X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fplaylist%2Fqtl.c;h=778608765b92e00f1a5cb418fa816534fb32748a;hb=d11fd0d1e5433a5299fbf0f0150178178ebd3f83;hp=792ed4dc66ee88cfb2e2ed17ab942d30376ca7ca;hpb=673861da5ce8bfeb0a4adbd5be95aa5fd2da9e4b;p=vlc diff --git a/modules/demux/playlist/qtl.c b/modules/demux/playlist/qtl.c index 792ed4dc66..778608765b 100644 --- a/modules/demux/playlist/qtl.c +++ b/modules/demux/playlist/qtl.c @@ -47,20 +47,20 @@ volume - 0 (mute) - 100 (max) /***************************************************************************** * Preamble *****************************************************************************/ -#include /* isspace() */ -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include "playlist.h" #include "vlc_xml.h" struct demux_sys_t { - playlist_t *p_playlist; - playlist_item_t *p_current; - playlist_item_t *p_item_in_category; + input_item_t *p_current_input; xml_t *p_xml; xml_reader_t *p_xml_reader; @@ -71,11 +71,11 @@ typedef enum { FULLSCREEN_NORMAL, FULLSCREEN_HALF, FULLSCREEN_CURRENT, FULLSCREEN_FULL } qtl_fullscreen_t; -char* ppsz_fullscreen[] = { "normal", "double", "half", "current", "full" }; +const char* ppsz_fullscreen[] = { "normal", "double", "half", "current", "full" }; typedef enum { LOOP_TRUE, LOOP_FALSE, LOOP_PALINDROME } qtl_loop_t; -char* ppsz_loop[] = { "true", "false", "palindrome" }; +const char* ppsz_loop[] = { "true", "false", "palindrome" }; /***************************************************************************** * Local prototypes @@ -86,10 +86,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ); /***************************************************************************** * Import_QTL: main import function *****************************************************************************/ -int E_(Import_QTL)( vlc_object_t *p_this ) +int Import_QTL( vlc_object_t *p_this ) { DEMUX_BY_EXTENSION_MSG( ".qtl", "using QuickTime Media Link reader" ); - p_demux->p_sys->p_playlist = NULL; p_demux->p_sys->p_xml = NULL; p_demux->p_sys->p_xml_reader = NULL; return VLC_SUCCESS; @@ -98,13 +97,11 @@ int E_(Import_QTL)( vlc_object_t *p_this ) /***************************************************************************** * Deactivate: frees unused data *****************************************************************************/ -void E_(Close_QTL)( vlc_object_t *p_this ) +void Close_QTL( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; demux_sys_t *p_sys = p_demux->p_sys; - if( p_sys->p_playlist ) - vlc_object_release( p_sys->p_playlist ); if( p_sys->p_xml_reader ) xml_ReaderDelete( p_sys->p_xml, p_sys->p_xml_reader ); if( p_sys->p_xml ) @@ -121,26 +118,24 @@ static int Demux( demux_t *p_demux ) input_item_t *p_input; /* List of all possible attributes. The only required one is "src" */ - vlc_bool_t b_autoplay = VLC_FALSE; - vlc_bool_t b_controler = VLC_TRUE; - qtl_fullscreen_t fullscreen = VLC_FALSE; + bool b_autoplay = false; + bool b_controler = true; + qtl_fullscreen_t fullscreen = false; char *psz_href = NULL; - vlc_bool_t b_kioskmode = VLC_FALSE; + bool b_kioskmode = false; qtl_loop_t loop = LOOP_FALSE; int i_movieid = -1; char *psz_moviename = NULL; - vlc_bool_t b_playeveryframe = VLC_FALSE; + bool b_playeveryframe = false; char *psz_qtnext = NULL; - vlc_bool_t b_quitwhendone = VLC_FALSE; + bool b_quitwhendone = false; char *psz_src = NULL; char *psz_mimetype = NULL; int i_volume = 100; INIT_PLAYLIST_STUFF; - p_sys->p_playlist = p_playlist; - p_sys->p_current = p_current; - p_sys->p_item_in_category = p_item_in_category; + p_sys->p_current_input = p_current_input; p_xml = p_sys->p_xml = xml_Create( p_demux ); if( !p_xml ) return -1; @@ -162,7 +157,7 @@ static int Demux( demux_t *p_demux ) { msg_Err( p_demux, "invalid root node %i, %s", xml_ReaderNodeType( p_xml_reader ), psz_eltname ); - FREE( psz_eltname ); + free( psz_eltname ); /* second line has p_xml_reader ) == VLC_SUCCESS ) { @@ -186,8 +181,8 @@ static int Demux( demux_t *p_demux ) if( !psz_attrname || !psz_attrvalue ) { - FREE( psz_attrname ); - FREE( psz_attrvalue ); + free( psz_attrname ); + free( psz_attrvalue ); return -1; } @@ -195,22 +190,22 @@ static int Demux( demux_t *p_demux ) { if( !strcmp( psz_attrvalue, "true" ) ) { - b_autoplay = VLC_TRUE; + b_autoplay = true; } else { - b_autoplay = VLC_FALSE; + b_autoplay = false; } } else if( !strcmp( psz_attrname, "controler" ) ) { if( !strcmp( psz_attrvalue, "false" ) ) { - b_controler = VLC_FALSE; + b_controler = false; } else { - b_controler = VLC_TRUE; + b_controler = true; } } else if( !strcmp( psz_attrname, "fullscreen" ) ) @@ -245,11 +240,11 @@ static int Demux( demux_t *p_demux ) { if( !strcmp( psz_attrvalue, "true" ) ) { - b_kioskmode = VLC_TRUE; + b_kioskmode = true; } else { - b_kioskmode = VLC_FALSE; + b_kioskmode = false; } } else if( !strcmp( psz_attrname, "loop" ) ) @@ -280,11 +275,11 @@ static int Demux( demux_t *p_demux ) { if( !strcmp( psz_attrvalue, "true" ) ) { - b_playeveryframe = VLC_TRUE; + b_playeveryframe = true; } else { - b_playeveryframe = VLC_FALSE; + b_playeveryframe = false; } } else if( !strcmp( psz_attrname, "qtnext" ) ) @@ -296,11 +291,11 @@ static int Demux( demux_t *p_demux ) { if( !strcmp( psz_attrvalue, "true" ) ) { - b_quitwhendone = VLC_TRUE; + b_quitwhendone = true; } else { - b_quitwhendone = VLC_FALSE; + b_quitwhendone = false; } } else if( !strcmp( psz_attrname, "src" ) ) @@ -322,27 +317,27 @@ static int Demux( demux_t *p_demux ) msg_Dbg( p_demux, "Attribute %s with value %s isn't valid", psz_attrname, psz_attrvalue ); } - FREE( psz_attrname ); - FREE( psz_attrvalue ); + free( psz_attrname ); + free( psz_attrvalue ); } msg_Dbg( p_demux, "autoplay: %s (unused by VLC)", - b_autoplay==VLC_TRUE ? "true": "false" ); + b_autoplay==true ? "true": "false" ); msg_Dbg( p_demux, "controler: %s (unused by VLC)", - b_controler==VLC_TRUE?"true": "false" ); + b_controler==true?"true": "false" ); msg_Dbg( p_demux, "fullscreen: %s (unused by VLC)", ppsz_fullscreen[fullscreen] ); msg_Dbg( p_demux, "href: %s", psz_href ); msg_Dbg( p_demux, "kioskmode: %s (unused by VLC)", - b_kioskmode==VLC_TRUE?"true":"false" ); + b_kioskmode==true?"true":"false" ); msg_Dbg( p_demux, "loop: %s (unused by VLC)", ppsz_loop[loop] ); msg_Dbg( p_demux, "movieid: %d (unused by VLC)", i_movieid ); msg_Dbg( p_demux, "moviename: %s", psz_moviename ); msg_Dbg( p_demux, "playeverframe: %s (unused by VLC)", - b_playeveryframe==VLC_TRUE?"true":"false" ); + b_playeveryframe==true?"true":"false" ); msg_Dbg( p_demux, "qtnext: %s", psz_qtnext ); msg_Dbg( p_demux, "quitwhendone: %s (unused by VLC)", - b_quitwhendone==VLC_TRUE?"true":"false" ); + b_quitwhendone==true?"true":"false" ); msg_Dbg( p_demux, "src: %s", psz_src ); msg_Dbg( p_demux, "mimetype: %s", psz_mimetype ); msg_Dbg( p_demux, "volume: %d (unused by VLC)", i_volume ); @@ -354,39 +349,36 @@ static int Demux( demux_t *p_demux ) } else { - p_input = input_ItemNewExt( p_sys->p_playlist, + p_input = input_item_NewExt( p_demux, psz_src, psz_moviename, 0, NULL, -1 ); -#define SADD_INFO( type, field ) if( field ) { input_ItemAddInfo( \ +#define SADD_INFO( type, field ) if( field ) { input_item_AddInfo( \ p_input, "QuickTime Media Link", _(type), "%s", field ) ; } SADD_INFO( "href", psz_href ); SADD_INFO( "mime type", psz_mimetype ); - playlist_BothAddInput( p_sys->p_playlist, p_input, - p_sys->p_item_in_category, PLAYLIST_APPEND, - PLAYLIST_END ); + input_item_AddSubItem( p_current_input, p_input ); + vlc_gc_decref( p_input ); if( psz_qtnext ) { - p_input = input_ItemNewExt( p_sys->p_playlist, + p_input = input_item_NewExt( p_demux, psz_qtnext, NULL, 0, NULL, -1 ); - playlist_BothAddInput( p_sys->p_playlist, p_input, - p_sys->p_item_in_category, - PLAYLIST_APPEND, PLAYLIST_END ); + input_item_AddSubItem( p_current_input, p_input ); + vlc_gc_decref( p_input ); } } HANDLE_PLAY_AND_RELEASE; - p_sys->p_playlist = NULL; - - FREE( psz_href ); - FREE( psz_moviename ); - FREE( psz_qtnext ); - FREE( psz_src ); - FREE( psz_mimetype ); + free( psz_href ); + free( psz_moviename ); + free( psz_qtnext ); + free( psz_src ); + free( psz_mimetype ); - return VLC_SUCCESS; + return 0; /* Needed for correct operation of go back */ } static int Control( demux_t *p_demux, int i_query, va_list args ) { + VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args); return VLC_EGENERIC; }