Mercurial > libavformat.hg
comparison movenc.c @ 987:955d23ed733f libavformat
compute output format before setting language patch by (Baptiste COUDURIER <baptiste.coudurier smartjog com)
author | michael |
---|---|
date | Thu, 02 Mar 2006 01:37:38 +0000 |
parents | 43f85eba04c4 |
children | f7394f02e95a |
comparison
equal
deleted
inserted
replaced
986:f5194ed612b5 | 987:955d23ed733f |
---|---|
1387 { | 1387 { |
1388 ByteIOContext *pb = &s->pb; | 1388 ByteIOContext *pb = &s->pb; |
1389 MOVContext *mov = s->priv_data; | 1389 MOVContext *mov = s->priv_data; |
1390 int i; | 1390 int i; |
1391 | 1391 |
1392 /* Default mode == MP4 */ | |
1393 mov->mode = MODE_MP4; | |
1394 | |
1395 if (s->oformat != NULL) { | |
1396 if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; | |
1397 else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2; | |
1398 else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; | |
1399 else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; | |
1400 | |
1401 if ( mov->mode == MODE_3GP || mov->mode == MODE_3G2 || | |
1402 mov->mode == MODE_MP4 || mov->mode == MODE_PSP ) | |
1403 mov_write_ftyp_tag(pb,s); | |
1404 if ( mov->mode == MODE_PSP ) { | |
1405 if ( s->nb_streams != 2 ) { | |
1406 av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); | |
1407 return -1; | |
1408 } | |
1409 mov_write_uuidprof_tag(pb,s); | |
1410 } | |
1411 } | |
1412 | |
1392 for(i=0; i<s->nb_streams; i++){ | 1413 for(i=0; i<s->nb_streams; i++){ |
1393 AVCodecContext *c= s->streams[i]->codec; | 1414 AVCodecContext *c= s->streams[i]->codec; |
1394 | 1415 |
1395 if(c->codec_type == CODEC_TYPE_VIDEO){ | 1416 if(c->codec_type == CODEC_TYPE_VIDEO){ |
1396 av_set_pts_info(s->streams[i], 64, 1, c->time_base.den); | 1417 av_set_pts_info(s->streams[i], 64, 1, c->time_base.den); |
1407 return -1; | 1428 return -1; |
1408 else | 1429 else |
1409 av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, the file may be unplayable!\n"); | 1430 av_log(s, AV_LOG_INFO, "Warning, using MS style audio codec tag, the file may be unplayable!\n"); |
1410 } | 1431 } |
1411 } | 1432 } |
1412 /* don't know yet if mp4 or not */ | 1433 mov->tracks[i].language = ff_mov_iso639_to_lang(s->streams[i]->language, mov->mode != MODE_MOV); |
1413 mov->tracks[i].language = ff_mov_iso639_to_lang(s->streams[i]->language, 1); | |
1414 } | |
1415 | |
1416 /* Default mode == MP4 */ | |
1417 mov->mode = MODE_MP4; | |
1418 | |
1419 if (s->oformat != NULL) { | |
1420 if (!strcmp("3gp", s->oformat->name)) mov->mode = MODE_3GP; | |
1421 else if (!strcmp("3g2", s->oformat->name)) mov->mode = MODE_3G2; | |
1422 else if (!strcmp("mov", s->oformat->name)) mov->mode = MODE_MOV; | |
1423 else if (!strcmp("psp", s->oformat->name)) mov->mode = MODE_PSP; | |
1424 | |
1425 if ( mov->mode == MODE_3GP || mov->mode == MODE_3G2 || | |
1426 mov->mode == MODE_MP4 || mov->mode == MODE_PSP ) | |
1427 mov_write_ftyp_tag(pb,s); | |
1428 if ( mov->mode == MODE_PSP ) { | |
1429 if ( s->nb_streams != 2 ) { | |
1430 av_log(s, AV_LOG_ERROR, "PSP mode need one video and one audio stream\n"); | |
1431 return -1; | |
1432 } | |
1433 mov_write_uuidprof_tag(pb,s); | |
1434 } | |
1435 } | 1434 } |
1436 | 1435 |
1437 for (i=0; i<MAX_STREAMS; i++) { | 1436 for (i=0; i<MAX_STREAMS; i++) { |
1438 mov->tracks[i].mode = mov->mode; | 1437 mov->tracks[i].mode = mov->mode; |
1439 } | 1438 } |