Revision 2727c35e

View differences:

libav/asf.c
392 392
            put_le16(pb, 40); /* size */
393 393

  
394 394
            /* BITMAPINFOHEADER header */
395
            put_bmp_header(pb, enc, codec_bmp_tags);
395
            put_bmp_header(pb, enc, codec_bmp_tags, 1);
396 396
        }
397 397
        end_header(pb, hpos);
398 398
    }
libav/avi.h
12 12
typedef struct CodecTag {
13 13
    int id;
14 14
    unsigned int tag;
15
    unsigned int invalid_asf : 1;
15 16
} CodecTag;
16 17

  
17
void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, CodecTag *tags);
18
void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, CodecTag *tags, int for_asf);
18 19
int put_wav_header(ByteIOContext *pb, AVCodecContext *enc);
19 20
int wav_codec_get_id(unsigned int tag, int bps);
20 21
void get_wav_header(ByteIOContext *pb, AVCodecContext *codec, 
libav/avienc.c
60 60
    { CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
61 61
    { CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
62 62
    { CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
63
    { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
64
    { CODEC_ID_MPEG4, MKTAG('d', 'i', 'v', 'x') },
65
    { CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
66
    { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
67
    { CODEC_ID_MPEG4, MKTAG('x', 'v', 'i', 'd') },
68
    { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 's') },
63
    { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X'), invalid_asf: 1 },
64
    { CODEC_ID_MPEG4, MKTAG('d', 'i', 'v', 'x'), invalid_asf: 1},
65
    { CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0'), invalid_asf: 1 },
66
    { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D'), invalid_asf: 1 },
67
    { CODEC_ID_MPEG4, MKTAG('x', 'v', 'i', 'd'), invalid_asf: 1 },
68
    { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 's'), invalid_asf: 1 },
69 69
    { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
70 70
    { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
71 71
    { CODEC_ID_MPEG4, MKTAG('m', '4', 's', '2') },
72 72
    { CODEC_ID_MPEG4, MKTAG(0x04, 0, 0, 0) }, /* some broken avi use this */
73
    { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
73
    { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3'), invalid_asf: 1 }, /* default signature when using MSMPEG4 */
74 74
    { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') }, 
75 75
    { CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') }, 
76 76
    { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') }, 
......
96 96
    return 0;
97 97
}
98 98

  
99
static unsigned int codec_get_asf_tag(const CodecTag *tags, int id)
100
{
101
    while (tags->id != 0) {
102
        if (!tags->invalid_asf && tags->id == id)
103
            return tags->tag;
104
        tags++;
105
    }
106
    return 0;
107
}
108

  
99 109
int codec_get_id(const CodecTag *tags, unsigned int tag)
100 110
{
101 111
    while (tags->id != 0) {
......
112 122
}
113 123

  
114 124
/* BITMAPINFOHEADER header */
115
void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, CodecTag *tags)
125
void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, CodecTag *tags, int for_asf)
116 126
{
117 127
    put_le32(pb, 40); /* size */
118 128
    put_le32(pb, enc->width);
......
120 130
    put_le16(pb, 1); /* planes */
121 131
    put_le16(pb, 24); /* depth */
122 132
    /* compression type */
123
    put_le32(pb, codec_get_tag(tags, enc->codec_id));
133
    put_le32(pb, for_asf ? codec_get_asf_tag(tags, enc->codec_id) : codec_get_tag(tags, enc->codec_id));
124 134
    put_le32(pb, enc->width * enc->height * 3);
125 135
    put_le32(pb, 0);
126 136
    put_le32(pb, 0);
......
265 275
        strf = start_tag(pb, "strf");
266 276
        switch(stream->codec_type) {
267 277
        case CODEC_TYPE_VIDEO:
268
	    put_bmp_header(pb, stream, codec_bmp_tags);
278
	    put_bmp_header(pb, stream, codec_bmp_tags, 0);
269 279
            break;
270 280
        case CODEC_TYPE_AUDIO:
271 281
            if (put_wav_header(pb, stream) < 0) {

Also available in: Unified diff