* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#include "libvlc_internal.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <assert.h>
#include <vlc/libvlc.h>
+#include <vlc/libvlc_media.h>
+#include <vlc/libvlc_events.h>
+
#include <vlc_demux.h>
#include <vlc_input.h>
#include <vlc_vout.h>
+
#include "libvlc.h"
-#include <assert.h>
+
+#include "libvlc_internal.h"
+#include "media_internal.h" // libvlc_media_set_state()
+#include "media_player_internal.h"
static int
input_seekable_changed( vlc_object_t * p_this, char const * psz_cmd,
static int SnapshotTakenCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
-static const libvlc_state_t vlc_to_libvlc_state_array[] =
+static const enum libvlc_state_t vlc_to_libvlc_state_array[] =
{
[INIT_S] = libvlc_NothingSpecial,
[OPENING_S] = libvlc_Opening,
[ERROR_S] = libvlc_Error,
};
-static inline libvlc_state_t vlc_to_libvlc_state( int vlc_state )
+static enum libvlc_state_t vlc_to_libvlc_state( int vlc_state )
{
if( vlc_state < 0 || vlc_state > 6 )
return libvlc_Ended;
if( newval.i_int == INPUT_EVENT_STATE )
{
- libvlc_state_t libvlc_state;
+ enum libvlc_state_t libvlc_state;
switch ( var_GetInteger( p_input, "state" ) )
{
p_mi = malloc( sizeof(libvlc_media_player_t) );
if( !p_mi )
{
- libvlc_exception_raise( p_e, "Not enough memory" );
+ libvlc_exception_raise( p_e, "not enough memory" );
return NULL;
}
p_mi->p_md = NULL;
p_mi->drawable.agl = 0;
p_mi->drawable.xid = 0;
p_mi->drawable.hwnd = NULL;
+ p_mi->drawable.nsobject = NULL;
p_mi->p_libvlc_instance = p_libvlc_instance;
p_mi->p_input_thread = NULL;
p_mi->i_refcount = 1;
release_input_thread( p_mi, true );
libvlc_event_manager_release( p_mi->p_event_manager );
- if( p_mi->p_md )
- libvlc_media_release( p_mi->p_md );
+ libvlc_media_release( p_mi->p_md );
vlc_mutex_destroy( &p_mi->object_lock );
free( p_mi );
}
if( !p_input_thread )
return;
- libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+ enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
if( state == libvlc_Playing || state == libvlc_Buffering )
{
if( libvlc_media_player_can_pause( p_mi, p_e ) )
int libvlc_media_player_is_playing( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
- libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+ enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
return (libvlc_Playing == state) || (libvlc_Buffering == state);
}
void libvlc_media_player_stop( libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
- libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
+ enum libvlc_state_t state = libvlc_media_player_get_state( p_mi, p_e );
if( state == libvlc_Playing ||
state == libvlc_Paused ||
/**************************************************************************
* get_nsobject
**************************************************************************/
-uint32_t libvlc_media_player_get_nsobject( libvlc_media_player_t *p_mi )
+void * libvlc_media_player_get_nsobject( libvlc_media_player_t *p_mi )
{
return p_mi->drawable.nsobject;
}
return (float)1000.0f/val.i_int;
}
-libvlc_state_t libvlc_media_player_get_state(
+enum libvlc_state_t libvlc_media_player_get_state(
libvlc_media_player_t *p_mi,
libvlc_exception_t *p_e )
{
input_thread_t *p_input_thread;
- libvlc_state_t state = libvlc_Ended;
+ enum libvlc_state_t state;
vlc_value_t val;
p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
/* We do return the right value, no need to throw an exception */
if( libvlc_exception_raised( p_e ) )
libvlc_exception_clear( p_e );
- return state;
+ return libvlc_Ended;
}
var_Get( p_input_thread, "state", &val );
libvlc_exception_t *p_e )
{
input_thread_t *p_input = libvlc_get_input_thread( p_mi, p_e );
+ libvlc_track_description_t *p_track_description = NULL,
+ *p_actual, *p_previous;
if( !p_input )
return NULL;
vlc_value_t val_list, text_list;
var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list);
- if( val_list.p_list->i_count <= 0 ) /* no tracks */
- return NULL;
+ /* no tracks */
+ if( val_list.p_list->i_count <= 0 )
+ goto end;
- libvlc_track_description_t *p_track_description, *p_actual, *p_previous;
p_track_description = ( libvlc_track_description_t * )
malloc( sizeof( libvlc_track_description_t ) );
if ( !p_track_description )
{
- var_Change( p_input, psz_variable, VLC_VAR_FREELIST,
- &val_list, &text_list);
- vlc_object_release( p_input );
- libvlc_exception_raise( p_e, "no enough memory" );
- return NULL;
+ libvlc_exception_raise( p_e, "not enough memory" );
+ goto end;
}
p_actual = p_track_description;
p_previous = NULL;
if ( !p_actual )
{
libvlc_track_description_release( p_track_description );
- var_Change( p_input, psz_variable, VLC_VAR_FREELIST,
- &val_list, &text_list);
- vlc_object_release( p_input );
- libvlc_exception_raise( p_e, "no enough memory" );
- return NULL;
+ libvlc_exception_raise( p_e, "not enough memory" );
+ goto end;
}
}
p_actual->i_id = val_list.p_list->p_values[i].i_int;
p_previous = p_actual;
p_actual = NULL;
}
- var_Change( p_input, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list);
+
+end:
+ var_FreeList( &val_list, &text_list );
vlc_object_release( p_input );
return p_track_description;