[FFmpeg-devel] [PATCH]Support muxing more qcelp samples in mov
Carl Eugen Hoyos
cehoyos at ag.or.at
Sun Jun 9 19:38:32 CEST 2013
Hi!
Attached patch allows muxing of qcelp in mov and playback with QuickTime.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 77fc180..10daef9 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3199,6 +3199,27 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
} else {
size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size);
}
+ } else if (enc->codec_id == AV_CODEC_ID_QCELP && size < 35) {
+ reformatted_data = av_mallocz(35);
+ if (!reformatted_data)
+ return AVERROR(ENOMEM);
+ switch (size) {
+ case 3:
+ reformatted_data[0] = 1;
+ break;
+ case 7:
+ reformatted_data[0] = 2;
+ break;
+ case 16:
+ reformatted_data[0] = 3;
+ break;
+ case 34:
+ reformatted_data[0] = 4;
+ }
+ memcpy(reformatted_data + (reformatted_data[0] ? 1 : 0),
+ pkt->data, size);
+ size = 35;
+ avio_write(pb, reformatted_data, size);
} else {
avio_write(pb, pkt->data, size);
}
More information about the ffmpeg-devel
mailing list