[FFmpeg-devel] [PATCH] metadata conversion API

Michael Niedermayer michaelni
Tue Mar 3 02:36:13 CET 2009


On Mon, Mar 02, 2009 at 03:41:04PM -0800, Baptiste Coudurier wrote:
> On 3/2/2009 3:32 PM, Michael Niedermayer wrote:
> > On Mon, Mar 02, 2009 at 10:51:00PM +0100, Peter Eszlari wrote:
[...]
> >> Of course manpower is a different matter...suppose we had this list
> >> with all options&ranges, how would we actually proceed? Checking them
> >> one by one like it is done atm (see attached patch for -aq/mp2 case)?
> >> This seems not practical, especially if we want to prevent the user
> >> from doing really stupid things like:
> > 
> > The way to go (if we had the volunteers for it ...) would be to at the
> > simplest level add an array of const char* name, float max, float min
> > to AVCodec
> > that can then include what options and what ranges each codec supports
> > its easy to check then if everything is within range and if any other
> > option has been changed from its default (there are also other ways
> > then checking against the default from AVOptions to detect changed stuff.
> 
> I propose to add an array of tag/value pairs as "char*" in
> AVCodecContext, then encoder_init can check these values.
> 
> char* is definitely more flexible, and permits more advanced treatment.
> Furthermore, it can be passed "as is" to libx264.
> 

> It's nice to see that you can agree with me when someone else finally
> express interest in something I propose.

i do not know what you are talking about. Maybe you could clarify what
you meant or what part of what i said was unclear. None of what i said
above was suggesting that name value tags should be added.

what i meant and i belive this was quite clear is

typedef struct AVCodec {
[...]
    const int *supported_samplerates;       ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
    const enum SampleFormat *sample_fmts;   ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
    const int64_t *channel_layouts;         ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
+   AVOption *supported_options;
} AVCodec;

AVCodec some_codec={
    .supported_options={
        {.name="bitrate", .max=123, .min=456},
        ...
    },
};

int avcodec_open(AVCodecContext *avctx, AVCodec *codec){
...
    if(codec->supported_options){
        AVClass *c= *(AVClass**)v; //FIXME silly way of storing AVClass
        const AVOption *o= c->option;

        for(;o && o->name; o++){
            AVOption *so= av_find_opt(o->name);
            if(so){ // option supported
                double d= av_get_double(avctx, o->name, NULL);
                if(d < so->min || d > so->max)
                    av_log("Warning, option blah is x which is not in the supported range u..v\n");
            }else{
                if(d != o->default)
                    av_log("Warning, option blah is set but the codec does not support it\n");
            }
        }
    }
}

Also we are lacking volunteers to make such lists, are you volunteering?

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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20090303/0f70067b/attachment.pgp>



More information about the ffmpeg-devel mailing list