Revision 72415b2a libavformat/movenc.c

View differences:

libavformat/movenc.c
333 333

  
334 334
    // the following fields is made of 6 bits to identify the streamtype (4 for video, 5 for audio)
335 335
    // plus 1 bit to indicate upstream and 1 bit set to 1 (reserved)
336
    if(track->enc->codec_type == CODEC_TYPE_AUDIO)
336
    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
337 337
        put_byte(pb, 0x15); // flags (= Audiostream)
338 338
    else
339 339
        put_byte(pb, 0x11); // flags (= Visualstream)
......
620 620
    else if (track->enc->codec_id == CODEC_ID_AC3)       tag = MKTAG('a','c','-','3');
621 621
    else if (track->enc->codec_id == CODEC_ID_DIRAC)     tag = MKTAG('d','r','a','c');
622 622
    else if (track->enc->codec_id == CODEC_ID_MOV_TEXT)  tag = MKTAG('t','x','3','g');
623
    else if (track->enc->codec_type == CODEC_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
624
    else if (track->enc->codec_type == CODEC_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
623
    else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) tag = MKTAG('m','p','4','v');
624
    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) tag = MKTAG('m','p','4','a');
625 625

  
626 626
    return tag;
627 627
}
......
642 642
    int tag = track->enc->codec_tag;
643 643

  
644 644
    // keep original tag for subs, ipod supports both formats
645
    if (!(track->enc->codec_type == CODEC_TYPE_SUBTITLE &&
645
    if (!(track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE &&
646 646
        (tag == MKTAG('t','x','3','g') ||
647 647
         tag == MKTAG('t','e','x','t'))))
648 648
        tag = ff_codec_get_tag(codec_ipod_tags, track->enc->codec_id);
......
714 714
            tag = mov_get_dv_codec_tag(s, track);
715 715
        else if (track->enc->codec_id == CODEC_ID_RAWVIDEO)
716 716
            tag = mov_get_rawvideo_codec_tag(s, track);
717
        else if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
717
        else if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
718 718
            tag = ff_codec_get_tag(codec_movvideo_tags, track->enc->codec_id);
719 719
            if (!tag) { // if no mac fcc found, try with Microsoft tags
720 720
                tag = ff_codec_get_tag(ff_codec_bmp_tags, track->enc->codec_id);
......
722 722
                    av_log(s, AV_LOG_INFO, "Warning, using MS style video codec tag, "
723 723
                           "the file may be unplayable!\n");
724 724
            }
725
        } else if (track->enc->codec_type == CODEC_TYPE_AUDIO) {
725
        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
726 726
            tag = ff_codec_get_tag(codec_movaudio_tags, track->enc->codec_id);
727 727
            if (!tag) { // if no mac fcc found, try with Microsoft tags
728 728
                int ms_tag = ff_codec_get_tag(ff_codec_wav_tags, track->enc->codec_id);
......
732 732
                           "the file may be unplayable!\n");
733 733
                }
734 734
            }
735
        } else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE)
735
        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
736 736
            tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, track->enc->codec_id);
737 737
    }
738 738

  
......
868 868
    put_tag(pb, "stsd");
869 869
    put_be32(pb, 0); /* version & flags */
870 870
    put_be32(pb, 1); /* entry count */
871
    if (track->enc->codec_type == CODEC_TYPE_VIDEO)
871
    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
872 872
        mov_write_video_tag(pb, track);
873
    else if (track->enc->codec_type == CODEC_TYPE_AUDIO)
873
    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
874 874
        mov_write_audio_tag(pb, track);
875
    else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE)
875
    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)
876 876
        mov_write_subtitle_tag(pb, track);
877 877
    return updateSize(pb, pos);
878 878
}
......
918 918
    uint32_t atom_size;
919 919
    int i;
920 920

  
921
    if (track->enc->codec_type == CODEC_TYPE_AUDIO && !track->audio_vbr) {
921
    if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO && !track->audio_vbr) {
922 922
        stts_entries = av_malloc(sizeof(*stts_entries)); /* one entry */
923 923
        stts_entries[0].count = track->sampleCount;
924 924
        stts_entries[0].duration = 1;
......
973 973
    put_tag(pb, "stbl");
974 974
    mov_write_stsd_tag(pb, track);
975 975
    mov_write_stts_tag(pb, track);
976
    if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
976
    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO &&
977 977
        track->hasKeyframes && track->hasKeyframes < track->entry)
978 978
        mov_write_stss_tag(pb, track, MOV_SYNC_SAMPLE);
979 979
    if (track->mode == MODE_MOV && track->flags & MOV_TRACK_STPS)
980 980
        mov_write_stss_tag(pb, track, MOV_PARTIAL_SYNC_SAMPLE);
981
    if (track->enc->codec_type == CODEC_TYPE_VIDEO &&
981
    if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO &&
982 982
        track->flags & MOV_TRACK_CTTS)
