2008-09-04 Wim Taymans <wim.taymans@collabora.co.uk>
+ * ext/ffmpeg/gstffmpegcodecmap.c: (nal_escape), (copy_config),
+ (gst_ffmpeg_caps_with_codecid):
+ Add some debug that revealed that the escape code was disabled...
+
+2008-09-04 Wim Taymans <wim.taymans@collabora.co.uk>
+
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame),
(gst_ffmpegdec_chain):
If we have a parser and we did not consume any of the bytes of a new
while (srcp < end) {
if (count == 2 && *srcp <= 0x03 ) {
+ GST_DEBUG ("added escape code");
*dstp++ = 0x03;
count = 0;
}
else
count = 0;
+ GST_DEBUG ("copy %02x, count %d", *srcp, count);
*dstp++ = *srcp++;
}
*destsize = dstp - dst;
gint cnt, i;
guint nalsize, esize;
- goto full_copy;
-
/* check size */
if (size < 7)
goto full_copy;
cnt = *(srcp + 5) & 0x1f; /* Number of sps */
+ GST_DEBUG ("num SPS %d", cnt);
+
memcpy (dstp, srcp, 6);
srcp += 6;
dstp += 6;
for (i = 0; i < cnt; i++) {
+ GST_DEBUG ("copy SPS %d", i);
nalsize = (srcp[0] << 8) | srcp[1];
nal_escape (dstp + 2, srcp + 2, nalsize, &esize);
dstp[0] = esize >> 8;
cnt = *(dstp++) = *(srcp++); /* Number of pps */
+ GST_DEBUG ("num PPS %d", cnt);
+
for (i = 0; i < cnt; i++) {
+ GST_DEBUG ("copy PPS %d", i);
nalsize = (srcp[0] << 8) | srcp[1];
nal_escape (dstp + 2, srcp + 2, nalsize, &esize);
dstp[0] = esize >> 8;
full_copy:
{
+ GST_DEBUG ("something unexpected, doing full copy");
memcpy (dst, src, size);
*destsize = size;
return;
if (codec_id == CODEC_ID_H264) {
guint extrasize;
+ GST_DEBUG ("copy, escaping codec_data %d", size);
/* ffmpeg h264 expects the codec_data to be escaped, there is no real
* reason for this but let's just escape it for now. Start by allocating
* enough space, x2 is more than enough. */
context->extradata =
av_mallocz (GST_ROUND_UP_16 (size * 2 + FF_INPUT_BUFFER_PADDING_SIZE));
copy_config (context->extradata, data, size, &extrasize);
+ GST_DEBUG ("escaped size: %d", extrasize);
context->extradata_size = extrasize;
}
else {
/* allocate with enough padding */
+ GST_DEBUG ("copy codec_data");
context->extradata =
av_mallocz (GST_ROUND_UP_16 (size + FF_INPUT_BUFFER_PADDING_SIZE));
memcpy (context->extradata, data, size);