[MOVED FROM BAD 021/134] vp8enc: Adjust Ogg mapping for the changes

This commit is contained in:
Sebastian Dröge 2010-05-19 21:34:42 +02:00
parent 5ce64cf8ad
commit b7e64c7c69

View file

@ -421,11 +421,17 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
"pixel-aspect-ratio", GST_TYPE_FRACTION, state->par_n,
state->par_d, NULL);
s = gst_caps_get_structure (caps, 0);
/* put buffers in a fixed list */
g_value_init (&array, GST_TYPE_ARRAY);
g_value_init (&value, GST_TYPE_BUFFER);
/* Create Ogg stream-info */
stream_hdr = gst_buffer_new_and_alloc (24);
data = GST_BUFFER_DATA (stream_hdr);
GST_WRITE_UINT32_BE (data, 0x56503830); /* "VP80" */
GST_WRITE_UINT32_BE (data, 0x2F565038); /* "/VP8" */
GST_WRITE_UINT8 (data + 4, 1); /* Major version 1 */
GST_WRITE_UINT8 (data + 5, 0); /* Minor version 0 */
GST_WRITE_UINT16_BE (data + 6, state->width);
@ -435,37 +441,30 @@ gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder)
GST_WRITE_UINT32_BE (data + 16, state->fps_n);
GST_WRITE_UINT32_BE (data + 20, state->fps_d);
iface_tags =
gst_tag_setter_get_tag_list (GST_TAG_SETTER (base_video_encoder));
if (!iface_tags)
tags = gst_tag_list_new ();
vorbiscomment =
gst_tag_list_to_vorbiscomment_buffer ((iface_tags) ? iface_tags : tags,
(const guint8 *) "VP8_TAG", 7, NULL);
if (tags)
gst_tag_list_free (tags);
/* mark buffers */
GST_BUFFER_FLAG_SET (stream_hdr, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (vorbiscomment, GST_BUFFER_FLAG_IN_CAPS);
s = gst_caps_get_structure (caps, 0);
/* put buffers in a fixed list */
g_value_init (&array, GST_TYPE_ARRAY);
g_value_init (&value, GST_TYPE_BUFFER);
gst_value_set_buffer (&value, stream_hdr);
gst_value_array_append_value (&array, &value);
g_value_unset (&value);
gst_buffer_unref (stream_hdr);
iface_tags =
gst_tag_setter_get_tag_list (GST_TAG_SETTER (base_video_encoder));
if (iface_tags) {
vorbiscomment =
gst_tag_list_to_vorbiscomment_buffer ((iface_tags) ? iface_tags : tags,
(const guint8 *) "OggVP8 ", 7, NULL);
GST_BUFFER_FLAG_SET (vorbiscomment, GST_BUFFER_FLAG_IN_CAPS);
g_value_init (&value, GST_TYPE_BUFFER);
gst_value_set_buffer (&value, vorbiscomment);
gst_value_array_append_value (&array, &value);
gst_structure_set_value (s, "streamheader", &array);
g_value_unset (&value);
g_value_unset (&array);
gst_buffer_unref (stream_hdr);
gst_buffer_unref (vorbiscomment);
}
gst_structure_set_value (s, "streamheader", &array);
g_value_unset (&array);
return caps;
}