[gst-cvs] gst-plugins-ugly: x264enc: fix up avcC header construction and playback by flash players
Tim Mueller
tpm at kemper.freedesktop.org
Tue Feb 16 06:14:33 PST 2010
Module: gst-plugins-ugly
Branch: master
Commit: 35dd89951d8bb1c094da65480e4197efdfb4e93c
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-ugly/commit/?id=35dd89951d8bb1c094da65480e4197efdfb4e93c
Author: Vittorio Palmisano <vpalmisano at gmail.com>
Date: Tue Feb 16 13:25:11 2010 +0000
x264enc: fix up avcC header construction and playback by flash players
Fix off-by-one bug when constructing the avcC header chunk: we
wrote wrong profile info into the header. The first byte in the
SPS NAL we get from x264 is the nal type, not the profile_idc.
Also add some debug logging.
Fixes #610089.
---
ext/x264/gstx264enc.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c
index d80e3bf..7d545d5 100644
--- a/ext/x264/gstx264enc.c
+++ b/ext/x264/gstx264enc.c
@@ -738,6 +738,10 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
return NULL;
}
+ GST_MEMDUMP ("SEI", nal[0].p_payload, nal[0].i_payload);
+ GST_MEMDUMP ("SPS", nal[1].p_payload, nal[1].i_payload);
+ GST_MEMDUMP ("PPS", nal[2].p_payload, nal[2].i_payload);
+
/* nal payloads with emulation_prevention_three_byte, and some header data */
buffer_size = (nal[1].i_payload + nal[2].i_payload) * 4 + 100;
buffer = g_malloc (buffer_size);
@@ -751,9 +755,9 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
#endif
buffer[0] = 1; /* AVC Decoder Configuration Record ver. 1 */
- buffer[1] = sps[0]; /* profile_idc */
- buffer[2] = sps[1]; /* profile_compability */
- buffer[3] = sps[2]; /* level_idc */
+ buffer[1] = sps[1]; /* profile_idc */
+ buffer[2] = sps[2]; /* profile_compability */
+ buffer[3] = sps[3]; /* level_idc */
buffer[4] = 0xfc | (4 - 1); /* nal_length_size_minus1 */
i_size = 5;
@@ -786,6 +790,8 @@ gst_x264_enc_header_buf (GstX264Enc * encoder)
memcpy (GST_BUFFER_DATA (buf), buffer, i_size);
g_free (buffer);
+ GST_MEMDUMP ("header", GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
+
return buf;
}
More information about the Gstreamer-commits
mailing list