[vlc-commits] dvb: demux: generate uri
Francois Cartegnie
git at videolan.org
Sun Apr 10 16:16:56 CEST 2011
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 5 02:11:14 2011 +0200| [3cb4988a9aa6b984ed83ec06fef4ad0546c2d166] | committer: Francois Cartegnie
dvb: demux: generate uri
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3cb4988a9aa6b984ed83ec06fef4ad0546c2d166
---
modules/demux/playlist/dvb.c | 29 ++++++++++++++++++++++++++++-
1 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 15e0578..627eebb 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -109,6 +109,8 @@ static int Demux( demux_t *p_demux )
char **ppsz_options = NULL;
int i_options = 0;
char *psz_name = NULL;
+ char *psz_uri = strdup( "dvb://" );
+ int i_optionslen = 0;
if( !ParseLine( psz_line, &psz_name, &ppsz_options, &i_options ) )
{
@@ -118,9 +120,33 @@ static int Demux( demux_t *p_demux )
EnsureUTF8( psz_name );
for( int i = 0; i< i_options; i++ )
+ {
EnsureUTF8( ppsz_options[i] );
+ i_optionslen += ( strlen( ppsz_options[i] ) + 2 );
+ }
+
+ if ( i_optionslen )
+ {
+ /* ensure uri is also generated dvb:// :op1 :op2 */
+ char *psz_localuri = calloc( i_optionslen + 6 + 1, sizeof(char) );
+ if ( psz_localuri )
+ {
+ char *psz_tmp;
+ char *psz_forward;
+ psz_forward = strcat( psz_localuri, psz_uri ) + 6;
+ for( int i = 0; i< i_options; i++ )
+ {
+ psz_tmp = ppsz_options[i]; /* avoid doing i*strcat */
+ *psz_forward++ = ' ';
+ *psz_forward++ = ':';
+ while( *psz_tmp ) *psz_forward++ = *psz_tmp++;
+ }
+ free( psz_uri );
+ psz_uri = psz_localuri;
+ }
+ }
- p_input = input_item_NewExt( p_demux, "dvb://", psz_name,
+ p_input = input_item_NewExt( p_demux, psz_uri, psz_name,
i_options, (const char**)ppsz_options, VLC_INPUT_OPTION_TRUSTED, -1 );
input_item_node_AppendItem( p_subitems, p_input );
vlc_gc_decref( p_input );
@@ -129,6 +155,7 @@ static int Demux( demux_t *p_demux )
free( ppsz_options[i_options] );
free( ppsz_options );
+ free( psz_uri );
free( psz_line );
}
More information about the vlc-commits
mailing list