Commit 149d8200 authored by Xavier Claessens's avatar Xavier Claessens

qtmux: Write AV1CodecConfigurationRecord

This requires av1parser element to fill all needed fields in the caps.
parent 5e4f215b
......@@ -5768,21 +5768,45 @@ gst_qt_mux_video_sink_set_caps (GstQTPad * qtpad, GstCaps * caps)
entry.fourcc = FOURCC_cfhd;
sync = FALSE;
} else if (strcmp (mimetype, "video/x-av1") == 0) {
gint presentation_delay;
guint8 presentation_delay_byte = 0;
guint8 seq_profile;
guint8 seq_level_idx_0;
guint8 seq_tier_0;
guint8 high_bitdepth;
guint8 twelve_bit;
guint8 monochrome;
guint8 chroma_subsampling_x;
guint8 chroma_subsampling_y;
guint8 chroma_sample_position;
guint8 initial_presentation_delay_present = 0;
guint8 data[4];
GstBuffer *av1_codec_data;
if (gst_structure_get_int (structure, "presentation-delay",
&presentation_delay)) {
presentation_delay_byte = 1 << 5;
presentation_delay_byte |= MAX (0xF, presentation_delay & 0xF);
}
if (!gst_structure_get (structure,
"seq_profile", G_TYPE_UINT, &seq_profile,
"seq_level_idx_0", G_TYPE_UINT, &seq_level_idx_0,
"seq_tier_0", G_TYPE_BOOLEAN, &seq_tier_0,
"high_bitdepth", G_TYPE_BOOLEAN, &high_bitdepth,
"twelve_bit", G_TYPE_BOOLEAN, &twelve_bit,
"monochrome", G_TYPE_BOOLEAN, &monochrome,
"chroma_subsampling_x", G_TYPE_BOOLEAN, &chroma_subsampling_x,
"chroma_subsampling_y", G_TYPE_BOOLEAN, &chroma_subsampling_y,
"chroma_sample_position", G_TYPE_UINT, &chroma_sample_position,
NULL))
goto refuse_caps;
data[0] = 1 << 7 | 1;
data[1] = (seq_profile & 0x7) << 5 | (seq_level_idx_0 & 0x1F);
data[2] = (seq_tier_0 & 0x1) << 7 |
(high_bitdepth & 0x1) << 6 |
(twelve_bit & 0x1) << 5 |
(monochrome & 0x1) << 4 |
(chroma_subsampling_x & 0x1) << 3 |
(chroma_subsampling_y & 0x1) << 2 | (chroma_sample_position & 0x3);
data[3] = (initial_presentation_delay_present & 0x1) << 4;
av1_codec_data = gst_buffer_new_allocate (NULL, sizeof (data), NULL);
gst_buffer_fill (av1_codec_data, 0, &data, sizeof (data));
av1_codec_data = gst_buffer_new_allocate (NULL, 5, NULL);
/* Fill version and 3 bytes of flags to 0 */
gst_buffer_memset (av1_codec_data, 0, 0, 4);
gst_buffer_fill (av1_codec_data, 4, &presentation_delay_byte, 1);
if (codec_data)
av1_codec_data = gst_buffer_append (av1_codec_data,
gst_buffer_ref ((GstBuffer *) codec_data));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment