Revision fc4cbc16 libavformat/movenc.c

View differences:

libavformat/movenc.c
516 516
    return updateSize(pb, pos);
517 517
}
518 518

  
519
/* also used by all avid codecs (dv, imx, meridien) and their variants */
520
static int mov_write_avid_tag(ByteIOContext *pb, MOVTrack *track)
521
{
522
    int i;
523
    put_be32(pb, 24); /* size */
524
    put_tag(pb, "ACLR");
525
    put_tag(pb, "ACLR");
526
    put_tag(pb, "0001");
527
    put_be32(pb, 1); /* yuv 1 / rgb 2 ? */
528
    put_be32(pb, 0); /* unknown */
529

  
530
    put_be32(pb, 24); /* size */
531
    put_tag(pb, "APRG");
532
    put_tag(pb, "APRG");
533
    put_tag(pb, "0001");
534
    put_be32(pb, 1); /* unknown */
535
    put_be32(pb, 0); /* unknown */
536

  
537
    put_be32(pb, 120); /* size */
538
    put_tag(pb, "ARES");
539
    put_tag(pb, "ARES");
540
    put_tag(pb, "0001");
541
    put_be32(pb, AV_RB32(track->vosData + 0x28)); /* dnxhd cid, some id ? */
542
    put_be32(pb, track->enc->width);
543
    /* values below are based on samples created with quicktime and avid codecs */
544
    if (track->vosData[5] & 2) { // interlaced
545
        put_be32(pb, track->enc->height/2);
546
        put_be32(pb, 2); /* unknown */
547
        put_be32(pb, 0); /* unknown */
548
        put_be32(pb, 4); /* unknown */
549
    } else {
550
        put_be32(pb, track->enc->height);
551
        put_be32(pb, 1); /* unknown */
552
        put_be32(pb, 0); /* unknown */
553
        put_be32(pb, 5); /* unknown */
554
    }
555
    /* padding */
556
    for (i = 0; i < 10; i++)
557
        put_be64(pb, 0);
558

  
559
    /* extra padding for stsd needed */
560
    put_be32(pb, 0);
561
    return 0;
562
}
563

  
519 564
static int mov_find_video_codec_tag(AVFormatContext *s, MOVTrack *track)
520 565
{
521 566
    int tag = track->enc->codec_tag;
......
623 668
        mov_write_svq3_tag(pb);
624 669
    else if(track->enc->codec_id == CODEC_ID_H264)
625 670
        mov_write_avcc_tag(pb, track);
671
    else if(track->enc->codec_id == CODEC_ID_DNXHD)
672
        mov_write_avid_tag(pb, track);
626 673

  
627 674
    return updateSize (pb, pos);
628 675
}
......
1561 1608
        avc_parse_nal_units(&pkt->data, &pkt->size);
1562 1609
        assert(pkt->size);
1563 1610
        size = pkt->size;
1611
    } else if (enc->codec_id == CODEC_ID_DNXHD && !trk->vosLen) {
1612
        /* copy frame header to create needed atoms */
1613
        if (size < 640)
1614
            return -1;
1615
        trk->vosLen = 640;
1616
        trk->vosData = av_malloc(trk->vosLen);
1617
        memcpy(trk->vosData, pkt->data, 640);
1564 1618
    }
1565 1619

  
1566 1620
    if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) {

Also available in: Unified diff