diff options
Diffstat (limited to 'omx/gstomxh265dec.c')
-rw-r--r-- | omx/gstomxh265dec.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/omx/gstomxh265dec.c b/omx/gstomxh265dec.c index e10c0c1..f8abf41 100644 --- a/omx/gstomxh265dec.c +++ b/omx/gstomxh265dec.c @@ -51,6 +51,21 @@ enum G_DEFINE_TYPE_WITH_CODE (GstOMXH265Dec, gst_omx_h265_dec, GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT); +#define MAKE_CAPS(alignment) \ + "video/x-h265, " \ + "alignment=(string) " alignment ", " \ + "stream-format=(string) byte-stream, " \ + "width=(int) [1,MAX], height=(int) [1,MAX]" + +/* The Zynq MPSoC supports decoding subframes though we want "au" to be the + * default, so we keep it prepended. This is the only way that it works with + * rtph265depay. */ +#ifdef USE_OMX_TARGET_ZYNQ_USCALE_PLUS +#define SINK_CAPS MAKE_CAPS ("au") ";" MAKE_CAPS ("nal"); +#else +#define SINK_CAPS MAKE_CAPS ("au") +#endif + static void gst_omx_h265_dec_class_init (GstOMXH265DecClass * klass) { @@ -61,10 +76,7 @@ gst_omx_h265_dec_class_init (GstOMXH265DecClass * klass) GST_DEBUG_FUNCPTR (gst_omx_h265_dec_is_format_change); videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h265_dec_set_format); - videodec_class->cdata.default_sink_template_caps = "video/x-h265, " - "alignment=(string) au, " - "stream-format=(string) byte-stream, " - "width=(int) [1,MAX], " "height=(int) [1,MAX]"; + videodec_class->cdata.default_sink_template_caps = SINK_CAPS; gst_element_class_set_static_metadata (element_class, "OpenMAX H.265 Video Decoder", @@ -87,8 +99,8 @@ gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, GstCaps *old_caps = NULL; GstCaps *new_caps = state->caps; GstStructure *old_structure, *new_structure; - const gchar *old_profile, *old_level, *old_tier, *new_profile, *new_level, - *new_tier; + const gchar *old_profile, *old_level, *old_tier, *old_alignment, + *new_profile, *new_level, *new_tier, *new_alignment; if (dec->input_state) { old_caps = dec->input_state->caps; @@ -103,13 +115,16 @@ gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, old_profile = gst_structure_get_string (old_structure, "profile"); old_level = gst_structure_get_string (old_structure, "level"); old_tier = gst_structure_get_string (old_structure, "tier"); + old_alignment = gst_structure_get_string (old_structure, "alignment"); new_profile = gst_structure_get_string (new_structure, "profile"); new_level = gst_structure_get_string (new_structure, "level"); new_tier = gst_structure_get_string (new_structure, "tier"); + new_alignment = gst_structure_get_string (new_structure, "alignment"); if (g_strcmp0 (old_profile, new_profile) != 0 || g_strcmp0 (old_level, new_level) != 0 - || g_strcmp0 (old_tier, new_tier)) { + || g_strcmp0 (old_tier, new_tier) != 0 + || g_strcmp0 (old_alignment, new_alignment) != 0) { return TRUE; } @@ -184,6 +199,7 @@ gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port, GstOMXVideoDecClass *klass = GST_OMX_VIDEO_DEC_GET_CLASS (dec); OMX_PARAM_PORTDEFINITIONTYPE port_def; OMX_ERRORTYPE err; + const GstStructure *s; gst_omx_port_get_port_definition (port, &port_def); port_def.format.video.eCompressionFormat = @@ -197,5 +213,12 @@ gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port, return FALSE; } + /* Enable subframe mode if NAL aligned */ + s = gst_caps_get_structure (state->caps, 0); + if (!g_strcmp0 (gst_structure_get_string (s, "alignment"), "nal") + && gst_omx_port_set_subframe (dec->dec_in_port, TRUE)) { + gst_video_decoder_set_subframe_mode (GST_VIDEO_DECODER (dec), TRUE); + } + return TRUE; } |