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);
|
"alignment", G_TYPE_STRING, "au", NULL);
|
||||||
|
|
||||||
if (err == OMX_ErrorNone) {
|
if (err == OMX_ErrorNone) {
|
||||||
switch (param.eProfile) {
|
profile = gst_omx_h265_utils_get_profile_from_enum (param.eProfile);
|
||||||
case OMX_VIDEO_HEVCProfileMain:
|
if (!profile) {
|
||||||
profile = "main";
|
g_assert_not_reached ();
|
||||||
break;
|
gst_caps_unref (caps);
|
||||||
case OMX_VIDEO_HEVCProfileMain10:
|
return NULL;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (param.eLevel) {
|
switch (param.eLevel) {
|
||||||
|
|
|
@ -25,26 +25,51 @@
|
||||||
|
|
||||||
#include "gstomxh265utils.h"
|
#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
|
OMX_VIDEO_HEVCPROFILETYPE
|
||||||
gst_omx_h265_utils_get_profile_from_str (const gchar * profile)
|
gst_omx_h265_utils_get_profile_from_str (const gchar * profile)
|
||||||
{
|
{
|
||||||
if (g_str_equal (profile, "main")) {
|
guint i;
|
||||||
return OMX_VIDEO_HEVCProfileMain;
|
|
||||||
} else if (g_str_equal (profile, "main-10")) {
|
for (i = 0; i < G_N_ELEMENTS (h265_profiles); i++) {
|
||||||
return OMX_VIDEO_HEVCProfileMain10;
|
if (g_str_equal (profile, h265_profiles[i].profile))
|
||||||
#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS
|
return h265_profiles[i].e;
|
||||||
} 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OMX_VIDEO_HEVCProfileUnknown;
|
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
|
OMX_VIDEO_HEVCLEVELTYPE
|
||||||
gst_omx_h265_utils_get_level_from_str (const gchar * level, const gchar * tier)
|
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 *
|
OMX_VIDEO_HEVCLEVELTYPE gst_omx_h265_utils_get_level_from_str (const gchar *
|
||||||
level, const gchar * tier);
|
level, const gchar * tier);
|
||||||
|
|
||||||
|
const gchar * gst_omx_h265_utils_get_profile_from_enum (OMX_VIDEO_HEVCPROFILETYPE e);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif /* __GST_OMX_H265_UTILS_H__ */
|
#endif /* __GST_OMX_H265_UTILS_H__ */
|
||||||
|
|
Loading…
Reference in a new issue