#include "interaction.h"
#include "embeddedwindow.h"
#include "update.h"
+#include "AppleRemote.h"
/*****************************************************************************
* Local prototypes.
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t * p_intf = VLCIntf;
- p_intf->p_sys->b_playlist_update = TRUE;
- p_intf->p_sys->b_intf_update = TRUE;
- p_intf->p_sys->b_playmode_update = TRUE;
+ p_intf->p_sys->b_playlist_update = VLC_TRUE;
+ p_intf->p_sys->b_intf_update = VLC_TRUE;
+ p_intf->p_sys->b_playmode_update = VLC_TRUE;
+ return VLC_SUCCESS;
+}
+
+/*****************************************************************************
+ * ShowController: Callback triggered by the show-intf playlist variable
+ * through the ShowIntf-control-intf, to let us show the controller-win;
+ * usually when in fullscreen-mode
+ *****************************************************************************/
+static int ShowController( vlc_object_t *p_this, const char *psz_variable,
+ vlc_value_t old_val, vlc_value_t new_val, void *param )
+{
+ intf_thread_t * p_intf = VLCIntf;
+ p_intf->p_sys->b_intf_show = VLC_TRUE;
return VLC_SUCCESS;
}
vlc_value_t old_val, vlc_value_t new_val, void *param )
{
intf_thread_t * p_intf = VLCIntf;
- p_intf->p_sys->b_fullscreen_update = TRUE;
+ p_intf->p_sys->b_fullscreen_update = VLC_TRUE;
return VLC_SUCCESS;
}
o_update = [[VLCUpdate alloc] init];
i_lastShownVolume = -1;
+
+ o_remote = [[AppleRemote alloc] init];
+ [o_remote setDelegate: _o_sharedMainInstance];
+
return _o_sharedMainInstance;
}
val.b_bool = VLC_FALSE;
var_AddCallback( p_playlist, "fullscreen", FullscreenChanged, self);
+ var_AddCallback( p_playlist, "intf-show", ShowController, self);
[o_embedded_window setFullscreen: var_GetBool( p_playlist,
"fullscreen" )];
if( psz != NULL )
{
o_str = [[[NSString alloc] initWithUTF8String: psz] autorelease];
+
+ if ( o_str == NULL )
+ {
+ msg_Err( VLCIntf, "could not translate: %s", psz );
+ return( @"" );
+ }
}
- if ( o_str == NULL )
+ else
{
- msg_Err( VLCIntf, "could not translate: %s", psz );
+ msg_Warn( VLCIntf, "can't translate empty strings" );
+ return( @"" );
}
return( o_str );
}
+/* Listen to the remote in exclusive mode, only when VLC is the active
+ application */
+- (void)applicationDidBecomeActive:(NSNotification *)aNotification
+{
+ [o_remote startListening: self];
+}
+- (void)applicationDidResignActive:(NSNotification *)aNotification
+{
+ [o_remote stopListening: self];
+}
+
+/* Apple Remote callback */
+- (void)appleRemoteButton:(AppleRemoteEventIdentifier)buttonIdentifier
+ pressedDown:(BOOL)pressedDown
+{
+ switch( buttonIdentifier )
+ {
+ case kRemoteButtonPlay:
+ [o_controls play: self];
+ break;
+ case kRemoteButtonVolume_Plus:
+ [o_controls volumeUp: self];
+ break;
+ case kRemoteButtonVolume_Minus:
+ [o_controls volumeDown: self];
+ break;
+
+ default:
+ /* Add here whatever you want other buttons to do */
+ break;
+ }
+}
+
- (char *)delocalizeString:(NSString *)id
{
NSData * o_data = [id dataUsingEncoding: NSUTF8StringEncoding
return nil;
}
+- (id)getMainIntfPgbar
+{
+ if( o_main_pgbar )
+ return o_main_pgbar;
+
+ msg_Err( p_intf, "main interface progress bar item wasn't found" );
+ return nil;
+}
+
+- (id)getMainScrollField
+{
+ if( o_scrollfield )
+ return o_scrollfield;
+
+ msg_Err( p_intf, "main scroll field item wasn't found" );
+ return nil;
+}
+
+- (id)getControllerWindow
+{
+ if( o_window )
+ return o_window;
+ return nil;
+}
+
- (void)manage
{
playlist_t * p_playlist;
return;
}
-#define p_input p_intf->p_sys->p_input
if( p_intf->p_sys->b_input_update )
{
/* Called when new input is opened */
vlc_object_release( p_playlist );
- if( ( b_input = ( p_input != NULL ) ) )
+ if( ( b_input = ( p_intf->p_sys->p_input != NULL ) ) )
{
+ vlc_object_yield( p_intf->p_sys->p_input );
/* seekable streams */
- var_Get( p_input, "seekable", &val);
- b_seekable = val.b_bool;
+ b_seekable = var_GetBool( p_intf->p_sys->p_input, "seekable" );
/* check wether slow/fast motion is possible*/
- b_control = p_input->input.b_can_pace_control;
+ b_control = p_intf->p_sys->p_input->input.b_can_pace_control;
/* chapters & titles */
- //b_chapters = p_input->stream.i_area_nb > 1;
+ //b_chapters = p_intf->p_sys->p_input->stream.i_area_nb > 1;
+ vlc_object_release( p_intf->p_sys->p_input );
}
[o_btn_stop setEnabled: b_input];
p_intf->p_sys->b_fullscreen_update = VLC_FALSE;
}
- if( p_input && !p_input->b_die )
+ if( p_intf->p_sys->b_intf_show )
+ {
+ [o_window makeKeyAndOrderFront: self];
+
+ p_intf->p_sys->b_intf_show = VLC_FALSE;
+ }
+
+ if( p_intf->p_sys->p_input && !p_intf->p_sys->p_input->b_die )
{
vlc_value_t val;
return;
}
o_temp = [NSString stringWithUTF8String:
- p_playlist->status.p_item->input.psz_name];
+ p_playlist->status.p_item->p_input->psz_name];
if( o_temp == NULL )
o_temp = [NSString stringWithCString:
- p_playlist->status.p_item->input.psz_name];
+ p_playlist->status.p_item->p_input->psz_name];
[self setScrollField: o_temp stopAfter:-1];
- p_vout = vlc_object_find( p_input, VLC_OBJECT_VOUT,
+ p_vout = vlc_object_find( p_intf->p_sys->p_input, VLC_OBJECT_VOUT,
FIND_PARENT );
if( p_vout != NULL )
{
p_intf->p_sys->b_current_title_update = FALSE;
}
- if( p_input && [o_timeslider isEnabled] )
+ if( p_intf->p_sys->p_input && [o_timeslider isEnabled] )
{
/* Update the slider */
vlc_value_t time;
vlc_value_t pos;
float f_updated;
- var_Get( p_input, "position", &pos );
+ var_Get( p_intf->p_sys->p_input, "position", &pos );
f_updated = 10000. * pos.f_float;
[o_timeslider setFloatValue: f_updated];
- var_Get( p_input, "time", &time );
+ var_Get( p_intf->p_sys->p_input, "time", &time );
i_seconds = time.i_time / 1000000;
o_time = [NSString stringWithFormat: @"%d:%02d:%02d",
}
/* Manage Playing status */
- var_Get( p_input, "state", &val );
+ var_Get( p_intf->p_sys->p_input, "state", &val );
if( p_intf->p_sys->i_play_status != val.i_int )
{
p_intf->p_sys->i_play_status = val.i_int;
[self setSubmenusEnabled: FALSE];
}
-#undef p_input
[self updateMessageArray];
{
vlc_object_t * p_dec_obj;
- [o_controls setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)[VLCVoutView getRealVout: p_vout]
+ [o_controls setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)p_vout
var: "aspect-ratio" selector: @selector(toggleVar:)];
- [o_controls setupVarMenuItem: o_mi_crop target: (vlc_object_t *)[VLCVoutView getRealVout: p_vout]
+ [o_controls setupVarMenuItem: o_mi_crop target: (vlc_object_t *) p_vout
var: "crop" selector: @selector(toggleVar:)];
[o_controls setupVarMenuItem: o_mi_screen target: (vlc_object_t *)p_vout
- (void)resetScrollField
{
i_end_scroll = -1;
-#define p_input p_intf->p_sys->p_input
- if( p_input && !p_input->b_die )
+ if( p_intf->p_sys->p_input && !p_intf->p_sys->p_input->b_die )
{
NSString *o_temp;
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
return;
}
o_temp = [NSString stringWithUTF8String:
- p_playlist->status.p_item->input.psz_name];
+ p_playlist->status.p_item->p_input->psz_name];
if( o_temp == NULL )
o_temp = [NSString stringWithCString:
- p_playlist->status.p_item->input.psz_name];
+ p_playlist->status.p_item->p_input->psz_name];
[self setScrollField: o_temp stopAfter:-1];
vlc_object_release( p_playlist );
return;
}
-#undef p_input
[self setScrollField: _NS("VLC media player") stopAfter:-1];
}