h264parse: add new h264 caps attribute alignment

See #606662.
This commit is contained in:
Mark Nauwelaerts 2010-06-22 12:28:38 +02:00
parent 4536c54469
commit 4c7fd3c247

View file

@ -1202,7 +1202,7 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
GstCaps *src_caps = NULL; GstCaps *src_caps = NULL;
GstStructure *structure; GstStructure *structure;
gboolean modified = FALSE; gboolean modified = FALSE;
const gchar *stream_format; const gchar *stream_format, *alignment;
/* current PPS dictates which SPS to use */ /* current PPS dictates which SPS to use */
if (h264parse->pps && h264parse->pps->sps_id < MAX_SPS_COUNT) { if (h264parse->pps && h264parse->pps->sps_id < MAX_SPS_COUNT) {
@ -1303,6 +1303,38 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
modified = TRUE; modified = TRUE;
} }
/* set alignment field */
if (h264parse->merge) {
alignment = "au";
} else {
if (h264parse->packetized) {
/* if packetized input, take upstream alignment if validly provided,
* otherwise assume au aligned ... */
alignment = gst_structure_get_string (structure, "alignment");
if (!alignment || (alignment &&
strcmp (alignment, "au") != 0 &&
strcmp (alignment, "nal") != 0)) {
if (h264parse->split_packetized)
alignment = "nal";
else
alignment = "au";
}
} else {
alignment = "nal";
}
}
/* now only set if changed */
{
const gchar *old_alignment;
old_alignment = gst_structure_get_string (structure, "alignment");
if (!old_alignment || strcmp (alignment, old_alignment) != 0) {
gst_structure_set (structure, "alignment", G_TYPE_STRING, alignment,
NULL);
modified = TRUE;
}
}
/* transforming to non-bytestream needs to make codec-data */ /* transforming to non-bytestream needs to make codec-data */
if (h264parse->format == GST_H264_PARSE_FORMAT_SAMPLE) { if (h264parse->format == GST_H264_PARSE_FORMAT_SAMPLE) {
GstBuffer *buf; GstBuffer *buf;