summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/omx
diff options
context:
space:
mode:
authorLeo Liu <[email protected]>2014-05-30 15:57:27 -0400
committerChristian König <[email protected]>2014-06-04 17:24:41 +0200
commitf588b80bbaa6aa69416f34a54364cc08c9f0636a (patch)
tree43fd66743a1bb0acfa491a23a6b6f4d514ea66c8 /src/gallium/state_trackers/omx
parent4722c326ceb5ebf1ca42499df0e7055694815ca2 (diff)
st/omx/enc: implement h264 profile support
Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/omx')
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.c50
-rw-r--r--src/gallium/state_trackers/omx/vid_enc.h1
2 files changed, 49 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c
index e64928bd6d7..f828d0508dd 100644
--- a/src/gallium/state_trackers/omx/vid_enc.c
+++ b/src/gallium/state_trackers/omx/vid_enc.c
@@ -256,6 +256,9 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
priv->quant.nQpP = OMX_VID_ENC_QUANT_P_FRAMES_DEFAULT;
priv->quant.nQpB = OMX_VID_ENC_QUANT_B_FRAMES_DEFAULT;
+ priv->profile_level.eProfile = OMX_VIDEO_AVCProfileBaseline;
+ priv->profile_level.eLevel = OMX_VIDEO_AVCLevel42;
+
priv->force_pic_type.IntraRefreshVOP = OMX_FALSE;
priv->frame_num = 0;
priv->pic_order_cnt = 0;
@@ -424,6 +427,17 @@ static OMX_ERRORTYPE vid_enc_SetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE i
break;
}
+ case OMX_IndexParamVideoProfileLevelCurrent: {
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE *profile_level = param;
+
+ r = checkHeader(param, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+ if (r)
+ return r;
+
+ priv->profile_level = *profile_level;
+
+ break;
+ }
default:
return omx_base_component_SetParameter(handle, idx, param);
}
@@ -498,10 +512,20 @@ static OMX_ERRORTYPE vid_enc_GetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE i
break;
}
+ case OMX_IndexParamVideoProfileLevelCurrent: {
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE *profile_level = param;
+ r = checkHeader(param, sizeof(OMX_VIDEO_PARAM_PROFILELEVELTYPE));
+ if (r)
+ return r;
+
+ profile_level->eProfile = priv->profile_level.eProfile;
+ profile_level->eLevel = priv->profile_level.eLevel;
+
+ break;
+ }
default:
return omx_base_component_GetParameter(handle, idx, param);
-
}
return OMX_ErrorNone;
}
@@ -599,6 +623,28 @@ static OMX_ERRORTYPE vid_enc_GetConfig(OMX_HANDLETYPE handle, OMX_INDEXTYPE idx,
return OMX_ErrorNone;
}
+static enum pipe_video_profile enc_TranslateOMXProfileToPipe(unsigned omx_profile)
+{
+ switch (omx_profile) {
+ case OMX_VIDEO_AVCProfileBaseline:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
+ case OMX_VIDEO_AVCProfileMain:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN;
+ case OMX_VIDEO_AVCProfileExtended:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED;
+ case OMX_VIDEO_AVCProfileHigh:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;
+ case OMX_VIDEO_AVCProfileHigh10:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10;
+ case OMX_VIDEO_AVCProfileHigh422:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422;
+ case OMX_VIDEO_AVCProfileHigh444:
+ return PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444;
+ default:
+ return PIPE_VIDEO_PROFILE_UNKNOWN;
+ }
+}
+
static OMX_ERRORTYPE vid_enc_MessageHandler(OMX_COMPONENTTYPE* comp, internalRequestMessageType *msg)
{
vid_enc_PrivateType* priv = comp->pComponentPrivate;
@@ -611,7 +657,7 @@ static OMX_ERRORTYPE vid_enc_MessageHandler(OMX_COMPONENTTYPE* comp, internalReq
port = (omx_base_video_PortType *)priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
- templat.profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE;
+ templat.profile = enc_TranslateOMXProfileToPipe(priv->profile_level.eProfile);
templat.entrypoint = PIPE_VIDEO_ENTRYPOINT_ENCODE;
templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
templat.width = priv->scale_buffer[priv->current_scale_buffer] ?
diff --git a/src/gallium/state_trackers/omx/vid_enc.h b/src/gallium/state_trackers/omx/vid_enc.h
index d0350d6b495..a49f249c792 100644
--- a/src/gallium/state_trackers/omx/vid_enc.h
+++ b/src/gallium/state_trackers/omx/vid_enc.h
@@ -80,6 +80,7 @@ DERIVEDCLASS(vid_enc_PrivateType, omx_base_filter_PrivateType)
OMX_BOOL restricted_b_frames; \
OMX_VIDEO_PARAM_BITRATETYPE bitrate; \
OMX_VIDEO_PARAM_QUANTIZATIONTYPE quant; \
+ OMX_VIDEO_PARAM_PROFILELEVELTYPE profile_level; \
OMX_CONFIG_INTRAREFRESHVOPTYPE force_pic_type; \
struct vl_compositor compositor; \
struct vl_compositor_state cstate; \