Commit 8683f7b7 authored by Laurent Aimar's avatar Laurent Aimar

* all: keep valid i_id.

parent 0fde9b2d
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* duplicate.c * duplicate.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: duplicate.c,v 1.10 2004/01/18 03:43:03 fenrir Exp $ * $Id: duplicate.c,v 1.11 2004/01/19 18:15:55 fenrir Exp $
* *
* Author: Laurent Aimar <fenrir@via.ecp.fr> * Author: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -60,8 +60,6 @@ struct sout_stream_sys_t ...@@ -60,8 +60,6 @@ struct sout_stream_sys_t
int i_nb_select; int i_nb_select;
char **ppsz_select; char **ppsz_select;
int i_es;
}; };
struct sout_stream_id_t struct sout_stream_id_t
...@@ -70,7 +68,7 @@ struct sout_stream_id_t ...@@ -70,7 +68,7 @@ struct sout_stream_id_t
void **pp_ids; void **pp_ids;
}; };
static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select, int i_es_number ); static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select );
/***************************************************************************** /*****************************************************************************
* Open: * Open:
...@@ -89,7 +87,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -89,7 +87,6 @@ static int Open( vlc_object_t *p_this )
p_sys->pp_streams = NULL; p_sys->pp_streams = NULL;
p_sys->i_nb_select = 0; p_sys->i_nb_select = 0;
p_sys->ppsz_select = NULL; p_sys->ppsz_select = NULL;
p_sys->i_es = 0;
for( p_cfg = p_stream->p_cfg; p_cfg != NULL; p_cfg = p_cfg->p_next ) for( p_cfg = p_stream->p_cfg; p_cfg != NULL; p_cfg = p_cfg->p_next )
{ {
...@@ -181,13 +178,13 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -181,13 +178,13 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
msg_Dbg( p_stream, "duplicated a new stream codec=%4.4s (es=%d group=%d)", msg_Dbg( p_stream, "duplicated a new stream codec=%4.4s (es=%d group=%d)",
(char*)&p_fmt->i_codec, (char*)&p_fmt->i_codec,
p_sys->i_es, p_fmt->i_id,
p_fmt->i_group ); p_fmt->i_group );
for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ ) for( i_stream = 0; i_stream < p_sys->i_nb_streams; i_stream++ )
{ {
void *id_new = NULL; void *id_new = NULL;
if( ESSelected( p_fmt, p_sys->ppsz_select[i_stream], p_sys->i_es ) ) if( ESSelected( p_fmt, p_sys->ppsz_select[i_stream] ) )
{ {
sout_stream_t *out = p_sys->pp_streams[i_stream]; sout_stream_t *out = p_sys->pp_streams[i_stream];
...@@ -212,8 +209,6 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -212,8 +209,6 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new ); TAB_APPEND( id->i_nb_ids, id->pp_ids, id_new );
} }
p_sys->i_es++;
if( i_valid_streams <= 0 ) if( i_valid_streams <= 0 )
{ {
Del( p_stream, id ); Del( p_stream, id );
...@@ -317,7 +312,7 @@ static vlc_bool_t NumInRange( char *psz_range, int i_num ) ...@@ -317,7 +312,7 @@ static vlc_bool_t NumInRange( char *psz_range, int i_num )
return i_start <= i_num && i_num <= i_stop ? VLC_TRUE : VLC_FALSE; return i_start <= i_num && i_num <= i_stop ? VLC_TRUE : VLC_FALSE;
} }
static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select, int i_es_number ) static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select )
{ {
char *psz_dup; char *psz_dup;
char *psz; char *psz;
...@@ -418,14 +413,14 @@ static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select, int i_es_numbe ...@@ -418,14 +413,14 @@ static vlc_bool_t ESSelected( es_format_t *fmt, char *psz_select, int i_es_numbe
{ {
if( i_es != 1 ) if( i_es != 1 )
{ {
i_es = !NumInRange( psz_arg, i_es_number ) ? 1 : 0; i_es = !NumInRange( psz_arg, fmt->i_id ) ? 1 : 0;
} }
} }
else if( !strcmp( psz, "es" ) ) else if( !strcmp( psz, "es" ) )
{ {
if( i_es != 1 ) if( i_es != 1 )
{ {
i_es = NumInRange( psz_arg, i_es_number ) ? 1 : 0; i_es = NumInRange( psz_arg, fmt->i_id) ? 1 : 0;
} }
} }
else if( !strcmp( psz, "no-prgm" ) || !strcmp( psz, "noprgm" ) || else if( !strcmp( psz, "no-prgm" ) || !strcmp( psz, "noprgm" ) ||
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* transcode.c * transcode.c
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: transcode.c,v 1.69 2004/01/19 14:40:25 fenrir Exp $ * $Id: transcode.c,v 1.70 2004/01/19 18:15:55 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com> * Gildas Bazin <gbazin@netcourrier.com>
...@@ -374,6 +374,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -374,6 +374,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
/* create dst format */ /* create dst format */
es_format_Init( &id->f_dst, AUDIO_ES, p_sys->i_acodec ); es_format_Init( &id->f_dst, AUDIO_ES, p_sys->i_acodec );
id->f_dst.i_id = id->f_src->i_id;
id->f_dst.i_group = id->f_src->i_group; id->f_dst.i_group = id->f_src->i_group;
id->f_dst.audio.i_rate = p_sys->i_sample_rate > 0 ? p_sys->i_sample_rate : id->f_src.audio.i_rate; id->f_dst.audio.i_rate = p_sys->i_sample_rate > 0 ? p_sys->i_sample_rate : id->f_src.audio.i_rate;
id->f_dst.audio.i_channels = p_sys->i_channels > 0 ? p_sys->i_channels : id->f_src.audio.i_channels; id->f_dst.audio.i_channels = p_sys->i_channels > 0 ? p_sys->i_channels : id->f_src.audio.i_channels;
...@@ -411,6 +412,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -411,6 +412,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
/* create dst format */ /* create dst format */
es_format_Init( &id->f_dst, VIDEO_ES, p_sys->i_vcodec ); es_format_Init( &id->f_dst, VIDEO_ES, p_sys->i_vcodec );
id->f_dst.i_id = id->f_src->i_id;
id->f_dst.i_group = id->f_src->i_group; id->f_dst.i_group = id->f_src->i_group;
id->f_dst.video.i_width = p_sys->i_width; id->f_dst.video.i_width = p_sys->i_width;
id->f_dst.video.i_height= p_sys->i_height; id->f_dst.video.i_height= p_sys->i_height;
......
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