[vlc-commits] macosx: polish the start/ stop time fields by allowing a more sane syntax than plain seconds

Felix Paul Kühne git at videolan.org
Tue Aug 14 14:14:23 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Tue Aug 14 14:14:19 2012 +0200| [10cb2dcac816767596c6287f0d36e0d744ef2e7d] | committer: Felix Paul Kühne

macosx: polish the start/stop time fields by allowing a more sane syntax than plain seconds

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=10cb2dcac816767596c6287f0d36e0d744ef2e7d
---

 modules/gui/macosx/open.m |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/open.m b/modules/gui/macosx/open.m
index 9bd062c..c8261a7 100644
--- a/modules/gui/macosx/open.m
+++ b/modules/gui/macosx/open.m
@@ -455,10 +455,27 @@ static VLCOpen *_o_sharedMainInstance = nil;
                     p_item->pi_list[[o_file_sub_size_pop indexOfSelectedItem]]]];
             }
         }
-        if ([o_file_starttime_fld intValue] > 0)
-            [o_options addObject: [NSString stringWithFormat:@"start-time=%@", [o_file_starttime_fld stringValue]]];
-        if ([o_file_stoptime_fld intValue] > 0)
-            [o_options addObject: [NSString stringWithFormat:@"stop-time=%@", [o_file_stoptime_fld stringValue]]];
+        NSArray * components = [[o_file_starttime_fld stringValue] componentsSeparatedByString:@":"];
+        NSUInteger componentCount = [components count];
+        NSInteger tempValue;
+        if( componentCount == 1 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] );
+        else if( componentCount == 2 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue] );
+        else if( componentCount == 3 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue] );
+        if (tempValue > 0)
+            [o_options addObject: [NSString stringWithFormat:@"start-time=%li", tempValue]];
+        components = [[o_file_stoptime_fld stringValue] componentsSeparatedByString:@":"];
+        componentCount = [components count];
+        if( componentCount == 1 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] );
+        else if( componentCount == 2 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 60 + [[components objectAtIndex:1] intValue] );
+        else if( componentCount == 3 )
+            tempValue = 1000000 * ( [[components objectAtIndex:0] intValue] * 3600 + [[components objectAtIndex:1] intValue] * 60 + [[components objectAtIndex:2] intValue] );
+        if (tempValue > 0)
+            [o_options addObject: [NSString stringWithFormat:@"stop-time=%li", tempValue]];
         if( [o_output_ckbox state] == NSOnState )
         {
             NSUInteger count = [[o_sout_options mrl] count];



More information about the vlc-commits mailing list