Revision 4d0c3dc0 libavformat/asfdec.c

View differences:

libavformat/asfdec.c
48 48

  
49 49
#ifdef DEBUG
50 50
#define PRINT_IF_GUID(g,cmp) \
51
if (!memcmp(g, &cmp, sizeof(GUID))) \
51
if (!guidcmp(g, &cmp)) \
52 52
    dprintf(NULL, "(GUID: %s) ", #cmp)
53 53

  
54 54
static void print_guid(const GUID *g)
......
87 87
#define print_guid(g)
88 88
#endif
89 89

  
90
static int guidcmp(const void *g1, const void *g2)
91
{
92
    return memcmp(g1, g2, sizeof(GUID));
93
}
94

  
90 95
static void get_guid(ByteIOContext *s, GUID *g)
91 96
{
92 97
    assert(sizeof(*g) == 16);
......
125 130
static int asf_probe(AVProbeData *pd)
126 131
{
127 132
    /* check file header */
128
    if (!memcmp(pd->buf, &ff_asf_header, sizeof(GUID)))
133
    if (!guidcmp(pd->buf, &ff_asf_header))
129 134
        return AVPROBE_SCORE_MAX;
130 135
    else
131 136
        return 0;
......
174 179
    memset(bitrate, 0, sizeof(bitrate));
175 180

  
176 181
    get_guid(pb, &g);
177
    if (memcmp(&g, &ff_asf_header, sizeof(GUID)))
182
    if (guidcmp(&g, &ff_asf_header))
178 183
        return -1;
179 184
    get_le64(pb);
180 185
    get_le32(pb);
......
187 192
        dprintf(s, "%08"PRIx64": ", url_ftell(pb) - 24);
188 193
        print_guid(&g);
189 194
        dprintf(s, "  size=0x%"PRIx64"\n", gsize);
190
        if (!memcmp(&g, &ff_asf_data_header, sizeof(GUID))) {
195
        if (!guidcmp(&g, &ff_asf_data_header)) {
191 196
            asf->data_object_offset = url_ftell(pb);
192 197
            // if not streaming, gsize is not unlimited (how?), and there is enough space in the file..
193 198
            if (!(asf->hdr.flags & 0x01) && gsize >= 100) {
......
199 204
        }
200 205
        if (gsize < 24)
201 206
            return -1;
202
        if (!memcmp(&g, &ff_asf_file_header, sizeof(GUID))) {
207
        if (!guidcmp(&g, &ff_asf_file_header)) {
203 208
            get_guid(pb, &asf->hdr.guid);
204 209
            asf->hdr.file_size          = get_le64(pb);
205 210
            asf->hdr.create_time        = get_le64(pb);
......
213 218
            asf->hdr.max_pktsize        = get_le32(pb);
214 219
            asf->hdr.max_bitrate        = get_le32(pb);
215 220
            asf->packet_size = asf->hdr.max_pktsize;
216
        } else if (!memcmp(&g, &ff_asf_stream_header, sizeof(GUID))) {
221
        } else if (!guidcmp(&g, &ff_asf_stream_header)) {
217 222
            enum CodecType type;
218 223
            int type_specific_size, sizeX;
219 224
            uint64_t total_size;
......
240 245
            get_guid(pb, &g);
241 246

  
242 247
            test_for_ext_stream_audio = 0;
243
            if (!memcmp(&g, &ff_asf_audio_stream, sizeof(GUID))) {
248
            if (!guidcmp(&g, &ff_asf_audio_stream)) {
244 249
                type = CODEC_TYPE_AUDIO;
245
            } else if (!memcmp(&g, &ff_asf_video_stream, sizeof(GUID))) {
250
            } else if (!guidcmp(&g, &ff_asf_video_stream)) {
246 251
                type = CODEC_TYPE_VIDEO;
247
            } else if (!memcmp(&g, &ff_asf_command_stream, sizeof(GUID))) {
252
            } else if (!guidcmp(&g, &ff_asf_command_stream)) {
248 253
                type = CODEC_TYPE_DATA;
249
            } else if (!memcmp(&g, &ff_asf_ext_stream_embed_stream_header, sizeof(GUID))) {
254
            } else if (!guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) {
250 255
                test_for_ext_stream_audio = 1;
251 256
                type = CODEC_TYPE_UNKNOWN;
252 257
            } else {
......
264 269

  
265 270
            if (test_for_ext_stream_audio) {
266 271
                get_guid(pb, &g);
267
                if (!memcmp(&g, &ff_asf_ext_stream_audio_stream, sizeof(GUID))) {
272
                if (!guidcmp(&g, &ff_asf_ext_stream_audio_stream)) {
268 273
                    type = CODEC_TYPE_AUDIO;
269 274
                    is_dvr_ms_audio=1;
270 275
                    get_guid(pb, &g);
......
370 375
            }
371 376
            pos2 = url_ftell(pb);
372 377
            url_fskip(pb, gsize - (pos2 - pos1 + 24));
373
        } else if (!memcmp(&g, &ff_asf_comment_header, sizeof(GUID))) {
378
        } else if (!guidcmp(&g, &ff_asf_comment_header)) {
374 379
            int len1, len2, len3, len4, len5;
375 380

  
376 381
            len1 = get_le16(pb);
......
383 388
            get_tag(s, "copyright", 0, len3);
384 389
            get_tag(s, "comment"  , 0, len4);
385 390
            url_fskip(pb, len5);
386
        } else if (!memcmp(&g, &stream_bitrate_guid, sizeof(GUID))) {
391
        } else if (!guidcmp(&g, &stream_bitrate_guid)) {
387 392
            int stream_count = get_le16(pb);
388 393
            int j;
389 394

  
......
398 403
//                av_log(s, AV_LOG_ERROR, "flags: 0x%x stream id %d, bitrate %d\n", flags, stream_id, bitrate);
399 404
                asf->stream_bitrates[stream_id]= bitrate;
400 405
            }
401
        } else if (!memcmp(&g, &ff_asf_extended_content_header, sizeof(GUID))) {
406
        } else if (!guidcmp(&g, &ff_asf_extended_content_header)) {
402 407
            int desc_count, i;
403 408

  
404 409
            desc_count = get_le16(pb);
......
412 417
                    value_len  = get_le16(pb);
413 418
                    get_tag(s, name, value_type, value_len);
414 419
            }
415
        } else if (!memcmp(&g, &ff_asf_metadata_header, sizeof(GUID))) {
420
        } else if (!guidcmp(&g, &ff_asf_metadata_header)) {
416 421
            int n, stream_num, name_len, value_len, value_type, value_num;
417 422
            n = get_le16(pb);
418 423

  
......
435 440
                    else if(!strcmp(name, "AspectRatioY")) dar[stream_num].den= value_num;
436 441
                }
437 442
            }
438
        } else if (!memcmp(&g, &ff_asf_ext_stream_header, sizeof(GUID))) {
443
        } else if (!guidcmp(&g, &ff_asf_ext_stream_header)) {
439 444
            int ext_len, payload_ext_ct, stream_ct;
440 445
            uint32_t ext_d, leak_rate, stream_num;
441 446
            int64_t pos_ex_st;
......
475 480

  
476 481
            // there could be a optional stream properties object to follow
477 482
            // if so the next iteration will pick it up
478
        } else if (!memcmp(&g, &ff_asf_head1_guid, sizeof(GUID))) {
483
        } else if (!guidcmp(&g, &ff_asf_head1_guid)) {
479 484
            int v1, v2;
480 485
            get_guid(pb, &g);
481 486
            v1 = get_le32(pb);
482 487
            v2 = get_le16(pb);
483 488
#if 0
484
        } else if (!memcmp(&g, &ff_asf_codec_comment_header, sizeof(GUID))) {
489
        } else if (!guidcmp(&g, &ff_asf_codec_comment_header)) {
485 490
            int len, v1, n, num;
486 491
            char str[256], *q;
487 492
            char tag[16];
......
990 995

  
991 996
    url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
992 997
    get_guid(s->pb, &g);
993
    if (!memcmp(&g, &index_guid, sizeof(GUID))) {
998
    if (!guidcmp(&g, &index_guid)) {
994 999
        gsize = get_le64(s->pb);
995 1000
        get_guid(s->pb, &g);
996 1001
        itime=get_le64(s->pb);

Also available in: Unified diff