compute output format before setting language patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com)

Originally committed as revision 5093 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Baptiste Coudurier 19 years ago committed by Michael Niedermayer
parent 289f999dab
commit 1522767d0d
  1. 45
      libavformat/movenc.c
  2. 2
      tests/ffmpeg.regression.ref
  3. 2
      tests/libav.regression.ref
  4. 2
      tests/rotozoom.regression.ref

@ -1389,6 +1389,27 @@ static int mov_write_header(AVFormatContext *s)
MOVContext *mov = s->priv_data;
int i;
/* Default mode == MP4 */
mov->mode = MODE_MP4;
if (s->oformat != NULL) {
if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP;
else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2;
else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
if ( mov->mode == MODE_3GP || mov->mode == MODE_3G2 ||
mov->mode == MODE_MP4 || mov->mode == MODE_PSP )
mov_write_ftyp_tag(pb,s);
if ( mov->mode == MODE_PSP ) {
if ( s->nb_streams != 2 ) {
av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n");
return -1;
}
mov_write_uuidprof_tag(pb,s);
}
}
for(i=0; i<s->nb_streams; i++){
AVCodecContext *c= s->streams[i]->codec;
@ -1409,29 +1430,7 @@ static int mov_write_header(AVFormatContext *s)
av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, the file may be unplayable!\n");
}
}
/* don't know yet if mp4 or not */
mov->tracks[i].language = ff_mov_iso639_to_lang(s->streams[i]->language, 1);
}
/* Default mode == MP4 */
mov->mode = MODE_MP4;
if (s->oformat != NULL) {
if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP;
else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2;
else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV;
else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP;
if ( mov->mode == MODE_3GP || mov->mode == MODE_3G2 ||
mov->mode == MODE_MP4 || mov->mode == MODE_PSP )
mov_write_ftyp_tag(pb,s);
if ( mov->mode == MODE_PSP ) {
if ( s->nb_streams != 2 ) {
av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n");
return -1;
}
mov_write_uuidprof_tag(pb,s);
}
mov->tracks[i].language = ff_mov_iso639_to_lang(s->streams[i]->language, mov->mode != MODE_MOV);
}
for (i=0; i<MAX_STREAMS; i++) {

@ -137,7 +137,7 @@ stddev: 0.00 PSNR:99.99 bytes:7602176
7200000 ./data/a-dv.dv
c2082cd8adf417c4ebc32654e446cba1 *./data/out.yuv
stddev: 8.86 PSNR:29.17 bytes:7602176
bd0db310a36ad94bcd4448abe0a88368 *./data/a-svq1.mov
733d55faec85f437f534771c145973d2 *./data/a-svq1.mov
1379827 ./data/a-svq1.mov
bbff871d1475e1eee4231a08e075de2c *./data/out.yuv
stddev: 10.99 PSNR:27.30 bytes:7602176

@ -22,7 +22,7 @@ c9050b51f6d6636cdda3160d43463bc3 *./data/b-libav.ts
794934a02582f8dfc85d1856514cf37c *./data/b-libav.flv
339325 ./data/b-libav.flv
./data/b-libav.flv CRC=0x7b9076f8
e4ed8d635d867e2f5980fd9c73c9cf3d *./data/b-libav.mov
4eecc0b7b09a6696f6d0f811f637612e *./data/b-libav.mov
369873 ./data/b-libav.mov
./data/b-libav.mov CRC=0x48f5a90d
8bf16d40a2ec19fa36b124a928e47e23 *./data/b-libav.nut

@ -137,7 +137,7 @@ stddev: 0.00 PSNR:99.99 bytes:7602176
7200000 ./data/a-dv.dv
bb69dda7a84a5b166434e28e1243d3d1 *./data/out.yuv
stddev: 2.99 PSNR:38.59 bytes:7602176
5b02b6ae7ffa257a66ae9857a992fdfe *./data/a-svq1.mov
e4896d19f536c420cb17fac162d1f95b *./data/a-svq1.mov
769527 ./data/a-svq1.mov
44777d1ddbccd0ef7f8d08394465670c *./data/out.yuv
stddev: 3.44 PSNR:37.38 bytes:7602176

Loading…
Cancel
Save