[gstreamer-bugs] [Bug 640483] flvdemux: Video's width, height and/or framerate src caps added when present on onMetaData
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Tue Jan 25 10:41:17 PST 2011
https://bugzilla.gnome.org/show_bug.cgi?id=640483
GStreamer | gst-plugins-good | 0.10.25
--- Comment #1 from Leonardo Sandoval <lsandoval at ti.com> 2011-01-25 18:41:14 UTC ---
(From update of attachment 179243)
>From e04428c2e0ed520cbb6c903ea22c17e49caac028 Mon Sep 17 00:00:00 2001
From: Leonardo Sandoval <lsandoval at ti.com>
Date: Mon, 24 Jan 2011 15:45:28 -0600
Subject: [PATCH] flvdemux: Video's width, height and framerate src caps added
when present on onMetaData
---
gst/flv/gstflvdemux.c | 37 +++++++++++++++++++++++++++++++++++++
gst/flv/gstflvdemux.h | 1 +
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/gst/flv/gstflvdemux.c b/gst/flv/gstflvdemux.c
index 27796ea..cffa68c 100644
--- a/gst/flv/gstflvdemux.c
+++ b/gst/flv/gstflvdemux.c
@@ -278,6 +278,12 @@ gst_flv_demux_parse_metadata_item (GstFlvDemux * demux,
GstByteReader * reader,
} else if (!strcmp (tag_name, "AspectRatioY")) {
demux->par_y = d;
demux->got_par = TRUE;
+ } else if (!strcmp (tag_name, "width")) {
+ demux->w = d;
+ } else if (!strcmp (tag_name, "height")) {
+ demux->h = d;
+ } else if (!strcmp (tag_name, "framerate")) {
+ demux->framerate = d;
} else {
GST_INFO_OBJECT (demux, "Tag \'%s\' not handled", tag_name);
}
@@ -1004,6 +1010,36 @@ gst_flv_demux_video_negotiate (GstFlvDemux * demux,
guint32 codec_tag)
gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION,
demux->par_x, demux->par_y, NULL);
+ if (G_LIKELY (demux->w)) {
+ gst_caps_set_simple (caps, "width", G_TYPE_INT, demux->w, NULL);
+ }
+
+ if (G_LIKELY (demux->h)) {
+ gst_caps_set_simple (caps, "height", G_TYPE_INT, demux->h, NULL);
+ }
+
+ if (G_LIKELY (demux->framerate)) {
+ GValue fps_double = { 0, };
+ GValue fps_fraction = { 0, };
+ gint num = 0;
+ gint den = 0;
+
+ g_value_init (&fps_double, G_TYPE_DOUBLE);
+ g_value_init (&fps_fraction, GST_TYPE_FRACTION);
+ g_value_set_double (&fps_double, demux->framerate);
+ g_value_transform (&fps_double, &fps_fraction);
+ num = gst_value_get_fraction_numerator (&fps_fraction);
+ den = gst_value_get_fraction_denominator (&fps_fraction);
+
+ GST_DEBUG ("fps to be used on caps %f ( as a fraction = %d/%d)",
+ demux->framerate, num, den);
+
+ gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, num, den,
NULL);
+
+ g_value_unset (&fps_double);
+ g_value_unset (&fps_fraction);
+ }
+
if (demux->video_codec_data) {
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER,
demux->video_codec_data, NULL);
@@ -1524,6 +1560,7 @@ gst_flv_demux_cleanup (GstFlvDemux * demux)
gst_segment_init (&demux->segment, GST_FORMAT_TIME);
demux->w = demux->h = 0;
+ demux->framerate = 0.0;
demux->par_x = demux->par_y = 1;
demux->video_offset = 0;
demux->audio_offset = 0;
diff --git a/gst/flv/gstflvdemux.h b/gst/flv/gstflvdemux.h
index dadff94..106deae 100644
--- a/gst/flv/gstflvdemux.h
+++ b/gst/flv/gstflvdemux.h
@@ -109,6 +109,7 @@ struct _GstFlvDemux
gboolean got_par;
GstBuffer * video_codec_data;
GstClockTime video_start;
+ gdouble framerate;
gboolean random_access;
gboolean need_header;
--
1.7.1
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list