[FFmpeg-devel] [PATCH] x264_param_apply_profile from AVCodecContext.profile

Lyubomir Marinov lyubomir.marinov at jitsi.org
Sun Sep 16 21:53:49 CEST 2012


Dear Michael,

On 15.09.2012, at 04:11, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Sep 15, 2012 at 01:05:00AM +0300, Lyubomir Marinov wrote:
>> Dear FFmpeg developers,
>> 
>> We at jitsi.org would also like to enable specifying the profile to be used by the FFmpeg x264 encoder through the AVCodecContext.profile field in the style of the following patch:
>> 
> 
>> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
>> index f2f8990..203f7af 100644
>> --- a/libavcodec/libx264.c
>> +++ b/libavcodec/libx264.c
>> @@ -447,6 +447,18 @@ static av_cold int X264_init(AVCodecContext *avctx)
>>     if (x4->fastfirstpass)
>>         x264_param_apply_fastfirstpass(&x4->params);
>> 
>> +    /* Allow specifying the x264 profile through AVCodecContext. */
>> +    if (!x4->profile)
>> +        switch (avctx->profile) {
>> +        case FF_PROFILE_H264_BASELINE:
>> +            x4->profile = "baseline";
>> +            break;
>> +        case FF_PROFILE_H264_MAIN:
>> +            x4->profile = "main";
>> +            break;
>> +        default:
>> +            break;
>> +        }
> 
> i think this is missing a av_strdup() if its implemented this way
> that is as is it should crash with freeing an invalid pointer

Thank you very much!

The following patch uses av_strdup in accord with your note and supports more FF_PROFILE_H264_* values:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libavcodec_libx264.c-profile.patch
Type: application/octet-stream
Size: 1226 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120916/d797d1d1/attachment.obj>
-------------- next part --------------


Best regards,
Lyubomir


More information about the ffmpeg-devel mailing list