[Ffmpeg-cvslog] CVS: ffmpeg/libavformat movenc.c,1.55,1.56
Corey Hickey CVS
corey
Wed Mar 8 01:39:26 CET 2006
Update of /cvsroot/ffmpeg/ffmpeg/libavformat
In directory mail:/var2/tmp/cvs-serv13548/libavformat
Modified Files:
movenc.c
Log Message:
correct computing of DV fourcc in mov muxer
Patch by Baptiste COUDURIER, baptiste <<dot>> coudurier <<at>> smartjog <<dot>> com
Index: movenc.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/movenc.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- movenc.c 2 Mar 2006 19:28:34 -0000 1.55
+++ movenc.c 8 Mar 2006 00:39:23 -0000 1.56
@@ -268,7 +268,7 @@
{ CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's') },
{ CODEC_ID_PCM_S16LE, MKTAG('s', 'o', 'w', 't') },
{ CODEC_ID_MP3, MKTAG('.', 'm', 'p', '3') },
- { 0, 0 },
+ { CODEC_ID_NONE, 0 },
};
static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)
@@ -471,10 +471,46 @@
{ CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
{ CODEC_ID_H263, MKTAG('s', '2', '6', '3') },
{ CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
- { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') },
- { 0, 0 },
+ /* special handling in mov_find_video_codec_tag */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') }, /* DV NTSC */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 'p') }, /* DV PAL */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'p', 'p') }, /* DVCPRO PAL */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'n') }, /* DVCPRO50 NTSC */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', 'p') }, /* DVCPRO50 PAL */
+ { CODEC_ID_NONE, 0 },
};
+static int mov_find_video_codec_tag(MOVTrack* track)
+{
+ int tag;
+
+ tag = track->enc->codec_tag;
+ if (!tag) {
+ if (track->enc->codec_id == CODEC_ID_DVVIDEO) {
+ if (track->enc->height == 480) { /* NTSC */
+ if (track->enc->pix_fmt == PIX_FMT_YUV422P)
+ tag = MKTAG('d', 'v', '5', 'n');
+ else
+ tag = MKTAG('d', 'v', 'c', ' ');
+ } else { /* assume PAL */
+ if (track->enc->pix_fmt == PIX_FMT_YUV422P)
+ tag = MKTAG('d', 'v', '5', 'p');
+ else if (track->enc->pix_fmt == PIX_FMT_YUV420P)
+ tag = MKTAG('d', 'v', 'p', 'p');
+ else
+ tag = MKTAG('d', 'v', 'c', 'p');
+ }
+ } else {
+ tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
+ }
+ }
+ // if no mac fcc found, try with Microsoft tags
+ if (!tag)
+ tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id);
+ assert(tag);
+ return tag;
+}
+
static int mov_write_video_tag(ByteIOContext *pb, MOVTrack* track)
{
offset_t pos = url_ftell(pb);
@@ -483,12 +519,7 @@
put_be32(pb, 0); /* size */
- tag = track->enc->codec_tag;
- if (!tag)
- tag = codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
- // if no mac fcc found, try with Microsoft tags
- if (!tag)
- tag = codec_get_tag(codec_bmp_tags, track->enc->codec_id);
+ tag = mov_find_video_codec_tag(track);
put_le32(pb, tag); // store it byteswapped
put_be32(pb, 0); /* Reserved */
More information about the ffmpeg-cvslog
mailing list