[MPlayer-cvslog] r32683 - trunk/libmpdemux/demux_real.c
reimar
subversion at mplayerhq.hu
Sat Dec 11 16:30:29 CET 2010
Author: reimar
Date: Sat Dec 11 16:30:28 2010
New Revision: 32683
Log:
Fix some unaligned writes and avoid some (incorrect due to alignment) casts.
Might also fix bug #371.
Modified:
trunk/libmpdemux/demux_real.c
Modified: trunk/libmpdemux/demux_real.c
==============================================================================
--- trunk/libmpdemux/demux_real.c Sat Dec 11 15:40:39 2010 (r32682)
+++ trunk/libmpdemux/demux_real.c Sat Dec 11 16:30:28 2010 (r32683)
@@ -44,6 +44,7 @@
#include "help_mp.h"
#include "mpbswap.h"
#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
#include "stream/stream.h"
#include "aviprint.h"
#include "demuxer.h"
@@ -879,7 +880,7 @@ got_video:
while(len>2){
dp_hdr_t* dp_hdr;
unsigned char* dp_data;
- uint32_t* extra;
+ uint8_t* extra;
// printf("xxx len=%d \n",len);
@@ -946,7 +947,7 @@ got_video:
dp=ds->asf_packet;
dp_hdr=(dp_hdr_t*)dp->buffer;
dp_data=dp->buffer+sizeof(dp_hdr_t);
- extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab);
+ extra=dp->buffer+dp_hdr->chunktab;
mp_dbg(MSGT_DEMUX,MSGL_DBG2, "we have an incomplete packet (oldseq=%d new=%d)\n",ds->asf_seq,vpkg_seqnum);
// we have an incomplete packet:
if(ds->asf_seq!=vpkg_seqnum){
@@ -967,10 +968,10 @@ got_video:
// re-calc pointers:
dp_hdr=(dp_hdr_t*)dp->buffer;
dp_data=dp->buffer+sizeof(dp_hdr_t);
- extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab);
+ extra=dp->buffer+dp_hdr->chunktab;
}
- extra[2*dp_hdr->chunks+0]=le2me_32(1);
- extra[2*dp_hdr->chunks+1]=le2me_32(dp_hdr->len);
+ AV_WL32(extra + 8*dp_hdr->chunks + 0, 1);
+ AV_WL32(extra + 8*dp_hdr->chunks + 4, dp_hdr->len);
if(0x80==(vpkg_header&0xc0)){
// last fragment!
if(dp_hdr->len!=vpkg_length-vpkg_offset)
@@ -1009,8 +1010,8 @@ got_video:
dp_hdr->timestamp=timestamp;
dp_hdr->chunktab=sizeof(dp_hdr_t)+vpkg_length;
dp_data=dp->buffer+sizeof(dp_hdr_t);
- extra=(uint32_t*)(dp->buffer+dp_hdr->chunktab);
- extra[0]=le2me_32(1); extra[1]=0; // offset of the first chunk
+ extra=dp->buffer+dp_hdr->chunktab;
+ AV_WL32(extra, 1); AV_WL32(extra + 4, 0); // offset of the first chunk
if(0x00==(vpkg_header&0xc0)){
// first fragment:
if (len > dp->len - sizeof(dp_hdr_t)) len = dp->len - sizeof(dp_hdr_t);
More information about the MPlayer-cvslog
mailing list