mirror of
https://github.com/mpv-player/mpv
synced 2025-01-16 22:37:28 +01:00
Use ffmpeg lzo instead of (also quite outdated) minlzo in nuppelvideo.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22098 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
77efea9cf2
commit
17cb5504b1
@ -20,7 +20,11 @@
|
||||
|
||||
#include "libmpdemux/nuppelvideo.h"
|
||||
#include "RTjpegN.h"
|
||||
#include "minilzo.h"
|
||||
#ifdef USE_LIBAVUTIL_SO
|
||||
#include <ffmpeg/lzo.h>
|
||||
#else
|
||||
#include "libavutil/lzo.h"
|
||||
#endif
|
||||
|
||||
#define KEEP_BUFFER
|
||||
|
||||
@ -34,7 +38,6 @@ void decode_nuv( unsigned char *encoded, int encoded_size,
|
||||
#ifdef KEEP_BUFFER
|
||||
static unsigned char *previous_buffer = 0; /* to support Last-frame-copy */
|
||||
#endif
|
||||
static int is_lzo_inited = 0;
|
||||
|
||||
// printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n",
|
||||
// encodedh->frametype, encodedh->comptype, encoded_size, width, height);
|
||||
@ -55,23 +58,12 @@ void decode_nuv( unsigned char *encoded, int encoded_size,
|
||||
}
|
||||
case 'V':
|
||||
{
|
||||
int in_len = encodedh->packetlength;
|
||||
#ifdef KEEP_BUFFER
|
||||
if (!previous_buffer)
|
||||
previous_buffer = ( unsigned char * ) malloc ( out_len );
|
||||
previous_buffer = ( unsigned char * ) malloc ( out_len + LZO_OUTPUT_PADDING );
|
||||
#endif
|
||||
|
||||
if (((encodedh->comptype == '2') ||
|
||||
(encodedh->comptype == '3')) && !is_lzo_inited)
|
||||
{
|
||||
/* frame using lzo, init lzo first if not inited */
|
||||
if ( lzo_init() != LZO_E_OK )
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "LZO init failed\n");
|
||||
return;
|
||||
}
|
||||
is_lzo_inited = 1;
|
||||
}
|
||||
|
||||
switch(encodedh->comptype)
|
||||
{
|
||||
case '0': /* raw YUV420 */
|
||||
@ -82,14 +74,14 @@ void decode_nuv( unsigned char *encoded, int encoded_size,
|
||||
break;
|
||||
case '2': /* RTJpeg with LZO */
|
||||
if (!buffer)
|
||||
buffer = ( unsigned char * ) malloc ( out_len );
|
||||
buffer = ( unsigned char * ) malloc ( out_len + LZO_OUTPUT_PADDING );
|
||||
if (!buffer)
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
}
|
||||
r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL );
|
||||
if ( r != LZO_E_OK )
|
||||
r = lzo1x_decode ( buffer, &out_len, encoded + 12, &in_len );
|
||||
if ( r )
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
@ -97,8 +89,8 @@ void decode_nuv( unsigned char *encoded, int encoded_size,
|
||||
RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded );
|
||||
break;
|
||||
case '3': /* raw YUV420 with LZO */
|
||||
r = lzo1x_decompress_safe ( encoded + 12, encodedh->packetlength, decoded, &out_len, NULL );
|
||||
if ( r != LZO_E_OK )
|
||||
r = lzo1x_decode ( decoded, &out_len, encoded + 12, &in_len );
|
||||
if ( r )
|
||||
{
|
||||
mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Nuppelvideo: error decompressing\n");
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user