mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
commit
52e40155a8
@ -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;
|
||||
|
@ -56,34 +56,8 @@ extern const AVCodecTag ff_codec_wav_tags[];
|
||||
|
||||
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale);
|
||||
|
||||
typedef uint8_t ff_asf_guid[16];
|
||||
|
||||
int ff_read_riff_info(AVFormatContext *s, int64_t size);
|
||||
|
||||
#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]
|
||||
|
||||
static av_always_inline int ff_guidcmp(const void *g1, const void *g2)
|
||||
{
|
||||
return memcmp(g1, g2, sizeof(ff_asf_guid));
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
@ -94,4 +68,32 @@ void ff_riff_write_info(AVFormatContext *s);
|
||||
*/
|
||||
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str);
|
||||
|
||||
typedef uint8_t ff_asf_guid[16];
|
||||
|
||||
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]
|
||||
|
||||
#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)
|
||||
{
|
||||
return memcmp(g1, g2, sizeof(ff_asf_guid));
|
||||
}
|
||||
|
||||
void ff_get_guid(AVIOContext *s, ff_asf_guid *g);
|
||||
|
||||
enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid);
|
||||
|
||||
#endif /* AVFORMAT_RIFF_H */
|
||||
|
Loading…
Reference in New Issue
Block a user