Revision f009e36f libavformat/matroskaenc.c

View differences:

libavformat/matroskaenc.c
21 21

  
22 22
#include "avformat.h"
23 23
#include "riff.h"
24
#include "isom.h"
24 25
#include "matroska.h"
25 26
#include "avc.h"
26 27
#include "libavutil/md5.h"
......
467 468
    }
468 469
}
469 470

  
470
static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id)
471
static int mkv_write_codecprivate(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec, int native_id, int qt_id)
471 472
{
472 473
    ByteIOContext *dyn_cp;
473 474
    uint8_t *codecpriv;
......
487 488
        else if (codec->extradata_size)
488 489
            put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
489 490
    } else if (codec->codec_type == CODEC_TYPE_VIDEO) {
491
        if (qt_id) {
492
            if (!codec->codec_tag)
493
                codec->codec_tag = codec_get_tag(codec_movvideo_tags, codec->codec_id);
494
            if (codec->extradata_size)
495
                put_buffer(dyn_cp, codec->extradata, codec->extradata_size);
496
        } else {
490 497
        if (!codec->codec_tag)
491 498
            codec->codec_tag = codec_get_tag(codec_bmp_tags, codec->codec_id);
492 499
        if (!codec->codec_tag) {
......
495 502
        }
496 503

  
497 504
        put_bmp_header(dyn_cp, codec, codec_bmp_tags, 0);
505
        }
498 506

  
499 507
    } else if (codec->codec_type == CODEC_TYPE_AUDIO) {
500 508
        if (!codec->codec_tag)
......
530 538
        AVCodecContext *codec = st->codec;
531 539
        ebml_master subinfo, track;
532 540
        int native_id = 0;
541
        int qt_id = 0;
533 542
        int bit_depth = av_get_bits_per_sample(codec->codec_id);
534 543
        int sample_rate = codec->sample_rate;
535 544
        int output_sample_rate = 0;
......
566 575
            case CODEC_TYPE_VIDEO:
567 576
                put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
568 577

  
569
                if (!native_id)
578
                if (!native_id &&
579
                      codec_get_tag(codec_movvideo_tags, codec->codec_id) &&
580
                    (!codec_get_tag(codec_bmp_tags,      codec->codec_id)
581
                     || codec->codec_id == CODEC_ID_SVQ1
582
                     || codec->codec_id == CODEC_ID_SVQ3
583
                     || codec->codec_id == CODEC_ID_CINEPAK))
584
                    qt_id = 1;
585

  
586
                if (qt_id)
587
                    put_ebml_string(pb, MATROSKA_ID_CODECID, "V_QUICKTIME");
588
                else if (!native_id)
570 589
                    // if there is no mkv-specific codec ID, use VFW mode
571 590
                    put_ebml_string(pb, MATROSKA_ID_CODECID, MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC);
572 591

  
......
607 626
                av_log(s, AV_LOG_ERROR, "Only audio, video, and subtitles are supported for Matroska.");
608 627
                break;
609 628
        }
610
        ret = mkv_write_codecprivate(s, pb, codec, native_id);
629
        ret = mkv_write_codecprivate(s, pb, codec, native_id, qt_id);
611 630
        if (ret < 0) return ret;
612 631

  
613 632
        end_ebml_master(pb, track);

Also available in: Unified diff