On 11/02/17 22:56, Takayuki 'January June' Suwa wrote:
> From: Takayuki 'January June' Suwa <jjs...@users.noreply.github.com>
> 
> This adds "-profile[:v] profile_name"-style option.
> ---
>  libavcodec/omx.c | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/libavcodec/omx.c b/libavcodec/omx.c
> index 16df50e..cfe2613 100644
> --- a/libavcodec/omx.c
> +++ b/libavcodec/omx.c
> @@ -226,6 +226,7 @@ typedef struct OMXCodecContext {
>      int output_buf_size;
>  
>      int input_zerocopy;
> +    int profile;
>  } OMXCodecContext;
>  
>  static void append_buffer(pthread_mutex_t *mutex, pthread_cond_t *cond,
> @@ -523,6 +524,32 @@ static av_cold int omx_component_init(AVCodecContext 
> *avctx, const char *role)
>          CHECK(err);
>          avc.nBFrames = 0;
>          avc.nPFrames = avctx->gop_size - 1;
> +        switch (s->profile) {
> +        case FF_PROFILE_H264_BASELINE:
> +            avc.eProfile = OMX_VIDEO_AVCProfileBaseline;
> +            break;
> +        case FF_PROFILE_H264_MAIN:
> +            avc.eProfile = OMX_VIDEO_AVCProfileMain;
> +            break;
> +        case FF_PROFILE_H264_HIGH:
> +        default:
> +            avc.eProfile = OMX_VIDEO_AVCProfileHigh;
> +            break;
> +        case FF_PROFILE_UNKNOWN:
> +            switch (avctx->profile) {
> +            case FF_PROFILE_H264_BASELINE:
> +                avc.eProfile = OMX_VIDEO_AVCProfileBaseline;
> +                break;
> +            case FF_PROFILE_H264_MAIN:
> +                avc.eProfile = OMX_VIDEO_AVCProfileMain;
> +                break;
> +            case FF_PROFILE_H264_HIGH:
> +            default:
> +                avc.eProfile = OMX_VIDEO_AVCProfileHigh;
> +                break;
> +            }
> +            break;
> +        }
>          err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc);
>          CHECK(err);

This is still setting the profile to high when the user hasn't explicitly set 
it, which will regress current behaviour on devices which don't support high 
profile.  You want to not set anything at all in that case.

>      }
> @@ -884,6 +911,10 @@ static const AVOption options[] = {
>      { "omx_libname", "OpenMAX library name", OFFSET(libname), 
> AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
>      { "omx_libprefix", "OpenMAX library prefix", OFFSET(libprefix), 
> AV_OPT_TYPE_STRING, { 0 }, 0, 0, VDE },
>      { "zerocopy", "Try to avoid copying input frames if possible", 
> OFFSET(input_zerocopy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
> +    { "profile",  "Set the encoding profile", OFFSET(profile), 
> AV_OPT_TYPE_INT,   { .i64 = FF_PROFILE_UNKNOWN },       FF_PROFILE_UNKNOWN, 
> FF_PROFILE_H264_HIGH, VE, "profile" },
> +    { "baseline", "",                         0,               
> AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_BASELINE }, 0, 0, VE, "profile" },
> +    { "main",     "",                         0,               
> AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_MAIN },     0, 0, VE, "profile" },
> +    { "high",     "",                         0,               
> AV_OPT_TYPE_CONST, { .i64 = FF_PROFILE_H264_HIGH },     0, 0, VE, "profile" },
>      { NULL }
>  };

Otherwise ok.

Thanks,

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to