Skip to content

Commit

Permalink
sout: constify format parameter to sout_stream_t.pf_add
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Denis-Courmont committed Feb 21, 2015
1 parent 82a2bde commit 21dfee9
Show file tree
Hide file tree
Showing 23 changed files with 81 additions and 65 deletions.
13 changes: 9 additions & 4 deletions include/vlc_sout.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ struct sout_stream_t
sout_stream_t *p_next;

/* add, remove a stream */
sout_stream_id_sys_t *(*pf_add)( sout_stream_t *, es_format_t * );
sout_stream_id_sys_t *(*pf_add)( sout_stream_t *, const es_format_t * );
void (*pf_del)( sout_stream_t *, sout_stream_id_sys_t * );
/* manage a packet */
int (*pf_send)( sout_stream_t *, sout_stream_id_sys_t *, block_t* );
Expand All @@ -199,15 +199,20 @@ VLC_API void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_las
VLC_API sout_stream_t *sout_StreamChainNew(sout_instance_t *p_sout,
char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;

static inline sout_stream_id_sys_t *sout_StreamIdAdd( sout_stream_t *s, es_format_t *fmt )
static inline sout_stream_id_sys_t *sout_StreamIdAdd( sout_stream_t *s,
const es_format_t *fmt )
{
return s->pf_add( s, fmt );
}
static inline void sout_StreamIdDel( sout_stream_t *s, sout_stream_id_sys_t *id )

static inline void sout_StreamIdDel( sout_stream_t *s,
sout_stream_id_sys_t *id )
{
s->pf_del( s, id );
}
static inline int sout_StreamIdSend( sout_stream_t *s, sout_stream_id_sys_t *id, block_t *b )

static inline int sout_StreamIdSend( sout_stream_t *s,
sout_stream_id_sys_t *id, block_t *b )
{
return s->pf_send( s, id, b );
}
Expand Down
5 changes: 3 additions & 2 deletions modules/stream_out/autodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ vlc_module_end ()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send ( sout_stream_t *, sout_stream_id_sys_t *, block_t * );

Expand Down Expand Up @@ -111,7 +111,8 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream,
const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
sout_stream_id_sys_t *p_es = malloc( sizeof(sout_stream_id_sys_t) );
Expand Down
8 changes: 4 additions & 4 deletions modules/stream_out/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ static const char *const ppsz_sout_options_in[] = {
NULL
};

static sout_stream_id_sys_t *AddOut ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *AddOut( sout_stream_t *, const es_format_t * );
static void DelOut ( sout_stream_t *, sout_stream_id_sys_t * );
static int SendOut( sout_stream_t *, sout_stream_id_sys_t *, block_t * );

static sout_stream_id_sys_t *AddIn ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *AddIn( sout_stream_t *, const es_format_t * );
static void DelIn ( sout_stream_t *, sout_stream_id_sys_t * );
static int SendIn( sout_stream_t *, sout_stream_id_sys_t *, block_t * );

Expand Down Expand Up @@ -233,7 +233,7 @@ static void CloseOut( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * AddOut( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
bridge_t *p_bridge;
Expand Down Expand Up @@ -451,7 +451,7 @@ struct sout_stream_id_sys_t
int i_cat; /* es category. Used for placeholder option */
};

static sout_stream_id_sys_t * AddIn( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * AddIn( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;

Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/chromaprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -160,7 +160,7 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id = NULL;
Expand Down
2 changes: 1 addition & 1 deletion modules/stream_out/chromecast/cast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ vlc_module_end ()
/*****************************************************************************
* Sout callbacks
*****************************************************************************/
static sout_stream_id_sys_t *Add(sout_stream_t *p_stream, es_format_t *p_fmt)
static sout_stream_id_sys_t *Add(sout_stream_t *p_stream, const es_format_t *p_fmt)
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
return p_sys->p_out->pf_add(p_sys->p_out, p_fmt);
Expand Down
2 changes: 1 addition & 1 deletion modules/stream_out/cycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static mtime_t get_dts(const block_t *block)
return block->i_dts;
}

static sout_stream_id_sys_t *Add(sout_stream_t *stream, es_format_t *fmt)
static sout_stream_id_sys_t *Add(sout_stream_t *stream, const es_format_t *fmt)
{
sout_stream_sys_t *sys = stream->p_sys;
sout_stream_id_sys_t *id = malloc(sizeof (*id));
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static const char *ppsz_sout_options[] = {
"id", "delay", NULL
};

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send ( sout_stream_t *, sout_stream_id_sys_t *, block_t * );

Expand Down Expand Up @@ -128,7 +128,7 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;

Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/description.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add ( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -104,7 +104,7 @@ static void Close( vlc_object_t *p_this )
free( p_sys );
}

static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
es_format_t *p_fmt_copy = malloc( sizeof( *p_fmt_copy ) );
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static const char *const ppsz_sout_options[] = {
"audio", "video", "delay", NULL
};

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -136,7 +136,7 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;

Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*****************************************************************************/
static int Open ( vlc_object_t * );

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -69,7 +69,7 @@ static int Open( vlc_object_t *p_this )
return VLC_SUCCESS;
}

static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
VLC_UNUSED(p_stream); VLC_UNUSED(p_fmt);
return malloc( 1 );
Expand Down
8 changes: 4 additions & 4 deletions modules/stream_out/duplicate.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ vlc_module_end ()
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *,
block_t* );
Expand All @@ -76,7 +76,7 @@ struct sout_stream_id_sys_t
void **pp_ids;
};

static bool ESSelected( es_format_t *fmt, char *psz_select );
static bool ESSelected( const es_format_t *fmt, char *psz_select );

/*****************************************************************************
* Open:
Expand Down Expand Up @@ -183,7 +183,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Add:
*****************************************************************************/
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id;
Expand Down Expand Up @@ -328,7 +328,7 @@ static bool NumInRange( const char *psz_range, int i_num )
return i_start <= i_num && i_num <= i_stop;
}

