Commit 75c556ad authored by Pierre's avatar Pierre
Browse files

demux playlist: Move the usage of vlc_object_find behind one function.

parent 279339a6
......@@ -234,7 +234,7 @@ static int Demux( demux_t *p_demux )
char *psz_parse = NULL;
char *psz_backup = NULL;
bool b_entry = false;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
/* init txt */
if( p_sys->i_data_len < 0 )
......@@ -710,7 +710,7 @@ static int Demux( demux_t *p_demux )
STARTMARK
#endif
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
char *psz_mrl = NULL, *psz_name = NULL, *psz_genre = NULL;
char *psz_now = NULL, *psz_listeners = NULL, *psz_bitrate = NULL;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = p_sys->p_xml = xml_Create( p_demux );
if( !p_xml ) return -1;
......@@ -295,7 +295,7 @@ static int Demux( demux_t *p_demux )
free( psz_elname );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -101,7 +101,7 @@ static int Demux( demux_t *p_demux )
{
char *psz_line;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
while( (psz_line = stream_ReadLine( p_demux->s )) )
{
......@@ -131,7 +131,7 @@ static int Demux( demux_t *p_demux )
free( psz_line );
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -129,7 +129,7 @@ static int Demux( demux_t *p_demux )
char *psz_description = NULL;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_sys->p_current_input = p_current_input;
......@@ -212,7 +212,7 @@ static int Demux( demux_t *p_demux )
vlc_gc_decref( p_input );
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
free( psz_version );
free( psz_url );
......
......@@ -88,7 +88,7 @@ static int Demux( demux_t *p_demux )
size_t len = 0;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
len = strlen( "dvd://" ) + strlen( p_demux->psz_path )
- strlen( "VIDEO_TS.IFO" );
......@@ -99,7 +99,7 @@ static int Demux( demux_t *p_demux )
input_item_AddSubItem( p_current_input, p_input );
vlc_gc_decref( p_input );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -71,7 +71,7 @@ int Demux( demux_t *p_demux )
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_demux->p_sys->i_ntracks = 0;
/* create new xml parser from stream */
......@@ -106,7 +106,7 @@ int Demux( demux_t *p_demux )
parse_plist_node( p_demux, p_current_input, NULL, p_xml_reader, "plist",
pl_elements );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
end:
free( psz_name );
......
......@@ -148,7 +148,7 @@ static int Demux( demux_t *p_demux )
bool b_cleanup = false;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
psz_line = stream_ReadLine( p_demux->s );
while( psz_line )
......@@ -249,7 +249,7 @@ static int Demux( demux_t *p_demux )
b_cleanup = false;
}
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
}
......
......@@ -165,6 +165,14 @@ vlc_module_begin ()
set_callbacks( Import_ZPL, Close_ZPL )
vlc_module_end ()
input_item_t * GetCurrentItem(demux_t *p_demux)
{
input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT );;
input_item_t *p_current_input = input_GetItem( p_input_thread );
vlc_gc_incref(p_current_input);
vlc_object_release(p_input_thread);
return p_current_input;
}
/**
* Find directory part of the path to the playlist file, in case of
......
......@@ -22,6 +22,7 @@
*****************************************************************************/
#include <vlc_input.h>
#include <vlc_playlist.h>
char *ProcessMRL( char *, char * );
char *FindPrefix( demux_t * );
......@@ -82,13 +83,7 @@ void Close_WPL ( vlc_object_t * );
int Import_ZPL ( vlc_object_t * );
void Close_ZPL ( vlc_object_t * );
#define INIT_PLAYLIST_STUFF \
input_thread_t *p_input_thread = (input_thread_t *)vlc_object_find( p_demux, VLC_OBJECT_INPUT, FIND_PARENT ); \
input_item_t *p_current_input = input_GetItem( p_input_thread );
#define HANDLE_PLAY_AND_RELEASE \
vlc_object_release( p_input_thread );
extern input_item_t * GetCurrentItem(demux_t *p_demux);
#define STANDARD_DEMUX_INIT_MSG( msg ) do { \
DEMUX_INIT_COMMON(); \
......
......@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
int i_key_length;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
......@@ -228,7 +228,7 @@ static int Demux( demux_t *p_demux )
free( psz_name );
psz_name = NULL;
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -91,7 +91,7 @@ static int Demux( demux_t *p_demux )
int i_type;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
......@@ -363,7 +363,7 @@ static int Demux( demux_t *p_demux )
xml_ReaderDelete( p_xml, p_xml_reader );
xml_Delete( p_xml );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
error:
......@@ -386,7 +386,7 @@ error:
if( p_xml )
xml_Delete( p_xml );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return -1;
}
......
......@@ -124,7 +124,7 @@ static int Demux( demux_t *p_demux )
char *psz_mimetype = NULL;
int i_volume = 100;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
......@@ -327,7 +327,7 @@ error:
if( p_xml )
xml_Delete( p_xml );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
free( psz_href );
free( psz_moviename );
......
......@@ -214,7 +214,7 @@ static int Demux( demux_t *p_demux )
bool b_cleanup = false;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
psz_line = stream_ReadLine( p_demux->s );
while( psz_line )
......@@ -360,7 +360,7 @@ static int Demux( demux_t *p_demux )
b_cleanup = false;
}
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "m3u-extvlcopt" );
return 0; /* Needed for correct operation of go back */
}
......
......@@ -324,7 +324,7 @@ static int Demux ( demux_t *p_demux )
input_item_t *p_child = NULL;
char *psz_line;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
while( ( psz_line = stream_ReadLine( p_demux->s ) ) )
{
......@@ -404,7 +404,7 @@ static int Demux ( demux_t *p_demux )
input_item_AddSubItem( p_current_input, p_child );
vlc_gc_decref( p_child );
HANDLE_PLAY_AND_RELEASE
vlc_gc_decref(p_current_input);
return 0; /* Needed for correct operation of go back */
}
......
......@@ -83,7 +83,7 @@ static int Demux( demux_t *p_demux )
xml_reader_t *p_xml_reader = NULL;
char *psz_eltname = NULL;
int i_ret = -1;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_xml = xml_Create( p_demux );
if( !p_xml )
......@@ -132,7 +132,7 @@ error:
if( p_xml )
xml_Delete( p_xml );
free( psz_eltname );
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
return i_ret;
}
......
......@@ -93,7 +93,7 @@ static int Demux( demux_t *p_demux )
char *psz_parse;
input_item_t *p_input;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
psz_line = stream_ReadLine( p_demux->s );
while( psz_line )
......@@ -124,7 +124,7 @@ static int Demux( demux_t *p_demux )
psz_line = stream_ReadLine( p_demux->s );
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "wpl-extvlcopt" );
return 0; /* Needed for correct operation of go back */
}
......
......@@ -83,7 +83,7 @@ int Demux( demux_t *p_demux )
xml_t *p_xml = NULL;
xml_reader_t *p_xml_reader = NULL;
char *psz_name = NULL;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
p_demux->p_sys->pp_tracklist = NULL;
p_demux->p_sys->i_tracklist_entries = 0;
p_demux->p_sys->i_track_id = -1;
......@@ -130,7 +130,7 @@ int Demux( demux_t *p_demux )
}
end:
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
if( p_xml_reader )
xml_ReaderDelete( p_xml, p_xml_reader );
if( p_xml )
......
......@@ -97,7 +97,7 @@ static int Demux( demux_t *p_demux )
*psz_description = NULL, *psz_url = NULL, *psz_copyright = NULL,
*psz_mrl = NULL;
INIT_PLAYLIST_STUFF;
input_item_t *p_current_input = GetCurrentItem(p_demux);
psz_line = stream_ReadLine( p_demux->s );
char *psz_parse = psz_line;
......@@ -212,7 +212,7 @@ static int Demux( demux_t *p_demux )
psz_line = stream_ReadLine( p_demux->s );
}
HANDLE_PLAY_AND_RELEASE;
vlc_gc_decref(p_current_input);
var_Destroy( p_demux, "zpl-extvlcopt" );
return 0; /* Needed for correct operation of go back */
}
......
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