changeset 22080:fc27312ae599

Use ffmpeg lzo instead of (also quite outdated) minlzo in nuppelvideo.
author reimar
date Wed, 31 Jan 2007 23:20:03 +0000
parents d018c5b9e0e6
children fde1ddcc04c7
files libmpcodecs/native/nuppelvideo.c
diffstat 1 files changed, 12 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/native/nuppelvideo.c	Wed Jan 31 23:04:20 2007 +0000
+++ b/libmpcodecs/native/nuppelvideo.c	Wed Jan 31 23:20:03 2007 +0000
@@ -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 @@
 #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 @@
 	    }
 	    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 @@
 			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 @@
 			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;