summaryrefslogtreecommitdiff
path: root/libavformat/rtmppkt.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-11-27 14:04:16 +0000
committerMans Rullgard <mans@mansr.com>2011-12-11 18:47:19 +0000
commit3383a53e7d0abb9639c3ea3481f0eda9dca61a26 (patch)
treed53f0c38d95d4256b727dc4f4c5add488aabe501 /libavformat/rtmppkt.c
parent5b3265a7181889b53ff8217c1bdccdf966c86955 (diff)
lavu: replace int/float punning functions
The existing functions defined in intfloat_readwrite.[ch] are both slow and incorrect (infinities are not handled). This introduces a new header with fast, inline conversion functions using direct union punning assuming an IEEE-754 system, an assumption already made throughout the code. The one use of Intel/Motorola extended 80-bit format is replaced by simpler code sufficient under the present constraints (positive normal values). The old functions are marked deprecated and retained for compatibility. Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavformat/rtmppkt.c')
-rw-r--r--libavformat/rtmppkt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 6bf641a742..8c455a09f0 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -21,7 +21,7 @@
#include "libavcodec/bytestream.h"
#include "libavutil/avstring.h"
-#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/intfloat.h"
#include "avformat.h"
#include "rtmppkt.h"
@@ -37,7 +37,7 @@ void ff_amf_write_bool(uint8_t **dst, int val)
void ff_amf_write_number(uint8_t **dst, double val)
{
bytestream_put_byte(dst, AMF_DATA_TYPE_NUMBER);
- bytestream_put_be64(dst, av_dbl2int(val));
+ bytestream_put_be64(dst, av_double2int(val));
}
void ff_amf_write_string(uint8_t **dst, const char *str)
@@ -318,7 +318,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end,
if (size == namelen && !memcmp(data-size, name, namelen)) {
switch (*data++) {
case AMF_DATA_TYPE_NUMBER:
- snprintf(dst, dst_size, "%g", av_int2dbl(AV_RB64(data)));
+ snprintf(dst, dst_size, "%g", av_int2double(AV_RB64(data)));
break;
case AMF_DATA_TYPE_BOOL:
snprintf(dst, dst_size, "%s", *data ? "true" : "false");
@@ -370,7 +370,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d
return;
switch (*data++) {
case AMF_DATA_TYPE_NUMBER:
- av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2dbl(AV_RB64(data)));
+ av_log(ctx, AV_LOG_DEBUG, " number %g\n", av_int2double(AV_RB64(data)));
return;
case AMF_DATA_TYPE_BOOL:
av_log(ctx, AV_LOG_DEBUG, " bool %d\n", *data);