Revision 1522767d libavformat/movenc.c

View differences:

libavformat/movenc.c
1389 1389
    MOVContext *mov = s->priv_data;
1390 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 1413
    for(i=0; i<s->nb_streams; i++){
1393 1414
        AVCodecContext *c= s->streams[i]->codec;
1394 1415

  
......
1409 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 */
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
        }
1433
        mov->tracks[i].language = ff_mov_iso639_to_lang(s->streams[i]->language, mov->mode != MODE_MOV);
1435 1434
    }
1436 1435

  
1437 1436
    for (i=0; i<MAX_STREAMS; i++) {

Also available in: Unified diff