qtdemux: handle signed values in 3GPP location tag

This commit is contained in:
Mark Nauwelaerts 2010-02-11 19:39:04 +01:00
parent 87e80aab57
commit 58d84a993c
2 changed files with 5 additions and 3 deletions

View file

@ -6040,13 +6040,14 @@ qtdemux_tag_add_location (GstQTDemux * qtdemux, const char *tag,
/* +1 +1 = skip null-terminator and location role byte */
offset += 1 + 1;
longitude = QT_FP32 (data + offset);
/* table in spec says unsigned, semantics say negative has meaning ... */
longitude = QT_SFP32 (data + offset);
offset += 4;
latitude = QT_FP32 (data + offset);
latitude = QT_SFP32 (data + offset);
offset += 4;
altitude = QT_FP32 (data + offset);
altitude = QT_SFP32 (data + offset);
/* one invalid means all are invalid */
if (longitude >= -180.0 && longitude <= 180.0 &&

View file

@ -38,6 +38,7 @@ typedef struct _QtNodeType QtNodeType;
#define QT_UINT16(a) (GST_READ_UINT16_BE(a))
#define QT_UINT8(a) (GST_READ_UINT8(a))
#define QT_FP32(a) ((GST_READ_UINT32_BE(a))/65536.0)
#define QT_SFP32(a) (((gint)(GST_READ_UINT32_BE(a)))/65536.0)
#define QT_FP16(a) ((GST_READ_UINT16_BE(a))/256.0)
#define QT_FOURCC(a) (GST_READ_UINT32_LE(a))
#define QT_UINT64(a) ((((guint64)QT_UINT32(a))<<32)|QT_UINT32(((guint8 *)a)+4))