From 99bd3f716cf63e04f88ad54a83d1a5d42f99bc56 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 19 Sep 2018 09:07:10 +0200 Subject: [PATCH] h265parse: parse SEI messages Don't do anything with them yet. I just copied the parsing and processing logic from h264parse. https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/790 --- gst/videoparsers/gsth265parse.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gst/videoparsers/gsth265parse.c b/gst/videoparsers/gsth265parse.c index edccb3fbbe..5554f87ed3 100644 --- a/gst/videoparsers/gsth265parse.c +++ b/gst/videoparsers/gsth265parse.c @@ -518,6 +518,34 @@ _nal_name (GstH265NalUnitType nal_type) } #endif +static void +gst_h265_parse_process_sei (GstH265Parse * h265parse, GstH265NalUnit * nalu) +{ + GstH265SEIMessage sei; + GstH265Parser *nalparser = h265parse->nalparser; + GstH265ParserResult pres; + GArray *messages; + guint i; + + pres = gst_h265_parser_parse_sei (nalparser, nalu, &messages); + if (pres != GST_H265_PARSER_OK) + GST_WARNING_OBJECT (h265parse, "failed to parse one or more SEI message"); + + /* Even if pres != GST_H265_PARSER_OK, some message could have been parsed and + * stored in messages. + */ + for (i = 0; i < messages->len; i++) { + sei = g_array_index (messages, GstH265SEIMessage, i); + switch (sei.payloadType) { + case GST_H265_SEI_BUF_PERIOD: + case GST_H265_SEI_PIC_TIMING: + /* FIXME */ + break; + } + } + g_array_free (messages, TRUE); +} + /* caller guarantees 2 bytes of nal payload */ static gboolean gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) @@ -641,7 +669,9 @@ gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) return FALSE; h265parse->header |= TRUE; - /*Fixme: parse sei messages */ + + gst_h265_parse_process_sei (h265parse, nalu); + /* mark SEI pos */ if (h265parse->sei_pos == -1) { if (h265parse->transform)