983 983
        mov_write_ctts_tag(pb, track);
984 984
    mov_write_stsc_tag(pb, track);
......
1050 1050
        descr = "DataHandler";
1051 1051
    } else {
1052 1052
        hdlr = (track->mode == MODE_MOV) ? "mhlr" : "\0\0\0\0";
1053
        if (track->enc->codec_type == CODEC_TYPE_VIDEO) {
1053
        if (track->enc->codec_type == AVMEDIA_TYPE_VIDEO) {
1054 1054
            hdlr_type = "vide";
1055 1055
            descr = "VideoHandler";
1056
        } else if (track->enc->codec_type == CODEC_TYPE_AUDIO) {
1056
        } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) {
1057 1057
            hdlr_type = "soun";
1058 1058
            descr = "SoundHandler";
1059
        } else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
1059
        } else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
1060 1060
            if (track->tag == MKTAG('t','x','3','g')) hdlr_type = "sbtl";
1061 1061
            else                                      hdlr_type = "text";
1062 1062
            descr = "SubtitleHandler";
......
1084 1084
    int64_t pos = url_ftell(pb);
1085 1085
    put_be32(pb, 0); /* size */
1086 1086
    put_tag(pb, "minf");
1087
    if(track->enc->codec_type == CODEC_TYPE_VIDEO)
1087
    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO)
1088 1088
        mov_write_vmhd_tag(pb);
1089
    else if (track->enc->codec_type == CODEC_TYPE_AUDIO)
1089
    else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
1090 1090
        mov_write_smhd_tag(pb);
1091
    else if (track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
1091
    else if (track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
1092 1092
        if (track->tag == MKTAG('t','e','x','t')) mov_write_gmhd_tag(pb);
1093 1093
        else                                      mov_write_nmhd_tag(pb);
1094 1094
    }
......
1165 1165
    put_be32(pb, 0); /* reserved */
1166 1166
    put_be32(pb, 0x0); /* reserved (Layer & Alternate group) */
1167 1167
    /* Volume, only for audio */
1168
    if(track->enc->codec_type == CODEC_TYPE_AUDIO)
1168
    if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
1169 1169
        put_be16(pb, 0x0100);
1170 1170
    else
1171 1171
        put_be16(pb, 0);
......
1183 1183
    put_be32(pb, 0x40000000); /* reserved */
1184 1184

  
1185 1185
    /* Track width and height, for visual only */
1186
    if(track->enc->codec_type == CODEC_TYPE_VIDEO ||
1187
       track->enc->codec_type == CODEC_TYPE_SUBTITLE) {
1186
    if(track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
1187
       track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE) {
1188 1188
        double sample_aspect_ratio = av_q2d(st->sample_aspect_ratio);
1189 1189
        if(!sample_aspect_ratio || track->height != track->enc->height)
1190 1190
            sample_aspect_ratio = 1;
......
1671 1671

  
1672 1672
    for (i = 0; i < s->nb_streams; i++) {
1673 1673
        AVStream *st = s->streams[i];
1674
        if (st->codec->codec_type == CODEC_TYPE_VIDEO)
1674
        if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
1675 1675
            has_video = 1;
1676 1676
        if (st->codec->codec_id == CODEC_ID_H264)
1677 1677
            has_h264 = 1;
......
1829 1829
                   "codec not currently supported in container\n", i);
1830 1830
            goto error;
1831 1831
        }
1832
        if(st->codec->codec_type == CODEC_TYPE_VIDEO){
1832
        if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
1833 1833
            if (track->tag == MKTAG('m','x','3','p') || track->tag == MKTAG('m','x','3','n') ||
1834 1834
                track->tag == MKTAG('m','x','4','p') || track->tag == MKTAG('m','x','4','n') ||
1835 1835
                track->tag == MKTAG('m','x','5','p') || track->tag == MKTAG('m','x','5','n')) {
......
1845 1845
                       "WARNING codec timebase is very high. If duration is too long,\n"
1846 1846
                       "file may not be playable by quicktime. Specify a shorter timebase\n"
1847 1847
                       "or choose different container.\n");
1848
        }else if(st->codec->codec_type == CODEC_TYPE_AUDIO){
1848
        }else if(st->codec->codec_type == AVMEDIA_TYPE_AUDIO){
1849 1849
            track->timescale = st->codec->sample_rate;
1850 1850
            if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
1851 1851
                av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
......
1868 1868
                    goto error;
1869 1869
                }
1870 1870
            }
1871
        }else if(st->codec->codec_type == CODEC_TYPE_SUBTITLE){
1871
        }else if(st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE){
1872 1872
            track->timescale = st->codec->time_base.den;
1873 1873
        }
1874 1874
        if (!track->height)

Also available in: Unified diff