mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
omxvideoenc: Don't fail if setting the bitrate or profile is not supported by the component
Also always set/get the profile, even if there are no peer caps.
This commit is contained in:
parent
624c2b4fdb
commit
714ba59b11
4 changed files with 338 additions and 305 deletions
|
@ -105,14 +105,14 @@ gst_omx_h263_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
GstCaps *peercaps;
|
||||
OMX_VIDEO_H263PROFILETYPE profile = OMX_VIDEO_H263ProfileBaseline;
|
||||
OMX_VIDEO_H263LEVELTYPE level = OMX_VIDEO_H263Level10;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
peercaps = gst_pad_peer_get_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (enc));
|
||||
if (peercaps) {
|
||||
GstStructure *s;
|
||||
GstCaps *intersection;
|
||||
guint profile_id, level_id;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
intersection =
|
||||
gst_caps_intersect (peercaps,
|
||||
|
@ -187,21 +187,24 @@ gst_omx_h263_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting profile/level not supported by component");
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -217,79 +220,9 @@ gst_omx_h263_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
guint profile, level;
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone)
|
||||
return NULL;
|
||||
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_H263ProfileBaseline:
|
||||
profile = 0;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileH320Coding:
|
||||
profile = 1;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileBackwardCompatible:
|
||||
profile = 2;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileISWV2:
|
||||
profile = 3;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileISWV3:
|
||||
profile = 4;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileHighCompression:
|
||||
profile = 5;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileInternet:
|
||||
profile = 6;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileInterlace:
|
||||
profile = 7;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileHighLatency:
|
||||
profile = 8;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_H263Level10:
|
||||
level = 10;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level20:
|
||||
level = 20;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level30:
|
||||
level = 30;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level40:
|
||||
level = 40;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level50:
|
||||
level = 50;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level60:
|
||||
level = 60;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level70:
|
||||
level = 70;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
caps =
|
||||
gst_caps_new_simple ("video/x-h263", "width", G_TYPE_INT, state->width,
|
||||
"height", G_TYPE_INT, state->height,
|
||||
"profile", G_TYPE_UINT, profile, "level", G_TYPE_UINT, level, NULL);
|
||||
"height", G_TYPE_INT, state->height, NULL);
|
||||
|
||||
if (state->fps_n != 0)
|
||||
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, state->fps_n,
|
||||
|
@ -298,5 +231,81 @@ gst_omx_h263_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
|
||||
state->par_n, state->par_d, NULL);
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex) {
|
||||
gst_caps_unref (caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (err == OMX_ErrorNone) {
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_H263ProfileBaseline:
|
||||
profile = 0;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileH320Coding:
|
||||
profile = 1;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileBackwardCompatible:
|
||||
profile = 2;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileISWV2:
|
||||
profile = 3;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileISWV3:
|
||||
profile = 4;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileHighCompression:
|
||||
profile = 5;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileInternet:
|
||||
profile = 6;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileInterlace:
|
||||
profile = 7;
|
||||
break;
|
||||
case OMX_VIDEO_H263ProfileHighLatency:
|
||||
profile = 8;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_H263Level10:
|
||||
level = 10;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level20:
|
||||
level = 20;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level30:
|
||||
level = 30;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level40:
|
||||
level = 40;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level50:
|
||||
level = 50;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level60:
|
||||
level = 60;
|
||||
break;
|
||||
case OMX_VIDEO_H263Level70:
|
||||
level = 70;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
gst_caps_set_simple (caps,
|
||||
"profile", G_TYPE_UINT, profile, "level", G_TYPE_UINT, level, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -105,14 +105,14 @@ gst_omx_h264_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
GstCaps *peercaps;
|
||||
OMX_VIDEO_AVCPROFILETYPE profile = OMX_VIDEO_AVCProfileBaseline;
|
||||
OMX_VIDEO_AVCLEVELTYPE level = OMX_VIDEO_AVCLevel11;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
peercaps = gst_pad_peer_get_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (enc));
|
||||
if (peercaps) {
|
||||
GstStructure *s;
|
||||
GstCaps *intersection;
|
||||
const gchar *profile_string, *level_string;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
intersection =
|
||||
gst_caps_intersect (peercaps,
|
||||
|
@ -185,21 +185,24 @@ gst_omx_h264_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting profile/level not supported by component");
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -215,100 +218,9 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
const gchar *profile, *level;
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone)
|
||||
return NULL;
|
||||
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_AVCProfileBaseline:
|
||||
profile = "baseline";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileMain:
|
||||
profile = "main";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileExtended:
|
||||
profile = "extended";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh:
|
||||
profile = "high";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh10:
|
||||
profile = "high-10";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh422:
|
||||
profile = "high-4:2:2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh444:
|
||||
profile = "high-4:4:4";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_AVCLevel1:
|
||||
level = "1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel1b:
|
||||
level = "1b";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel11:
|
||||
level = "1.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel12:
|
||||
level = "1.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel13:
|
||||
level = "1.3";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel2:
|
||||
level = "2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel21:
|
||||
level = "2.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel22:
|
||||
level = "2.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel3:
|
||||
level = "3";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel31:
|
||||
level = "3.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel32:
|
||||
level = "3.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel4:
|
||||
level = "4";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel41:
|
||||
level = "4.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel42:
|
||||
level = "4.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel5:
|
||||
level = "5";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel51:
|
||||
level = "5.1";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
caps =
|
||||
gst_caps_new_simple ("video/x-h264", "width", G_TYPE_INT, state->width,
|
||||
"height", G_TYPE_INT, state->height,
|
||||
"profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL);
|
||||
"height", G_TYPE_INT, state->height, NULL);
|
||||
|
||||
if (state->fps_n != 0)
|
||||
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, state->fps_n,
|
||||
|
@ -317,5 +229,99 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
|
||||
state->par_n, state->par_d, NULL);
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex)
|
||||
return NULL;
|
||||
|
||||
if (err == OMX_ErrorNone) {
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_AVCProfileBaseline:
|
||||
profile = "baseline";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileMain:
|
||||
profile = "main";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileExtended:
|
||||
profile = "extended";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh:
|
||||
profile = "high";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh10:
|
||||
profile = "high-10";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh422:
|
||||
profile = "high-4:2:2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCProfileHigh444:
|
||||
profile = "high-4:4:4";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_AVCLevel1:
|
||||
level = "1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel1b:
|
||||
level = "1b";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel11:
|
||||
level = "1.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel12:
|
||||
level = "1.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel13:
|
||||
level = "1.3";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel2:
|
||||
level = "2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel21:
|
||||
level = "2.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel22:
|
||||
level = "2.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel3:
|
||||
level = "3";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel31:
|
||||
level = "3.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel32:
|
||||
level = "3.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel4:
|
||||
level = "4";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel41:
|
||||
level = "4.1";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel42:
|
||||
level = "4.2";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel5:
|
||||
level = "5";
|
||||
break;
|
||||
case OMX_VIDEO_AVCLevel51:
|
||||
level = "5.1";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
gst_caps_set_simple (caps,
|
||||
"profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -110,14 +110,14 @@ gst_omx_mpeg4_video_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
GstCaps *peercaps;
|
||||
OMX_VIDEO_MPEG4PROFILETYPE profile = OMX_VIDEO_MPEG4ProfileSimple;
|
||||
OMX_VIDEO_MPEG4LEVELTYPE level = OMX_VIDEO_MPEG4Level1;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
peercaps = gst_pad_peer_get_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (enc));
|
||||
if (peercaps) {
|
||||
GstStructure *s;
|
||||
GstCaps *intersection;
|
||||
const gchar *profile_string, *level_string;
|
||||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
OMX_ERRORTYPE err;
|
||||
|
||||
intersection =
|
||||
gst_caps_intersect (peercaps,
|
||||
|
@ -192,21 +192,24 @@ gst_omx_mpeg4_video_enc_set_format (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
param.eProfile = profile;
|
||||
param.eLevel = level;
|
||||
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
err =
|
||||
gst_omx_component_set_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting profile/level not supported by component");
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Error setting profile %d and level %d: %s (0x%08x)", profile, level,
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -222,104 +225,10 @@ gst_omx_mpeg4_video_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
OMX_VIDEO_PARAM_PROFILELEVELTYPE param;
|
||||
const gchar *profile, *level;
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone)
|
||||
return NULL;
|
||||
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_MPEG4ProfileSimple:
|
||||
profile = "simple";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleScalable:
|
||||
profile = "simple-scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileCore:
|
||||
profile = "core";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileMain:
|
||||
profile = "main";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileNbit:
|
||||
profile = "n-bit";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileScalableTexture:
|
||||
profile = "scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleFace:
|
||||
profile = "simple-face";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleFBA:
|
||||
profile = "simple-fba";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileBasicAnimated:
|
||||
profile = "basic-animated-texture";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileHybrid:
|
||||
profile = "hybrid";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedRealTime:
|
||||
profile = "advanced-real-time-simple";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileCoreScalable:
|
||||
profile = "core-scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedCoding:
|
||||
profile = "advanced-coding-efficiency";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedCore:
|
||||
profile = "advanced-core";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedScalable:
|
||||
profile = "advanced-scalable-texture";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedSimple:
|
||||
profile = "advanced-simple";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_MPEG4Level0:
|
||||
level = "0";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level0b:
|
||||
level = "0b";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level1:
|
||||
level = "1";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level2:
|
||||
level = "2";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level3:
|
||||
level = "3";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level4:
|
||||
level = "4";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level4a:
|
||||
level = "4a";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level5:
|
||||
level = "5";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
caps =
|
||||
gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 4,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, "width", G_TYPE_INT, state->width,
|
||||
"height", G_TYPE_INT, state->height,
|
||||
"profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL);
|
||||
"height", G_TYPE_INT, state->height, NULL);
|
||||
|
||||
if (state->fps_n != 0)
|
||||
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, state->fps_n,
|
||||
|
@ -328,5 +237,105 @@ gst_omx_mpeg4_video_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
|
||||
state->par_n, state->par_d, NULL);
|
||||
|
||||
GST_OMX_INIT_STRUCT (¶m);
|
||||
param.nPortIndex = GST_OMX_VIDEO_ENC (self)->out_port->index;
|
||||
|
||||
err =
|
||||
gst_omx_component_get_parameter (GST_OMX_VIDEO_ENC (self)->component,
|
||||
OMX_IndexParamVideoProfileLevelCurrent, ¶m);
|
||||
if (err != OMX_ErrorNone && err != OMX_ErrorUnsupportedIndex) {
|
||||
gst_caps_unref (caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (err == OMX_ErrorNone) {
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_MPEG4ProfileSimple:
|
||||
profile = "simple";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleScalable:
|
||||
profile = "simple-scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileCore:
|
||||
profile = "core";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileMain:
|
||||
profile = "main";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileNbit:
|
||||
profile = "n-bit";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileScalableTexture:
|
||||
profile = "scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleFace:
|
||||
profile = "simple-face";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileSimpleFBA:
|
||||
profile = "simple-fba";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileBasicAnimated:
|
||||
profile = "basic-animated-texture";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileHybrid:
|
||||
profile = "hybrid";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedRealTime:
|
||||
profile = "advanced-real-time-simple";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileCoreScalable:
|
||||
profile = "core-scalable";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedCoding:
|
||||
profile = "advanced-coding-efficiency";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedCore:
|
||||
profile = "advanced-core";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedScalable:
|
||||
profile = "advanced-scalable-texture";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4ProfileAdvancedSimple:
|
||||
profile = "advanced-simple";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
case OMX_VIDEO_MPEG4Level0:
|
||||
level = "0";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level0b:
|
||||
level = "0b";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level1:
|
||||
level = "1";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level2:
|
||||
level = "2";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level3:
|
||||
level = "3";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level4:
|
||||
level = "4";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level4a:
|
||||
level = "4a";
|
||||
break;
|
||||
case OMX_VIDEO_MPEG4Level5:
|
||||
level = "5";
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
gst_caps_set_simple (caps,
|
||||
"profile", G_TYPE_STRING, profile, "level", G_TYPE_STRING, level, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
|
|
@ -358,7 +358,11 @@ gst_omx_video_enc_open (GstOMXVideoEnc * self)
|
|||
err =
|
||||
gst_omx_component_set_parameter (self->component,
|
||||
OMX_IndexParamVideoBitrate, &bitrate_param);
|
||||
if (err != OMX_ErrorNone) {
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting a bitrate not supported by the component");
|
||||
goto done;
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self, "Failed to set bitrate parameters: %s (0x%08x)",
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
|
@ -373,13 +377,18 @@ gst_omx_video_enc_open (GstOMXVideoEnc * self)
|
|||
err =
|
||||
gst_omx_component_set_parameter (self->component,
|
||||
OMX_IndexParamVideoQuantization, &quant_param);
|
||||
if (err != OMX_ErrorNone) {
|
||||
if (err == OMX_ErrorUnsupportedIndex) {
|
||||
GST_WARNING_OBJECT (self,
|
||||
"Setting quantization parameters not supported by the component");
|
||||
goto done;
|
||||
} else if (err != OMX_ErrorNone) {
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Failed to set quantization parameters: %s (0x%08x)",
|
||||
gst_omx_error_to_string (err), err);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
done:
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue