[FFmpeg-devel] [PATCH] Add default stream flag

Michael Niedermayer michaelni
Fri Feb 29 02:51:04 CET 2008


    On Fri, Feb 29, 2008 at 02:26:36AM +0300, Evgeniy Stepanov wrote:
> On Thursday 28 February 2008 23:49:15 Michael Niedermayer wrote:
> > On Thu, Feb 28, 2008 at 11:24:22PM +0300, Evgeniy Stepanov wrote:
> > > Hi,
> > >
> > > this patch adds 'default_stream' flag to AVStream. Streams marked as
> > > default are to be selected for playback (or whatever else) if the user
> > > does not have any other preference (like language, or an exact stream
> > > id).
> > >
> > > This patch adds support for such streams in matroska muxer and demuxer. I
> > > don't know if there is similar functionality in other containers.
> >
> > nut of course ...
> >
> > > Is there a better place to put this information, without adding a new
> > > member to AVStream ?
> > >
> > > Maybe add an AVStream.flags with one bit of it occupied by
> > > default_stream flag ?
> >
> > This is better, but please call it int disposition; with
> > AV_DISPOSITION_DEFAULT
> > AV_DISPOSITION_DUB
> > AV_DISPOSITION_ORIGINAL
> > AV_DISPOSITION_COMMENT
> > AV_DISPOSITION_LYRICS
> > AV_DISPOSITION_KARAOKE
> 
> Here. Both matroska and nut supported (I invented new disposition 'default' 
> for nut, it is not in the spec). In ffmpeg.c, disposition is copied from ist 
> to ost.

[...]
> +typedef struct {
> +    char str[65];

9 is enough for the moment


[...]
> +static void set_disposition_bits(AVFormatContext* avf, char* value, unsigned int stream_id_plus1){
> +    int flag = 0, i;
> +    for (i=0; ff_nut_dispositions[i].flag != 0; ++i) {

the != 0 is superflous


> +        if (!strncmp(ff_nut_dispositions[i].str, value,
> +                     strlen(ff_nut_dispositions[i].str))) {

why strncmp() and not strcmp() ?


> +            flag = ff_nut_dispositions[i].flag;
> +            break;
> +        }

the break isnt needed


> +    }
> +    if (!flag) {
> +        av_log(avf, AV_LOG_INFO, "unknown disposition type '%s'\n", value);
> +        return;
> +    }

you dont need a return here


> +    if (!stream_id_plus1)
> +        for (i = 0; i < avf->nb_streams; ++i)
> +            avf->streams[i]->disposition |= flag;
> +    else
> +        avf->streams[stream_id_plus1 - 1]->disposition |= flag;

for (i = 0; i < avf->nb_streams; ++i)
    if(stream_id == i || stream_id == -1)
        avf->streams[i]->disposition |= flag;


[...]
> +            else if(!strcmp(name, "Disposition"))
> +                set_disposition_bits(s, str_value, stream_id_plus1);

set_disposition_bits(s, str_value, stream_id_plus1 - 1);
-> shorter variable names in set_disposition_bits


[...]
> +    for (i=0; ff_nut_dispositions[i].flag != 0; ++i) {

the != 0 is useless here too


[...]
> +        ret = write_streaminfo(nut, dyn_bc, i) > 0;
> +        if (ret < 0)
> +            return ret;

(X > 0) < 0 will never be true

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080229/a5065d25/attachment.pgp>



More information about the ffmpeg-devel mailing list