From f48bb20b4f2852166d897ac03fa89b4a3a396b59 Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Sat, 4 Jan 2014 21:34:38 +0100 Subject: [PATCH] avi: use new riff api to extract nikon metadata Fixes #636143 --- gst/avi/gstavidemux.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index a3a1b5d..774da5c 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -3795,6 +3795,22 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi) gst_buffer_unref (sub); sub = NULL; break; + case GST_RIFF_LIST_ncdt: + gst_buffer_unmap (sub, &map); + gst_buffer_resize (sub, 4, -1); + gst_riff_parse_ncdt (element, sub, &tags); + if (tags) { + if (avi->globaltags) { + gst_tag_list_insert (avi->globaltags, tags, + GST_TAG_MERGE_REPLACE); + } else { + avi->globaltags = tags; + } + } + tags = NULL; + gst_buffer_unref (sub); + sub = NULL; + break; default: GST_WARNING_OBJECT (avi, "Unknown list %" GST_FOURCC_FORMAT " in AVI header", @@ -3912,6 +3928,40 @@ gst_avi_demux_stream_header_pull (GstAviDemux * avi) gst_buffer_unref (buf); /* gst_riff_read_chunk() has already advanced avi->offset */ break; + case GST_RIFF_LIST_ncdt: + res = + gst_riff_read_chunk (element, avi->sinkpad, &avi->offset, &tag, + &buf); + if (res != GST_FLOW_OK) { + GST_DEBUG_OBJECT (avi, "couldn't read ncdt chunk"); + goto pull_range_failed; + } + GST_DEBUG ("got size %" G_GSIZE_FORMAT, gst_buffer_get_size (buf)); + if (size < 4) { + GST_DEBUG ("skipping ncdt LIST prefix"); + avi->offset += (4 - GST_ROUND_UP_2 (size)); + gst_buffer_unref (buf); + continue; + } + + sub = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, 4, -1); + gst_riff_parse_ncdt (element, sub, &tags); + if (tags) { + if (avi->globaltags) { + gst_tag_list_insert (avi->globaltags, tags, + GST_TAG_MERGE_REPLACE); + } else { + avi->globaltags = tags; + } + } + tags = NULL; + if (sub) { + gst_buffer_unref (sub); + sub = NULL; + } + gst_buffer_unref (buf); + /* gst_riff_read_chunk() has already advanced avi->offset */ + break; default: GST_WARNING_OBJECT (avi, "Skipping unknown list tag %" GST_FOURCC_FORMAT, -- 2.7.4