diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 14:04:10 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-04-22 14:20:04 +0400 |
commit | 52e40155a8e1f41b2d97e5832022263b77752f32 (patch) | |
tree | 6a0e74576fa02d3794ba5110c84130a2884841c1 /libavformat | |
parent | 369e5dcfc530576293998ea35137b8cc35aee412 (diff) | |
parent | e544782623caf1eb4b2429e9c4f35d6b627accba (diff) |
Merge commit 'e544782623caf1eb4b2429e9c4f35d6b627accba'
* commit 'e544782623caf1eb4b2429e9c4f35d6b627accba':
riff: Move guid structs and helper functions into riff
Conflicts:
libavformat/asf.h
libavformat/riff.c
libavformat/wtv.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/riff.c | 43 | ||||
-rw-r--r-- | libavformat/riff.h | 46 |
2 files changed, 45 insertions, 44 deletions
diff --git a/libavformat/riff.c b/libavformat/riff.c index 818ef55d98..9bc637262c 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -420,11 +420,11 @@ const AVCodecTag ff_codec_wav_tags[] = { }; const AVCodecGuid ff_codec_wav_guids[] = { - {AV_CODEC_ID_AC3, {0x2C,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}}, - {AV_CODEC_ID_ATRAC3P, {0xBF,0xAA,0x23,0xE9,0x58,0xCB,0x71,0x44,0xA1,0x19,0xFF,0xFA,0x01,0xE4,0xCE,0x62}}, - {AV_CODEC_ID_EAC3, {0xAF,0x87,0xFB,0xA7,0x02,0x2D,0xFB,0x42,0xA4,0xD4,0x05,0xCD,0x93,0x84,0x3B,0xDD}}, - {AV_CODEC_ID_MP2, {0x2B,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}}, - {AV_CODEC_ID_NONE} + { AV_CODEC_ID_AC3, { 0x2C, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, + { AV_CODEC_ID_ATRAC3P, { 0xBF, 0xAA, 0x23, 0xE9, 0x58, 0xCB, 0x71, 0x44, 0xA1, 0x19, 0xFF, 0xFA, 0x01, 0xE4, 0xCE, 0x62 } }, + { AV_CODEC_ID_EAC3, { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D, 0xFB, 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } }, + { AV_CODEC_ID_MP2, { 0x2B, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, + { AV_CODEC_ID_NONE } }; const AVMetadataConv ff_riff_info_conv[] = { @@ -443,6 +443,22 @@ const AVMetadataConv ff_riff_info_conv[] = { { 0 }, }; +void ff_get_guid(AVIOContext *s, ff_asf_guid *g) +{ + av_assert0(sizeof(*g) == 16); //compiler will optimize this out + if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) + memset(*g, 0, sizeof(*g)); +} + +enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid) +{ + int i; + for (i = 0; guids[i].id != AV_CODEC_ID_NONE; i++) + if (!ff_guidcmp(guids[i].guid, guid)) + return guids[i].id; + return AV_CODEC_ID_NONE; +} + #if CONFIG_MUXERS int64_t ff_start_tag(AVIOContext *pb, const char *tag) { @@ -841,23 +857,6 @@ int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize) return tag1; } -void ff_get_guid(AVIOContext *s, ff_asf_guid *g) -{ - av_assert0(sizeof(*g) == 16); //compiler will optimize this out - if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) - memset(*g, 0, sizeof(*g)); -} - -enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid) -{ - int i; - for (i = 0; guids[i].id != AV_CODEC_ID_NONE; i++) { - if (!ff_guidcmp(guids[i].guid, guid)) - return guids[i].id; - } - return AV_CODEC_ID_NONE; -} - int ff_read_riff_info(AVFormatContext *s, int64_t size) { int64_t start, end, cur; diff --git a/libavformat/riff.h b/libavformat/riff.h index 70b2f76171..cb8378922f 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -56,14 +56,36 @@ extern const AVCodecTag ff_codec_wav_tags[]; void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale); +int ff_read_riff_info(AVFormatContext *s, int64_t size); + +/** + * Write all recognized RIFF tags from s->metadata + */ +void ff_riff_write_info(AVFormatContext *s); + +/** + * Write a single RIFF info tag + */ +void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str); + typedef uint8_t ff_asf_guid[16]; -int ff_read_riff_info(AVFormatContext *s, int64_t size); +typedef struct AVCodecGuid { + enum AVCodecID id; + ff_asf_guid guid; +} AVCodecGuid; + +extern const AVCodecGuid ff_codec_wav_guids[]; #define FF_PRI_GUID \ "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" + #define FF_ARG_GUID(g) \ - g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15] + g[0], g[1], g[2], g[3], g[4], g[5], g[6], g[7], \ + g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15] + +#define FF_MEDIASUBTYPE_BASE_GUID \ + 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 static av_always_inline int ff_guidcmp(const void *g1, const void *g2) { @@ -72,26 +94,6 @@ static av_always_inline int ff_guidcmp(const void *g1, const void *g2) void ff_get_guid(AVIOContext *s, ff_asf_guid *g); -typedef struct { - enum AVCodecID id; - ff_asf_guid guid; -} AVCodecGuid; - enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid); -extern const AVCodecGuid ff_codec_wav_guids[]; - -#define FF_MEDIASUBTYPE_BASE_GUID \ - 0x00,0x00,0x10,0x00,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71 - -/** - * Write all recognized RIFF tags from s->metadata - */ -void ff_riff_write_info(AVFormatContext *s); - -/** - * Write a single RIFF info tag - */ -void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str); - #endif /* AVFORMAT_RIFF_H */ |