aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/matroska.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2005-07-19 15:32:43 +0000
committerMichael Niedermayer <michaelni@gmx.at>2005-07-19 15:32:43 +0000
commit8baa661498e5c7846088721a2e686d9a521da0db (patch)
tree4253222f44d160f102ac233203bd27e875fd90d8 /libavformat/matroska.c
parent7cb8f314db095715698329fafae5eadeb5504610 (diff)
downloadffmpeg-8baa661498e5c7846088721a2e686d9a521da0db.tar.gz
more non portable float parsing code ...
Originally committed as revision 4462 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/matroska.c')
-rw-r--r--libavformat/matroska.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 0661151487..dda4f45877 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -609,42 +609,21 @@ ebml_read_float (MatroskaDemuxContext *matroska,
return res;
size = rlength;
- if (size != 4 && size != 8 && size != 10) {
+ if (size == 4) {
+ *num= av_int2flt(get_be32(pb));
+ } else if(size==8){
+ *num= av_int2dbl(get_be64(pb));
+ } else if(size==10){
+ av_log(matroska->ctx, AV_LOG_ERROR,
+ "FIXME! 10-byte floats unimplemented\n");
+ return AVERROR_UNKNOWN;
+ } else{
offset_t pos = url_ftell(pb);
av_log(matroska->ctx, AV_LOG_ERROR,
"Invalid float element size %d at position %llu (0x%llx)\n",
size, pos, pos);
return AVERROR_INVALIDDATA;
}
- if (size == 10) {
- av_log(matroska->ctx, AV_LOG_ERROR,
- "FIXME! 10-byte floats unimplemented\n");
- return AVERROR_UNKNOWN;
- }
-
- if (size == 4) {
- float f;
-
- while (size-- > 0)
-#ifdef WORDS_BIGENDIAN
- ((uint8_t *) &f)[3 - size] = get_byte(pb);
-#else
- ((uint8_t *) &f)[size] = get_byte(pb);
-#endif
-
- *num = f;
- } else {
- double d;
-
- while (size-- > 0)
-#ifdef WORDS_BIGENDIAN
- ((uint8_t *) &d)[7 - size] = get_byte(pb);
-#else
- ((uint8_t *) &d)[size] = get_byte(pb);
-#endif
-
- *num = d;
- }
return 0;
}