mirror of https://github.com/mpv-player/mpv
Use av_int2flt/av_int2dbl to read float values. This is simpler and more
correct since it also works for int endianness != float endianness. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21404 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
15eb8639c6
commit
ef393a0650
|
@ -13,6 +13,7 @@
|
||||||
#include "ebml.h"
|
#include "ebml.h"
|
||||||
#include "libavutil/common.h"
|
#include "libavutil/common.h"
|
||||||
#include "libavutil/bswap.h"
|
#include "libavutil/bswap.h"
|
||||||
|
#include "libavutil/intfloat_readwrite.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef SIZE_MAX
|
#ifndef SIZE_MAX
|
||||||
|
@ -179,20 +180,12 @@ ebml_read_float (stream_t *s, uint64_t *length)
|
||||||
switch (len)
|
switch (len)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
{
|
value = av_int2flt(stream_read_dword(s));
|
||||||
union {uint32_t i; float f;} u;
|
|
||||||
u.i = stream_read_dword (s);
|
|
||||||
value = u.f;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
{
|
value = av_int2dbl(stream_read_qword(s));
|
||||||
union {uint64_t i; double d;} u;
|
|
||||||
u.i = stream_read_qword (s);
|
|
||||||
value = u.d;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return EBML_FLOAT_INVALID;
|
return EBML_FLOAT_INVALID;
|
||||||
|
|
Loading…
Reference in New Issue