Commit 021b9f25 authored by David Fuhrmann's avatar David Fuhrmann

macosx: show current pos and remaining or total time in fs controller

parent 18d11128
...@@ -146,7 +146,6 @@ ...@@ -146,7 +146,6 @@
- (void)updateVolumeSlider; - (void)updateVolumeSlider;
- (void)updateControls; - (void)updateControls;
- (void)updatePosAndTimeInFSPanel:(VLCFSPanel *)o_fspanel;
@end @end
...@@ -988,9 +988,4 @@ else \ ...@@ -988,9 +988,4 @@ else \
[[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control]; [[VLCMainMenu sharedInstance] setRateControlsEnabled: b_control];
} }
- (void)updatePosAndTimeInFSPanel:(VLCFSPanel *)o_fspanel
{
[o_fspanel setStreamPos:[o_time_sld floatValue] andTime: [o_time_fld stringValue]];
}
@end @end
...@@ -608,7 +608,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -608,7 +608,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)updateTimeSlider - (void)updateTimeSlider
{ {
[o_controls_bar updateTimeSlider]; [o_controls_bar updateTimeSlider];
[[self controlsBar] updatePosAndTimeInFSPanel:o_fspanel]; [o_fspanel updatePositionAndTime];
[[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)]; [[[VLCMain sharedInstance] voutController] updateWindowsControlsBarWithSelector:@selector(updateTimeSlider)];
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
- (void)setPlay; - (void)setPlay;
- (void)setPause; - (void)setPause;
- (void)setStreamTitle: (NSString *)o_title; - (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time; - (void)updatePositionAndTime;
- (void)setSeekable: (BOOL)b_seekable; - (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (int)i_volumeLevel; - (void)setVolumeLevel: (int)i_volumeLevel;
...@@ -83,7 +83,8 @@ ...@@ -83,7 +83,8 @@
{ {
NSColor *fillColor; NSColor *fillColor;
NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen; NSButton *o_prev, *o_next, *o_bwd, *o_fwd, *o_play, *o_fullscreen;
NSTextField *o_streamTitle_txt, *o_streamPosition_txt; NSTextField *o_streamTitle_txt;
VLCTimeField *o_streamPosition_txt, *o_streamLength_txt;
NSSlider *o_fs_timeSlider, *o_fs_volumeSlider; NSSlider *o_fs_timeSlider, *o_fs_volumeSlider;
VLCProgressView *o_progress_view; VLCProgressView *o_progress_view;
NSImage *o_background_img, *o_vol_sld_img, *o_vol_mute_img, *o_vol_max_img, *o_time_sld_img; NSImage *o_background_img, *o_vol_sld_img, *o_vol_mute_img, *o_vol_max_img, *o_time_sld_img;
...@@ -96,7 +97,7 @@ ...@@ -96,7 +97,7 @@
- (void)setPlay; - (void)setPlay;
- (void)setPause; - (void)setPause;
- (void)setStreamTitle: (NSString *)o_title; - (void)setStreamTitle: (NSString *)o_title;
- (void)setStreamPos: (float)f_pos andTime: (NSString *)o_time; - (void)updatePositionAndTime;
- (void)setSeekable: (BOOL)b_seekable; - (void)setSeekable: (BOOL)b_seekable;
- (void)setVolumeLevel: (int)i_volumeLevel; - (void)setVolumeLevel: (int)i_volumeLevel;
- (IBAction)play:(id)sender; - (IBAction)play:(id)sender;
......
...@@ -154,9 +154,9 @@ ...@@ -154,9 +154,9 @@
[[self contentView] setStreamTitle: o_title]; [[self contentView] setStreamTitle: o_title];
} }
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time - (void)updatePositionAndTime
{ {
[[self contentView] setStreamPos:f_pos andTime: o_time]; [[self contentView] updatePositionAndTime];
} }
- (void)setSeekable:(BOOL) b_seekable - (void)setSeekable:(BOOL) b_seekable
...@@ -458,15 +458,20 @@ ...@@ -458,15 +458,20 @@
/* time counter and stream title output fields */ /* time counter and stream title output fields */
s_rc = [self frame]; s_rc = [self frame];
s_rc.origin.x = 98; // 10 px gap between time fields
s_rc.origin.x = 90;
s_rc.origin.y = 64; s_rc.origin.y = 64;
s_rc.size.width = 352; s_rc.size.width = 361;
s_rc.size.height = 14; s_rc.size.height = 14;
addTextfield(NSTextField, o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor); addTextfield(NSTextField, o_streamTitle_txt, NSCenterTextAlignment, systemFontOfSize, whiteColor);
s_rc.origin.x = 15;
s_rc.origin.y = 64;
s_rc.size.width = 65;
addTextfield(VLCTimeField, o_streamPosition_txt, NSLeftTextAlignment, systemFontOfSize, whiteColor);
s_rc.origin.x = 471; s_rc.origin.x = 471;
s_rc.origin.y = 64; s_rc.origin.y = 64;
s_rc.size.width = 65; s_rc.size.width = 65;
addTextfield(VLCTimeField, o_streamPosition_txt, NSRightTextAlignment, systemFontOfSize, whiteColor); addTextfield(VLCTimeField, o_streamLength_txt, NSRightTextAlignment, systemFontOfSize, whiteColor);
o_background_img = [[NSImage imageNamed:@"fs_background"] retain]; o_background_img = [[NSImage imageNamed:@"fs_background"] retain];
o_vol_sld_img = [[NSImage imageNamed:@"fs_volume_slider_bar"] retain]; o_vol_sld_img = [[NSImage imageNamed:@"fs_volume_slider_bar"] retain];
...@@ -514,10 +519,54 @@ ...@@ -514,10 +519,54 @@
[o_streamTitle_txt setStringValue: o_title]; [o_streamTitle_txt setStringValue: o_title];
} }
- (void)setStreamPos:(float) f_pos andTime:(NSString *)o_time - (void)updatePositionAndTime
{ {
[o_streamPosition_txt setStringValue: o_time]; input_thread_t * p_input;
[o_fs_timeSlider setFloatValue: f_pos]; p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
vlc_value_t pos;
float f_updated;
var_Get(p_input, "position", &pos);
f_updated = 10000. * pos.f_float;
[o_fs_timeSlider setFloatValue: f_updated];
vlc_value_t time;
char psz_time[MSTRTIME_MAX_SIZE];
var_Get(p_input, "time", &time);
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
// update total duration (right field)
if(dur <= 0) {
[o_streamLength_txt setHidden: YES];
} else {
[o_streamLength_txt setHidden: NO];
NSString *o_total_time;
if ([o_streamLength_txt timeRemaining]) {
mtime_t remaining = 0;
if (dur > time.i_time)
remaining = dur - time.i_time;
o_total_time = [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
} else
o_total_time = [NSString stringWithUTF8String: secstotimestr(psz_time, (dur / 1000000))];
[o_streamLength_txt setStringValue: o_total_time];
}
// update current position (left field)
NSString *o_playback_pos = [NSString stringWithUTF8String: secstotimestr(psz_time, (time.i_time / 1000000))];
[o_streamPosition_txt setStringValue: o_playback_pos];
vlc_object_release(p_input);
} else {
[o_fs_timeSlider setFloatValue: 0.0];
[o_streamPosition_txt setStringValue: @"00:00"];
[o_streamLength_txt setHidden: YES];
}
} }
- (void)setSeekable:(BOOL)b_seekable - (void)setSeekable:(BOOL)b_seekable
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment