diff options
author | Takayuki 'January June' Suwa <jjsuwa@users.noreply.github.com> | 2017-03-03 15:17:37 +0900 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-03-03 17:17:53 +0100 |
commit | 13332504c98918447159da2a1a34e377dca360e2 (patch) | |
tree | 86c7aa7957a95936f5b64c39ae1c9e2d621ce6ef /libavcodec | |
parent | 6d93e7d1a3e607d001141784e66cc73ba1f061c6 (diff) | |
download | ffmpeg-13332504c98918447159da2a1a34e377dca360e2.tar.gz |
omx: Add support for specifying H.264 profile [v5']
This adds "-profile[:v] profile_name"-style option.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/omx.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c index 16df50e456..19b4f33836 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,19 @@ 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 == FF_PROFILE_UNKNOWN ? avctx->profile : 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: + avc.eProfile = OMX_VIDEO_AVCProfileHigh; + break; + default: + break; + } err = OMX_SetParameter(s->handle, OMX_IndexParamVideoAvc, &avc); CHECK(err); } @@ -884,6 +898,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 } }; |