aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/xmv.c
diff options
context:
space:
mode:
authorSven Hesse <drmccoy@drmccoy.de>2011-08-18 19:23:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-18 23:56:12 +0200
commit8ea6157d83277a089137fb8113174bc4e7a8ffd2 (patch)
treeffef45b4ad43105207b837d31e98eb589b8efb73 /libavformat/xmv.c
parentc062aa8deb5660a6963bf0314e09756236597517 (diff)
downloadffmpeg-8ea6157d83277a089137fb8113174bc4e7a8ffd2.tar.gz
xmv: Read the video packet data first, then swap its bytes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/xmv.c')
-rw-r--r--libavformat/xmv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index e9f0c834bc..9c17a14fa1 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -450,7 +450,7 @@ static int xmv_fetch_video_packet(AVFormatContext *s,
int result;
uint32_t frame_header;
uint32_t frame_size, frame_timestamp;
- uint32_t i;
+ uint8_t *data, *end;
/* Seek to it */
if (avio_seek(pb, video->data_offset, SEEK_SET) != video->data_offset)
@@ -465,17 +465,17 @@ static int xmv_fetch_video_packet(AVFormatContext *s,
if ((frame_size + 4) > video->data_size)
return AVERROR(EIO);
- /* Create the packet */
- result = av_new_packet(pkt, frame_size);
- if (result)
+ /* Get the packet data */
+ result = av_get_packet(pb, pkt, frame_size);
+ if (result != frame_size)
return result;
/* Contrary to normal WMV2 video, the bit stream in XMV's
* WMV2 is little-endian.
* TODO: This manual swap is of course suboptimal.
*/
- for (i = 0; i < frame_size; i += 4)
- AV_WB32(pkt->data + i, avio_rl32(pb));
+ for (data = pkt->data, end = pkt->data + frame_size; data < end; data += 4)
+ AV_WB32(data, AV_RL32(data));
pkt->stream_index = video->stream_index;