diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-01-21 20:06:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-01-21 20:06:19 +0000 |
commit | 24c14d6d018bb3c4716266d955e75c7952eddf3b (patch) | |
tree | 8a47da117afe2eee1dcc57633ab16598db003227 /libavformat | |
parent | efbd19fe760edcd71adcf3b60fd23ec3ae259e83 (diff) | |
download | ffmpeg-24c14d6d018bb3c4716266d955e75c7952eddf3b.tar.gz |
simplify GUIDs
Originally committed as revision 7611 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/asf-enc.c | 9 | ||||
-rw-r--r-- | libavformat/asf.c | 33 | ||||
-rw-r--r-- | libavformat/asf.h | 51 |
3 files changed, 32 insertions, 61 deletions
diff --git a/libavformat/asf-enc.c b/libavformat/asf-enc.c index 811b9da1cf..45f727bf47 100644 --- a/libavformat/asf-enc.c +++ b/libavformat/asf-enc.c @@ -200,13 +200,8 @@ static const uint8_t error_spread_ADPCM_G726[] = { 0x01, 0x90, 0x01, 0x90, 0x01, static void put_guid(ByteIOContext *s, const GUID *g) { - int i; - - put_le32(s, g->v1); - put_le16(s, g->v2); - put_le16(s, g->v3); - for(i=0;i<8;i++) - put_byte(s, g->v4[i]); + assert(sizeof(*g) == 16); + put_buffer(s, g, sizeof(*g)); } static void put_str16_nolen(ByteIOContext *s, const char *tag); diff --git a/libavformat/asf.c b/libavformat/asf.c index df4de7c521..c971828c18 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -31,7 +31,7 @@ // Fix Me! FRAME_HEADER_SIZE may be different. static const GUID index_guid = { - 0x33000890, 0xe5b1, 0x11cf, { 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb }, + 0x90, 0x08, 0x00, 0x33, 0xb1, 0xe5, 0xcf, 0x11, 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb }; /**********************************/ @@ -69,9 +69,8 @@ static void print_guid(const GUID *g) else PRINT_IF_GUID(g, ext_stream_audio_stream); else printf("(GUID: unknown) "); - printf("0x%08x, 0x%04x, 0x%04x, {", g->v1, g->v2, g->v3); - for(i=0;i<8;i++) - printf(" 0x%02x,", g->v4[i]); + for(i=0;i<16;i++) + printf(" 0x%02x,", (*g)[i]); printf("}\n"); } #undef PRINT_IF_GUID @@ -79,13 +78,8 @@ static void print_guid(const GUID *g) static void get_guid(ByteIOContext *s, GUID *g) { - int i; - - g->v1 = get_le32(s); - g->v2 = get_le16(s); - g->v3 = get_le16(s); - for(i=0;i<8;i++) - g->v4[i] = get_byte(s); + assert(sizeof(*g) == 16); + get_buffer(s, g, sizeof(*g)); } #if 0 @@ -119,24 +113,11 @@ static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size) static int asf_probe(AVProbeData *pd) { - GUID g; - const unsigned char *p; - int i; - /* check file header */ if (pd->buf_size <= 32) return 0; - p = pd->buf; - g.v1 = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); - p += 4; - g.v2 = p[0] | (p[1] << 8); - p += 2; - g.v3 = p[0] | (p[1] << 8); - p += 2; - for(i=0;i<8;i++) - g.v4[i] = *p++; - - if (!memcmp(&g, &asf_header, sizeof(GUID))) + + if (!memcmp(pd->buf, &asf_header, sizeof(GUID))) return AVPROBE_SCORE_MAX; else return 0; diff --git a/libavformat/asf.h b/libavformat/asf.h index 5e3d26c399..d04f99d5dc 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -38,12 +38,7 @@ typedef struct { } ASFStream; -typedef struct { - uint32_t v1; - uint16_t v2; - uint16_t v3; - uint8_t v4[8]; -} GUID; +typedef uint8_t GUID[16]; typedef struct { GUID guid; // generated by client computer @@ -137,90 +132,90 @@ typedef struct { } ASFContext; static const GUID asf_header = { - 0x75B22630, 0x668E, 0x11CF, { 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C }, + 0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C }; static const GUID file_header = { - 0x8CABDCA1, 0xA947, 0x11CF, { 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, + 0xA1, 0xDC, 0xAB, 0x8C, 0x47, 0xA9, 0xCF, 0x11, 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }; static const GUID stream_header = { - 0xB7DC0791, 0xA9B7, 0x11CF, { 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }, + 0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 }; static const GUID ext_stream_header = { - 0x14E6A5CB, 0xC672, 0x4332, { 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A }, + 0xCB, 0xA5, 0xE6, 0x14, 0x72, 0xC6, 0x32, 0x43, 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A }; static const GUID audio_stream = { - 0xF8699E40, 0x5B4D, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, + 0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }; static const GUID audio_conceal_none = { - // 0x49f1a440, 0x4ece, 0x11d0, { 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }, + // 0x40, 0xa4, 0xf1, 0x49, 0x4ece, 0x11d0, 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 // New value lifted from avifile - 0x20fb5700, 0x5b55, 0x11cf, { 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }, + 0x00, 0x57, 0xfb, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b }; static const GUID audio_conceal_spread = { - 0xBFC3CD50, 0x618F, 0x11CF, { 0x8B, 0xB2, 0x00, 0xAA, 0x00, 0xB4, 0xE2, 0x20 }, + 0x50, 0xCD, 0xC3, 0xBF, 0x8F, 0x61, 0xCF, 0x11, 0x8B, 0xB2, 0x00, 0xAA, 0x00, 0xB4, 0xE2, 0x20 }; static const GUID video_stream = { - 0xBC19EFC0, 0x5B4D, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, + 0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }; static const GUID video_conceal_none = { - 0x20FB5700, 0x5B55, 0x11CF, { 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }, + 0x00, 0x57, 0xFB, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B }; static const GUID command_stream = { - 0x59DACFC0, 0x59E6, 0x11D0, { 0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }, + 0xC0, 0xCF, 0xDA, 0x59, 0xE6, 0x59, 0xD0, 0x11, 0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }; static const GUID comment_header = { - 0x75b22633, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }, + 0x33, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }; static const GUID codec_comment_header = { - 0x86D15240, 0x311D, 0x11D0, { 0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }, + 0x40, 0x52, 0xD1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 }; static const GUID codec_comment1_header = { - 0x86d15241, 0x311d, 0x11d0, { 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }, + 0x41, 0x52, 0xd1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 }; static const GUID data_header = { - 0x75b22636, 0x668e, 0x11cf, { 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }, + 0x36, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c }; static const GUID head1_guid = { - 0x5fbf03b5, 0xa92e, 0x11cf, { 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }, + 0xb5, 0x03, 0xbf, 0x5f, 0x2E, 0xA9, 0xCF, 0x11, 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }; static const GUID head2_guid = { - 0xabd3d211, 0xa9ba, 0x11cf, { 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }, + 0x11, 0xd2, 0xd3, 0xab, 0xBA, 0xA9, 0xCF, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 }; static const GUID extended_content_header = { - 0xD2D0A440, 0xE307, 0x11D2, { 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 }, + 0x40, 0xA4, 0xD0, 0xD2, 0x07, 0xE3, 0xD2, 0x11, 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 }; static const GUID simple_index_header = { - 0x33000890, 0xE5B1, 0x11CF, { 0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB }, + 0x90, 0x08, 0x00, 0x33, 0xB1, 0xE5, 0xCF, 0x11, 0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB }; static const GUID ext_stream_embed_stream_header = { - 0x3afb65e2, 0x47ef, 0x40f2, { 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43} + 0xe2, 0x65, 0xfb, 0x3a, 0xEF, 0x47, 0xF2, 0x40, 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43 }; static const GUID ext_stream_audio_stream = { - 0x31178c9d, 0x03e1, 0x4528, { 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03} + 0x9d, 0x8c, 0x17, 0x31, 0xE1, 0x03, 0x28, 0x45, 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03 }; /* I am not a number !!! This GUID is the one found on the PC used to generate the stream */ static const GUID my_guid = { - 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000 |