omxvideo: use GST_VIDEO_CAPS_MAKE() for template caps

Simplify the code and so we advertise the formats actually supported by
gst-omx.
This commit is contained in:
Guillaume Desmottes 2019-01-04 10:11:38 +01:00 committed by Olivier Crête
parent 09bc1d630f
commit 9ff4dc533f
4 changed files with 8 additions and 6 deletions

View file

@ -33,6 +33,7 @@
GST_DEBUG_CATEGORY (gst_omx_video_debug_category); GST_DEBUG_CATEGORY (gst_omx_video_debug_category);
#define GST_CAT_DEFAULT gst_omx_video_debug_category #define GST_CAT_DEFAULT gst_omx_video_debug_category
/* Keep synced with GST_OMX_VIDEO_SUPPORTED_FORMATS */
GstVideoFormat GstVideoFormat
gst_omx_video_get_format_from_omx (OMX_COLOR_FORMATTYPE omx_colorformat) gst_omx_video_get_format_from_omx (OMX_COLOR_FORMATTYPE omx_colorformat)
{ {

View file

@ -34,6 +34,10 @@
G_BEGIN_DECLS G_BEGIN_DECLS
/* Keep synced with gst_omx_video_get_format_from_omx(). Sort by decreasing quality */
#define GST_OMX_VIDEO_SUPPORTED_FORMATS "{ NV16_10LE32, NV12_10LE32, " \
"NV16, YUY2, YVYU, UYVY, NV12, I420, RGB16, BGR16, ABGR, ARGB, BGR, GRAY8 }"
typedef struct typedef struct
{ {
GstVideoFormat format; GstVideoFormat format;

View file

@ -189,9 +189,7 @@ gst_omx_video_dec_class_init (GstOMXVideoDecClass * klass)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_GL_MEMORY,
"RGBA") "; " "RGBA") "; "
#endif #endif
"video/x-raw, " GST_VIDEO_CAPS_MAKE (GST_OMX_VIDEO_SUPPORTED_FORMATS);
"width = " GST_VIDEO_SIZE_RANGE ", "
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
} }
static void static void

View file

@ -490,9 +490,8 @@ gst_omx_video_enc_class_init (GstOMXVideoEncClass * klass)
GST_DEBUG_FUNCPTR (gst_omx_video_enc_decide_allocation); GST_DEBUG_FUNCPTR (gst_omx_video_enc_decide_allocation);
klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER; klass->cdata.type = GST_OMX_COMPONENT_TYPE_FILTER;
klass->cdata.default_sink_template_caps = "video/x-raw, " klass->cdata.default_sink_template_caps =
"width = " GST_VIDEO_SIZE_RANGE ", " GST_VIDEO_CAPS_MAKE (GST_OMX_VIDEO_SUPPORTED_FORMATS);
"height = " GST_VIDEO_SIZE_RANGE ", " "framerate = " GST_VIDEO_FPS_RANGE;
klass->handle_output_frame = klass->handle_output_frame =
GST_DEBUG_FUNCPTR (gst_omx_video_enc_handle_output_frame); GST_DEBUG_FUNCPTR (gst_omx_video_enc_handle_output_frame);