[Mplayer-cvslog] CVS: main nuppelvideo.c,1.3,1.4
Alex Beregszaszi
alex at mplayer.dev.hu
Sun Feb 10 19:17:20 CET 2002
Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv12486
Modified Files:
nuppelvideo.c
Log Message:
break if error in decompressing, moved buffer allocating
Index: nuppelvideo.c
===================================================================
RCS file: /cvsroot/mplayer/main/nuppelvideo.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- nuppelvideo.c 27 Jan 2002 17:21:20 -0000 1.3
+++ nuppelvideo.c 10 Feb 2002 18:17:17 -0000 1.4
@@ -27,8 +27,10 @@
int r;
unsigned int out_len;
struct rtframeheader *encodedh = ( struct rtframeheader* ) encoded;
- static unsigned char *buffer = 0;
- static unsigned char *previous_buffer = 0;
+ static unsigned char *buffer = 0; /* for RTJpeg with LZO decompress */
+#ifdef KEEP_BUFFER
+ static unsigned char *previous_buffer = 0; /* to support Last-frame-copy */
+#endif
static is_lzo_inited = 0;
// printf("frametype: %c, comtype: %c, encoded_size: %d, width: %d, height: %d\n",
@@ -49,25 +51,9 @@
}
case 'V':
{
- /* do the buffer stuffs */
- if ( buffer == NULL )
- {
- buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 );
-#if 0
- printf ( "Allocated for %dx%d image %d bytes\n", width, height,
- width * height + ( width * height ) / 2 );
-#endif
- }
-
#ifdef KEEP_BUFFER
- if ( previous_buffer == NULL )
- {
+ if (!previous_buffer)
previous_buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 );
-#if 0
- printf ( "Allocated for %dx%d image %d bytes\n", width, height,
- width * height + ( width * height ) / 2 );
-#endif
- }
#endif
if (((encodedh->comptype == '2') ||
@@ -91,10 +77,18 @@
RTjpeg_decompressYUV420 ( ( __s8 * ) encoded + 12, decoded );
break;
case '2': /* RTJpeg with LZO */
+ if (!buffer)
+ buffer = ( unsigned char * ) malloc ( width * height + ( width * height ) / 2 );
+ if (!buffer)
+ {
+ printf ( "Error decompressing\n" );
+ break;
+ }
r = lzo1x_decompress ( encoded + 12, encodedh->packetlength, buffer, &out_len, NULL );
if ( r != LZO_E_OK )
{
printf ( "Error decompressing\n" );
+ break;
}
RTjpeg_decompressYUV420 ( ( __s8 * ) buffer, decoded );
break;
@@ -103,8 +97,8 @@
if ( r != LZO_E_OK )
{
printf ( "Error decompressing\n" );
+ break;
}
-// memcpy(decoded, buffer, width*height*3/2);
break;
case 'N': /* black frame */
memset ( decoded, 0, width * height );
More information about the MPlayer-cvslog
mailing list