Mercurial > libavformat.hg
changeset 822:2614d3c1f415 libavformat
kill duplicated get/put_be24()
author | michael |
---|---|
date | Tue, 19 Jul 2005 14:41:08 +0000 |
parents | 92dfb26763e4 |
children | e8b4454b997d |
files | avio.h aviobuf.c flvdec.c flvenc.c mov.c |
diffstat | 5 files changed, 21 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.h Tue Jul 19 14:26:41 2005 +0000 +++ b/avio.h Tue Jul 19 14:41:08 2005 +0000 @@ -99,6 +99,7 @@ void put_be64(ByteIOContext *s, uint64_t val); void put_le32(ByteIOContext *s, unsigned int val); void put_be32(ByteIOContext *s, unsigned int val); +void put_be24(ByteIOContext *s, unsigned int val); void put_le16(ByteIOContext *s, unsigned int val); void put_be16(ByteIOContext *s, unsigned int val); void put_tag(ByteIOContext *s, const char *tag); @@ -134,6 +135,7 @@ double get_be64_double(ByteIOContext *s); char *get_strz(ByteIOContext *s, char *buf, int maxlen); unsigned int get_be16(ByteIOContext *s); +unsigned int get_be24(ByteIOContext *s); unsigned int get_be32(ByteIOContext *s); uint64_t get_be64(ByteIOContext *s);
--- a/aviobuf.c Tue Jul 19 14:26:41 2005 +0000 +++ b/aviobuf.c Tue Jul 19 14:41:08 2005 +0000 @@ -253,6 +253,12 @@ put_byte(s, val); } +void put_be24(ByteIOContext *s, unsigned int val) +{ + put_be16(s, val >> 8); + put_byte(s, val); +} + void put_tag(ByteIOContext *s, const char *tag) { while (*tag) { @@ -407,10 +413,8 @@ unsigned int get_le32(ByteIOContext *s) { unsigned int val; - val = get_byte(s); - val |= get_byte(s) << 8; - val |= get_byte(s) << 16; - val |= get_byte(s) << 24; + val = get_le16(s); + val |= get_le16(s) << 16; return val; } @@ -430,13 +434,18 @@ return val; } +unsigned int get_be24(ByteIOContext *s) +{ + unsigned int val; + val = get_be16(s) << 8; + val |= get_byte(s); + return val; +} unsigned int get_be32(ByteIOContext *s) { unsigned int val; - val = get_byte(s) << 24; - val |= get_byte(s) << 16; - val |= get_byte(s) << 8; - val |= get_byte(s); + val = get_be16(s) << 16; + val |= get_be16(s); return val; }
--- a/flvdec.c Tue Jul 19 14:26:41 2005 +0000 +++ b/flvdec.c Tue Jul 19 14:41:08 2005 +0000 @@ -18,15 +18,6 @@ */ #include "avformat.h" -unsigned int get_be24(ByteIOContext *s) -{ - unsigned int val; - val = get_byte(s) << 16; - val |= get_byte(s) << 8; - val |= get_byte(s); - return val; -} - static int flv_probe(AVProbeData *p) { const uint8_t *d;
--- a/flvenc.c Tue Jul 19 14:26:41 2005 +0000 +++ b/flvenc.c Tue Jul 19 14:41:08 2005 +0000 @@ -27,13 +27,6 @@ int reserved; } FLVContext; -static void put_be24(ByteIOContext *pb, int value) -{ - put_byte(pb, (value>>16) & 0xFF ); - put_byte(pb, (value>> 8) & 0xFF ); - put_byte(pb, (value>> 0) & 0xFF ); -} - static int get_audio_flags(AVCodecContext *enc){ int flags = (enc->bits_per_sample == 16) ? 0x2 : 0x0; @@ -52,6 +45,7 @@ flags |= 0x00; break; default: + av_log(enc, AV_LOG_ERROR, "flv doesnt support that sample rate, choose from (44100, 22050, 11025)\n"); return -1; } @@ -75,6 +69,7 @@ flags |= enc->codec_tag<<4; break; default: + av_log(enc, AV_LOG_ERROR, "codec not compatible with flv\n"); return -1; }
--- a/mov.c Tue Jul 19 14:26:41 2005 +0000 +++ b/mov.c Tue Jul 19 14:41:08 2005 +0000 @@ -550,15 +550,6 @@ return len; } -static inline unsigned int get_be24(ByteIOContext *s) -{ - unsigned int val; - val = get_byte(s) << 16; - val |= get_byte(s) << 8; - val |= get_byte(s); - return val; -} - static int mov_read_esds(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1];