[vlc-devel] [PATCH] sout: allow duplicate outputs to be merged
Laurent Aimar
fenrir at via.ecp.fr
Sat Jan 16 23:29:52 CET 2010
Hi,
On Thu, Jan 14, 2010, Rafaël Carré wrote:
> I need a way to specify different transcoding settings (especially no
> encoding at all if the stream is already in the desired codec) on an
> input with multiple audio tracks.
>
> I use duplicate to select each ES and apply the desired settings, and
> with this patch I can merge the output of each stream_out module into
> one (std which will mux all the ES together).
>
> I discussed this patch with fenrir at VDD, so I prefer if he looks if I
> didn't mess something.
>
> Also I RFC on:
> - are "sout_Chain{Delete,Create}" good names ?
I would prefer sout_StreamChainNew/Delete to match a bit more what exits
in sout. You forgot (or I missed it) to document them.
> - should sout_Stream{New,Delete} not be exported ? (record.c needs to
> be modified to use sout_Chain* but that's trivial)
If it is trivial, I think it would be better as it decreases the number of
exported function to maintain/understand.
> modules/stream_out/autodel.c | 13 +--
> modules/stream_out/bridge.c | 29 +++---
> modules/stream_out/duplicate.c | 14 ++-
> modules/stream_out/gather.c | 16 +--
> modules/stream_out/record.c | 5 +-
> modules/stream_out/switcher.c | 16 +--
> modules/stream_out/transcode/audio.c | 2 +-
> modules/stream_out/transcode/osd.c | 4 +-
> modules/stream_out/transcode/spu.c | 2 +-
> modules/stream_out/transcode/transcode.c | 13 +--
> modules/stream_out/transcode/transcode.h | 1 -
> modules/stream_out/transcode/video.c | 3 +-
I have only quickly look at them and will trust your changes.
> diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
> index 8fbfbb0..0bd58eb 100644
> --- a/src/stream_output/stream_output.c
> +++ b/src/stream_output/stream_output.c
> +void sout_ChainDelete(sout_stream_t *p_first, sout_stream_t *p_last)
> +{
> + printf("%s(%p, %p)\n", __func__, p_first, p_last);
Probably a debug left over.
> + if(!p_first)
> + return;
> +
> + if(p_first != p_last)
> + sout_ChainDelete(p_first->p_next, p_last);
> +
> + sout_StreamDelete(p_first);
> +}
> +
> +sout_stream_t *sout_ChainCreate(sout_instance_t *p_sout, char *psz_chain,
> + sout_stream_t *p_next, sout_stream_t **p_last)
pp_last
> +{
> + vlc_array_t cfg, name, module;
> + int modules;
It might be better to move it where it is actually used (if possible).
> + if(!psz_chain)
> + {
> + if(p_last) *p_last = NULL;
> + return p_next;
> + }
> +
> + vlc_array_init(&cfg);
> + vlc_array_init(&name);
> + vlc_array_init(&module);
> +
> + /* parse chain */
> + while(psz_chain)
> + {
> + config_chain_t *p_cfg;
> + char *psz_name;
> + psz_chain = config_ChainCreate( &psz_name, &p_cfg, psz_chain);
> +
> + vlc_array_append(&cfg, p_cfg);
> + vlc_array_append(&name, psz_name);
> + }
I wonder what happen with a non NULL but empty chain (as "").
> + int i = vlc_array_count(&name);
> + while(i--)
> + {
> + p_next = sout_StreamNew( p_sout, vlc_array_item_at_index(&name, i),
> + vlc_array_item_at_index(&cfg, i), p_next);
> +
> + if(!p_next)
> + goto error;
> +
> + if(i == vlc_array_count(&name) - 1 && p_last)
> + *p_last = p_next; /* last module created in the chain */
> +
> + vlc_array_append(&module, p_next);
> + }
> +
> + return p_next;
I think you forgot to clean up the arrays (module, cfg, ...)
Regards,
--
fenrir
More information about the vlc-devel
mailing list