diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-03-03 10:19:56 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-03-03 10:19:56 +0000 |
commit | fd9fe9e04d56535ccbee56a7f0c5876009e56c9f (patch) | |
tree | 925f95455381bb4098ee0c0a6ad4ab2b2716dd62 | |
parent | 3d4f1ec4833a4fcb9ce3894f033984174f788b8f (diff) |
Make nuv files work on bigendian (but old nuv files created with mencoder
wont play anymore - before they would have worked with mplayer on be)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14897 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/native/RTjpegN.c | 9 | ||||
-rw-r--r-- | libmpcodecs/native/nuppelvideo.c | 2 | ||||
-rw-r--r-- | libmpcodecs/ve_nuv.c | 2 | ||||
-rw-r--r-- | libmpdemux/demux_nuv.c | 3 | ||||
-rw-r--r-- | libmpdemux/nuppelvideo.h | 20 |
5 files changed, 32 insertions, 4 deletions
diff --git a/libmpcodecs/native/RTjpegN.c b/libmpcodecs/native/RTjpegN.c index 54fc3d0026..523612d1f9 100644 --- a/libmpcodecs/native/RTjpegN.c +++ b/libmpcodecs/native/RTjpegN.c @@ -31,6 +31,7 @@ #define MMX #endif +#include "bswap.h" #include "RTjpegN.h" #ifdef MMX @@ -2820,9 +2821,9 @@ void RTjpeg_init_compress(__u32 *buf, int width, int height, __u8 Q) RTjpeg_quant_init(); for(i=0; i<64; i++) - buf[i]=RTjpeg_liqt[i]; + buf[i]=le2me_32(RTjpeg_liqt[i]); for(i=0; i<64; i++) - buf[64+i]=RTjpeg_ciqt[i]; + buf[64+i]=le2me_32(RTjpeg_ciqt[i]); } void RTjpeg_init_decompress(__u32 *buf, int width, int height) @@ -2840,8 +2841,8 @@ void RTjpeg_init_decompress(__u32 *buf, int width, int height) for(i=0; i<64; i++) { - RTjpeg_liqt[i]=buf[i]; - RTjpeg_ciqt[i]=buf[i+64]; + RTjpeg_liqt[i]=le2me_32(buf[i]); + RTjpeg_ciqt[i]=le2me_32(buf[i+64]); } RTjpeg_lb8=0; diff --git a/libmpcodecs/native/nuppelvideo.c b/libmpcodecs/native/nuppelvideo.c index 8b82d8a4e3..566d707426 100644 --- a/libmpcodecs/native/nuppelvideo.c +++ b/libmpcodecs/native/nuppelvideo.c @@ -13,6 +13,7 @@ #include "config.h" #include "mp_msg.h" +#include "bswap.h" #include "../../libvo/fastmemcpy.h" @@ -37,6 +38,7 @@ void decode_nuv( unsigned char *encoded, int encoded_size, // printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n", // encodedh->frametype, encodedh->comptype, encoded_size, width, height); + le2me_rtframeheader(encodedh); switch(encodedh->frametype) { case 'D': /* additional data for compressors */ diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index f1a9f92b4b..bee798617d 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -116,6 +116,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ ench->comptype = 'R'; // compressor data for RTjpeg ench->packetlength = 128*sizeof(long int); + le2me_rtframeheader(ench); mux_v->buffer=vf->priv->buffer; muxer_write_chunk(mux_v,FRAMEHEADERSIZE + 128*sizeof(long int), 0x10); vf->priv->tbl_wrote = 1; @@ -172,6 +173,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ ench->frametype = 'V'; // video frame ench->packetlength = len; + le2me_rtframeheader(ench); mux_v->buffer=(void*)ench; muxer_write_chunk(mux_v, len + FRAMEHEADERSIZE, 0x10); return 1; diff --git a/libmpdemux/demux_nuv.c b/libmpdemux/demux_nuv.c index eb12313494..7e3a6cc340 100644 --- a/libmpdemux/demux_nuv.c +++ b/libmpdemux/demux_nuv.c @@ -69,6 +69,7 @@ void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags ) { if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader)) return; /* EOF */ + le2me_rtframeheader(&rtjpeg_frameheader); if ( rtjpeg_frameheader.frametype == 'V' ) { @@ -145,6 +146,7 @@ int demux_nuv_fill_buffer ( demuxer_t *demuxer ) demuxer->filepos = orig_pos = stream_tell ( demuxer->stream ); if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader)) return 0; /* EOF */ + le2me_rtframeheader(&rtjpeg_frameheader); #if 0 printf("NUV frame: frametype: %c, comptype: %c, packetlength: %d\n", @@ -218,6 +220,7 @@ demuxer_t* demux_open_nuv ( demuxer_t* demuxer ) stream_seek(demuxer->stream, 0); stream_read ( demuxer->stream, (char*)& rtjpeg_fileheader, sizeof(rtjpeg_fileheader) ); + le2me_rtfileheader(&rtjpeg_fileheader); /* no video */ if (rtjpeg_fileheader.videoblocks == 0) diff --git a/libmpdemux/nuppelvideo.h b/libmpdemux/nuppelvideo.h index 2c6d217e9a..2e9dc51562 100644 --- a/libmpdemux/nuppelvideo.h +++ b/libmpdemux/nuppelvideo.h @@ -90,3 +90,23 @@ typedef struct audbuffertype unsigned char *buffer_offset; } audbuffertyp; +#ifdef WORDS_BIGENDIAN +#define le2me_rtfileheader(h) { \ + (h)->width = le2me_32((h)->width); \ + (h)->height = le2me_32((h)->height); \ + (h)->desiredwidth = le2me_32((h)->desiredwidth); \ + (h)->desiredheight = le2me_32((h)->desiredheight); \ + (h)->videoblocks = le2me_32((h)->videoblocks); \ + (h)->audioblocks = le2me_32((h)->audioblocks); \ + (h)->textsblocks = le2me_32((h)->textsblocks); \ + (h)->keyframedist = le2me_32((h)->keyframedist); \ + } +#define le2me_rtframeheader(h) { \ + (h)->timecode = le2me_32((h)->timecode); \ + (h)->packetlength = le2me_32((h)->packetlength); \ + } +#else +#define le2me_rtfileheader(h) /**/ +#define le2me_rtframeheader(h) /**/ +#endif + |