avformat/riff: return error code from ff_get_guid()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/58/head
Michael Niedermayer 11 years ago
parent 8c5fece11f
commit d32926db7f
  1. 2
      libavformat/riff.h
  2. 7
      libavformat/riffdec.c

@ -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);

@ -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)

Loading…
Cancel
Save