From e40f658344802f2198a1d7ad1f71ab2aab45b207 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 31 Mar 2007 14:17:31 +0000 Subject: Remove unused/nonworking wallpaper setting utility. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22859 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/mwallp/README | 23 -------- TOOLS/mwallp/compile.sh | 6 -- TOOLS/mwallp/jpeg.c | 147 ------------------------------------------------ TOOLS/mwallp/mwallp.c | 115 ------------------------------------- 4 files changed, 291 deletions(-) delete mode 100644 TOOLS/mwallp/README delete mode 100755 TOOLS/mwallp/compile.sh delete mode 100644 TOOLS/mwallp/jpeg.c delete mode 100644 TOOLS/mwallp/mwallp.c (limited to 'TOOLS') diff --git a/TOOLS/mwallp/README b/TOOLS/mwallp/README deleted file mode 100644 index 143d57a7ce..0000000000 --- a/TOOLS/mwallp/README +++ /dev/null @@ -1,23 +0,0 @@ -mwallp - mplayer's wallpaper setting utility -====== - -Usage: mwallp file1.jpg [file2.jpg file3.jpg ...] -~~~~~~ - -About: -~~~~~~ -MWallp is a simple tool to set .jpg images as background/wallpaper on the -desktop. It scales (bicubic) and convert the given jpg image to desktop -size/bpp and set as background of Root window. - -If more than 1 filenames given, it randomly selects one, so running something -like 'mwallp ~/.wallpapers/*.jpg' from cron will randomly changes wallpaper. - -Why? -~~~~ -I've tried several programs, and as most of them used Imlib, their quality -sucks (Imlib uses neares-neighbour scaling...). -So I've decided to put together something very simple but efficient built -using the MPlayer codebase. - -A'rpi diff --git a/TOOLS/mwallp/compile.sh b/TOOLS/mwallp/compile.sh deleted file mode 100755 index 6ef2d20c44..0000000000 --- a/TOOLS/mwallp/compile.sh +++ /dev/null @@ -1,6 +0,0 @@ -echo -gcc -g mwallp.c jpeg.c ../../libvo/aclib.o ../../libmpcodecs/img_format.o \ - ../../cpudetect.o ../../mp_msg-mencoder.o ../../libavcodec/libavcodec.a \ - ../../libswscale/libswscale.a ../../osdep/libosdep.a \ - -I../../libmpcodecs -I../.. -I../../libswscale \ - -L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lm -ljpeg -o mwallp diff --git a/TOOLS/mwallp/jpeg.c b/TOOLS/mwallp/jpeg.c deleted file mode 100644 index 7a3b678434..0000000000 --- a/TOOLS/mwallp/jpeg.c +++ /dev/null @@ -1,147 +0,0 @@ -// based on vd_ijpg.c by Pontscho - -#include -#include - -#include -#define UINT16 IJPG_UINT16 -#define INT16 IJPG_INT16 - -#include - -#include - -#include "img_format.h" - -#include "swscale.h" -#include "rgb2rgb.h" - -static struct SwsContext *swsContext=NULL; - -typedef struct -{ - struct jpeg_source_mgr pub; - unsigned char * inbuf; - int bufsize; -} my_source_mgr; - -typedef my_source_mgr * my_src_ptr; - -METHODDEF(void) init_source (j_decompress_ptr cinfo) -{ -} - -METHODDEF(boolean) fill_input_buffer (j_decompress_ptr cinfo) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - size_t nbytes; - src->pub.next_input_byte = src->inbuf; - src->pub.bytes_in_buffer = src->bufsize; - return TRUE; -} - -METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes) -{ - my_src_ptr src = (my_src_ptr) cinfo->src; - - if (num_bytes > 0) - { - while (num_bytes > (long) src->pub.bytes_in_buffer) - { - num_bytes -= (long) src->pub.bytes_in_buffer; - (void) fill_input_buffer(cinfo); - } - src->pub.next_input_byte += (size_t) num_bytes; - src->pub.bytes_in_buffer -= (size_t) num_bytes; - } -} - -METHODDEF(void) term_source (j_decompress_ptr cinfo) { } - -GLOBAL(void) jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize ) -{ - my_src_ptr src; - if (cinfo->src == NULL) cinfo->src=malloc( sizeof( my_source_mgr ) ); - src = (my_src_ptr) cinfo->src; - src->pub.init_source = init_source; - src->pub.fill_input_buffer = fill_input_buffer; - src->pub.skip_input_data = skip_input_data; - src->pub.resync_to_restart = jpeg_resync_to_restart; - src->pub.term_source = term_source; - src->inbuf = inbuf; - src->bufsize=bufsize; - src->pub.bytes_in_buffer = 0; - src->pub.next_input_byte = NULL; -} - -struct my_error_mgr -{ - struct jpeg_error_mgr pub; - jmp_buf setjmp_buffer; -}; - -typedef struct my_error_mgr * my_error_ptr; - -METHODDEF(void) my_error_exit (j_common_ptr cinfo) -{ - my_error_ptr myerr=(my_error_ptr) cinfo->err; - (*cinfo->err->output_message) (cinfo); - longjmp(myerr->setjmp_buffer, 1); -} - -static struct jpeg_decompress_struct cinfo; -static struct my_error_mgr jerr; - -// decode a frame -int decode_jpeg(void* data,int len,char* dbuffer,int dwidth,int dheight, int dstride,int dbpp){ - int width,height,depth,i; - int row_stride; - unsigned char* img=NULL; - int in_fmt=0; - - if ( len <= 0 ) return 0; // skipped frame - - cinfo.err=jpeg_std_error( &jerr.pub ); - jerr.pub.error_exit=my_error_exit; - if( setjmp( jerr.setjmp_buffer ) ) - { - return 0; - } - - jpeg_create_decompress( &cinfo ); - jpeg_buf_src( &cinfo,data,len ); - jpeg_read_header( &cinfo,TRUE ); - width=cinfo.image_width; - height=cinfo.image_height; - jpeg_start_decompress( &cinfo ); - depth=cinfo.output_components * 8; - - switch( depth ) { - case 8: in_fmt=IMGFMT_Y8;break; - case 24: in_fmt=IMGFMT_RGB|24;break; - default: return 0; - } - - row_stride=cinfo.output_width * cinfo.output_components; - img=malloc(row_stride * (height+1)); - - for ( i=0;i < height;i++ ){ -// char* row=dbuffer+i*dstride; - char* row=img+row_stride*i; - jpeg_read_scanlines( &cinfo,(JSAMPLE**)&row,1 ); - } - - jpeg_finish_decompress(&cinfo); - jpeg_destroy_decompress(&cinfo); - - swsContext= sws_getContext(width,height, in_fmt, - dwidth,dheight, IMGFMT_BGR|dbpp, SWS_BICUBIC, NULL, NULL, NULL); - - sws_scale(swsContext,&img,&row_stride,0,height,&dbuffer, &dstride); - - sws_freeContext(swsContext); - - free(img); - - return 1; -} diff --git a/TOOLS/mwallp/mwallp.c b/TOOLS/mwallp/mwallp.c deleted file mode 100644 index f9fbaefc76..0000000000 --- a/TOOLS/mwallp/mwallp.c +++ /dev/null @@ -1,115 +0,0 @@ -// based on x11_common.c/vo_x11.c from libvo - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include "cpudetect.h" - -char* mDisplayName=NULL; -Display* mDisplay=NULL; -Window mRootWin=None; -int mScreen=0; -XImage * mXImage = NULL; -GC vo_gc = NULL; -Pixmap mPixmap=0; - -int vo_depthonscreen=0; -int vo_screenwidth=0; -int vo_screenheight=0; - -int verbose=0; -int namecnt=0; - -int main(int argc,char* argv[]){ - unsigned int mask; - int bpp,depth; - - mp_msg_init(); - mp_msg_set_level(5); - - GetCpuCaps(&gCpuCaps); - - mDisplayName = XDisplayName(mDisplayName); - mDisplay=XOpenDisplay(mDisplayName); - if ( !mDisplay ) - { - printf("vo: couldn't open the X11 display (%s)!\n",mDisplayName ); - return 0; - } - mScreen=DefaultScreen( mDisplay ); // Screen ID. - mRootWin=RootWindow( mDisplay,mScreen );// Root window ID. - - vo_screenwidth=DisplayWidth( mDisplay,mScreen ); - vo_screenheight=DisplayHeight( mDisplay,mScreen ); - - // get color depth (from root window, or the best visual): - { XWindowAttributes attribs; - XGetWindowAttributes(mDisplay, mRootWin, &attribs); - depth=vo_depthonscreen=attribs.depth; - } - mXImage=XGetImage( mDisplay,mRootWin,0,0,vo_screenwidth,vo_screenheight,AllPlanes,ZPixmap ); - - bpp=mXImage->bits_per_pixel; - if((vo_depthonscreen+7)/8 != (bpp+7)/8) vo_depthonscreen=bpp; // by A'rpi - mask=mXImage->red_mask|mXImage->green_mask|mXImage->blue_mask; - - if(((vo_depthonscreen+7)/8)==2){ - if(mask==0x7FFF) vo_depthonscreen=15; else - if(mask==0xFFFF) vo_depthonscreen=16; - } - - printf("X11 running at %d x %d, %d bpp \n",vo_screenwidth,vo_screenheight,vo_depthonscreen); - - mPixmap=XCreatePixmap(mDisplay,mRootWin,vo_screenwidth,vo_screenheight,depth); - - { XGCValues xgcv; - vo_gc=XCreateGC( mDisplay,mRootWin,0L,&xgcv ); - } - - if(argc<2){ printf("no filenames!\n");return;} - - srand(time(NULL)); - -while(1){ - FILE *f; - char* data; - int len; - int ret; - - namecnt=1+(long long)rand()*(argc-1)/RAND_MAX; - //++namecnt; if(namecnt>=argc) namecnt=1; - if(namecnt<1 || namecnt>=argc) continue; // ??? - - f=fopen(argv[namecnt],"rb");if(!f) continue; - fseek(f,0,SEEK_END); len=ftell(f); fseek(f,0,SEEK_SET); - data=malloc(len); - len=fread(data,1,len,f); - fclose(f); - - ret=decode_jpeg(data,len,mXImage->data,vo_screenwidth,vo_screenheight, - ((vo_depthonscreen+7)/8)*vo_screenwidth,vo_depthonscreen); - - free(data); - - if(!ret) continue; // failed to load - - XPutImage( mDisplay,mPixmap,vo_gc,mXImage, - 0,0, 0,0, vo_screenwidth,vo_screenheight); - XSetWindowBackgroundPixmap(mDisplay,mRootWin,mPixmap); - XClearWindow(mDisplay,mRootWin); - XSync(mDisplay, True); - - break; // DONE! -} - -} -- cgit v1.2.3