summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-29 13:16:25 +0200
committerDave Robillard <dave@drobilla.net>2009-05-03 12:03:19 -0400
commit228057310290988ce8e986aa6c1052b2fc84c113 (patch)
treec70d8ed38cf3a1be5a62328338fedbc3d3f1192e /gst
parente31bbf9a7672d9620e3937463088f4b31b04510a (diff)
downloadgst-plugins-bad-228057310290988ce8e986aa6c1052b2fc84c113.tar.gz
gst-plugins-bad-228057310290988ce8e986aa6c1052b2fc84c113.tar.bz2
gst-plugins-bad-228057310290988ce8e986aa6c1052b2fc84c113.zip
flv: Always write at least the minimal tags and write the PAR as tags
Diffstat (limited to 'gst')
-rw-r--r--gst/flv/gstflvmux.c57
1 files changed, 49 insertions, 8 deletions
diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c
index 1b717ed7..b34a14a1 100644
--- a/gst/flv/gstflvmux.c
+++ b/gst/flv/gstflvmux.c
@@ -544,11 +544,6 @@ gst_flv_mux_write_metadata (GstFlvMux * mux)
merged_tags = gst_tag_list_merge (user_tags, mux->tags,
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (mux)));
- if (!merged_tags) {
- GST_DEBUG_OBJECT (mux, "No tags to write");
- return GST_FLOW_OK;
- }
-
GST_DEBUG_OBJECT (mux, "merged tags = %" GST_PTR_FORMAT, merged_tags);
script_tag = gst_buffer_new_and_alloc (11);
@@ -576,14 +571,15 @@ gst_flv_mux_write_metadata (GstFlvMux * mux)
script_tag = gst_buffer_join (script_tag, tmp);
- n_tags = gst_structure_n_fields ((GstStructure *) merged_tags);
+ n_tags =
+ (merged_tags) ? gst_structure_n_fields ((GstStructure *) merged_tags) : 0;
tmp = gst_buffer_new_and_alloc (5);
data = GST_BUFFER_DATA (tmp);
data[0] = 8; /* ECMA array */
GST_WRITE_UINT32_BE (data + 1, n_tags);
script_tag = gst_buffer_join (script_tag, tmp);
- for (i = 0; i < n_tags; i++) {
+ for (i = 0; merged_tags && i < n_tags; i++) {
const gchar *tag_name =
gst_structure_nth_field_name ((const GstStructure *) merged_tags, i);
if (!strcmp (tag_name, GST_TAG_DURATION)) {
@@ -634,6 +630,50 @@ gst_flv_mux_write_metadata (GstFlvMux * mux)
}
}
+ if (mux->have_video) {
+ GstPad *video_pad;
+ GSList *l = mux->collect->data;
+
+ for (; l; l = l->next) {
+ GstFlvPad *cpad = l->data;
+ if (cpad && cpad->video) {
+ video_pad = cpad->collect.pad;
+ break;
+ }
+ }
+
+ if (video_pad && GST_PAD_CAPS (video_pad)) {
+ GstStructure *s = gst_caps_get_structure (GST_PAD_CAPS (video_pad), 0);
+ gint par_x, par_y;
+
+ if (gst_structure_get_fraction (s, "pixel-aspect-ratio", &par_x, &par_y)) {
+ gdouble d;
+
+ d = par_x;
+ tmp = gst_buffer_new_and_alloc (2 + 12 + 1 + 8);
+ data = GST_BUFFER_DATA (tmp);
+ data[0] = 0; /* 12 bytes name */
+ data[1] = 12;
+ memcpy (&data[2], "AspectRatioX", sizeof ("AspectRatioX"));
+ data[14] = 0; /* double */
+ GST_WRITE_DOUBLE_BE (data + 15, d);
+ script_tag = gst_buffer_join (script_tag, tmp);
+ tags_written++;
+
+ d = par_y;
+ tmp = gst_buffer_new_and_alloc (2 + 12 + 1 + 8);
+ data = GST_BUFFER_DATA (tmp);
+ data[0] = 0; /* 12 bytes name */
+ data[1] = 12;
+ memcpy (&data[2], "AspectRatioY", sizeof ("AspectRatioY"));
+ data[14] = 0; /* double */
+ GST_WRITE_DOUBLE_BE (data + 15, d);
+ script_tag = gst_buffer_join (script_tag, tmp);
+ tags_written++;
+ }
+ }
+ }
+
{
const gchar *s = "GStreamer FLV muxer";
@@ -711,7 +751,8 @@ gst_flv_mux_write_metadata (GstFlvMux * mux)
gst_buffer_set_caps (script_tag, GST_PAD_CAPS (mux->srcpad));
ret = gst_pad_push (mux->srcpad, script_tag);
- gst_tag_list_free (merged_tags);
+ if (merged_tags)
+ gst_tag_list_free (merged_tags);
return ret;
}