[FFmpeg-devel] [PATCH] Add android_capture indev

Felix Matouschek felix at matouschek.org
Thu Nov 30 11:12:53 EET 2017


Am 29.11.2017 04:31, schrieb Michael Niedermayer:

> if the identifer and the string always match you could do this
> with a macro avoiding the neede to duplcate each string
> see AV_STRINGIFY

I changed it, is it ok like this?

> [...]
>> +static int add_video_stream(AVFormatContext *avctx)
>> +{
>> +    AndroidCameraCtx *ctx = avctx->priv_data;
>> +    AVStream *st;
>> +    AVCodecParameters *codecpar;
>> +
>> +    st = avformat_new_stream(avctx, NULL);
>> +    if (!st) {
>> +        return AVERROR(ENOMEM);
>> +    }
>> +
>> +    st->id = VIDEO_STREAM_INDEX;
> 
>> +    st->avg_frame_rate = (AVRational) { ctx->framerate_range[1], 1 };
>> +    st->r_frame_rate = (AVRational) { ctx->framerate_range[1], 1 };
> 
> Are these values always correct ?

You mean avg_frame_rate and r_frame_rate?
The framerate can vary between the values in framerate_range[0] (min) 
and framerate_range[1] (max).
Ideally both values are the same, sometimes min can be lower but for the 
average the framerate should be what is in max.
Should I set r_frame_rate to min?

I fixed all other parts you mentioned.

Felix


More information about the ffmpeg-devel mailing list