mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
omxh264: factor out gst_omx_h264_utils_get_profile_from_enum()
Move the profile <-> enum mapping to one place. Make changes easier as I'm about to add extra profiles. No semantic change. https://bugzilla.gnome.org/show_bug.cgi?id=794177
This commit is contained in:
parent
4e75bab796
commit
7242d0a2e2
3 changed files with 42 additions and 40 deletions
|
@ -737,29 +737,8 @@ gst_omx_h264_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
"alignment", G_TYPE_STRING, "au", 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:
|
||||
profile = gst_omx_h264_utils_get_profile_from_enum (param.eProfile);
|
||||
if (!profile) {
|
||||
g_assert_not_reached ();
|
||||
gst_caps_unref (caps);
|
||||
return NULL;
|
||||
|
|
|
@ -24,28 +24,49 @@
|
|||
|
||||
#include "gstomxh264utils.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const gchar *profile;
|
||||
OMX_VIDEO_AVCPROFILETYPE e;
|
||||
} H264ProfileMapping;
|
||||
|
||||
static const H264ProfileMapping h264_profiles[] = {
|
||||
{"baseline", OMX_VIDEO_AVCProfileBaseline},
|
||||
{"constrained-baseline", OMX_VIDEO_AVCProfileBaseline},
|
||||
{"main", OMX_VIDEO_AVCProfileMain},
|
||||
{"extended", OMX_VIDEO_AVCProfileExtended},
|
||||
{"high", OMX_VIDEO_AVCProfileHigh},
|
||||
{"high-10", OMX_VIDEO_AVCProfileHigh10},
|
||||
{"high-4:2:2", OMX_VIDEO_AVCProfileHigh422},
|
||||
{"high-4:4:4", OMX_VIDEO_AVCProfileHigh444},
|
||||
};
|
||||
|
||||
OMX_VIDEO_AVCPROFILETYPE
|
||||
gst_omx_h264_utils_get_profile_from_str (const gchar * profile)
|
||||
{
|
||||
if (g_str_equal (profile, "baseline")) {
|
||||
return OMX_VIDEO_AVCProfileBaseline;
|
||||
} else if (g_str_equal (profile, "main")) {
|
||||
return OMX_VIDEO_AVCProfileMain;
|
||||
} else if (g_str_equal (profile, "extended")) {
|
||||
return OMX_VIDEO_AVCProfileExtended;
|
||||
} else if (g_str_equal (profile, "high")) {
|
||||
return OMX_VIDEO_AVCProfileHigh;
|
||||
} else if (g_str_equal (profile, "high-10")) {
|
||||
return OMX_VIDEO_AVCProfileHigh10;
|
||||
} else if (g_str_equal (profile, "high-4:2:2")) {
|
||||
return OMX_VIDEO_AVCProfileHigh422;
|
||||
} else if (g_str_equal (profile, "high-4:4:4")) {
|
||||
return OMX_VIDEO_AVCProfileHigh444;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (h264_profiles); i++) {
|
||||
if (g_str_equal (profile, h264_profiles[i].profile))
|
||||
return h264_profiles[i].e;
|
||||
}
|
||||
|
||||
return OMX_VIDEO_AVCProfileMax;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gst_omx_h264_utils_get_profile_from_enum (OMX_VIDEO_AVCPROFILETYPE e)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (h264_profiles); i++) {
|
||||
if (e == h264_profiles[i].e)
|
||||
return h264_profiles[i].profile;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OMX_VIDEO_AVCLEVELTYPE
|
||||
gst_omx_h264_utils_get_level_from_str (const gchar * level)
|
||||
{
|
||||
|
|
|
@ -30,5 +30,7 @@ OMX_VIDEO_AVCPROFILETYPE gst_omx_h264_utils_get_profile_from_str (const
|
|||
OMX_VIDEO_AVCLEVELTYPE gst_omx_h264_utils_get_level_from_str (const gchar *
|
||||
level);
|
||||
|
||||
const gchar * gst_omx_h264_utils_get_profile_from_enum (OMX_VIDEO_AVCPROFILETYPE e);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_OMX_H264_UTILS_H__ */
|
||||
|
|
Loading…
Reference in a new issue