diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index 5933ffe992..2ce7dc87f5 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -45,13 +45,6 @@ #define BLKSIZE 1024 -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - #define CLAMP_TO_SHORT(value) \ if (value > 32767) \ value = 32767; \ diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index cbc65dfc6a..53307882e6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2118,6 +2118,18 @@ extern int av_log_get_level(void); extern void av_log_set_level(int); extern void av_log_set_callback(void (*)(void*, int, const char*, va_list)); +/* endian macros */ +#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) +#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ + (((uint8_t*)(x))[1] << 16) | \ + (((uint8_t*)(x))[2] << 8) | \ + ((uint8_t*)(x))[3]) +#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) +#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ + (((uint8_t*)(x))[2] << 16) | \ + (((uint8_t*)(x))[1] << 8) | \ + ((uint8_t*)(x))[0]) + #ifdef __cplusplus } #endif diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index e8d3efc3c0..412db7f7e5 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -37,12 +37,6 @@ #define PALETTE_COUNT 256 -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - typedef struct { uint8_t y0, y1, y2, y3; uint8_t u, v; diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index b59a9cd6b8..b80604e5f4 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -44,11 +44,6 @@ typedef struct DPCMContext { #define SATURATE_S16(x) if (x < -32768) x = -32768; \ else if (x > 32767) x = 32767; #define SE_16BIT(x) if (x & 0x8000) x -= 0x10000; -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) static int interplay_delta_table[] = { 0, 1, 2, 3, 4, 5, 6, 7, diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 248fc843a3..99825cebc2 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -51,12 +51,6 @@ #define FLI_COPY 16 #define FLI_MINI 18 -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - typedef struct FlicDecodeContext { AVCodecContext *avctx; AVFrame frame; diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index 3190efb9ef..b88bdab5de 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -39,7 +39,6 @@ #include "dsputil.h" #define PALETTE_COUNT 256 -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) #define CHECK_STREAM_PTR(n) \ if ((stream_ptr + n) > s->size ) { \ av_log(s->avctx, AV_LOG_ERROR, " MS Video-1 warning: stream_ptr out of bounds (%d >= %d)\n", \ diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 29e777b31f..55fa98663d 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -26,8 +26,8 @@ * * The QT RLE decoder has seven modes of operation: * 1, 2, 4, 8, 16, 24, and 32 bits per pixel. For modes 1, 2, 4, and 8 - * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB24 - * data. 24-bit data is RGB888 and 32-bit data is RGBA32. + * the decoder outputs PAL8 colorspace data. 16-bit data yields RGB555 + * data. 24-bit data is RGB24 and 32-bit data is RGBA32. */ #include @@ -50,8 +50,6 @@ typedef struct QtrleContext { } QtrleContext; -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) - #define CHECK_STREAM_PTR(n) \ if ((stream_ptr + n) > s->size) { \ av_log (s->avctx, AV_LOG_INFO, "Problem: stream_ptr out of bounds (%d >= %d)\n", \ diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index 965fb729b0..1c429f6244 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -53,12 +53,6 @@ typedef struct RpzaContext { } RpzaContext; -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - #define ADVANCE_BLOCK() \ { \ pixel_ptr += 4; \ diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 2f6f3850a2..87db500053 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -61,11 +61,6 @@ typedef struct SmcContext { } SmcContext; -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) #define GET_BLOCK_COUNT() \ (opcode & 0x10) ? (1 + s->buf[stream_ptr++]) : 1 + (opcode & 0x0F); diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index 1e73a3ff12..34ae368881 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -799,9 +799,7 @@ static int svq3_decode_frame (AVCodecContext *avctx, break; extradata++; } - - size = (extradata[4] << 24) | (extradata[5] << 16) | - (extradata[6] << 8) | extradata[7]; + size = BE_32(&extradata[4]); /* if a match was found, parse the extra data */ if (!memcmp (extradata, "SEQH", 4)) { diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index b0a8562ad7..35bf3a788b 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -41,8 +41,6 @@ #include "truemotion1data.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) - typedef struct TrueMotion1Context { AVCodecContext *avctx; AVFrame frame; diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 97cbbd6d93..ea86fb1086 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -82,26 +82,13 @@ #define MAX_VECTORS (MAX_CODEBOOK_VECTORS + SOLID_PIXEL_VECTORS) #define MAX_CODEBOOK_SIZE (MAX_VECTORS * 4 * 4) -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch3) | \ - ( (long)(unsigned char)(ch2) << 8 ) | \ - ( (long)(unsigned char)(ch1) << 16 ) | \ - ( (long)(unsigned char)(ch0) << 24 ) ) - -#define CBF0_TAG FOURCC_TAG('C', 'B', 'F', '0') -#define CBFZ_TAG FOURCC_TAG('C', 'B', 'F', 'Z') -#define CBP0_TAG FOURCC_TAG('C', 'B', 'P', '0') -#define CBPZ_TAG FOURCC_TAG('C', 'B', 'P', 'Z') -#define CPL0_TAG FOURCC_TAG('C', 'P', 'L', '0') -#define CPLZ_TAG FOURCC_TAG('C', 'P', 'L', 'Z') -#define VPTZ_TAG FOURCC_TAG('V', 'P', 'T', 'Z') +#define CBF0_TAG MKBETAG('C', 'B', 'F', '0') +#define CBFZ_TAG MKBETAG('C', 'B', 'F', 'Z') +#define CBP0_TAG MKBETAG('C', 'B', 'P', '0') +#define CBPZ_TAG MKBETAG('C', 'B', 'P', 'Z') +#define CPL0_TAG MKBETAG('C', 'P', 'L', '0') +#define CPLZ_TAG MKBETAG('C', 'P', 'L', 'Z') +#define VPTZ_TAG MKBETAG('V', 'P', 'T', 'Z') #define VQA_DEBUG 0 diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 4dad2e2141..f98a06bca9 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -58,13 +58,6 @@ typedef struct XanContext { } XanContext; -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - /* RGB -> YUV conversion stuff */ #define SCALEFACTOR 65536 #define CENTERSAMPLE 128 diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 2214e11747..37cfb3b29b 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -27,35 +27,22 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch0) | \ - ( (long)(unsigned char)(ch1) << 8 ) | \ - ( (long)(unsigned char)(ch2) << 16 ) | \ - ( (long)(unsigned char)(ch3) << 24 ) ) - -#define RIFF_TAG FOURCC_TAG('R', 'I', 'F', 'F') -#define _4XMV_TAG FOURCC_TAG('4', 'X', 'M', 'V') -#define LIST_TAG FOURCC_TAG('L', 'I', 'S', 'T') -#define HEAD_TAG FOURCC_TAG('H', 'E', 'A', 'D') -#define TRK__TAG FOURCC_TAG('T', 'R', 'K', '_') -#define MOVI_TAG FOURCC_TAG('M', 'O', 'V', 'I') -#define VTRK_TAG FOURCC_TAG('V', 'T', 'R', 'K') -#define STRK_TAG FOURCC_TAG('S', 'T', 'R', 'K') -#define std__TAG FOURCC_TAG('s', 't', 'd', '_') -#define name_TAG FOURCC_TAG('n', 'a', 'm', 'e') -#define vtrk_TAG FOURCC_TAG('v', 't', 'r', 'k') -#define strk_TAG FOURCC_TAG('s', 't', 'r', 'k') -#define ifrm_TAG FOURCC_TAG('i', 'f', 'r', 'm') -#define pfrm_TAG FOURCC_TAG('p', 'f', 'r', 'm') -#define cfrm_TAG FOURCC_TAG('c', 'f', 'r', 'm') -#define snd__TAG FOURCC_TAG('s', 'n', 'd', '_') -#define _TAG FOURCC_TAG('', '', '', '') +#define RIFF_TAG MKTAG('R', 'I', 'F', 'F') +#define _4XMV_TAG MKTAG('4', 'X', 'M', 'V') +#define LIST_TAG MKTAG('L', 'I', 'S', 'T') +#define HEAD_TAG MKTAG('H', 'E', 'A', 'D') +#define TRK__TAG MKTAG('T', 'R', 'K', '_') +#define MOVI_TAG MKTAG('M', 'O', 'V', 'I') +#define VTRK_TAG MKTAG('V', 'T', 'R', 'K') +#define STRK_TAG MKTAG('S', 'T', 'R', 'K') +#define std__TAG MKTAG('s', 't', 'd', '_') +#define name_TAG MKTAG('n', 'a', 'm', 'e') +#define vtrk_TAG MKTAG('v', 't', 'r', 'k') +#define strk_TAG MKTAG('s', 't', 'r', 'k') +#define ifrm_TAG MKTAG('i', 'f', 'r', 'm') +#define pfrm_TAG MKTAG('p', 'f', 'r', 'm') +#define cfrm_TAG MKTAG('c', 'f', 'r', 'm') +#define snd__TAG MKTAG('s', 'n', 'd', '_') #define vtrk_SIZE 0x44 #define strk_SIZE 0x28 diff --git a/libavformat/flic.c b/libavformat/flic.c index cab689a8ef..3f7faa65e1 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -31,12 +31,6 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - #define FLIC_FILE_MAGIC_1 0xAF11 #define FLIC_FILE_MAGIC_2 0xAF12 #define FLIC_CHUNK_MAGIC_1 0xF1FA diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 9d13aa5634..ccb1d4b48f 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -68,12 +68,6 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - #define HUFFMAN_TABLE_SIZE (64 * 1024) #define FRAME_PTS_INC (90000 / 14) diff --git a/libavformat/idroq.c b/libavformat/idroq.c index d87cfb3080..7d782c2d04 100644 --- a/libavformat/idroq.c +++ b/libavformat/idroq.c @@ -27,12 +27,6 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - #define RoQ_MAGIC_NUMBER 0x1084 #define RoQ_CHUNK_PREAMBLE_SIZE 8 #define RoQ_AUDIO_SAMPLE_RATE 22050 diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 89ec674bed..8e4c4c00cb 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -42,13 +42,6 @@ static inline void debug_ipmovie(const char *format, ...) { } #endif - -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - #define IPMOVIE_SIGNATURE "Interplay MVE File\x1A\0" #define IPMOVIE_SIGNATURE_SIZE 20 #define CHUNK_PREAMBLE_SIZE 4 diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 9b5140787e..88c44dff4e 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -31,20 +31,8 @@ //#define PRINTSTUFF -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) - -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch0) | \ - ( (long)(unsigned char)(ch1) << 8 ) | \ - ( (long)(unsigned char)(ch2) << 16 ) | \ - ( (long)(unsigned char)(ch3) << 24 ) ) - -#define RIFF_TAG FOURCC_TAG('R', 'I', 'F', 'F') -#define CDXA_TAG FOURCC_TAG('C', 'D', 'X', 'A') +#define RIFF_TAG MKTAG('R', 'I', 'F', 'F') +#define CDXA_TAG MKTAG('C', 'D', 'X', 'A') #define RAW_CD_SECTOR_SIZE 2352 #define RAW_CD_SECTOR_DATA_SIZE 2304 diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 3d1b48bbfa..fc54f3095c 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -27,22 +27,10 @@ #include "avformat.h" -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch3) | \ - ( (long)(unsigned char)(ch2) << 8 ) | \ - ( (long)(unsigned char)(ch1) << 16 ) | \ - ( (long)(unsigned char)(ch0) << 24 ) ) - -#define FILM_TAG FOURCC_TAG('F', 'I', 'L', 'M') -#define FDSC_TAG FOURCC_TAG('F', 'D', 'S', 'C') -#define STAB_TAG FOURCC_TAG('S', 'T', 'A', 'B') -#define CVID_TAG FOURCC_TAG('c', 'v', 'i', 'd') +#define FILM_TAG MKBETAG('F', 'I', 'L', 'M') +#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C') +#define STAB_TAG MKBETAG('S', 'T', 'A', 'B') +#define CVID_TAG MKBETAG('c', 'v', 'i', 'd') typedef struct { int stream; diff --git a/libavformat/sgi.c b/libavformat/sgi.c index 11b6ab50f6..89ef72137f 100644 --- a/libavformat/sgi.c +++ b/libavformat/sgi.c @@ -22,13 +22,6 @@ /* #define DEBUG */ -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) - -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - /* sgi image file signature */ #define SGI_MAGIC 474 diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index fc4f37e5a0..ada34666b8 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -27,38 +27,21 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) -#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - #define WC3_PREAMBLE_SIZE 8 -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch0) | \ - ( (long)(unsigned char)(ch1) << 8 ) | \ - ( (long)(unsigned char)(ch2) << 16 ) | \ - ( (long)(unsigned char)(ch3) << 24 ) ) - -#define FORM_TAG FOURCC_TAG('F', 'O', 'R', 'M') -#define MOVE_TAG FOURCC_TAG('M', 'O', 'V', 'E') -#define _PC__TAG FOURCC_TAG('_', 'P', 'C', '_') -#define SOND_TAG FOURCC_TAG('S', 'O', 'N', 'D') -#define BNAM_TAG FOURCC_TAG('B', 'N', 'A', 'M') -#define SIZE_TAG FOURCC_TAG('S', 'I', 'Z', 'E') -#define PALT_TAG FOURCC_TAG('P', 'A', 'L', 'T') -#define INDX_TAG FOURCC_TAG('I', 'N', 'D', 'X') -#define BRCH_TAG FOURCC_TAG('B', 'R', 'C', 'H') -#define SHOT_TAG FOURCC_TAG('S', 'H', 'O', 'T') -#define VGA__TAG FOURCC_TAG('V', 'G', 'A', ' ') -#define TEXT_TAG FOURCC_TAG('T', 'E', 'X', 'T') -#define AUDI_TAG FOURCC_TAG('A', 'U', 'D', 'I') +#define FORM_TAG MKTAG('F', 'O', 'R', 'M') +#define MOVE_TAG MKTAG('M', 'O', 'V', 'E') +#define _PC__TAG MKTAG('_', 'P', 'C', '_') +#define SOND_TAG MKTAG('S', 'O', 'N', 'D') +#define BNAM_TAG MKTAG('B', 'N', 'A', 'M') +#define SIZE_TAG MKTAG('S', 'I', 'Z', 'E') +#define PALT_TAG MKTAG('P', 'A', 'L', 'T') +#define INDX_TAG MKTAG('I', 'N', 'D', 'X') +#define BRCH_TAG MKTAG('B', 'R', 'C', 'H') +#define SHOT_TAG MKTAG('S', 'H', 'O', 'T') +#define VGA__TAG MKTAG('V', 'G', 'A', ' ') +#define TEXT_TAG MKTAG('T', 'E', 'X', 'T') +#define AUDI_TAG MKTAG('A', 'U', 'D', 'I') /* video resolution unless otherwise specified */ #define WC3_DEFAULT_WIDTH 320 diff --git a/libavformat/westwood.c b/libavformat/westwood.c index af0777f644..5d0848cec1 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -33,41 +33,25 @@ #include "avformat.h" -#define LE_16(x) ((((uint8_t*)(x))[1] << 8) | ((uint8_t*)(x))[0]) -#define LE_32(x) ((((uint8_t*)(x))[3] << 24) | \ - (((uint8_t*)(x))[2] << 16) | \ - (((uint8_t*)(x))[1] << 8) | \ - ((uint8_t*)(x))[0]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) - #define AUD_HEADER_SIZE 12 #define AUD_CHUNK_PREAMBLE_SIZE 8 #define AUD_CHUNK_SIGNATURE 0x0000DEAF -#define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ - ( (long)(unsigned char)(ch3) | \ - ( (long)(unsigned char)(ch2) << 8 ) | \ - ( (long)(unsigned char)(ch1) << 16 ) | \ - ( (long)(unsigned char)(ch0) << 24 ) ) - -#define FORM_TAG FOURCC_TAG('F', 'O', 'R', 'M') -#define WVQA_TAG FOURCC_TAG('W', 'V', 'Q', 'A') -#define VQHD_TAG FOURCC_TAG('V', 'Q', 'H', 'D') -#define FINF_TAG FOURCC_TAG('F', 'I', 'N', 'F') -#define SND0_TAG FOURCC_TAG('S', 'N', 'D', '0') -#define SND2_TAG FOURCC_TAG('S', 'N', 'D', '2') -#define VQFR_TAG FOURCC_TAG('V', 'Q', 'F', 'R') +#define FORM_TAG MKBETAG('F', 'O', 'R', 'M') +#define WVQA_TAG MKBETAG('W', 'V', 'Q', 'A') +#define VQHD_TAG MKBETAG('V', 'Q', 'H', 'D') +#define FINF_TAG MKBETAG('F', 'I', 'N', 'F') +#define SND0_TAG MKBETAG('S', 'N', 'D', '0') +#define SND2_TAG MKBETAG('S', 'N', 'D', '2') +#define VQFR_TAG MKBETAG('V', 'Q', 'F', 'R') /* don't know what these tags are for, but acknowledge their existence */ -#define CINF_TAG FOURCC_TAG('C', 'I', 'N', 'F') -#define CINH_TAG FOURCC_TAG('C', 'I', 'N', 'H') -#define CIND_TAG FOURCC_TAG('C', 'I', 'N', 'D') -#define PINF_TAG FOURCC_TAG('P', 'I', 'N', 'F') -#define PINH_TAG FOURCC_TAG('P', 'I', 'N', 'H') -#define PIND_TAG FOURCC_TAG('P', 'I', 'N', 'D') +#define CINF_TAG MKBETAG('C', 'I', 'N', 'F') +#define CINH_TAG MKBETAG('C', 'I', 'N', 'H') +#define CIND_TAG MKBETAG('C', 'I', 'N', 'D') +#define PINF_TAG MKBETAG('P', 'I', 'N', 'F') +#define PINH_TAG MKBETAG('P', 'I', 'N', 'H') +#define PIND_TAG MKBETAG('P', 'I', 'N', 'D') #define VQA_HEADER_SIZE 0x2A #define VQA_FRAMERATE 15