diff options
author | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 15:12:55 +0000 |
---|---|---|
committer | pontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-02-23 15:12:55 +0000 |
commit | c090d0da98cfc613b7b9b7227dd505735df224a6 (patch) | |
tree | 0e27f5b57f9efcde040f3b8381544468612f47d6 /Gui/bitmap | |
parent | 469f2d1b7e6c2251cbc9418b111f5bc700c7a262 (diff) | |
download | mpv-c090d0da98cfc613b7b9b7227dd505735df224a6.tar.bz2 mpv-c090d0da98cfc613b7b9b7227dd505735df224a6.tar.xz |
new gui interface, and gtk moved into mplayer process. fork ... bleh :)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4819 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui/bitmap')
-rw-r--r-- | Gui/bitmap/bitmap.c | 38 | ||||
-rw-r--r-- | Gui/bitmap/bitmap.h | 1 | ||||
-rw-r--r-- | Gui/bitmap/bmp/bmp.c | 33 | ||||
-rw-r--r-- | Gui/bitmap/png/png.c | 17 | ||||
-rw-r--r-- | Gui/bitmap/tga/tga.c | 63 |
5 files changed, 51 insertions, 101 deletions
diff --git a/Gui/bitmap/bitmap.c b/Gui/bitmap/bitmap.c index 657c1f3330..b04e2ba926 100644 --- a/Gui/bitmap/bitmap.c +++ b/Gui/bitmap/bitmap.c @@ -4,7 +4,6 @@ #include <string.h> #include "bitmap.h" -#include "../error.h" #define BMP 1 #define TGA 2 @@ -25,13 +24,11 @@ int conv24to32( txSample * bf ) bf->BPP=32; if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Not enough memory for image.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Not enough memory for image.\n" ); return 1; } memset( bf->Image,0,bf->ImageSize ); - for ( c=0,i=0;i < bf->Width * bf->Height * 3; ) + for ( c=0,i=0;i < (int)(bf->Width * bf->Height * 3); ) { bf->Image[c++]=tmpImage[i++]; bf->Image[c++]=tmpImage[i++]; @@ -47,7 +44,7 @@ void bgr2rgb( txSample * bf ) unsigned char c; int i; - for ( i=0;i < bf->ImageSize;i+=4 ) + for ( i=0;i < (int)bf->ImageSize;i+=4 ) { c=bf->Image[i]; bf->Image[i]=bf->Image[i+2]; @@ -58,8 +55,7 @@ void bgr2rgb( txSample * bf ) void Normalize( txSample * bf ) { int i; - - for ( i=0;i < bf->ImageSize;i+=4 ) bf->Image[i+3]=0; + for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0; } unsigned char tmp[512]; @@ -149,23 +145,17 @@ int bpRead( char * fname, txSample * bf ) bgr=1; break; case TGAPACKED: - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, packed TGA not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, packed TGA not supported.\n" ); return -6; default: { - #ifdef DEBUG - dbprintf( 4,"[bitmap] Unknown file type ( %s ).\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Unknown file type ( %s ).\n",fname ); return -7; } } if ( bf->BPP < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] sorry, 16 or less bitmaps not supported.\n" ); return -1; } if ( conv24to32( bf ) ) return -8; @@ -180,15 +170,15 @@ void Convert32to1( txSample * in,txSample * out,int adaptivlimit ) out->Height=in->Height; out->BPP=1; out->ImageSize=out->Width * out->Height / 8; - dbprintf( 4,"[c1to32] imagesize: %d\n",out->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c1to32] imagesize: %d\n",out->ImageSize ); out->Image=(char *)calloc( 1,out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1; buf=(unsigned long *)in->Image; - for ( b=0,i=0;i < out->Width * out->Height;i++ ) + for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ ) { - if ( buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; + if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128; else { tmp=tmp >> 1; buf[i]=nothaveshape=0; } if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; } } @@ -205,12 +195,12 @@ void Convert1to32( txSample * in,txSample * out ) out->BPP=32; out->ImageSize=out->Width * out->Height * 4; out->Image=(char *)calloc( 1,out->ImageSize ); - dbprintf( 4,"[c32to1] imagesize: %d\n",out->ImageSize ); - if ( out->Image == NULL ) dbprintf( 4,"nem van ram baze\n" ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize ); + if ( (int)out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_STATUS,"nem van ram baze\n" ); { int i,b,c=0; unsigned long * buf = NULL; unsigned char tmp = 0; buf=(unsigned long *)out->Image; - for ( c=0,i=0;i < in->Width * in->Height / 8;i++ ) + for ( c=0,i=0;i < (int)(in->Width * in->Height / 8);i++ ) { tmp=in->Image[i]; for ( b=0;b<8;b++ ) diff --git a/Gui/bitmap/bitmap.h b/Gui/bitmap/bitmap.h index 6daa2927a1..913f2636a2 100644 --- a/Gui/bitmap/bitmap.h +++ b/Gui/bitmap/bitmap.h @@ -14,6 +14,7 @@ typedef struct _txSample #include "tga/tga.h" #include "bmp/bmp.h" #include "png/png.h" +#include "../../mp_msg.h" extern int bpRead( char * fname, txSample * bf ); extern int conv24to32( txSample * bf ); diff --git a/Gui/bitmap/bmp/bmp.c b/Gui/bitmap/bmp/bmp.c index b362d3f9a3..4511f33eef 100644 --- a/Gui/bitmap/bmp/bmp.c +++ b/Gui/bitmap/bmp/bmp.c @@ -27,7 +27,6 @@ #include "bmp.h" #include "../bitmap.h" -#include "../../error.h" int bmpRead( unsigned char * fname,txSample * bF ) { @@ -40,16 +39,12 @@ int bmpRead( unsigned char * fname,txSample * bF ) if ( (BMP=fopen( fname,"rt" )) == NULL ) { -#ifdef DEBUG - dbprintf( 4,"[bmp] File not found ( %s ).\n",fname ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] File not found ( %s ).\n",fname ); return 1; } if ( (i=fread( bmpHeader,54,1,BMP )) != 1 ) { -#ifdef DEBUG - dbprintf( 4,"[bmp] Header read error ( %s ).\n",fname ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Header read error ( %s ).\n",fname ); return 2; } // memcpy( &bF->Size,&bmpHeader[2],4 ); @@ -61,31 +56,23 @@ int bmpRead( unsigned char * fname,txSample * bF ) if ( bF->BPP < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Sorry, this loader not supported 16 bit or less ...\n" ); return 3; } -#ifdef DEBUG - dbprintf( 4,"[bmp] filename: %s\n",fname ); - dbprintf( 4,"[bmp] size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP ); - dbprintf( 4,"[bmp] imagesize: %lu\n",bF->ImageSize ); -#endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] filename: %s\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] size: %dx%d bits: %d\n",bF->Width,bF->Height,bF->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] imagesize: %lu\n",bF->ImageSize ); if ( ( bF->Image=malloc( bF->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Not enough memory for image buffer.\n" ); return 4; } if ( (i=fread( bF->Image,bF->ImageSize,1,BMP )) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Image read error.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Image read error.\n" ); return 5; } @@ -94,9 +81,7 @@ int bmpRead( unsigned char * fname,txSample * bF ) linesize=bF->Width * ( bF->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[bmp] Not enough memory for flipping.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bmp] Not enough memory for flipping.\n" ); return 6; } diff --git a/Gui/bitmap/png/png.c b/Gui/bitmap/png/png.c index 113a22b095..175cf7e582 100644 --- a/Gui/bitmap/png/png.c +++ b/Gui/bitmap/png/png.c @@ -2,7 +2,6 @@ #include <stdlib.h> #include "./png.h" -#include "../../error.h" #include <png.h> typedef struct @@ -106,9 +105,7 @@ int pngRead( unsigned char * fname,txSample * bf ) if ( pngLoadRaw( fname,&raw ) ) { - #ifdef DEBUG - dbprintf( 4,"[png] file read error ( %s ).\n",fname ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] file read error ( %s ).\n",fname ); return 1; } bf->Width=raw.Width; @@ -117,17 +114,13 @@ int pngRead( unsigned char * fname,txSample * bf ) bf->ImageSize=bf->Width * bf->Height * ( bf->BPP / 8 ); if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[png] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] Not enough memory for image buffer.\n" ); return 2; } memcpy( bf->Image,raw.Data,bf->ImageSize ); free( raw.Data ); - #ifdef DEBUG - dbprintf( 4,"[png] filename: %s.\n",fname ); - dbprintf( 4,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); - dbprintf( 4,"[png] imagesize: %lu\n",bf->ImageSize ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] imagesize: %lu\n",bf->ImageSize ); return 0; } diff --git a/Gui/bitmap/tga/tga.c b/Gui/bitmap/tga/tga.c index 8a33f6a07e..de826d2bd8 100644 --- a/Gui/bitmap/tga/tga.c +++ b/Gui/bitmap/tga/tga.c @@ -4,7 +4,6 @@ #include <stdlib.h> #include "tga.h" -#include "../../error.h" int tgaRead( char * filename,txSample * bf ) { @@ -20,23 +19,17 @@ int tgaRead( char * filename,txSample * bf ) if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); if ( (BMP=fopen( tmp,"rb" )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] File not found ( %s ).\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] File not found ( %s ).\n",tmp ); return 1; } if ( (i=fread( &tgaHeader,sizeof( tgaHeader ),1,BMP )) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Header read error ( %s ).\n",tmp ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Header read error ( %s ).\n",tmp ); return 2; } if ( tgaHeader.depth < 24 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Sorry, this loader not supported 16 bit or less ...\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Sorry, this loader not supported 16 bit or less ...\n" ); return 3; } bf->Width=tgaHeader.sx; @@ -46,9 +39,7 @@ int tgaRead( char * filename,txSample * bf ) if ( ( bf->Image=malloc( bf->ImageSize ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for image buffer.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for image buffer.\n" ); return 4; } @@ -57,35 +48,29 @@ int tgaRead( char * filename,txSample * bf ) { if ( ( comment=malloc( tgaHeader.tmp[0] + 1 ) ) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for comment string.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for comment string.\n" ); return 5; } memset( comment,0,tgaHeader.tmp[0] + 1 ); if ( fread( comment,tgaHeader.tmp[0],1,BMP ) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Comment read error.\n" ); - #endif - return 6; + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Comment read error.\n" ); + return 6; } } - #ifdef DEBUG - dbprintf( 4,"[tga] filename ( read ): %s\n",tmp ); - dbprintf( 4,"[tga] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); - dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); - if ( comment ) dbprintf( 4,"[tga] comment: %s\n",comment ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] filename ( read ): %s\n",tmp ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] imagesize: %lu\n",bf->ImageSize ); + #ifdef MP_DEBUG + if ( comment ) mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] comment: %s\n",comment ); #endif if ( comment ) free( comment ); if ( fread( bf->Image,bf->ImageSize,1,BMP ) != 1 ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Image read error.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Image read error.\n" ); return 7; } @@ -96,9 +81,7 @@ int tgaRead( char * filename,txSample * bf ) linesize=bf->Width * ( bf->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - #ifdef DEBUG - dbprintf( 4,"[tga] Not enough memory for flipping.\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] Not enough memory for flipping.\n" ); return 8; } @@ -129,7 +112,7 @@ void tgaWriteTexture( char * filename,txSample * bf ) if ( !strstr( tmp,".tga" ) ) strcat( tmp,".tga" ); if ( ( BMP=fopen( tmp,"wb+" ) ) == NULL ) { - dbprintf( 0,"[tga] File not open ( %s ).\n",tmp ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] File not open ( %s ).\n",tmp ); exit( 0 ); } memset( &tgaHeader,0,sizeof( tgaHeader ) ); @@ -141,21 +124,19 @@ void tgaWriteTexture( char * filename,txSample * bf ) if ( bf->BPP != 8 ) tgaHeader.tmp[2]=2; else tgaHeader.tmp[2]=3; - #ifdef DEBUG - dbprintf( 4,"\n[tga] filename ( write ): %s\n",tmp ); - dbprintf( 4,"[tga] size: %dx%d\n",bf->Width,bf->Height ); - dbprintf( 4,"[tga] bits: %d\n",bf->BPP ); - dbprintf( 4,"[tga] imagesize: %lu\n",bf->ImageSize ); - dbprintf( 4,"[tga] comment: %s\n",comment ); - dbprintf( 4,"\n" ); - #endif + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[tga] filename ( write ): %s\n",tmp ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] size: %dx%d\n",bf->Width,bf->Height ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] bits: %d\n",bf->BPP ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] imagesize: %lu\n",bf->ImageSize ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[tga] comment: %s\n",comment ); + mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n" ); if ( tgaHeader.ctmp == 0 ) { linesize=bf->Width * ( bf->BPP / 8 ); if ( (line=malloc( linesize )) == NULL ) { - dbprintf( 0,"[tga] Not enough memory for flipping.\n" ); + mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[tga] Not enough memory for flipping.\n" ); exit( 0 ); } |