mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 04:51:52 +00:00
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
This commit is contained in:
parent
3d4f1ec483
commit
fd9fe9e04d
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user