[vlc-devel] [PATCH] sout: allow duplicate outputs to be merged

Rafaël Carré rafael.carre at gmail.com
Sun Jan 17 07:49:48 CET 2010


On Sat, 16 Jan 2010 23:29:52 +0100
Laurent Aimar <fenrir at via.ecp.fr> wrote:

> 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.

I changed to sout_StreamChainNew/Delete and added a description 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.

done

> > +{
> > +    vlc_array_t cfg, name, module;
> > +    int modules;
> It might be better to move it where it is actually used (if possible).

modules was used just after a label but i reordered some stuff to move
it.

> > +    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 "").

I added a check for *psz_chain == '\0' in sout_StreamChainNew and return
NULL

> > +    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, ...)

Right, and I found 2 other leaks with valgrind, now it's ok


Corrected version pushed to master.

I'm not sure if it's worth an entry in NEWS, j-b what do you think ?

-- 
Rafaël Carré
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20100117/edbb798b/attachment.sig>


More information about the vlc-devel mailing list