mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
omxh265: factor out gst_omx_h265_utils_get_profile_from_enum()
Move the profile <-> enum mapping to one place. Make changes easier as I'm about to add some profiles. No semantic change. https://bugzilla.gnome.org/show_bug.cgi?id=794177
This commit is contained in:
parent
dc0ed29a62
commit
f9922a1a56
3 changed files with 45 additions and 35 deletions
|
@ -556,28 +556,11 @@ gst_omx_h265_enc_get_caps (GstOMXVideoEnc * enc, GstOMXPort * port,
|
|||
"alignment", G_TYPE_STRING, "au", NULL);
|
||||
|
||||
if (err == OMX_ErrorNone) {
|
||||
switch (param.eProfile) {
|
||||
case OMX_VIDEO_HEVCProfileMain:
|
||||
profile = "main";
|
||||
break;
|
||||
case OMX_VIDEO_HEVCProfileMain10:
|
||||
profile = "main-10";
|
||||
break;
|
||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
||||
case OMX_ALG_VIDEO_HEVCProfileMainStill:
|
||||
profile = "main-still-picture";
|
||||
break;
|
||||
case OMX_ALG_VIDEO_HEVCProfileMain422:
|
||||
profile = "main-422";
|
||||
break;
|
||||
case OMX_ALG_VIDEO_HEVCProfileMain422_10:
|
||||
profile = "main-422-10";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
gst_caps_unref (caps);
|
||||
return NULL;
|
||||
profile = gst_omx_h265_utils_get_profile_from_enum (param.eProfile);
|
||||
if (!profile) {
|
||||
g_assert_not_reached ();
|
||||
gst_caps_unref (caps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (param.eLevel) {
|
||||
|
|
|
@ -25,26 +25,51 @@
|
|||
|
||||
#include "gstomxh265utils.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const gchar *profile;
|
||||
OMX_VIDEO_HEVCPROFILETYPE e;
|
||||
} H265ProfileMapping;
|
||||
|
||||
static const H265ProfileMapping h265_profiles[] = {
|
||||
{"main", OMX_VIDEO_HEVCProfileMain},
|
||||
{"main-10", OMX_VIDEO_HEVCProfileMain10},
|
||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
||||
{"main-still-picture",
|
||||
(OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMainStill},
|
||||
/* Not standard: 8 bits variation of main-422-10 */
|
||||
{"main-422", (OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMain422},
|
||||
{"main-422-10",
|
||||
(OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMain422_10},
|
||||
#endif
|
||||
};
|
||||
|
||||
OMX_VIDEO_HEVCPROFILETYPE
|
||||
gst_omx_h265_utils_get_profile_from_str (const gchar * profile)
|
||||
{
|
||||
if (g_str_equal (profile, "main")) {
|
||||
return OMX_VIDEO_HEVCProfileMain;
|
||||
} else if (g_str_equal (profile, "main-10")) {
|
||||
return OMX_VIDEO_HEVCProfileMain10;
|
||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
||||
} else if (g_str_equal (profile, "main-still-picture")) {
|
||||
return (OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMainStill;
|
||||
} else if (g_str_equal (profile, "main-422")) {
|
||||
/* Not standard: 8 bits variation of main-422-10 */
|
||||
return (OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMain422;
|
||||
} else if (g_str_equal (profile, "main-422-10")) {
|
||||
return (OMX_VIDEO_HEVCPROFILETYPE) OMX_ALG_VIDEO_HEVCProfileMain422_10;
|
||||
#endif
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (h265_profiles); i++) {
|
||||
if (g_str_equal (profile, h265_profiles[i].profile))
|
||||
return h265_profiles[i].e;
|
||||
}
|
||||
|
||||
return OMX_VIDEO_HEVCProfileUnknown;
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gst_omx_h265_utils_get_profile_from_enum (OMX_VIDEO_HEVCPROFILETYPE e)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (h265_profiles); i++) {
|
||||
if (e == h265_profiles[i].e)
|
||||
return h265_profiles[i].profile;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OMX_VIDEO_HEVCLEVELTYPE
|
||||
gst_omx_h265_utils_get_level_from_str (const gchar * level, const gchar * tier)
|
||||
{
|
||||
|
|
|
@ -31,5 +31,7 @@ OMX_VIDEO_HEVCPROFILETYPE gst_omx_h265_utils_get_profile_from_str (const
|
|||
OMX_VIDEO_HEVCLEVELTYPE gst_omx_h265_utils_get_level_from_str (const gchar *
|
||||
level, const gchar * tier);
|
||||
|
||||
const gchar * gst_omx_h265_utils_get_profile_from_enum (OMX_VIDEO_HEVCPROFILETYPE e);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_OMX_H265_UTILS_H__ */
|
||||
|
|
Loading…
Reference in a new issue