static bool ESSelected( es_format_t *fmt, char *psz_select )
static bool ESSelected( const es_format_t *fmt, char *psz_select )
{
char *psz_dup;
char *psz;
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/es.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static const char *const ppsz_sout_options[] = {
NULL
};

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -269,7 +269,7 @@ static char * es_print_url( const char *psz_fmt, vlc_fourcc_t i_fourcc, int i_co
return( psz_dst );
}

static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id;
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/gather.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ vlc_module_end ()
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add ( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -121,7 +121,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
* Add:
*****************************************************************************/
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id;
Expand Down
20 changes: 11 additions & 9 deletions modules/stream_out/langfromtelx.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ static void Close( vlc_object_t * p_this )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
sout_stream_id_sys_t *id;
es_format_t fmt;

if ( p_fmt->i_id == p_sys->i_id )
{
fmt = *p_fmt;

p_sys->psz_old_language = p_fmt->psz_language;
msg_Dbg( p_stream,
"changing language of ID %d (magazine %d page %x row %d)",
Expand All @@ -159,18 +163,16 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
else
strcpy( p_fmt->psz_language, "unk" );
p_fmt->psz_language[3] = '\0';

p_sys->p_id = p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
return p_sys->p_id;
}

if ( p_fmt->i_codec == VLC_CODEC_TELETEXT )
{
p_sys->p_telx = p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
return p_sys->p_telx;
}
id = sout_StreamIdAdd( p_stream->p_next, p_fmt );

if( p_fmt->i_id == p_sys->i_id )
p_sys->p_id = id;
if( p_fmt->i_codec == VLC_CODEC_TELETEXT )
p_sys->p_telx = id;

return p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
return id;
}

static void Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/mosaic_bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct decoder_owner_sys_t
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t * );

Expand Down Expand Up @@ -269,7 +269,7 @@ static void Close( vlc_object_t * p_this )
free( p_sys );
}

static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
bridge_t *p_bridge;
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/raop.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static const char psz_delim_semicolon[] = ";";
static int Open( vlc_object_t * );
static void Close( vlc_object_t * );

static sout_stream_id_sys_t *Add( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -1560,7 +1560,7 @@ static void Close( vlc_object_t *p_this )
/*****************************************************************************
* Add:
*****************************************************************************/
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id = NULL;
Expand Down
4 changes: 2 additions & 2 deletions modules/stream_out/record.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static const char *const ppsz_sout_options[] = {
};

/* */
static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *, block_t* );

Expand Down Expand Up @@ -180,7 +180,7 @@ static void Close( vlc_object_t * p_this )
/*****************************************************************************
*
*****************************************************************************/
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
sout_stream_sys_t *p_sys = p_stream->p_sys;
sout_stream_id_sys_t *id;
Expand Down
10 changes: 6 additions & 4 deletions modules/stream_out/rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ static const char *const ppsz_sout_options[] = {
"mp4a-latm", NULL
};

static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *Add( sout_stream_t *, const es_format_t * );
static void Del ( sout_stream_t *, sout_stream_id_sys_t * );
static int Send( sout_stream_t *, sout_stream_id_sys_t *,
block_t* );
static sout_stream_id_sys_t *MuxAdd ( sout_stream_t *, es_format_t * );
static sout_stream_id_sys_t *MuxAdd( sout_stream_t *, const es_format_t * );
static void MuxDel ( sout_stream_t *, sout_stream_id_sys_t * );
static int MuxSend( sout_stream_t *, sout_stream_id_sys_t *,
block_t* );
Expand Down Expand Up @@ -953,7 +953,8 @@ uint32_t rtp_compute_ts( unsigned i_clock_rate, int64_t i_pts )
}

/** Add an ES as a new RTP stream */
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *Add( sout_stream_t *p_stream,
const es_format_t *p_fmt )
{
/* NOTE: As a special case, if we use a non-RTP
* mux (TS/PS), then p_fmt is NULL. */
Expand Down Expand Up @@ -1676,7 +1677,8 @@ size_t rtp_mtu (const sout_stream_id_sys_t *id)
*****************************************************************************/

/** Add an ES to a non-RTP muxed stream */
static sout_stream_id_sys_t *MuxAdd( sout_stream_t *p_stream, es_format_t *p_fmt )
static sout_stream_id_sys_t *MuxAdd( sout_stream_t *p_stream,
const es_format_t *p_fmt )
{
sout_input_t *p_input;
sout_mux_t *p_mux = p_stream->p_sys->p_mux;
Expand Down
Loading

0 comments on commit 21dfee9

Please sign in to comment.