Ticket #468: patchiaudio.diff

File patchiaudio.diff, 1.9 KB (added by cehoyos, 3 years ago)
  • libavformat/movenc.c

    diff --git a/libavformat/movenc.c b/libavformat/movenc.c
    index 510cef5..42496b5 100644
    a b static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) 
    16021602    (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ 
    16031603    ffio_wfourcc(pb, "tkhd"); 
    16041604    avio_w8(pb, version); 
    1605     avio_wb24(pb, 0xf); /* flags (track enabled) */ 
     1605    avio_wb24(pb, track->secondary ? 0x2 : 0xf); /* flags (first track enabled) */ 
    16061606    if (version == 1) { 
    16071607        avio_wb64(pb, track->time); 
    16081608        avio_wb64(pb, track->time); 
    static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, 
    23152315{ 
    23162316    int i; 
    23172317    int64_t pos = avio_tell(pb); 
     2318    int not_first[AVMEDIA_TYPE_NB]={0}; 
    23182319    avio_wb32(pb, 0); /* size placeholder*/ 
    23192320    ffio_wfourcc(pb, "moov"); 
    23202321 
    static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, 
    23552356        mov_write_iods_tag(pb, mov); 
    23562357    for (i=0; i<mov->nb_streams; i++) { 
    23572358        if (mov->tracks[i].entry > 0 || mov->flags & FF_MOV_FLAG_FRAGMENT) { 
     2359            if(i < s->nb_streams){ 
     2360                int codec_type= s->streams[i]->codec->codec_type; 
     2361                if(codec_type==AVMEDIA_TYPE_AUDIO || codec_type==AVMEDIA_TYPE_SUBTITLE){ 
     2362                    mov->tracks[i].secondary= not_first[codec_type]; 
     2363                    not_first[codec_type]= 1; 
     2364                } 
     2365            } 
    23582366            mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL); 
    23592367        } 
    23602368    } 
  • libavformat/movenc.h

    diff --git a/libavformat/movenc.h b/libavformat/movenc.h
    index b5d066f..a5db895 100644
    a b typedef struct MOVIndex { 
    9494#define MOV_TIMECODE_FLAG_ALLOWNEGATIVE 0x0004 
    9595    uint32_t    timecode_flags; 
    9696    int         language; 
     97    int         secondary; 
    9798    int         track_id; 
    9899    int         tag; ///< stsd fourcc 
    99100    AVCodecContext *enc;