1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/riff: return error code from ff_get_guid()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-02-12 15:51:38 +01:00
parent 8c5fece11f
commit d32926db7f
2 changed files with 6 additions and 3 deletions

View File

@ -91,7 +91,7 @@ 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);
int ff_get_guid(AVIOContext *s, ff_asf_guid *g);
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g);
const ff_asf_guid *get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid);

View File

@ -29,11 +29,14 @@
#include "avio_internal.h"
#include "riff.h"
void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
int 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))
if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) {
memset(*g, 0, sizeof(*g));
return AVERROR_INVALIDDATA;
}
return 0;
}
enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid)