vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Mon May 22 20:10:19 2017 +0300| [7fd804acc413dc4f0fdc750c9e892385ec24e959] | committer: Rémi Denis-Courmont
ram: convert to stream filter > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7fd804acc413dc4f0fdc750c9e892385ec24e959 --- modules/demux/playlist/playlist.c | 3 +-- modules/demux/playlist/ram.c | 38 ++++++++++++++------------------------ 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c index fef72a7215..76ddb6ddc4 100644 --- a/modules/demux/playlist/playlist.c +++ b/modules/demux/playlist/playlist.c @@ -70,8 +70,7 @@ vlc_module_begin () set_callbacks( Import_M3U, Close_M3U ) add_submodule () set_description( N_("RAM playlist import") ) - add_shortcut( "playlist", "ram-open" ) - set_capability( "demux", 10 ) + set_capability( "stream_filter", 10 ) set_callbacks( Import_RAM, NULL ) add_submodule () set_description( N_("PLS playlist import") ) diff --git a/modules/demux/playlist/ram.c b/modules/demux/playlist/ram.c index 2346ed50fb..322ba2a744 100644 --- a/modules/demux/playlist/ram.c +++ b/modules/demux/playlist/ram.c @@ -50,7 +50,7 @@ http://service.real.com/help/library/guides/realone/IntroGuide/HTML/htmfiles/ram #include <ctype.h> #include <vlc_common.h> -#include <vlc_demux.h> +#include <vlc_access.h> #include <vlc_url.h> #include <vlc_charset.h> @@ -59,7 +59,7 @@ http://service.real.com/help/library/guides/realone/IntroGuide/HTML/htmfiles/ram /***************************************************************************** * Local prototypes *****************************************************************************/ -static int Demux( demux_t *p_demux); +static int ReadDir( stream_t *, input_item_node_t * ); static void ParseClipInfo( const char * psz_clipinfo, char **ppsz_artist, char **ppsz_title, char **ppsz_album, char **ppsz_genre, char **ppsz_year, char **ppsz_cdnum, char **ppsz_comments ); @@ -71,16 +71,16 @@ static void ParseClipInfo( const char * psz_clipinfo, char **ppsz_artist, char * */ int Import_RAM( vlc_object_t *p_this ) { - demux_t *p_demux = (demux_t *)p_this; + stream_t *p_demux = (stream_t *)p_this; const uint8_t *p_peek; CHECK_FILE(p_demux); - if( !demux_IsPathExtension( p_demux, ".ram" ) - && !demux_IsPathExtension( p_demux, ".rm" ) ) + if( !stream_HasExtension( p_demux, ".ram" ) + && !stream_HasExtension( p_demux, ".rm" ) ) return VLC_EGENERIC; /* Many Real Media Files are misdetected */ - if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) + if( vlc_stream_Peek( p_demux->p_source, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; if( !memcmp( p_peek, ".ra", 3 ) || !memcmp( p_peek, ".RMF", 4 ) ) { @@ -88,8 +88,8 @@ int Import_RAM( vlc_object_t *p_this ) } msg_Dbg( p_demux, "found valid RAM playlist" ); - p_demux->pf_demux = Demux; - p_demux->pf_control = Control; + p_demux->pf_readdir = ReadDir; + p_demux->pf_control = access_vaDirectoryControlHelper; return VLC_SUCCESS; } @@ -193,15 +193,11 @@ static int ParseTime( const char *s, size_t i_strlen) return result; } -/** - * Main demux callback function - * @param p_demux: this demux object - */ -static int Demux( demux_t *p_demux ) +static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems ) { - char *psz_prefix = FindPrefix( p_demux ); + const char *psz_prefix = p_demux->psz_url; if( unlikely(psz_prefix == NULL) ) - return VLC_DEMUXER_EOF; + return VLC_SUCCESS; char *psz_line; char *psz_artist = NULL, *psz_album = NULL, *psz_genre = NULL, *psz_year = NULL; @@ -212,11 +208,7 @@ static int Demux( demux_t *p_demux ) bool b_cleanup = false; input_item_t *p_input; - input_item_t *p_current_input = GetCurrentItem(p_demux); - - input_item_node_t *p_subitems = input_item_node_Create( p_current_input ); - - psz_line = vlc_stream_ReadLine( p_demux->s ); + psz_line = vlc_stream_ReadLine( p_demux->p_source ); while( psz_line ) { char *psz_parse = psz_line; @@ -354,7 +346,7 @@ static int Demux( demux_t *p_demux ) error: /* Fetch another line */ free( psz_line ); - psz_line = vlc_stream_ReadLine( p_demux->s ); + psz_line = vlc_stream_ReadLine( p_demux->p_source ); if( !psz_line ) b_cleanup = true; if( b_cleanup ) @@ -378,9 +370,7 @@ static int Demux( demux_t *p_demux ) b_cleanup = false; } } - input_item_node_PostAndDelete( p_subitems ); - free(psz_prefix); - return 0; /* Needed for correct operation of go back */ + return VLC_SUCCESS; } /** _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
