h264parse: separate fields for distinct functional uses of codec_data field

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=692789
This commit is contained in:
Mark Nauwelaerts 2013-02-02 18:44:11 +01:00
parent de648b8832
commit 7df753165f
2 changed files with 8 additions and 3 deletions

View file

@ -189,6 +189,7 @@ gst_h264_parse_reset (GstH264Parse * h264parse)
h264parse->upstream_par_n = -1; h264parse->upstream_par_n = -1;
h264parse->upstream_par_d = -1; h264parse->upstream_par_d = -1;
gst_buffer_replace (&h264parse->codec_data, NULL); gst_buffer_replace (&h264parse->codec_data, NULL);
gst_buffer_replace (&h264parse->codec_data_in, NULL);
h264parse->nal_length_size = 4; h264parse->nal_length_size = 4;
h264parse->packetized = FALSE; h264parse->packetized = FALSE;
h264parse->transform = FALSE; h264parse->transform = FALSE;
@ -1140,8 +1141,8 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
gst_buffer_unmap (buf, &map); gst_buffer_unmap (buf, &map);
} else { } else {
if (h264parse->codec_data) if (!buf && h264parse->codec_data_in)
buf = gst_buffer_ref (h264parse->codec_data); buf = gst_buffer_ref (h264parse->codec_data_in);
modified = TRUE; modified = TRUE;
} }
} }
@ -1260,6 +1261,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
/* remove any left-over codec-data hanging around */ /* remove any left-over codec-data hanging around */
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
gst_structure_remove_field (s, "codec_data"); gst_structure_remove_field (s, "codec_data");
gst_buffer_replace (&h264parse->codec_data, NULL);
} }
gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps); gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps);
gst_caps_unref (caps); gst_caps_unref (caps);
@ -1791,7 +1793,7 @@ gst_h264_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
gst_buffer_unmap (codec_data, &map); gst_buffer_unmap (codec_data, &map);
h264parse->codec_data = gst_buffer_ref (codec_data); gst_buffer_replace (&h264parse->codec_data_in, codec_data);
/* if upstream sets codec_data without setting stream-format and alignment, we /* if upstream sets codec_data without setting stream-format and alignment, we
* assume stream-format=avc,alignment=au */ * assume stream-format=avc,alignment=au */

View file

@ -59,7 +59,10 @@ struct _GstH264Parse
gint aspect_ratio_idc; gint aspect_ratio_idc;
gint sar_width, sar_height; gint sar_width, sar_height;
gint upstream_par_n, upstream_par_d; gint upstream_par_n, upstream_par_d;
/* current codec_data in output caps, if any */
GstBuffer *codec_data; GstBuffer *codec_data;
/* input codec_data, if any */
GstBuffer *codec_data_in;
guint nal_length_size; guint nal_length_size;
gboolean packetized; gboolean packetized;
gboolean split_packetized; gboolean split_packetized;