Revision f009e36f

View differences:

libavformat/matroskadec.c
31 31
#include "avformat.h"
32 32
/* For codec_get_id(). */
33 33
#include "riff.h"
34
#include "isom.h"
34 35
#include "matroska.h"
35 36
#include "libavcodec/mpeg4audio.h"
36 37
#include "libavutil/intfloat_readwrite.h"
......
2550 2551

  
2551 2552
            }
2552 2553

  
2554
            if (!strcmp(track->codec_id, "V_QUICKTIME") &&
2555
                (track->codec_priv_size >= 86) &&
2556
                (track->codec_priv != NULL)) {
2557
                MatroskaVideoTrack *vtrack = (MatroskaVideoTrack *) track;
2558

  
2559
                vtrack->fourcc = AV_RL32(track->codec_priv);
2560
                codec_id = codec_get_id(codec_movvideo_tags, vtrack->fourcc);
2561
            }
2562

  
2553 2563
            else if (codec_id == CODEC_ID_AAC && !track->codec_priv_size) {
2554 2564
                MatroskaAudioTrack *audiotrack = (MatroskaAudioTrack *) track;
2555 2565
                int profile = matroska_aac_profile(track->codec_id);
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