From 3050d97eb83cfdfb4d04a51231acba47e6addf1c Mon Sep 17 00:00:00 2001 From: Daniel Caujolle-Bert Date: Wed, 26 Nov 2003 19:43:26 +0000 Subject: lprintf cleanup, pass I. CVS patchset: 5796 CVS date: 2003/11/26 19:43:26 --- src/audio_out/audio_directx_out.c | 1115 +++++++++++------------- src/audio_out/audio_oss_out.c | 49 +- src/demuxers/demux_4xm.c | 9 +- src/demuxers/demux_asf.c | 280 +++--- src/demuxers/demux_avi.c | 6 +- src/demuxers/demux_eawve.c | 9 +- src/demuxers/demux_elem.c | 9 +- src/demuxers/demux_film.c | 9 +- src/demuxers/demux_idcin.c | 5 +- src/demuxers/demux_image.c | 9 +- src/demuxers/demux_ipmovie.c | 13 +- src/demuxers/demux_mng.c | 9 +- src/demuxers/demux_mpeg.c | 9 +- src/demuxers/demux_mpeg_block.c | 126 +-- src/demuxers/demux_mpeg_pes.c | 124 +-- src/demuxers/demux_mpgaudio.c | 6 +- src/demuxers/demux_nsv.c | 9 +- src/demuxers/demux_ogg.c | 21 +- src/demuxers/demux_real.c | 11 +- src/demuxers/demux_roq.c | 9 +- src/demuxers/demux_slave.c | 9 +- src/demuxers/demux_str.c | 9 +- src/demuxers/demux_ts.c | 15 +- src/demuxers/demux_wc3movie.c | 8 +- src/demuxers/demux_yuv_frames.c | 11 +- src/dxr3/dxr3_decode_spu.c | 7 +- src/input/input_cdda.c | 445 +++++----- src/input/input_dvb.c | 36 +- src/input/input_file.c | 21 +- src/input/input_http.c | 34 +- src/input/input_mms.c | 40 +- src/input/input_net.c | 31 +- src/input/input_pnm.c | 25 +- src/input/input_pvr.c | 109 +-- src/input/input_rtp.c | 47 +- src/input/input_rtsp.c | 34 +- src/input/input_stdin_fifo.c | 46 +- src/input/input_v4l.c | 2 +- src/input/libreal/asmrp.c | 72 +- src/input/libreal/real.c | 79 +- src/input/libreal/rmff.c | 54 +- src/input/libreal/sdpplin.c | 22 +- src/input/librtsp/rtsp.c | 48 +- src/input/librtsp/rtsp_session.c | 22 +- src/input/mms.c | 35 +- src/input/mmsh.c | 184 ++-- src/input/net_buf_ctrl.c | 34 +- src/input/pnm.c | 34 +- src/liba52/xine_decoder.c | 63 +- src/libdivx4/xine_decoder.c | 60 +- src/libfaad/xine_decoder.c | 30 +- src/libffmpeg/xine_decoder.c | 66 +- src/libflac/decoder_flac.c | 87 +- src/libflac/demux_flac.c | 172 ++-- src/libmad/xine_decoder.c | 31 +- src/libmpeg2/decode.c | 68 +- src/libmpeg2/xine_decoder.c | 28 +- src/libreal/audio_decoder.c | 94 +- src/libreal/xine_decoder.c | 100 +-- src/libspeex/xine_decoder.c | 35 +- src/libsputext/demux_sputext.c | 20 +- src/libsputext/xine_decoder.c | 58 +- src/libsputext/xine_decoder_ogm.c | 56 +- src/libtheora/xine_decoder.c | 37 +- src/libvorbis/xine_decoder.c | 33 +- src/libw32dll/qt_decoder.c | 237 ++---- src/libw32dll/w32codec.c | 95 +-- src/libxineadec/adpcm.c | 79 +- src/libxineadec/pcm.c | 24 +- src/libxinevdec/image.c | 50 +- src/libxinevdec/yuv_frames.c | 28 +- src/libxvid/xine_decoder.c | 17 +- src/post/deinterlace/deinterlace.c | 29 +- src/post/goom/xine_goom.c | 11 +- src/post/mosaico/mosaico.c | 40 +- src/post/mosaico/switch.c | 24 +- src/video_out/video_out_directx.c | 1650 ++++++++++++++++++------------------ src/video_out/video_out_fb.c | 29 +- src/video_out/video_out_sdl.c | 36 +- src/video_out/video_out_stk.c | 48 +- src/video_out/video_out_vidix.c | 100 +-- src/video_out/video_out_xshm.c | 44 +- src/video_out/video_out_xv.c | 25 +- src/video_out/video_out_xvmc.c | 102 +-- src/video_out/yuv2rgb.c | 14 +- src/xine-engine/audio_decoder.c | 51 +- src/xine-engine/audio_out.c | 9 +- src/xine-engine/configfile.c | 44 +- src/xine-engine/demux.c | 63 +- src/xine-engine/input_rip.c | 9 +- src/xine-engine/load_plugins.c | 40 +- src/xine-engine/metronom.c | 3 +- src/xine-engine/osd.c | 11 +- src/xine-engine/scratch.c | 19 +- src/xine-engine/video_decoder.c | 57 +- src/xine-engine/video_out.c | 157 ++-- src/xine-engine/vo_scale.c | 23 +- src/xine-engine/xine.c | 7 +- src/xine-utils/cpu_accel.c | 12 +- src/xine-utils/memcpy.c | 15 +- src/xine-utils/xine_buffer.c | 53 +- src/xine-utils/xmllexer.c | 36 +- src/xine-utils/xmlparser.c | 73 +- 103 files changed, 3377 insertions(+), 4375 deletions(-) diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c index cc218d543..1956eccd3 100755 --- a/src/audio_out/audio_directx_out.c +++ b/src/audio_out/audio_directx_out.c @@ -20,7 +20,7 @@ * audio_directx_out.c, direct sound audio output plugin for xine * by Matthew Grooms * - * $Id: audio_directx_out.c,v 1.4 2003/10/06 15:27:10 mroi Exp $ + * $Id: audio_directx_out.c,v 1.5 2003/11/26 19:43:26 f1rmb Exp $ */ typedef unsigned char boolean; @@ -30,81 +30,73 @@ typedef unsigned char boolean; #include "audio_out.h" #include "xine_internal.h" +#define LOG_MODULE "audio_directx_out" +#define LOG_VERBOSE +/* +#define LOG +*/ -#if (0) -#define LOG 1 -#endif - -#define MAX_CHANNELS 6 -#define MAX_BITS 16 -#define MAX_SAMPLE_RATE 44100 -#define SOUND_BUFFER_DIV 32 -#define SOUND_BUFFER_MAX MAX_CHANNELS * MAX_BITS * MAX_SAMPLE_RATE / SOUND_BUFFER_DIV - -#define DSBUFF_INIT 0 -#define DSBUFF_LEFT 1 -#define DSBUFF_RIGHT 2 - -#define AO_DIRECTX_IFACE_VERSION 7 - -// ----------------------------------------- -// -// ao_directx driver struct -// -// ----------------------------------------- - -typedef struct ao_directx_s -{ - ao_driver_t ao_driver; - - int capabilities; - - // directx objects - - LPDIRECTSOUND dsobj; - LPDIRECTSOUNDBUFFER dsbuffer; - DSBCAPS dsbcaps; - LPDIRECTSOUNDNOTIFY notify; - DSBPOSITIONNOTIFY notify_events[ 2 ]; - - // buffer vars - - long buffer_size; - long buffer_init; - int write_status; - long write_pos; - - uint8_t prebuff[ SOUND_BUFFER_MAX ]; - uint32_t prebuff_size; - - // current buffer properties - - int bits; - int rate; - int chnn; - int frsz; +#define MAX_CHANNELS 6 +#define MAX_BITS 16 +#define MAX_SAMPLE_RATE 44100 +#define SOUND_BUFFER_DIV 32 +#define SOUND_BUFFER_MAX MAX_CHANNELS * MAX_BITS * MAX_SAMPLE_RATE / SOUND_BUFFER_DIV - // current mixer settings +#define DSBUFF_INIT 0 +#define DSBUFF_LEFT 1 +#define DSBUFF_RIGHT 2 - int mute; - int volume; +#define AO_DIRECTX_IFACE_VERSION 7 -}ao_directx_t; +/* ----------------------------------------- + * + * ao_directx driver struct + * + * ----------------------------------------- */ typedef struct { - audio_driver_class_t driver_class; - - config_values_t *config; + ao_driver_t ao_driver; + int capabilities; + + /* directx objects */ + LPDIRECTSOUND dsobj; + LPDIRECTSOUNDBUFFER dsbuffer; + DSBCAPS dsbcaps; + LPDIRECTSOUNDNOTIFY notify; + DSBPOSITIONNOTIFY notify_events[ 2 ]; + + /* buffer vars */ + long buffer_size; + long buffer_init; + int write_status; + long write_pos; + + uint8_t prebuff[ SOUND_BUFFER_MAX ]; + uint32_t prebuff_size; + + /* current buffer properties */ + int bits; + int rate; + int chnn; + int frsz; + + /* current mixer settings */ + int mute; + int volume; +} ao_directx_t; - char *device_name; +typedef struct { + audio_driver_class_t driver_class; + config_values_t *config; + char *device_name; } audiox_class_t; -// ------------------------------------------- -// -// BEGIN : Direct Sound and win32 handlers -// for xine audio output plugins. -// -// ------------------------------------------- +/* ------------------------------------------- + * + * BEGIN : Direct Sound and win32 handlers + * for xine audio output plugins. + * + * ------------------------------------------- */ boolean CreateDirectSound( ao_directx_t * ao_directx ); void DestroyDirectSound( ao_directx_t * ao_directx ); @@ -112,768 +104,697 @@ boolean CreateSoundBuffer( ao_directx_t * ao_directx ); void DestroySoundBuffer( ao_directx_t * ao_directx ); uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * samples ); -// Display formatted error message in -// popup message box. +/* Display formatted error message in + * popup message box. */ void Error( HWND hwnd, LPSTR szfmt, ... ) { - char tempbuff[ 256 ]; - *tempbuff = 0; - wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); - MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); + char tempbuff[ 256 ]; + *tempbuff = 0; + wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); + MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); } -// Create our direct sound object and -// set the cooperative level. +/* Create our direct sound object and + * set the cooperative level. */ boolean CreateDirectSound( ao_directx_t * ao_directx ) { - DSCAPS dscaps; - HWND hxinewnd; + DSCAPS dscaps; + HWND hxinewnd; -#ifdef LOG - printf("audio_directx_out: CreateDirectSound(%08x) Enter\n", (unsigned long)ao_directx); -#endif + lprintf("CreateDirectSound(%08x) Enter\n", (unsigned long)ao_directx); - // create direct sound object + /* create direct sound object */ - if( DirectSoundCreate( 0, &ao_directx->dsobj, 0 ) != DS_OK ) + if( DirectSoundCreate( 0, &ao_directx->dsobj, 0 ) != DS_OK ) { - Error( 0, "DirectSoundCreate : Unable to create direct sound object" ); -#ifdef LOG - printf("audio_directx_out: CreateDirectSound() Exit! Returning False\n"); -#endif - return FALSE; + Error( 0, "DirectSoundCreate : Unable to create direct sound object" ); + lprintf("CreateDirectSound() Exit! Returning False\n"); + return FALSE; } - // try to get our current xine window + /* try to get our current xine window */ - hxinewnd = FindWindow( "xinectrlwindow", "xine" ); - if( !hxinewnd ) - hxinewnd = GetDesktopWindow(); + hxinewnd = FindWindow( "xinectrlwindow", "xine" ); + if( !hxinewnd ) + hxinewnd = GetDesktopWindow(); - // set direct sound cooperative level + /* set direct sound cooperative level */ - if( IDirectSound_SetCooperativeLevel( ao_directx->dsobj, hxinewnd, DSSCL_EXCLUSIVE ) != DS_OK ) + if( IDirectSound_SetCooperativeLevel( ao_directx->dsobj, hxinewnd, DSSCL_EXCLUSIVE ) != DS_OK ) { - Error( 0, "IDirectSound_SetCooperativeLevel : could not set direct sound cooperative level" ); -#ifdef LOG - printf("audio_directx_out: CreateDirectSound() Exit! Returning False\n"); -#endif - return FALSE; + Error( 0, "IDirectSound_SetCooperativeLevel : could not set direct sound cooperative level" ); + lprintf("CreateDirectSound() Exit! Returning False\n"); + return FALSE; } - // get the direct sound device caps + /* get the direct sound device caps */ - memset( &dscaps, 0, sizeof( dscaps ) ); - dscaps.dwSize = sizeof( dscaps ); - if( IDirectSound_GetCaps( ao_directx->dsobj, &dscaps ) != DS_OK ) - { - Error( 0, "IDirectSound_GetCaps : Unable to get direct sound device capabilities" ); -#ifdef LOG - printf("audio_directx_out: CreateDirectSound() Exit! Returning False\n"); -#endif - return FALSE; - } + memset( &dscaps, 0, sizeof( dscaps ) ); + dscaps.dwSize = sizeof( dscaps ); + if( IDirectSound_GetCaps( ao_directx->dsobj, &dscaps ) != DS_OK ) + { + Error( 0, "IDirectSound_GetCaps : Unable to get direct sound device capabilities" ); + lprintf("CreateDirectSound() Exit! Returning False\n"); + return FALSE; + } -#ifdef LOG - printf("audio_directx_out: CreateDirectSound() Exit! Returning True\n"); -#endif - return TRUE; + lprintf("CreateDirectSound() Exit! Returning True\n"); + return TRUE; } -// Destroy all direct sound allocated -// resources. +/* Destroy all direct sound allocated + * resources. */ void DestroyDirectSound( ao_directx_t * ao_directx ) { -#ifdef LOG - printf("audio_directx_out: DestroyDirectSound(%08x) Enter\n", (unsigned long)ao_directx); -#endif + lprintf("DestroyDirectSound(%08x) Enter\n", (unsigned long)ao_directx); - if( ao_directx->dsobj ) - { -#ifdef LOG - printf("audio_directx_out: IDirectSound_Release()\n"); -#endif - - IDirectSound_Release( ao_directx->dsobj ); - ao_directx->dsobj = 0; - } + if( ao_directx->dsobj ) + { + lprintf("IDirectSound_Release()\n"); -#ifdef LOG - printf("audio_directx_out: DestroyDirectSound() Exit\n"); -#endif + IDirectSound_Release( ao_directx->dsobj ); + ao_directx->dsobj = 0; + } + lprintf("DestroyDirectSound() Exit\n"); } -// Used to create directx sound buffer, -// notification events, and initialize -// buffer to null sample data. +/* Used to create directx sound buffer, + * notification events, and initialize + * buffer to null sample data. */ boolean CreateSoundBuffer( ao_directx_t * ao_directx ) { - DSBUFFERDESC dsbdesc; - PCMWAVEFORMAT pcmwf; + DSBUFFERDESC dsbdesc; + PCMWAVEFORMAT pcmwf; -#ifdef LOG - printf("audio_directx_out: CreateSoundBuffer(%08x) Enter\n", (unsigned long)ao_directx); -#endif + lprintf("CreateSoundBuffer(%08x) Enter\n", (unsigned long)ao_directx); - // calculate buffer and frame size + /* calculate buffer and frame size */ - ao_directx->frsz = ( ao_directx->bits / 8 ) * ao_directx->chnn; - ao_directx->buffer_size = ( ao_directx->frsz * ao_directx->rate ) / SOUND_BUFFER_DIV; + ao_directx->frsz = ( ao_directx->bits / 8 ) * ao_directx->chnn; + ao_directx->buffer_size = ( ao_directx->frsz * ao_directx->rate ) / SOUND_BUFFER_DIV; - // release any existing sound buffer - // related resources + /* release any existing sound buffer + * related resources */ - DestroySoundBuffer( ao_directx ); + DestroySoundBuffer( ao_directx ); - // create a secondary sound buffer + /* create a secondary sound buffer */ - memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); - pcmwf.wBitsPerSample = ( unsigned short ) ao_directx->bits; - pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; - pcmwf.wf.nChannels = ao_directx->chnn; - pcmwf.wf.nSamplesPerSec = ao_directx->rate; - pcmwf.wf.nBlockAlign = ao_directx->frsz; - pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; - - memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); - dsbdesc.dwSize = sizeof( DSBUFFERDESC ); - dsbdesc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | - DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY; - dsbdesc.dwBufferBytes = ao_directx->buffer_size; - dsbdesc.lpwfxFormat = ( LPWAVEFORMATEX ) &pcmwf; - - if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, - &ao_directx->dsbuffer, 0 ) != DS_OK ) - { - Error( 0, "IDirectSound_CreateSoundBuffer : Unable to create secondary sound buffer" ); - return FALSE; - } + memset( &pcmwf, 0, sizeof( PCMWAVEFORMAT ) ); + pcmwf.wBitsPerSample = ( unsigned short ) ao_directx->bits; + pcmwf.wf.wFormatTag = WAVE_FORMAT_PCM; + pcmwf.wf.nChannels = ao_directx->chnn; + pcmwf.wf.nSamplesPerSec = ao_directx->rate; + pcmwf.wf.nBlockAlign = ao_directx->frsz; + pcmwf.wf.nAvgBytesPerSec = ao_directx->rate * ao_directx->frsz; + + memset( &dsbdesc, 0, sizeof( DSBUFFERDESC ) ); + dsbdesc.dwSize = sizeof( DSBUFFERDESC ); + dsbdesc.dwFlags = (DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | + DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY); + dsbdesc.dwBufferBytes = ao_directx->buffer_size; + dsbdesc.lpwfxFormat = ( LPWAVEFORMATEX ) &pcmwf; + + if( IDirectSound_CreateSoundBuffer( ao_directx->dsobj, &dsbdesc, + &ao_directx->dsbuffer, 0 ) != DS_OK ) + { + Error( 0, "IDirectSound_CreateSoundBuffer : Unable to create secondary sound buffer" ); + return FALSE; + } - // get the buffer capabilities + /* get the buffer capabilities */ - memset( &ao_directx->dsbcaps, 0, sizeof( DSBCAPS ) ); - ao_directx->dsbcaps.dwSize = sizeof( DSBCAPS ); + memset( &ao_directx->dsbcaps, 0, sizeof( DSBCAPS ) ); + ao_directx->dsbcaps.dwSize = sizeof( DSBCAPS ); - if( IDirectSound_GetCaps( ao_directx->dsbuffer, &ao_directx->dsbcaps ) != DS_OK ) - { - Error( 0, "IDirectSound_GetCaps : Unable to get secondary sound buffer capabilities" ); - return FALSE; - } - - // create left side notification ( non-signaled ) + if( IDirectSound_GetCaps( ao_directx->dsbuffer, &ao_directx->dsbcaps ) != DS_OK ) + { + Error( 0, "IDirectSound_GetCaps : Unable to get secondary sound buffer capabilities" ); + return FALSE; + } - ao_directx->notify_events[ 0 ].hEventNotify = CreateEvent( NULL, FALSE, FALSE, NULL ); + /* create left side notification ( non-signaled ) */ - // create right side notification ( signaled ) + ao_directx->notify_events[ 0 ].hEventNotify = CreateEvent( NULL, FALSE, FALSE, NULL ); - ao_directx->notify_events[ 1 ].hEventNotify = CreateEvent( NULL, FALSE, FALSE, NULL ); + /* create right side notification ( signaled ) */ - if( !ao_directx->notify_events[ 0 ].hEventNotify || !ao_directx->notify_events[ 1 ].hEventNotify ) - { - Error( 0, "CreateEvent : Unable to create sound notification events" ); - return FALSE; - } + ao_directx->notify_events[ 1 ].hEventNotify = CreateEvent( NULL, FALSE, FALSE, NULL ); - // get the direct sound notification interface + if( !ao_directx->notify_events[ 0 ].hEventNotify || !ao_directx->notify_events[ 1 ].hEventNotify ) + { + Error( 0, "CreateEvent : Unable to create sound notification events" ); + return FALSE; + } - if( IDirectSoundBuffer_QueryInterface( ao_directx->dsbuffer, - &IID_IDirectSoundNotify, - (LPVOID *)&ao_directx->notify ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_QueryInterface : Unable to get notification interface" ); - return FALSE; - } + /* get the direct sound notification interface */ - // set notification events + if( IDirectSoundBuffer_QueryInterface( ao_directx->dsbuffer, + &IID_IDirectSoundNotify, + (LPVOID *)&ao_directx->notify ) != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_QueryInterface : Unable to get notification interface" ); + return FALSE; + } - ao_directx->notify_events[ 0 ].dwOffset = 0; - ao_directx->notify_events[ 1 ].dwOffset = ao_directx->buffer_size / 2; + /* set notification events */ - if( IDirectSoundNotify_SetNotificationPositions( ao_directx->notify, 2, - ao_directx->notify_events ) != DS_OK ) - { - Error( 0, "IDirectSoundNotify_SetNotificationPositions : Unable to set notification positions" ); - return FALSE; - } + ao_directx->notify_events[ 0 ].dwOffset = 0; + ao_directx->notify_events[ 1 ].dwOffset = ao_directx->buffer_size / 2; - // DEBUG : set sound buffer volume + if( IDirectSoundNotify_SetNotificationPositions( ao_directx->notify, 2, + ao_directx->notify_events ) != DS_OK ) + { + Error( 0, "IDirectSoundNotify_SetNotificationPositions : Unable to set notification positions" ); + return FALSE; + } - if( IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MAX ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_SetVolume : Unable to set sound buffer volume" ); - return FALSE; - } + /* DEBUG : set sound buffer volume */ - // initialize our sound buffer + if( IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MAX ) != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_SetVolume : Unable to set sound buffer volume" ); + return FALSE; + } - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); - FillSoundBuffer( ao_directx, DSBUFF_INIT, 0 ); + /* initialize our sound buffer */ - return TRUE; + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); + FillSoundBuffer( ao_directx, DSBUFF_INIT, 0 ); -#ifdef LOG - printf("audio_directx_out: CreateSoundBuffer() Exit\n"); -#endif + return TRUE; + lprintf("CreateSoundBuffer() Exit\n"); } -// Destroy all direct sound buffer allocated -// resources. +/* Destroy all direct sound buffer allocated + * resources. */ void DestroySoundBuffer( ao_directx_t * ao_directx ) { -#ifdef LOG - printf("audio_directx_out: DestroySoundBuffer(%08x) Enter\n", (unsigned long)ao_directx); -#endif + lprintf("DestroySoundBuffer(%08x) Enter\n", (unsigned long)ao_directx); - // stop our buffer and zero it out + /* stop our buffer and zero it out */ - if( ao_directx->dsbuffer ) - { - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); - IDirectSoundBuffer_Stop( ao_directx->dsbuffer ); - FillSoundBuffer( ao_directx, DSBUFF_INIT, 0 ); - } - - // release our notification events + if( ao_directx->dsbuffer ) + { + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); + IDirectSoundBuffer_Stop( ao_directx->dsbuffer ); + FillSoundBuffer( ao_directx, DSBUFF_INIT, 0 ); + } - if( ao_directx->notify_events[ 0 ].hEventNotify ) - { - CloseHandle( ao_directx->notify_events[ 0 ].hEventNotify ); - ao_directx->notify_events[ 0 ].hEventNotify = 0; - } + /* release our notification events */ - if( ao_directx->notify_events[ 1 ].hEventNotify ) - { - CloseHandle( ao_directx->notify_events[ 1 ].hEventNotify ); - ao_directx->notify_events[ 1 ].hEventNotify = 0; - } + if( ao_directx->notify_events[ 0 ].hEventNotify ) + { + CloseHandle( ao_directx->notify_events[ 0 ].hEventNotify ); + ao_directx->notify_events[ 0 ].hEventNotify = 0; + } - // release our buffer notification interface + if( ao_directx->notify_events[ 1 ].hEventNotify ) + { + CloseHandle( ao_directx->notify_events[ 1 ].hEventNotify ); + ao_directx->notify_events[ 1 ].hEventNotify = 0; + } - if( ao_directx->notify ) - { - IDirectSoundNotify_Release( ao_directx->notify ); - ao_directx->notify = 0; - } + /* release our buffer notification interface */ - // release our direct sound buffer + if( ao_directx->notify ) + { + IDirectSoundNotify_Release( ao_directx->notify ); + ao_directx->notify = 0; + } - if( ao_directx->dsbuffer ) - { - IDirectSoundBuffer_Release( ao_directx->dsbuffer ); - ao_directx->dsbuffer = 0; - } + /* release our direct sound buffer */ -#ifdef LOG - printf("audio_directx_out: DestroySoundBuffer() Exit\n"); -#endif + if( ao_directx->dsbuffer ) + { + IDirectSoundBuffer_Release( ao_directx->dsbuffer ); + ao_directx->dsbuffer = 0; + } + lprintf("DestroySoundBuffer() Exit\n"); } -// Used to fill our looping sound buffer -// with data. +/* Used to fill our looping sound buffer + * with data. */ uint32_t FillSoundBuffer( ao_directx_t * ao_directx, int code, unsigned char * samples ) { - uint8_t * buff_pointer; // pointer inside circular buffer - uint32_t buff_length; // bytes locked by pointer - uint32_t half_size; // half our sound buffer size - uint32_t result; // error result + uint8_t * buff_pointer; /* pointer inside circular buffer */ + uint32_t buff_length; /* bytes locked by pointer */ + uint32_t half_size; /* half our sound buffer size */ + uint32_t result; /* error result */ #ifdef LOG - if ((void*)samples != (void*)0) - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); - else - printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + if ((void*)samples != (void*)0) + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); + else + printf("audio_directx_out: FillSoundBuffer(%08x, %d, Null) Enter\n", (unsigned long)ao_directx, code); #endif - half_size = ao_directx->buffer_size / 2; + half_size = ao_directx->buffer_size / 2; - if( code == DSBUFF_INIT ) - { -#ifdef LOG - printf("audio_directx_out: FillSoundBuffer: DSBUFF_INIT\n"); -#endif + if( code == DSBUFF_INIT ) + { + lprintf("FillSoundBuffer: DSBUFF_INIT\n"); - // set our new status code + /* set our new status code */ - ao_directx->write_status = DSBUFF_RIGHT; + ao_directx->write_status = DSBUFF_RIGHT; - // lock our sound buffer for write access + /* lock our sound buffer for write access */ - result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, - 0, 0, - &buff_pointer, &buff_length, - 0, 0, DSBLOCK_ENTIREBUFFER ); - if( result != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); - return 0; - } + result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, + 0, 0, + &buff_pointer, &buff_length, + 0, 0, DSBLOCK_ENTIREBUFFER ); + if( result != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); + return 0; + } - // clear our entire sound buffer + /* clear our entire sound buffer */ - memset( buff_pointer, 0, buff_length ); + memset( buff_pointer, 0, buff_length ); - // unlock our sound buffer + /* unlock our sound buffer */ - if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, - buff_pointer, buff_length, - 0, 0 ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); - return 0; - } + if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, + buff_pointer, buff_length, + 0, 0 ) != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); + return 0; + } - // start the buffer playing + /* start the buffer playing */ - if( IDirectSoundBuffer_Play( ao_directx->dsbuffer, 0, 0, DSBPLAY_LOOPING ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Play : could not play sound buffer" ); - return 0 ; - } - else - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - } - else if( code == DSBUFF_LEFT ) + if( IDirectSoundBuffer_Play( ao_directx->dsbuffer, 0, 0, DSBPLAY_LOOPING ) != DS_OK ) { -#ifdef LOG - printf("audio_directx_out: FillSoundBuffer: DSBUFF_LEFT\n"); -#endif - // set our new status code - - ao_directx->write_status = DSBUFF_RIGHT; + Error( 0, "IDirectSoundBuffer_Play : could not play sound buffer" ); + return 0 ; + } + else + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); + } + else if( code == DSBUFF_LEFT ) + { + lprintf("FillSoundBuffer: DSBUFF_LEFT\n"); + /* set our new status code */ - // lock our sound buffer for write access + ao_directx->write_status = DSBUFF_RIGHT; - result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, - 0, half_size, - &buff_pointer, &buff_length, - 0, 0, 0 ); - if( result != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); - return 0; - } + /* lock our sound buffer for write access */ - // write data to our sound buffer + result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, + 0, half_size, + &buff_pointer, &buff_length, + 0, 0, 0 ); + if( result != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); + return 0; + } - memcpy( buff_pointer, samples, buff_length ); + /* write data to our sound buffer */ - // unlock our sound buffer + memcpy( buff_pointer, samples, buff_length ); - if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, - buff_pointer, buff_length, - 0, 0 ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); - return 0; - } + /* unlock our sound buffer */ - } - else if( code == DSBUFF_RIGHT ) + if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, + buff_pointer, buff_length, + 0, 0 ) != DS_OK ) { -#ifdef LOG - printf("audio_directx_out: FillSoundBuffer: DSBUFF_RIGHT\n"); -#endif - // set our new status code + Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); + return 0; + } + + } + else if( code == DSBUFF_RIGHT ) + { + lprintf("FillSoundBuffer: DSBUFF_RIGHT\n"); + /* set our new status code */ - ao_directx->write_status = DSBUFF_LEFT; + ao_directx->write_status = DSBUFF_LEFT; - // lock our sound buffer for write access + /* lock our sound buffer for write access */ - result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, - half_size, half_size, - &buff_pointer, &buff_length, - 0, 0, 0 ); - if( result != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); - return 0; - } + result = IDirectSoundBuffer_Lock( ao_directx->dsbuffer, + half_size, half_size, + &buff_pointer, &buff_length, + 0, 0, 0 ); + if( result != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_Lock : could not lock sound buffer" ); + return 0; + } - // write data to our sound buffer + /* write data to our sound buffer */ - memcpy( buff_pointer, samples, buff_length ); + memcpy( buff_pointer, samples, buff_length ); - // unlock our sound buffer + /* unlock our sound buffer */ - if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, - buff_pointer, buff_length, - 0, 0 ) != DS_OK ) - { - Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); - return 0; - } + if( IDirectSoundBuffer_Unlock( ao_directx->dsbuffer, + buff_pointer, buff_length, + 0, 0 ) != DS_OK ) + { + Error( 0, "IDirectSoundBuffer_Unlock : could not unlock sound buffer" ); + return 0; } + } -#ifdef LOG - printf("audio_directx_out: FillSoundBuffer() Exit\n"); -#endif + lprintf("FillSoundBuffer() Exit\n"); - return buff_length; + return buff_length; } -// ----------------------------------------- -// -// BEGIN : Xine driver audio output plugin -// handlers. -// -// ----------------------------------------- +/* ----------------------------------------- + * + * BEGIN : Xine driver audio output plugin + * handlers. + * + * ----------------------------------------- */ static int ao_directx_control(ao_driver_t *this_gen, int cmd, ...) { - - ao_directx_t * ao_directx = ( ao_directx_t * ) this_gen; + ao_directx_t *ao_directx = ( ao_directx_t * ) this_gen; switch (cmd) - { + { - case AO_CTRL_PLAY_PAUSE: - break; + case AO_CTRL_PLAY_PAUSE: + break; - case AO_CTRL_PLAY_RESUME: - break; + case AO_CTRL_PLAY_RESUME: + break; - case AO_CTRL_FLUSH_BUFFERS: - break; - } + case AO_CTRL_FLUSH_BUFFERS: + break; + } return 0; } - static int ao_directx_open( ao_driver_t * ao_driver, uint32_t bits, uint32_t rate, int mode ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; -#ifdef LOG - printf("audio_directx_out: ao_directx_open(%08x, %d, %d, %d) Enter\n", (unsigned long)ao_directx, bits, rate, mode); -#endif - // store input rate and bits + lprintf("ao_directx_open(%08x, %d, %d, %d) Enter\n", (unsigned long)ao_directx, bits, rate, mode); + + /* store input rate and bits */ - ao_directx->bits = bits; - ao_directx->rate = rate; + ao_directx->bits = bits; + ao_directx->rate = rate; - // store channel count + /* store channel count */ - switch( mode ) - { - case AO_CAP_MODE_MONO: - ao_directx->chnn = 1; - printf( "ao_directx : opened in AO_CAP_MODE_MONO mode\n" ); - break; - - case AO_CAP_MODE_STEREO: - ao_directx->chnn = 2; - printf( "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" ); - break; - - case AO_CAP_MODE_4CHANNEL: - ao_directx->chnn = 4; - printf( "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" ); - break; - - case AO_CAP_MODE_5CHANNEL: - ao_directx->chnn = 5; - printf( "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" ); - break; - - case AO_CAP_MODE_5_1CHANNEL: - ao_directx->chnn = 6; - printf( "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" ); - break; - - case AO_CAP_MODE_A52: - case AO_CAP_MODE_AC5: - return 0; - } + switch( mode ) + { + case AO_CAP_MODE_MONO: + ao_directx->chnn = 1; + printf( "ao_directx : opened in AO_CAP_MODE_MONO mode\n" ); + break; + + case AO_CAP_MODE_STEREO: + ao_directx->chnn = 2; + printf( "ao_directx : opened in AO_CAP_MODE_STEREO mode\n" ); + break; + + case AO_CAP_MODE_4CHANNEL: + ao_directx->chnn = 4; + printf( "ao_directx : opened in AO_CAP_MODE_4CHANNEL mode\n" ); + break; + + case AO_CAP_MODE_5CHANNEL: + ao_directx->chnn = 5; + printf( "ao_directx : opened in AO_CAP_MODE_5CHANNEL mode\n" ); + break; + + case AO_CAP_MODE_5_1CHANNEL: + ao_directx->chnn = 6; + printf( "ao_directx : opened in AO_CAP_MODE_5_1CHANNEL mode\n" ); + break; + + case AO_CAP_MODE_A52: + case AO_CAP_MODE_AC5: + return 0; + } - CreateSoundBuffer( ao_directx ); + CreateSoundBuffer( ao_directx ); -#ifdef LOG - printf("audio_directx_out: ao_directx_open() Exit! Returning ao_directx->rate=%d\n", ao_directx->rate); -#endif + lprintf("ao_directx_open() Exit! Returning ao_directx->rate=%d\n", ao_directx->rate); - return ao_directx->rate; + return ao_directx->rate; } static int ao_directx_num_channels( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; - return ao_directx->chnn; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + return ao_directx->chnn; } static int ao_directx_bytes_per_frame( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; - return ao_directx->frsz; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + return ao_directx->frsz; } static int ao_directx_get_gap_tolerance( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; - return 5000; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + return 5000; } static int ao_directx_delay( ao_driver_t * ao_driver ) { - DWORD current_read; - DWORD bytes_left; - DWORD frames_left; + DWORD current_read; + DWORD bytes_left; + DWORD frames_left; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + lprintf("ao_directx_delay(%08x) Enter\n", (unsigned long)ao_directx); -#ifdef LOG - printf("audio_directx_out: ao_directx_delay(%08x) Enter\n", (unsigned long)ao_directx); -#endif + IDirectSoundBuffer_GetCurrentPosition( ao_directx->dsbuffer, ¤t_read, 0 ); - IDirectSoundBuffer_GetCurrentPosition( ao_directx->dsbuffer, ¤t_read, 0 ); + if( ao_directx->write_pos > current_read ) + bytes_left = ( ao_directx->write_pos - current_read ); + else + bytes_left = ( ao_directx->write_pos + ao_directx->buffer_size - current_read ); - if( ao_directx->write_pos > current_read ) - bytes_left = ( ao_directx->write_pos - current_read ); - else - bytes_left = ( ao_directx->write_pos + ao_directx->buffer_size - current_read ); + frames_left = ( ao_directx->prebuff_size + bytes_left ) / ao_directx->frsz; - frames_left = ( ao_directx->prebuff_size + bytes_left ) / ao_directx->frsz; + lprintf("ao_directx_delay() Exit! Returning frames_left=%d\n", frames_left); -#ifdef LOG - printf("audio_directx_out: ao_directx_delay() Exit! Returning frames_left=%d\n", frames_left); -#endif - - return frames_left; + return frames_left; } static int ao_directx_write( ao_driver_t * ao_driver, int16_t * frame_buffer, uint32_t num_frames ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + uint32_t frame_bytes; /* how many bytes to lock */ + uint32_t wrote; /* number of bytes written */ + uint32_t half_size; /* half our sound buffer size */ - uint32_t frame_bytes; // how many bytes to lock - uint32_t wrote; // number of bytes written - uint32_t half_size; // half our sound buffer size + lprintf("ao_directx_write(%08x, %08x, %d) Enter\n", + (unsigned long)ao_directx, (unsigned long)frame_buffer, num_frames); -#ifdef LOG - printf("audio_directx_out: ao_directx_write(%08x, %08x, %d) Enter\n", (unsigned long)ao_directx, (unsigned long)frame_buffer, num_frames); -#endif + /* zero write counter */ - // zero write counter + wrote = 0; - wrote = 0; + /* calculate how many bytes in frame_buffer */ - // calculate how many bytes in frame_buffer + frame_bytes = num_frames * ao_directx->frsz; - frame_bytes = num_frames * ao_directx->frsz; + /* calculate half our buffer size */ - // calculate half our buffer size + half_size = ao_directx->buffer_size / 2; - half_size = ao_directx->buffer_size / 2; + /* fill audio prebuff */ - // fill audio prebuff + memcpy( ao_directx->prebuff + ao_directx->prebuff_size, frame_buffer, frame_bytes ); + ao_directx->prebuff_size = ao_directx->prebuff_size + frame_bytes; - memcpy( ao_directx->prebuff + ao_directx->prebuff_size, frame_buffer, frame_bytes ); - ao_directx->prebuff_size = ao_directx->prebuff_size + frame_bytes; - - // check to see if we have enough in prebuff to - // fill half of our sound buffer + /* check to see if we have enough in prebuff to + * fill half of our sound buffer */ + while( ao_directx->prebuff_size >= half_size ) + { + /* write to our sound buffer */ - while( ao_directx->prebuff_size >= half_size ) + if( ao_directx->write_status == DSBUFF_LEFT ) { - // write to our sound buffer - - if( ao_directx->write_status == DSBUFF_LEFT ) - { - // wait for our read pointer to reach the right half - // of our sound buffer, we only want to write to the - // left side + /* wait for our read pointer to reach the right half + * of our sound buffer, we only want to write to the + * left side */ - WaitForSingleObject( ao_directx->notify_events[ 1 ].hEventNotify, INFINITE ); + WaitForSingleObject( ao_directx->notify_events[ 1 ].hEventNotify, INFINITE ); - // fill left half of our buffer + /* fill left half of our buffer */ - wrote = FillSoundBuffer( ao_directx, DSBUFF_LEFT, ao_directx->prebuff ); - } - else if( ao_directx->write_status == DSBUFF_RIGHT ) - { - // wait for our read pointer to reach the left half, - // of our sound buffer, we only want to write to the - // right side + wrote = FillSoundBuffer( ao_directx, DSBUFF_LEFT, ao_directx->prebuff ); + } + else if( ao_directx->write_status == DSBUFF_RIGHT ) + { + /* wait for our read pointer to reach the left half, + * of our sound buffer, we only want to write to the + * right side */ - WaitForSingleObject( ao_directx->notify_events[ 0 ].hEventNotify, INFINITE ); + WaitForSingleObject( ao_directx->notify_events[ 0 ].hEventNotify, INFINITE ); - // fill right half of our buffer + /* fill right half of our buffer */ - wrote = FillSoundBuffer( ao_directx, DSBUFF_RIGHT, ao_directx->prebuff ); - } + wrote = FillSoundBuffer( ao_directx, DSBUFF_RIGHT, ao_directx->prebuff ); + } - // calc bytes written and store position for next write + /* calc bytes written and store position for next write */ - ao_directx->write_pos = ( ao_directx->write_pos + wrote ) % ao_directx->buffer_size; + ao_directx->write_pos = ( ao_directx->write_pos + wrote ) % ao_directx->buffer_size; - // copy remaining contents of prebuff and recalc size + /* copy remaining contents of prebuff and recalc size */ - memcpy( ao_directx->prebuff, ao_directx->prebuff + wrote, ao_directx->prebuff_size - wrote ); - ao_directx->prebuff_size = ao_directx->prebuff_size - wrote; - } + memcpy( ao_directx->prebuff, ao_directx->prebuff + wrote, ao_directx->prebuff_size - wrote ); + ao_directx->prebuff_size = ao_directx->prebuff_size - wrote; + } -#ifdef LOG - printf("audio_directx_out: ao_directx_write() Exit! Returning num_frmaes=%d\n", num_frames); -#endif + lprintf("ao_directx_write() Exit! Returning num_frmaes=%d\n", num_frames); - return num_frames; + return num_frames; } static void ao_directx_close( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; -#ifdef LOG - printf("audio_directx_out: ao_directx_close(%08x) Enter\n", (unsigned long)ao_directx); -#endif + lprintf("ao_directx_close(%08x) Enter\n", (unsigned long)ao_directx); - // release any existing sound buffer - // related resources + /* release any existing sound buffer + * related resources */ - DestroySoundBuffer( ao_directx ); - -#ifdef LOG - printf("audio_directx_out: ao_directx_close() Exit!\n"); -#endif + DestroySoundBuffer( ao_directx ); + lprintf("ao_directx_close() Exit!\n"); } static uint32_t ao_directx_get_capabilities( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; - return AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + return AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | AO_CAP_PCM_VOL | AO_CAP_MUTE_VOL; } static void ao_directx_exit( ao_driver_t * ao_driver ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; -#ifdef LOG - printf("audio_directx_out: ao_directx_exit(%08x) Enter\n", (unsigned long)ao_directx); -#endif - - // release any existing sound buffer - // related resources + lprintf("ao_directx_exit(%08x) Enter\n", (unsigned long)ao_directx); - DestroySoundBuffer( ao_directx ); + /* release any existing sound buffer + * related resources */ - // release any existing direct sound - // related resources + DestroySoundBuffer( ao_directx ); - DestroyDirectSound( ao_directx ); + /* release any existing direct sound + * related resources */ - // free our driver + DestroyDirectSound( ao_directx ); - free( ao_directx ); + /* free our driver */ -#ifdef LOG - printf("audio_directx_out: ao_directx_exit() Exit!\n"); -#endif + free( ao_directx ); + lprintf("ao_directx_exit() Exit!\n"); } static int ao_directx_get_property( ao_driver_t * ao_driver, int property ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; - return 0; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; + return 0; } static int ao_directx_set_property( ao_driver_t * ao_driver, int property, int value ) { - ao_directx_t * ao_directx = ( ao_directx_t * ) ao_driver; + ao_directx_t *ao_directx = ( ao_directx_t * ) ao_driver; -#ifdef LOG - printf("audio_directx_out: ao_directx_set_property(%08x, %d, %d) Enter\n", (unsigned long)ao_directx, property, value); -#endif + lprintf("ao_directx_set_property(%08x, %d, %d) Enter\n", + (unsigned long)ao_directx, property, value); - switch( property ) - { - case AO_PROP_PCM_VOL: - case AO_PROP_MIXER_VOL: -#ifdef LOG - printf("audio_directx_out: ao_directx_set_property: AO_PROP_PCM_VOL|AO_PROP_MIXER_VOL\n"); -#endif + switch( property ) + { + case AO_PROP_PCM_VOL: + case AO_PROP_MIXER_VOL: + lprintf("ao_directx_set_property: AO_PROP_PCM_VOL|AO_PROP_MIXER_VOL\n"); - ao_directx->volume = value * ( DSBVOLUME_MIN / 100 / 3); + ao_directx->volume = value * ( DSBVOLUME_MIN / 100 / 3); - if( !ao_directx->mute && ao_directx->dsbuffer ) - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); + if( !ao_directx->mute && ao_directx->dsbuffer ) + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - printf( "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); + printf( "ao_directx : volume set to %d - directX volume = %d\n", value, ao_directx->volume); - return value; + return value; - break; + break; - case AO_PROP_MUTE_VOL: + case AO_PROP_MUTE_VOL: + lprintf("ao_directx_set_property: AO_PROP_MUTE_VOL\n"); -#ifdef LOG - printf("audio_directx_out: ao_directx_set_property: AO_PROP_MUTE_VOL\n"); -#endif + ao_directx->mute = value; - ao_directx->mute = value; + if( !ao_directx->mute && ao_directx->dsbuffer ) + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - if( !ao_directx->mute && ao_directx->dsbuffer ) - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, ao_directx->volume ); - - if( ao_directx->mute && ao_directx->dsbuffer ) - IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); + if( ao_directx->mute && ao_directx->dsbuffer ) + IDirectSoundBuffer_SetVolume( ao_directx->dsbuffer, DSBVOLUME_MIN ); - printf( "ao_directx : mute toggled" ); + printf( "ao_directx : mute toggled" ); - return value; + return value; - break; - } + break; + } -#ifdef LOG - printf("audio_directx_out: ao_directx_set_property() Exit! Returning ~value=%d\n", ~value); -#endif + lprintf("ao_directx_set_property() Exit! Returning ~value=%d\n", ~value); - return ~value; + return ~value; } static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *data) { - ao_directx_t * ao_directx = ( ao_directx_t * ) malloc( sizeof( ao_directx_t ) ); - memset( ao_directx, 0, sizeof( ao_directx_t ) ); + ao_directx_t *ao_directx = ( ao_directx_t * ) malloc( sizeof( ao_directx_t ) ); -#ifdef LOG - printf("audio_directx_out: open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data); - printf("audio_directx_out: open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx); -#endif + memset( ao_directx, 0, sizeof( ao_directx_t ) ); - ao_directx->ao_driver.get_capabilities = ao_directx_get_capabilities; - ao_directx->ao_driver.get_property = ao_directx_get_property; - ao_directx->ao_driver.set_property = ao_directx_set_property; - ao_directx->ao_driver.open = ao_directx_open; - ao_directx->ao_driver.num_channels = ao_directx_num_channels; - ao_directx->ao_driver.bytes_per_frame = ao_directx_bytes_per_frame; - ao_directx->ao_driver.delay = ao_directx_delay; - ao_directx->ao_driver.write = ao_directx_write; - ao_directx->ao_driver.close = ao_directx_close; - ao_directx->ao_driver.exit = ao_directx_exit; - ao_directx->ao_driver.get_gap_tolerance = ao_directx_get_gap_tolerance; - ao_directx->ao_driver.control = ao_directx_control; - - CreateDirectSound( ao_directx ); + lprintf("open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data); + lprintf("open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx); -#ifdef LOG - printf("audio_directx_out: open_plugin() Exit! Returning ao_directx=%08x\n", (unsigned long)ao_directx); -#endif + ao_directx->ao_driver.get_capabilities = ao_directx_get_capabilities; + ao_directx->ao_driver.get_property = ao_directx_get_property; + ao_directx->ao_driver.set_property = ao_directx_set_property; + ao_directx->ao_driver.open = ao_directx_open; + ao_directx->ao_driver.num_channels = ao_directx_num_channels; + ao_directx->ao_driver.bytes_per_frame = ao_directx_bytes_per_frame; + ao_directx->ao_driver.delay = ao_directx_delay; + ao_directx->ao_driver.write = ao_directx_write; + ao_directx->ao_driver.close = ao_directx_close; + ao_directx->ao_driver.exit = ao_directx_exit; + ao_directx->ao_driver.get_gap_tolerance = ao_directx_get_gap_tolerance; + ao_directx->ao_driver.control = ao_directx_control; + + CreateDirectSound( ao_directx ); + + lprintf("open_plugin() Exit! Returning ao_directx=%08x\n", (unsigned long)ao_directx); - return ( ao_driver_t * ) ao_directx; + return ( ao_driver_t * ) ao_directx; } static char* get_identifier (video_driver_class_t *this_gen) { @@ -885,24 +806,21 @@ static char* get_description (audio_driver_class_t *this_gen) { } static void dispose_class (audio_driver_class_t *this_gen) { + audiox_class_t *audiox = (audiox_class_t *) this_gen; - audiox_class_t *audiox = (audiox_class_t *) this_gen; free (audiox); } static void *init_class (xine_t *xine, void *data) { + audiox_class_t *audiox; + char* device_name; - audiox_class_t *audiox; - char* device_name; + lprintf("init_class() Enter\n"); -#ifdef LOG - printf("audio_directx_out: init_class() Enter\n"); -#endif - - device_name = xine->config->register_string(xine->config, - "audio.directx_device", "/dev/audio_directx", - _("xine audio output plugin for win32 using directx"), - NULL, 10, NULL, NULL); + device_name = xine->config->register_string(xine->config, + "audio.directx_device", "/dev/audio_directx", + _("xine audio output plugin for win32 using directx"), + NULL, 10, NULL, NULL); /* * from this point on, nothing should go wrong anymore @@ -915,12 +833,10 @@ static void *init_class (xine_t *xine, void *data) { audiox->driver_class.get_description = get_description; audiox->driver_class.dispose = dispose_class; - audiox->config = xine->config; - audiox->device_name = device_name; + audiox->config = xine->config; + audiox->device_name = device_name; -#ifdef LOG - printf("audio_directx_out: init_class() Exit! Returning audiox=%08x\n", audiox); -#endif + lprintf("init_class() Exit! Returning audiox=%08x\n", audiox); return audiox; } @@ -937,4 +853,3 @@ plugin_info_t xine_plugin_info[] = { { PLUGIN_AUDIO_OUT, AO_DIRECTX_IFACE_VERSION, "directx", XINE_VERSION_CODE, &ao_info_directx, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; - diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 373432b7d..6f4df2f05 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_oss_out.c,v 1.92 2003/10/19 13:40:32 tmattern Exp $ + * $Id: audio_oss_out.c,v 1.93 2003/11/26 19:43:26 f1rmb Exp $ * * 20-8-2001 First implementation of Audio sync and Audio driver separation. * Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk @@ -65,6 +65,12 @@ #include #include +#define LOG_MODULE "audio_oss_out" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -72,10 +78,6 @@ #include -/* -#define LOG -*/ - #ifndef AFMT_S16_NE # if defined(sparc) || defined(__sparc__) || defined(PPC) /* Big endian machines */ @@ -412,9 +414,7 @@ static int ao_oss_delay(ao_driver_t *this_gen) { perror ("audio_oss_out: SNDCTL_DSP_GETOPTR failed:"); } -#ifdef LOG - printf ("audio_oss_out: %d bytes output\n", info.bytes); -#endif + lprintf ("%d bytes output\n", info.bytes); if (this->bytes_in_buffer < info.bytes) { this->bytes_in_buffer -= this->last_getoptr; /* GETOPTR wrapped */ @@ -434,9 +434,9 @@ static int ao_oss_delay(ao_driver_t *this_gen) { } if (bytes_left<0) bytes_left = 0; -#ifdef LOG - printf ("audio_oss_out: %d bytes left\n", bytes_left); -#endif + + lprintf ("%d bytes left\n", bytes_left); + break; } @@ -454,9 +454,7 @@ static int ao_oss_write(ao_driver_t *this_gen, oss_driver_t *this = (oss_driver_t *) this_gen; int n; -#ifdef LOG - printf ("audio_oss_out: ao_oss_write %d frames\n", num_frames); -#endif + lprintf ("ao_oss_write %d frames\n", num_frames); if (this->sync_method == OSS_SYNC_SOFTSYNC) { int simulated_bytes_in_buffer, frames ; @@ -482,9 +480,7 @@ static int ao_oss_write(ao_driver_t *this_gen, n = write(this->audio_fd, frame_buffer, num_frames * this->bytes_per_frame); -#ifdef LOG - printf ("audio_oss_out: ao_oss_write done\n"); -#endif + lprintf ("ao_oss_write done\n"); return (n >= 0 ? n : 0); } @@ -649,9 +645,8 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { switch (cmd) { case AO_CTRL_PLAY_PAUSE: -#ifdef LOG - printf ("audio_oss_out: AO_CTRL_PLAY_PAUSE\n"); -#endif + lprintf ("AO_CTRL_PLAY_PAUSE\n"); + if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); @@ -663,15 +658,11 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { break; case AO_CTRL_PLAY_RESUME: -#ifdef LOG - printf ("audio_oss_out: AO_CTRL_PLAY_RESUME\n"); -#endif + lprintf ("AO_CTRL_PLAY_RESUME\n"); break; case AO_CTRL_FLUSH_BUFFERS: -#ifdef LOG - printf ("audio_oss_out: AO_CTRL_FLUSH_BUFFERS\n"); -#endif + lprintf ("AO_CTRL_FLUSH_BUFFERS\n"); if (this->sync_method != OSS_SYNC_SOFTSYNC) ioctl(this->audio_fd, SNDCTL_DSP_RESET, NULL); @@ -679,9 +670,9 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { ao_oss_close(this_gen); ao_oss_open(this_gen, this->bits_per_sample, this->input_sample_rate, this->mode); } -#ifdef LOG - printf ("audio_oss_out: AO_CTRL_FLUSH_BUFFERS done\n"); -#endif + + lprintf ("AO_CTRL_FLUSH_BUFFERS done\n"); + break; } diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 9bd2941ca..c936d1065 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -23,7 +23,7 @@ * For more information on the 4xm file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_4xm.c,v 1.11 2003/11/16 23:33:42 f1rmb Exp $ + * $Id: demux_4xm.c,v 1.12 2003/11/26 19:43:27 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,10 +36,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_4xm" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 7a7791825..76a24e4e4 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_asf.c,v 1.142 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_asf.c,v 1.143 2003/11/26 19:43:27 f1rmb Exp $ * * demultiplexer for asf streams * @@ -39,6 +39,12 @@ #include #include +#define LOG_MODULE "demux_asf" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "demux.h" #include "xineutils.h" @@ -46,10 +52,6 @@ #include "asfheader.h" #include "xmlparser.h" -/* -#define LOG -*/ - #define CODEC_TYPE_AUDIO 0 #define CODEC_TYPE_VIDEO 1 #define CODEC_TYPE_CONTROL 2 @@ -247,9 +249,7 @@ static int get_guid_id (demux_asf_t *this, GUID g) { for (i = 1; i < GUID_END; i++) { if (!memcmp(&g, &guids[i].guid, sizeof(GUID))) { -#ifdef LOG - printf ("demux_asf: GUID: %s\n", guids[i].name); -#endif + lprintf ("GUID: %s\n", guids[i].name); return i; } } @@ -306,9 +306,7 @@ static void asf_send_audio_header (demux_asf_t *this, int stream) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, wavex->wFormatTag); -#ifdef LOG - printf ("demux_asf: wavex header is %d bytes long\n", this->wavex_size); -#endif + lprintf ("wavex header is %d bytes long\n", this->wavex_size); buf->size = this->wavex_size; buf->type = this->streams[stream].buf_type; @@ -489,9 +487,8 @@ static int asf_read_header (demux_asf_t *this) { } else this->streams[this->num_streams].defrag = 0; -#ifdef LOG - printf ("demux_asf: found an audio stream id=%d \n", stream_id); -#endif + lprintf ("found an audio stream id=%d \n", stream_id); + this->num_audio_streams++; } else if (type == CODEC_TYPE_VIDEO) { @@ -525,10 +522,9 @@ static int asf_read_header (demux_asf_t *this) { } else printf ("demux_asf: invalid bih_size received (%d), v_stream ignored.\n", i ); -#ifdef LOG - printf ("demux_asf: found a video stream id=%d, buf_type=%08x \n", - stream_id, this->streams[this->num_streams].buf_type); -#endif + lprintf ("found a video stream id=%d, buf_type=%08x \n", + stream_id, this->streams[this->num_streams].buf_type); + this->num_video_streams++; } else if (type == CODEC_TYPE_CONTROL) { @@ -539,9 +535,8 @@ static int asf_read_header (demux_asf_t *this) { while (get_byte(this) != 0) {while (get_byte(this) != 0) {}} while (get_byte(this) != 0) {while (get_byte(this) != 0) {}} */ -#ifdef LOG - printf ("demux_asf: found a control stream id=%d \n", stream_id); -#endif + lprintf ("found a control stream id=%d \n", stream_id); + } this->num_streams++; @@ -551,9 +546,8 @@ static int asf_read_header (demux_asf_t *this) { break; case GUID_ASF_DATA: -#ifdef LOG - printf ("demux_asf: found data\n"); -#endif + lprintf ("found data\n"); + goto headers_ok; break; case GUID_ASF_CONTENT_DESCRIPTION: @@ -582,9 +576,7 @@ static int asf_read_header (demux_asf_t *this) { uint16_t streams, stream_id; uint16_t i; -#ifdef LOG - printf("demux_asf: GUID stream group\n"); -#endif + lprintf("GUID stream group\n"); streams = get_le16(this); for(i = 0; i < streams; i++) { @@ -741,9 +733,7 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e if (pts && (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD)) ) { -#ifdef LOG - printf ("demux_asf: sending newpts %lld (video = %d diff = %lld)\n", pts, video, diff); -#endif + lprintf ("sending newpts %lld (video = %d diff = %lld)\n", pts, video, diff); if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); @@ -769,14 +759,12 @@ static void check_newpts (demux_asf_t *this, int64_t pts, int video, int frame_e diff = pts - this->last_frame_pts; if ( (diff>0) && (diff < MAX_FRAME_DUR) ) { -#ifdef LOG - printf ("demux_asf: last_frame_pts = %8lld, diff=%8lld\n", + lprintf ("last_frame_pts = %8lld, diff=%8lld\n", this->last_frame_pts, diff); -#endif + this->frame_duration = (15*this->frame_duration + diff) / 16; -#ifdef LOG - printf ("demux_asf: frame_duration is %d\n", this->frame_duration); -#endif + + lprintf ("frame_duration is %d\n", this->frame_duration); } } @@ -794,9 +782,7 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, int bufsize; int package_done; -#ifdef LOG - printf ("demux_asf: asf_send_buffer_nodefrag: timestamp=%lld, pts=%lld\n", timestamp, timestamp * 90); -#endif + lprintf ("asf_send_buffer_nodefrag: timestamp=%lld, pts=%lld\n", timestamp, timestamp * 90); if ((stream->frag_offset == 0) && (frag_offset == 0)) { /* new packet */ @@ -838,11 +824,9 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, else buf->extra_info->input_time = 0; -#ifdef LOG - printf ("demux_asf: input pos is %lld, input time is %d\n", - buf->extra_info->input_pos, - buf->extra_info->input_time); -#endif + lprintf ("input pos is %lld, input time is %d\n", + buf->extra_info->input_pos, + buf->extra_info->input_time); buf->pts = timestamp * 90; buf->type = stream->buf_type; @@ -872,10 +856,9 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_stream_t *stream, stream->frag_offset = 0; } -#ifdef LOG - printf ("demux_asf: buffer type %08x %8d bytes, %8lld pts\n", - buf->type, buf->size, buf->pts); -#endif + lprintf ("buffer type %08x %8d bytes, %8lld pts\n", + buf->type, buf->size, buf->pts); + stream->fifo->put (stream->fifo, buf); } } @@ -892,9 +875,7 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, printf("asf_send_buffer seq=%d frag_offset=%d frag_len=%d\n", seq, frag_offset, frag_len ); */ -#ifdef LOG - printf ("demux_asf: asf_send_buffer_defrag: timestamp=%lld, pts=%lld\n", timestamp, timestamp * 90); -#endif + lprintf ("asf_send_buffer_defrag: timestamp=%lld, pts=%lld\n", timestamp, timestamp * 90); if ((stream->frag_offset == 0) && (frag_offset == 0)) { /* new packet */ @@ -969,10 +950,8 @@ static void asf_send_buffer_defrag (demux_asf_t *this, asf_stream_t *stream, buf->type = stream->buf_type; buf->size = bufsize; -#ifdef LOG - printf ("demux_asf: buffer type %08x %8d bytes, %8lld pts\n", - buf->type, buf->size, buf->pts); -#endif + lprintf ("buffer type %08x %8d bytes, %8lld pts\n", + buf->type, buf->size, buf->pts); stream->frag_offset -= bufsize; p+=bufsize; @@ -1056,9 +1035,8 @@ static int asf_parse_packet_header(demux_asf_t *this) { if (ecd_flags & 0x70) { /* skip invalid packet */ -#ifdef LOG - printf("demux_asf: skip invalid packet: %d\n", ecd_flags); -#endif + lprintf("skip invalid packet: %d\n", ecd_flags); + this->input->seek (this->input, this->packet_size - p_hdr_size, SEEK_CUR); invalid_packet = 1; } @@ -1104,21 +1082,18 @@ static int asf_parse_packet_header(demux_asf_t *this) { timestamp = get_le32(this); p_hdr_size += 4; duration = get_le16(this); p_hdr_size += 2; -#ifdef LOG - printf ("demux_asf: timestamp=%lld, duration=%lld\n", timestamp, duration); -#endif + + lprintf ("timestamp=%lld, duration=%lld\n", timestamp, duration); if ((this->packet_flags >> 5) & 3) { /* absolute data size */ -#ifdef LOG - printf ("demux_asf: absolute data size\n"); -#endif + lprintf ("absolute data size\n"); + this->packet_padsize = this->packet_size - this->data_size; /* not used */ } else { /* relative data size */ -#ifdef LOG - printf ("demux_asf: relative data size\n"); -#endif + lprintf ("relative data size\n"); + this->data_size = this->packet_size - this->packet_padsize; } @@ -1133,9 +1108,8 @@ static int asf_parse_packet_header(demux_asf_t *this) { if (this->packet_flags & 0x01) { this->frame_flag = get_byte(this); p_hdr_size += 1; this->nb_frames = (this->frame_flag & 0x3F); -#ifdef LOG - printf ("demux_asf: multiple frames %d\n", this->nb_frames); -#endif + + lprintf ("multiple frames %d\n", this->nb_frames); } else { this->frame_flag = 0; this->nb_frames = 1; @@ -1143,10 +1117,8 @@ static int asf_parse_packet_header(demux_asf_t *this) { /* this->packet_size_left = this->packet_size - p_hdr_size; */ this->packet_size_left = this->data_size - p_hdr_size; -#ifdef LOG - printf ("demux_asf: new packet, size = %d, size_left = %d, flags = 0x%02x, padsize = %d, this->packet_size = %d\n", - this->data_size, this->packet_size_left, this->packet_flags, this->packet_padsize, this->packet_size); -#endif + lprintf ("new packet, size = %d, size_left = %d, flags = 0x%02x, padsize = %d, this->packet_size = %d\n", + this->data_size, this->packet_size_left, this->packet_flags, this->packet_padsize, this->packet_size); return 0; } @@ -1166,9 +1138,8 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, stream_id = raw_id & 0x7f; *stream = NULL; -#ifdef LOG - printf ("demux_asf: got raw_id=%d\n", raw_id); -#endif + + lprintf ("got raw_id=%d\n", raw_id); for (i = 0; i < this->num_streams; i++) { if (this->streams[i].stream_id == stream_id && @@ -1207,16 +1178,13 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, exp_seq = (*stream)->seq + 1; break; default: -#ifdef LOG - printf ("demux_asf: seq=0\n"); -#endif + lprintf ("seq=0\n"); *seq = 0; } /* check seq number */ -#ifdef LOG - printf ("demux_asf: stream_id = %d, seq = %d\n", (*stream)->stream_id, *seq); -#endif + lprintf ("stream_id = %d, seq = %d\n", (*stream)->stream_id, *seq); + if (*stream) { if ((*stream)->first_seq || (*stream)->skip) { exp_seq = *seq; @@ -1235,9 +1203,8 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, (*stream)->fifo->put((*stream)->fifo, buf); } if ((*stream)->stream_id == this->video_stream_id) { -#ifdef LOG - printf ("demux_asf: bad seq: waiting for keyframe\n"); -#endif + lprintf ("bad seq: waiting for keyframe\n"); + (*stream)->resync = 1; (*stream)->skip = 1; this->keyframe_ts = 0; @@ -1254,9 +1221,7 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, case 3: *frag_offset = get_le32(this); s_hdr_size += 4; break; default: -#ifdef LOG - printf ("demux_asf: frag_offset=0\n"); -#endif + lprintf ("frag_offset=0\n"); *frag_offset = 0; } @@ -1278,10 +1243,9 @@ static int asf_parse_packet_payload_common(demux_asf_t *this, return 1; } -#ifdef LOG - printf ("demux_asf: segment header, stream id %02x, frag_offset %d, flags : %02x\n", + lprintf ("segment header, stream id %02x, frag_offset %d, flags : %02x\n", stream_id, *frag_offset, *rlen); -#endif + this->packet_size_left -= s_hdr_size; return 0; } @@ -1297,9 +1261,8 @@ static int asf_parse_packet_payload_single(demux_asf_t *this, uint32_t data_length = 0; uint32_t data_sent=0; -#ifdef LOG - printf ("demux_asf: asf_parse_packet_payload_single\n"); -#endif + lprintf ("asf_parse_packet_payload_single\n"); + *timestamp = frag_offset; frag_offset = 0; get_byte (this); s_hdr_size += 1; @@ -1314,21 +1277,16 @@ static int asf_parse_packet_payload_single(demux_asf_t *this, case 3: data_length = get_le32(this); s_hdr_size += 4; break; default: -#ifdef LOG - printf ("demux_asf: invalid frame_flag %d\n", this->frame_flag); -#endif + lprintf ("invalid frame_flag %d\n", this->frame_flag); data_length = get_le16(this); s_hdr_size += 2; } -#ifdef LOG - printf ("demux_asf: reading grouping part segment, size = %d\n", data_length); -#endif + lprintf ("reading grouping part segment, size = %d\n", data_length); } else { data_length = this->packet_size_left - s_hdr_size; -#ifdef LOG - printf ("demux_asf: reading grouping single segment, size = %d\n", data_length); -#endif + + lprintf ("reading grouping single segment, size = %d\n", data_length); } if (data_length > this->packet_size_left) { @@ -1343,10 +1301,7 @@ static int asf_parse_packet_payload_single(demux_asf_t *this, while (data_sent < data_length) { int object_length = get_byte(this); -#ifdef LOG - printf ("demux_asf: sending grouped object, len = %d\n", object_length); -#endif - + lprintf ("sending grouped object, len = %d\n", object_length); if (stream && stream->fifo) { /* keyframe detection for non-seekable input plugins */ @@ -1364,9 +1319,7 @@ static int asf_parse_packet_payload_single(demux_asf_t *this, } if (!stream->skip) { - #ifdef LOG - printf ("demux_asf: sending buffer of type %08x\n", stream->buf_type); - #endif + lprintf ("sending buffer of type %08x\n", stream->buf_type); if (stream->defrag) asf_send_buffer_defrag (this, stream, 0, seq, *timestamp, @@ -1375,15 +1328,13 @@ static int asf_parse_packet_payload_single(demux_asf_t *this, asf_send_buffer_nodefrag (this, stream, 0, seq, *timestamp, object_length, object_length); } else { - #ifdef LOG - printf ("demux_asf: skip object\n"); - #endif + lprintf ("skip object\n"); + this->input->seek (this->input, object_length, SEEK_CUR); } } else { -#ifdef LOG - printf ("demux_asf: unhandled stream type\n"); -#endif + lprintf ("unhandled stream type\n"); + this->input->seek (this->input, object_length, SEEK_CUR); } seq++; @@ -1406,10 +1357,9 @@ static int asf_parse_packet_payload_multiple(demux_asf_t *this, uint32_t s_hdr_size = 0; uint32_t payload_size, frag_len; -#ifdef LOG - printf ("demux_asf: asf_parse_packet_payload_multiple\n"); -#endif - if (rlen >= 8) { + lprintf ("asf_parse_packet_payload_multiple\n"); + + if (rlen >= 8) { payload_size = get_le32(this); s_hdr_size += 4; *timestamp = get_le32(this); s_hdr_size += 4; if (rlen - 8) this->input->seek (this->input, rlen - 8, SEEK_CUR); @@ -1432,21 +1382,16 @@ static int asf_parse_packet_payload_multiple(demux_asf_t *this, case 3: frag_len = get_le32(this); s_hdr_size += 4; break; default: -#ifdef LOG - printf ("demux_asf: invalid frame_flag %d\n", this->frame_flag); -#endif + lprintf ("invalid frame_flag %d\n", this->frame_flag); + frag_len = get_le16(this); s_hdr_size += 2; } -#ifdef LOG - printf ("demux_asf: reading part segment, size = %d\n", frag_len); -#endif + lprintf ("reading part segment, size = %d\n", frag_len); } else { frag_len = this->packet_size_left - s_hdr_size; -#ifdef LOG - printf ("demux_asf: reading single segment, size = %d\n", frag_len); -#endif + lprintf ("reading single segment, size = %d\n", frag_len); } if (frag_len > this->packet_size_left) { @@ -1480,9 +1425,8 @@ static int asf_parse_packet_payload_multiple(demux_asf_t *this, } if (!stream->skip) { -#ifdef LOG - printf ("demux_asf: sending buffer of type %08x\n", stream->buf_type); -#endif + lprintf ("sending buffer of type %08x\n", stream->buf_type); + if (stream->defrag) asf_send_buffer_defrag (this, stream, frag_offset, seq, *timestamp, frag_len, payload_size); @@ -1490,15 +1434,13 @@ static int asf_parse_packet_payload_multiple(demux_asf_t *this, asf_send_buffer_nodefrag (this, stream, frag_offset, seq, *timestamp, frag_len, payload_size); } else { -#ifdef LOG - printf ("demux_asf: skip fragment\n"); -#endif + lprintf ("skip fragment\n"); + this->input->seek (this->input, frag_len, SEEK_CUR); } } else { -#ifdef LOG - printf ("demux_asf: unhandled stream type\n"); -#endif + lprintf ("unhandled stream type\n"); + this->input->seek (this->input, frag_len, SEEK_CUR); } this->packet_size_left -= frag_len; @@ -1876,9 +1818,8 @@ static void demux_asf_send_headers (demux_plugin_t *this_gen) { } demux_asf_send_headers_common(this, 1); -#ifdef LOG - printf ("demux_asf: send header done\n"); -#endif + + lprintf ("send header done\n"); } static int demux_asf_seek (demux_plugin_t *this_gen, @@ -1895,10 +1836,8 @@ static int demux_asf_seek (demux_plugin_t *this_gen, start_time /= 1000; -#ifdef LOG - printf ("demux_asf: demux_asf_seek: start_pos = %lld, start_time=%d\n", - start_pos, start_time); -#endif + lprintf ("demux_asf_seek: start_pos = %lld, start_time=%d\n", + start_pos, start_time); this->status = DEMUX_OK; @@ -1943,9 +1882,8 @@ static int demux_asf_seek (demux_plugin_t *this_gen, /* no video stream */ if (this->video_stream_id == -1) { -#ifdef LOG - printf ("demux_asf: demux_asf_seek: no video stream\n"); -#endif + lprintf ("demux_asf_seek: no video stream\n"); + state = 2; } @@ -1958,9 +1896,8 @@ static int demux_asf_seek (demux_plugin_t *this_gen, start_pos -= (start_pos - this->first_packet_pos) % this->packet_size; while ((start_pos >= this->first_packet_pos) && (state != 5)){ /* seek to the beginning of the previous packet */ -#ifdef LOG - printf ("demux_asf: demux_asf_seek: seek back\n"); -#endif + lprintf ("demux_asf_seek: seek back\n"); + if (this->input->seek (this->input, start_pos, SEEK_SET) != start_pos) { printf ("demux_asf: demux_asf_seek: seek failed\n"); goto error; @@ -1973,9 +1910,9 @@ static int demux_asf_seek (demux_plugin_t *this_gen, for (this->frame = 0; this->frame < (this->nb_frames & 0x3f); this->frame++) { raw_id = get_byte(this); this->packet_size_left -= 1; -#ifdef LOG - printf ("demux_asf: demux_asf_seek: raw_id = %d\n", raw_id); -#endif + + lprintf ("demux_asf_seek: raw_id = %d\n", raw_id); + stream_id = raw_id & 0x7f; keyframe = raw_id & 0x80; if (asf_parse_packet_payload_common(this, raw_id, &stream, &frag_offset, &rlen, &seq)) @@ -1993,22 +1930,19 @@ static int demux_asf_seek (demux_plugin_t *this_gen, if (keyframe && (stream_id == this->video_stream_id) && !frag_offset) { this->keyframe_ts = ts; if (this->audio_stream_id == -1) { -#ifdef LOG - printf ("demux_asf: demux_asf_seek: no audio stream\n"); -#endif + lprintf ("demux_asf_seek: no audio stream\n"); + state = 5; } state = 1; /* search an audio packet with pts < keyframe pts */ -#ifdef LOG - printf ("demux_asf: demux_asf_seek: keyframe found at %lld, timestamp = %lld\n", start_pos, ts); -#endif + + lprintf ("demux_asf_seek: keyframe found at %lld, timestamp = %lld\n", start_pos, ts); } } else if (state == 1) { if ((stream_id == this->audio_stream_id) && ts && (ts <= this->keyframe_ts)) { -#ifdef LOG - printf ("demux_asf: demux_asf_seek: audio packet found at %lld, ts = %lld\n", start_pos, ts); -#endif + lprintf ("demux_asf_seek: audio packet found at %lld, ts = %lld\n", start_pos, ts); + state = 5; /* end */ break; } @@ -2016,9 +1950,8 @@ static int demux_asf_seek (demux_plugin_t *this_gen, if ((stream_id == this->audio_stream_id) && !frag_offset) { this->keyframe_ts = ts; state = 5; /* end */ -#ifdef LOG - printf ("demux_asf: demux_asf_seek: audio packet found at %lld, timestamp = %lld\n", start_pos, ts); -#endif + + lprintf ("demux_asf_seek: audio packet found at %lld, timestamp = %lld\n", start_pos, ts); } } } @@ -2091,9 +2024,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, if ( (len=input->read (input, buf, 1024)) <= 0) return NULL; -#ifdef LOG - printf ("demux_asf: PREVIEW data unavailable, but seek+read worked.\n"); -#endif + lprintf ("PREVIEW data unavailable, but seek+read worked.\n"); } else return NULL; @@ -2112,9 +2043,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, return NULL; } -#ifdef LOG - printf ("demux_asf: file starts with an asf header\n"); -#endif + lprintf ("file starts with an asf header\n"); break; @@ -2137,9 +2066,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, strncasecmp(ending, ".wma", 4) ) { return NULL; } -#ifdef LOG - printf ("demux_asf: extension accepted.\n"); -#endif + + lprintf ("extension accepted.\n"); } break; diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 8a86840fe..d9faf7011 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_avi.c,v 1.181 2003/11/23 23:20:57 valtri Exp $ + * $Id: demux_avi.c,v 1.182 2003/11/26 19:43:28 f1rmb Exp $ * * demultiplexer for avi streams * @@ -59,12 +59,12 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_avi" #define LOG_VERBOSE /* -#define LOG +#define LOG */ + #include "xine_internal.h" #include "xineutils.h" #include "demux.h" diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index 7fff96bed..2ee247459 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_eawve.c,v 1.25 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_eawve.c,v 1.26 2003/11/26 19:43:29 f1rmb Exp $ * * demux_eawve.c, Demuxer plugin for Electronic Arts' WVE file format * @@ -35,10 +35,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_eawve" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index 147a712e6..0aa1a7e90 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_elem.c,v 1.79 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_elem.c,v 1.80 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for elementary mpeg streams */ @@ -34,10 +34,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_elem" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index b6de020aa..40b132183 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -21,7 +21,7 @@ * For more information on the FILM file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_film.c,v 1.71 2003/11/17 05:42:07 tmmm Exp $ + * $Id: demux_film.c,v 1.72 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -34,9 +34,12 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_film" -/* #define LOG_VERBOSE */ +#define LOG_VERBOSE +/* +#define LOG +*/ + /* set DEBUG_FILM_LOAD to dump the frame index after the demuxer loads a * FILM file */ diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 8f2da7dd4..00e4b943b 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -65,7 +65,7 @@ * - if any bytes exceed 63, do not shift the bytes at all before * transmitting them to the video decoder * - * $Id: demux_idcin.c,v 1.48 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_idcin.c,v 1.49 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -78,9 +78,8 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_idcin" -/* #define LOG_VERBOSE */ +#define LOG_VERBOSE /* define LOG to output information about the A/V chunks that the * demuxer is dispatching to the engine */ diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index 51fa41b73..68a5cb8bf 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_image.c,v 1.11 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_image.c,v 1.12 2003/11/26 19:43:30 f1rmb Exp $ * * image dummy demultiplexer */ @@ -34,10 +34,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_image" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index b4652b29f..97e435dd7 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -23,7 +23,7 @@ * For more information regarding the Interplay MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_ipmovie.c,v 1.19 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_ipmovie.c,v 1.20 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,10 +36,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_ipmovie" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" @@ -377,7 +378,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { /* check for the logical maximum palette size * (3 * 256 + 4 bytes) */ if (opcode_size > 0x304) { - lprintf("demux_ipmovie: set_palette opcode too large\n"); + lprintf("set_palette opcode too large\n"); chunk_type = CHUNK_BAD; break; } @@ -392,7 +393,7 @@ static int process_ipmovie_chunk(demux_ipmovie_t *this) { color_count = LE_16(&scratch[2]); /* sanity check (since they are 16 bit values) */ if ((first_color > 0xFF) || (first_color + color_count > 0x100)) { - lprintf("demux_ipmovie: set_palette indices out of range (%d -> %d)\n", + lprintf("set_palette indices out of range (%d -> %d)\n", first_color, first_color + color_count); chunk_type = CHUNK_BAD; break; diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index 201802cc7..222d42477 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mng.c,v 1.15 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_mng.c,v 1.16 2003/11/26 19:43:30 f1rmb Exp $ * * demux_mng.c, Demuxer plugin for Multiple-image Network Graphics format * @@ -37,10 +37,11 @@ #include -/********** logging **********/ #define LOG_MODULE "demux_mng" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index b30d4fd67..e01cfd736 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_mpeg.c,v 1.130 2003/11/18 04:35:14 tmmm Exp $ + * $Id: demux_mpeg.c,v 1.131 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for mpeg 1/2 program streams * reads streams of variable blocksizes @@ -35,10 +35,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_mpeg" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "demux.h" diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index d444291dd..59fec5df8 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_block.c,v 1.201 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_mpeg_block.c,v 1.202 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for mpeg 1/2 program streams * used with fixed blocksize devices (like dvd/vcd) @@ -34,14 +34,16 @@ #include #include -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" - +#define LOG_MODULE "demux_mpeg_block" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "xineutils.h" +#include "demux.h" + #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 @@ -157,9 +159,8 @@ static void check_newpts( demux_mpeg_block_t *this, int64_t pts, int video ) /* check if pts is outside nav pts range. any stream without nav must enter here. */ if( pts > this->nav_last_end_pts || pts < this->nav_last_start_pts ) { -#ifdef LOG - printf("demux_mpeg_block: discontinuity detected by pts wrap\n"); -#endif + lprintf("discontinuity detected by pts wrap\n"); + if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); this->buf_flag_seek = 0; @@ -168,9 +169,7 @@ static void check_newpts( demux_mpeg_block_t *this, int64_t pts, int video ) } this->send_newpts = 0; } else { -#ifdef LOG - printf("demux_mpeg_block: no wrap detected\n" ); -#endif + lprintf("no wrap detected\n" ); } this->last_pts[1-video] = 0; @@ -189,9 +188,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m this->scr = 0; this->preview_mode = preview_mode; -#ifdef LOG - printf ("demux_mpeg_block: read_block\n"); -#endif + lprintf ("read_block\n"); buf = this->input->read_block (this->input, this->video_fifo, this->blocksize); @@ -220,9 +217,7 @@ static void demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_m this->audio_fifo->put (this->audio_fifo, cbuf); } -#ifdef LOG - printf ("demux_mpeg_block: type %08x != BUF_DEMUX_BLOCK\n", buf->type); -#endif + lprintf ("type %08x != BUF_DEMUX_BLOCK\n", buf->type); return; } @@ -457,9 +452,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_block_t *this, uint8_ this->scr += ( (p[8] & 0x03 << 7) | (p[9] & 0xFE >> 1) ); */ -#ifdef LOG - printf ("demux_mpeg_block: SCR=%lld\n", this->scr); -#endif + lprintf ("SCR=%lld\n", this->scr); /* mux_rate */ @@ -526,16 +519,13 @@ static int32_t parse_private_stream_2(demux_mpeg_block_t *this, uint8_t *p, buf_ this->last_begin_time = buf->extra_info->input_time; } -#ifdef LOG - printf ("demux_mpeg_block: NAV packet, start pts = %lld, end_pts = %lld\n", + lprintf ("NAV packet, start pts = %lld, end_pts = %lld\n", start_pts, end_pts); -#endif if (this->nav_last_end_pts != start_pts && !this->preview_mode) { -#ifdef LOG - printf("demux_mpeg_block: discontinuity detected by nav packet\n" ); -#endif + lprintf("discontinuity detected by nav packet\n" ); + if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, start_pts, BUF_FLAG_SEEK); this->buf_flag_seek = 0; @@ -668,9 +658,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_block_t *this, uint8_t *p, buf_eleme this->pts |= p[12] << 7 ; this->pts |= (p[13] & 0xFE) >> 1 ; -#ifdef LOG - printf ("demux_mpeg_block: pts = %lld\n", this->pts); -#endif + lprintf ("pts = %lld\n", this->pts); } else this->pts = 0; @@ -719,9 +707,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ buf->pts = this->pts; this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: SPU PACK put on fifo\n"); -#endif + lprintf ("SPU PACK put on fifo\n"); return -1; } @@ -739,9 +725,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); -#endif + lprintf ("SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); return -1; } @@ -759,9 +743,7 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); -#endif + lprintf ("SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); return -1; } @@ -875,9 +857,8 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: A52 PACK put on fifo\n"); -#endif + lprintf ("A52 PACK put on fifo\n"); + return -1; } else { buf->free_buffer(buf); @@ -942,9 +923,8 @@ static int32_t parse_private_stream_1(demux_mpeg_block_t *this, uint8_t *p, buf_ if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: LPCM PACK put on fifo\n"); -#endif + lprintf ("LPCM PACK put on fifo\n"); + return -1; } else { buf->free_buffer(buf); @@ -977,9 +957,7 @@ static int32_t parse_video_stream(demux_mpeg_block_t *this, uint8_t *p, buf_elem check_newpts( this, this->pts, PTS_VIDEO ); this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: MPEG Video PACK put on fifo\n"); -#endif + lprintf ("MPEG Video PACK put on fifo\n"); return -1; } @@ -1005,9 +983,8 @@ static int32_t parse_audio_stream(demux_mpeg_block_t *this, uint8_t *p, buf_elem if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_block: MPEG Audio PACK put on fifo\n"); -#endif + lprintf ("MPEG Audio PACK put on fifo\n"); + } else { buf->free_buffer(buf); } @@ -1185,9 +1162,7 @@ static int demux_mpeg_block_estimate_rate (demux_mpeg_block_t *this) { buf->free_buffer (buf); } -#ifdef LOG - printf("demux_mpeg_block:est_rate=%d\n",rate); -#endif + lprintf("est_rate=%d\n",rate); return rate; } @@ -1347,17 +1322,13 @@ static void demux_mpeg_block_accept_input (demux_mpeg_block_t *this, strncpy (this->cur_mrl, input->get_mrl(input), 256); -#ifdef LOG - printf ("demux_mpeg_block: mrl %s is new\n", - this->cur_mrl); -#endif + lprintf ("mrl %s is new\n", this->cur_mrl); - } else -#ifdef LOG - printf ("demux_mpeg_block: mrl %s is known, bitrate: %d\n", - this->cur_mrl, this->rate * 50 * 8) -#endif - ; + } + else { + lprintf ("mrl %s is known, bitrate: %d\n", + this->cur_mrl, this->rate * 50 * 8); + } } static int demux_mpeg_block_get_stream_length (demux_plugin_t *this_gen) { @@ -1406,10 +1377,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str this->scratch = xine_xmalloc_aligned (512, 4096, (void**) &this->scratch_base); this->status = DEMUX_FINISHED; -#ifdef LOG - printf ("demux_mpeg_block:open_plugin:detection_method=%d\n", - stream->content_detection_method); -#endif + lprintf ("open_plugin:detection_method=%d\n", + stream->content_detection_method); switch (stream->content_detection_method) { @@ -1425,9 +1394,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str if (((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) ) { this->blocksize = input->get_blocksize(input); -#ifdef LOG - printf("demux_mpeg_block:open_plugin:blocksize=%d\n",this->blocksize); -#endif + lprintf("open_plugin:blocksize=%d\n",this->blocksize); if (!this->blocksize) this->blocksize = demux_mpeg_detect_blocksize( this, input ); @@ -1440,15 +1407,12 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input->seek(input, 0, SEEK_SET); if (input->read(input, this->scratch, this->blocksize)) { -#ifdef LOG - printf("demux_mpeg_block:open_plugin:read worked\n"); -#endif + lprintf("open_plugin:read worked\n"); if (this->scratch[0] || this->scratch[1] || (this->scratch[2] != 0x01) || (this->scratch[3] != 0xba)) { -#ifdef LOG - printf("demux_mpeg_block:open_plugin:scratch failed\n"); -#endif + lprintf("open_plugin:scratch failed\n"); + free (this->scratch_base); free (this); return NULL; @@ -1465,9 +1429,9 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input->seek(input, 0, SEEK_SET); demux_mpeg_block_accept_input (this, input); -#ifdef LOG - printf("demux_mpeg_block:open_plugin:Accepting detection_method XINE_DEMUX_CONTENT_STRATEGY blocksize=%d\n",this->blocksize); -#endif + lprintf("open_plugin:Accepting detection_method XINE_DEMUX_CONTENT_STRATEGY blocksize=%d\n", + this->blocksize); + break; } } @@ -1513,9 +1477,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_EXPLICIT: { this->blocksize = input->get_blocksize(input); -#ifdef LOG - printf("demux_mpeg_block:open_plugin:blocksize=%d\n",this->blocksize); -#endif + lprintf("open_plugin:blocksize=%d\n",this->blocksize); if (!this->blocksize && ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0)) diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 51706a7fe..d1753d907 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpeg_pes.c,v 1.17 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_mpeg_pes.c,v 1.18 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for mpeg 2 PES (Packetized Elementary Streams) * reads streams of variable blocksizes @@ -38,14 +38,16 @@ #include #include -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" - +#define LOG_MODULE "demux_mpeg_pes" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "xineutils.h" +#include "demux.h" + #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 @@ -140,9 +142,8 @@ static void check_newpts( demux_mpeg_pes_t *this, int64_t pts, int video ) /* check if pts is outside nav pts range. any stream without nav must enter here. */ if( pts > this->nav_last_end_pts || pts < this->nav_last_start_pts ) { -#ifdef LOG - printf("demux_mpeg_pes: discontinuity detected by pts wrap\n"); -#endif + lprintf("discontinuity detected by pts wrap\n"); + if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK); this->buf_flag_seek = 0; @@ -151,9 +152,7 @@ static void check_newpts( demux_mpeg_pes_t *this, int64_t pts, int video ) } this->send_newpts = 0; } else { -#ifdef LOG - printf("demux_mpeg_pes: no wrap detected\n" ); -#endif + lprintf("no wrap detected\n" ); } this->last_pts[1-video] = 0; @@ -236,9 +235,8 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) #endif this->packet_len = p[4] << 8 | p[5]; -#ifdef LOG - printf("demux_pes: stream_id=0x%x, packet_len=%d\n",this->stream_id, this->packet_len); -#endif + lprintf("stream_id=0x%x, packet_len=%d\n",this->stream_id, this->packet_len); + if (this->packet_len <= (buf->max_size - 6)) { i = this->input->read (this->input, buf->mem+6, (off_t) this->packet_len); if (i != this->packet_len) { @@ -248,9 +246,8 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) } buf->size = this->packet_len + 6; } else { -#ifdef LOG - printf("Jumbo PES packet length=%d, stream_id=0x%x\n",this->packet_len, this->stream_id); -#endif + lprintf("Jumbo PES packet length=%d, stream_id=0x%x\n",this->packet_len, this->stream_id); + i = this->input->read (this->input, buf->mem+6, (off_t) (buf->max_size - 6)); if (i != ( buf->max_size - 6)) { buf->free_buffer (buf); @@ -461,9 +458,7 @@ static int32_t parse_program_stream_pack_header(demux_mpeg_pes_t *this, uint8_t this->scr += ( (p[8] & 0x03 << 7) | (p[9] & 0xFE >> 1) ); */ -#ifdef LOG - printf ("demux_mpeg_pes: SCR=%lld\n", this->scr); -#endif + lprintf ("SCR=%lld\n", this->scr); /* mux_rate */ @@ -540,16 +535,13 @@ static int32_t parse_private_stream_2(demux_mpeg_pes_t *this, uint8_t *p, buf_el this->last_begin_time = buf->extra_info->input_time; } -#ifdef LOG - printf ("demux_mpeg_pes: NAV packet, start pts = %lld, end_pts = %lld\n", + lprintf ("NAV packet, start pts = %lld, end_pts = %lld\n", start_pts, end_pts); -#endif if (this->nav_last_end_pts != start_pts && !this->preview_mode) { -#ifdef LOG - printf("demux_mpeg_pes: discontinuity detected by nav packet\n" ); -#endif + lprintf("discontinuity detected by nav packet\n" ); + if (this->buf_flag_seek) { _x_demux_control_newpts(this->stream, start_pts, BUF_FLAG_SEEK); this->buf_flag_seek = 0; @@ -689,9 +681,7 @@ static int32_t parse_pes_for_pts(demux_mpeg_pes_t *this, uint8_t *p, buf_element this->pts |= (int64_t) p[12] << 7 ; this->pts |= (int64_t) (p[13] & 0xFE) >> 1 ; -#ifdef LOG - printf ("demux_mpeg_pes: pts = %lld\n", this->pts); -#endif + lprintf ("pts = %lld\n", this->pts); } else this->pts = 0; @@ -740,9 +730,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el buf->pts = this->pts; this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: SPU PACK put on fifo\n"); -#endif + lprintf ("SPU PACK put on fifo\n"); return this->packet_len + result; } @@ -760,9 +748,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); -#endif + lprintf ("SPU SVCD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); return this->packet_len + result; } @@ -780,9 +766,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el check_newpts( this, this->pts, PTS_VIDEO ); */ this->video_fifo->put (this->video_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); -#endif + lprintf ("SPU CVD PACK (%lld, %d) put on fifo\n", this->pts, spu_id); return this->packet_len + result; } @@ -806,9 +790,8 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: A52 PACK put on fifo\n"); -#endif + lprintf ("A52 PACK put on fifo\n"); + } else { buf->free_buffer(buf); } @@ -872,9 +855,8 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: LPCM PACK put on fifo\n"); -#endif + lprintf ("LPCM PACK put on fifo\n"); + } else { buf->free_buffer(buf); } @@ -903,9 +885,7 @@ static int32_t parse_private_stream_1(demux_mpeg_pes_t *this, uint8_t *p, buf_el if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: A52 PACK put on fifo\n"); -#endif + lprintf ("A52 PACK put on fifo\n"); } else { buf->free_buffer(buf); } @@ -969,11 +949,7 @@ static int32_t parse_video_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen todo_length -= chunk_length; } - - -#ifdef LOG - printf ("demux_mpeg_pes: MPEG Video PACK put on fifo\n"); -#endif + lprintf ("MPEG Video PACK put on fifo\n"); return this->packet_len + result; } @@ -999,9 +975,7 @@ static int32_t parse_audio_stream(demux_mpeg_pes_t *this, uint8_t *p, buf_elemen if(this->audio_fifo) { this->audio_fifo->put (this->audio_fifo, buf); -#ifdef LOG - printf ("demux_mpeg_pes: MPEG Audio PACK put on fifo\n"); -#endif + lprintf ("MPEG Audio PACK put on fifo\n"); } else { buf->free_buffer(buf); } @@ -1173,9 +1147,7 @@ static int demux_mpeg_pes_estimate_rate (demux_mpeg_pes_t *this) { } } -#ifdef LOG - printf("demux_mpeg_pes:est_rate=%d\n",rate); -#endif + lprintf("est_rate=%d\n",rate); return rate; } @@ -1305,17 +1277,13 @@ static void demux_mpeg_pes_accept_input (demux_mpeg_pes_t *this, strncpy (this->cur_mrl, input->get_mrl(input), 256); -#ifdef LOG - printf ("demux_mpeg_pes: mrl %s is new\n", - this->cur_mrl); -#endif + lprintf ("mrl %s is new\n", this->cur_mrl); - } else -#ifdef LOG - printf ("demux_mpeg_pes: mrl %s is known, bitrate: %d\n", - this->cur_mrl, this->rate * 50 * 8) -#endif - ; + } + else { + lprintf ("mrl %s is known, bitrate: %d\n", + this->cur_mrl, this->rate * 50 * 8); + } } static int demux_mpeg_pes_get_stream_length (demux_plugin_t *this_gen) { @@ -1367,10 +1335,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str /* We need to system header in order to identify is the stream is mpeg1 or mpeg2. */ this->wait_for_program_stream_pack_header=1; -#ifdef LOG - printf ("demux_mpeg_pes:open_plugin:detection_method=%d\n", - stream->content_detection_method); -#endif + lprintf ("open_plugin:detection_method=%d\n", + stream->content_detection_method); switch (stream->content_detection_method) { @@ -1387,15 +1353,12 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input->seek(input, 0, SEEK_SET); if (input->read(input, this->scratch, 6)) { -#ifdef LOG - printf("demux_mpeg_pes:open_plugin:read worked\n"); -#endif + lprintf("open_plugin:read worked\n"); if (this->scratch[0] || this->scratch[1] || (this->scratch[2] != 0x01) ) { -#ifdef LOG - printf("demux_mpeg_pes:open_plugin:scratch failed\n"); -#endif + lprintf("open_plugin:scratch failed\n"); + free (this->scratch_base); free (this); return NULL; @@ -1416,9 +1379,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str input->seek(input, 0, SEEK_SET); demux_mpeg_pes_accept_input (this, input); -#ifdef LOG - printf("demux_mpeg_pes:open_plugin:Accepting detection_method XINE_DEMUX_CONTENT_STRATEGY \n"); -#endif + lprintf("open_plugin:Accepting detection_method XINE_DEMUX_CONTENT_STRATEGY \n"); + break; } } diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index efadb6d7c..b5fc2d363 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_mpgaudio.c,v 1.127 2003/11/26 19:26:59 mroi Exp $ + * $Id: demux_mpgaudio.c,v 1.128 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for mpeg audio (i.e. mp3) streams * @@ -36,8 +36,6 @@ #include #include - -/********** logging **********/ #define LOG_MODULE "demux_mpeg_audio" #define LOG_VERBOSE /* @@ -1088,7 +1086,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str case METHOD_BY_EXTENSION: { char *mrl = input->get_mrl(input); - lprintf ("demux_mpgaudio: stage by extension %s\n", mrl); + lprintf ("stage by extension %s\n", mrl); if (strncmp (mrl, "ice :/", 6)) { char *extensions = class_gen->get_extensions (class_gen); diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index 97a47213d..9a62e342a 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -23,7 +23,7 @@ * For more information regarding the NSV file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_nsv.c,v 1.10 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_nsv.c,v 1.11 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,10 +36,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_nsv" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c index 6cda0b596..68b4bfd86 100644 --- a/src/demuxers/demux_ogg.c +++ b/src/demuxers/demux_ogg.c @@ -19,7 +19,7 @@ */ /* - * $Id: demux_ogg.c,v 1.116 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_ogg.c,v 1.117 2003/11/26 19:43:30 f1rmb Exp $ * * demultiplexer for ogg streams * @@ -52,10 +52,11 @@ #include #endif -/********** logging **********/ #define LOG_MODULE "demux_ogg" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" @@ -1160,12 +1161,10 @@ static void demux_ogg_send_header (demux_ogg_t *this) { ((int64_t) this->t_info.aspect_numerator * 10000) / this->t_info.aspect_denominator); -#ifdef LOG - printf ("demux_ogg: decoded theora header \n"); - printf (" frameduration %d\n",this->frame_duration); - printf (" w:%d h:%d \n",this->t_info.frame_width,this->t_info.frame_height); - printf (" an:%d ad:%d \n",this->t_info.aspect_numerator,this->t_info.aspect_denominator); -#endif + lprintf ("decoded theora header \n"); + lprintf ("frameduration %d\n",this->frame_duration); + lprintf ("w:%d h:%d \n",this->t_info.frame_width,this->t_info.frame_height); + lprintf ("an:%d ad:%d \n",this->t_info.aspect_numerator,this->t_info.aspect_denominator); } else { /*Rejected stream*/ xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -1283,7 +1282,7 @@ static void demux_ogg_send_content (demux_ogg_t *this) { this->header_granulepos[stream_num]=op.granulepos; lprintf ("header with granulepos, remembering granulepos\n"); } else { - lprintf ("demux_ogg: header => discard\n"); + lprintf ("header => discard\n"); } continue; } diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index f0c613e8a..2565e79d9 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -30,7 +30,7 @@ * * Based on FFmpeg's libav/rm.c. * - * $Id: demux_real.c,v 1.72 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_real.c,v 1.73 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -44,10 +44,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_real" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" @@ -1007,7 +1008,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { this->video_fifo->put (this->video_fifo, buf); size -= fragment_size; - lprintf ("demux_real: size left %d\n", size); + lprintf ("size left %d\n", size); this->fragment_size += fragment_size; diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index 785fd78a4..299f9ddc7 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -23,7 +23,7 @@ * For more information regarding the RoQ file format, visit: * http://www.csse.monash.edu.au/~timf/ * - * $Id: demux_roq.c,v 1.47 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_roq.c,v 1.48 2003/11/26 19:43:30 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -36,10 +36,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_roq" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index c8c566225..44bf24b03 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -21,7 +21,7 @@ */ /* - * $Id: demux_slave.c,v 1.9 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_slave.c,v 1.10 2003/11/26 19:43:30 f1rmb Exp $ * * demuxer for slave "protocol" * master xine must be started with XINE_PARAM_BROADCASTER_PORT set, that is, @@ -38,10 +38,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_slave" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 00003d69f..3d69d6cd6 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -24,7 +24,7 @@ * This demuxer handles either raw STR files (which are just a concatenation * of raw compact disc sectors) or STR files with RIFF headers. * - * $Id: demux_str.c,v 1.20 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_str.c,v 1.21 2003/11/26 19:43:31 f1rmb Exp $ */ /* @@ -119,10 +119,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_str" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index a3ca2781c..6efce42c4 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_ts.c,v 1.96 2003/11/16 23:33:43 f1rmb Exp $ + * $Id: demux_ts.c,v 1.97 2003/11/26 19:43:31 f1rmb Exp $ * * Demultiplexer for MPEG2 Transport Streams. * @@ -137,6 +137,12 @@ #include #include +#define LOG_MODULE "demux_ts" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "demux.h" @@ -642,10 +648,9 @@ static int demux_ts_parse_pes_header (demux_ts_media *m, int track, spu_id; -#ifdef LOG - printf ("demux_ts: audio buf = %02X %02X %02X %02X %02X %02X %02X %02X\n", - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); -#endif + lprintf ("audio buf = %02X %02X %02X %02X %02X %02X %02X %02X\n", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + track = p[0] & 0x0F; /* hack : ac3 track */ /* * we check the descriptor tag first because some stations diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index ff41cd7ae..e90466b21 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -24,7 +24,7 @@ * For more information on the MVE file format, visit: * http://www.pcisys.net/~melanson/codecs/ * - * $Id: demux_wc3movie.c,v 1.47 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: demux_wc3movie.c,v 1.48 2003/11/26 19:43:31 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -39,8 +39,10 @@ /********** logging **********/ #define LOG_MODULE "demux_wc3movie" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index c8cd4ce8a..ba4fce30b 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -20,7 +20,7 @@ */ /* - * $Id: demux_yuv_frames.c,v 1.12 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: demux_yuv_frames.c,v 1.13 2003/11/26 19:43:31 f1rmb Exp $ * * dummy demultiplexer for raw yuv frames (delivered by v4l) */ @@ -35,10 +35,11 @@ #include #include -/********** logging **********/ #define LOG_MODULE "demux_yuv_frames" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "xineutils.h" @@ -184,7 +185,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, default: return NULL; } - lprintf ("demux_yuv_frames: input accepted.\n"); + lprintf ("input accepted.\n"); /* * if we reach this point, the input has been accepted. diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 853860f85..8721f43c2 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: dxr3_decode_spu.c,v 1.39 2003/11/12 17:52:59 mroi Exp $ + * $Id: dxr3_decode_spu.c,v 1.40 2003/11/26 19:43:31 f1rmb Exp $ */ /* dxr3 spu decoder plugin. @@ -37,6 +37,11 @@ #include #define LOG_MODULE "dxr3_decode_spu" +#define LOG_VERBOSE +/* +#define LOG +*/ + #define LOG_PTS 0 #define LOG_SPU 0 #define LOG_BTN 0 diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index d8d7d2439..4759f553a 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.38 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: input_cdda.c,v 1.39 2003/11/26 19:43:31 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -48,6 +48,12 @@ #include #include +#define LOG_MODULE "input_cdda" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" @@ -57,10 +63,6 @@ #include #endif -/* -#define LOG 1 -*/ - #if defined(__sun) #define DEFAULT_CDDA_DEVICE "/vol/dev/aliases/cdrom0" #elif defined(WIN32) @@ -306,54 +308,54 @@ struct SRB_ExecSCSICmd #ifdef LOG static void print_cdrom_toc(cdrom_toc *toc) { - - int i; - int time1; - int time2; - int timediff; - - printf("\ntoc:\n"); - printf("\tfirst track = %d\n", toc->first_track); - printf("\tlast track = %d\n", toc->last_track); - printf("\ttotal tracks = %d\n", toc->total_tracks); - printf("\ntoc entries:\n"); - - - printf("leadout track: Control: %d MSF: %02d:%02d:%04d, first frame = %d\n", - toc->leadout_track.track_mode, - toc->leadout_track.first_frame_minute, - toc->leadout_track.first_frame_second, - toc->leadout_track.first_frame_frame, - toc->leadout_track.first_frame); - - /* fetch each toc entry */ - if (toc->first_track > 0) { - for (i = toc->first_track; i <= toc->last_track; i++) { - printf("\ttrack mode = %d", toc->toc_entries[i-1].track_mode); - printf("\ttrack %d, audio, MSF: %02d:%02d:%02d, first frame = %d\n", - i, - toc->toc_entries[i-1].first_frame_minute, - toc->toc_entries[i-1].first_frame_second, - toc->toc_entries[i-1].first_frame_frame, - toc->toc_entries[i-1].first_frame); - - time1 = ((toc->toc_entries[i-1].first_frame_minute * 60) + - toc->toc_entries[i-1].first_frame_second); - - if (i == toc->last_track) { - time2 = ((toc->leadout_track.first_frame_minute * 60) + - toc->leadout_track.first_frame_second); - } - else { - time2 = ((toc->toc_entries[i].first_frame_minute * 60) + - toc->toc_entries[i].first_frame_second); - } - - timediff = time2 - time1; - - printf("\t time: %02d:%02d\n", timediff/60, timediff%60); - } - } + + int i; + int time1; + int time2; + int timediff; + + printf("\ntoc:\n"); + printf("\tfirst track = %d\n", toc->first_track); + printf("\tlast track = %d\n", toc->last_track); + printf("\ttotal tracks = %d\n", toc->total_tracks); + printf("\ntoc entries:\n"); + + + printf("leadout track: Control: %d MSF: %02d:%02d:%04d, first frame = %d\n", + toc->leadout_track.track_mode, + toc->leadout_track.first_frame_minute, + toc->leadout_track.first_frame_second, + toc->leadout_track.first_frame_frame, + toc->leadout_track.first_frame); + + /* fetch each toc entry */ + if (toc->first_track > 0) { + for (i = toc->first_track; i <= toc->last_track; i++) { + printf("\ttrack mode = %d", toc->toc_entries[i-1].track_mode); + printf("\ttrack %d, audio, MSF: %02d:%02d:%02d, first frame = %d\n", + i, + toc->toc_entries[i-1].first_frame_minute, + toc->toc_entries[i-1].first_frame_second, + toc->toc_entries[i-1].first_frame_frame, + toc->toc_entries[i-1].first_frame); + + time1 = ((toc->toc_entries[i-1].first_frame_minute * 60) + + toc->toc_entries[i-1].first_frame_second); + + if (i == toc->last_track) { + time2 = ((toc->leadout_track.first_frame_minute * 60) + + toc->leadout_track.first_frame_second); + } + else { + time2 = ((toc->toc_entries[i].first_frame_minute * 60) + + toc->toc_entries[i].first_frame_second); + } + + timediff = time2 - time1; + + printf("\t time: %02d:%02d\n", timediff/60, timediff%60); + } + } } #endif @@ -695,33 +697,31 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { if( this_gen->hASPI ) { - /* This is for ASPI which obviously isn't supported! */ -#ifdef LOG - printf("Windows ASPI support is not complete yet!\n"); -#endif - return -1; - + /* This is for ASPI which obviously isn't supported! */ + lprintf("Windows ASPI support is not complete yet!\n"); + return -1; + } else - { - DWORD dwBytesReturned; - CDROM_TOC cdrom_toc; - int i; - - if( DeviceIoControl( this_gen->h_device_handle, - IOCTL_CDROM_READ_TOC, - NULL, 0, &cdrom_toc, sizeof(CDROM_TOC), - &dwBytesReturned, NULL ) == 0 ) - { + { + DWORD dwBytesReturned; + CDROM_TOC cdrom_toc; + int i; + + if( DeviceIoControl( this_gen->h_device_handle, + IOCTL_CDROM_READ_TOC, + NULL, 0, &cdrom_toc, sizeof(CDROM_TOC), + &dwBytesReturned, NULL ) == 0 ) + { #ifdef LOG - DWORD dw; - printf( "input_cdda: could not read TOCHDR\n" ); - dw = GetLastError(); - printf("GetLastError returned %u\n", dw); + DWORD dw; + printf( "input_cdda: could not read TOCHDR\n" ); + dw = GetLastError(); + printf("GetLastError returned %u\n", dw); #endif - return -1; - } - + return -1; + } + toc->first_track = cdrom_toc.FirstTrack; toc->last_track = cdrom_toc.LastTrack; toc->total_tracks = toc->last_track - toc->first_track + 1; @@ -775,46 +775,44 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f if( this_gen->hASPI ) { /* This is for ASPI which obviously isn't supported! */ -#ifdef LOG - printf("Windows ASPI support is not complete yet!\n"); -#endif - return -1; - + lprintf("Windows ASPI support is not complete yet!\n"); + return -1; + } else - { - memset(data, 0, CD_RAW_FRAME_SIZE * num_frames); - - while( num_frames ) { - + { + memset(data, 0, CD_RAW_FRAME_SIZE * num_frames); + + while( num_frames ) { + #ifdef LOG - /*printf("\t Raw read frame %d\n", frame);*/ + /*printf("\t Raw read frame %d\n", frame);*/ #endif - raw_read_info.DiskOffset.QuadPart = frame * CD_SECTOR_SIZE; - raw_read_info.SectorCount = 1; - raw_read_info.TrackMode = CDDA; - - /* read a frame */ - if( DeviceIoControl( this_gen->h_device_handle, - IOCTL_CDROM_RAW_READ, - &raw_read_info, sizeof(RAW_READ_INFO), data, - CD_RAW_FRAME_SIZE, - &dwBytesReturned, NULL ) == 0 ) - { + raw_read_info.DiskOffset.QuadPart = frame * CD_SECTOR_SIZE; + raw_read_info.SectorCount = 1; + raw_read_info.TrackMode = CDDA; + + /* read a frame */ + if( DeviceIoControl( this_gen->h_device_handle, + IOCTL_CDROM_RAW_READ, + &raw_read_info, sizeof(RAW_READ_INFO), data, + CD_RAW_FRAME_SIZE, + &dwBytesReturned, NULL ) == 0 ) + { #ifdef LOG - DWORD dw; - printf( "input_cdda: could not read frame\n" ); - dw = GetLastError(); - printf("GetLastError returned %u\n", dw); + DWORD dw; + printf( "input_cdda: could not read frame\n" ); + dw = GetLastError(); + printf("GetLastError returned %u\n", dw); #endif - return -1; - } - - data += CD_RAW_FRAME_SIZE; - frame++; - num_frames--; + return -1; } - } + + data += CD_RAW_FRAME_SIZE; + frame++; + num_frames--; + } + } return 0; } @@ -1997,87 +1995,80 @@ static int cdda_open(cdda_input_plugin_t *this_gen, * device and not a file! */ if( WIN_NT ) - { - char psz_win32_drive[7]; - -#ifdef LOG - printf( "input_cdda: using winNT/2K/XP ioctl layer" ); -#endif - - sprintf( psz_win32_drive, "\\\\.\\%c:", cdda_device[0] ); - - this_gen->h_device_handle = CreateFile( psz_win32_drive, GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, - FILE_FLAG_NO_BUFFERING | - FILE_FLAG_RANDOM_ACCESS, NULL ); - return (this_gen->h_device_handle == NULL) ? -1 : 0; - } + { + char psz_win32_drive[7]; + + lprintf( "using winNT/2K/XP ioctl layer" ); + + sprintf( psz_win32_drive, "\\\\.\\%c:", cdda_device[0] ); + + this_gen->h_device_handle = CreateFile( psz_win32_drive, GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, + FILE_FLAG_NO_BUFFERING | + FILE_FLAG_RANDOM_ACCESS, NULL ); + return (this_gen->h_device_handle == NULL) ? -1 : 0; + } else - { - HMODULE hASPI = NULL; - long (*lpGetSupport)( void ) = NULL; - long (*lpSendCommand)( void* ) = NULL; - DWORD dwSupportInfo; - int i, j, i_hostadapters; - char c_drive = cdda_device[0]; - - hASPI = LoadLibrary( "wnaspi32.dll" ); - if( hASPI != NULL ) - { - (FARPROC) lpGetSupport = GetProcAddress( hASPI, - "GetASPI32SupportInfo" ); - (FARPROC) lpSendCommand = GetProcAddress( hASPI, - "SendASPI32Command" ); - } - - if( hASPI == NULL || lpGetSupport == NULL || lpSendCommand == NULL ) - { -#ifdef LOG - printf( "input_cdda: unable to load aspi or get aspi function pointers" ); -#endif - - if( hASPI ) FreeLibrary( hASPI ); - return -1; - } - - /* ASPI support seems to be there */ - - dwSupportInfo = lpGetSupport(); - - if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) - { -#ifdef LOG - printf( "input_cdda: no host adapters found (aspi)" ); -#endif - FreeLibrary( hASPI ); - return -1; - } - - if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) - { -#ifdef LOG - printf( "input_cdda: unable to initalize aspi layer" ); -#endif - FreeLibrary( hASPI ); - return -1; - } - - i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) ); - if( i_hostadapters == 0 ) - { - FreeLibrary( hASPI ); - return -1; - } + { + HMODULE hASPI = NULL; + long (*lpGetSupport)( void ) = NULL; + long (*lpSendCommand)( void* ) = NULL; + DWORD dwSupportInfo; + int i, j, i_hostadapters; + char c_drive = cdda_device[0]; + + hASPI = LoadLibrary( "wnaspi32.dll" ); + if( hASPI != NULL ) + { + (FARPROC) lpGetSupport = GetProcAddress( hASPI, + "GetASPI32SupportInfo" ); + (FARPROC) lpSendCommand = GetProcAddress( hASPI, + "SendASPI32Command" ); + } + + if( hASPI == NULL || lpGetSupport == NULL || lpSendCommand == NULL ) + { + lprintf( "unable to load aspi or get aspi function pointers" ); - c_drive = c_drive > 'Z' ? c_drive - 'a' : c_drive - 'A'; + if( hASPI ) FreeLibrary( hASPI ); + return -1; + } + + /* ASPI support seems to be there */ + + dwSupportInfo = lpGetSupport(); + + if( HIBYTE( LOWORD ( dwSupportInfo ) ) == SS_NO_ADAPTERS ) + { + lprintf( "no host adapters found (aspi)" ); + FreeLibrary( hASPI ); + return -1; + } + + if( HIBYTE( LOWORD ( dwSupportInfo ) ) != SS_COMP ) + { + lprintf( "unable to initalize aspi layer" ); - for( i = 0; i < i_hostadapters; i++ ) - { + FreeLibrary( hASPI ); + return -1; + } + + i_hostadapters = LOBYTE( LOWORD( dwSupportInfo ) ); + if( i_hostadapters == 0 ) + { + FreeLibrary( hASPI ); + return -1; + } + + c_drive = c_drive > 'Z' ? c_drive - 'a' : c_drive - 'A'; + + for( i = 0; i < i_hostadapters; i++ ) + { for( j = 0; j < 15; j++ ) - { + { struct SRB_GetDiskInfo srbDiskInfo; - + srbDiskInfo.SRB_Cmd = SC_GET_DISK_INFO; srbDiskInfo.SRB_HaId = i; srbDiskInfo.SRB_Flags = 0; @@ -2089,51 +2080,43 @@ static int cdda_open(cdda_input_plugin_t *this_gen, if( (srbDiskInfo.SRB_Status == SS_COMP) && (srbDiskInfo.SRB_Int13HDriveInfo == c_drive) ) - { + { /* Make sure this is a cdrom device */ struct SRB_GDEVBlock srbGDEVBlock; - + memset( &srbGDEVBlock, 0, sizeof(struct SRB_GDEVBlock) ); srbGDEVBlock.SRB_Cmd = SC_GET_DEV_TYPE; srbGDEVBlock.SRB_HaId = i; srbGDEVBlock.SRB_Target = j; - + lpSendCommand( (void*) &srbGDEVBlock ); - + if( ( srbGDEVBlock.SRB_Status == SS_COMP ) && ( srbGDEVBlock.SRB_DeviceType == DTYPE_CDROM ) ) - { + { this_gen->i_sid = MAKEWORD( i, j ); this_gen->hASPI = (long)hASPI; this_gen->lpSendCommand = lpSendCommand; - -#ifdef LOG - printf( "input_cdda: using aspi layer" ); -#endif - + + lprintf( "using aspi layer" ); + return 0; - } + } else - { - FreeLibrary( hASPI ); -#ifdef LOG - printf( "input_cdda: %s: is not a cdrom drive", - cdda_device[0] ); -#endif - return -1; - } - } - } - } - - FreeLibrary( hASPI ); - -#ifdef LOG - printf( "input_cdda: unable to get haid and target (aspi)" ); -#endif - + { + FreeLibrary( hASPI ); + lprintf( "%s: is not a cdrom drive", cdda_device[0] ); + return -1; + } + } + } + } + + FreeLibrary( hASPI ); + + lprintf( "unable to get haid and target (aspi)" ); } - + #endif /* WIN32 */ return -1; @@ -2307,9 +2290,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { char *cdda_device; int err = -1; -#ifdef LOG - printf("cdda_plugin_open\n"); -#endif + lprintf("cdda_plugin_open\n"); /* get the CD TOC */ toc = init_cdrom_toc(); @@ -2344,7 +2325,7 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { #endif #ifdef LOG - print_cdrom_toc(toc); + print_cdrom_toc(toc); #endif } @@ -2402,41 +2383,31 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { _cdda_cddb_grab_infos(this); if(this->cddb.disc_title) { -#ifdef LOG - printf("Disc Title: %s\n", this->cddb.disc_title); -#endif + lprintf("Disc Title: %s\n", this->cddb.disc_title); _x_meta_info_set(this->stream, XINE_META_INFO_ALBUM, this->cddb.disc_title); } if(this->cddb.track[this->track].title) { -#ifdef LOG - printf("Track %d Title: %s\n", this->track+1, this->cddb.track[this->track].title); -#endif + lprintf("Track %d Title: %s\n", this->track+1, this->cddb.track[this->track].title); _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, this->cddb.track[this->track].title); } if(this->cddb.disc_artist) { -#ifdef LOG - printf("Disc Artist: %s\n", this->cddb.disc_artist); -#endif + lprintf("Disc Artist: %s\n", this->cddb.disc_artist); _x_meta_info_set(this->stream, XINE_META_INFO_ARTIST, this->cddb.disc_artist); } if(this->cddb.disc_category) { -#ifdef LOG - printf("Disc Category: %s\n", this->cddb.disc_category); -#endif + lprintf("Disc Category: %s\n", this->cddb.disc_category); _x_meta_info_set(this->stream, XINE_META_INFO_GENRE, this->cddb.disc_category); } if(this->cddb.disc_year) { -#ifdef LOG - printf("Disc Year: %s\n", this->cddb.disc_year); -#endif + lprintf("Disc Year: %s\n", this->cddb.disc_year); _x_meta_info_set(this->stream, XINE_META_INFO_YEAR, this->cddb.disc_year); } @@ -2498,7 +2469,7 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, #endif /* WIN32 */ #ifdef LOG - print_cdrom_toc(toc); + print_cdrom_toc(toc); #endif cdda_close(ip); @@ -2532,9 +2503,7 @@ static input_plugin_t *cdda_class_get_instance (input_class_t *cls_gen, xine_str xine_cfg_entry_t enable_entry, server_entry, port_entry, cachedir_entry; char *cdda_device = NULL; -#ifdef LOG - printf("cdda_class_get_instance\n"); -#endif + lprintf("cdda_class_get_instance\n"); /* fetch the CD track to play */ if (!strncasecmp (mrl, "cdda:/", 6)) { diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 5aae8adc8..4f2850dc0 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -45,15 +45,17 @@ #include "dvb/dmx.h" #include "dvb/frontend.h" +#define LOG_MODULE "input_dvb" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - /* comment this out to have audio-only streams in the menu as well */ /* workaround for xine's unability to handle audio-only ts streams */ #define FILTER_RADIO_STREAMS @@ -471,9 +473,7 @@ static void dvb_event_handler (dvb_input_plugin_t *this) { while ((event = xine_event_get (this->event_queue))) { -#ifdef LOG - printf ("input_dvb: got event %08x\n", event->type); -#endif + lprintf ("got event %08x\n", event->type); if (this->fd<0) { xine_event_free (event); @@ -539,9 +539,7 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, dvb_event_handler (this); -#ifdef LOG - printf ("input_dvb: reading %lld bytes...\n", len); -#endif + lprintf ("reading %lld bytes...\n", len); nbc_check_buffers (this->nbc); @@ -550,10 +548,7 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, while (totalfd, &buf[total], len-total); -#ifdef LOG - printf ("input_dvb: got %lld bytes (%lld/%lld bytes read)\n", - n,total,len); -#endif + lprintf ("got %lld bytes (%lld/%lld bytes read)\n", n,total,len); if (n > 0){ this->curpos += n; @@ -598,10 +593,7 @@ static off_t dvb_plugin_seek (input_plugin_t *this_gen, off_t offset, dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; -#ifdef LOG - printf ("input_dvb: seek %lld bytes, origin %d\n", - offset, origin); -#endif + lprintf ("seek %lld bytes, origin %d\n", offset, origin); /* only relative forward-seeking is implemented */ @@ -867,9 +859,7 @@ static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { channels[num_channels].apid = strtoul(field, NULL, 0); -#ifdef LOG - printf ("input: dvb channel %s loaded\n", channels[num_channels].name); -#endif + lprintf ("dvb channel %s loaded\n", channels[num_channels].name); num_channels++; } @@ -1048,9 +1038,7 @@ static void *init_class (xine_t *xine, void *data) { this->mrls[0] = "dvb://"; this->mrls[1] = 0; -#ifdef LOG - printf ("input_dvb: init class succeeded\n"); -#endif + lprintf ("init class succeeded\n"); return this; } diff --git a/src/input/input_file.c b/src/input/input_file.c index c0e476413..d05a9ba83 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.86 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: input_file.c,v 1.87 2003/11/26 19:43:31 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -34,6 +34,12 @@ #include #include +#define LOG_MODULE "input_file" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -236,9 +242,8 @@ static int file_plugin_open (input_plugin_t *this_gen ) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; char *filename; - #ifdef LOG - printf("file_plugin_open\n"); - #endif + lprintf("file_plugin_open\n"); + if (strncasecmp (this->mrl, "file:", 5) == 0) filename = decode_uri(&(this->mrl[5])); else @@ -270,9 +275,7 @@ static input_plugin_t *file_class_get_instance (input_class_t *cls_gen, xine_str file_input_plugin_t *this; char *mrl = strdup(data); - #ifdef LOG - printf("file_class_get_instance\n"); - #endif + lprintf("file_class_get_instance\n"); if ((strncasecmp (mrl, "file:", 5)) && strstr (mrl, ":/") && (strstr (mrl, ":/") < strchr(mrl, '/'))) { free (mrl); @@ -426,9 +429,7 @@ static uint32_t get_file_type(char *filepathname, char *origin, xine_t *xine) { if((lstat(filepathname, &pstat)) < 0) { sprintf(buf, "%s/%s", origin, filepathname); if((lstat(buf, &pstat)) < 0) { -#ifdef LOG - printf ("lstat failed for %s{%s}\n", filepathname, origin); -#endif + lprintf ("lstat failed for %s{%s}\n", filepathname, origin); file_type |= mrl_unknown; return file_type; } diff --git a/src/input/input_http.c b/src/input/input_http.c index e1a7bb9fa..95ee7422b 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.75 2003/11/26 08:09:58 tmattern Exp $ + * $Id: input_http.c,v 1.76 2003/11/26 19:43:31 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -42,16 +42,18 @@ #include +#define LOG_MODULE "input_http" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" #include "net_buf_ctrl.h" #include "http_helper.h" -/* -#define LOG -*/ - #define BUFSIZE 1024 #define DEFAULT_HTTP_PORT 80 @@ -216,14 +218,14 @@ static void http_plugin_read_metainf (input_plugin_t *this_gen) { /* get the length of the metadata */ this_gen->read(this_gen, &len, 1); - lprintf ("input_http: http_plugin_read_metainf: len=%d\n", len); + lprintf ("http_plugin_read_metainf: len=%d\n", len); if (len > 0) { this_gen->read(this_gen, metadata_buf, len * 16); metadata_buf[len * 16] = '\0'; - lprintf ("input_http: http_plugin_read_metainf: %s\n", metadata_buf); + lprintf ("http_plugin_read_metainf: %s\n", metadata_buf); /* Extract the title of the current song */ if ((songtitle = strstr(metadata_buf, "StreamTitle='"))) { @@ -235,7 +237,7 @@ static void http_plugin_read_metainf (input_plugin_t *this_gen) { (strcmp(songtitle, this->shoutcast_songtitle))) && (strlen(songtitle) > 0)) { - lprintf ("input_http: http_plugin_read_metainf: songtitle: %s\n", songtitle); + lprintf ("http_plugin_read_metainf: songtitle: %s\n", songtitle); if (this->shoutcast_songtitle) free(this->shoutcast_songtitle); @@ -288,7 +290,7 @@ static off_t http_plugin_read (input_plugin_t *this_gen, if (n > (nlen - num_bytes)) n = nlen - num_bytes; - lprintf ("input_http: %lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); + lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); if (this->shoutcast_mode) { if ((this->shoutcast_pos + n) >= this->shoutcast_metaint) { @@ -376,7 +378,7 @@ static int read_shoutcast_header(http_input_plugin_t *this) { linenum++; - lprintf ("input_http: shoutcast answer: >%s<\n", this->buf); + lprintf ("shoutcast answer: >%s<\n", this->buf); if (!strncasecmp(this->buf, "icy-name:", 9)) { _x_meta_info_set(this->stream, XINE_META_INFO_ALBUM, @@ -398,7 +400,7 @@ static int read_shoutcast_header(http_input_plugin_t *this) { /* metadata interval (in byte) */ if (sscanf(this->buf, "icy-metaint:%d", &this->shoutcast_metaint) == 1) { - lprintf("input_http: shoutcast_metaint: %d\n", this->shoutcast_metaint); + lprintf("shoutcast_metaint: %d\n", this->shoutcast_metaint); } if (len == -1) @@ -409,7 +411,7 @@ static int read_shoutcast_header(http_input_plugin_t *this) { len ++; } - lprintf ("input_http: end of the shoutcast header\n"); + lprintf ("end of the shoutcast header\n"); return 0; } @@ -680,7 +682,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { return 0; } - lprintf ("input_http: request sent: >%s<\n", this->buf); + lprintf ("request sent: >%s<\n", this->buf); /* read and parse reply */ done = 0; len = 0; linenum = 0; @@ -708,7 +710,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { linenum++; - lprintf ("input_http: answer: >%s<\n", this->buf); + lprintf ("answer: >%s<\n", this->buf); if (linenum == 1) { int httpver, httpsub; @@ -755,7 +757,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (!strncasecmp(this->buf, "Location: ", 10)) { char *href = (this->buf + 10); - lprintf ("input_http: trying to open target of redirection: >%s<\n", href); + lprintf ("trying to open target of redirection: >%s<\n", href); free(this->mrl); this->mrl = strdup(href); @@ -771,7 +773,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { len ++; } - lprintf ("input_http: end of headers\n"); + lprintf ("end of headers\n"); /* * fill preview buffer diff --git a/src/input/input_mms.c b/src/input/input_mms.c index bd427855a..faa0933fd 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.41 2003/10/22 12:04:42 hadess Exp $ + * $Id: input_mms.c,v 1.42 2003/11/26 19:43:31 f1rmb Exp $ * * mms input plugin based on work from major mms */ @@ -37,6 +37,12 @@ #include #include "bswap.h" +#define LOG_MODULE "input_mms" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" @@ -45,10 +51,6 @@ #include "mmsh.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - #define PROTOCOL_UNDEFINED 0 #define PROTOCOL_MMST 1 #define PROTOCOL_MMSH 2 @@ -102,10 +104,7 @@ static off_t mms_plugin_read (input_plugin_t *this_gen, mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t n = 0; -#ifdef LOG - printf ("input_mms: mms_plugin_read: %lld bytes ...\n", - len); -#endif + lprintf ("mms_plugin_read: %lld bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -129,10 +128,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; -#ifdef LOG - printf ("input_mms: mms_plugin_read_block: %lld bytes...\n", - todo); -#endif + lprintf ("mms_plugin_read_block: %lld bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -153,10 +149,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t dest = this->curpos; -#ifdef LOG - printf ("input_mms: mms_plugin_seek: %lld offset, %d origin...\n", - offset, origin); -#endif + lprintf ("mms_plugin_seek: %lld offset, %d origin...\n", offset, origin); switch (origin) { case SEEK_SET: @@ -222,9 +215,7 @@ static off_t mms_plugin_get_length (input_plugin_t *this_gen) { break; } -#ifdef LOG - printf ("input_mms: length is %lld\n", length); -#endif + lprintf ("length is %lld\n", length); return length; @@ -306,9 +297,8 @@ static int mms_plugin_get_optional_data (input_plugin_t *this_gen, static void bandwidth_changed_cb (void *this_gen, xine_cfg_entry_t *entry) { mms_input_class_t *class = (mms_input_class_t*) this_gen; -#ifdef LOG - printf ("input_mms: bandwidth_changed_cb %d\n", entry->num_value); -#endif + lprintf ("bandwidth_changed_cb %d\n", entry->num_value); + if(!class) return; @@ -362,9 +352,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre xine_cfg_entry_t bandwidth_entry; int protocol; -#ifdef LOG - printf ("input_mms: trying to open '%s'\n", mrl); -#endif + lprintf ("trying to open '%s'\n", mrl); if (!strncasecmp (mrl, "mms://", 6)) { protocol = PROTOCOL_UNDEFINED; diff --git a/src/input/input_net.c b/src/input/input_net.c index 17854b86b..666a33a1a 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -20,7 +20,7 @@ * Read from a tcp network stream over a lan (put a tweaked mp1e encoder the * other end and you can watch tv anywhere in the house ..) * - * $Id: input_net.c,v 1.54 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: input_net.c,v 1.55 2003/11/26 19:43:31 f1rmb Exp $ * * how to set up mp1e for use with this plugin: * @@ -62,15 +62,17 @@ #include #include +#define LOG_MODULE "input_net" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - #define NET_BS_LEN 2324 #define BUFSIZE 1024 @@ -213,9 +215,7 @@ static int host_connect(const char *host, int port, xine_t *xine) { snprintf(strport, sizeof(strport), "%d", port); -#ifdef LOG - printf("Resolving host '%s' at port '%s'\n", host, strport); -#endif + lprintf("Resolving host '%s' at port '%s'\n", host, strport); error = getaddrinfo(host, strport, &hints, &res); @@ -254,19 +254,15 @@ static off_t net_plugin_read (input_plugin_t *this_gen, net_input_plugin_t *this = (net_input_plugin_t *) this_gen; off_t n, total; -#ifdef LOG - printf ("input_net: reading %d bytes...\n", len); -#endif + lprintf ("reading %d bytes...\n", len); total=0; if (this->curpos < this->preview_size) { n = this->preview_size - this->curpos; if (n > (len - total)) n = len - total; -#ifdef LOG - printf ("input_net: %lld bytes from preview (which has %lld bytes)\n", - n, this->preview_size); -#endif + + lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); memcpy (&buf[total], &this->preview[this->curpos], n); this->curpos += n; @@ -276,10 +272,7 @@ static off_t net_plugin_read (input_plugin_t *this_gen, if( (len-total) > 0 ) { n = _x_read_abort (this->stream, this->fh, &buf[total], len-total); -#ifdef LOG - printf ("input_net: got %lld bytes (%lld/%lld bytes read)\n", - n,total,len); -#endif + printf ("input_net: got %lld bytes (%lld/%lld bytes read)\n", n,total,len); if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, this->host_port, NULL); diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index a15bb7745..2f4c61557 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -35,6 +35,12 @@ #include #include "bswap.h" +#define LOG_MODULE "input_pnm" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" @@ -42,10 +48,6 @@ #include "pnm.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - #define BUFSIZE 4096 #if !defined(NDELAY) && defined(O_NDELAY) @@ -82,10 +84,7 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen, pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; off_t n; -#ifdef LOG - printf ("pnm_plugin_read: %lld bytes ...\n", - len); -#endif + lprintf ("pnm_plugin_read: %lld bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -101,10 +100,7 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; -#ifdef LOG - printf ("pnm_plugin_read_block: %lld bytes...\n", - todo); -#endif + lprintf ("pnm_plugin_read_block: %lld bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -211,12 +207,9 @@ static int pnm_plugin_get_optional_data (input_plugin_t *this_gen, static int pnm_plugin_open (input_plugin_t *this_gen) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; - pnm_t *pnm; -#ifdef LOG - printf ("input_pnm: trying to open '%s'\n", this->mrl); -#endif + lprintf ("trying to open '%s'\n", this->mrl); pnm = pnm_connect (this->stream, this->mrl); diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index b54e696ba..8c6d8527c 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -38,7 +38,7 @@ * usage: * xine pvr:/\!\! * - * $Id: input_pvr.c,v 1.36 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: input_pvr.c,v 1.37 2003/11/26 19:43:31 f1rmb Exp $ */ /************************************************************************** @@ -115,6 +115,12 @@ #define XINE_ENABLE_EXPERIMENTAL_FEATURES +#define LOG_MODULE "input_pvr" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "compat.h" @@ -132,7 +138,6 @@ #define NUM_PREVIEW_BUFFERS 250 /* used in mpeg_block demuxer */ -#define LOG 1 /* #define SCRLOG 1 */ @@ -605,9 +610,7 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) { filename = make_temp_name(this, this->rec_page); -#ifdef LOG - printf("input_pvr: opening pvr file for writing (%s)\n", filename); -#endif + lprintf("opening pvr file for writing (%s)\n", filename); this->rec_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666 ); if( this->rec_fd == -1 ) { @@ -624,9 +627,7 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) { filename = make_temp_name(this, this->first_page); -#ifdef LOG - printf("input_pvr: erasing old pvr file (%s)\n", filename); -#endif + lprintf("erasing old pvr file (%s)\n", filename); this->first_page++; if(this->play_fd != -1 && this->play_page < this->first_page) { @@ -699,15 +700,12 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t close(this->play_fd); this->play_fd = -1; -#ifdef LOG - printf("input_pvr: switching back to realtime\n"); -#endif + lprintf("switching back to realtime\n"); + pvr_report_realtime(this,1); } else if (this->new_session) { -#ifdef LOG - printf("input_pvr: starting new session in realtime\n"); -#endif + lprintf("starting new session in realtime\n"); pvr_report_realtime(this,1); } @@ -730,9 +728,8 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t (this->rec_page > this->play_page && this->play_blk >= this->page_block[this->play_page+1]) ) { if(this->play_fd == -1) { -#ifdef LOG - printf("input_pvr: switching to non-realtime\n"); -#endif + lprintf("switching to non-realtime\n"); + pvr_report_realtime(this,0); } @@ -765,9 +762,7 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t filename = make_temp_name(this, this->play_page); -#ifdef LOG - printf("input_pvr: opening pvr file for reading (%s)\n", filename); -#endif + lprintf("opening pvr file for reading (%s)\n", filename); this->play_fd = open(filename, O_RDONLY ); if( this->play_fd == -1 ) { @@ -852,9 +847,8 @@ static void *pvr_loop (void *this_gen) { } if( this->data[0] || this->data[1] || this->data[2] != 1 || this->data[3] != 0xba ) { -#ifdef LOG - printf("input_pvr: resyncing mpeg stream\n"); -#endif + lprintf("resyncing mpeg stream\n"); + if( !pvr_mpeg_resync(this->dev_fd) ) { this->pvr_running = 0; } else { @@ -900,9 +894,7 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { char *dst_filename; uint32_t i; -#ifdef LOG - printf("input_pvr: finish_recording\n"); -#endif + lprintf("finish_recording\n"); if( this->rec_fd != -1 ) { close(this->rec_fd); @@ -922,9 +914,8 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { src_filename = make_temp_name(this, i); if( this->save_page == -1 || i < this->save_page ) { -#ifdef LOG - printf("input_pvr: erasing old pvr file (%s)\n", src_filename); -#endif + lprintf("erasing old pvr file (%s)\n", src_filename); + remove(src_filename); } else { @@ -933,9 +924,8 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { else dst_filename = make_save_name(this, this->save_name, i-this->save_page+1); -#ifdef LOG - printf("input_pvr: moving (%s) to (%s)\n", src_filename, dst_filename); -#endif + lprintf("moving (%s) to (%s)\n", src_filename, dst_filename); + rename(src_filename,dst_filename); free(dst_filename); } @@ -952,9 +942,8 @@ static void pvr_finish_recording (pvr_input_plugin_t *this) { show->pages = this->rec_page - this->save_page + 1; xine_list_append_content (this->saved_shows, show); -#ifdef LOG - printf("input_pvr: sending event with base name [%s]\n", show->base_name); -#endif + lprintf("sending event with base name [%s]\n", show->base_name); + /* tell frontend the name of the saved show */ event.type = XINE_EVENT_PVR_REPORT_NAME; event.stream = this->stream; @@ -1042,12 +1031,11 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { this->input = v4l2_data->input; this->channel = v4l2_data->channel; this->frequency = v4l2_data->frequency; -#ifdef LOG - printf("input_pvr: switching to input:%d chan:%d freq:%.2f\n", - v4l2_data->input, - v4l2_data->channel, - (float)v4l2_data->frequency * 62.5); -#endif + + lprintf("switching to input:%d chan:%d freq:%.2f\n", + v4l2_data->input, + v4l2_data->channel, + (float)v4l2_data->frequency * 62.5); pthread_mutex_lock(&this->dev_lock); #ifdef USE_V4L2 @@ -1088,9 +1076,8 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { if( this->session != -1 ) { switch( save_data->mode ) { case 0: -#ifdef LOG - printf("input_pvr: saving from this point\n"); -#endif + lprintf("saving from this point\n"); + pthread_mutex_lock(&this->lock); pvr_break_rec_page(this); this->save_page = this->rec_page; @@ -1098,17 +1085,15 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { pthread_mutex_unlock(&this->lock); break; case 1: -#ifdef LOG - printf("input_pvr: saving from show start\n"); -#endif + lprintf("saving from show start\n"); + pthread_mutex_lock(&this->lock); this->save_page = this->show_page; pthread_mutex_unlock(&this->lock); break; case 2: -#ifdef LOG - printf("input_pvr: saving everything so far\n"); -#endif + lprintf("saving everything so far\n"); + pthread_mutex_lock(&this->lock); this->save_page = this->first_page; pthread_mutex_unlock(&this->lock); @@ -1142,9 +1127,9 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { src_filename = make_save_name(this, show->base_name, i+1); dst_filename = make_save_name(this, save_data->name, i+1); -#ifdef LOG - printf("input_pvr: moving (%s) to (%s)\n", src_filename, dst_filename); -#endif + + lprintf("moving (%s) to (%s)\n", src_filename, dst_filename); + rename(src_filename,dst_filename); free(dst_filename); free(src_filename); @@ -1366,18 +1351,16 @@ static void pvr_plugin_dispose (input_plugin_t *this_gen ) { saved_show_t *show; if( this->pvr_running ) { -#ifdef LOG - printf("input_pvr: finishing pvr thread\n"); -#endif + lprintf("finishing pvr thread\n"); + pthread_mutex_lock(&this->lock); this->pvr_running = 0; this->want_data = 0; pthread_cond_signal (&this->wake_pvr); pthread_mutex_unlock(&this->lock); pthread_join (this->pvr_thread, &p); -#ifdef LOG - printf("input_pvr: pvr thread joined\n"); -#endif + + lprintf("pvr thread joined\n"); } if (this->scr) { @@ -1521,11 +1504,9 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre this->save_prefix=strdup("./"); } -#ifdef LOG - printf("input_pvr: tmp_prefix=%s\n", this->tmp_prefix); - printf("input_pvr: save_prefix=%s\n", this->save_prefix); - printf("input_pvr: max_page_age=%d\n", this->max_page_age); -#endif + lprintf("tmp_prefix=%s\n", this->tmp_prefix); + lprintf("save_prefix=%s\n", this->save_prefix); + lprintf("max_page_age=%d\n", this->max_page_age); this->input_plugin.open = pvr_plugin_open; this->input_plugin.get_capabilities = pvr_plugin_get_capabilities; diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index e8fa2aa68..d67567c93 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -79,27 +79,25 @@ #include #include +#define LOG_MODULE "input_rtp" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" #ifdef __GNUC__ -#define LOG_MSG_STDERR(xine, message, args...) { \ - xine_log(xine, XINE_LOG_MSG, message, ##args); \ - fprintf(stderr, message, ##args); \ - } -#define LOG_MSG(xine, message, args...) { \ - xine_log(xine, XINE_LOG_MSG, message, ##args); \ - printf(message, ##args); \ +#define LOG_MSG(xine, message, args...) { \ + xine_log(xine, XINE_LOG_MSG, message, ##args); \ + lprintf(message, ##args); \ } #else -#define LOG_MSG_STDERR(xine, ...) { \ - xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ - fprintf(stderr, __VA_ARGS__); \ - } -#define LOG_MSG(xine, ...) { \ - xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ - printf(__VA_ARGS__); \ +#define LOG_MSG(xine, ...) { \ + xine_log(xine, XINE_LOG_MSG, __VA_ARGS__); \ + lprintf(__VA_ARGS__); \ } #endif @@ -164,7 +162,7 @@ static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) { int optval; if(s == -1) { - LOG_MSG_STDERR(xine, _("socket(): %s.\n"), strerror(errno)); + LOG_MSG(xine, _("socket(): %s.\n"), strerror(errno)); return -1; } @@ -176,13 +174,13 @@ static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) { optval = 1024 * 1024; if ((setsockopt(s, SOL_SOCKET, SO_RCVBUF, &optval, sizeof(optval))) < 0) { - LOG_MSG_STDERR(xine, _("setsockopt(SO_RCVBUF): %s.\n"), strerror(errno)); + LOG_MSG(xine, _("setsockopt(SO_RCVBUF): %s.\n"), strerror(errno)); return -1; } /* datagram socket */ if (bind(s, (struct sockaddr *)&sin, sizeof(sin))) { - LOG_MSG_STDERR(xine, _("bind(): %s.\n"), strerror(errno)); + LOG_MSG(xine, _("bind(): %s.\n"), strerror(errno)); return -1; } @@ -201,8 +199,8 @@ static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) { mreqn.imr_interface.s_addr = INADDR_ANY; #endif if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,&mreqn,sizeof(mreqn))) { - LOG_MSG_STDERR(xine, _("setsockopt(IP_ADD_MEMBERSHIP) failed (multicast kernel?): %s.\n"), - strerror(errno)); + LOG_MSG(xine, _("setsockopt(IP_ADD_MEMBERSHIP) failed (multicast kernel?): %s.\n"), + strerror(errno)); return -1; } } @@ -221,7 +219,7 @@ static int host_connect(const char *host, int port, xine_t *xine) { h=gethostbyname(host); if(h==NULL) { - LOG_MSG_STDERR(xine, _("unable to resolve '%s'.\n"), host); + LOG_MSG(xine, _("unable to resolve '%s'.\n"), host); return -1; } @@ -234,7 +232,7 @@ static int host_connect(const char *host, int port, xine_t *xine) { if(s != -1) return s; } - LOG_MSG_STDERR(xine, _("unable to bind to '%s'.\n"), host); + LOG_MSG(xine, _("unable to bind to '%s'.\n"), host); return -1; } @@ -262,8 +260,7 @@ static void * input_plugin_read_loop(void *arg) { { if (errno != EINTR) { - LOG_MSG_STDERR(this->stream->xine, - _("recv(): %s.\n"), strerror(errno)); + LOG_MSG(this->stream->xine, _("recv(): %s.\n"), strerror(errno)); return NULL; } } @@ -569,9 +566,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen ) { if ((err = pthread_create(&this->reader_thread, NULL, input_plugin_read_loop, (void *)this)) != 0) { - LOG_MSG_STDERR(this->stream->xine, - _("input_rtp: can't create new thread (%s)\n"), - strerror(err)); + LOG_MSG(this->stream->xine, _("input_rtp: can't create new thread (%s)\n"), strerror(err)); abort(); } diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 41e27c437..671bff710 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -35,6 +35,12 @@ #include #include "bswap.h" +#define LOG_MODULE "input_rtsp" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" @@ -42,10 +48,6 @@ #include "librtsp/rtsp_session.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - #define BUFSIZE 1025 #if !defined(NDELAY) && defined(O_NDELAY) @@ -83,10 +85,7 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen, rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t n; -#ifdef LOG - printf ("rtsp_plugin_read: %lld bytes ...\n", - len); -#endif + lprintf ("rtsp_plugin_read: %lld bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -102,10 +101,7 @@ static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; -#ifdef LOG - printf ("rtsp_plugin_read_block: %lld bytes...\n", - todo); -#endif + lprintf ("rtsp_plugin_read_block: %lld bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -126,10 +122,7 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; -#ifdef LOG - printf ("input_rtsp: seek %lld bytes, origin %d\n", - offset, origin); -#endif + lprintf ("seek %lld bytes, origin %d\n", offset, origin); /* only realtive forward-seeking is implemented */ @@ -221,16 +214,13 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { rtsp_session_t *rtsp; -#ifdef LOG - printf ("input_rtsp: trying to open '%s'\n", this->mrl); -#endif + lprintf ("trying to open '%s'\n", this->mrl); rtsp = rtsp_session_start(this->stream,this->mrl); if (!rtsp) { -#ifdef LOG - printf ("input_rtsp: returning null.\n"); -#endif + lprintf ("returning null.\n"); + return 0; } diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index ccbd5bfe4..ddd8456c4 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.53 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: input_stdin_fifo.c,v 1.54 2003/11/26 19:43:31 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -32,15 +32,17 @@ #include #include +#define LOG_MODULE "input_stdin_fifo" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "input_plugin.h" #include "net_buf_ctrl.h" -/* -#define LOG -*/ - #define BUFSIZE 1024 typedef struct { @@ -76,19 +78,14 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; off_t n, total; -#ifdef LOG - printf ("stdin: reading %lld bytes...\n", len); -#endif + lprintf ("reading %lld bytes...\n", len); total=0; if (this->curpos < this->preview_size) { n = this->preview_size - this->curpos; if (n > (len - total)) n = len - total; -#ifdef LOG - printf ("stdin: %lld bytes from preview (which has %lld bytes)\n", - n, this->preview_size); -#endif + lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); memcpy (&buf[total], &this->preview[this->curpos], n); this->curpos += n; @@ -98,10 +95,7 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, if( (len-total) > 0 ) { n = _x_io_file_read (this->stream, this->fh, &buf[total], len - total); -#ifdef LOG - printf ("stdin: got %lld bytes (%lld/%lld bytes read)\n", - n,total,len); -#endif + lprintf ("got %lld bytes (%lld/%lld bytes read)\n", n,total,len); if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, NULL); @@ -143,10 +137,7 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; -#ifdef LOG - printf ("stdin: seek %lld offset, %d origin...\n", - offset, origin); -#endif + lprintf ("seek %lld offset, %d origin...\n", offset, origin); if ((origin == SEEK_CUR) && (offset >= 0)) { @@ -241,10 +232,7 @@ static int stdin_plugin_get_optional_data (input_plugin_t *this_gen, static int stdin_plugin_open (input_plugin_t *this_gen ) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; -#ifdef LOG - printf ("input_stdin_fifo: trying to open '%s'...\n", - this->mrl); -#endif + lprintf ("trying to open '%s'...\n", this->mrl); if (this->fh == -1) { char *filename; @@ -252,9 +240,7 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { filename = (char *) &this->mrl[5]; this->fh = open (filename, O_RDONLY); -#ifdef LOG - printf("input_stdin_fifo: filename '%s'\n", filename); -#endif + lprintf("filename '%s'\n", filename); if (this->fh == -1) { printf ("stdin: failed to open '%s'\n", @@ -301,9 +287,9 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_st filename = (char *) &mrl[5]; fh = -1; -#ifdef LOG - printf("input_stdin_fifo: filename '%s'\n", filename); -#endif + + lprintf("filename '%s'\n", filename); + } else { free (mrl); return NULL; diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index e6a17f3dc..94f6e6ad1 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -91,7 +91,7 @@ static struct { #define PLUGIN "input_v4l" #ifdef LOG -#define DBGPRINT(args...) printf(PLUGIN ": " args); fflush(stdout) +#define DBGPRINT(args...) do { printf(PLUGIN ": " args); fflush(stdout); } while(0) #else #define DBGPRINT(args...) {} #endif diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 49d3e63e5..928e137fb 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: asmrp.c,v 1.3 2003/10/12 18:52:55 mroi Exp $ + * $Id: asmrp.c,v 1.4 2003/11/26 19:43:31 f1rmb Exp $ * * a parser for real's asm rules * @@ -38,12 +38,15 @@ #include #include -#include "asmrp.h" - +#define LOG_MODULE "asmrp" +#define LOG_VERBOSE /* #define LOG */ +#include "asmrp.h" +#include "xineutils.h" + #define ASMRP_SYM_NONE 0 #define ASMRP_SYM_EOF 1 @@ -120,9 +123,7 @@ static void asmrp_getch (asmrp_t *p) { p->ch = p->buf[p->pos]; p->pos++; -#ifdef LOG - printf ("%c\n", p->ch); -#endif + lprintf ("%c\n", p->ch); } @@ -382,17 +383,13 @@ static int asmrp_set_id (asmrp_t *p, char *s, int v) { p->sym_tab_num++; p->sym_tab[i].id = strdup (s); -#ifdef LOG - printf ("new symbol '%s'\n", s); -#endif + lprintf ("new symbol '%s'\n", s); } p->sym_tab[i].v = v; -#ifdef LOG - printf ("symbol '%s' assigned %d\n", s, v); -#endif + lprintf ("symbol '%s' assigned %d\n", s, v); return i; } @@ -403,9 +400,7 @@ static int asmrp_operand (asmrp_t *p) { int i, ret; -#ifdef LOG - printf ("operand\n"); -#endif + lprintf ("operand\n"); ret = 0; @@ -453,9 +448,7 @@ static int asmrp_operand (asmrp_t *p) { abort(); } -#ifdef LOG - printf ("operand done, =%d\n", ret); -#endif + lprintf ("operand done, =%d\n", ret); return ret; } @@ -464,9 +457,7 @@ static int asmrp_comp_expression (asmrp_t *p) { int a; -#ifdef LOG - printf ("comp_expression\n"); -#endif + lprintf ("comp_expression\n"); a = asmrp_operand (p); @@ -502,9 +493,8 @@ static int asmrp_comp_expression (asmrp_t *p) { } -#ifdef LOG - printf ("comp_expression done = %d\n", a); -#endif + lprintf ("comp_expression done = %d\n", a); + return a; } @@ -512,9 +502,7 @@ static int asmrp_condition (asmrp_t *p) { int a; -#ifdef LOG - printf ("condition\n"); -#endif + lprintf ("condition\n"); a = asmrp_comp_expression (p); @@ -537,17 +525,14 @@ static int asmrp_condition (asmrp_t *p) { } } -#ifdef LOG - printf ("condition done = %d\n", a); -#endif + lprintf ("condition done = %d\n", a); + return a; } static void asmrp_assignment (asmrp_t *p) { -#ifdef LOG - printf ("assignment\n"); -#endif + lprintf ("assignment\n"); if (p->sym != ASMRP_SYM_ID) { printf ("error: identifier expected\n"); @@ -568,18 +553,14 @@ static void asmrp_assignment (asmrp_t *p) { } asmrp_get_sym (p); -#ifdef LOG - printf ("assignment done\n"); -#endif + lprintf ("assignment done\n"); } static int asmrp_rule (asmrp_t *p) { int ret; -#ifdef LOG - printf ("rule\n"); -#endif + lprintf ("rule\n"); ret = 1; @@ -606,9 +587,7 @@ static int asmrp_rule (asmrp_t *p) { } } -#ifdef LOG - printf ("rule done = %d\n", ret); -#endif + lprintf ("rule done = %d\n", ret); if (p->sym != ASMRP_SYM_SEMICOLON) { printf ("semicolon expected.\n"); @@ -624,9 +603,7 @@ static int asmrp_eval (asmrp_t *p, int *matches) { int rule_num, num_matches; -#ifdef LOG - printf ("eval\n"); -#endif + lprintf ("eval\n"); asmrp_get_sym (p); @@ -634,9 +611,8 @@ static int asmrp_eval (asmrp_t *p, int *matches) { while (p->sym != ASMRP_SYM_EOF) { if (asmrp_rule (p)) { -#ifdef LOG - printf ("rule #%d is true\n", rule_num); -#endif + lprintf ("rule #%d is true\n", rule_num); + matches[num_matches] = rule_num; num_matches++; } diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 8122e169b..1cba7720b 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: real.c,v 1.8 2003/03/30 17:11:50 holstsn Exp $ + * $Id: real.c,v 1.9 2003/11/26 19:43:31 f1rmb Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -27,15 +27,17 @@ #include #include -#include "real.h" -#include "asmrp.h" -#include "sdpplin.h" -#include - +#define LOG_MODULE "real" +#define LOG_VERBOSE /* #define LOG */ +#include "real.h" +#include "asmrp.h" +#include "sdpplin.h" +#include "xineutils.h" + const unsigned char xor_table[] = { 0x05, 0x18, 0x74, 0xd0, 0x0d, 0x09, 0x02, 0x53, 0xc0, 0x01, 0x05, 0x05, 0x67, 0x03, 0x19, 0x70, @@ -91,10 +93,10 @@ static void hash(char *field, char *param) { memcpy(&b, &field[4], sizeof(uint32_t)); memcpy(&c, &field[8], sizeof(uint32_t)); memcpy(&d, &field[12], sizeof(uint32_t)); - + + lprintf("hash input: %x %x %x %x\n", a, b, c, d); + lprintf("hash parameter:\n"); #ifdef LOG - printf("real: hash input: %x %x %x %x\n", a, b, c, d); - printf("real: hash parameter:\n"); hexdump(param, 64); #endif @@ -230,9 +232,7 @@ static void hash(char *field, char *param) { b = ((~a | c) ^ d) + *((uint32_t*)(param+0x24)) + b - 0x14792C6F; b = ((b << 0x15) | (b >> 0x0b)) + c; -#ifdef LOG - printf("real: hash output: %x %x %x %x\n", a, b, c, d); -#endif + lprintf("hash output: %x %x %x %x\n", a, b, c, d); *((uint32_t *)(field+0)) += a; *((uint32_t *)(field+4)) += b; @@ -255,9 +255,7 @@ static void call_hash (char *key, char *challenge, int len) { if (a < (len << 3)) { -#ifdef LOG - printf("not verified: (len << 3) > a true\n"); -#endif + lprintf("not verified: (len << 3) > a true\n"); ptr2 += 4; } @@ -273,10 +271,7 @@ static void call_hash (char *key, char *challenge, int len) { d = c + 0x3f; while ( d < len ) { - -#ifdef LOG - printf("not verified: while ( d < len )\n"); -#endif + lprintf("not verified: while ( d < len )\n"); hash(key, challenge+d-0x3f); d += 64; c += 64; @@ -303,9 +298,7 @@ static void calc_response (char *result, char *field) { if (i < 56) { i = 56 - i; } else { -#ifdef LOG - printf("not verified: ! (i < 56)\n"); -#endif + lprintf("not verified: ! (i < 56)\n"); i = 120 - i; } @@ -422,9 +415,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection ||(mlti_chunk[2] != 'T') ||(mlti_chunk[3] != 'I')) { -#ifdef LOG - printf("libreal: MLTI tag not detected, copying data\n"); -#endif + lprintf("MLTI tag not detected, copying data\n"); memcpy(out, mlti_chunk, mlti_size); return mlti_size; } @@ -503,9 +494,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth desc->abstract); header->data=rmff_new_dataheader(0,0); header->streams=xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); -#ifdef LOG - printf("number of streams: %u\n", desc->stream_count); -#endif + lprintf("number of streams: %u\n", desc->stream_count); for (i=0; istream_count; i++) { @@ -514,14 +503,11 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth char b[64]; int rulematches[16]; -#ifdef LOG - printf("calling asmrp_match with:\n%s\n%u\n", desc->stream[i]->asm_rule_book, bandwidth); -#endif + lprintf("calling asmrp_match with:\n%s\n%u\n", desc->stream[i]->asm_rule_book, bandwidth); + n=asmrp_match(desc->stream[i]->asm_rule_book, bandwidth, rulematches); for (j=0; jstream[i]->stream_id); -#endif + lprintf("asmrp rule match: %u for stream %u\n", rulematches[j], desc->stream[i]->stream_id); sprintf(b,"stream=%u;rule=%u,", desc->stream[i]->stream_id, rulematches[j]); strcat(stream_rules, b); } @@ -596,16 +582,14 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { flags1=header[4]; if ((flags1!=0x40)&&(flags1!=0x42)) { -#ifdef LOG - printf("got flags1: 0x%02x\n",flags1); -#endif + lprintf("got flags1: 0x%02x\n",flags1); header[0]=header[5]; header[1]=header[6]; header[2]=header[7]; n=rtsp_read_data(rtsp_session, header+3, 5); if (n<5) return 0; + lprintf("ignoring bytes:\n"); #ifdef LOG - printf("ignoring bytes:\n"); hexdump(header, 8); #endif n=rtsp_read_data(rtsp_session, header+4, 4); @@ -618,10 +602,9 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { if (n<6) return 0; ts=BE_32(header); -#ifdef LOG - printf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n", + lprintf("ts: %u size: %u, flags: 0x%02x, unknown values: %u 0x%02x 0x%02x\n", ts, size, flags1, unknown1, header[4], header[5]); -#endif + size+=2; ph.object_version=0; @@ -653,9 +636,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid /* get challenge */ challenge1=strdup(rtsp_search_answers(rtsp_session,"RealChallenge1")); -#ifdef LOG - printf("real: Challenge1: %s\n", challenge1); -#endif + lprintf("Challenge1: %s\n", challenge1); /* request stream description */ rtsp_schedule_field(rtsp_session, "Accept: application/sdp"); @@ -691,9 +672,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid else session_id=strdup(rtsp_search_answers(rtsp_session,"ETag")); -#ifdef LOG - printf("real: Stream description size: %i\n", size); -#endif + lprintf("Stream description size: %i\n", size); description=malloc(sizeof(char)*(size+1)); @@ -706,10 +685,8 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid if (!h) return NULL; rmff_fix_header(h); -#ifdef LOG - printf("Title: %s\nCopyright: %s\nAuthor: %s\nStreams: %i\n", - h->cont->title, h->cont->copyright, h->cont->author, h->prop->num_streams); -#endif + lprintf("Title: %s\nCopyright: %s\nAuthor: %s\nStreams: %i\n", + h->cont->title, h->cont->copyright, h->cont->author, h->prop->num_streams); /* setup our streams */ real_calc_response_and_checksum (challenge2, checksum, challenge1); diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index bbdd398ec..a87b80f0c 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -17,19 +17,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rmff.c,v 1.3 2002/12/24 01:30:22 holstsn Exp $ + * $Id: rmff.c,v 1.4 2003/11/26 19:43:31 f1rmb Exp $ * * functions for real media file format * adopted from joschkas real tools */ #include -#include "rmff.h" +#define LOG_MODULE "rmff" +#define LOG_VERBOSE /* #define LOG */ +#include "xineutils.h" +#include "rmff.h" + #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) #define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ (((uint8_t*)(x))[1] << 16) | \ @@ -777,16 +781,14 @@ void rmff_fix_header(rmff_header_t *h) { if (h->prop) { if (h->prop->size != 50) { -#ifdef LOG - printf("rmff_fix_header: correcting prop.size from %i to %i\n", h->prop->size, 50); -#endif + lprintf("rmff_fix_header: correcting prop.size from %i to %i\n", h->prop->size, 50); + h->prop->size=50; } if (h->prop->num_streams != num_streams) { -#ifdef LOG - printf("rmff_fix_header: correcting prop.num_streams from %i to %i\n", h->prop->num_streams, num_streams); -#endif + lprintf("rmff_fix_header: correcting prop.num_streams from %i to %i\n", h->prop->num_streams, num_streams); + h->prop->num_streams=num_streams; } num_headers++; @@ -801,9 +803,8 @@ void rmff_fix_header(rmff_header_t *h) { printf("rmff_fix_header: warning: no CONT chunk.\n"); if (!h->data) { -#ifdef LOG - printf("rmff_fix_header: no DATA chunk, creating one\n"); -#endif + lprintf("rmff_fix_header: no DATA chunk, creating one\n"); + h->data=malloc(sizeof(rmff_data_t)); h->data->object_id=DATA_TAG; h->data->object_version=0; @@ -815,9 +816,8 @@ void rmff_fix_header(rmff_header_t *h) { if (!h->fileheader) { -#ifdef LOG - printf("rmff_fix_header: no fileheader, creating one"); -#endif + lprintf("rmff_fix_header: no fileheader, creating one"); + h->fileheader=malloc(sizeof(rmff_fileheader_t)); h->fileheader->object_id=RMF_TAG; h->fileheader->size=34; @@ -829,36 +829,32 @@ void rmff_fix_header(rmff_header_t *h) { num_headers++; if(h->fileheader->num_headers != num_headers) { -#ifdef LOG - printf("rmff_fix_header: setting num_headers from %i to %i\n", h->fileheader->num_headers, num_headers); -#endif + lprintf("rmff_fix_header: setting num_headers from %i to %i\n", h->fileheader->num_headers, num_headers); + h->fileheader->num_headers=num_headers; } if(h->prop) { if (h->prop->data_offset != header_size) { -#ifdef LOG - printf("rmff_fix_header: setting prop.data_offset from %i to %i\n", h->prop->data_offset, header_size); -#endif + lprintf("rmff_fix_header: setting prop.data_offset from %i to %i\n", h->prop->data_offset, header_size); + h->prop->data_offset=header_size; } if (h->prop->num_packets == 0) { int p=(int)(h->prop->avg_bit_rate/8.0*(h->prop->duration/1000.0)/h->prop->avg_packet_size); -#ifdef LOG - printf("rmff_fix_header: assuming prop.num_packets=%i\n", p); -#endif + + lprintf("rmff_fix_header: assuming prop.num_packets=%i\n", p); + h->prop->num_packets=p; } if (h->data->num_packets == 0) { -#ifdef LOG - printf("rmff_fix_header: assuming data.num_packets=%i\n", h->prop->num_packets); -#endif + lprintf("rmff_fix_header: assuming data.num_packets=%i\n", h->prop->num_packets); + h->data->num_packets=h->prop->num_packets; } -#ifdef LOG - printf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size); -#endif + lprintf("rmff_fix_header: assuming data.size=%i\n", h->prop->num_packets*h->prop->avg_packet_size); + h->data->size=h->prop->num_packets*h->prop->avg_packet_size; } } diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index cd1c49275..fb803dd91 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -17,21 +17,23 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: sdpplin.c,v 1.1 2002/12/24 01:30:22 holstsn Exp $ + * $Id: sdpplin.c,v 1.2 2003/11/26 19:43:31 f1rmb Exp $ * * sdp/sdpplin parser. * */ -#include "rmff.h" -#include "rtsp.h" -#include "sdpplin.h" -#include - +#define LOG_MODULE "sdpplin" +#define LOG_VERBOSE /* #define LOG */ +#include "rmff.h" +#include "rtsp.h" +#include "sdpplin.h" +#include "xineutils.h" + /* * Decodes base64 strings (based upon b64 package) */ @@ -195,9 +197,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); -#ifdef LOG - printf("mlti_data_size: %i\n", desc->mlti_data_size); -#endif + lprintf("mlti_data_size: %i\n", desc->mlti_data_size); } if(filter(*data,"a=ASMRuleBook:string;",&buf)) { @@ -238,9 +238,7 @@ sdpplin_t *sdpplin_parse(char *data) { if (filter(data, "m=", &buf)) { stream=sdpplin_parse_stream(&data); -#ifdef LOG - printf("got data for stream id %u\n", stream->stream_id); -#endif + lprintf("got data for stream id %u\n", stream->stream_id); desc->stream[stream->stream_id]=stream; continue; } diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 17df49179..639344036 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp.c,v 1.11 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: rtsp.c,v 1.12 2003/11/26 19:43:31 f1rmb Exp $ * * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. @@ -38,12 +38,15 @@ #include #include -#include "rtsp.h" - +#define LOG_MODULE "rtsp" +#define LOG_VERBOSE /* #define LOG */ +#include "rtsp.h" +#include "xineutils.h" + #define BUF_SIZE 4096 #define HEADER_SIZE 1024 #define MAX_FIELDS 256 @@ -276,10 +279,7 @@ static char *rtsp_get(rtsp_t *s) { memcpy(string,s->buffer,n-1); string[n-1]=0; -#ifdef LOG - printf("librtsp: << '%s'\n", string); -#endif - + lprintf("<< '%s'\n", string); return string; } @@ -293,9 +293,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { int len=strlen(string); char *buf=malloc(sizeof(char)*len+2); -#ifdef LOG - printf("librtsp: >> '%s'", string); -#endif + lprintf(">> '%s'", string); memcpy(buf,string,len); buf[len]=0x0d; @@ -303,9 +301,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { write_stream(s->s, buf, len+2); -#ifdef LOG - printf(" done.\n"); -#endif + lprintf("done.\n"); free(buf); } @@ -389,9 +385,8 @@ static int rtsp_get_answers(rtsp_t *s) { if (!strncmp(answer,"Cseq:",5)) { sscanf(answer,"Cseq: %u",&answer_seq); if (s->cseq != answer_seq) { -#ifdef LOG - printf("librtsp: warning: Cseq mismatch. got %u, assumed %u", answer_seq, s->cseq); -#endif + lprintf("warning: Cseq mismatch. got %u, assumed %u", answer_seq, s->cseq); + s->cseq=answer_seq; } } @@ -411,9 +406,8 @@ static int rtsp_get_answers(rtsp_t *s) { } } else { -#ifdef LOG - printf("rtsp: setting session id to: %s\n", s->buffer); -#endif + lprintf("setting session id to: %s\n", s->buffer); + s->session=strdup(s->buffer); } } @@ -556,9 +550,8 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { } while (strlen(rest)!=0); free(rest); if (seq<0) { -#ifdef LOG - printf("rtsp: warning: cseq not recognized!\n"); -#endif + lprintf("warning: cseq not recognized!\n"); + seq=1; } /* lets make the server happy */ @@ -575,9 +568,8 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { } } else i=read_stream(s, buffer, size); -#ifdef LOG - printf("librtsp: << %d of %d bytes\n", i, size); -#endif + + lprintf("<< %d of %d bytes\n", i, size); return i; } @@ -646,9 +638,9 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag s->buffer[pathbegin-hostend-1]=0; s->port=atoi(s->buffer); } -#ifdef LOG - printf("got mrl: %s %i %s\n",s->host,s->port,s->path); -#endif + + lprintf("got mrl: %s %i %s\n",s->host,s->port,s->path); + s->s = host_connect (s->host, s->port); if (s->s < 0) { diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 50cd03664..e49a06b08 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp_session.c,v 1.11 2003/06/02 21:22:00 jstembridge Exp $ + * $Id: rtsp_session.c,v 1.12 2003/11/26 19:43:31 f1rmb Exp $ * * high level interface to rtsp servers. */ @@ -32,15 +32,18 @@ #include #include +#define LOG_MODULE "rtsp_session" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "rtsp.h" #include "rtsp_session.h" #include "real.h" #include "rmff.h" #include "asmrp.h" - -/* -#define LOG -*/ +#include "xineutils.h" #define BUF_SIZE 4096 #define HEADER_SIZE 4096 @@ -152,9 +155,8 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { fill = this->recv_size; if (this->recv_size == 0) { -#ifdef LOG - printf ("librtsp: %d of %d bytes provided\n", len-to_copy, len); -#endif + lprintf ("%d of %d bytes provided\n", len-to_copy, len); + return len-to_copy; } } @@ -162,9 +164,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { memcpy(dest, source, to_copy); this->recv_read += to_copy; -#ifdef LOG - printf ("librtsp: %d bytes provided\n", len); -#endif + lprintf ("%d bytes provided\n", len); return len; } diff --git a/src/input/mms.c b/src/input/mms.c index a5322223d..116a4763d 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.35 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: mms.c,v 1.36 2003/11/26 19:43:31 f1rmb Exp $ * * MMS over TCP protocol * based on work from major mms @@ -54,7 +54,7 @@ #endif /********** logging **********/ -#define LOG_MODULE "libmms" +#define LOG_MODULE "mms" #define LOG_VERBOSE /* #define LOG @@ -155,11 +155,12 @@ static int get_guid (unsigned char *buffer, int offset) { } } - printf ("libmms: unknown GUID: 0x%x, 0x%x, 0x%x, " - "{ 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx }\n", - g.Data1, g.Data2, g.Data3, - g.Data4[0], g.Data4[1], g.Data4[2], g.Data4[3], - g.Data4[4], g.Data4[5], g.Data4[6], g.Data4[7]); + lprintf ("unknown GUID: 0x%x, 0x%x, 0x%x, " + "{ 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx, 0x%hx }\n", + g.Data1, g.Data2, g.Data3, + g.Data4[0], g.Data4[1], g.Data4[2], g.Data4[3], + g.Data4[4], g.Data4[5], g.Data4[6], g.Data4[7]); + return GUID_ERROR; } @@ -494,13 +495,13 @@ static int get_header (mms_t *this) { /* reply to a ping command */ if (command == 0x1b) { if (!send_command (this, 0x1b, 0, 0, 0)) { - lprintf("libmms: failed to send command 0x1b\n"); + lprintf("failed to send command 0x1b\n"); return 0; } } } - lprintf ("mms: get header packet succ\n"); + lprintf ("get header packet succ\n"); } return 1; @@ -715,7 +716,7 @@ static int mms_tcp_connect(mms_t *this) { if (res != XIO_READY) { return 1; } - lprintf ("libmms: connected\n"); + lprintf ("connected\n"); return 0; } @@ -768,7 +769,7 @@ int static mms_choose_best_streams(mms_t *this) { if (bandwitdh_left < 0) { bandwitdh_left = 0; } - lprintf("libmms: bandwitdh %d, left %d\n", this->bandwidth, bandwitdh_left); + lprintf("bandwitdh %d, left %d\n", this->bandwidth, bandwitdh_left); min_bw_left = bandwitdh_left; for (i = 0; i < this->num_stream_ids; i++) { @@ -1101,17 +1102,17 @@ static int get_media_packet (mms_t *this) { len = _x_io_tcp_read (this->stream, this->s, this->buf, packet_len); if (len < 0) { - lprintf ("\nlibmms: get_media_packet: read error\n"); + lprintf ("get_media_packet: read error\n"); return 0; } else if (len != packet_len) { - lprintf ("\nlibmms: get_media_packet: end of stream\n"); + lprintf ("get_media_packet: end of stream\n"); return 0; } if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b) || (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) { - lprintf ("libmms: missing signature\n"); + lprintf ("missing signature\n"); return 0; } @@ -1130,10 +1131,10 @@ static int get_media_packet (mms_t *this) { } else if (command == 0x20) { - lprintf ("libmms: new stream.\n"); + lprintf ("new stream.\n"); /* asf header */ if (!get_header (this)) { - lprintf ("libmms: bad header\n"); + lprintf ("bad header\n"); return 0; } @@ -1184,7 +1185,7 @@ int mms_read (mms_t *this, char *data, int len) { while (total < len) { /* not really usefull, even in debug mode */ - lprintf ("libmms: read, got %d / %d bytes\n", total, len); + lprintf ("read, got %d / %d bytes\n", total, len); if (this->asf_header_read < this->asf_header_len) { int n, bytes_left ; diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 9598ecf7a..a815a9ff9 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mmsh.c,v 1.20 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: mmsh.c,v 1.21 2003/11/26 19:43:31 f1rmb Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -48,6 +48,12 @@ #include #include +#define LOG_MODULE "mmsh" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" @@ -56,10 +62,6 @@ #include "mmsh.h" #include "../demuxers/asfheader.h" -/* -#define LOG -*/ - #define USERAGENT "User-Agent: NSPlayer/7.1.0.3055\r\n" #define CLIENTGUID "Pragma: xClientGUID={c77e7400-738a-11d2-9add-0020af0a3278}\r\n" @@ -233,9 +235,8 @@ static int get_guid (unsigned char *buffer, int offset) { for (i = 1; i < GUID_END; i++) { if (!memcmp(&g, &guids[i].guid, sizeof(GUID))) { -#ifdef LOG - printf ("libmmsh: GUID: %s\n", guids[i].name); -#endif + lprintf ("GUID: %s\n", guids[i].name); + return i; } } @@ -251,9 +252,8 @@ static int get_guid (unsigned char *buffer, int offset) { static int send_command (mmsh_t *this, char *cmd) { int length; -#ifdef LOG - printf ("libmmsh: send_command:\n%s\n", cmd); -#endif + lprintf ("send_command:\n%s\n", cmd); + length = strlen(cmd); if (_x_io_tcp_write(this->stream, this->s, cmd, length) != length) { printf ("libmmsh: send error\n"); @@ -267,9 +267,8 @@ static int get_answer (mmsh_t *this) { int done, len, linenum; char *features; -#ifdef LOG - printf ("libmmsh: get_answer\n"); -#endif + lprintf ("get_answer\n"); + done = 0; len = 0; linenum = 0; this->stream_type = MMSH_UNKNOWN; @@ -292,9 +291,7 @@ static int get_answer (mmsh_t *this) { linenum++; -#ifdef LOG - printf ("libmmsh: answer: >%s<\n", this->buf); -#endif + lprintf ("answer: >%s<\n", this->buf); if (linenum == 1) { int httpver, httpsub, httpcode; @@ -328,15 +325,11 @@ static int get_answer (mmsh_t *this) { features = strstr(this->buf + 7, "features="); if (features) { if (strstr(features, "seekable")) { -#ifdef LOG - printf("libmmsh: seekable stream\n"); -#endif + lprintf("seekable stream\n"); this->stream_type = MMSH_SEEKABLE; } else { if (strstr(features, "broadcast")) { -#ifdef LOG - printf("libmmsh: live stream\n"); -#endif + lprintf("live stream\n"); this->stream_type = MMSH_LIVE; } } @@ -364,15 +357,13 @@ static int get_chunk_header (mmsh_t *this) { char chunk_header[CHUNK_HEADER_LENGTH]; int len; -#ifdef LOG - printf ("libmmsh: get_chunk\n"); -#endif + lprintf ("get_chunk\n"); + /* chunk header */ len = _x_io_tcp_read(this->stream, this->s, chunk_header, CHUNK_HEADER_LENGTH); if (len != CHUNK_HEADER_LENGTH) { -#ifdef LOG - printf ("libmmsh: chunk header read failed, %d != %d\n", len, CHUNK_HEADER_LENGTH); -#endif + lprintf ("chunk header read failed, %d != %d\n", len, CHUNK_HEADER_LENGTH); + return 0; } this->chunk_type = get_16 (chunk_header, 0); @@ -402,9 +393,8 @@ static int get_chunk_header (mmsh_t *this) { static int get_header (mmsh_t *this) { int len = 0; -#ifdef LOG - printf("libmmsh: get_header\n"); -#endif + lprintf("get_header\n"); + this->asf_header_len = 0; /* read chunk */ @@ -444,9 +434,8 @@ static void interp_header (mmsh_t *this) { int i; -#ifdef LOG - printf ("libmmsh: interp_header\n"); -#endif + lprintf ("interp_header\n"); + this->packet_length = 0; /* @@ -473,10 +462,8 @@ static void interp_header (mmsh_t *this) { this->packet_length = get_32(this->asf_header, i + 92 - 24); this->file_length = get_32(this->asf_header, i + 40 - 24); -#ifdef LOG - printf ("libmmsh: file object, packet length = %d (%d)\n", - this->packet_length, get_32(this->asf_header, i + 96 - 24)); -#endif + lprintf ("file object, packet length = %d (%d)\n", + this->packet_length, get_32(this->asf_header, i + 96 - 24)); break; case GUID_ASF_STREAM_PROPERTIES: @@ -506,9 +493,8 @@ static void interp_header (mmsh_t *this) { stream_id = get_16(this->asf_header, i + 48); -#ifdef LOG - printf ("libmmsh: stream object, stream id: %d\n", stream_id); -#endif + lprintf ("stream object, stream id: %d\n", stream_id); + this->stream_types[stream_id] = type; this->stream_ids[this->num_stream_ids] = stream_id; this->num_stream_ids++; @@ -522,18 +508,14 @@ static void interp_header (mmsh_t *this) { uint16_t stream_id; int j; -#ifdef LOG - printf ("libmmsh: stream bitrate properties\n"); -#endif + lprintf ("stream bitrate properties\n"); + lprintf ("streams %d\n", streams); -#ifdef LOG - printf ("libmmsh: streams %d\n", streams); -#endif for(j = 0; j < streams; j++) { stream_id = get_16(this->asf_header, i + 2 + j * 6); -#ifdef LOG - printf ("libmmsh: stream id %d\n", stream_id); -#endif + + lprintf ("stream id %d\n", stream_id); + this->bitrates[stream_id] = get_32(this->asf_header, i + 4 + j * 6); this->bitrates_pos[stream_id] = i + 4 + j * 6; printf ("libmmsh: stream id %d, bitrate %d\n", stream_id, @@ -543,15 +525,11 @@ static void interp_header (mmsh_t *this) { break; default: -#ifdef LOG - printf ("libmmsh: unknown object\n"); -#endif + lprintf ("unknown object\n"); break; } -#ifdef LOG - printf ("libmmsh: length : %lld\n", length); -#endif + lprintf ("length : %lld\n", length); if (length > 24) { i += length - 24; @@ -565,9 +543,8 @@ static int mmsh_valid_url (char* url, const char *const * mmsh_url) { int i = 0; int len; -#ifdef LOG - printf("libmmsh: mmsh_valid_url\n"); -#endif + lprintf("mmsh_valid_url\n"); + if(!url ) return 0; @@ -608,9 +585,7 @@ static int mmsh_parse_url(mmsh_t *this) { char *_host; if ((proto_len = mmsh_valid_url(this->url, mmsh_url_s)) <= 0) { -#ifdef LOG - printf ("libmmsh: invalid url\n"); -#endif + lprintf ("invalid url\n"); return 1; } @@ -620,9 +595,8 @@ static int mmsh_parse_url(mmsh_t *this) { _host = _url; /* extract hostname */ -#ifdef LOG - printf ("libmmsh: extracting host name \n"); -#endif + lprintf ("extracting host name \n"); + hostend = strchr(_host, '/'); /* if ((!hostend) || (strlen(hostend) <= 1)) { @@ -631,9 +605,8 @@ static int mmsh_parse_url(mmsh_t *this) { } */ if (!hostend) { -#ifdef LOG - printf ("libmmsh: no trailing /\n"); -#endif + lprintf ("no trailing /\n"); + hostend = _host + strlen(_host); } else { *hostend++ = '\0'; @@ -660,9 +633,8 @@ static int mmsh_tcp_connect(mmsh_t *this) { /* * try to connect */ -#ifdef LOG - printf("libmmsh: try to connect to %s on port %d \n", this->host, this->port); -#endif + lprintf("try to connect to %s on port %d \n", this->host, this->port); + this->s = _x_io_tcp_connect (this->stream, this->host, this->port); if (this->s == -1) { @@ -680,9 +652,7 @@ static int mmsh_tcp_connect(mmsh_t *this) { if (res != XIO_READY) { return 1; } -#ifdef LOG - printf ("libmmsh: connected\n"); -#endif + lprintf ("connected\n"); return 0; } @@ -728,11 +698,9 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { goto fail; } -#ifdef LOG - printf ("libmmsh: url=%s\nlibmmsh: host=%s\nlibmmsh: " - "path=%s\nlibmmsh: file=%s\n", this->url, this->host, this->path, + lprintf ("url=%s\nlibmmsh: host=%s\nlibmmsh: " + "path=%s\nlibmmsh: file=%s\n", this->url, this->host, this->path, this->file); -#endif if (mmsh_tcp_connect(this)) { goto fail; @@ -744,9 +712,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { */ /* first request */ -#ifdef LOG - printf("libmmsh: first http request\n"); -#endif + lprintf("first http request\n"); sprintf (this->str, mmsh_FirstRequest, this->path, this->host, 1); @@ -785,9 +751,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { if (bandwitdh_left < 0) { bandwitdh_left = 0; } -#ifdef LOG - printf("libmmsh: bandwitdh %d, left %d\n", bandwidth, bandwitdh_left); -#endif + lprintf("bandwitdh %d, left %d\n", bandwidth, bandwitdh_left); min_bw_left = bandwitdh_left; for (i = 0; i < this->num_stream_ids; i++) { @@ -824,15 +788,11 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { } } -#ifdef LOG - printf("libmmsh: audio stream %d, video stream %d\n", audio_stream, video_stream); -#endif - + lprintf("audio stream %d, video stream %d\n", audio_stream, video_stream); - /* second request */ -#ifdef LOG - printf("libmmsh: second http request\n"); -#endif + /* second request */ + lprintf("second http request\n"); + if (mmsh_tcp_connect(this)) { goto fail; } @@ -846,9 +806,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { (this->stream_ids[i] == video_stream)) { sprintf(stream_selection + i * 9, "ffff:%d:0 ", this->stream_ids[i]); } else { -#ifdef LOG - printf("libmmsh: disabling stream %d\n", this->stream_ids[i]); -#endif + lprintf("disabling stream %d\n", this->stream_ids[i]); sprintf(stream_selection + i * 9, "ffff:%d:2 ", this->stream_ids[i]); } } @@ -869,9 +827,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { if (!send_command (this, this->str)) goto fail; -#ifdef LOG - printf("libmmsh: before read \n"); -#endif + lprintf("before read \n"); if (!get_answer (this)) goto fail; @@ -882,9 +838,8 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { for (i = 0; i < this->num_stream_ids; i++) { if ((this->stream_ids[i] != audio_stream) && (this->stream_ids[i] != video_stream)) { -#ifdef LOG - printf("libmmsh: disabling stream %d\n", this->stream_ids[i]); -#endif + lprintf("disabling stream %d\n", this->stream_ids[i]); + /* forces the asf demuxer to not choose this stream */ this->asf_header[this->bitrates_pos[this->stream_ids[i]]] = 0; this->asf_header[this->bitrates_pos[this->stream_ids[i]] + 1] = 0; @@ -895,13 +850,12 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { report_progress (stream, 100); -#ifdef LOG - printf("libmmsh: mmsh_connect: passed\n" ); -#endif + lprintf("mmsh_connect: passed\n" ); + return this; fail: - printf("libmmsh: mmsh_connect: failed\n" ); + lprintf("mmsh_connect: failed\n" ); if (this->s != -1) close(this->s); if (this->url) @@ -915,7 +869,7 @@ fail: free(this); - printf("libmmsh: mmsh_connect: failed return\n" ); + lprintf("mmsh_connect: failed return\n" ); return NULL; } @@ -923,9 +877,7 @@ fail: static int get_media_packet (mmsh_t *this) { int len = 0; -#ifdef LOG - printf("libmmsh: get_media_packet: this->packet_length: %d\n", this->packet_length); -#endif + lprintf("get_media_packet: this->packet_length: %d\n", this->packet_length); if (!this->chunk_eos && get_chunk_header(this)) { switch (this->chunk_type) { @@ -958,9 +910,7 @@ static int get_media_packet (mmsh_t *this) { int mmsh_peek_header (mmsh_t *this, char *data, int maxsize) { int len; -#ifdef LOG - printf("libmmsh: mmsh_peek_header\n"); -#endif + lprintf("mmsh_peek_header\n"); len = (this->asf_header_len < maxsize) ? this->asf_header_len : maxsize; @@ -973,9 +923,7 @@ int mmsh_read (mmsh_t *this, char *data, int len) { total = 0; -#ifdef LOG - printf ("libmmsh: mmsh_read: len: %d\n", len); -#endif + lprintf ("mmsh_read: len: %d\n", len); while (total < len) { @@ -1030,9 +978,7 @@ int mmsh_read (mmsh_t *this, char *data, int len) { void mmsh_close (mmsh_t *this) { -#ifdef LOG - printf("libmmsh: mmsh_close\n"); -#endif + lprintf("mmsh_close\n"); if (this->s !=-1) close(this->s); diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index b34c3d164..7462b0793 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -98,7 +98,9 @@ static void report_progress (xine_stream_t *stream, int p) { } static void nbc_set_speed_pause (xine_stream_t *stream) { - lprintf("\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); +#endif stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_PAUSE); stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 0); if (stream->audio_out) @@ -106,7 +108,9 @@ static void nbc_set_speed_pause (xine_stream_t *stream) { } static void nbc_set_speed_normal (xine_stream_t *stream) { - lprintf("\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); +#endif stream->xine->clock->set_speed (stream->xine->clock, XINE_SPEED_NORMAL); stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); if (stream->audio_out) @@ -361,10 +365,14 @@ static void nbc_put_cb (fifo_buffer_t *fifo, /* discontinuity management */ if (fifo == this->video_fifo) { this->video_in_disc++; - lprintf("\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); +#endif } else { this->audio_in_disc++; - lprintf("\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); +#endif } break; } @@ -434,10 +442,14 @@ static void nbc_get_cb (fifo_buffer_t *fifo, if (buf->type == BUF_CONTROL_NEWPTS) { if (fifo == this->video_fifo) { this->video_in_disc--; - lprintf("\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); +#endif } else { this->audio_in_disc--; - lprintf("\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); +#endif } } @@ -459,7 +471,7 @@ nbc_t *nbc_init (xine_stream_t *stream) { fifo_buffer_t *video_fifo = stream->video_fifo; fifo_buffer_t *audio_fifo = stream->audio_fifo; - lprintf("net_buf_ctrl: nbc_init\n"); + lprintf("nbc_init\n"); pthread_mutex_init (&this->mutex, NULL); this->stream = stream; @@ -504,7 +516,9 @@ void nbc_close (nbc_t *this) { fifo_buffer_t *video_fifo = this->stream->video_fifo; fifo_buffer_t *audio_fifo = this->stream->audio_fifo; - lprintf("\nnet_buf_ctrl: nbc_close\n"); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_close\n"); +#endif video_fifo->unregister_alloc_cb(video_fifo, nbc_alloc_cb); video_fifo->unregister_put_cb(video_fifo, nbc_put_cb); @@ -527,7 +541,9 @@ void nbc_close (nbc_t *this) { pthread_mutex_unlock(&this->mutex); free (this); - lprintf("\nnet_buf_ctrl: nbc_close: done\n"); +#ifdef LOG + printf("\nnet_buf_ctrl: nbc_close: done\n"); +#endif } diff --git a/src/input/pnm.c b/src/input/pnm.c index 4a09efb1e..aa814236a 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: pnm.c,v 1.16 2003/11/11 18:44:54 f1rmb Exp $ + * $Id: pnm.c,v 1.17 2003/11/26 19:43:31 f1rmb Exp $ * * pnm protocol implementation * based upon code from joschka @@ -36,16 +36,18 @@ #include #include +#define LOG_MODULE "pnm" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "pnm.h" #include "libreal/rmff.h" #include "bswap.h" #include "xineutils.h" #include "xine_internal.h" -/* -#define LOG -*/ - #define BUF_SIZE 4096 #define HEADER_SIZE 4096 @@ -687,9 +689,8 @@ static int pnm_calc_stream(pnm_t *p) { if (p->ts_current < p->ts_last[0]) return 1; /* does not help, we guess type 0 */ -#ifdef LOG - printf("guessing stream# 0\n"); -#endif + lprintf("guessing stream# 0\n"); + p->seq_num[0]=p->seq_current[0]+1; p->seq_num[1]=p->seq_current[1]+1; return 0; @@ -730,9 +731,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { { n = rm_read (p, p->buffer, 8); if (n<8) return 0; -#ifdef LOG - printf("input_pnm: had to seek 8 bytes on 0x62\n"); -#endif + lprintf("had to seek 8 bytes on 0x62\n"); } /* a server message */ @@ -872,9 +871,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { free(mrl_ptr-6); -#ifdef LOG - printf("input_pnm: got mrl: %s %i %s\n",p->host,p->port,p->path); -#endif + lprintf("got mrl: %s %i %s\n",p->host,p->port,p->path); fd = host_connect (p->host, p->port); @@ -927,9 +924,8 @@ int pnm_read (pnm_t *this, char *data, int len) { this->recv_read=0; if (!pnm_get_stream_chunk (this)) { -#ifdef LOG - printf ("input_pnm: %d of %d bytes provided\n", len-to_copy, len); -#endif + lprintf ("%d of %d bytes provided\n", len-to_copy, len); + return len-to_copy; } source = this->recv; @@ -939,9 +935,7 @@ int pnm_read (pnm_t *this, char *data, int len) { memcpy(dest, source, to_copy); this->recv_read += to_copy; -#ifdef LOG - printf ("input_pnm: %d bytes provided\n", len); -#endif + lprintf ("%d bytes provided\n", len); return len; } diff --git a/src/liba52/xine_decoder.c b/src/liba52/xine_decoder.c index c5fcacc51..d2151c8fc 100644 --- a/src/liba52/xine_decoder.c +++ b/src/liba52/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.63 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.64 2003/11/26 19:43:31 f1rmb Exp $ * * stuff needed to turn liba52 into a xine decoder plugin */ @@ -36,6 +36,13 @@ #include #include +#define LOG_MODULE "a52_decoder" +#define LOG_VERBOSE +/* +#define LOG +#define LOG_PTS +*/ + #include "xine_internal.h" #include "audio_out.h" #include "a52.h" @@ -43,11 +50,6 @@ #include "buffer.h" #include "xineutils.h" -/* -#define LOG -#define LOG_PTS -*/ - #undef DEBUG_A52 #ifdef DEBUG_A52 int a52file; @@ -328,9 +330,8 @@ static void a52dec_decode_frame (a52dec_decoder_t *this, int64_t pts, int previe printf ("liba52: help - unsupported mode %08x\n", output_mode); } } -#ifdef LOG - printf ("liba52: %d frames output\n", buf->num_frames); -#endif + + lprintf ("%d frames output\n", buf->num_frames); /* output decoded samples */ @@ -402,11 +403,9 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { uint16_t crc16; uint16_t crc16_result; -#ifdef LOG - printf ("liba52: decode data %d bytes of type %08x, pts=%lld\n", - buf->size, buf->type, buf->pts); - printf ("liba52: decode data decoder_info=%d, %d\n",buf->decoder_info[1],buf->decoder_info[2]); -#endif + lprintf ("decode data %d bytes of type %08x, pts=%lld\n", + buf->size, buf->type, buf->pts); + lprintf ("decode data decoder_info=%d, %d\n",buf->decoder_info[1],buf->decoder_info[2]); if (buf->decoder_flags & BUF_FLAG_HEADER) return; @@ -414,9 +413,7 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* swap byte pairs if this is RealAudio DNET data */ if (buf->type == BUF_AUDIO_DNET) { -#ifdef LOG - printf ("liba52: byte-swapping dnet\n"); -#endif + lprintf ("byte-swapping dnet\n"); while (current != end) { byte = *current++; @@ -480,9 +477,8 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { printf("\n"); #endif -#ifdef LOG - printf ("liba52: processing...state %d\n", this->sync_state); -#endif + lprintf ("processing...state %d\n", this->sync_state); + while (current < end) { switch (this->sync_state) { case 0: /* Looking for sync header */ @@ -516,9 +512,9 @@ static void a52dec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->sync_state = 0; break; } -#ifdef LOG - printf("Frame length = %d\n",this->frame_length); -#endif + + lprintf("Frame length = %d\n",this->frame_length); + this->frame_todo = this->frame_length - 17; this->sync_state = 2; if (!_x_meta_info_get(this->stream, XINE_META_INFO_AUDIOCODEC) || @@ -625,9 +621,8 @@ static void a52dec_dispose (audio_decoder_t *this_gen) { static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream) { a52dec_decoder_t *this ; -#ifdef LOG - printf ("liba52:open_plugin called\n"); -#endif + + lprintf ("open_plugin called\n"); this = (a52dec_decoder_t *) malloc (sizeof (a52dec_decoder_t)); memset(this, 0, sizeof (a52dec_decoder_t)); @@ -746,23 +741,17 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre } static char *get_identifier (audio_decoder_class_t *this) { -#ifdef LOG - printf ("liba52:get_identifier called\n"); -#endif + lprintf ("get_identifier called\n"); return "a/52dec"; } static char *get_description (audio_decoder_class_t *this) { -#ifdef LOG - printf ("liba52:get_description called\n"); -#endif + lprintf ("get_description called\n"); return "liba52 based a52 audio decoder plugin"; } static void dispose_class (audio_decoder_class_t *this) { -#ifdef LOG - printf ("liba52:dispose_class called\n"); -#endif + lprintf ("dispose_class called\n"); free (this); } @@ -792,9 +781,7 @@ static void *init_plugin (xine_t *xine, void *data) { NULL, 0, NULL, NULL); -#ifdef LOG - printf ("liba52:init_plugin called\n"); -#endif + lprintf ("init_plugin called\n"); return this; } diff --git a/src/libdivx4/xine_decoder.c b/src/libdivx4/xine_decoder.c index c70e7753e..89d8c7315 100644 --- a/src/libdivx4/xine_decoder.c +++ b/src/libdivx4/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.45 2003/08/04 03:47:09 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.46 2003/11/26 19:43:31 f1rmb Exp $ * * xine decoder plugin using divx4 * @@ -49,6 +49,12 @@ #include #include +#define LOG_MODULE "divx4_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "buffer.h" @@ -60,10 +66,6 @@ #if CATCH_SIGSEGV #include -/* -#define LOG -*/ - /* to be able to restore the old handler */ void (*old_handler)(int); @@ -186,9 +188,7 @@ static void divx4_set_pp(divx4_decoder_t *this) { DEC_SET setpp; /* for setting postproc level */ int ret; -#ifdef LOG - printf ("divx4: this->decoder_ok=%d\n", this->decoder_ok); -#endif + lprintf ("this->decoder_ok=%d\n", this->decoder_ok); if (!this->decoder_ok) return; @@ -221,9 +221,7 @@ static int divx4_init_decoder(divx4_decoder_t *this, buf_element_t *buf) { DEC_PARAM param; /* for init */ int ret, codec_type; -#ifdef LOG - printf ("divx4: init_decoder\n"); -#endif + lprintf ("init_decoder\n"); memcpy ( &this->bih, buf->content, sizeof (xine_bmiheader)); this->video_step = buf->decoder_info[1]; @@ -334,9 +332,7 @@ static int divx4_can_handle (video_decoder_t *this_gen, int buf_type) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; buf_type &= 0xFFFF0000; -#ifdef LOG - printf ("divx4: can_handle\n"); -#endif + lprintf ("can_handle\n"); /* divx4 currently does not support MSMPEG4 v1/v2 */ return ( (buf_type == BUF_VIDEO_MSMPEG4_V3 && this->can_handle_311) || @@ -350,9 +346,7 @@ static void divx4_init (video_decoder_t *this_gen, vo_instance_t *video_out) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; -#ifdef LOG - printf ("divx4: divx4_init\n"); -#endif + lprintf ("divx4_init\n"); this->video_out = video_out; this->decoder_ok = 0; @@ -369,9 +363,7 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; -#ifdef LOG - printf ("divx4: decoding buffer %08x, flags = %08x\n", buf, buf->decoder_flags); -#endif + lprintf ("decoding buffer %08x, flags = %08x\n", buf, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; @@ -379,9 +371,7 @@ static void divx4_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_HEADER) { /* need to initialize */ /* only proceed if version is good and initialization succeeded */ -#ifdef LOG - printf ("divx4: get_version...\n"); -#endif + lprintf ("get_version...\n"); divx4_get_version(this); this->decoder_ok = ( divx4_check_version(this) && @@ -490,9 +480,7 @@ static void divx4_update_postproc(void *this_gen, xine_cfg_entry_t *entry) { divx4_decoder_t *this = (divx4_decoder_t *) this_gen; -#ifdef LOG - printf ("divx4: update_postproc this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); -#endif + lprintf ("update_postproc this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); if( this->postproc != entry->num_value) { this->postproc = entry->num_value; @@ -502,29 +490,21 @@ static void divx4_update_postproc(void *this_gen, xine_cfg_entry_t *entry) { static char *divx4_get_id(void) { -#ifdef LOG - printf ("divx4: get_id\n"); -#endif + lprintf ("get_id\n"); return "divx4 video decoder"; } static void divx4_flush(video_decoder_t *this_gen) { -#ifdef LOG - printf ("divx4: flush\n"); -#endif + lprintf ("flush\n"); } static void divx4_reset(video_decoder_t *this_gen) { /* seems to handle seeking quite nicelly without any code here */ -#ifdef LOG - printf ("divx4: reset\n"); -#endif + lprintf ("reset\n"); } static void divx4_dispose(video_decoder_t *this_gen) { -#ifdef LOG - printf ("divx4: dispose\n"); -#endif + lprintf ("dispose\n"); free (this_gen); } @@ -594,9 +574,7 @@ static void *init_video_decoder_plugin (xine_t *xine, void *data) { if (this->postproc > 10) this->postproc=10; if (this->postproc < 0) this->postproc=0; -#ifdef LOG - printf ("divx4: this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); -#endif + lprintf ("this=0x%08x, decoder_ok = %d\n", this, this->decoder_ok); return (video_decoder_t *) this; } diff --git a/src/libfaad/xine_decoder.c b/src/libfaad/xine_decoder.c index d299e55a3..5534ea7dd 100644 --- a/src/libfaad/xine_decoder.c +++ b/src/libfaad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.18 2003/11/16 23:33:44 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.19 2003/11/26 19:43:32 f1rmb Exp $ * */ @@ -28,16 +28,18 @@ #include #include +#define LOG_MODULE "faad_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "audio_out.h" #include "buffer.h" #include "xineutils.h" #include "faad.h" -/* -#define LOG -*/ - typedef struct { audio_decoder_class_t decoder_class; } faad_class_t; @@ -122,10 +124,8 @@ static void faad_decode_audio ( faad_decoder_t *this, int end_frame ) { decoded = this->faac_finfo.samples * 2; /* 1 sample = 2 bytes */ -#ifdef LOG - printf("libfaad: decoded %d/%d output %ld\n", - used, this->size, this->faac_finfo.samples ); -#endif + lprintf("decoded %d/%d output %ld\n", + used, this->size, this->faac_finfo.samples ); if (sample_buffer == NULL) { printf("libfaad: %s\n", faacDecGetErrorMessage(this->faac_finfo.error)); @@ -199,10 +199,8 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } -#ifdef LOG - printf("libfaad: faacDecInit2 returned rate=%ld channels=%d\n", + lprintf("faacDecInit2 returned rate=%ld channels=%d\n", this->rate, this->num_channels ); -#endif } /* get audio parameters from file header @@ -229,9 +227,7 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } else { -#ifdef LOG - printf ("faad: decoding %d data bytes...\n", buf->size); -#endif + lprintf ("decoding %d data bytes...\n", buf->size); if( (int)buf->size <= 0 || this->faac_failed ) return; @@ -266,10 +262,8 @@ static void faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_HANDLED, 0); return; } -#ifdef LOG - printf("libfaad: faacDecInit() returned rate=%ld channels=%d (used=%d)\n", + lprintf("faacDecInit() returned rate=%ld channels=%d (used=%d)\n", this->rate, this->num_channels, used); -#endif this->size -= used; memmove(this->buf, &this->buf[used], this->size); diff --git a/src/libffmpeg/xine_decoder.c b/src/libffmpeg/xine_decoder.c index 94f62f145..3a119d959 100644 --- a/src/libffmpeg/xine_decoder.c +++ b/src/libffmpeg/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.139 2003/11/23 16:55:35 jstembridge Exp $ + * $Id: xine_decoder.c,v 1.140 2003/11/26 19:43:32 f1rmb Exp $ * * xine decoder plugin using ffmpeg * @@ -35,6 +35,12 @@ #include #include +#define LOG_MODULE "ffmpeg_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "buffer.h" @@ -45,10 +51,6 @@ #include "libavcodec/dsputil.h" #include "libavcodec/libpostproc/postprocess.h" -/* -#define LOG -*/ - #define ENABLE_DIRECT_RENDERING #define SLICE_BUFFER_SIZE (1194 * 1024) @@ -427,9 +429,7 @@ static void find_sequence_header (ff_video_decoder_t *this, if (current == NULL) return ; -#ifdef LOG - printf ("ffmpeg: looking for sequence header... %02x\n", code); -#endif + lprintf ("looking for sequence header... %02x\n", code); /* mpeg2_stats (code, this->chunk_buffer); */ @@ -437,9 +437,7 @@ static void find_sequence_header (ff_video_decoder_t *this, int width, height, frame_rate_code; -#ifdef LOG - printf ("ffmpeg: found sequence header !\n"); -#endif + lprintf ("found sequence header !\n"); height = (this->chunk_buffer[0] << 16) | (this->chunk_buffer[1] << 8) | this->chunk_buffer[2]; @@ -737,17 +735,14 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; int codec_type; -#ifdef LOG - printf ("ffmpeg: processing packet type = %08x, buf : %p, buf->decoder_flags=%08x\n", - buf->type, buf, buf->decoder_flags); -#endif + lprintf ("processing packet type = %08x, buf : %p, buf->decoder_flags=%08x\n", + buf->type, buf, buf->decoder_flags); + codec_type = buf->type & 0xFFFF0000; if (buf->decoder_flags & BUF_FLAG_PREVIEW) { -#ifdef LOG - printf ("ffmpeg: preview\n"); -#endif + lprintf ("preview\n"); if ( (buf->type & 0xFFFF0000) == BUF_VIDEO_MPEG ) { find_sequence_header (this, buf->content, buf->content+buf->size); @@ -757,9 +752,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (buf->decoder_flags & BUF_FLAG_HEADER) { -#ifdef LOG - printf ("ffmpeg: header\n"); -#endif + lprintf ("header\n"); /* init package containing bih */ @@ -1046,9 +1039,7 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { return; } -#ifdef LOG - printf ("ffmpeg: got a picture\n"); -#endif + lprintf ("got a picture\n"); this->aspect_ratio = av_q2d(this->context->sample_aspect_ratio) * (double) this->context->width / (double) this->context->height; @@ -1126,24 +1117,18 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } } else { -#ifdef LOG - printf ("ffmpeg: data but decoder not initialized (headers missing)\n"); -#endif + lprintf ("data but decoder not initialized (headers missing)\n"); } } static void ff_flush (video_decoder_t *this_gen) { -#ifdef LOG - printf ("ffmpeg: ff_flush\n"); -#endif - + lprintf ("ff_flush\n"); } static void ff_reset (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; -#ifdef LOG - printf ("ffmpeg: ff_reset\n"); -#endif + + lprintf ("ff_reset\n"); this->size = 0; if(this->context) @@ -1151,9 +1136,8 @@ static void ff_reset (video_decoder_t *this_gen) { } static void ff_discontinuity (video_decoder_t *this_gen) { -#ifdef LOG - printf ("ffmpeg: ff_discontinuity\n"); -#endif + + lprintf ("ff_discontinuity\n"); } void avcodec_register_all(void) @@ -1221,9 +1205,7 @@ void avcodec_register_all(void) static void ff_dispose (video_decoder_t *this_gen) { ff_video_decoder_t *this = (ff_video_decoder_t *) this_gen; -#ifdef LOG - printf ("ffmpeg: ff_dispose\n"); -#endif + lprintf ("ff_dispose\n"); if (this->decoder_ok) { avcodec_close (this->context); @@ -1269,9 +1251,7 @@ static video_decoder_t *ff_video_open_plugin (video_decoder_class_t *class_gen, ff_video_decoder_t *this ; -#ifdef LOG - printf ("ffmpeg: open_plugin\n"); -#endif + lprintf ("open_plugin\n"); this = (ff_video_decoder_t *) malloc (sizeof (ff_video_decoder_t)); diff --git a/src/libflac/decoder_flac.c b/src/libflac/decoder_flac.c index aaca2ea9b..8c7d39ad0 100644 --- a/src/libflac/decoder_flac.c +++ b/src/libflac/decoder_flac.c @@ -30,15 +30,16 @@ #include +#define LOG_MODULE "flac_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ #include "xine_internal.h" #include "audio_out.h" #include "buffer.h" -/* -#define LOG 1 -*/ - #include "demux_flac.h" typedef struct { @@ -82,18 +83,14 @@ flac_read_callback (const FLAC__StreamDecoder *decoder, flac_decoder_t *this = (flac_decoder_t *)client_data; int number_of_bytes_to_copy; -#ifdef LOG - printf("libflac: flac_read_callback: %d\n", *bytes); -#endif + lprintf("flac_read_callback: %d\n", *bytes); if (this->buf_pos > *bytes) number_of_bytes_to_copy = *bytes; else number_of_bytes_to_copy = this->buf_pos; -#ifdef LOG - printf("libflac: number_of_bytes_to_copy: %d\n", number_of_bytes_to_copy); -#endif + lprintf("number_of_bytes_to_copy: %d\n", number_of_bytes_to_copy); *bytes = number_of_bytes_to_copy; @@ -123,9 +120,7 @@ flac_write_callback (const FLAC__StreamDecoder *decoder, int16_t *data16; int i,j; -#ifdef LOG - printf("libflac: flac_write_callback\n"); -#endif + lprintf("flac_write_callback\n"); while( samples_left ) { @@ -168,24 +163,22 @@ flac_metadata_callback (const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { - flac_decoder_t *this = (flac_decoder_t *)client_data; + /* flac_decoder_t *this = (flac_decoder_t *)client_data; */ + + lprintf("Metadata callback called!\n"); #ifdef LOG - printf("libflac: Metadata callback called!\n"); -#endif - - if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { -#ifdef LOG - printf("libflac: min_blocksize = %d\n", metadata->data.stream_info.min_blocksize); - printf("libflac: max_blocksize = %d\n", metadata->data.stream_info.max_blocksize); - printf("libflac: min_framesize = %d\n", metadata->data.stream_info.min_framesize); - printf("libflac: max_framesize = %d\n", metadata->data.stream_info.max_framesize); + if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { + printf("libflac: min_blocksize = %d\n", metadata->data.stream_info.min_blocksize); + printf("libflac: max_blocksize = %d\n", metadata->data.stream_info.max_blocksize); + printf("libflac: min_framesize = %d\n", metadata->data.stream_info.min_framesize); + printf("libflac: max_framesize = %d\n", metadata->data.stream_info.max_framesize); + /* does not work well: + this->min_size = 2 * metadata->data.stream_info.max_blocksize; */ + } #endif - - /* does not work well: - this->min_size = 2 * metadata->data.stream_info.max_blocksize; */ - } - return; + + return; } static void @@ -194,17 +187,17 @@ flac_error_callback (const FLAC__StreamDecoder *decoder, void *client_data) { /* This will be called if there is an error in the flac stream */ + lprintf("flac_error_callback\n"); + #ifdef LOG - printf("libflac: flac_error_callback\n"); - - if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - printf("libflac: Decoder lost synchronization.\n"); - else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER) - printf("libflac: Decoder encounted a corrupted frame header.\n"); - else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH) - printf("libflac: Frame's data did not match the CRC in the footer.\n"); - else - printf("libflac: unknown error.\n"); + if (status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) + printf("libflac: Decoder lost synchronization.\n"); + else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER) + printf("libflac: Decoder encounted a corrupted frame header.\n"); + else if (status == FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH) + printf("libflac: Frame's data did not match the CRC in the footer.\n"); + else + printf("libflac: unknown error.\n"); #endif return; @@ -235,9 +228,8 @@ flac_discontinuity (audio_decoder_t *this_gen) flac_decoder_t *this = (flac_decoder_t *) this_gen; this->pts = 0; -#ifdef LOG - printf("libflac: Discontinuity!\n"); -#endif + + lprintf("Discontinuity!\n"); } static void @@ -299,9 +291,7 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->buf_size += 2 * buf->size; this->buf = realloc (this->buf, this->buf_size); -#ifdef LOG - printf("libflac: reallocating buffer to %d\n", this->buf_size); -#endif + lprintf("reallocating buffer to %d\n", this->buf_size); } xine_fast_memcpy (&this->buf[this->buf_pos], buf->content, buf->size); @@ -315,14 +305,11 @@ flac_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) if( FLAC__stream_decoder_get_state(this->flac_decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA ) { -#ifdef LOG - printf("libflac: process_until_end_of_metadata\n"); -#endif + lprintf("process_until_end_of_metadata\n"); + ret = FLAC__stream_decoder_process_until_end_of_metadata (this->flac_decoder); } else { -#ifdef LOG - printf("libflac: process_single\n"); -#endif + lprintf("process_single\n"); ret = FLAC__stream_decoder_process_single (this->flac_decoder); } } diff --git a/src/libflac/demux_flac.c b/src/libflac/demux_flac.c index a329fad2b..086f20fa9 100644 --- a/src/libflac/demux_flac.c +++ b/src/libflac/demux_flac.c @@ -38,14 +38,16 @@ #include +#define LOG_MODULE "demux_flac" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "../demuxers/demux.h" -/* -#define LOG 1 -*/ - #include "demux_flac.h" /* FLAC Demuxer plugin */ @@ -97,9 +99,7 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, input_plugin_t *input = this->input; off_t offset = *bytes; -#ifdef LOG - printf("demux_flac: flac_read_callback\n"); -#endif + lprintf("flac_read_callback\n"); /* This should only be called when flac is reading the metadata * of the flac stream. @@ -107,26 +107,22 @@ flac_read_callback (const FLAC__SeekableStreamDecoder *decoder, offset = input->read (input, buffer, offset); -#ifdef LOG - printf("demux_flac: Read %lld / %u bytes into buffer\n", offset, *bytes); -#endif + lprintf("Read %lld / %u bytes into buffer\n", offset, *bytes); *bytes = offset; /* This is the way to detect EOF with xine input plugins */ if ( (offset != *bytes) && (*bytes != 0) ) { -#ifdef LOG - printf("demux_flac: Marking EOF\n"); -#endif - this->status = DEMUX_FINISHED; - return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; + lprintf("Marking EOF\n"); + + this->status = DEMUX_FINISHED; + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR; } else { -#ifdef LOG - printf("demux_flac: Read was perfect\n"); -#endif - return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; + lprintf("Read was perfect\n"); + + return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK; } } @@ -138,9 +134,7 @@ flac_seek_callback (const FLAC__SeekableStreamDecoder *decoder, input_plugin_t *input = ((demux_flac_t *)client_data)->input; off_t offset; -#ifdef LOG - printf("demux_flac: flac_seek_callback\n"); -#endif + lprintf("flac_seek_callback\n"); offset = input->seek (input, absolute_byte_offset, SEEK_SET); @@ -158,9 +152,8 @@ flac_tell_callback (const FLAC__SeekableStreamDecoder *decoder, input_plugin_t *input = ((demux_flac_t *)client_data)->input; off_t offset; -#ifdef LOG - printf("demux_flac: flac_tell_callback\n"); -#endif + lprintf("flac_tell_callback\n"); + offset = input->get_current_pos (input); *absolute_byte_offset = offset; @@ -176,9 +169,8 @@ flac_length_callback (const FLAC__SeekableStreamDecoder *decoder, input_plugin_t *input = ((demux_flac_t *)client_data)->input; off_t offset; -#ifdef LOG - printf("demux_flac: flac_length_callback\n"); -#endif + lprintf("flac_length_callback\n"); + offset = input->get_length (input); /* FIXME, can flac handle -1 as offset ? */ @@ -190,23 +182,20 @@ flac_eof_callback (const FLAC__SeekableStreamDecoder *decoder, void *client_data) { demux_flac_t *this = (demux_flac_t *)client_data; -#ifdef LOG - printf("demux_flac: flac_eof_callback\n"); -#endif + + lprintf("flac_eof_callback\n"); if (this->status == DEMUX_FINISHED) { -#ifdef LOG - printf("demux_flac: flac_eof_callback: True!\n"); -#endif - return true; + lprintf("flac_eof_callback: True!\n"); + + return true; } else { -#ifdef LOG - printf("demux_flac: flac_eof_callback: False!\n"); -#endif - return false; + lprintf("flac_eof_callback: False!\n"); + + return false; } } @@ -220,11 +209,9 @@ flac_write_callback (const FLAC__SeekableStreamDecoder *decoder, * is seeking. We do the decoding in the decoder */ -#ifdef LOG - printf("demux_flac: Error: Write callback was called!\n"); -#endif + lprintf("Error: Write callback was called!\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } static void @@ -234,21 +221,19 @@ flac_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, { demux_flac_t *this = (demux_flac_t *)client_data; -#ifdef LOG - printf("demux_flac: IN: Metadata callback\n"); -#endif + lprintf("IN: Metadata callback\n"); + /* This should be called when we first look at a flac stream, * We get information about the stream here. */ if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { -#ifdef LOG - printf("demux_flac: Got METADATA!\n"); -#endif - this->total_samples = metadata->data.stream_info.total_samples; - this->bits_per_sample = metadata->data.stream_info.bits_per_sample; - this->channels = metadata->data.stream_info.channels; - this->sample_rate = metadata->data.stream_info.sample_rate; - this->length_in_msec = (this->total_samples * 10 / + lprintf("Got METADATA!\n"); + + this->total_samples = metadata->data.stream_info.total_samples; + this->bits_per_sample = metadata->data.stream_info.bits_per_sample; + this->channels = metadata->data.stream_info.channels; + this->sample_rate = metadata->data.stream_info.sample_rate; + this->length_in_msec = (this->total_samples * 10 / (this->sample_rate / 100))/1000; } return; @@ -327,12 +312,11 @@ demux_flac_send_chunk (demux_plugin_t *this_gen) { remaining_sample_bytes -= buf->size; if (this->input->read (this->input,buf->content,buf->size)!=buf->size) { -#ifdef LOG - printf("demux_flac: buf->size != input->read()\n"); -#endif - buf->free_buffer (buf); - this->status = DEMUX_FINISHED; - break; + lprintf("buf->size != input->read()\n"); + + buf->free_buffer (buf); + this->status = DEMUX_FINISHED; + break; } /* @@ -353,9 +337,7 @@ demux_flac_send_headers (demux_plugin_t *this_gen) { buf_element_t *buf; -#ifdef LOG - printf("demux_flac: demux_flac_send_headers\n"); -#endif + lprintf("demux_flac_send_headers\n"); this->video_fifo = this->stream->video_fifo; this->audio_fifo = this->stream->audio_fifo; @@ -387,9 +369,8 @@ static void demux_flac_dispose (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; -#ifdef LOG - printf("demux_flac: demux_flac_dispose\n"); -#endif + lprintf("demux_flac_dispose\n"); + if (this->flac_decoder) FLAC__seekable_stream_decoder_delete (this->flac_decoder); @@ -401,9 +382,7 @@ static int demux_flac_get_status (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; -#ifdef LOG - printf("demux_flac: demux_flac_get_status\n"); -#endif + lprintf("demux_flac_get_status\n"); return this->status; } @@ -413,15 +392,12 @@ static int demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_flac_t *this = (demux_flac_t *) this_gen; -#ifdef LOG - printf("demux_flac: demux_flac_seek\n"); -#endif + lprintf("demux_flac_seek\n"); + if (start_pos || !start_time) { this->input->seek (this->input, start_pos, SEEK_SET); -#ifdef LOG - printf ("Seek to position: %lld\n", start_pos); -#endif + lprintf ("Seek to position: %lld\n", start_pos); } else { @@ -439,9 +415,7 @@ demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int target_sample); if (s) { -#ifdef LOG - printf ("Seek to: %d successfull!\n", start_time); -#endif + lprintf ("Seek to: %d successfull!\n", start_time); } else this->status = DEMUX_FINISHED; } @@ -455,9 +429,7 @@ static int demux_flac_get_stream_length (demux_plugin_t *this_gen) { demux_flac_t *this = (demux_flac_t *) this_gen; -#ifdef LOG - printf("demux_flac: demux_flac_get_stream_length\n"); -#endif + lprintf("demux_flac_get_stream_length\n"); if (this->flac_decoder) return this->length_in_msec; @@ -467,18 +439,16 @@ demux_flac_get_stream_length (demux_plugin_t *this_gen) { static uint32_t demux_flac_get_capabilities (demux_plugin_t *this_gen) { -#ifdef LOG - printf("demux_flac: demux_flac_get_capabilities\n"); -#endif - return DEMUX_CAP_NOCAP; + lprintf("demux_flac_get_capabilities\n"); + + return DEMUX_CAP_NOCAP; } static int demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int dtype) { -#ifdef LOG - printf("demux_flac: demux_flac_get_optional_data\n"); -#endif - return DEMUX_OPTIONAL_UNSUPPORTED; + lprintf("demux_flac_get_optional_data\n"); + + return DEMUX_OPTIONAL_UNSUPPORTED; } static demux_plugin_t * @@ -487,9 +457,7 @@ open_plugin (demux_class_t *class_gen, input_plugin_t *input) { demux_flac_t *this; -#ifdef LOG - printf("demux_flac: open_plugin\n"); -#endif + lprintf("open_plugin\n"); switch (stream->content_detection_method) { case METHOD_BY_CONTENT: @@ -565,9 +533,8 @@ open_plugin (demux_class_t *class_gen, /* Get a new FLAC decoder and hook up callbacks */ this->flac_decoder = FLAC__seekable_stream_decoder_new(); -#ifdef LOG - printf("demux_flac: this->flac_decoder: %p\n", this->flac_decoder); -#endif + lprintf("this->flac_decoder: %p\n", this->flac_decoder); + FLAC__seekable_stream_decoder_set_md5_checking (this->flac_decoder, false); FLAC__seekable_stream_decoder_set_read_callback (this->flac_decoder, flac_read_callback); @@ -599,9 +566,8 @@ open_plugin (demux_class_t *class_gen, */ this->status = DEMUX_OK; FLAC__seekable_stream_decoder_process_until_end_of_metadata (this->flac_decoder); -#ifdef LOG - printf("demux_flac: Processed file until end of metadata\n"); -#endif + + lprintf("Processed file until end of metadata\n"); return &this->demux_plugin; } @@ -633,9 +599,8 @@ static void class_dispose (demux_class_t *this_gen) { demux_flac_class_t *this = (demux_flac_class_t *) this_gen; -#ifdef LOG - printf("demux_flac: class_dispose\n"); -#endif + lprintf("class_dispose\n"); + free (this); } @@ -644,9 +609,8 @@ demux_flac_init_class (xine_t *xine, void *data) { demux_flac_class_t *this; -#ifdef LOG - printf("demux_flac: demux_flac_init_class\n"); -#endif + lprintf("demux_flac_init_class\n"); + this = xine_xmalloc (sizeof (demux_flac_class_t)); this->config = xine->config; this->xine = xine; diff --git a/src/libmad/xine_decoder.c b/src/libmad/xine_decoder.c index b9a77922c..fe6607b44 100644 --- a/src/libmad/xine_decoder.c +++ b/src/libmad/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.43 2003/11/16 23:33:45 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.44 2003/11/26 19:43:32 f1rmb Exp $ * * stuff needed to turn libmad into a xine decoder plugin */ @@ -25,6 +25,12 @@ #include #include +#define LOG_MODULE "mad_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "audio_out.h" #include "buffer.h" @@ -32,10 +38,6 @@ #include "synth.h" #include "xineutils.h" -/* -#define LOG -*/ - #define INPUT_BUF_SIZE 16384 typedef struct { @@ -125,9 +127,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_decoder_t *this = (mad_decoder_t *) this_gen; -#ifdef LOG - printf ("libmad: decode data, decoder_flags: %d\n", buf->decoder_flags); -#endif + lprintf ("decode data, decoder_flags: %d\n", buf->decoder_flags); if (buf->size>(INPUT_BUF_SIZE-this->bytes_in_buffer)) { printf ("libmad: ALERT input buffer too small (%d bytes, %d avail)!\n", @@ -188,11 +188,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { || (this->output_sampling_rate != this->frame.header.samplerate) || (this->output_mode != mode)) { -#ifdef LOG - printf ("libmad: audio sample rate %d mode %08x\n", - this->frame.header.samplerate, - mode); -#endif + lprintf ("audio sample rate %d mode %08x\n", this->frame.header.samplerate, mode); _x_stream_info_set(this->xstream, XINE_STREAM_INFO_AUDIO_BITRATE, this->frame.header.bitrate); switch (this->frame.header.layer) { @@ -266,9 +262,8 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { buf->pts = 0; } -#ifdef LOG - printf ("libmad: decode worked\n"); -#endif + + lprintf ("decode worked\n"); } } @@ -312,9 +307,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre mad_stream_init (&this->stream); mad_frame_init (&this->frame); -#ifdef LOG - printf ("libmad: init\n"); -#endif + lprintf ("init\n"); return &this->audio_decoder; } diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c index df30fbd6e..4c311c8a0 100644 --- a/src/libmpeg2/decode.c +++ b/src/libmpeg2/decode.c @@ -31,6 +31,12 @@ #include #include +#define LOG_MODULE "decode" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "mpeg2.h" @@ -41,10 +47,6 @@ #define LOG_PAN_SCAN */ -/* -#define LOG -*/ - /* #define BUFFER_SIZE (224 * 1024) */ #define BUFFER_SIZE (1194 * 1024) /* new buffer size for mpeg2dec 0.2.1 */ @@ -316,15 +318,11 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, switch (picture->picture_coding_type) { case B_TYPE: -#ifdef LOG - printf ("libmpeg2: B-Frame\n"); -#endif + lprintf ("B-Frame\n"); if (mpeg2dec->frames_to_drop>1) { -#ifdef LOG - printf ("libmpeg2: dropping b-frame because frames_to_drop==%d\n", - mpeg2dec->frames_to_drop); -#endif + lprintf ("dropping b-frame because frames_to_drop==%d\n", + mpeg2dec->frames_to_drop); mpeg2dec->drop_frame = 1; } else if (!picture->forward_reference_frame || picture->forward_reference_frame->bad_frame || !picture->backward_reference_frame || picture->backward_reference_frame->bad_frame) { @@ -343,25 +341,19 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, #endif mpeg2dec->drop_frame = 1; } else if (mpeg2dec->is_wait_for_ip_frames > 0) { -#ifdef LOG - printf("libmpeg2: dropping b-frame because refs are invalid\n"); -#endif + lprintf("dropping b-frame because refs are invalid\n"); mpeg2dec->drop_frame = 1; } break; case P_TYPE: -#ifdef LOG - printf ("libmpeg2: P-Frame\n"); -#endif + lprintf ("P-Frame\n"); if (mpeg2dec->frames_to_drop>2) { mpeg2dec->drop_frame = 1; -#ifdef LOG - printf ("libmpeg2: dropping p-frame because frames_to_drop==%d\n", - mpeg2dec->frames_to_drop); -#endif + lprintf ("dropping p-frame because frames_to_drop==%d\n", + mpeg2dec->frames_to_drop); } else if (!picture->backward_reference_frame || picture->backward_reference_frame->bad_frame) { mpeg2dec->drop_frame = 1; #ifdef LOG @@ -371,9 +363,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, printf ("libmpeg2: dropping p-frame because ref %d is bad\n", picture->backward_reference_frame->id); #endif } else if (mpeg2dec->is_wait_for_ip_frames > 1) { -#ifdef LOG - printf("libmpeg2: dropping p-frame because ref is invalid\n"); -#endif + lprintf("dropping p-frame because ref is invalid\n"); mpeg2dec->drop_frame = 1; } else if (mpeg2dec->is_wait_for_ip_frames) mpeg2dec->is_wait_for_ip_frames--; @@ -381,9 +371,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, break; case I_TYPE: -#ifdef LOG - printf ("libmpeg2: I-Frame\n"); -#endif + lprintf ("I-Frame\n"); /* for the sake of dvd menus, never drop i-frames if (mpeg2dec->frames_to_drop>4) { mpeg2dec->drop_frame = 1; @@ -548,11 +536,9 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, break; } -#ifdef LOG - printf ("libmpeg2: decoding frame %d, type %s\n", - picture->current_frame->id, picture->picture_coding_type == I_TYPE ? "I" : - picture->picture_coding_type == P_TYPE ? "P" : "B"); -#endif + lprintf ("decoding frame %d, type %s\n", + picture->current_frame->id, picture->picture_coding_type == I_TYPE ? "I" : + picture->picture_coding_type == P_TYPE ? "P" : "B"); mpeg2dec->pts = 0; } } @@ -572,9 +558,7 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code, if( picture->v_offset > picture->limit_y ) { picture->current_frame->bad_frame = 0; -#ifdef LOG - printf("libmpeg2: frame %d successfuly decoded\n",picture->current_frame->id); -#endif + lprintf("frame %d successfuly decoded\n",picture->current_frame->id); } } } @@ -729,10 +713,8 @@ void mpeg2_flush (mpeg2dec_t * mpeg2dec) { if (picture->current_frame && !picture->current_frame->drawn && !picture->current_frame->bad_frame) { -#ifdef LOG - printf ("libmpeg2: blasting out current frame %d on flush\n", - picture->current_frame->id); -#endif + lprintf ("blasting out current frame %d on flush\n", + picture->current_frame->id); picture->current_frame->drawn = 1; get_frame_duration(mpeg2dec, picture->current_frame); @@ -761,9 +743,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) if ( picture->current_frame ) { if( !picture->current_frame->drawn ) { -#ifdef LOG - printf ("libmpeg2: blasting out current frame on close\n"); -#endif + lprintf ("blasting out current frame on close\n"); picture->current_frame->pts = 0; get_frame_duration(mpeg2dec, picture->current_frame); picture->current_frame->draw (picture->current_frame, mpeg2dec->stream); @@ -785,9 +765,7 @@ void mpeg2_close (mpeg2dec_t * mpeg2dec) if (picture->backward_reference_frame) { if( !picture->backward_reference_frame->drawn) { -#ifdef LOG - printf ("libmpeg2: blasting out backward reference frame on close\n"); -#endif + lprintf ("blasting out backward reference frame on close\n"); picture->backward_reference_frame->pts = 0; get_frame_duration(mpeg2dec, picture->backward_reference_frame); picture->backward_reference_frame->draw (picture->backward_reference_frame, mpeg2dec->stream); diff --git a/src/libmpeg2/xine_decoder.c b/src/libmpeg2/xine_decoder.c index 6ec453ce0..0f2efb057 100644 --- a/src/libmpeg2/xine_decoder.c +++ b/src/libmpeg2/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.51 2003/10/23 20:12:33 mroi Exp $ + * $Id: xine_decoder.c,v 1.52 2003/11/26 19:43:34 f1rmb Exp $ * * stuff needed to turn libmpeg2 into a xine decoder plugin */ @@ -30,16 +30,18 @@ #include #include +#define LOG_MODULE "mpeg2_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "mpeg2.h" #include "mpeg2_internal.h" #include "buffer.h" -/* -#define LOG -*/ - typedef struct { video_decoder_class_t decoder_class; } mpeg2_class_t; @@ -55,9 +57,7 @@ typedef struct mpeg2dec_decoder_s { static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; -#ifdef LOG - printf ("libmpeg2: decode_data, flags=0x%08x ...\n", buf->decoder_flags); -#endif + lprintf ("decode_data, flags=0x%08x ...\n", buf->decoder_flags); /* handle aspect hints from xine-dvdnav */ if (buf->decoder_flags & BUF_FLAG_SPECIAL) { @@ -80,17 +80,13 @@ static void mpeg2dec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) buf->pts); } -#ifdef LOG - printf ("libmpeg2: decode_data...done\n"); -#endif + lprintf ("decode_data...done\n"); } static void mpeg2dec_flush (video_decoder_t *this_gen) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; -#ifdef LOG - printf ("libmpeg2: flush\n"); -#endif + lprintf ("flush\n"); mpeg2_flush (&this->mpeg2); } @@ -111,9 +107,7 @@ static void mpeg2dec_dispose (video_decoder_t *this_gen) { mpeg2dec_decoder_t *this = (mpeg2dec_decoder_t *) this_gen; -#ifdef LOG - printf ("libmpeg2: close\n"); -#endif + lprintf ("close\n"); mpeg2_close (&this->mpeg2); diff --git a/src/libreal/audio_decoder.c b/src/libreal/audio_decoder.c index c03e87d71..a1de359d0 100644 --- a/src/libreal/audio_decoder.c +++ b/src/libreal/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.31 2003/11/16 23:33:46 f1rmb Exp $ + * $Id: audio_decoder.c,v 1.32 2003/11/26 19:43:35 f1rmb Exp $ * * thin layer to use real binary-only codecs in xine * @@ -33,16 +33,18 @@ #include #include +#define LOG_MODULE "real_audio_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "bswap.h" #include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "xineutils.h" -/* -#define LOG -*/ - typedef struct { audio_decoder_class_t decoder_class; @@ -124,10 +126,7 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { sprintf (path, "%s/%s", entry->str_value, codec_name); -#ifdef LOG - printf ("libareal: (audio) opening shared obj '%s'\n", path); - -#endif + lprintf ("(audio) opening shared obj '%s'\n", path); this->ra_handle = dlopen (path, RTLD_LAZY); @@ -171,9 +170,7 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { this->raSetDLLAccessPath(path); } -#ifdef LOG - printf ("libareal: audio decoder loaded successfully\n"); -#endif + lprintf ("audio decoder loaded successfully\n"); return 1; } @@ -193,8 +190,8 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { version = BE_16 (buf->content); + lprintf ("header buffer detected, header version %d\n", version); #ifdef LOG - printf ("libareal: header buffer detected, header version %d\n", version); xine_hexdump (buf->content, buf->size); #endif @@ -232,13 +229,11 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->block_align= coded_frame_size2; -#ifdef LOG - printf ("libareal: 0x%04x 0x%04x 0x%04x 0x%04x data_len 0x%04x\n", - subpacket_size, coded_frame_size, codec_data_length, - coded_frame_size2, data_len); - printf ("libareal: %d samples/sec, %d bits/sample, %d channels\n", - samples_per_sec, bits_per_sample, num_channels); -#endif + lprintf ("0x%04x 0x%04x 0x%04x 0x%04x data_len 0x%04x\n", + subpacket_size, coded_frame_size, codec_data_length, + coded_frame_size2, data_len); + lprintf ("%d samples/sec, %d bits/sample, %d channels\n", + samples_per_sec, bits_per_sample, num_channels); /* load codec, resolv symbols */ @@ -322,9 +317,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { if (this->raSetPwd){ /* used by 'SIPR' */ this->raSetPwd (this->context, "Ardubancel Quazanga"); /* set password... lol. */ -#ifdef LOG - printf ("libareal: password set\n"); -#endif + lprintf ("password set\n"); } result = this->raSetFlavor (this->context, flavor); @@ -393,10 +386,8 @@ static unsigned char sipr_swaps[38][2]={ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; -#ifdef LOG - printf ("libareal: decode_data %d bytes, flags=0x%08x, pts=%lld ...\n", - buf->size, buf->decoder_flags, buf->pts); -#endif + lprintf ("decode_data %d bytes, flags=0x%08x, pts=%lld ...\n", + buf->size, buf->decoder_flags, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { @@ -412,9 +403,7 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) int size; -#ifdef LOG - printf ("libareal: content buffer detected, %d bytes\n", buf->size); -#endif + lprintf ("content buffer detected, %d bytes\n", buf->size); if (buf->pts && !this->pts) this->pts = buf->pts; @@ -432,9 +421,7 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, size); this->frame_num_bytes += size; -#ifdef LOG - printf ("libareal: buffering %d/%d bytes\n", this->frame_num_bytes, this->frame_size); -#endif + lprintf ("buffering %d/%d bytes\n", this->frame_num_bytes, this->frame_size); size = 0; @@ -448,19 +435,15 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) int h = this->h; audio_buffer_t *audio_buffer; -#ifdef LOG - printf ("libareal: buffering %d bytes\n", needed); -#endif + lprintf ("buffering %d bytes\n", needed); memcpy (this->frame_buffer+this->frame_num_bytes, buf->content, needed); size -= needed; this->frame_num_bytes = 0; -#ifdef LOG - printf ("libareal: frame completed. reordering...\n"); - printf ("libareal: bs=%d sps=%d w=%d h=%d \n",/*sh->wf->nBlockAlign*/-1,sps,w,h); -#endif + lprintf ("frame completed. reordering...\n"); + lprintf ("bs=%d sps=%d w=%d h=%d \n",/*sh->wf->nBlockAlign*/-1,sps,w,h); if (!sps) { @@ -508,10 +491,8 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) for (x=0; x>1))); -#endif + lprintf ("x=%d, y=%d, off %d\n", + x, y, sps*(h*x+((h+1)/2)*(y&1)+(y>>1))); memcpy (this->frame_reordered+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), s, sps); @@ -541,9 +522,7 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) this->block_align, (char *) audio_buffer->mem, &len, -1); -#ifdef LOG - printf ("libareal: raDecode result %d, len=%d\n", result, len); -#endif + lprintf ("raDecode result %d, len=%d\n", result, len); audio_buffer->vpts = this->pts; @@ -559,10 +538,7 @@ static void realdec_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) } } - -#ifdef LOG - printf ("libareal: decode_data...done\n"); -#endif + lprintf ("decode_data...done\n"); } static void realdec_reset (audio_decoder_t *this_gen) { @@ -581,9 +557,7 @@ static void realdec_dispose (audio_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; -#ifdef LOG - printf ("libareal: dispose\n"); -#endif + lprintf ("dispose\n"); if (this->context) this->raCloseCodec (this->context); @@ -595,9 +569,7 @@ static void realdec_dispose (audio_decoder_t *this_gen) { this->raFreeDecoder (this->context); #endif -#ifdef LOG - printf ("libareal: dlclose...\n"); -#endif + lprintf ("dlclose...\n"); if (this->ra_handle) dlclose (this->ra_handle); @@ -610,9 +582,7 @@ static void realdec_dispose (audio_decoder_t *this_gen) { free (this); -#ifdef LOG - printf ("libareal: dispose done\n"); -#endif + lprintf ("dispose done\n"); } static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, @@ -714,9 +684,7 @@ static void *init_class (xine_t *xine, void *data) { "/usr/lib/win32"); } -#ifdef LOG - printf ("libareal: real codec path : %s\n", real_codec_path); -#endif + lprintf ("real codec path : %s\n", real_codec_path); return this; } diff --git a/src/libreal/xine_decoder.c b/src/libreal/xine_decoder.c index b6488bd77..9f595f880 100644 --- a/src/libreal/xine_decoder.c +++ b/src/libreal/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.54 2003/11/16 23:33:46 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.55 2003/11/26 19:43:36 f1rmb Exp $ * * thin layer to use real binary-only codecs in xine * @@ -33,17 +33,18 @@ #include #include +#define LOG_MODULE "read_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "bswap.h" #include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "xineutils.h" -/* -#define LOG -*/ - - typedef struct { video_decoder_class_t decoder_class; @@ -124,9 +125,8 @@ static int load_syms_linux (realdec_decoder_t *this, char *codec_name) { sprintf (path, "%s/%s", entry->str_value, codec_name); -#ifdef LOG - printf ("libreal: opening shared obj '%s'\n", path); -#endif + lprintf ("opening shared obj '%s'\n", path); + this->rv_handle = dlopen (path, RTLD_LAZY); if (!this->rv_handle) { @@ -190,14 +190,12 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { this->height = (init_data.h + 1) & (~1); this->ratio = (double)this->width/(double)this->height; -#ifdef LOG - printf ("libreal: init_data.w=%d(0x%x), init_data.h=%d(0x%x)," - "this->width=%d(0x%x), this->height=%d(0x%x)\n", - init_data.w, init_data.w, - init_data.h, init_data.h, - this->width, this->width, this->height, this->height); -#endif - + lprintf ("init_data.w=%d(0x%x), init_data.h=%d(0x%x)," + "this->width=%d(0x%x), this->height=%d(0x%x)\n", + init_data.w, init_data.w, + init_data.h, init_data.h, + this->width, this->width, this->height, this->height); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); @@ -210,19 +208,16 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { printf ("libreal: buf->content\n"); xine_hexdump (buf->content, buf->size); - - printf ("libreal: init codec %dx%d... %x %x\n", - init_data.w, init_data.h, - init_data.subformat, init_data.format ); #endif - + lprintf ("init codec %dx%d... %x %x\n", + init_data.w, init_data.h, + init_data.subformat, init_data.format ); + this->context = NULL; result = this->rvyuv_init (&init_data, &this->context); -#ifdef LOG - printf ("libreal: init result: %d\n", result); -#endif + lprintf ("init result: %d\n", result); /* setup rv30 codec (codec sub-type and image dimensions): */ if ((init_data.format>=0x20200002) && (buf->type != BUF_VIDEO_RV40)) { @@ -299,10 +294,8 @@ static void realdec_copy_frame (realdec_decoder_t *this, uint8_t *base[3], int p static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; -#ifdef LOG - printf ("libreal: decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", - buf->decoder_flags, buf->size, buf->pts); -#endif + lprintf ("decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", + buf->decoder_flags, buf->size, buf->pts); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { /* real_find_sequence_header (&this->real, buf->content, buf->content + buf->size);*/ @@ -356,10 +349,9 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) transform_out, this->context); + lprintf ("transform result: %08x\n", result); + lprintf ("transform_out:\n"); #ifdef LOG - printf ("libreal: transform result: %08x\n", result); - - printf ("libreal: transform_out:\n"); xine_hexdump ((char *) transform_out, 5*4); #endif @@ -403,14 +395,12 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->duration); img->bad_frame = 0; -#ifdef LOG - printf ("libreal: pts %lld %lld diff %lld # %d est. duration %lld\n", - this->pts, - buf->pts, - buf->pts - this->pts, - this->num_frames, - this->duration); -#endif + lprintf ("pts %lld %lld diff %lld # %d est. duration %lld\n", + this->pts, + buf->pts, + buf->pts - this->pts, + this->num_frames, + this->duration); realdec_copy_frame (this, img->base, img->pitches); @@ -421,9 +411,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) /* new frame starting */ -#ifdef LOG - printf ("libreal: new frame starting (%d bytes)\n", buf->size); -#endif + lprintf ("new frame starting (%d bytes)\n", buf->size); memcpy (this->chunk_buffer, buf->content, buf->size); @@ -442,10 +430,7 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) /* buffer another fragment */ -#ifdef LOG - printf ("libreal: another fragment (%d chunks in buffer)\n", - this->num_chunks); -#endif + lprintf ("another fragment (%d chunks in buffer)\n", this->num_chunks); if (((buf->type != BUF_VIDEO_RV30) && (buf->type != BUF_VIDEO_RV40)) || (buf->content[0] == this->chunk_id)) { @@ -470,18 +455,13 @@ static void realdec_decode_data (video_decoder_t *this_gen, buf_element_t *buf) } } -#ifdef LOG - printf ("libreal: decode_data...done\n"); -#endif + lprintf ("decode_data...done\n"); } static void realdec_flush (video_decoder_t *this_gen) { /* realdec_decoder_t *this = (realdec_decoder_t *) this_gen; */ -#ifdef LOG - printf ("libreal: flush\n"); -#endif - + lprintf ("flush\n"); } static void realdec_reset (video_decoder_t *this_gen) { @@ -502,9 +482,7 @@ static void realdec_dispose (video_decoder_t *this_gen) { realdec_decoder_t *this = (realdec_decoder_t *) this_gen; -#ifdef LOG - printf ("libreal: dispose\n"); -#endif + lprintf ("dispose\n"); if (this->context) this->stream->video_out->close(this->stream->video_out, this->stream); @@ -526,9 +504,7 @@ static void realdec_dispose (video_decoder_t *this_gen) { free (this); -#ifdef LOG - printf ("libreal: dispose done\n"); -#endif + lprintf ("dispose done\n"); } static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, @@ -633,9 +609,7 @@ static void *init_class (xine_t *xine, void *data) { "/usr/lib/win32"); } -#ifdef LOG - printf ("libareal: real codec path : %s\n", real_codec_path); -#endif + lprintf ("real codec path : %s\n", real_codec_path); return this; } diff --git a/src/libspeex/xine_decoder.c b/src/libspeex/xine_decoder.c index 4f4f02bde..17a9fc9f3 100644 --- a/src/libspeex/xine_decoder.c +++ b/src/libspeex/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.5 2003/11/16 23:33:46 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.6 2003/11/26 19:43:36 f1rmb Exp $ * * (ogg/)speex audio decoder plugin (libspeex wrapper) for xine */ @@ -29,6 +29,12 @@ #include #include +#define LOG_MODULE "speex_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "audio_out.h" #include "buffer.h" @@ -41,10 +47,6 @@ #define MAX_FRAME_SIZE 2000 -/* -#define LOG -*/ - typedef struct { audio_decoder_class_t decoder_class; } speex_class_t; @@ -176,10 +178,8 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) int keylen = strlen(speex_comment_keys[i].key); char meta_info[(len - keylen) + 1]; -#ifdef LOG - printf ("libspeex: known metadata %d %d\n", - i, speex_comment_keys[i].xine_metainfo_index); -#endif + lprintf ("known metadata %d %d\n", + i, speex_comment_keys[i].xine_metainfo_index); snprintf(meta_info, (len - keylen), "%s", c + keylen); _x_meta_info_set(this->stream, speex_comment_keys[i].xine_metainfo_index, meta_info); @@ -194,15 +194,11 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { speex_decoder_t *this = (speex_decoder_t *) this_gen; -#ifdef LOG - printf ("libspeex: decode buf=%8p content=%8p flags=%08x\n", - buf, buf->content, buf->decoder_flags); -#endif + lprintf ("decode buf=%8p content=%8p flags=%08x\n", + buf, buf->content, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { -#ifdef LOG - printf ("libspeex: preview buffer, %d headers to go\n", this->header_count); -#endif + lprintf ("preview buffer, %d headers to go\n", this->header_count); if (this->header_count) { @@ -365,10 +361,9 @@ static void speex_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } } -#ifdef LOG - else - printf ("libspeex: output not open\n"); -#endif + else { + lprintf ("output not open\n"); + } } static void speex_dispose (audio_decoder_t *this_gen) { diff --git a/src/libsputext/demux_sputext.c b/src/libsputext/demux_sputext.c index 770368e5b..6a1b1692d 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/libsputext/demux_sputext.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: demux_sputext.c,v 1.29 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: demux_sputext.c,v 1.30 2003/11/26 19:43:36 f1rmb Exp $ * * code based on old libsputext/xine_decoder.c * @@ -43,14 +43,16 @@ #include #include +#define LOG_MODULE "demux_sputext" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "xineutils.h" #include "../demuxers/demux.h" -/* -#define LOG 1 -*/ - #define ERR (void *)-1 #define SUB_MAX_TEXT 5 #define SUB_BUFSIZE 1024 @@ -871,7 +873,7 @@ static int demux_sputext_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing) { demux_sputext_t *this = (demux_sputext_t*)this_gen; - lprintf("demux_sputext: seek() called\n"); + lprintf("seek() called\n"); /* simple seeking approach: just go back to start. * decoder will discard subtitles until the desired position. @@ -890,7 +892,7 @@ static void demux_sputext_send_headers(demux_plugin_t *this_gen) { buf_element_t *buf; - lprintf("demux_sputext: send_headers() called\n"); + lprintf("send_headers() called\n"); _x_demux_control_start(this->stream); _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); @@ -930,7 +932,7 @@ static demux_plugin_t *open_demux_plugin (demux_class_t *class_gen, xine_stream_ input_plugin_t *input = (input_plugin_t *) input_gen; demux_sputext_t *this; - lprintf("demux_sputext: open_plugin() called\n"); + lprintf("open_plugin() called\n"); this = xine_xmalloc (sizeof (demux_sputext_t)); this->stream = stream; @@ -1028,7 +1030,7 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { demux_sputext_class_t *this ; - lprintf("demux_sputext: initializing\n"); + lprintf("initializing\n"); this = xine_xmalloc (sizeof (demux_sputext_class_t)); diff --git a/src/libsputext/xine_decoder.c b/src/libsputext/xine_decoder.c index c856dd827..1bfe66aed 100644 --- a/src/libsputext/xine_decoder.c +++ b/src/libsputext/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.66 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: xine_decoder.c,v 1.67 2003/11/26 19:43:36 f1rmb Exp $ * */ @@ -30,15 +30,17 @@ #include #include +#define LOG_MODULE "sputext_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "buffer.h" #include "xine_internal.h" #include "xineutils.h" #include "osd.h" -/* -#define LOG 1 -*/ - #define SUB_MAX_TEXT 5 #define SUB_BUFSIZE 1024 @@ -244,11 +246,9 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su this->renderer->show (this->osd, sub_start); this->renderer->hide (this->osd, sub_end); -#ifdef LOG - printf ("sputext: scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", - this->text[0], sub_start, sub_end, - this->stream->xine->clock->get_current_time (this->stream->xine->clock)); -#endif + lprintf ("scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", + this->text[0], sub_start, sub_end, + this->stream->xine->clock->get_current_time (this->stream->xine->clock)); } @@ -281,16 +281,13 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { strcpy( this->text[i], str ); } -#ifdef LOG - printf("libsputext: decoder data [%s]\n", this->text[0]); - printf("libsputext: mode %d timing %d->%d\n", uses_time, start, end); -#endif + lprintf("decoder data [%s]\n", this->text[0]); + lprintf("mode %d timing %d->%d\n", uses_time, start, end); - if( end <= start ) { #ifdef LOG + if( end <= start ) printf("libsputext: discarding subtitle with invalid timing\n"); #endif - } spu_offset = this->stream->master->metronom->get_option (this->stream->master->metronom, METRONOM_SPU_OFFSET); @@ -316,9 +313,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { /* discard old subtitles */ if( diff < 0 ) { -#ifdef LOG - printf("libsputext: discarding old\n"); -#endif + lprintf("discarding old\n"); + return; } @@ -345,9 +341,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { /* discard old subtitles */ if( diff < 0 ) { -#ifdef LOG - printf("libsputext: discarding old\n"); -#endif + lprintf("discarding old\n"); + return; } @@ -368,9 +363,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( this->master_started && (status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP) ) { -#ifdef LOG - printf("libsputext: master stopped\n"); -#endif + lprintf("master stopped\n"); + this->width = this->height = 0; return; } @@ -381,9 +375,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( this->slave_started && (status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP) ) { -#ifdef LOG - printf("libsputext: slave stopped\n"); -#endif + lprintf("slave stopped\n"); + this->width = this->height = 0; return; } @@ -394,9 +387,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { _x_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) ); } -#ifdef LOG - printf("libsputext: seek_count mismatch\n"); -#endif + + lprintf("seek_count mismatch\n"); } @@ -500,9 +492,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { }; sputext_class_t *this ; -#ifdef LOG - printf("libsputext: init class\n"); -#endif + lprintf("init class\n"); this = (sputext_class_t *) xine_xmalloc (sizeof (sputext_class_t)); diff --git a/src/libsputext/xine_decoder_ogm.c b/src/libsputext/xine_decoder_ogm.c index 98cee9746..21ad356b6 100644 --- a/src/libsputext/xine_decoder_ogm.c +++ b/src/libsputext/xine_decoder_ogm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder_ogm.c,v 1.7 2003/11/11 18:44:55 f1rmb Exp $ + * $Id: xine_decoder_ogm.c,v 1.8 2003/11/26 19:43:36 f1rmb Exp $ * */ @@ -30,15 +30,17 @@ #include #include +#define LOG_MODULE "sputext_ogm_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "buffer.h" #include "xine_internal.h" #include "xineutils.h" #include "osd.h" -/* -#define LOG 1 -*/ - #define SUB_MAX_TEXT 5 @@ -260,11 +262,9 @@ static void draw_subtitle(spuogm_decoder_t *this, int64_t sub_start, int64_t sub this->renderer->show (this->osd, sub_start); this->renderer->hide (this->osd, sub_end); -#ifdef LOG - printf ("spuogm: scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", - this->text[0], sub_start, sub_end, - this->stream->xine->clock->get_current_time (this->stream->xine->clock)); -#endif + lprintf ("scheduling subtitle >%s< at %lld until %lld, current time is %lld\n", + this->text[0], sub_start, sub_end, + this->stream->xine->clock->get_current_time (this->stream->xine->clock)); } @@ -313,18 +313,17 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { this->lines++; } + lprintf("lines %d\n", this->lines); #ifdef LOG - printf("libspuogm: lines %d\n", this->lines); for(i=0;ilines;i++) - printf("libspuogm: decoder data [%s]\n", this->text[i]); - printf("libspuogm: timing %d->%d\n", start, end); + lprintf("libspuogm: decoder data [%s]\n", this->text[i]); #endif + lprintf("timing %d->%d\n", start, end); - if( end <= start ) { #ifdef LOG + if( end <= start ) printf("libspuogm: discarding subtitle with invalid timing\n"); #endif - } spu_offset = this->stream->master->metronom->get_option (this->stream->master->metronom, METRONOM_SPU_OFFSET); @@ -359,9 +358,7 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { /* discard old subtitles */ if( diff < 0 ) { -#ifdef LOG - printf("libspuogm: discarding old\n"); -#endif + lprintf("discarding old\n"); return; } @@ -381,9 +378,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( this->master_started && (status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP) ) { -#ifdef LOG - printf("libspuogm: master stopped\n"); -#endif + lprintf("master stopped\n"); + this->width = this->height = 0; return; } @@ -394,9 +390,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { if( this->slave_started && (status == XINE_STATUS_QUIT || status == XINE_STATUS_STOP) ) { -#ifdef LOG - printf("libspuogm: slave stopped\n"); -#endif + lprintf("slave stopped\n"); + this->width = this->height = 0; return; } @@ -407,9 +402,8 @@ static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf) { _x_get_current_info (this->stream->master, &extra_info, sizeof(extra_info) ); } -#ifdef LOG - printf("libspuogm: seek_count mismatch\n"); -#endif + + lprintf("seek_count mismatch\n"); } @@ -470,9 +464,7 @@ static spu_decoder_t *spuogm_class_open_plugin (spu_decoder_class_t *class_gen, spuogm_decoder_t *this ; static char *subtitle_size_strings[] = { "small", "normal", "large", NULL }; -#ifdef LOG - printf ("libspuogm: plugin opened\n"); -#endif + lprintf ("plugin opened\n"); this = (spuogm_decoder_t *) xine_xmalloc (sizeof (spuogm_decoder_t)); @@ -532,9 +524,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { spuogm_class_t *this ; -#ifdef LOG - printf("libspuogm: init class\n"); -#endif + lprintf("init class\n"); this = (spuogm_class_t *) xine_xmalloc (sizeof (spuogm_class_t)); diff --git a/src/libtheora/xine_decoder.c b/src/libtheora/xine_decoder.c index 41a4ddd81..be22c34be 100644 --- a/src/libtheora/xine_decoder.c +++ b/src/libtheora/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.14 2003/10/23 20:12:33 mroi Exp $ + * $Id: xine_decoder.c,v 1.15 2003/11/26 19:43:36 f1rmb Exp $ * * xine decoder plugin using libtheora * @@ -35,16 +35,19 @@ #include #include #include + +#define LOG_MODULE "theora_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "buffer.h" #include "metronom.h" #include "xineutils.h" -/* -#define LOG -*/ - typedef struct theora_class_s { video_decoder_class_t decoder_class; } theora_class_t; @@ -184,16 +187,16 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (this->hp_read==3) { /*headers are now decoded. initialize the decoder*/ theora_decode_init (&this->t_state, &this->t_info); -#ifdef LOG - printf("libtheora: theora stream is Theora %dx%d %.02f fps video.\n" - " frame content is %dx%d with offset (%d,%d).\n" - " pixel aspect is %d:%d.\n", - this->t_info.width,this->t_info.height, - (double)this->t_info.fps_numerator/this->t_info.fps_denominator, - this->t_info.frame_width, this->t_info.frame_height, - this->t_info.offset_x, this->t_info.offset_y, - this->t_info.aspect_numerator, this->t_info.aspect_denominator); -#endif + + lprintf("theora stream is Theora %dx%d %.02f fps video.\n" + " frame content is %dx%d with offset (%d,%d).\n" + " pixel aspect is %d:%d.\n", + this->t_info.width,this->t_info.height, + (double)this->t_info.fps_numerator/this->t_info.fps_denominator, + this->t_info.frame_width, this->t_info.frame_height, + this->t_info.offset_x, this->t_info.offset_y, + this->t_info.aspect_numerator, this->t_info.aspect_denominator); + this->frame_duration=((int64_t)90000*this->t_info.fps_denominator)/this->t_info.fps_numerator; this->width=this->t_info.frame_width; this->height=this->t_info.frame_height; @@ -284,9 +287,7 @@ static void theora_dispose (video_decoder_t *this_gen) { theora_decoder_t *this = (theora_decoder_t *) this_gen; -#ifdef LOG - printf ("libtheora: dispose \n"); -#endif + lprintf ("dispose \n"); theora_clear (&this->t_state); theora_comment_clear (&this->t_comment); diff --git a/src/libvorbis/xine_decoder.c b/src/libvorbis/xine_decoder.c index 13c49d3a8..8258bf2bc 100644 --- a/src/libvorbis/xine_decoder.c +++ b/src/libvorbis/xine_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_decoder.c,v 1.30 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: xine_decoder.c,v 1.31 2003/11/26 19:43:36 f1rmb Exp $ * * (ogg/)vorbis audio decoder plugin (libvorbis wrapper) for xine */ @@ -29,6 +29,12 @@ #include #include +#define LOG_MODULE "vorbis_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "audio_out.h" #include "buffer.h" @@ -38,10 +44,6 @@ #define MAX_NUM_SAMPLES 4096 -/* -#define LOG -*/ - typedef struct { audio_decoder_class_t decoder_class; } vorbis_class_t; @@ -107,19 +109,15 @@ static void get_metadata (vorbis_decoder_t *this) { char *comment = *ptr; int i; -#ifdef LOG - printf("libvorbis: %s\n", comment); -#endif + lprintf("%s\n", comment); for (i = 0; vorbis_comment_keys[i].key != NULL; i++) { if ( !strncasecmp (vorbis_comment_keys[i].key, comment, strlen(vorbis_comment_keys[i].key)) ) { -#ifdef LOG - printf ("libvorbis: known metadata %d %d\n", - i, vorbis_comment_keys[i].xine_metainfo_index); -#endif + lprintf ("known metadata %d %d\n", + i, vorbis_comment_keys[i].xine_metainfo_index); _x_meta_info_set(this->stream, vorbis_comment_keys[i].xine_metainfo_index, comment + strlen(vorbis_comment_keys[i].key)); @@ -137,15 +135,12 @@ static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; ogg_packet *op = (ogg_packet *) buf->content; -#ifdef LOG - printf ("libvorbis: decode buf=%08x content=%08x op=%08x packet=%08x flags=%08x\n", - buf, buf->content, op, op->packet, buf->decoder_flags); -#endif + lprintf ("decode buf=%08x content=%08x op=%08x packet=%08x flags=%08x\n", + buf, buf->content, op, op->packet, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_PREVIEW) { -#ifdef LOG - printf ("libvorbis: preview buffer, %d headers to go\n", this->header_count); -#endif + lprintf ("preview buffer, %d headers to go\n", this->header_count); + if (this->header_count) { if(vorbis_synthesis_headerin(&this->vi,&this->vc,op)<0){ diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index dfb577089..0513e236a 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: qt_decoder.c,v 1.26 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: qt_decoder.c,v 1.27 2003/11/26 19:43:37 f1rmb Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -33,6 +33,12 @@ #include #include +#define LOG_MODULE "qt_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "bswap.h" #include "xine_internal.h" #include "audio_out.h" @@ -52,10 +58,6 @@ #endif #define FOUR_CHAR_CODE BE_FOURCC -/* -#define LOG -*/ - /* * * part 0: common wine stuff @@ -76,15 +78,11 @@ extern char *win32_def_path; static void init_routine(void) { -#ifdef LOG - printf ("qt_decoder: init_routine\n"); -#endif + lprintf ("%s\n", __XINE_FUNCTION__); pthread_mutex_init (&win32_codec_mutex, NULL); -#ifdef LOG - printf ("qt_decoder: init_routine completed\n"); -#endif + lprintf ("%s completed\n", __XINE_FUNCTION__); } #define BUFSIZE 1024*1024 @@ -222,15 +220,11 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->FramesToGet = 0; -#ifdef LOG - printf ("qt_audio: init_driver... (trying to lock mutex...)\n"); -#endif + lprintf ("audio: init_driver... (trying to lock mutex...)\n"); pthread_mutex_lock(&win32_codec_mutex); -#ifdef LOG - printf ("qt_audio: init_driver... (mutex locked)\n"); -#endif + lprintf ("audio: init_driver... (mutex locked)\n"); this->ldt_fs = Setup_LDT_Keeper(); @@ -298,14 +292,11 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { pthread_mutex_unlock(&win32_codec_mutex); return; } -#ifdef LOG - printf ("qt_audio: Standard init done you may now call supported functions\n"); -#endif + lprintf ("audio: Standard init done you may now call supported functions\n"); error = this->InitializeQTML(6+16); -#ifdef LOG - printf ("qt_audio: InitializeQTML:%i\n",error); -#endif + lprintf ("audio: InitializeQTML:%i\n",error); + if (error) { pthread_mutex_unlock(&win32_codec_mutex); return; @@ -355,9 +346,8 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { error = this->SoundConverterOpen (&this->InputFormatInfo, &this->OutputFormatInfo, &this->myConverter); -#ifdef LOG - printf ("qt_audio: SoundConverterOpen:%i\n",error); -#endif + lprintf ("audio: SoundConverterOpen:%i\n",error); + if (error) { pthread_mutex_unlock(&win32_codec_mutex); return; @@ -367,9 +357,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { error = this->SoundConverterSetInfo (this->myConverter, FOUR_CHAR_CODE('w','a','v','e'), ((unsigned char *)buf->decoder_info_ptr[2]) + 0x38); -#ifdef LOG - printf ("qt_audio: SoundConverterSetInfo:%i\n",error); -#endif + lprintf ("audio: SoundConverterSetInfo:%i\n",error); if (error) { pthread_mutex_unlock(&win32_codec_mutex); @@ -381,33 +369,26 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { error = this->SoundConverterGetBufferSizes (this->myConverter, WantedBufferSize, &this->FramesToGet, &InputBufferSize, &OutputBufferSize); -#ifdef LOG - printf ("qt_audio: SoundConverterGetBufferSizes:%i\n", error); - printf ("qt_audio: WantedBufferSize = %li\n", WantedBufferSize); - printf ("qt_audio: InputBufferSize = %li\n", InputBufferSize); - printf ("qt_audio: OutputBufferSize = %li\n", OutputBufferSize); - printf ("qt_audio: this->FramesToGet = %li\n", this->FramesToGet); -#endif + lprintf ("audio: SoundConverterGetBufferSizes:%i\n", error); + lprintf ("audio: WantedBufferSize = %li\n", WantedBufferSize); + lprintf ("audio: InputBufferSize = %li\n", InputBufferSize); + lprintf ("audio: OutputBufferSize = %li\n", OutputBufferSize); + lprintf ("audio: this->FramesToGet = %li\n", this->FramesToGet); this->InFrameSize = (InputBufferSize+this->FramesToGet-1)/this->FramesToGet; this->OutFrameSize = OutputBufferSize/this->FramesToGet; -#ifdef LOG - printf ("qt_audio: FrameSize: %i -> %i\n", this->InFrameSize, this->OutFrameSize); -#endif + lprintf ("audio: FrameSize: %i -> %i\n", this->InFrameSize, this->OutFrameSize); error = this->SoundConverterBeginConversion (this->myConverter); -#ifdef LOG - printf ("qt_audio: SoundConverterBeginConversion:%i\n",error); -#endif + lprintf ("audio: SoundConverterBeginConversion:%i\n",error); + if (error) { pthread_mutex_unlock(&win32_codec_mutex); return; } -#ifdef LOG - printf ("qt_audio: opening output.\n"); -#endif + lprintf ("audio: opening output.\n"); switch (this->wave.nChannels) { case 1: @@ -441,9 +422,7 @@ static void qta_init_driver (qta_decoder_t *this, buf_element_t *buf) { this->codec_initialized = 1; -#ifdef LOG - printf ("qt_audio: mutex unlock\n"); -#endif + lprintf ("audio: mutex unlock\n"); pthread_mutex_unlock(&win32_codec_mutex); } @@ -452,10 +431,8 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { qta_decoder_t *this = (qta_decoder_t *) this_gen; -#ifdef LOG - printf ("qt_audio: decode buf=%08x %d bytes flags=%08x pts=%lld\n", - buf, buf->size, buf->decoder_flags, buf->pts); -#endif + lprintf ("audio: decode buf=%08x %d bytes flags=%08x pts=%lld\n", + buf, buf->size, buf->decoder_flags, buf->pts); if (buf->decoder_flags & BUF_FLAG_HEADER) { @@ -465,20 +442,13 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->wave.wBitsPerSample = buf->decoder_info[2]; this->wave.nSamplesPerSec = buf->decoder_info[1]; -#ifdef LOG - printf ("qt_audio: header copied\n"); -#endif + lprintf ("audio: header copied\n"); } else if (buf->decoder_flags & BUF_FLAG_SPECIAL) { -#ifdef LOG - printf ("qt_audio: special buffer\n"); -#endif + lprintf ("audio: special buffer\n"); if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { - -#ifdef LOG - printf ("qt_audio: got stsd atom -> init codec\n"); -#endif + lprintf ("audio: got stsd atom -> init codec\n"); if (!this->codec_initialized) { qta_init_driver (this, buf); @@ -508,10 +478,8 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { &out_frames, &out_bytes); pthread_mutex_unlock(&win32_codec_mutex); -#ifdef LOG - printf ("qt_audio: decoded %d frames => %d frames (error %d)\n", - num_frames, out_frames, error); -#endif + lprintf ("audio: decoded %d frames => %d frames (error %d)\n", + num_frames, out_frames, error); this->data_len -= this->InFrameSize * num_frames; if (this->data_len>0) @@ -538,10 +506,7 @@ static void qta_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { buf->pts = 0; /* only the first buffer gets the real pts */ audio_buffer->num_frames = nframes; -#ifdef LOG - printf ("qt_audio: sending %d frames, %d frames left\n", - nframes, frames_left); -#endif + lprintf ("audio: sending %d frames, %d frames left\n", nframes, frames_left); this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); @@ -573,13 +538,12 @@ static void qta_dispose (audio_decoder_t *this_gen) { error = this->SoundConverterEndConversion (this->myConverter,NULL, &ConvertedFrames,&ConvertedBytes); -#ifdef LOG - printf ("qt_audio: SoundConverterEndConversion:%i\n",error); -#endif + lprintf ("audio: SoundConverterEndConversion:%i\n",error); + error = this->SoundConverterClose (this->myConverter); -#ifdef LOG - printf ("qt_audio: SoundConverterClose:%i\n",error); -#endif + + lprintf ("audio: SoundConverterClose:%i\n",error); + Restore_LDT_Keeper(this->ldt_fs); this->ldt_fs = NULL; } @@ -798,15 +762,11 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { ImageSubCodecDecompressCapabilities icap; /* for ImageCodecInitialize() */ ImageDescription *id; -#ifdef LOG - printf ("qt_video: init_driver... (trying to lock mutex...)\n"); -#endif + lprintf ("video: init_driver... (trying to lock mutex...)\n"); pthread_mutex_lock(&win32_codec_mutex); -#ifdef LOG - printf ("qt_video: mutex locked\n"); -#endif + lprintf ("video: mutex locked\n"); this->ldt_fs = Setup_LDT_Keeper(); @@ -842,15 +802,12 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { return; } -#ifdef LOG - printf ("qt_video: calling InitializeQTML...\n"); -#endif + lprintf ("video: calling InitializeQTML...\n"); result = this->InitializeQTML(6+16); /* result=InitializeQTML(0); */ -#ifdef LOG - printf("qt_video: InitializeQTML returned %d\n",result); -#endif + lprintf("video: InitializeQTML returned %d\n",result); + /* result=EnterMovies(); */ /* printf("EnterMovies->%d\n",result); */ @@ -862,9 +819,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { desc.componentFlags=0; desc.componentFlagsMask=0; -#ifdef LOG - printf("qt_video: Count = %d\n", this->CountComponents(&desc)); -#endif + lprintf("video: Count = %d\n", this->CountComponents(&desc)); prev = this->FindNextComponent(NULL,&desc); if(!prev){ @@ -872,28 +827,25 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { pthread_mutex_unlock(&win32_codec_mutex); return; } -#ifdef LOG - printf ("qt_video: Found it! ID = 0x%X\n",prev); -#endif + + lprintf ("video: Found it! ID = 0x%X\n",prev); this->ci = this->OpenComponent(prev); - printf ("qt_video: this->ci=%p\n",this->ci); + lprintf ("video: this->ci=%p\n",this->ci); memset (&icap,0,sizeof(icap)); cres = this->ImageCodecInitialize (this->ci, &icap); -#ifdef LOG - printf ("qt_video: ImageCodecInitialize->%p size=%d (%d)\n", - cres,icap.recordSize,icap.decompressRecordSize); -#endif + + lprintf ("video: ImageCodecInitialize->%p size=%d (%d)\n", + cres,icap.recordSize,icap.decompressRecordSize); memset(&cinfo,0,sizeof(cinfo)); cres = this->ImageCodecGetCodecInfo (this->ci, &cinfo); -#ifdef LOG - printf ("qt_video: Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", - cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags); - printf ("qt_video: Codec name: %.*s\n", ((unsigned char*)&cinfo.typeName)[0], - ((unsigned char*)&cinfo.typeName)+1); -#endif + + lprintf ("video: Flags: compr: 0x%X decomp: 0x%X format: 0x%X\n", + cinfo.compressFlags, cinfo.decompressFlags, cinfo.formatFlags); + lprintf ("video: Codec name: %.*s\n", ((unsigned char*)&cinfo.typeName)[0], + ((unsigned char*)&cinfo.typeName)+1); /* make a yuy2 gworld */ this->OutBufferRect.top = 0; @@ -901,12 +853,11 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->OutBufferRect.right = this->bih.biWidth; this->OutBufferRect.bottom = this->bih.biHeight; -#ifdef LOG - printf ("qt_video: image size %d x %d\n", - this->bih.biWidth, this->bih.biHeight); - - printf ("qt_video: stsd (%d bytes):\n", buf->decoder_info[2]) ; + lprintf ("video: image size %d x %d\n", + this->bih.biWidth, this->bih.biHeight); + lprintf ("video: stsd (%d bytes):\n", buf->decoder_info[2]) ; +#ifdef LOG qtv_hexdump ((unsigned char *)buf->decoder_info_ptr[2], buf->decoder_info[2]); #endif @@ -934,26 +885,21 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { if (stdata_len>0x56) memcpy (((char*)&id->clutID)+2, stdata+0x52, stdata_len-0x52); + lprintf ("video: id (%d bytes)\n", stdata_len); #ifdef LOG - printf ("qt_video: id (%d bytes)\n", stdata_len); qtv_hexdump (id, stdata_len); #endif } + lprintf ("video: ImageDescription size: %d\n", id->idSize); #ifdef LOG - printf ("qt_video: ImageDescription size: %d\n", - id->idSize); - qtv_hexdump (id, id->idSize); #endif this->framedescHandle = (ImageDescriptionHandle) this->NewHandleClear (id->idSize); -#ifdef LOG - printf ("qt_video: framedescHandle = %x\n", - this->framedescHandle); -#endif + lprintf ("video: framedescHandle = %x\n", this->framedescHandle); memcpy (*this->framedescHandle, id, id->idSize); @@ -972,10 +918,7 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->plane, this->bih.biWidth*2); -#ifdef LOG - printf ("qt_video: NewGWorldFromPtr returned:%d\n", - 65536-(result&0xffff)); -#endif + lprintf ("video: NewGWorldFromPtr returned:%d\n", 65536-(result&0xffff)); this->decpar.imageDescription = this->framedescHandle; this->decpar.startLine = 0; @@ -993,9 +936,8 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { this->decpar.dstPixMap = **this->GetGWorldPixMap (this->OutBufferGWorld);/*destPixmap; */ cres = this->ImageCodecPreDecompress (this->ci, &this->decpar); -#ifdef LOG - printf ("qt_video: ImageCodecPreDecompress cres=0x%X\n", cres); -#endif + + lprintf ("video: ImageCodecPreDecompress cres=0x%X\n", cres); this->data_len = 0; @@ -1010,16 +952,11 @@ static void qtv_init_driver (qtv_decoder_t *this, buf_element_t *buf) { static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { qtv_decoder_t *this = (qtv_decoder_t *) this_gen; -#ifdef LOG - printf ("qt_video: decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", - buf->decoder_flags, buf->size, buf->pts); -#endif + lprintf ("video: decode_data, flags=0x%08x, len=%d, pts=%lld ...\n", + buf->decoder_flags, buf->size, buf->pts); if (buf->decoder_flags & BUF_FLAG_HEADER) { - -#ifdef LOG - printf ("qt_video: copying bih\n"); -#endif + lprintf ("video: copying bih\n"); memcpy (&this->bih, buf->content, sizeof (xine_bmiheader)); this->ratio = (double)this->bih.biWidth / (double)this->bih.biHeight; @@ -1028,15 +965,10 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, "Sorenson Video 3 (QT DLL)"); } else if (buf->decoder_flags & BUF_FLAG_SPECIAL) { -#ifdef LOG - printf ("qt_video: special buffer\n"); -#endif + lprintf ("video: special buffer\n"); if (buf->decoder_info[1] == BUF_SPECIAL_STSD_ATOM) { - -#ifdef LOG - printf ("qt_video: got stsd atom -> init codec\n"); -#endif + lprintf ("video: got stsd atom -> init codec\n"); if (!this->codec_initialized) { qtv_init_driver (this, buf); @@ -1046,16 +978,12 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } } else if (this->codec_initialized) { -#ifdef LOG - printf ("qt_video: actual image data\n"); -#endif + lprintf ("video: actual image data\n"); memcpy (&this->data[this->data_len], buf->content, buf->size); this->data_len += buf->size; -#ifdef LOG - printf ("qt_video: got %d bytes in buffer\n", this->data_len); -#endif + lprintf ("video: got %d bytes in buffer\n", this->data_len); if (buf->decoder_flags & BUF_FLAG_FRAME_END) { @@ -1102,18 +1030,13 @@ static void qtv_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } } -#ifdef LOG - printf ("qt_video: decode_data...done\n"); -#endif + lprintf ("video: decode_data...done\n"); } static void qtv_flush (video_decoder_t *this_gen) { /* qtv_decoder_t *this = (qtv_decoder_t *) this_gen; */ -#ifdef LOG - printf ("qt_video: flush\n"); -#endif - + lprintf ("video: flush\n"); } static void qtv_reset (video_decoder_t *this_gen) { @@ -1137,9 +1060,7 @@ static void qtv_dispose (video_decoder_t *this_gen) { this->ldt_fs = NULL; } -#ifdef LOG - printf ("qt_video: dispose\n"); -#endif + lprintf ("video: dispose\n"); free (this); } @@ -1201,9 +1122,7 @@ static void *qtv_init_class (xine_t *xine, void *data) { _("path to win32 codec dlls"), NULL, 0, NULL, NULL); -#ifdef LOG - printf ("qtv_init_class...\n"); -#endif + lprintf ("%s...\n", __XINE_FUNCTION__); pthread_once (&once_control, init_routine); diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 355a0ce38..6ab0f955d 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: w32codec.c,v 1.131 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: w32codec.c,v 1.132 2003/11/26 19:43:37 f1rmb Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -47,16 +47,18 @@ #include "dmo/DMO_AudioDecoder.h" #include "dmo/DMO_VideoDecoder.h" +#define LOG_MODULE "w32codec" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "audio_out.h" #include "buffer.h" #include "xineutils.h" -/* -#define LOG -*/ - static GUID CLSID_Voxware = { 0x73f7a062, 0x8829, 0x11d1, @@ -494,9 +496,7 @@ static void w32v_init_codec (w32v_decoder_t *this, int buf_type) { uint32_t vo_cap; int outfmt; -#ifdef LOG - printf ("w32codec: init codec...\n"); -#endif + lprintf ("init codec...\n"); memset(&this->o_bih, 0, sizeof(BITMAPINFOHEADER)); this->o_bih.biSize = sizeof(BITMAPINFOHEADER); @@ -693,11 +693,8 @@ static void w32v_init_ds_dmo_codec (w32v_decoder_t *this, int buf_type) { static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { w32v_decoder_t *this = (w32v_decoder_t *) this_gen; - -#ifdef LOG - printf ("w32codec: processing packet type = %08x, buf->decoder_flags=%08x\n", - buf->type, buf->decoder_flags); -#endif + lprintf ("processing packet type = %08x, buf->decoder_flags=%08x\n", + buf->type, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_PREVIEW) return; @@ -706,9 +703,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if ( buf->type & 0xff ) return; -#ifdef LOG - printf ("w32codec: processing header ...\n"); -#endif + lprintf ("processing header ...\n"); /* init package containing bih */ if( this->bih ) @@ -723,9 +718,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->bih->biHeight); _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); -#ifdef LOG - printf ("w32codec: video_step is %lld\n", this->video_step); -#endif + lprintf ("video_step is %lld\n", this->video_step); pthread_mutex_lock(&win32_codec_mutex); win32_codec_name = get_vids_codec_name (this, buf->type); @@ -751,9 +744,8 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } else if (this->decoder_ok) { -#ifdef LOG - printf ("w32codec: processing packet ...\n"); -#endif + lprintf ("processing packet ...\n"); + if( (int) buf->size <= 0 ) return; @@ -799,9 +791,7 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { img->duration = this->video_step; -#ifdef LOG - printf ("w32codec: frame duration is %lld\n", this->video_step); -#endif + lprintf ("frame duration is %lld\n", this->video_step); if (this->outfmt==IMGFMT_YUY2) img_buffer = img->base[0]; @@ -899,21 +889,15 @@ static void w32v_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { if (!this->skipframes) printf("w32codec: Error decompressing frame, err=%ld\n", (long)ret); img->bad_frame = 1; -#ifdef LOG - printf ("w32codec: BAD FRAME, duration is %d\n", img->duration); -#endif + lprintf ("BAD FRAME, duration is %d\n", img->duration); } else { img->bad_frame = 0; -#ifdef LOG - printf ("w32codec: GOOD FRAME, duration is %d\n\n", img->duration); -#endif + lprintf ("GOOD FRAME, duration is %d\n\n", img->duration); } this->skipframes = img->draw(img, this->stream); -#ifdef LOG - printf ("w32codec: skipframes is %d\n", this->skipframes); -#endif + lprintf ("skipframes is %d\n", this->skipframes); if (this->skipframes < 0) this->skipframes = 0; @@ -1274,10 +1258,9 @@ static void w32a_decode_audio (w32a_decoder_t *this, xine_fast_memcpy (&this->buf[this->size], data, size); -#ifdef LOG - printf("w32codec: w32a_decode_audio: demux pts=%lld, this->size=%d, d=%d, rate=%lf\n", - pts, this->size, delay, this->byterate); -#endif + lprintf("w32a_decode_audio: demux pts=%lld, this->size=%d, d=%d, rate=%lf\n", + pts, this->size, delay, this->byterate); + this->size += size; while (this->size >= this->rec_audio_src_size) { @@ -1290,12 +1273,10 @@ static void w32a_decode_audio (w32a_decoder_t *this, ash.pbDst=this->outbuf; ash.cbDstLength=this->outsize; -#ifdef LOG - printf ("decoding %d of %d bytes (%02x %02x %02x %02x ... %02x %02x)\n", - this->rec_audio_src_size, this->size, - this->buf[0], this->buf[1], this->buf[2], this->buf[3], - this->buf[this->rec_audio_src_size-2], this->buf[this->rec_audio_src_size-1]); -#endif + lprintf ("decoding %d of %d bytes (%02x %02x %02x %02x ... %02x %02x)\n", + this->rec_audio_src_size, this->size, + this->buf[0], this->buf[1], this->buf[2], this->buf[3], + this->buf[this->rec_audio_src_size-2], this->buf[this->rec_audio_src_size-1]); pthread_mutex_lock(&win32_codec_mutex); if( this->driver_type == DRIVER_STD ) { @@ -1330,10 +1311,10 @@ static void w32a_decode_audio (w32a_decoder_t *this, int DstLengthUsed, bufsize; audio_buffer_t *audio_buffer; char *p; -#ifdef LOG - printf ("acmStreamConvert worked, used %d bytes, generated %d bytes\n", - ash.cbSrcLengthUsed, ash.cbDstLengthUsed); -#endif + + lprintf ("acmStreamConvert worked, used %d bytes, generated %d bytes\n", + ash.cbSrcLengthUsed, ash.cbDstLengthUsed); + DstLengthUsed = ash.cbDstLengthUsed; p = this->outbuf; @@ -1354,9 +1335,8 @@ static void w32a_decode_audio (w32a_decoder_t *this, else audio_buffer->vpts = 0; -#ifdef LOG - printf("w32codec: w32a_decode_audio: decoder pts=%lld\n", audio_buffer->vpts); -#endif + lprintf("w32a_decode_audio: decoder pts=%lld\n", audio_buffer->vpts); + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); this->pts = 0; @@ -1387,17 +1367,12 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { w32a_decoder_t *this = (w32a_decoder_t *) this_gen; if (buf->decoder_flags & BUF_FLAG_PREVIEW) { -#ifdef LOG - printf ("w32codec: preview data ignored.\n"); -#endif + lprintf ("preview data ignored.\n"); return; } if (buf->decoder_flags & BUF_FLAG_HEADER) { - -#ifdef LOG - printf ("w32codec: got audio header\n"); -#endif + lprintf ("got audio header\n"); pthread_mutex_lock(&win32_codec_mutex); this->decoder_ok = w32a_init_audio (this, buf); @@ -1411,9 +1386,7 @@ static void w32a_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { pthread_mutex_unlock(&win32_codec_mutex); } else if (this->decoder_ok) { -#ifdef LOG - printf ("w32codec: decoding %d data bytes...\n", buf->size); -#endif + lprintf ("decoding %d data bytes...\n", buf->size); if( (int)buf->size <= 0 ) return; diff --git a/src/libxineadec/adpcm.c b/src/libxineadec/adpcm.c index f395a7959..9c22eabd5 100644 --- a/src/libxineadec/adpcm.c +++ b/src/libxineadec/adpcm.c @@ -31,7 +31,7 @@ * this is also useful for extracting streams from Playstation discs * * - * $Id: adpcm.c,v 1.33 2003/11/16 23:33:47 f1rmb Exp $ + * $Id: adpcm.c,v 1.34 2003/11/26 19:43:37 f1rmb Exp $ */ #include @@ -40,6 +40,12 @@ #include #include +#define LOG_MODULE "adpcm_audio_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "audio_out.h" @@ -275,9 +281,7 @@ static void dk3_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { /* make sure the input size checks out */ if ((this->size % this->in_block_size) != 0) { -#ifdef LOG - printf ("adpcm: received DK3 ADPCM block that does not line up\n"); -#endif + lprintf ("received DK3 ADPCM block that does not line up\n"); this->size = 0; return; } @@ -383,9 +387,7 @@ static void dk3_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { while (j < out_ptr) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -426,9 +428,7 @@ static void dk4_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { /* make sure the input size checks out */ if ((this->size % this->in_block_size) != 0) { -#ifdef LOG - printf ("adpcm: received DK4 ADPCM block that does not line up\n"); -#endif + lprintf ("received DK4 ADPCM block that does not line up\n"); this->size = 0; return; } @@ -468,9 +468,7 @@ static void dk4_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { while (j < out_ptr) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -515,9 +513,7 @@ static void ms_ima_adpcm_decode_block(adpcm_decoder_t *this, /* check the size */ if ((this->size % this->in_block_size) != 0) { -#ifdef LOG - printf ("adpcm: received MS IMA block that does not line up\n"); -#endif + lprintf ("received MS IMA block that does not line up\n"); this->size = 0; return; } @@ -582,9 +578,7 @@ static void ms_ima_adpcm_decode_block(adpcm_decoder_t *this, while (j < this->out_block_size) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -627,9 +621,7 @@ static void qt_ima_adpcm_decode_block(adpcm_decoder_t *this, /* check the size */ if ((this->size % (QT_IMA_ADPCM_BLOCK_SIZE * this->channels) != 0)) { -#ifdef LOG - printf ("adpcm: received QT IMA block that does not line up\n"); -#endif + lprintf ("received QT IMA block that does not line up\n"); this->size = 0; return; } @@ -738,9 +730,7 @@ static void ms_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { /* make sure the input size checks out */ if ((this->size % this->in_block_size) != 0) { -#ifdef LOG - printf ("adpcm: received MS ADPCM block that does not line up\n"); -#endif + lprintf ("received MS ADPCM block that does not line up\n"); this->size = 0; return; } @@ -763,11 +753,8 @@ static void ms_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { j++; if (this->channels == 2) { if (this->buf[j] > 6) { -#ifdef LOG - printf( - "MS ADPCM: coefficient (%d) out of range (should be [0..6])\n", - this->buf[j]); -#endif + lprintf("MS ADPCM: coefficient (%d) out of range (should be [0..6])\n", + this->buf[j]); } coeff1[1] = ms_adapt_coeff1[this->buf[j]]; coeff2[1] = ms_adapt_coeff2[this->buf[j]]; @@ -845,9 +832,7 @@ static void ms_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { while (j < out_ptr) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -919,9 +904,7 @@ static void smjpeg_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) while (i < out_ptr) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -994,9 +977,7 @@ static void vqa_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { while (i < out_ptr) { audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -1090,9 +1071,7 @@ static void ea_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { audio_buffer = this->stream->audio_out->get_buffer(this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -1361,9 +1340,7 @@ static void xa_adpcm_decode_block(adpcm_decoder_t *this, buf_element_t *buf) { audio_buffer= this->stream->audio_out->get_buffer(this->stream->audio_out); if (audio_buffer->mem_size == 0) { -#ifdef LOG - printf ("adpcm: Help! Allocated audio buffer with nothing in it!\n"); -#endif + lprintf ("Help! Allocated audio buffer with nothing in it!\n"); return; } @@ -1540,10 +1517,8 @@ static void adpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } if (!this->output_open) { -#ifdef LOG - printf ("adpcm: opening audio output (%d Hz sampling rate, mode=%d)\n", - this->rate, this->ao_cap_mode); -#endif + lprintf ("opening audio output (%d Hz sampling rate, mode=%d)\n", + this->rate, this->ao_cap_mode); this->output_open = this->stream->audio_out->open (this->stream->audio_out, this->stream, this->bits_per_sample, this->rate, this->ao_cap_mode); } @@ -1555,10 +1530,8 @@ static void adpcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { /* accumulate compressed audio data */ if( this->size + buf->size > this->bufsize ) { this->bufsize = this->size + 2 * buf->size; -#ifdef LOG - printf("adpcm: increasing source buffer to %d to avoid overflow.\n", - this->bufsize); -#endif + lprintf("increasing source buffer to %d to avoid overflow.\n", + this->bufsize); this->buf = realloc( this->buf, this->bufsize ); } diff --git a/src/libxineadec/pcm.c b/src/libxineadec/pcm.c index 554a2e6fc..cdf750f45 100644 --- a/src/libxineadec/pcm.c +++ b/src/libxineadec/pcm.c @@ -30,6 +30,12 @@ #include #include +#define LOG_MODULE "pcm_audio_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "audio_out.h" @@ -69,17 +75,13 @@ static void pcm_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {\ int bytes_left = buf->decoder_info[1]; int bits_per_frame = buf->decoder_info[1] / buf->decoder_info[0]; -#ifdef LOG - printf(__FILE__ ": decode_data, flags=0x%08x , mem size: %d, frames: %d...\n", - buf->decoder_flags, buf->decoder_info[1], buf->decoder_info[0]); -#endif + lprintf("decode_data, flags=0x%08x , mem size: %d, frames: %d...\n", + buf->decoder_flags, buf->decoder_info[1], buf->decoder_info[0]); if (_x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_MODE) == 0) { -#ifdef LOG - printf(__FILE__ ": Someone changed the audio mode. Closing device\r"); -#endif - this->stream->audio_out->close(this->stream->audio_out, this->stream); - this->open = 0; + lprintf("Someone changed the audio mode. Closing device\r"); + this->stream->audio_out->close(this->stream->audio_out, this->stream); + this->open = 0; } if (!this->open) @@ -136,9 +138,7 @@ static void pcm_dispose (audio_decoder_t *this_gen) { pcm_decoder_t *this = (pcm_decoder_t *) this_gen; -#ifdef LOG - printf(__FILE__ ": Cleaning up\n"); -#endif + lprintf("Cleaning up\n"); if (this->open) this->stream->audio_out->close (this->stream->audio_out, this->stream); diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index f2b054b1f..c700443c3 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: image.c,v 1.9 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: image.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ * * a image video decoder */ @@ -32,15 +32,17 @@ #include +#define LOG_MODULE "image_video_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "bswap.h" #include "video_out.h" #include "buffer.h" -/* -#define LOG -*/ - typedef struct { video_decoder_class_t decoder_class; @@ -141,9 +143,7 @@ static void info_callback(png_structp png_ptr, png_infop info_ptr) { int i; image_decoder_t *this = png_get_progressive_ptr(png_ptr); -#ifdef LOG - printf("image: png info cb\n"); -#endif + lprintf("png info cb\n"); png_get_IHDR(png_ptr, info_ptr, &this->width, &this->height, &this->bit_depth, &this->color_type, &this->interlace_type, &this->compression_type, &this->filter_type); @@ -221,9 +221,7 @@ static void end_callback(png_structp png_ptr, png_infop info) { image_decoder_t *this = png_get_progressive_ptr(png_ptr); finalize_png_reader(this); -#ifdef LOG - printf("image: png end cb\n"); -#endif + lprintf("png end cb\n"); if (this->rows_valid) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, @@ -286,15 +284,12 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } } if (!this->video_open) { -#ifdef LOG - printf("image: opening video\n"); -#endif + lprintf("opening video\n"); this->stream->video_out->open(this->stream->video_out, this->stream); this->video_open = 1; } -#ifdef LOG - printf("image: have to decode data\n"); -#endif + + lprintf("have to decode data\n"); this->pts = buf->pts; if (process_data(this, buf->content, buf->size) < 0) @@ -336,16 +331,13 @@ static void image_dispose (video_decoder_t *this_gen) { image_decoder_t *this = (image_decoder_t *) this_gen; if (this->video_open) { -#ifdef LOG - printf("image: closing video\n"); -#endif + lprintf("closing video\n"); + this->stream->video_out->close(this->stream->video_out, this->stream); this->video_open = 0; } -#ifdef LOG - printf("image: closed\n"); -#endif + lprintf("closed\n"); free (this); } @@ -356,9 +348,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, image_class_t *cls = (image_class_t *) class_gen; image_decoder_t *this; -#ifdef LOG - printf("image: opened\n"); -#endif + lprintf("opened\n"); this = (image_decoder_t *) xine_xmalloc (sizeof (image_decoder_t)); @@ -396,9 +386,7 @@ static char *get_description (video_decoder_class_t *this) { static void dispose_class (video_decoder_class_t *this_gen) { image_class_t *this = (image_class_t *) this_gen; -#ifdef LOG - printf("image: class closed\n"); -#endif + lprintf("class closed\n"); free (this); } @@ -419,9 +407,7 @@ static void *init_class (xine_t *xine, void *data) { * initialisation of privates */ -#ifdef LOG - printf("image: class opened\n"); -#endif + lprintf("class opened\n"); return this; } diff --git a/src/libxinevdec/yuv_frames.c b/src/libxinevdec/yuv_frames.c index f855731e8..662f5dec9 100644 --- a/src/libxinevdec/yuv_frames.c +++ b/src/libxinevdec/yuv_frames.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: yuv_frames.c,v 1.6 2003/10/23 20:12:34 mroi Exp $ + * $Id: yuv_frames.c,v 1.7 2003/11/26 19:43:37 f1rmb Exp $ * * dummy video decoder for uncompressed video frames as delivered by v4l */ @@ -30,14 +30,16 @@ #include #include -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" - +#define LOG_MODULE "yuv_frame_video_decoder" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "video_out.h" +#include "buffer.h" + typedef struct { video_decoder_class_t decoder_class; } mpeg2_class_t; @@ -54,9 +56,7 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu int frame_size; vo_frame_t *img; -#ifdef LOG - printf ("yuv_frames: decode_data, flags=0x%08x ...\n", buf->decoder_flags); -#endif + lprintf ("decode_data, flags=0x%08x ...\n", buf->decoder_flags); img = this->stream->video_out->get_frame (this->stream->video_out, buf->decoder_info[0], @@ -77,17 +77,13 @@ static void yuv_frames_decode_data (video_decoder_t *this_gen, buf_element_t *bu img->draw (img, this->stream); img->free (img); -#ifdef LOG - printf ("yuv_frames: decode_data...done\n"); -#endif + lprintf ("decode_data...done\n"); } static void yuv_frames_flush (video_decoder_t *this_gen) { /* yuv_frames_decoder_t *this = (yuv_frames_decoder_t *) this_gen; */ -#ifdef LOG - printf ("yuv_frames: flush\n"); -#endif + lprintf ("flush\n"); } static void yuv_frames_reset (video_decoder_t *this_gen) { @@ -102,9 +98,7 @@ static void yuv_frames_dispose (video_decoder_t *this_gen) { yuv_frames_decoder_t *this = (yuv_frames_decoder_t *) this_gen; -#ifdef LOG - printf ("yuv_frames: close\n"); -#endif + lprintf ("close\n"); this->stream->video_out->close(this->stream->video_out, this->stream); diff --git a/src/libxvid/xine_decoder.c b/src/libxvid/xine_decoder.c index 611c07ad0..5daa4c269 100644 --- a/src/libxvid/xine_decoder.c +++ b/src/libxvid/xine_decoder.c @@ -33,6 +33,12 @@ #include #include +#define LOG_MODULE "xvid_decoder" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "bswap.h" #include "xine_internal.h" #include "buffer.h" @@ -40,11 +46,6 @@ #define VIDEOBUFSIZE 128 * 1024 -/* -#define LOG -*/ - - typedef struct xvid_decoder_s { video_decoder_t video_decoder; @@ -81,10 +82,8 @@ static void xvid_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { int xerr; xvid_decoder_t *this = (xvid_decoder_t *) this_gen; -#ifdef LOG - printf ("xvid: processing packet type = %08x, buf: %08x, buf->decoder_flags=%08x\n", - buf->type, buf, buf->decoder_flags); -#endif + lprintf ("processing packet type = %08x, buf: %08x, buf->decoder_flags=%08x\n", + buf->type, buf, buf->decoder_flags); if (buf->decoder_flags & BUF_FLAG_HEADER) { xine_bmiheader *bih; diff --git a/src/post/deinterlace/deinterlace.c b/src/post/deinterlace/deinterlace.c index afd0093f1..df7d0e65c 100644 --- a/src/post/deinterlace/deinterlace.c +++ b/src/post/deinterlace/deinterlace.c @@ -24,9 +24,14 @@ #include #include -#include "deinterlace.h" +#define LOG_MODULE "deinterlace" +#define LOG_VERBOSE +/* +#define LOG +*/ -/*#define LOG*/ +#include "deinterlace.h" +#include "xine_internal.h" typedef struct methodlist_item_s methodlist_item_t; @@ -109,22 +114,16 @@ void filter_deinterlace_methods( int accel, int fields_available ) if( (cur->method->accelrequired & accel) != cur->method->accelrequired ) { /* This method is no good, drop it from the list. */ -#ifdef LOG - printf( "deinterlace: %s disabled: required " - "CPU accelleration features unavailable.\n", - cur->method->short_name ); -#endif - drop = 1; + lprintf( "%s disabled: required CPU accelleration features unavailable.\n", + cur->method->short_name ); + drop = 1; } if( cur->method->fields_required > fields_available ) { /* This method is no good, drop it from the list. */ -#ifdef LOG - printf( "deinterlace: %s disabled: requires " - "%d field buffers, only %d available.\n", - cur->method->short_name, cur->method->fields_required, - fields_available ); -#endif - drop = 1; + lprintf( "%s disabled: requires %d field buffers, only %d available.\n", + cur->method->short_name, cur->method->fields_required, + fields_available ); + drop = 1; } if( drop ) { diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 0bf8305a5..b0cfee656 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_goom.c,v 1.43 2003/11/26 19:30:14 mroi Exp $ + * $Id: xine_goom.c,v 1.44 2003/11/26 19:43:37 f1rmb Exp $ * * GOOM post plugin. * @@ -28,10 +28,11 @@ #include -/********** logging **********/ #define LOG_MODULE "goom" -/* #define LOG_VERBOSE */ -/* #define LOG */ +#define LOG_VERBOSE +/* +#define LOG +*/ #include "config.h" #include "xine_internal.h" @@ -261,7 +262,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs, this->metronom = _x_metronom_init(1, 0, class->xine); - lprintf("goom: goom_open_plugin\n"); + lprintf("goom_open_plugin\n"); if(xine_config_lookup_entry(class->xine, "post.goom_fps", &fps_entry)) diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index 4118670c7..377069b03 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -17,13 +17,19 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mosaico.c,v 1.17 2003/11/11 18:44:59 f1rmb Exp $ + * $Id: mosaico.c,v 1.18 2003/11/26 19:43:37 f1rmb Exp $ */ /* * simple video mosaico plugin */ +#define LOG_MODULE "mosaico" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "post.h" @@ -35,10 +41,6 @@ #define DEFAULT_H (150) #define MAXPIP (5) -/* -#define LOG -*/ - /* plugin class initialization function */ static void *mosaico_init_plugin(xine_t *xine, void *); @@ -194,9 +196,7 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, if(inputs < 2) return NULL; -#ifdef LOG - printf("mosaico open\n"); -#endif + lprintf("mosaico open\n"); if (!this || !input1 || !output || !video_target || !video_target[0]) { free(this); @@ -393,9 +393,7 @@ static void frame_copy_content(vo_frame_t *to, vo_frame_t *from) { int size; if((to == NULL)||(from == NULL)) { -#ifdef LOG - printf("Something wrong in frame_copy_content\n"); -#endif + lprintf("Something wrong in frame_copy_content\n"); return; } @@ -456,18 +454,14 @@ static int _mosaico_draw_2(vo_frame_t *frame, post_mosaico_out_t *output, int co pthread_mutex_lock(&output->mut2); if((output->saved_frame_2[cont] == NULL)&&(frame == NULL)) { -#ifdef LOG - printf("frame_2 NULL\n"); -#endif + lprintf("frame_2 NULL\n"); pthread_mutex_unlock(&output->mut1); pthread_mutex_unlock(&output->mut2); return 0; } if(output->saved_frame == NULL) { -#ifdef LOG - printf("saved frame NULL\n"); -#endif + lprintf("saved frame NULL\n"); pthread_mutex_unlock(&output->mut1); pthread_mutex_unlock(&output->mut2); return 0; @@ -508,9 +502,7 @@ static int _mosaico_draw_2(vo_frame_t *frame, post_mosaico_out_t *output, int co switch (output->saved_frame_2[ciclo-1]->format) { case XINE_IMGFMT_YUY2: -#ifdef LOG - printf("not supported\n"); -#endif + lprintf("not supported\n"); /*size = new_frame->pitches[0] * new_frame->height; for (i = 0; i < size; i++) new_frame->base[0][i] = frame->base[0][i];*/ @@ -584,9 +576,7 @@ static int mosaico_draw(vo_frame_t *frame, xine_stream_t *stream) return skip; } -#ifdef LOG - printf("ERROR!! oh oh\n\n"); -#endif + lprintf("ERROR!! oh oh\n\n"); return 0; } @@ -604,9 +594,7 @@ static int mosaico_draw_2(vo_frame_t *frame, xine_stream_t *stream) while(in != NULL) { pt = in->data; if(pt == frame->port) { -#ifdef LOG - /*printf("trovato %d\n", i);*/ -#endif + lprintf("trovato %d\n", i); break; } in = xine_list_next_content(port->post->input); diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index 86dd7dece..3c31c9178 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.c @@ -17,22 +17,24 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: switch.c,v 1.9 2003/11/11 18:44:59 f1rmb Exp $ + * $Id: switch.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ */ /* * simple switch video post plugin */ +#define LOG_MODULE "switch" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "post.h" #define SWVERSION (5) -/* -#define LOG -*/ - /* plugin class initialization function */ static void *switch_init_plugin(xine_t *xine, void *); @@ -143,9 +145,7 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, if(inputs < 2) return NULL; -#ifdef LOG - printf("switch open\n"); -#endif + lprintf("switch open\n"); if (!this || !input1 || !output || !video_target || !video_target[0]) { free(this); @@ -340,16 +340,12 @@ static void frame_copy_content(vo_frame_t *to, vo_frame_t *from) { int size; if((to == NULL)||(from == NULL)) { -#ifdef LOG - printf("Something wrong in frame_copy_content\n"); -#endif + lprintf("Something wrong in frame_copy_content\n"); return; } if(to->format != from->format) { -#ifdef LOG - printf("frame_copy_content : buffers have different format\n"); -#endif + lprintf("frame_copy_content : buffers have different format\n"); return; } diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 4852b3e00..4f773d535 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -20,7 +20,7 @@ * video_out_directx.c, direct draw video output plugin for xine * by Matthew Grooms * - * $Id: video_out_directx.c,v 1.10 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_directx.c,v 1.11 2003/11/26 19:43:37 f1rmb Exp $ */ typedef unsigned char boolean; @@ -32,1105 +32,1086 @@ typedef unsigned char boolean; #include "video_out.h" #include "video_out_win32.h" #include "alphablend.h" + +#define LOG_MODULE "video_out_directx" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "yuv2rgb.h" -/**/ -#define LOG 1 -/**/ - #define NEW_YUV 1 /* Set to 1 for RGB support */ -#define RGB_SUPPORT 0 - -#define BORDER_SIZE 8 -#define IMGFMT_NATIVE 4 - -// ----------------------------------------- -// -// vo_directx frame struct -// -// ----------------------------------------- - -typedef struct win32_frame_s -{ - vo_frame_t vo_frame; - - uint8_t * buffer; - int format; - int width; - int height; - int size; - double ratio; - -}win32_frame_t; - -// ----------------------------------------- -// -// vo_directx driver struct -// -// ----------------------------------------- - -typedef struct -{ - vo_driver_t vo_driver; - win32_visual_t * win32_visual; - - LPDIRECTDRAW7 ddobj; // direct draw object - LPDIRECTDRAWSURFACE primary; // primary dd surface - LPDIRECTDRAWSURFACE secondary; // secondary dd surface - LPDIRECTDRAWCLIPPER ddclipper; // dd clipper object - uint8_t * contents; // secondary contents - win32_frame_t *current; // current frame +#define RGB_SUPPORT 0 - int req_format; // requested frame format - int act_format; // actual frame format - int width; // frame with - int height; // frame height - double ratio; // frame ratio - - yuv2rgb_factory_t *yuv2rgb_factory; // used for format conversion - yuv2rgb_t *yuv2rgb; // used for format conversion - int mode; // rgb mode - int bytespp; // rgb bits per pixel - -}win32_driver_t; +#define BORDER_SIZE 8 +#define IMGFMT_NATIVE 4 +/* ----------------------------------------- + * + * vo_directx frame struct + * + * ----------------------------------------- */ typedef struct { - video_driver_class_t driver_class; + vo_frame_t vo_frame; + uint8_t *buffer; + int format; + int width; + int height; + int size; + double ratio; +} win32_frame_t; + +/* ----------------------------------------- + * + * vo_directx driver struct + * + * ----------------------------------------- */ - config_values_t *config; +typedef struct { + vo_driver_t vo_driver; + win32_visual_t *win32_visual; + + LPDIRECTDRAW7 ddobj; /* direct draw object */ + LPDIRECTDRAWSURFACE primary; /* primary dd surface */ + LPDIRECTDRAWSURFACE secondary; /* secondary dd surface */ + LPDIRECTDRAWCLIPPER ddclipper; /* dd clipper object */ + uint8_t * contents; /* secondary contents */ + win32_frame_t *current; /* current frame */ + + int req_format; /* requested frame format */ + int act_format; /* actual frame format */ + int width; /* frame with */ + int height; /* frame height */ + double ratio; /* frame ratio */ + + yuv2rgb_factory_t *yuv2rgb_factory; /* used for format conversion */ + yuv2rgb_t *yuv2rgb; /* used for format conversion */ + int mode; /* rgb mode */ + int bytespp; /* rgb bits per pixel */ +} win32_driver_t; - char *device_name; +typedef struct { + video_driver_class_t driver_class; + config_values_t *config; + char *device_name; } directx_class_t; -// ----------------------------------------- -// -// BEGIN : Direct Draw and win32 handlers -// for xine video output plugins. -// -// ----------------------------------------- +/* ----------------------------------------- + * + * BEGIN : Direct Draw and win32 handlers + * for xine video output plugins. + * + * ----------------------------------------- */ -// Display formatted error message in -// popup message box. +/* Display formatted error message in + * popup message box.*/ void Error( HWND hwnd, LPSTR szfmt, ... ) { - char tempbuff[ 256 ]; - *tempbuff = 0; - wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); - MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); + char tempbuff[ 256 ]; + *tempbuff = 0; + wvsprintf( &tempbuff[ strlen( tempbuff ) ], szfmt, ( char * )( &szfmt + 1 ) ); + MessageBox( hwnd, tempbuff, "Error", MB_ICONERROR | MB_OK | MB_APPLMODAL | MB_SYSTEMMODAL ); } -// Update our drivers current knowledge -// of our windows video out posistion +/* Update our drivers current knowledge + * of our windows video out posistion */ void UpdateRect( win32_visual_t * win32_visual ) { - if( win32_visual->FullScreen ) + if( win32_visual->FullScreen ) { - SetRect( &win32_visual->WndRect, 0, 0, - GetSystemMetrics( SM_CXSCREEN ), - GetSystemMetrics( SM_CYSCREEN ) ); + SetRect( &win32_visual->WndRect, 0, 0, + GetSystemMetrics( SM_CXSCREEN ), + GetSystemMetrics( SM_CYSCREEN ) ); } - else + else { - GetClientRect( win32_visual->WndHnd, &win32_visual->WndRect ); - ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect ); - ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect + 1 ); + GetClientRect( win32_visual->WndHnd, &win32_visual->WndRect ); + ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect ); + ClientToScreen( win32_visual->WndHnd, ( POINT * ) &win32_visual->WndRect + 1 ); } } -// Create our direct draw object, primary -// surface and clipper object. -// -// NOTE : The primary surface is more or -// less a viewport into the parent desktop -// window and will always have a pixel format -// identical to the current display mode. +/* Create our direct draw object, primary + * surface and clipper object. + * + * NOTE : The primary surface is more or + * less a viewport into the parent desktop + * window and will always have a pixel format + * identical to the current display mode. */ boolean CreatePrimary( win32_driver_t * win32_driver ) { - LPDIRECTDRAW ddobj; - DDSURFACEDESC2 ddsd; - HRESULT result; + LPDIRECTDRAW ddobj; + DDSURFACEDESC2 ddsd; + HRESULT result; - // create direct draw object + /* create direct draw object */ - result = DirectDrawCreate( 0, &ddobj, 0 ); - if( result != DD_OK ) - { - Error( 0, "DirectDrawCreate : error %i", result ); - printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); - return 0; - } + result = DirectDrawCreate( 0, &ddobj, 0 ); + if( result != DD_OK ) + { + Error( 0, "DirectDrawCreate : error %i", result ); + printf( "vo_out_directx : DirectDrawCreate : error %i\n", result ); + return 0; + } - // set cooperative level + /* set cooperative level */ - result = IDirectDraw_SetCooperativeLevel( ddobj, win32_driver->win32_visual->WndHnd, DDSCL_NORMAL ); - if( result != DD_OK ) - { - Error( 0, "SetCooperativeLevel : error %i", result ); - return 0; - } + result = IDirectDraw_SetCooperativeLevel( ddobj, win32_driver->win32_visual->WndHnd, DDSCL_NORMAL ); + if( result != DD_OK ) + { + Error( 0, "SetCooperativeLevel : error %i", result ); + return 0; + } - // try to get new interface + /* try to get new interface */ - result = IDirectDraw_QueryInterface( ddobj, &IID_IDirectDraw7, (LPVOID *) &win32_driver->ddobj ); - if( result != DD_OK ) - { - Error( 0, "ddobj->QueryInterface : DirectX 7 or higher required" ); - return 0; - } + result = IDirectDraw_QueryInterface( ddobj, &IID_IDirectDraw7, (LPVOID *) &win32_driver->ddobj ); + if( result != DD_OK ) + { + Error( 0, "ddobj->QueryInterface : DirectX 7 or higher required" ); + return 0; + } - // release our old interface + /* release our old interface */ - IDirectDraw_Release( ddobj ); + IDirectDraw_Release( ddobj ); - // create primary_surface + /* create primary_surface */ - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - result = IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->primary, 0 ); - if( result != DD_OK ) - { - Error( 0, "CreateSurface ( primary ) : error %i ", result ); - return 0; - } + result = IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->primary, 0 ); + if( result != DD_OK ) + { + Error( 0, "CreateSurface ( primary ) : error %i ", result ); + return 0; + } - // create our clipper object + /* create our clipper object */ - result = IDirectDraw7_CreateClipper( win32_driver->ddobj, 0, &win32_driver->ddclipper, 0 ); - if( result != DD_OK ) - { - Error( 0, "CreateClipper : error %i", result ); - return 0; - } + result = IDirectDraw7_CreateClipper( win32_driver->ddobj, 0, &win32_driver->ddclipper, 0 ); + if( result != DD_OK ) + { + Error( 0, "CreateClipper : error %i", result ); + return 0; + } - // associate our clipper with our window + /* associate our clipper with our window */ - result = IDirectDrawClipper_SetHWnd( win32_driver->ddclipper, 0, win32_driver->win32_visual->WndHnd ); - if( result != DD_OK ) - { - Error( 0, "ddclipper->SetHWnd : error %i", result ); - return 0; - } + result = IDirectDrawClipper_SetHWnd( win32_driver->ddclipper, 0, win32_driver->win32_visual->WndHnd ); + if( result != DD_OK ) + { + Error( 0, "ddclipper->SetHWnd : error %i", result ); + return 0; + } - // associate our primary surface with our clipper + /* associate our primary surface with our clipper */ - result = IDirectDrawSurface7_SetClipper( win32_driver->primary, win32_driver->ddclipper ); - if( result != DD_OK ) - { - Error( 0, "ddclipper->SetHWnd : error %i", result ); - return 0; - } + result = IDirectDrawSurface7_SetClipper( win32_driver->primary, win32_driver->ddclipper ); + if( result != DD_OK ) + { + Error( 0, "ddclipper->SetHWnd : error %i", result ); + return 0; + } - // store our objects in our visual struct + /* store our objects in our visual struct */ - UpdateRect( win32_driver->win32_visual ); + UpdateRect( win32_driver->win32_visual ); - return 1; + return 1; } -// Create our secondary ( off screen ) buffer. -// The optimal secondary buffer is a h/w -// overlay with the same pixel format as the -// xine frame type. However, since this is -// not always supported by the host h/w, -// we will fall back to creating an rgb buffer -// in video memory qith the same pixel format -// as the primary surface. At least then we -// can use h/w scaling if supported. +/* Create our secondary ( off screen ) buffer. + * The optimal secondary buffer is a h/w + * overlay with the same pixel format as the + * xine frame type. However, since this is + * not always supported by the host h/w, + * we will fall back to creating an rgb buffer + * in video memory qith the same pixel format + * as the primary surface. At least then we + * can use h/w scaling if supported. */ boolean CreateSecondary( win32_driver_t * win32_driver, int width, int height, int format ) { - DDSURFACEDESC2 ddsd; + DDSURFACEDESC2 ddsd; - if( format == XINE_IMGFMT_YV12 ) - printf( "vo_out_directx : switching to YV12 overlay type\n" ); + if( format == XINE_IMGFMT_YV12 ) + printf( "vo_out_directx : switching to YV12 overlay type\n" ); - if( format == XINE_IMGFMT_YUY2 ) - printf( "vo_out_directx : switching to YUY2 overlay type\n" ); + if( format == XINE_IMGFMT_YUY2 ) + printf( "vo_out_directx : switching to YUY2 overlay type\n" ); #if RGB_SUPPORT - if( format == IMGFMT_RGB ) - printf( "vo_out_directx : switching to RGB overlay type\n" ); + if( format == IMGFMT_RGB ) + printf( "vo_out_directx : switching to RGB overlay type\n" ); #endif - if( !win32_driver->ddobj ) - return FALSE; + if( !win32_driver->ddobj ) + return FALSE; - // store our reqested format, - // width and height + /* store our reqested format, + * width and height */ - win32_driver->req_format = format; - win32_driver->width = width; - win32_driver->height = height; + win32_driver->req_format = format; + win32_driver->width = width; + win32_driver->height = height; - // if we already have a secondary - // surface then release it + /* if we already have a secondary + * surface then release it */ - if( win32_driver->secondary ) - IDirectDrawSurface7_Release( win32_driver->secondary ); + if( win32_driver->secondary ) + IDirectDrawSurface7_Release( win32_driver->secondary ); - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); - ddsd.dwWidth = width; - ddsd.dwHeight = height; + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); + ddsd.dwWidth = width; + ddsd.dwHeight = height; - if( format == XINE_IMGFMT_YV12 ) - { - // the requested format is XINE_IMGFMT_YV12 + if( format == XINE_IMGFMT_YV12 ) + { + /* the requested format is XINE_IMGFMT_YV12 */ - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; - ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'V', '1', '2' ); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + ddsd.ddpfPixelFormat.dwYUVBitCount = 16; + ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'V', '1', '2' ); -#ifdef LOG - printf("CreateSecondary() - act_format = (YV12) %d\n", XINE_IMGFMT_YV12); -#endif + lprintf("CreateSecondary() - act_format = (YV12) %d\n", XINE_IMGFMT_YV12); - win32_driver->act_format = XINE_IMGFMT_YV12; - } + win32_driver->act_format = XINE_IMGFMT_YV12; + } - if( format == XINE_IMGFMT_YUY2 ) - { - // the requested format is XINE_IMGFMT_YUY2 + if( format == XINE_IMGFMT_YUY2 ) + { + /* the requested format is XINE_IMGFMT_YUY2 */ - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; - ddsd.ddpfPixelFormat.dwYUVBitCount = 16; - ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'U', 'Y', '2' ); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; + ddsd.ddpfPixelFormat.dwYUVBitCount = 16; + ddsd.ddpfPixelFormat.dwFourCC = mmioFOURCC( 'Y', 'U', 'Y', '2' ); -#ifdef LOG - printf("CreateSecondary() - act_format = (YUY2) %d\n", XINE_IMGFMT_YUY2); -#endif + lprintf("CreateSecondary() - act_format = (YUY2) %d\n", XINE_IMGFMT_YUY2); - win32_driver->act_format = XINE_IMGFMT_YUY2; - } + win32_driver->act_format = XINE_IMGFMT_YUY2; + } #if RGB_SUPPORT - if( format == IMGFMT_RGB ) - { - // the requested format is IMGFMT_RGB - - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; - ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; - ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; - ddsd.ddpfPixelFormat.dwYUVBitCount = 24; - ddsd.ddpfPixelFormat.dwRBitMask = 0xff0000; - ddsd.ddpfPixelFormat.dwGBitMask = 0x00ff00; - ddsd.ddpfPixelFormat.dwBBitMask = 0x0000ff; - -#ifdef LOG - printf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); -#endif + if( format == IMGFMT_RGB ) + { + /* the requested format is IMGFMT_RGB */ + + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OVERLAY; + ddsd.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); + ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB; + ddsd.ddpfPixelFormat.dwYUVBitCount = 24; + ddsd.ddpfPixelFormat.dwRBitMask = 0xff0000; + ddsd.ddpfPixelFormat.dwGBitMask = 0x00ff00; + ddsd.ddpfPixelFormat.dwBBitMask = 0x0000ff; - win32_driver->act_format = IMGFMT_RGB; - } + lprintf("CreateSecondary() - act_format = (RGB) %d\n", IMGFMT_RGB); + + win32_driver->act_format = IMGFMT_RGB; + } #endif /* RGB_SUPPORT */ -#ifdef LOG - printf("CreateSecondary() - IDirectDraw7_CreateSurface()\n"); -#endif + lprintf("CreateSecondary() - IDirectDraw7_CreateSurface()\n"); - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) - return TRUE; + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) + return TRUE; - // Our fallback method is to create a back buffer - // with the same image format as the primary surface + /* Our fallback method is to create a back buffer + * with the same image format as the primary surface */ -#ifdef LOG - printf("CreateSecondary() - Falling back to back buffer same as primary\n"); -#endif + lprintf("CreateSecondary() - Falling back to back buffer same as primary\n"); - ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; -#ifdef LOG - printf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE); -#endif + lprintf("CreateSecondary() - act_format = (NATIVE) %d\n", IMGFMT_NATIVE); - win32_driver->act_format = IMGFMT_NATIVE; + win32_driver->act_format = IMGFMT_NATIVE; - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) - return TRUE; + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &ddsd, &win32_driver->secondary, 0 ) == DD_OK ) + return TRUE; - // This is bad. We cant even create a surface with - // the same format as the primary surface. + /* This is bad. We cant even create a surface with + * the same format as the primary surface. */ - Error( 0, "CreateSurface ( Secondary ) : unable to create a suitable rendering surface" ); + Error( 0, "CreateSurface ( Secondary ) : unable to create a suitable rendering surface" ); - return FALSE; + return FALSE; } -// Destroy all direct draw driver allocated -// resources. +/* Destroy all direct draw driver allocated + * resources. */ void Destroy( win32_driver_t * win32_driver ) { - if( win32_driver->ddclipper ) - IDirectDrawClipper_Release( win32_driver->ddclipper ); + if( win32_driver->ddclipper ) + IDirectDrawClipper_Release( win32_driver->ddclipper ); - if( win32_driver->primary ) - IDirectDrawSurface7_Release( win32_driver->primary ); + if( win32_driver->primary ) + IDirectDrawSurface7_Release( win32_driver->primary ); - if( win32_driver->secondary ) - IDirectDrawSurface7_Release( win32_driver->secondary ); + if( win32_driver->secondary ) + IDirectDrawSurface7_Release( win32_driver->secondary ); - if( win32_driver->ddobj ) - IDirectDraw_Release( win32_driver->ddobj ); + if( win32_driver->ddobj ) + IDirectDraw_Release( win32_driver->ddobj ); - free( win32_driver ); + free( win32_driver ); } -// Check the current pixel format of the -// display mode. This is neccesary in case -// the h/w does not support an overlay for -// the native frame format. +/* Check the current pixel format of the + * display mode. This is neccesary in case + * the h/w does not support an overlay for + * the native frame format. */ boolean CheckPixelFormat( win32_driver_t * win32_driver ) { - DDPIXELFORMAT ddpf; - HRESULT result; + DDPIXELFORMAT ddpf; + HRESULT result; - // get the pixel format of our primary surface + /* get the pixel format of our primary surface */ - memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); - ddpf.dwSize = sizeof( DDPIXELFORMAT ); - result = IDirectDrawSurface7_GetPixelFormat( win32_driver->primary, &ddpf ); - if( result != DD_OK ) - { - Error( 0, "IDirectDrawSurface7_GetPixelFormat ( CheckPixelFormat ) : error %u", result ); - return 0; - } + memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); + ddpf.dwSize = sizeof( DDPIXELFORMAT ); + result = IDirectDrawSurface7_GetPixelFormat( win32_driver->primary, &ddpf ); + if( result != DD_OK ) + { + Error( 0, "IDirectDrawSurface7_GetPixelFormat ( CheckPixelFormat ) : error %u", result ); + return 0; + } - // TODO : support paletized video modes + /* TODO : support paletized video modes */ - if( ( ddpf.dwFlags & DDPF_PALETTEINDEXED1 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED2 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED4 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXED8 ) || - ( ddpf.dwFlags & DDPF_PALETTEINDEXEDTO8 ) ) - return FALSE; + if( ( ddpf.dwFlags & DDPF_PALETTEINDEXED1 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED2 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED4 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXED8 ) || + ( ddpf.dwFlags & DDPF_PALETTEINDEXEDTO8 ) ) + return FALSE; - // store bytes per pixel + /* store bytes per pixel */ - win32_driver->bytespp = ddpf.dwRGBBitCount / 8; + win32_driver->bytespp = ddpf.dwRGBBitCount / 8; - // find the rgb mode for software - // colorspace conversion + /* find the rgb mode for software + * colorspace conversion */ - if( ddpf.dwRGBBitCount == 32 ) - { - if( ddpf.dwRBitMask == 0xff0000 ) - win32_driver->mode = MODE_32_RGB; - else - win32_driver->mode = MODE_32_BGR; - } + if( ddpf.dwRGBBitCount == 32 ) + { + if( ddpf.dwRBitMask == 0xff0000 ) + win32_driver->mode = MODE_32_RGB; + else + win32_driver->mode = MODE_32_BGR; + } - if( ddpf.dwRGBBitCount == 24 ) - { - if( ddpf.dwRBitMask == 0xff0000 ) - win32_driver->mode = MODE_24_RGB; - else - win32_driver->mode = MODE_24_BGR; - } + if( ddpf.dwRGBBitCount == 24 ) + { + if( ddpf.dwRBitMask == 0xff0000 ) + win32_driver->mode = MODE_24_RGB; + else + win32_driver->mode = MODE_24_BGR; + } - if( ddpf.dwRGBBitCount == 16 ) - { - if( ddpf.dwRBitMask == 0xf800 ) - win32_driver->mode = MODE_16_RGB; - else - win32_driver->mode = MODE_16_BGR; - } + if( ddpf.dwRGBBitCount == 16 ) + { + if( ddpf.dwRBitMask == 0xf800 ) + win32_driver->mode = MODE_16_RGB; + else + win32_driver->mode = MODE_16_BGR; + } - if( ddpf.dwRGBBitCount == 15 ) - { - if( ddpf.dwRBitMask == 0x7C00 ) - win32_driver->mode = MODE_15_RGB; - else - win32_driver->mode = MODE_15_BGR; - } + if( ddpf.dwRGBBitCount == 15 ) + { + if( ddpf.dwRBitMask == 0x7C00 ) + win32_driver->mode = MODE_15_RGB; + else + win32_driver->mode = MODE_15_BGR; + } - return TRUE; + return TRUE; } -// Create a Direct draw surface from -// a bitmap resource.. -// -// NOTE : This is not really useful -// anymore since the xine logo code is -// being pushed to the backend. +/* Create a Direct draw surface from + * a bitmap resource.. + * + * NOTE : This is not really useful + * anymore since the xine logo code is + * being pushed to the backend. */ LPDIRECTDRAWSURFACE7 CreateBMP( win32_driver_t * win32_driver, int resource ) { - LPDIRECTDRAWSURFACE7 bmp_surf; - DDSURFACEDESC2 bmp_ddsd; - HBITMAP bmp_hndl; - BITMAP bmp_head; - HDC hdc_dds; - HDC hdc_mem; + LPDIRECTDRAWSURFACE7 bmp_surf; + DDSURFACEDESC2 bmp_ddsd; + HBITMAP bmp_hndl; + BITMAP bmp_head; + HDC hdc_dds; + HDC hdc_mem; - // load our bitmap from a resource + /* load our bitmap from a resource */ - if( !( bmp_hndl = LoadBitmap( win32_driver->win32_visual->HInst, MAKEINTRESOURCE( resource ) ) ) ) - { - Error( 0, "CreateBitmap : could not load bmp resource" ); - return 0; - } + if( !( bmp_hndl = LoadBitmap( win32_driver->win32_visual->HInst, MAKEINTRESOURCE( resource ) ) ) ) + { + Error( 0, "CreateBitmap : could not load bmp resource" ); + return 0; + } - // create an off screen surface with - // the same dimentions as our bitmap + /* create an off screen surface with + * the same dimentions as our bitmap */ - GetObject( bmp_hndl, sizeof( bmp_head ), &bmp_head ); + GetObject( bmp_hndl, sizeof( bmp_head ), &bmp_head ); - memset( &bmp_ddsd, 0, sizeof( bmp_ddsd ) ); - bmp_ddsd.dwSize = sizeof( bmp_ddsd ); - bmp_ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - bmp_ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; - bmp_ddsd.dwWidth = bmp_head.bmWidth; - bmp_ddsd.dwHeight = bmp_head.bmHeight; + memset( &bmp_ddsd, 0, sizeof( bmp_ddsd ) ); + bmp_ddsd.dwSize = sizeof( bmp_ddsd ); + bmp_ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + bmp_ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY; + bmp_ddsd.dwWidth = bmp_head.bmWidth; + bmp_ddsd.dwHeight = bmp_head.bmHeight; - if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &bmp_ddsd, &bmp_surf, 0 ) != DD_OK ) - { - Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); - return 0; - } + if( IDirectDraw7_CreateSurface( win32_driver->ddobj, &bmp_ddsd, &bmp_surf, 0 ) != DD_OK ) + { + Error( 0, "CreateSurface ( bitmap ) : could not create dd surface" ); + return 0; + } - // get a handle to our surface dc, - // create a compat dc and load - // our bitmap into the compat dc + /* get a handle to our surface dc, + * create a compat dc and load + * our bitmap into the compat dc */ - IDirectDrawSurface7_GetDC( bmp_surf, &hdc_dds ); - hdc_mem = CreateCompatibleDC( hdc_dds ); - SelectObject( hdc_mem, bmp_hndl ); + IDirectDrawSurface7_GetDC( bmp_surf, &hdc_dds ); + hdc_mem = CreateCompatibleDC( hdc_dds ); + SelectObject( hdc_mem, bmp_hndl ); - // copy our bmp from the compat dc - // into our dd surface + /* copy our bmp from the compat dc + * into our dd surface */ - BitBlt( hdc_dds, 0, 0, bmp_head.bmWidth, bmp_head.bmHeight, - hdc_mem, 0, 0, SRCCOPY ); + BitBlt( hdc_dds, 0, 0, bmp_head.bmWidth, bmp_head.bmHeight, + hdc_mem, 0, 0, SRCCOPY ); - // clean up + /* clean up */ - DeleteDC( hdc_mem ); - DeleteObject( bmp_hndl ); - IDirectDrawSurface7_ReleaseDC( bmp_surf, hdc_dds ); + DeleteDC( hdc_mem ); + DeleteObject( bmp_hndl ); + IDirectDrawSurface7_ReleaseDC( bmp_surf, hdc_dds ); - return bmp_surf; + return bmp_surf; } -// Merge overlay with the current primary -// surface. This funtion is only used when -// a h/w overlay of the current frame type -// is supported. +/* Merge overlay with the current primary + * surface. This funtion is only used when + * a h/w overlay of the current frame type + * is supported. */ boolean Overlay( LPDIRECTDRAWSURFACE7 src_surface, RECT * src_rect, - LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect, - COLORREF color_key ) + LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect, + COLORREF color_key ) { - DWORD dw_color_key; - DDPIXELFORMAT ddpf; - DDOVERLAYFX ddofx; - int flags; - HRESULT result; - - // compute the colorkey pixel value from the RGB value we've got/ - // NOTE : based on videolan colorkey code - - memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); - ddpf.dwSize = sizeof( DDPIXELFORMAT ); - result = IDirectDrawSurface7_GetPixelFormat( dst_surface, &ddpf ); - if( result != DD_OK ) - { - Error( 0, "IDirectDrawSurface7_GetPixelFormat : could not get surface pixel format" ); - return FALSE; - } + DWORD dw_color_key; + DDPIXELFORMAT ddpf; + DDOVERLAYFX ddofx; + int flags; + HRESULT result; + + /* compute the colorkey pixel value from the RGB value we've got/ + * NOTE : based on videolan colorkey code */ + + memset( &ddpf, 0, sizeof( DDPIXELFORMAT )); + ddpf.dwSize = sizeof( DDPIXELFORMAT ); + result = IDirectDrawSurface7_GetPixelFormat( dst_surface, &ddpf ); + if( result != DD_OK ) + { + Error( 0, "IDirectDrawSurface7_GetPixelFormat : could not get surface pixel format" ); + return FALSE; + } - dw_color_key = ( DWORD ) color_key; - dw_color_key = ( DWORD ) ( ( ( dw_color_key * ddpf.dwRBitMask ) / 255 ) & ddpf.dwRBitMask ); + dw_color_key = ( DWORD ) color_key; + dw_color_key = ( DWORD ) ( ( ( dw_color_key * ddpf.dwRBitMask ) / 255 ) & ddpf.dwRBitMask ); - memset( &ddofx, 0, sizeof( DDOVERLAYFX ) ); - ddofx.dwSize = sizeof( DDOVERLAYFX ); - ddofx.dckDestColorkey.dwColorSpaceLowValue = dw_color_key; - ddofx.dckDestColorkey.dwColorSpaceHighValue = dw_color_key; + memset( &ddofx, 0, sizeof( DDOVERLAYFX ) ); + ddofx.dwSize = sizeof( DDOVERLAYFX ); + ddofx.dckDestColorkey.dwColorSpaceLowValue = dw_color_key; + ddofx.dckDestColorkey.dwColorSpaceHighValue = dw_color_key; - // set our overlay flags + /* set our overlay flags */ - flags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE; + flags = DDOVER_SHOW | DDOVER_KEYDESTOVERRIDE; - // attempt to overlay the surface + /* attempt to overlay the surface */ - result = IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); - if( result != DD_OK ) + result = IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); + if( result != DD_OK ) + { + if( result == DDERR_SURFACELOST ) { - if( result == DDERR_SURFACELOST ) - { - IDirectDrawSurface7_Restore( src_surface ); - IDirectDrawSurface7_Restore( dst_surface ); - - IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); - } - else - { - Error( 0, "IDirectDrawSurface7_UpdateOverlay : error %i", result ); - return FALSE; - } + IDirectDrawSurface7_Restore( src_surface ); + IDirectDrawSurface7_Restore( dst_surface ); + + IDirectDrawSurface7_UpdateOverlay( src_surface, src_rect, dst_surface, dst_rect, flags, &ddofx ); } + else + { + Error( 0, "IDirectDrawSurface7_UpdateOverlay : error %i", result ); + return FALSE; + } + } - return TRUE; + return TRUE; } -// Copy our off screen surface into our primary -// surface. This funtion is only used when a -// h/w overlay of the current frame format is -// not supported. +/* Copy our off screen surface into our primary + * surface. This funtion is only used when a + * h/w overlay of the current frame format is + * not supported. */ boolean BltCopy( LPDIRECTDRAWSURFACE7 src_surface, RECT * src_rect, - LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect ) + LPDIRECTDRAWSURFACE7 dst_surface, RECT * dst_rect ) { - DDSURFACEDESC ddsd_target; - HRESULT result; + DDSURFACEDESC ddsd_target; + HRESULT result; - memset( &ddsd_target, 0, sizeof( ddsd_target ) ); - ddsd_target.dwSize = sizeof( ddsd_target ); + memset( &ddsd_target, 0, sizeof( ddsd_target ) ); + ddsd_target.dwSize = sizeof( ddsd_target ); - // attempt to blt the surface sontents + /* attempt to blt the surface sontents */ - result = IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); - if( result != DD_OK ) + result = IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); + if( result != DD_OK ) + { + if( result != DDERR_SURFACELOST ) { - if( result != DDERR_SURFACELOST ) - { - IDirectDrawSurface7_Restore( src_surface ); - IDirectDrawSurface7_Restore( dst_surface ); - - IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); - } - else - { - Error( 0, "IDirectDrawSurface7_Blt : error %i", result ); - return FALSE; - } + IDirectDrawSurface7_Restore( src_surface ); + IDirectDrawSurface7_Restore( dst_surface ); + + IDirectDrawSurface7_Blt( dst_surface, dst_rect, src_surface, src_rect, DDBLT_WAIT, 0 ); } + else + { + Error( 0, "IDirectDrawSurface7_Blt : error %i", result ); + return FALSE; + } + } - return TRUE; + return TRUE; } -// Display our current frame. This function -// corrects frame output ratio and clipps the -// frame if nessesary. It will then handle -// moving the image contents contained in our -// secondary surface to our primary surface. +/* Display our current frame. This function + * corrects frame output ratio and clipps the + * frame if nessesary. It will then handle + * moving the image contents contained in our + * secondary surface to our primary surface. */ boolean DisplayFrame( win32_driver_t * win32_driver ) { - int view_width; - int view_height; - int scaled_width; - int scaled_height; - int screen_width; - int screen_height; - RECT clipped; - RECT centered; + int view_width; + int view_height; + int scaled_width; + int scaled_height; + int screen_width; + int screen_height; + RECT clipped; + RECT centered; - // aspect ratio calculations + /* aspect ratio calculations */ - // TODO : account for screen ratio as well + /* TODO : account for screen ratio as well */ - view_width = win32_driver->win32_visual->WndRect.right - win32_driver->win32_visual->WndRect.left; - view_height = win32_driver->win32_visual->WndRect.bottom - win32_driver->win32_visual->WndRect.top; + view_width = win32_driver->win32_visual->WndRect.right - win32_driver->win32_visual->WndRect.left; + view_height = win32_driver->win32_visual->WndRect.bottom - win32_driver->win32_visual->WndRect.top; - if( view_width / win32_driver->ratio < view_height ) - { - scaled_width = view_width - BORDER_SIZE; - scaled_height = view_width / win32_driver->ratio - BORDER_SIZE; - } - else - { - scaled_width = view_height * win32_driver->ratio - BORDER_SIZE; - scaled_height = view_height - BORDER_SIZE; - } - - // center our overlay in our view frame - - centered.left = ( view_width - scaled_width ) / 2 + win32_driver->win32_visual->WndRect.left; - centered.right = centered.left + scaled_width; - centered.top = ( view_height - scaled_height ) / 2 + win32_driver->win32_visual->WndRect.top; - centered.bottom = centered.top + scaled_height; + if( view_width / win32_driver->ratio < view_height ) + { + scaled_width = view_width - BORDER_SIZE; + scaled_height = view_width / win32_driver->ratio - BORDER_SIZE; + } + else + { + scaled_width = view_height * win32_driver->ratio - BORDER_SIZE; + scaled_height = view_height - BORDER_SIZE; + } - // clip our overlay if it is off screen + /* center our overlay in our view frame */ - screen_width = GetSystemMetrics( SM_CXSCREEN ); - screen_height = GetSystemMetrics( SM_CYSCREEN ); + centered.left = ( view_width - scaled_width ) / 2 + win32_driver->win32_visual->WndRect.left; + centered.right = centered.left + scaled_width; + centered.top = ( view_height - scaled_height ) / 2 + win32_driver->win32_visual->WndRect.top; + centered.bottom = centered.top + scaled_height; - if( centered.left < 0 ) - { - double x_scale = ( double ) ( view_width + centered.left ) / ( double ) view_width; - clipped.left = win32_driver->width - ( int ) ( win32_driver->width * x_scale ); - centered.left = 0; - } - else - clipped.left = 0; + /* clip our overlay if it is off screen */ - if( centered.top < 0 ) - { - double y_scale = ( double ) ( view_height + centered.top ) / ( double ) view_height; - clipped.left = win32_driver->height - ( int ) ( win32_driver->height * y_scale ); - centered.left = 0; - } - else - clipped.top = 0; + screen_width = GetSystemMetrics( SM_CXSCREEN ); + screen_height = GetSystemMetrics( SM_CYSCREEN ); - if( centered.right > screen_width ) - { - double x_scale = ( double ) ( view_width - ( centered.right - screen_width ) ) / ( double ) view_width; - clipped.right = ( int ) ( win32_driver->width * x_scale ); - centered.right = screen_width; - } - else - clipped.right = win32_driver->width; + if( centered.left < 0 ) + { + double x_scale = ( double ) ( view_width + centered.left ) / ( double ) view_width; + clipped.left = win32_driver->width - ( int ) ( win32_driver->width * x_scale ); + centered.left = 0; + } + else + clipped.left = 0; - if( centered.bottom > screen_height ) - { - double y_scale = ( double ) ( view_height - ( centered.bottom - screen_height ) ) / ( double ) view_height; - clipped.bottom = ( int ) ( win32_driver->height * y_scale ); - centered.bottom = screen_height; - } - else - clipped.bottom = win32_driver->height; + if( centered.top < 0 ) + { + double y_scale = ( double ) ( view_height + centered.top ) / ( double ) view_height; + clipped.left = win32_driver->height - ( int ) ( win32_driver->height * y_scale ); + centered.left = 0; + } + else + clipped.top = 0; - // if surface is entirely off screen or the - // width or height is 0 for the overlay or - // the output view area, then return without - // overlay update + if( centered.right > screen_width ) + { + double x_scale = ( double ) ( view_width - ( centered.right - screen_width ) ) / ( double ) view_width; + clipped.right = ( int ) ( win32_driver->width * x_scale ); + centered.right = screen_width; + } + else + clipped.right = win32_driver->width; - if( ( centered.left > screen_width ) || - ( centered.top > screen_height ) || - ( centered.right < 0 ) || - ( centered.bottom < 0 ) || - ( clipped.left >= clipped.right ) || - ( clipped.top >= clipped.bottom ) || - ( view_width <= 0 ) || - ( view_height <= 0 ) ) + if( centered.bottom > screen_height ) + { + double y_scale = ( double ) ( view_height - ( centered.bottom - screen_height ) ) / ( double ) view_height; + clipped.bottom = ( int ) ( win32_driver->height * y_scale ); + centered.bottom = screen_height; + } + else + clipped.bottom = win32_driver->height; + + /* if surface is entirely off screen or the + * width or height is 0 for the overlay or + * the output view area, then return without + * overlay update */ + + if( ( centered.left > screen_width ) || + ( centered.top > screen_height ) || + ( centered.right < 0 ) || + ( centered.bottom < 0 ) || + ( clipped.left >= clipped.right ) || + ( clipped.top >= clipped.bottom ) || + ( view_width <= 0 ) || + ( view_height <= 0 ) ) - return 1; + return 1; - // we have a h/w supported overlay + /* we have a h/w supported overlay */ - if( ( win32_driver->act_format == XINE_IMGFMT_YV12 ) || ( win32_driver->act_format == XINE_IMGFMT_YUY2 ) ) - return Overlay( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered, win32_driver->win32_visual->ColorKey ); + if( ( win32_driver->act_format == XINE_IMGFMT_YV12 ) || ( win32_driver->act_format == XINE_IMGFMT_YUY2 ) ) + return Overlay( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered, win32_driver->win32_visual->ColorKey ); - // we do not have a h/w supported overlay + /* we do not have a h/w supported overlay */ - return BltCopy( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered ); + return BltCopy( win32_driver->secondary, &clipped, win32_driver->primary, ¢ered ); } -// Lock our back buffer to update its contents. +/* Lock our back buffer to update its contents. */ void * Lock( void * surface ) { - LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; - DDSURFACEDESC2 ddsd; - HRESULT result; + LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; + DDSURFACEDESC2 ddsd; + HRESULT result; - if( !surface ) - return 0; + if( !surface ) + return 0; - memset( &ddsd, 0, sizeof( ddsd ) ); - ddsd.dwSize = sizeof( ddsd ); + memset( &ddsd, 0, sizeof( ddsd ) ); + ddsd.dwSize = sizeof( ddsd ); - result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); - if( result == DDERR_SURFACELOST ) + result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); + if( result == DDERR_SURFACELOST ) { - IDirectDrawSurface7_Restore( lock_surface ); - result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); + IDirectDrawSurface7_Restore( lock_surface ); + result = IDirectDrawSurface7_Lock( lock_surface, 0, &ddsd, DDLOCK_WAIT | DDLOCK_NOSYSLOCK, 0 ); - if( result != DD_OK ) - return 0; + if( result != DD_OK ) + return 0; - } - else if( result != DD_OK ) + } + else if( result != DD_OK ) + { + if( result == DDERR_GENERIC ) { - if( result == DDERR_GENERIC ) - { - Error( 0, "surface->Lock : error, DDERR_GENERIC" ); - exit( 1 ); - } + Error( 0, "surface->Lock : error, DDERR_GENERIC" ); + exit( 1 ); } + } - return ddsd.lpSurface; + return ddsd.lpSurface; - return 0; + return 0; } -// Unlock our back buffer to prepair for display. +/* Unlock our back buffer to prepair for display. */ void Unlock( void * surface ) { - LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; + LPDIRECTDRAWSURFACE7 lock_surface = ( LPDIRECTDRAWSURFACE7 ) surface; - if( !surface ) - return; + if( !surface ) + return; - IDirectDrawSurface7_Unlock( lock_surface, 0 ); + IDirectDrawSurface7_Unlock( lock_surface, 0 ); } -// ----------------------------------------- -// -// BEGIN : Xine driver video output plugin -// handlers. -// -// ----------------------------------------- +/* ----------------------------------------- + * + * BEGIN : Xine driver video output plugin + * handlers. + * + * ----------------------------------------- */ static uint32_t win32_get_capabilities( vo_driver_t * vo_driver ) { - uint32_t retVal; + uint32_t retVal; - retVal = VO_CAP_YV12 | VO_CAP_YUY2; + retVal = VO_CAP_YV12 | VO_CAP_YUY2; #if RGB_SUPPORT - retVal |= VO_CAP_RGB; + retVal |= VO_CAP_RGB; #endif /* RGB_SUPPORT */ - return retVal; + return retVal; } static void win32_frame_field( vo_frame_t * vo_frame, int which_field ) { - // I have no idea what this even - // does, frame interlace stuff? + /* I have no idea what this even + * does, frame interlace stuff? */ } static void win32_free_framedata(vo_frame_t* vo_frame) { - win32_frame_t * frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * frame = ( win32_frame_t * ) vo_frame; - if(frame->vo_frame.base[0]) { - free(frame->vo_frame.base[0]); - frame->vo_frame.base[0] = NULL; - } + if(frame->vo_frame.base[0]) { + free(frame->vo_frame.base[0]); + frame->vo_frame.base[0] = NULL; + } - if(frame->vo_frame.base[1]) { - free(frame->vo_frame.base[1]); - frame->vo_frame.base[1] = NULL; - } + if(frame->vo_frame.base[1]) { + free(frame->vo_frame.base[1]); + frame->vo_frame.base[1] = NULL; + } - if(frame->vo_frame.base[2]) { - free(frame->vo_frame.base[2]); - frame->vo_frame.base[2] = NULL; - } + if(frame->vo_frame.base[2]) { + free(frame->vo_frame.base[2]); + frame->vo_frame.base[2] = NULL; + } } static void win32_frame_dispose( vo_frame_t * vo_frame ) { - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - if( win32_frame->buffer ) - free( win32_frame->buffer ); + if( win32_frame->buffer ) + free( win32_frame->buffer ); - win32_free_framedata(vo_frame); + win32_free_framedata(vo_frame); - free( win32_frame ); + free( win32_frame ); } static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) { - win32_frame_t * win32_frame; + win32_frame_t * win32_frame; - win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) ); - if (win32_frame == NULL) { - printf("win32_alloc_frame: out of memory\n"); - return NULL; - } - memset( win32_frame, 0, sizeof( win32_frame_t ) ); + win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) ); + if (win32_frame == NULL) { + printf("win32_alloc_frame: out of memory\n"); + return NULL; + } + memset( win32_frame, 0, sizeof( win32_frame_t ) ); - win32_frame->vo_frame.proc_slice = NULL; - win32_frame->vo_frame.proc_frame = NULL; - win32_frame->vo_frame.field = win32_frame_field; - win32_frame->vo_frame.dispose = win32_frame_dispose; - win32_frame->format = -1; + win32_frame->vo_frame.proc_slice = NULL; + win32_frame->vo_frame.proc_frame = NULL; + win32_frame->vo_frame.field = win32_frame_field; + win32_frame->vo_frame.dispose = win32_frame_dispose; + win32_frame->format = -1; - return ( vo_frame_t * ) win32_frame; + return ( vo_frame_t * ) win32_frame; } static void win32_update_frame_format( vo_driver_t * vo_driver, vo_frame_t * vo_frame, uint32_t width, - uint32_t height, double ratio, int format, int flags ) + uint32_t height, double ratio, int format, int flags ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; + win32_frame_t *win32_frame = ( win32_frame_t * ) vo_frame; - /*printf("vo_out_directx : win32_update_frame_format() - width = %d, height=%d, ratio_code=%d, format=%d, flags=%d\n", width, height, ratio_code, format, flags);*/ + /*printf("vo_out_directx : win32_update_frame_format() - width = %d, height=%d, ratio_code=%d, format=%d, flags=%d\n", width, height, ratio_code, format, flags);*/ - if( ( win32_frame->format != format ) || - ( win32_frame->width != width ) || - ( win32_frame->height != height ) ) - { - // free our allocated memory + if( ( win32_frame->format != format ) || + ( win32_frame->width != width ) || + ( win32_frame->height != height ) ) + { + /* free our allocated memory */ - win32_free_framedata((vo_frame_t *)&win32_frame->vo_frame); + win32_free_framedata((vo_frame_t *)&win32_frame->vo_frame); - // create new render buffer - if( format == XINE_IMGFMT_YV12 ) - { - win32_frame->vo_frame.pitches[0] = 8*((width + 7) / 8); - win32_frame->vo_frame.pitches[1] = 8*((width + 15) / 16); - win32_frame->vo_frame.pitches[2] = 8*((width + 15) / 16); + /* create new render buffer */ + if( format == XINE_IMGFMT_YV12 ) + { + win32_frame->vo_frame.pitches[0] = 8*((width + 7) / 8); + win32_frame->vo_frame.pitches[1] = 8*((width + 15) / 16); + win32_frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height); - win32_frame->vo_frame.base[1] = malloc(win32_frame->vo_frame.pitches[1] * ((height+1)/2)); - win32_frame->vo_frame.base[2] = malloc(win32_frame->vo_frame.pitches[2] * ((height+1)/2)); + win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height); + win32_frame->vo_frame.base[1] = malloc(win32_frame->vo_frame.pitches[1] * ((height+1)/2)); + win32_frame->vo_frame.base[2] = malloc(win32_frame->vo_frame.pitches[2] * ((height+1)/2)); - win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; - } - else if( format == XINE_IMGFMT_YUY2 ) - { - win32_frame->vo_frame.pitches[0] = 8*((width + 3) / 4); + win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; + } + else if( format == XINE_IMGFMT_YUY2 ) + { + win32_frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height * 2); - win32_frame->vo_frame.base[1] = NULL; - win32_frame->vo_frame.base[2] = NULL; + win32_frame->vo_frame.base[0] = malloc(win32_frame->vo_frame.pitches[0] * height * 2); + win32_frame->vo_frame.base[1] = NULL; + win32_frame->vo_frame.base[2] = NULL; - win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; - } + win32_frame->size = win32_frame->vo_frame.pitches[0] * height * 2; + } #if RGB_SUPPORT - else if( format == IMGFMT_RGB ) - { - win32_frame->size = width * height * 3; - win32_frame->buffer = malloc( win32_frame->size ); - vo_frame->base[0] = win32_frame->buffer; - } + else if( format == IMGFMT_RGB ) + { + win32_frame->size = width * height * 3; + win32_frame->buffer = malloc( win32_frame->size ); + vo_frame->base[0] = win32_frame->buffer; + } #endif - else - { - printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); - exit (1); - } - - win32_frame->format = format; - win32_frame->width = width; - win32_frame->height = height; - win32_frame->ratio = ratio; + else + { + printf ( "vo_out_directx : !!! unsupported image format %04x !!!\n", format ); + exit (1); } + + win32_frame->format = format; + win32_frame->width = width; + win32_frame->height = height; + win32_frame->ratio = ratio; + } } static void win32_display_frame( vo_driver_t * vo_driver, vo_frame_t * vo_frame ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - int offset; - int size; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; + win32_frame_t *win32_frame = ( win32_frame_t * ) vo_frame; + int offset; + int size; - // if the required width, height or format has changed - // then recreate the secondary buffer + /* if the required width, height or format has changed + * then recreate the secondary buffer */ - if( ( win32_driver->req_format != win32_frame->format ) || - ( win32_driver->width != win32_frame->width ) || - ( win32_driver->height != win32_frame->height ) ) - { - CreateSecondary( win32_driver, win32_frame->width, win32_frame->height, win32_frame->format ); - } + if( ( win32_driver->req_format != win32_frame->format ) || + ( win32_driver->width != win32_frame->width ) || + ( win32_driver->height != win32_frame->height ) ) + { + CreateSecondary( win32_driver, win32_frame->width, win32_frame->height, win32_frame->format ); + } - // determine desired ratio + /* determine desired ratio */ - win32_driver->ratio = win32_frame->ratio; + win32_driver->ratio = win32_frame->ratio; - // lock our surface to update its contents + /* lock our surface to update its contents */ - win32_driver->contents = Lock( win32_driver->secondary ); + win32_driver->contents = Lock( win32_driver->secondary ); - // surface unavailable, skip frame render + /* surface unavailable, skip frame render */ - if( !win32_driver->contents ) - { - vo_frame->free( vo_frame ); - return; - } + if( !win32_driver->contents ) + { + vo_frame->free( vo_frame ); + return; + } - // if our actual frame format is the native screen - // pixel format, we need to convert it + /* if our actual frame format is the native screen + * pixel format, we need to convert it */ - if( win32_driver->act_format == IMGFMT_NATIVE ) - { - // use the software color conversion functions - // to rebuild the frame in our native screen - // pixel format ... this is slow + if( win32_driver->act_format == IMGFMT_NATIVE ) + { + /* use the software color conversion functions + * to rebuild the frame in our native screen + * pixel format ... this is slow */ - if( win32_driver->req_format == XINE_IMGFMT_YV12 ) - { - // convert from yv12 to native - // screen pixel format + if( win32_driver->req_format == XINE_IMGFMT_YV12 ) + { + /* convert from yv12 to native + * screen pixel format */ #if NEW_YUV - win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #else - yuv2rgb_setup( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + yuv2rgb_setup( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #endif - win32_driver->yuv2rgb->yuv2rgb_fun( win32_driver->yuv2rgb, - win32_driver->contents, - win32_frame->vo_frame.base[0], - win32_frame->vo_frame.base[1], - win32_frame->vo_frame.base[2] ); - } - - if( win32_driver->req_format == XINE_IMGFMT_YUY2 ) - { - // convert from yuy2 to native - // screen pixel format + win32_driver->yuv2rgb->yuv2rgb_fun( win32_driver->yuv2rgb, + win32_driver->contents, + win32_frame->vo_frame.base[0], + win32_frame->vo_frame.base[1], + win32_frame->vo_frame.base[2] ); + } + + if( win32_driver->req_format == XINE_IMGFMT_YUY2 ) + { + /* convert from yuy2 to native + * screen pixel format */ #if NEW_YUV - win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + win32_driver->yuv2rgb->configure( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #else - yuv2rgb_setup( win32_driver->yuv2rgb, - win32_driver->width, win32_driver->height, - win32_driver->width, win32_driver->width/2, - win32_driver->width, win32_driver->height, - win32_driver->width * win32_driver->bytespp ); + yuv2rgb_setup( win32_driver->yuv2rgb, + win32_driver->width, win32_driver->height, + win32_driver->width, win32_driver->width/2, + win32_driver->width, win32_driver->height, + win32_driver->width * win32_driver->bytespp ); #endif - win32_driver->yuv2rgb->yuy22rgb_fun( win32_driver->yuv2rgb, - win32_driver->contents, - win32_frame->vo_frame.base[0] ); - } + win32_driver->yuv2rgb->yuy22rgb_fun( win32_driver->yuv2rgb, + win32_driver->contents, + win32_frame->vo_frame.base[0] ); + } #if RGB_SUPPORT - if( win32_driver->req_format == IMGFMT_RGB ) - { - // convert from 24 bit rgb to native - // screen pixel format + if( win32_driver->req_format == IMGFMT_RGB ) + { + /* convert from 24 bit rgb to native + * screen pixel format */ - // TODO : rgb2rgb conversion - } -#endif + /* TODO : rgb2rgb conversion */ } - else +#endif + } + else + { + /* the actual format is identical to our + * stream format. we just need to copy it */ + + switch(win32_frame->format) { - // the actual format is identical to our - // stream format. we just need to copy it - - switch(win32_frame->format) - { - case XINE_IMGFMT_YV12: - { - vo_frame_t *frame; - uint8_t *img; - - frame = vo_frame; - img = (uint8_t *)win32_driver->contents; - - offset = 0; - size = frame->pitches[0] * frame->height; - memcpy( img+offset, frame->base[0], size); - - offset += size; - size = frame->pitches[2]* frame->height / 2; - memcpy( img+offset, frame->base[2], size); + case XINE_IMGFMT_YV12: + { + vo_frame_t *frame; + uint8_t *img; + + frame = vo_frame; + img = (uint8_t *)win32_driver->contents; + + offset = 0; + size = frame->pitches[0] * frame->height; + memcpy( img+offset, frame->base[0], size); + + offset += size; + size = frame->pitches[2]* frame->height / 2; + memcpy( img+offset, frame->base[2], size); - offset += size; - size = frame->pitches[1] * frame->height / 2; - memcpy( img+offset, frame->base[1], size); - } - break; - case XINE_IMGFMT_YUY2: - memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); - break; - default: - memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); - break; - } + offset += size; + size = frame->pitches[1] * frame->height / 2; + memcpy( img+offset, frame->base[1], size); + } + break; + case XINE_IMGFMT_YUY2: + memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); + break; + default: + memcpy( win32_driver->contents, win32_frame->vo_frame.base[0], win32_frame->vo_frame.pitches[0] * win32_frame->vo_frame.height * 2); + break; } + } - // unlock the surface + /* unlock the surface */ - Unlock( win32_driver->secondary ); + Unlock( win32_driver->secondary ); - // scale, clip and display our frame + /* scale, clip and display our frame */ - DisplayFrame( win32_driver ); + DisplayFrame( win32_driver ); - // tag our frame as displayed - if((win32_driver->current != NULL) && (win32_driver->current != vo_frame)) { - vo_frame->free(&win32_driver->current->vo_frame); - } - win32_driver->current = vo_frame; + /* tag our frame as displayed */ + if((win32_driver->current != NULL) && (win32_driver->current != vo_frame)) { + vo_frame->free(&win32_driver->current->vo_frame); + } + win32_driver->current = vo_frame; } static void win32_overlay_blend( vo_driver_t * vo_driver, vo_frame_t * vo_frame, vo_overlay_t * vo_overlay ) { - win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; + win32_frame_t * win32_frame = ( win32_frame_t * ) vo_frame; - // temporary overlay support, somthing more appropriate - // for win32 will be devised at a later date + /* temporary overlay support, somthing more appropriate + * for win32 will be devised at a later date */ - if( vo_overlay->rle ) - { - if( vo_frame->format == XINE_IMGFMT_YV12 ) - blend_yuv( win32_frame->vo_frame.base, vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches ); - else - blend_yuy2( win32_frame->vo_frame.base[0], vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches[0] ); - } + if( vo_overlay->rle ) + { + if( vo_frame->format == XINE_IMGFMT_YV12 ) + blend_yuv( win32_frame->vo_frame.base, vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches ); + else + blend_yuy2( win32_frame->vo_frame.base[0], vo_overlay, win32_frame->width, win32_frame->height, win32_frame->vo_frame.pitches[0] ); + } } static int win32_get_property( vo_driver_t * vo_driver, int property ) { -#ifdef LOG - printf( "win32_get_property\n" ); -#endif + lprintf( "win32_get_property\n" ); - return 0; + return 0; } static int win32_set_property( vo_driver_t * vo_driver, int property, int value ) { - return value; + return value; } static void win32_get_property_min_max( vo_driver_t * vo_driver, int property, int * min, int * max ) { - *min = 0; - *max = 0; + *min = 0; + *max = 0; } static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void * data ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; - switch( data_type ) - { - case GUI_WIN32_MOVED_OR_RESIZED: - UpdateRect( win32_driver->win32_visual ); - DisplayFrame( win32_driver ); - break; - } + switch( data_type ) + { + case GUI_WIN32_MOVED_OR_RESIZED: + UpdateRect( win32_driver->win32_visual ); + DisplayFrame( win32_driver ); + break; + } return 0; } @@ -1138,7 +1119,7 @@ static int win32_gui_data_exchange( vo_driver_t * vo_driver, int data_type, void static int win32_redraw_needed(vo_driver_t* this_gen) { - win32_driver_t* win32_driver = (win32_driver_t *) this_gen; + win32_driver_t *win32_driver = (win32_driver_t *) this_gen; int ret = 0; @@ -1155,52 +1136,52 @@ static int win32_redraw_needed(vo_driver_t* this_gen) static void win32_exit( vo_driver_t * vo_driver ) { - win32_driver_t * win32_driver = ( win32_driver_t * ) vo_driver; + win32_driver_t *win32_driver = ( win32_driver_t * ) vo_driver; - free(win32_driver->win32_visual); + free(win32_driver->win32_visual); - Destroy( win32_driver ); + Destroy( win32_driver ); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *win32_visual) -/*vo_driver_t *init_video_out_plugin( config_values_t * config, void * win32_visual )*/ + /*vo_driver_t *init_video_out_plugin( config_values_t * config, void * win32_visual )*/ { - - /* Make sure that the DirectX drivers are available and present! */ - /* Not complete yet */ - - win32_driver_t * win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); - memset( win32_driver, 0, sizeof( win32_driver_t ) ); - - win32_driver->win32_visual = win32_visual; - win32_driver->vo_driver.get_capabilities = win32_get_capabilities; - win32_driver->vo_driver.alloc_frame = win32_alloc_frame ; - win32_driver->vo_driver.update_frame_format = win32_update_frame_format; - win32_driver->vo_driver.display_frame = win32_display_frame; - win32_driver->vo_driver.overlay_blend = win32_overlay_blend; - win32_driver->vo_driver.get_property = win32_get_property; - win32_driver->vo_driver.set_property = win32_set_property; - win32_driver->vo_driver.get_property_min_max = win32_get_property_min_max; - win32_driver->vo_driver.gui_data_exchange = win32_gui_data_exchange; - win32_driver->vo_driver.dispose = win32_exit; - win32_driver->vo_driver.redraw_needed = win32_redraw_needed; - - CreatePrimary( win32_driver ); - if( !CheckPixelFormat( win32_driver ) ) - { - Error( 0, "vo_directx : Your screen pixel format is not supported" ); - Destroy( win32_driver ); - return 0; - } + win32_driver_t *win32_driver = ( win32_driver_t * ) malloc ( sizeof( win32_driver_t ) ); + + memset( win32_driver, 0, sizeof( win32_driver_t ) ); + + /* Make sure that the DirectX drivers are available and present! */ + /* Not complete yet */ + + win32_driver->win32_visual = win32_visual; + win32_driver->vo_driver.get_capabilities = win32_get_capabilities; + win32_driver->vo_driver.alloc_frame = win32_alloc_frame ; + win32_driver->vo_driver.update_frame_format = win32_update_frame_format; + win32_driver->vo_driver.display_frame = win32_display_frame; + win32_driver->vo_driver.overlay_blend = win32_overlay_blend; + win32_driver->vo_driver.get_property = win32_get_property; + win32_driver->vo_driver.set_property = win32_set_property; + win32_driver->vo_driver.get_property_min_max = win32_get_property_min_max; + win32_driver->vo_driver.gui_data_exchange = win32_gui_data_exchange; + win32_driver->vo_driver.dispose = win32_exit; + win32_driver->vo_driver.redraw_needed = win32_redraw_needed; + + CreatePrimary( win32_driver ); + if( !CheckPixelFormat( win32_driver ) ) + { + Error( 0, "vo_directx : Your screen pixel format is not supported" ); + Destroy( win32_driver ); + return 0; + } #if (NEW_YUV) - win32_driver->yuv2rgb_factory = yuv2rgb_factory_init( win32_driver->mode, 0, 0 ); - win32_driver->yuv2rgb = win32_driver->yuv2rgb_factory->create_converter(win32_driver->yuv2rgb_factory); + win32_driver->yuv2rgb_factory = yuv2rgb_factory_init( win32_driver->mode, 0, 0 ); + win32_driver->yuv2rgb = win32_driver->yuv2rgb_factory->create_converter(win32_driver->yuv2rgb_factory); #else - win32_driver->yuv2rgb = yuv2rgb_init( win32_driver->mode, 0, 0 ); + win32_driver->yuv2rgb = yuv2rgb_init( win32_driver->mode, 0, 0 ); #endif - return ( vo_driver_t * ) win32_driver; + return ( vo_driver_t * ) win32_driver; } @@ -1213,32 +1194,31 @@ static char* get_description (video_driver_class_t *this_gen) { } static void dispose_class (video_driver_class_t *this_gen) { - directx_class_t *directx = (directx_class_t *) this_gen; + free (directx); } static void *init_class (xine_t *xine, void *visual_gen) { - directx_class_t *directx; - char* device_name; - + directx_class_t *directx; + char* device_name; #ifdef TC - int fd; + int fd; #endif - device_name = xine->config->register_string(xine->config, - "video.directx_device", "/dev/directx", - _("xine video output plugin for win32 using directx"), - NULL, 10, NULL, NULL); + device_name = xine->config->register_string(xine->config, + "video.directx_device", "/dev/directx", + _("xine video output plugin for win32 using directx"), + NULL, 10, NULL, NULL); #ifdef TC - /* check for directx device */ - if((fd = open(device_name, O_RDWR)) < 0) { - printf("video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); - return NULL; - } - close(fd); + /* check for directx device */ + if((fd = open(device_name, O_RDWR)) < 0) { + printf("video_out_directx: aborting. (unable to open directx device \"%s\")\n", device_name); + return NULL; + } + close(fd); #endif /* @@ -1252,14 +1232,14 @@ static void *init_class (xine_t *xine, void *visual_gen) { directx->driver_class.get_description = get_description; directx->driver_class.dispose = dispose_class; - directx->config = xine->config; - directx->device_name = device_name; + directx->config = xine->config; + directx->device_name = device_name; return directx; } static vo_info_t vo_info_win32 = { - 7, /* priority */ + 7, /* priority */ XINE_VISUAL_TYPE_DIRECTX /* visual type */ }; diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 5fa3df6e6..3900d5b66 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_fb.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_fb.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_fb.c, frame buffer xine driver by Miguel Freitas * @@ -74,14 +74,18 @@ #include #include +#define LOG_MODULE "video_out_fb" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "alphablend.h" #include "yuv2rgb.h" #include "xineutils.h" #include "vo_scale.h" -#define LOG - typedef struct fb_frame_s { vo_frame_t vo_frame; @@ -272,14 +276,12 @@ static void fb_compute_rgb_size(fb_driver_t *this, fb_frame_t *frame) if (frame->sc.output_width & 1) frame->sc.output_width++; -#ifdef LOG - printf("video_out_fb: frame source %d x %d => screen output %d x %d%s\n", - frame->sc.delivered_width, frame->sc.delivered_height, - frame->sc.output_width, frame->sc.output_height, - (frame->sc.delivered_width != frame->sc.output_width || - frame->sc.delivered_height != frame->sc.output_height ? - ", software scaling" : "")); -#endif + lprintf("frame source %d x %d => screen output %d x %d%s\n", + frame->sc.delivered_width, frame->sc.delivered_height, + frame->sc.output_width, frame->sc.output_height, + (frame->sc.delivered_width != frame->sc.output_width || + frame->sc.delivered_height != frame->sc.output_height ? + ", software scaling" : "")); } static void setup_colorspace_converter(fb_frame_t *frame, int flags) @@ -430,10 +432,7 @@ static void fb_update_frame_format(vo_driver_t *this_gen, format != frame->format || this->sc.user_ratio != frame->sc.user_ratio) { -#ifdef LOG - printf("video_out_fb: frame format (from decoder) " - "has changed => adapt\n"); -#endif + lprintf("frame format (from decoder) has changed => adapt\n"); frame->sc.delivered_width = width; frame->sc.delivered_height = height; diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 18c9c962d..516e8af56 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_sdl.c,v 1.32 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_sdl.c,v 1.33 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_sdl.c, Simple DirectMedia Layer * @@ -53,6 +53,12 @@ # include #endif +#define LOG_MODULE "video_out_sdl" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "xine_internal.h" #include "video_out.h" @@ -64,10 +70,6 @@ #include #endif -/* -#define SDL_LOG -*/ - typedef struct sdl_driver_s sdl_driver_t; typedef struct sdl_frame_s { @@ -164,11 +166,9 @@ static void sdl_compute_output_size (sdl_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); -#ifdef LOG - printf ("video_out_sdl: frame source %d x %d => screen output %d x %d\n", - this->sc.delivered_width, this->sc.delivered_height, - this->sc.output_width, this->sc.output_height); -#endif + lprintf ("frame source %d x %d => screen output %d x %d\n", + this->sc.delivered_width, this->sc.delivered_height, + this->sc.output_width, this->sc.output_height); } @@ -194,16 +194,12 @@ static void sdl_update_frame_format (vo_driver_t *this_gen, } if( format == XINE_IMGFMT_YV12 ) { -#ifdef SDL_LOG - printf ("video_out_sdl: format YV12 "); -#endif + lprintf ("format YV12 "); frame->overlay = SDL_CreateYUVOverlay (width, height, SDL_YV12_OVERLAY, this->surface); } else if( format == XINE_IMGFMT_YUY2 ) { -#ifdef SDL_LOG - printf ("video_out_sdl: format YUY2 "); -#endif + lprintf ("format YUY2 "); frame->overlay = SDL_CreateYUVOverlay (width, height, SDL_YUY2_OVERLAY, this->surface); } @@ -404,9 +400,7 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: -#ifdef SDL_LOG - printf ("video_out_sdl: XINE_GUI_SEND_DRAWABLE_CHANGED\n"); -#endif + lprintf ("XINE_GUI_SEND_DRAWABLE_CHANGED\n"); this->drawable = (Drawable) data; /* OOPS! Is it possible to change SDL window id? */ @@ -414,9 +408,7 @@ static int sdl_gui_data_exchange (vo_driver_t *this_gen, break; case XINE_GUI_SEND_EXPOSE_EVENT: -#ifdef SDL_LOG - printf ("video_out_sdl: XINE_GUI_SEND_EXPOSE_EVENT\n"); -#endif + lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); break; case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 3d215294b..0b92b6a0d 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_stk.c,v 1.9 2003/11/11 18:45:00 f1rmb Exp $ + * $Id: video_out_stk.c,v 1.10 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_stk.c, Libstk Surface Video Driver * more info on Libstk at http://www.libstk.org @@ -54,6 +54,12 @@ #include +#define LOG_MODULE "video_out_stk" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "xine_internal.h" #include "video_out.h" @@ -61,10 +67,6 @@ #include "xineutils.h" #include "vo_scale.h" -/* -#define STK_LOG -*/ - /* Extend the video frame class with stk private data */ typedef struct stk_frame_s { /* public interface */ @@ -156,11 +158,9 @@ static void stk_compute_output_size (stk_driver_t *this) { //printf("video_out_stk: compute_output_size()\n"); _x_vo_scale_compute_output_size( &this->sc ); -#ifdef LOG - printf ("video_out_stk: frame source %d x %d => screen output %d x %d\n", - this->sc.delivered_width, this->sc.delivered_height, - this->sc.output_width, this->sc.output_height); -#endif + lprintf ("frame source %d x %d => screen output %d x %d\n", + this->sc.delivered_width, this->sc.delivered_height, + this->sc.output_width, this->sc.output_height); } @@ -171,13 +171,11 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge //printf("video_out_stk: update_frame_format()\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { -#ifdef STK_LOG - printf("video_out_stk: update_frame_format - %d=%d, %d=%d, %d=%d\n", - frame->width, width, frame->height, height, frame->format, format); - printf("video_out_stk: vo_frame data - width, height, format: %d, %d, %d\n", - frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); -#endif - + lprintf("update_frame_format - %d=%d, %d=%d, %d=%d\n", + frame->width, width, frame->height, height, frame->format, format); + lprintf("vo_frame data - width, height, format: %d, %d, %d\n", + frame->vo_frame.width, frame->vo_frame.height, frame->vo_frame.format); + /* (re-) allocate image */ if (frame->overlay) { stk_overlay_free(frame->overlay); @@ -185,18 +183,14 @@ static void stk_update_frame_format (vo_driver_t *this_gen, vo_frame_t *frame_ge } if (format == XINE_IMGFMT_YV12) { -#ifdef STK_LOG - printf ("video_out_stk: format YV12\n"); -#endif - frame->overlay = stk_surface_create_overlay(this->surface, width, height, - STK_FORMAT_YV12); + lprintf ("format YV12\n"); + frame->overlay = stk_surface_create_overlay(this->surface, width, height, + STK_FORMAT_YV12); } else if (format == XINE_IMGFMT_YUY2) { -#ifdef STK_LOG - printf("video_out_stk: format YUY2\n"); -#endif - frame->overlay = stk_surface_create_overlay(this->surface, width, height, - STK_FORMAT_YUY2); + lprintf("format YUY2\n"); + frame->overlay = stk_surface_create_overlay(this->surface, width, height, + STK_FORMAT_YUY2); } if (frame->overlay == NULL) diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 8e06be682..bb4baf299 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_vidix.c,v 1.53 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_vidix.c,v 1.54 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_vidix.c * @@ -53,6 +53,12 @@ #include "vidixlib.h" #include "fourcc.h" +#define LOG_MODULE "video_out_vidix" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "video_out.h" #include "xine_internal.h" #include "alphablend.h" @@ -63,10 +69,6 @@ #include "x11osd.h" #endif -/* -#define LOG -*/ - #define NUM_FRAMES 3 typedef struct vidix_driver_s vidix_driver_t; @@ -436,9 +438,7 @@ static void vidix_config_playback (vidix_driver_t *this) { _x_vo_scale_compute_output_size( &this->sc ); if( this->vidix_started > 0 ) { -#ifdef LOG - printf("video_out_vidix: overlay off\n"); -#endif + lprintf("video_out_vidix: overlay off\n"); vdlPlaybackOff(this->vidix_handler); } @@ -469,31 +469,29 @@ static void vidix_config_playback (vidix_driver_t *this) { return; } -#ifdef LOG - printf("video_out_vidix: dga_addr = %p frame_size = %d frames = %d\n", - this->vidix_play.dga_addr, this->vidix_play.frame_size, - this->vidix_play.num_frames ); + lprintf("video_out_vidix: dga_addr = %p frame_size = %d frames = %d\n", + this->vidix_play.dga_addr, this->vidix_play.frame_size, + this->vidix_play.num_frames ); - printf("video_out_vidix: offsets[0..2] = %d %d %d\n", - this->vidix_play.offsets[0], this->vidix_play.offsets[1], - this->vidix_play.offsets[2] ); + lprintf("video_out_vidix: offsets[0..2] = %d %d %d\n", + this->vidix_play.offsets[0], this->vidix_play.offsets[1], + this->vidix_play.offsets[2] ); - printf("video_out_vidix: offset.y/u/v = %d/%d/%d\n", - this->vidix_play.offset.y, this->vidix_play.offset.u, - this->vidix_play.offset.v ); + lprintf("video_out_vidix: offset.y/u/v = %d/%d/%d\n", + this->vidix_play.offset.y, this->vidix_play.offset.u, + this->vidix_play.offset.v ); - printf("video_out_vidix: src.x/y/w/h = %d/%d/%d/%d\n", - this->vidix_play.src.x, this->vidix_play.src.y, - this->vidix_play.src.w, this->vidix_play.src.h ); + lprintf("video_out_vidix: src.x/y/w/h = %d/%d/%d/%d\n", + this->vidix_play.src.x, this->vidix_play.src.y, + this->vidix_play.src.w, this->vidix_play.src.h ); - printf("video_out_vidix: dest.x/y/w/h = %d/%d/%d/%d\n", - this->vidix_play.dest.x, this->vidix_play.dest.y, - this->vidix_play.dest.w, this->vidix_play.dest.h ); - - printf("video_out_vidix: dest.pitch.y/u/v = %d/%d/%d\n", - this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, - this->vidix_play.dest.pitch.v ); -#endif + lprintf("video_out_vidix: dest.x/y/w/h = %d/%d/%d/%d\n", + this->vidix_play.dest.x, this->vidix_play.dest.y, + this->vidix_play.dest.w, this->vidix_play.dest.h ); + + lprintf("video_out_vidix: dest.pitch.y/u/v = %d/%d/%d\n", + this->vidix_play.dest.pitch.y, this->vidix_play.dest.pitch.u, + this->vidix_play.dest.pitch.v ); this->vidix_mem = this->vidix_play.dga_addr; @@ -522,9 +520,7 @@ static void vidix_config_playback (vidix_driver_t *this) { this->delivered_format); } -#ifdef LOG - printf("video_out_vidix: overlay on\n"); -#endif + lprintf("video_out_vidix: overlay on\n"); vdlPlaybackOn(this->vidix_handler); this->vidix_started = 1; } @@ -664,17 +660,15 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) || (frame->format != this->delivered_format ) ) { -#ifdef LOG - printf("video_out_vidix: change frame format\n"); -#endif - - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio = frame->ratio; - this->delivered_format = frame->format; - - vidix_compute_ideal_size( this ); - this->sc.force_redraw = 1; + lprintf("video_out_vidix: change frame format\n"); + + this->sc.delivered_width = frame->width; + this->sc.delivered_height = frame->height; + this->sc.delivered_ratio = frame->ratio; + this->delivered_format = frame->format; + + vidix_compute_ideal_size( this ); + this->sc.force_redraw = 1; } /* @@ -712,10 +706,8 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { break; } -#ifdef LOG - printf ("video_out_vidix: property #%d = %d\n", property, - this->props[property].value); -#endif + lprintf ("video_out_vidix: property #%d = %d\n", property, + this->props[property].value); return this->props[property].value; } @@ -733,10 +725,8 @@ static int vidix_set_property (vo_driver_t *this_gen, this->props[property].value = value; if ( property == VO_PROP_ASPECT_RATIO) { -#ifdef LOG - printf("video_out_vidix: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); -#endif + lprintf("video_out_vidix: aspect ratio changed to %s\n", + _x_vo_scale_aspect_ratio_name(value)); if(value == XINE_VO_ASPECT_NUM_RATIOS) value = this->props[property].value = XINE_VO_ASPECT_AUTO; @@ -871,9 +861,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, switch (data_type) { case XINE_GUI_SEND_DRAWABLE_CHANGED: -#ifdef LOG - printf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); -#endif + lprintf ("video_out_vidix: GUI_DATA_EX_DRAWABLE_CHANGED\n"); if(this->visual_type == XINE_VISUAL_TYPE_X11) { #ifdef HAVE_X11 @@ -890,9 +878,7 @@ static int vidix_gui_data_exchange (vo_driver_t *this_gen, break; case XINE_GUI_SEND_EXPOSE_EVENT: -#ifdef LOG - printf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); -#endif + lprintf ("video_out_vidix: GUI_DATA_EX_EXPOSE_EVENT\n"); vidix_clean_output_area(this); #ifdef HAVE_X11 XLockDisplay (this->display); diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index 26e9bd4c1..4cde70123 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xshm.c,v 1.121 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_xshm.c,v 1.122 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_xshm.c, X11 shared memory extension interface for xine * @@ -54,6 +54,12 @@ #include #include +#define LOG_MODULE "video_out_xshm" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "alphablend.h" #include "yuv2rgb.h" @@ -61,10 +67,6 @@ #include "vo_scale.h" #include "x11osd.h" -/* -#define LOG -*/ - typedef struct { vo_frame_t vo_frame; @@ -320,9 +322,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { vo_img->proc_called = 1; -#ifdef LOG - printf ("video_out_xshm: copy... (format %d)\n", frame->format); -#endif + lprintf ("copy... (format %d)\n", frame->format); if (frame->format == XINE_IMGFMT_YV12) frame->yuv2rgb->yuv2rgb_fun (frame->yuv2rgb, frame->rgb_dst, @@ -331,9 +331,7 @@ static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) { frame->yuv2rgb->yuy22rgb_fun (frame->yuv2rgb, frame->rgb_dst, src[0]); -#ifdef LOG - printf ("video_out_xshm: copy...done\n"); -#endif + lprintf ("copy...done\n"); } static void xshm_frame_field (vo_frame_t *vo_img, int which_field) { @@ -423,7 +421,7 @@ static void xshm_compute_rgb_size (xshm_driver_t *this, xshm_frame_t *frame) { if (frame->sc.output_width & 1) /* yuv2rgb_mlib needs an even YUV2 width */ frame->sc.output_width++; - lprintf("video_out_xshm: frame source %d x %d => screen output %d x %d%s\n", + lprintf("frame source %d x %d => screen output %d x %d%s\n", frame->sc.delivered_width, frame->sc.delivered_height, frame->sc.output_width, frame->sc.output_height, ( frame->sc.delivered_width != frame->sc.output_width @@ -459,7 +457,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, do_adapt = 1; - lprintf ("video_out_xshm: frame format (from decoder) has changed => adapt\n"); + lprintf ("frame format (from decoder) has changed => adapt\n"); frame->sc.delivered_width = width; frame->sc.delivered_height = height; @@ -488,7 +486,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, xshm_compute_rgb_size (this, frame); - lprintf ("video_out_xshm: gui_size has changed => adapt\n"); + lprintf ("gui_size has changed => adapt\n"); } @@ -496,7 +494,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, if (do_adapt) { - lprintf ("video_out_xshm: updating frame to %d x %d\n", + lprintf ("updating frame to %d x %d\n", frame->sc.output_width, frame->sc.output_height); XLockDisplay (this->display); @@ -544,7 +542,7 @@ static void xshm_update_frame_format (vo_driver_t *this_gen, frame->chunk[2] = NULL; } - lprintf ("video_out_xshm: stripe out_ht=%i, deliv_ht=%i\n", + lprintf ("stripe out_ht=%i, deliv_ht=%i\n", frame->sc.output_height, frame->sc.delivered_height); /* @@ -713,8 +711,8 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xshm_driver_t *this = (xshm_driver_t *) this_gen; xshm_frame_t *frame = (xshm_frame_t *) frame_gen; - lprintf ("video_out_xshm: display frame...\n"); - lprintf ("video_out_xshm: about to draw frame %d x %d...\n", + lprintf ("display frame...\n"); + lprintf ("about to draw frame %d x %d...\n", frame->sc.output_width, frame->sc.output_height); /* @@ -744,11 +742,11 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { this->cur_frame = frame; XLockDisplay (this->display); - lprintf ("video_out_xshm: display locked...\n"); + lprintf ("display locked...\n"); if (this->use_shm) { - lprintf ("video_out_xshm: put image (shm)\n"); + lprintf ("put image (shm)\n"); XShmPutImage(this->display, this->drawable, this->gc, frame->image, 0, 0, frame->sc.output_xoffset, frame->sc.output_yoffset, @@ -756,7 +754,7 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { } else { - lprintf ("video_out_xshm: put image (plain/remote)\n"); + lprintf ("put image (plain/remote)\n"); XPutImage(this->display, this->drawable, this->gc, frame->image, 0, 0, frame->sc.output_xoffset, frame->sc.output_yoffset, @@ -766,7 +764,7 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { XSync(this->display, False); XUnlockDisplay (this->display); - lprintf ("video_out_xshm: display frame done\n"); + lprintf ("display frame done\n"); } static int xshm_get_property (vo_driver_t *this_gen, int property) { @@ -879,7 +877,7 @@ static int xshm_gui_data_exchange (vo_driver_t *this_gen, case XINE_GUI_SEND_EXPOSE_EVENT: - lprintf ("video_out_xshm: expose event\n"); + lprintf ("expose event\n"); if (this->cur_frame) { XExposeEvent * xev = (XExposeEvent *) data; diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index ae9b76579..a91bf39eb 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xv.c,v 1.183 2003/11/26 18:36:34 miguelfreitas Exp $ + * $Id: video_out_xv.c,v 1.184 2003/11/26 19:43:37 f1rmb Exp $ * * video_out_xv.c, X11 video extension interface for xine * @@ -64,6 +64,12 @@ #include #include +#define LOG_MODULE "vidoe_out_xv" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -74,10 +80,6 @@ #include "vo_scale.h" #include "x11osd.h" -/* -#define LOG -*/ - typedef struct xv_driver_s xv_driver_t; typedef struct { @@ -736,9 +738,7 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { -#ifdef LOG - printf("video_out_xv: frame format changed\n"); -#endif + lprintf("frame format changed\n"); this->sc.force_redraw = 1; /* trigger re-calc of output size */ } @@ -1337,11 +1337,10 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xv_format_yuy2 = 0; for(i = 0; i < formats; i++) { -#ifdef LOG - printf ("video_out_xv: Xv image format: 0x%x (%4.4s) %s\n", - fo[i].id, (char*)&fo[i].id, - (fo[i].format == XvPacked) ? "packed" : "planar"); -#endif + lprintf ("Xv image format: 0x%x (%4.4s) %s\n", + fo[i].id, (char*)&fo[i].id, + (fo[i].format == XvPacked) ? "packed" : "planar"); + if (fo[i].id == XINE_IMGFMT_YV12) { this->xv_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 547cf5804..04c94ba0b 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out_xvmc.c,v 1.8 2003/11/26 01:03:32 miguelfreitas Exp $ + * $Id: video_out_xvmc.c,v 1.9 2003/11/26 19:43:38 f1rmb Exp $ * * video_out_xvmc.c, X11 video motion compensation extension interface for xine * @@ -61,6 +61,12 @@ #include #include +#define LOG_MODULE "video_out_xvmc" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine.h" #include "video_out.h" #include "xine_internal.h" @@ -72,11 +78,7 @@ #include "xineutils.h" #include "vo_scale.h" -/* -#define LOG -*/ /* #define LOG1 */ -/* #define LOG */ /* #define DLOG */ /* #define PRINTDATA */ @@ -458,7 +460,7 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type, static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_capabilities\n"); + lprintf ("xvmc_get_capabilities\n"); return this->capabilities; } @@ -466,7 +468,7 @@ static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) { static void xvmc_frame_field (vo_frame_t *vo_img, int which_field) { xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver; - lprintf ("video_out_xvmc: xvmc_frame_field\n"); + lprintf ("xvmc_frame_field\n"); this->macroblocks.num_blocks = 0; this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr; @@ -477,7 +479,7 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) { xvmc_frame_t *frame = (xvmc_frame_t *) vo_img ; xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver; - lprintf ("video_out_xvmc: xvmc_frame_dispose\n"); + lprintf ("xvmc_frame_dispose\n"); /* * TODO - clean up of images/surfaces and frames @@ -505,12 +507,12 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image; xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image; - lprintf ("video_out_xvmc: xvmc_render_macro_blocks\n"); - lprintf (" slices %d 0x%08lx 0x%08lx 0x%08lx\n", + lprintf ("xvmc_render_macro_blocks\n"); + lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n", macroblocks->slices, (long) current_frame, (long) backward_frame, (long) forward_frame); - /* lprintf (" slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, + /* lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",macroblocks->slices, (long) current_frame->surface, (long) backward_frame->surface, (long) forward_frame->surface); */ @@ -559,14 +561,14 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image, /* XvMCFlushSurface(this->display, ¤t_frame->surface); */ - lprintf ("video_out_xvmc: xvmc_render_macro_blocks done\n"); + lprintf ("xvmc_render_macro_blocks done\n"); } static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) { xvmc_frame_t *frame; xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_alloc_frame\n"); + lprintf ("xvmc_alloc_frame\n"); frame = (xvmc_frame_t *) malloc (sizeof (xvmc_frame_t)); @@ -604,7 +606,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, int slices = 1; xvmc_macroblocks_t *macroblocks = (xvmc_macroblocks_t *) macro_blocks; - lprintf ("video_out_xvmc: xvmc_set_context %dx%d %04x\n",width,height,format); + lprintf ("xvmc_set_context %dx%d %04x\n",width,height,format); /* initialize block & macro block pointers first time */ if(macroblocks->blocks == NULL || macroblocks->macro_blocks == NULL) { @@ -613,7 +615,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, memset (macroblocks->blocks, 0, sizeof(XvMCBlockArray)); memset (macroblocks->macro_blocks, 0, sizeof(XvMCMacroBlockArray)); - lprintf(" macroblocks->blocks %lx ->macro_blocks %lx\n", + lprintf("macroblocks->blocks %lx ->macro_blocks %lx\n", macroblocks->blocks,macroblocks->macro_blocks); } @@ -624,7 +626,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, (flags == this->surface_flags)) { /* don't need to change context */ - lprintf ("video_out_xvmc: didn't change context\n"); + lprintf ("didn't change context\n"); return(&this->context_id); @@ -636,7 +638,7 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this, * flush any drawing and wait till we are done with the old stuff * blow away the old stuff */ - lprintf ("video_out_xvmc: freeing previous context\n"); + lprintf ("freeing previous context\n"); XvMCDestroyBlocks(this->display, macroblocks->blocks); XvMCDestroyMacroBlocks(this->display, macroblocks->macro_blocks); @@ -721,7 +723,7 @@ static XvImage *create_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, unsigned int xvmc_format; XvImage *image = NULL; - lprintf ("video_out_xvmc: create_ximage\n"); + lprintf ("create_ximage\n"); switch (format) { case XINE_IMGFMT_YV12: @@ -768,7 +770,7 @@ static void dispose_ximage (xvmc_driver_t *this, XShmSegmentInfo *shminfo, XvImage *myimage) { - lprintf ("video_out_xvmc: dispose_ximage\n"); + lprintf ("dispose_ximage\n"); XFree(myimage); } @@ -779,13 +781,13 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, xvmc_driver_t *this = (xvmc_driver_t *) this_gen; xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; - lprintf ("video_out_xvmc: xvmc_update_frame_format\n"); + lprintf ("xvmc_update_frame_format\n"); if ((frame->width != width) || (frame->height != height) || (frame->format != format)) { - lprintf ("video_out_xvmc: updating frame to %d x %d (ratio=%f, format=%08x)\n", + lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n", width, height, ratio, format); XLockDisplay (this->display); @@ -828,7 +830,7 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen, } static void xvmc_clean_output_area (xvmc_driver_t *this) { - lprintf ("video_out_xvmc: xvmc_clean_output_area\n"); + lprintf ("xvmc_clean_output_area\n"); XLockDisplay (this->display); XSetForeground (this->display, this->gc, this->black.pixel); @@ -866,7 +868,7 @@ static void xvmc_overlay_blend (vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay) { xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; - lprintf ("video_out_xvmc: xvmc_overlay_blend\n"); + lprintf ("xvmc_overlay_blend\n"); /* Alpha Blend here * As XV drivers improve to support Hardware overlay, we will change this function. @@ -885,7 +887,7 @@ static void xvmc_overlay_blend (vo_driver_t *this_gen, static void xvmc_add_recent_frame (xvmc_driver_t *this, xvmc_frame_t *frame) { int i; - lprintf ("video_out_xvmc: xvmc_add_recent_frame\n"); + lprintf ("xvmc_add_recent_frame\n"); i = VO_NUM_RECENT_FRAMES-1; if( this->recent_frames[i] ) @@ -903,7 +905,7 @@ static void xvmc_add_recent_frame (xvmc_driver_t *this, xvmc_frame_t *frame) { static void xvmc_flush_recent_frames (xvmc_driver_t *this) { int i; - lprintf ("video_out_xvmc: xvmc_flush_recent_frames\n"); + lprintf ("xvmc_flush_recent_frames\n"); for( i=0; i < VO_NUM_RECENT_FRAMES; i++ ) { if( this->recent_frames[i] ) @@ -943,7 +945,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen; int status; - lprintf ("video_out_xvmc: xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); + lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen); /* * queue frames (deinterlacing) @@ -962,7 +964,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { - lprintf("video_out_xvmc: frame format changed\n"); + lprintf("frame format changed\n"); /* this->delivered_width = frame->width; @@ -1021,7 +1023,7 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) { static int xvmc_get_property (vo_driver_t *this_gen, int property) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_property\n"); + lprintf ("xvmc_get_property\n"); switch (property) { case VO_PROP_WINDOW_WIDTH: @@ -1039,7 +1041,7 @@ static void xvmc_property_callback (void *property_gen, xine_cfg_entry_t *entry) xvmc_property_t *property = (xvmc_property_t *) property_gen; xvmc_driver_t *this = property->this; - lprintf ("video_out_xvmc: xvmc_property_callback\n"); + lprintf ("xvmc_property_callback\n"); XLockDisplay(this->display); XvSetPortAttribute (this->display, this->xv_port, @@ -1051,7 +1053,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, int property, int value) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_set_property %d value %d\n",property,value); + lprintf ("xvmc_set_property %d value %d\n",property,value); if (this->props[property].atom != None) { /* value is out of bound */ @@ -1075,7 +1077,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, switch (property) { case VO_PROP_INTERLACED: this->props[property].value = value; - lprintf("video_out_xvmc: VO_PROP_INTERLACED(%d)\n", this->props[property].value); + lprintf("VO_PROP_INTERLACED(%d)\n", this->props[property].value); this->deinterlace_enabled = value; if (this->deinterlace_method == DEINTERLACE_ONEFIELDXV) { @@ -1088,7 +1090,7 @@ static int xvmc_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->props[property].value = value; - lprintf("video_out_xvmc: VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); + lprintf("VO_PROP_ASPECT_RATIO(%d)\n", this->props[property].value); xvmc_compute_ideal_size (this); xvmc_compute_output_size (this); @@ -1129,7 +1131,7 @@ static void xvmc_get_property_min_max (vo_driver_t *this_gen, int property, int *min, int *max) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_get_property_min_max\n"); + lprintf ("xvmc_get_property_min_max\n"); *min = this->props[property].min; *max = this->props[property].max; @@ -1139,14 +1141,14 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen, int data_type, void *data) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_gui_data_exchange\n"); + lprintf ("xvmc_gui_data_exchange\n"); switch (data_type) { case XINE_GUI_SEND_EXPOSE_EVENT: { /* XExposeEvent * xev = (XExposeEvent *) data; */ /* FIXME : take care of completion events */ - lprintf ("video_out_xvmc: XINE_GUI_SEND_EXPOSE_EVENT\n"); + lprintf ("XINE_GUI_SEND_EXPOSE_EVENT\n"); if (this->cur_frame) { int i; @@ -1234,7 +1236,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; int i; - lprintf ("video_out_xvmc: xvmc_dispose\n"); + lprintf ("xvmc_dispose\n"); if (this->deinterlace_frame.image) { /* dispose_ximage should be xlocked */ @@ -1260,7 +1262,7 @@ static void xvmc_dispose (vo_driver_t *this_gen) { XLockDisplay (this->display); if(XvUngrabPort (this->display, this->xv_port, CurrentTime) != Success) { - lprintf ("video_out_xvmc: xvmc_dispose: XvUngrabPort() failed.\n"); + lprintf ("xvmc_dispose: XvUngrabPort() failed.\n"); } XUnlockDisplay (this->display); @@ -1331,7 +1333,7 @@ static void xvmc_check_capability (xvmc_driver_t *this, static void xvmc_update_deinterlace(void *this_gen, xine_cfg_entry_t *entry) { xvmc_driver_t *this = (xvmc_driver_t *) this_gen; - lprintf ("video_out_xvmc: xvmc_update_deinterlace method = %d\n",entry->num_value); + lprintf ("xvmc_update_deinterlace method = %d\n",entry->num_value); this->deinterlace_method = entry->num_value; } @@ -1349,7 +1351,7 @@ static void xvmc_update_XV_DOUBLE_BUFFER(void *this_gen, xine_cfg_entry_t *entry XvSetPortAttribute (this->display, this->xv_port, atom, xvmc_double_buffer); XUnlockDisplay(this->display); - lprintf("video_out_xvmc: double buffering mode = %d\n",xvmc_double_buffer); + lprintf("double buffering mode = %d\n",xvmc_double_buffer); } static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { @@ -1366,7 +1368,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi XColor dummy; /* XvImage *myimage; */ - lprintf ("video_out_xvmc: open_plugin\n"); + lprintf ("open_plugin\n"); display = visual->display; @@ -1518,19 +1520,19 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->xvmc_format_yuy2 = 0; for(i = 0; i < formats; i++) { - lprintf ("video_out_xvmc: XvMC image format: 0x%x (%4.4s) %s\n", + lprintf ("XvMC image format: 0x%x (%4.4s) %s\n", fo[i].id, (char*)&fo[i].id, (fo[i].format == XvPacked) ? "packed" : "planar"); if (fo[i].id == XINE_IMGFMT_YV12) { this->xvmc_format_yv12 = fo[i].id; this->capabilities |= VO_CAP_YV12; - lprintf("video_out_xvmc: this adaptor supports the yv12 format.\n"); + lprintf("this adaptor supports the yv12 format.\n"); } else if (fo[i].id == XINE_IMGFMT_YUY2) { this->xvmc_format_yuy2 = fo[i].id; this->capabilities |= VO_CAP_YUY2; - lprintf("video_out_xvmc: this adaptor supports the yuy2 format.\n"); + lprintf("this adaptor supports the yuy2 format.\n"); } } @@ -1552,7 +1554,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi NULL, 10, xvmc_update_deinterlace, this); this->deinterlace_enabled = 1; /* default is enabled */ - lprintf("video_out_xvmc: deinterlace_methods %d ",this->deinterlace_method); + lprintf("deinterlace_methods %d ",this->deinterlace_method); switch(this->deinterlace_method) { case DEINTERLACE_NONE: @@ -1578,7 +1580,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi break; } - lprintf("video_out_xvmc: initialization of plugin successful\n"); + lprintf("initialization of plugin successful\n"); return &this->vo_driver; } @@ -1627,7 +1629,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { /* * check for Xv and XvMC video support */ - lprintf ("video_out_xvmc: XvMC init_class\n"); + lprintf ("XvMC init_class\n"); XLockDisplay(display); if (Success != XvQueryExtension(display, &ver, &rel, &req, &ev, &err)) { @@ -1684,13 +1686,13 @@ static void *init_class (xine_t *xine, void *visual_gen) { } if(!xv_port) { /* try for just XVMC_MOCOMP */ - lprintf ("video_out_xvmc: didn't find XVMC_IDCT acceleration trying for MC\n"); + lprintf ("didn't find XVMC_IDCT acceleration trying for MC\n"); for(surface_num = 0; surface_num < types; surface_num++) { if((surfaceInfo[surface_num].chroma_format == XVMC_CHROMA_FORMAT_420) && ((surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)))) { - lprintf ("video_out_xvmc: Found XVMC_MOCOMP\n"); + lprintf ("Found XVMC_MOCOMP\n"); max_width = surfaceInfo[surface_num].max_width; max_height = surfaceInfo[surface_num].max_height; @@ -1710,7 +1712,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { } } if(xv_port) { - lprintf ("video_out_xvmc: port %ld surface %d\n",xv_port,j); + lprintf ("port %ld surface %d\n",xv_port,j); if(surfaceInfo[j].flags & XVMC_OVERLAID_SURFACE) useOverlay = 1; @@ -1782,7 +1784,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->max_surface_height = max_height; this->acceleration = IDCTaccel; - lprintf("video_out_xvmc: init_class done\n"); + lprintf("init_class done\n"); return this; } diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index ac7a55b2b..174d1414e 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -23,7 +23,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: yuv2rgb.c,v 1.45 2003/10/20 00:33:29 komadori Exp $ + * $Id: yuv2rgb.c,v 1.46 2003/11/26 19:43:38 f1rmb Exp $ */ #include "config.h" @@ -34,12 +34,15 @@ #include #include "yuv2rgb.h" -#include "xineutils.h" +#define LOG_MODULE "yuv2rgb" +#define LOG_VERBOSE /* -#define LOG +#define LOG */ +#include "xineutils.h" + static int prof_scale_line = -1; static scale_line_func_t find_scale_line_func(int step); @@ -3212,9 +3215,8 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, } #endif if (this->yuv2rgb_fun == NULL) { -#ifdef LOG - printf ("yuv2rgb: no accelerated colorspace conversion found\n"); -#endif + lprintf ("no accelerated colorspace conversion found\n"); + yuv2rgb_c_init (this); } diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 58db274df..480a6e205 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.114 2003/11/22 11:58:05 f1rmb Exp $ + * $Id: audio_decoder.c,v 1.115 2003/11/26 19:43:38 f1rmb Exp $ * * * functions that implement audio decoding @@ -35,13 +35,15 @@ #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" -#include "xineutils.h" - +#define LOG_MODULE "audio_decoder" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "xineutils.h" + static void *audio_decoder_loop (void *stream_gen) { buf_element_t *buf; @@ -55,17 +57,11 @@ static void *audio_decoder_loop (void *stream_gen) { while (running) { -#ifdef LOG - printf ("audio_loop: waiting for package...\n"); -#endif + lprintf ("audio_loop: waiting for package...\n"); buf = stream->audio_fifo->get (stream->audio_fifo); - -#ifdef LOG - printf ("audio_loop: got package pts = %lld, type = %08x\n", - buf->pts, buf->type); -#endif + lprintf ("audio_loop: got package pts = %lld, type = %08x\n", buf->pts, buf->type); _x_extra_info_merge( stream->audio_decoder_extra_info, buf->extra_info ); stream->audio_decoder_extra_info->seek_count = stream->video_seek_count; @@ -99,15 +95,11 @@ static void *audio_decoder_loop (void *stream_gen) { case BUF_CONTROL_START: -#ifdef LOG - printf ("audio_decoder: start\n"); -#endif + lprintf ("start\n"); if (stream->audio_decoder_plugin) { -#ifdef LOG - printf ("audio_decoder: close old decoder\n"); -#endif + lprintf ("close old decoder\n"); _x_free_audio_decoder (stream, stream->audio_decoder_plugin); stream->audio_decoder_plugin = NULL; @@ -127,10 +119,7 @@ static void *audio_decoder_loop (void *stream_gen) { stream->finished_count_audio++; -#ifdef LOG - printf ("audio_decoder: reached end marker # %d\n", - stream->finished_count_audio); -#endif + lprintf ("reached end marker # %d\n", stream->finished_count_audio); pthread_cond_broadcast (&stream->counter_changed); @@ -169,9 +158,8 @@ static void *audio_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_RESET_DECODER: -#ifdef LOG - printf ("audio_decoder: reset\n"); -#endif + lprintf ("reset\n"); + _x_extra_info_reset( stream->audio_decoder_extra_info ); if (stream->audio_decoder_plugin) stream->audio_decoder_plugin->reset (stream->audio_decoder_plugin); @@ -245,11 +233,9 @@ static void *audio_decoder_loop (void *stream_gen) { /* find out which audio type to decode */ -#ifdef LOG - printf ("audio_decoder: audio_channel_user = %d, map[0]=%08x\n", - stream->audio_channel_user, - stream->audio_track_map[0]); -#endif + lprintf ("audio_channel_user = %d, map[0]=%08x\n", + stream->audio_channel_user, + stream->audio_track_map[0]); if (stream->audio_channel_user > -2) { @@ -257,10 +243,7 @@ static void *audio_decoder_loop (void *stream_gen) { /* auto */ -#ifdef LOG - printf ("audio_decoder: audio_channel_auto = %d\n", - stream->audio_channel_auto); -#endif + lprintf ("audio_channel_auto = %d\n", stream->audio_channel_auto); if (stream->audio_channel_auto>=0) { diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 62140b326..05b9f7fd3 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.152 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: audio_out.c,v 1.153 2003/11/26 19:43:38 f1rmb Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -80,11 +80,12 @@ #define XINE_ENABLE_EXPERIMENTAL_FEATURES #define XINE_ENGINE_INTERNAL -/********** logging **********/ #define LOG_MODULE "audio_out" -/* #define LOG_VERBOSE */ +#define LOG_VERBOSE +/* +#define LOG +*/ -/* #define LOG */ #define LOG_RESAMPLE_SYNC 0 #include "xine_internal.h" diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index b171fd751..823e9cab9 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: configfile.c,v 1.56 2003/11/16 23:33:48 f1rmb Exp $ + * $Id: configfile.c,v 1.57 2003/11/26 19:43:38 f1rmb Exp $ * * config object (was: file) management - implementation * @@ -34,13 +34,15 @@ #include #include #include "configfile.h" -#include "xineutils.h" -#include "xine_internal.h" -/* +#define LOG_MODULE "configfile" +#define LOG_VERBOSE +/* #define LOG */ +#include "xineutils.h" +#include "xine_internal.h" static int config_section_enum(const char *sect) { static char *known_section[] = { @@ -159,7 +161,7 @@ static cfg_entry_t *__config_add (config_values_t *this, const char *key, int ex config_insert(this, entry); - lprintf ("configfile: add entry key=%s\n", key); + lprintf ("add entry key=%s\n", key); return entry; } @@ -204,7 +206,7 @@ static char *__config_register_string (config_values_t *this, XINE_ASSERT(key, "Register key is NULL. This is a required argument."); XINE_ASSERT(def_value, "Default value is NULL. This is a required argument."); - lprintf ("configfile: registering %s\n", key); + lprintf ("registering %s\n", key); /* make sure this entry exists, create it if not */ pthread_mutex_lock(&this->config_lock); @@ -266,7 +268,7 @@ static int __config_register_num (config_values_t *this, cfg_entry_t *entry, *prev; XINE_ASSERT(key, "Register key is NULL. This is a required argument."); - lprintf ("configfile: registering %s\n", key); + lprintf ("registering %s\n", key); /* make sure this entry exists, create it if not */ pthread_mutex_lock(&this->config_lock); @@ -331,7 +333,7 @@ static int __config_register_bool (config_values_t *this, cfg_entry_t *entry, *prev; XINE_ASSERT(key, "Register key is NULL. This is a required argument."); - lprintf ("configfile: registering %s\n", key); + lprintf ("registering %s\n", key); /* make sure this entry exists, create it if not */ pthread_mutex_lock(&this->config_lock); @@ -397,7 +399,7 @@ static int __config_register_range (config_values_t *this, cfg_entry_t *entry, *prev; XINE_ASSERT(key, "Register key is NULL. This is a required argument."); - lprintf ("configfile: registering range %s\n", key); + lprintf ("registering range %s\n", key); /* make sure this entry exists, create it if not */ pthread_mutex_lock(&this->config_lock); @@ -462,7 +464,7 @@ static int __config_parse_enum (const char *str, char **values) { while (*value) { - lprintf ("configfile: parse enum, >%s< ?= >%s<\n", *value, str); + lprintf ("parse enum, >%s< ?= >%s<\n", *value, str); if (!strcmp (*value, str)) return i; @@ -471,7 +473,7 @@ static int __config_parse_enum (const char *str, char **values) { i++; } - lprintf ("configfile: warning, >%s< is not a valid enum here, using 0\n", str); + lprintf ("warning, >%s< is not a valid enum here, using 0\n", str); return 0; } @@ -490,7 +492,7 @@ static int __config_register_enum (config_values_t *this, XINE_ASSERT(key, "Register key is NULL. This is a required argument."); XINE_ASSERT(values, "Argument 'values' is NULL. This is a required argument."); - lprintf ("configfile: registering enum %s\n", key); + lprintf ("registering enum %s\n", key); /* make sure this entry exists, create it if not */ pthread_mutex_lock(&this->config_lock); @@ -570,11 +572,11 @@ static void __config_update_num (config_values_t *this, entry = this->lookup_entry (this, key); - lprintf ("configfile: updating %s to %d\n", key, value); + lprintf ("updating %s to %d\n", key, value); if (!entry) { - lprintf ("configfile: WARNING! tried to update unknown key %s (to %d)\n", key, value); + lprintf ("WARNING! tried to update unknown key %s (to %d)\n", key, value); return; @@ -607,7 +609,7 @@ static void __config_update_string (config_values_t *this, cfg_entry_t *entry; char *str_free = NULL; - lprintf ("configfile: updating %s to %s\n", key, value); + lprintf ("updating %s to %s\n", key, value); entry = this->lookup_entry (this, key); @@ -651,7 +653,7 @@ void xine_config_load (xine_t *xine, const char *filename) { config_values_t *this = xine->config; FILE *f_config; - lprintf ("configfile: reading from file '%s'\n", filename); + lprintf ("reading from file '%s'\n", filename); f_config = fopen (filename, "r"); @@ -731,7 +733,7 @@ void xine_config_save (xine_t *xine, const char *filename) { if (stat(temp, &backup_stat) != 0) { char line[1024]; - lprintf("configfile: backing up configfile to %s\n", temp); + lprintf("backing up configfile to %s\n", temp); f_backup = fopen(temp, "w"); f_config = fopen(filename, "r"); @@ -766,7 +768,7 @@ void xine_config_save (xine_t *xine, const char *filename) { return; } - lprintf ("configfile: writing config file to %s\n", filename); + lprintf ("writing config file to %s\n", filename); f_config = fopen(filename, "w"); @@ -784,7 +786,7 @@ void xine_config_save (xine_t *xine, const char *filename) { while (entry) { - lprintf ("configfile: saving key '%s'\n", entry->key); + lprintf ("saving key '%s'\n", entry->key); if (entry->description) fprintf (f_config, "# %s\n", entry->description); @@ -878,7 +880,7 @@ static void __config_dispose (config_values_t *this) { pthread_mutex_lock(&this->config_lock); entry = this->first; - lprintf ("configfile: dispose\n"); + lprintf ("dispose\n"); while (entry) { last = entry; @@ -958,7 +960,7 @@ int _x_config_change_opt(config_values_t *config, const char *opt) { cfg_entry_t *entry; int handled = 0; - lprintf ("configfile: change_opt '%s'\n", opt); + lprintf ("change_opt '%s'\n", opt); if(config && opt) { char *key, *value; diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index f17ef910c..e49a93fba 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -20,7 +20,7 @@ * Demuxer helper functions * hide some xine engine details from demuxers and reduce code duplication * - * $Id: demux.c,v 1.41 2003/11/20 00:42:14 tmattern Exp $ + * $Id: demux.c,v 1.42 2003/11/26 19:43:38 f1rmb Exp $ */ @@ -35,6 +35,12 @@ #define XINE_ENGINE_INTERNAL +#define LOG_MODULE "demux" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "demuxers/demux.h" #include "buffer.h" @@ -48,10 +54,6 @@ #endif #define MIN(a,b) ( (a) < (b) ) ? (a) : (b) -/* -#define LOG -*/ - /* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and @@ -150,20 +152,20 @@ void _x_demux_control_headers_done (xine_stream_t *stream) { (stream->header_count_videoheader_count_video, header_count_video, - stream->header_count_audio, header_count_audio); -#endif + + lprintf ("waiting for headers. v:%d %d a:%d %d\n", + stream->header_count_video, header_count_video, + stream->header_count_audio, header_count_audio); + gettimeofday(&tv, NULL); ts.tv_sec = tv.tv_sec + 1; ts.tv_nsec = tv.tv_usec * 1000; /* use timedwait to workaround buggy pthread broadcast implementations */ pthread_cond_timedwait (&stream->counter_changed, &stream->counter_lock, &ts); } -#ifdef LOG - printf ("xine: headers processed.\n"); -#endif + + lprintf ("headers processed.\n"); + pthread_mutex_unlock (&stream->counter_lock); } @@ -215,9 +217,7 @@ static void *demux_loop (void *stream_gen) { xine_stream_t *stream = (xine_stream_t *)stream_gen; int status; -#ifdef LOG - printf ("demux: loop starting...\n"); -#endif + lprintf ("loop starting...\n"); pthread_mutex_lock( &stream->demux_lock ); @@ -233,17 +233,15 @@ static void *demux_loop (void *stream_gen) { /* someone may want to interrupt us */ if( stream->demux_action_pending ) { pthread_mutex_unlock( &stream->demux_lock ); -#ifdef LOG - printf ("demux: sched_yield\n"); -#endif + + lprintf ("sched_yield\n"); + sched_yield(); pthread_mutex_lock( &stream->demux_lock ); } } -#ifdef LOG - printf ("demux: main demuxer loop finished (status: %d)\n", status); -#endif + lprintf ("main demuxer loop finished (status: %d)\n", status); /* tell to the net_buf_ctrl that we are at the end of the stream * then the net_buf_ctrl will not pause @@ -263,9 +261,7 @@ static void *demux_loop (void *stream_gen) { } while( status == DEMUX_OK && stream->demux_thread_running ); -#ifdef LOG - printf ("demux: loop finished (status: %d)\n", status); -#endif + lprintf ("loop finished (status: %d)\n", status); /* demux_thread_running is zero if demux loop has being stopped by user */ if (stream->demux_thread_running) { @@ -274,9 +270,8 @@ static void *demux_loop (void *stream_gen) { _x_demux_control_end(stream, BUF_FLAG_END_USER); } -#ifdef LOG - printf ("demux: loop finished, end buffer sent\n"); -#endif + lprintf ("loop finished, end buffer sent\n"); + stream->demux_thread_running = 0; pthread_mutex_unlock( &stream->demux_lock ); @@ -288,9 +283,7 @@ int _x_demux_start_thread (xine_stream_t *stream) { int err; -#ifdef LOG - printf ("demux: start thread called\n"); -#endif + lprintf ("start thread called\n"); stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); @@ -315,9 +308,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) { void *p; -#ifdef LOG - printf ("demux: stop thread called\n"); -#endif + lprintf ("stop thread called\n"); stream->demux_action_pending = 1; pthread_mutex_lock( &stream->demux_lock ); @@ -325,9 +316,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) { stream->demux_action_pending = 0; pthread_mutex_unlock( &stream->demux_lock ); -#ifdef LOG - printf ("demux: joining thread %ld\n", stream->demux_thread ); -#endif + lprintf ("joining thread %ld\n", stream->demux_thread ); /* FIXME: counter_lock isn't meant to protect demux_thread update. however we can't use demux_lock here. should we create a new lock? */ diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index cefe5e4cb..b5525d384 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -29,7 +29,7 @@ * - it's possible speeder saving streams in the xine without playing: * xine stream_mrl#save:file.raw\;noaudio\;novideo * - * $Id: input_rip.c,v 1.17 2003/11/24 22:52:15 valtri Exp $ + * $Id: input_rip.c,v 1.18 2003/11/26 19:43:38 f1rmb Exp $ */ /* TODO: @@ -49,9 +49,12 @@ #include #include -/* logging */ -/*#define LOG 1*/ #define LOG_MODULE "input_rip" +#define LOG_VERBOSE +/* +#define LOG +*/ + #define CLR_FAIL "\e[1;31m" #define CLR_RST "\e[0;39m" diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 2844faaee..15e614f4d 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: load_plugins.c,v 1.164 2003/11/26 19:32:27 mroi Exp $ + * $Id: load_plugins.c,v 1.165 2003/11/26 19:43:38 f1rmb Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -42,7 +42,9 @@ #define LOG_MODULE "load_plugins" #define LOG_VERBOSE -/* #define LOG */ +/* +#define LOG +*/ #define XINE_ENABLE_EXPERIMENTAL_FEATURES 1 #include "xine_internal.h" @@ -127,7 +129,7 @@ static void map_decoders (xine_t *this) { plugin_node_t *node; int i, pos; - lprintf ("load_plugins: map_decoders\n"); + lprintf ("map_decoders\n"); /* clean up */ @@ -147,7 +149,7 @@ static void map_decoders (xine_t *this) { int *type = ((decoder_info_t *)node->info->special_info)->supported_types; int priority = get_decoder_priority(this, node); - lprintf ("load_plugins: mapping decoder %s\n", node->info->id); + lprintf ("mapping decoder %s\n", node->info->id); while (type && (*type)) { @@ -168,7 +170,7 @@ static void map_decoders (xine_t *this) { /* insert new decoder */ catalog->audio_decoder_map[streamtype][pos] = node; - lprintf("load_plugins: decoder inserted in decoder map at %d\n", pos); + lprintf("decoder inserted in decoder map at %d\n", pos); type++; } @@ -186,7 +188,7 @@ static void map_decoders (xine_t *this) { int *type = ((decoder_info_t *)node->info->special_info)->supported_types; int priority = get_decoder_priority(this, node); - lprintf ("load_plugins: mapping decoder %s\n", node->info->id); + lprintf ("mapping decoder %s\n", node->info->id); while (type && (*type)) { @@ -206,7 +208,7 @@ static void map_decoders (xine_t *this) { /* insert new decoder */ catalog->video_decoder_map[streamtype][pos] = node; - lprintf("load_plugins: decoder inserted in decoder map at %d\n", pos); + lprintf("decoder inserted in decoder map at %d\n", pos); type++; } @@ -224,7 +226,7 @@ static void map_decoders (xine_t *this) { int *type = ((decoder_info_t *)node->info->special_info)->supported_types; int priority = get_decoder_priority(this, node); - lprintf ("load_plugins: mapping decoder %s\n", node->info->id); + lprintf ("mapping decoder %s\n", node->info->id); while (type && (*type)) { @@ -245,7 +247,7 @@ static void map_decoders (xine_t *this) { /* insert new decoder */ catalog->spu_decoder_map[streamtype][pos] = node; - lprintf("load_plugins: decoder inserted in decoder map at %d\n", pos); + lprintf("decoder inserted in decoder map at %d\n", pos); type++; } @@ -412,7 +414,7 @@ static void collect_plugins(xine_t *this, char *path){ DIR *dir; - lprintf ("load_plugins: collect_plugins in %s\n", path); + lprintf ("collect_plugins in %s\n", path); dir = opendir(path); if (dir) { @@ -632,7 +634,7 @@ static void _load_required_plugins(xine_t *this, xine_list_t *list) { if( load && !node->plugin_class ) { - lprintf("load_plugins: preload plugin %s from %s\n", node->info->id, node->filename); + lprintf("preload plugin %s from %s\n", node->info->id, node->filename); node->plugin_class = _load_plugin_class (this, node->filename, node->info, NULL); @@ -941,7 +943,7 @@ void _x_scan_plugins (xine_t *this) { int i,j; int lenpluginpath; - lprintf("load_plugins: _x_scan_plugins()\n"); + lprintf("_x_scan_plugins()\n"); /* TODO - This needs to be fixed for WIN32 */ #ifndef WIN32 @@ -1156,7 +1158,7 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha while (node) { - lprintf ("load_plugins: probing demux '%s'\n", node->info->id); + lprintf ("probing demux '%s'\n", node->info->id); if (strcasecmp(node->info->id, last_demux_name) == 0) { last_demux = node; @@ -1355,7 +1357,7 @@ xine_video_port_t *xine_open_video_driver (xine_t *this, pthread_mutex_unlock (&catalog->lock); if (!driver) { - lprintf ("load_plugins: failed to load video output plugin <%s>\n", id); + lprintf ("failed to load video output plugin <%s>\n", id); return NULL; } @@ -1392,7 +1394,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { pthread_mutex_unlock (&catalog->lock); if (!driver) { - lprintf ("load_plugins: failed to load video output plugin <%s>\n", id); + lprintf ("failed to load video output plugin <%s>\n", id); return NULL; } @@ -1434,7 +1436,7 @@ static ao_driver_t *_load_audio_driver (xine_t *this, plugin_node_t *node, node->plugin_class = _load_plugin_class (this, node->filename, node->info, data); if (!node->plugin_class) { - lprintf ("load_plugins: failed to load plugin class %s\n", node->info->id); + lprintf ("failed to load plugin class %s\n", node->info->id); return NULL; } @@ -1590,7 +1592,7 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ int i, j; plugin_catalog_t *catalog = stream->xine->plugin_catalog; - lprintf ("load_plugins: looking for video decoder for streamtype %02x\n", stream_type); + lprintf ("looking for video decoder for streamtype %02x\n", stream_type); pthread_mutex_lock (&catalog->lock); @@ -1666,7 +1668,7 @@ audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_typ int i, j; plugin_catalog_t *catalog = stream->xine->plugin_catalog; - lprintf ("load_plugins: looking for audio decoder for streamtype %02x\n", stream_type); + lprintf ("looking for audio decoder for streamtype %02x\n", stream_type); pthread_mutex_lock (&catalog->lock); @@ -1739,7 +1741,7 @@ spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) { int i, j; plugin_catalog_t *catalog = stream->xine->plugin_catalog; - lprintf ("load_plugins: looking for spu decoder for streamtype %02x\n", stream_type); + lprintf ("looking for spu decoder for streamtype %02x\n", stream_type); pthread_mutex_lock (&catalog->lock); diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 374f616e0..69a1939d1 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: metronom.c,v 1.129 2003/11/20 00:42:14 tmattern Exp $ + * $Id: metronom.c,v 1.130 2003/11/26 19:43:38 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -34,6 +34,7 @@ #include #define LOG_MODULE "metronom" +#define LOG_VERBOSE /* #define LOG #define LOG_AUDIO diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index dc8383de6..4d04c3f61 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -22,11 +22,6 @@ #define __OSD_C__ -/* -#define LOG_VERBOSE 1 -#define LOG 1 -*/ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -47,6 +42,12 @@ #include #endif +#define LOG_MODULE "osd" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out/alphablend.h" #include "xine-engine/bswap.h" diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 55cd0d281..4a34a0ad2 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: scratch.c,v 1.10 2003/11/11 18:45:01 f1rmb Exp $ + * $Id: scratch.c,v 1.11 2003/11/26 19:43:38 f1rmb Exp $ * * top-level xine functions * @@ -31,21 +31,20 @@ #include #include /* For memset */ -#include "scratch.h" -#include "xineutils.h" - +#define LOG_MODULE "scratch" +#define LOG_VERBOSE /* #define LOG */ +#include "scratch.h" +#include "xineutils.h" + static void scratch_printf (scratch_buffer_t *this, const char *format, va_list argp) { vsnprintf (this->lines[this->cur], 1023, format, argp); -#ifdef LOG - printf ("scratch: printing format %s to line %d\n", - format, this->cur); -#endif + lprintf ("printing format %s to line %d\n", format, this->cur); this->cur = (this->cur + 1) % this->num_lines; } @@ -61,9 +60,7 @@ static const char **scratch_get_content (scratch_buffer_t *this) { this->ordered[i] = this->lines[j]; -#ifdef LOG - printf ("scratch: line %d contains >%s<\n", i , this->lines[j]); -#endif + lprintf ("line %d contains >%s<\n", i , this->lines[j]); } diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index 493716fbc..f4226a7d5 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_decoder.c,v 1.140 2003/11/20 00:42:14 tmattern Exp $ + * $Id: video_decoder.c,v 1.141 2003/11/26 19:43:38 f1rmb Exp $ * */ @@ -31,14 +31,16 @@ #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" -#include "xineutils.h" -#include - +#define LOG_MODULE "video_decoder" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "xineutils.h" +#include + static void update_spu_decoder (xine_stream_t *stream, int type) { int streamtype = (type>>16) & 0xFF; @@ -73,17 +75,13 @@ static void *video_decoder_loop (void *stream_gen) { while (running) { -#ifdef LOG - printf ("video_decoder: getting buffer...\n"); -#endif + lprintf ("getting buffer...\n"); buf = stream->video_fifo->get (stream->video_fifo); _x_extra_info_merge( stream->video_decoder_extra_info, buf->extra_info ); stream->video_decoder_extra_info->seek_count = stream->video_seek_count; -#ifdef LOG - printf ("video_decoder: got buffer 0x%08x\n", buf->type); -#endif + lprintf ("got buffer 0x%08x\n", buf->type); /* check for a new port to use */ if (stream->next_video_port) { @@ -159,10 +157,8 @@ static void *video_decoder_loop (void *stream_gen) { stream->finished_count_video++; -#ifdef LOG - printf ("video_decoder: reached end marker # %d\n", - stream->finished_count_video); -#endif + lprintf ("reached end marker # %d\n", + stream->finished_count_video); pthread_cond_broadcast (&stream->counter_changed); @@ -226,9 +222,8 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_DISCONTINUITY: -#ifdef LOG - printf ("video_decoder: discontinuity ahead\n"); -#endif + lprintf ("discontinuity ahead\n"); + if (stream->video_decoder_plugin) { /* it might be a long time before we get back from a discontinuity, so we better flush * the decoder before */ @@ -241,9 +236,8 @@ static void *video_decoder_loop (void *stream_gen) { break; case BUF_CONTROL_NEWPTS: -#ifdef LOG - printf ("video_decoder: new pts %lld\n", buf->disc_off); -#endif + lprintf ("new pts %lld\n", buf->disc_off); + if (stream->video_decoder_plugin) { /* it might be a long time before we get back from a discontinuity, so we better flush * the decoder before */ @@ -440,28 +434,25 @@ void _x_video_decoder_shutdown (xine_stream_t *stream) { buf_element_t *buf; void *p; -#ifdef LOG - printf ("video_decoder: shutdown...\n"); -#endif + lprintf ("shutdown...\n"); if (stream->video_thread) { /* stream->video_fifo->clear(stream->video_fifo); */ buf = stream->video_fifo->buffer_pool_alloc (stream->video_fifo); -#ifdef LOG - printf ("video_decoder: shutdown...2\n"); -#endif + + lprintf ("shutdown...2\n"); + buf->type = BUF_CONTROL_QUIT; stream->video_fifo->put (stream->video_fifo, buf); -#ifdef LOG - printf ("video_decoder: shutdown...3\n"); -#endif + + lprintf ("shutdown...3\n"); pthread_join (stream->video_thread, &p); -#ifdef LOG - printf ("video_decoder: shutdown...4\n"); -#endif + + lprintf ("shutdown...4\n"); + } stream->video_fifo->dispose (stream->video_fifo); diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 3d051d2ea..18bfa8300 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: video_out.c,v 1.180 2003/11/19 12:05:26 mroi Exp $ + * $Id: video_out.c,v 1.181 2003/11/26 19:43:38 f1rmb Exp $ * * frame allocation / queuing / scheduling / output functions */ @@ -39,15 +39,17 @@ #define XINE_ENABLE_EXPERIMENTAL_FEATURES #define XINE_ENGINE_INTERNAL +#define LOG_MODULE "video_out" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" #include "video_out.h" #include "metronom.h" #include "xineutils.h" -/* -#define LOG -*/ - #define NUM_FRAME_BUFFERS 15 typedef struct { @@ -277,15 +279,11 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, vo_frame_t *img; vos_t *this = (vos_t *) this_gen; -#ifdef LOG - printf ("video_out: get_frame (%d x %d)\n", width, height); -#endif + lprintf ("get_frame (%d x %d)\n", width, height); img = vo_remove_from_img_buf_queue (this->free_img_buf_queue); -#ifdef LOG - printf ("video_out: got a frame -> pthread_mutex_lock (&img->mutex)\n"); -#endif + lprintf ("got a frame -> pthread_mutex_lock (&img->mutex)\n"); /* some decoders report strange ratios */ if (ratio <= 0.0) @@ -313,9 +311,7 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen, pthread_mutex_unlock (&img->mutex); -#ifdef LOG - printf ("video_out: get_frame (%d x %d) done\n", width, height); -#endif + lprintf ("get_frame (%d x %d) done\n", width, height); return img; } @@ -346,10 +342,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { cur_vpts = this->clock->get_current_time(this->clock); this->last_delivery_pts = cur_vpts; -#ifdef LOG - printf ("video_out: got image at master vpts %lld. vpts for picture is %lld (pts was %lld)\n", - cur_vpts, pic_vpts, img->pts); -#endif + lprintf ("got image at master vpts %lld. vpts for picture is %lld (pts was %lld)\n", + cur_vpts, pic_vpts, img->pts); this->num_frames_delivered++; @@ -382,18 +376,15 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { frames_to_skip = 0; if (this->discard_frames) { -#ifdef LOG - printf ("video_out: i'm in flush mode, not appending this frame to queue\n"); -#endif + lprintf ("i'm in flush mode, not appending this frame to queue\n"); + return 0; } } -#ifdef LOG - printf ("video_out: delivery diff : %lld, current vpts is %lld, %d frames to skip\n", - diff, cur_vpts, frames_to_skip); -#endif + lprintf ("delivery diff : %lld, current vpts is %lld, %d frames to skip\n", + diff, cur_vpts, frames_to_skip); if (!img->bad_frame) { @@ -405,9 +396,7 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { * put frame into FIFO-Buffer */ -#ifdef LOG - printf ("video_out: frame is ok => appending to display buffer\n"); -#endif + lprintf ("frame is ok => appending to display buffer\n"); /* * check for first frame after seek and mark it @@ -420,9 +409,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { if (stream->first_frame_flag == 2) { stream->first_frame_flag = (this->grab_only)?0:1; img->is_first = 1; -#ifdef LOG - printf ("video_out: get_next_video_frame first_frame_reached\n"); -#endif + + lprintf ("get_next_video_frame first_frame_reached\n"); } pthread_mutex_unlock (&stream->first_frame_lock); } @@ -432,9 +420,8 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { vo_append_to_img_buf_queue (this->display_img_buf_queue, img); } else { -#ifdef LOG - printf ("video_out: bad_frame\n"); -#endif + lprintf ("bad_frame\n"); + if (stream) { pthread_mutex_lock( &stream->current_extra_info_lock ); _x_extra_info_merge( stream->current_extra_info, img->extra_info ); @@ -608,9 +595,8 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { while (img && (diff > img->duration || this->discard_frames)) { if (img->is_first) { -#ifdef LOG - printf("video_out: expire_frames: first_frame !\n"); -#endif + lprintf("expire_frames: first_frame !\n"); + /* * before displaying the first frame without * "metronom prebuffering" we should make sure it's @@ -660,14 +646,12 @@ static void expire_frames (vos_t *this, int64_t cur_vpts) { if (!this->display_img_buf_queue->first) { if (this->img_backup) { -#ifdef LOG - printf("video_out: overwriting frame backup\n"); -#endif + lprintf("overwriting frame backup\n"); + vo_frame_dec_lock( this->img_backup ); } -#ifdef LOG - printf("video_out: possible still frame (old)\n"); -#endif + + lprintf("possible still frame (old)\n"); this->img_backup = img; @@ -702,16 +686,12 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { if (!img) { pthread_mutex_unlock(&this->display_img_buf_queue->mutex); -#ifdef LOG - printf ("video_out: no frame\n"); -#endif + + lprintf ("no frame\n"); if (this->img_backup && (this->redraw_needed==1)) { -#ifdef LOG - printf("video_out: generating still frame (cur_vpts = %lld) \n", - cur_vpts); -#endif + lprintf("generating still frame (cur_vpts = %lld) \n", cur_vpts); /* keep playing still frames */ pthread_mutex_lock( &this->free_img_buf_queue->mutex ); @@ -729,9 +709,8 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { if( this->redraw_needed ) this->redraw_needed--; -#ifdef LOG - printf ("video_out: no frame, but no backup frame\n"); -#endif + + lprintf ("no frame, but no backup frame\n"); return NULL; } @@ -745,9 +724,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { * time to display frame "img" ? */ -#ifdef LOG - printf ("video_out: diff %lld\n", diff); -#endif + lprintf ("diff %lld\n", diff); if (diff < 0) { pthread_mutex_unlock(&this->display_img_buf_queue->mutex); @@ -755,9 +732,8 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { } if (this->img_backup) { -#ifdef LOG - printf("video_out: freeing frame backup\n"); -#endif + lprintf("freeing frame backup\n"); + vo_frame_dec_lock( this->img_backup ); this->img_backup = NULL; } @@ -772,9 +748,8 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts) { _x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) || img->stream->video_fifo->size(img->stream->video_fifo) < 10) { -#ifdef LOG - printf ("video_out: possible still frame\n"); -#endif + lprintf ("possible still frame\n"); + this->img_backup = duplicate_frame (this, img); } } @@ -795,10 +770,7 @@ static void overlay_and_display_frame (vos_t *this, vo_frame_t *img, int64_t vpts) { xine_stream_t *stream; -#ifdef LOG - printf ("video_out: displaying image with vpts = %lld\n", - img->vpts); -#endif + lprintf ("displaying image with vpts = %lld\n", img->vpts); /* no, this is not were proc_*() is usually called. * it's just to catch special cases like late or duplicated frames. @@ -942,9 +914,7 @@ static void *video_out_loop (void *this_gen) { next_frame_vpts = this->clock->get_current_time (this->clock); -#ifdef LOG - printf ("video_out: loop starting...\n"); -#endif + lprintf ("loop starting...\n"); while ( this->video_loop_running ) { @@ -953,9 +923,9 @@ static void *video_out_loop (void *this_gen) { */ vpts = this->clock->get_current_time (this->clock); -#ifdef LOG - printf ("video_out: loop iteration at %lld\n", vpts); -#endif + + lprintf ("loop iteration at %lld\n", vpts); + expire_frames (this, vpts); img = get_next_frame (this, vpts); @@ -964,9 +934,8 @@ static void *video_out_loop (void *this_gen) { */ if (img) { -#ifdef LOG - printf ("video_out: displaying frame (id=%d)\n", img->id); -#endif + lprintf ("displaying frame (id=%d)\n", img->id); + overlay_and_display_frame (this, img, vpts); } else { @@ -990,9 +959,7 @@ static void *video_out_loop (void *this_gen) { if (stream->video_decoder_plugin && stream->video_fifo) { buf_element_t *buf; -#ifdef LOG - printf ("video_out: flushing current video decoder plugin\n"); -#endif + lprintf ("flushing current video decoder plugin\n"); buf = stream->video_fifo->buffer_pool_try_alloc (stream->video_fifo); if( buf ) { @@ -1017,9 +984,7 @@ static void *video_out_loop (void *this_gen) { next_frame_vpts += 1000; } -#ifdef LOG - printf ("video_out: next_frame_vpts is %lld\n", next_frame_vpts); -#endif + lprintf ("next_frame_vpts is %lld\n", next_frame_vpts); do { vpts = this->clock->get_current_time (this->clock); @@ -1029,10 +994,7 @@ static void *video_out_loop (void *this_gen) { usec_to_sleep = (next_frame_vpts - vpts) * 100 / 9; -#ifdef LOG - printf ("video_out: %lld usec to sleep at master vpts %lld\n", - usec_to_sleep, vpts); -#endif + lprintf ("%lld usec to sleep at master vpts %lld\n", usec_to_sleep, vpts); if ( (next_frame_vpts - vpts) > 2*90000 ) printf("video_out: vpts/clock error, next_vpts=%lld cur_vpts=%lld\n", @@ -1096,11 +1058,9 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen, /* FIXME: ugly, use conditions and locks instead */ -#ifdef LOG - printf ("video_out: get_next_video_frame demux status = %d, fifo_size=%d\n", - stream->demux_plugin->get_status (stream->demux_plugin), - stream->video_fifo->fifo_size); -#endif + lprintf ("get_next_video_frame demux status = %d, fifo_size=%d\n", + stream->demux_plugin->get_status (stream->demux_plugin), + stream->video_fifo->fifo_size); while ( !img && (stream->video_fifo->fifo_size || (stream->demux_plugin->get_status (stream->demux_plugin)==DEMUX_OK))) { @@ -1161,9 +1121,8 @@ static void vo_open (xine_video_port_t *this_gen, xine_stream_t *stream) { vos_t *this = (vos_t *) this_gen; -#ifdef LOG - printf("video_out: vo_open\n"); -#endif + lprintf("vo_open\n"); + this->video_opened = 1; this->discard_frames = 0; this->last_delivery_pts = 0; @@ -1266,9 +1225,7 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value while ((img = this->display_img_buf_queue->first)) { -#ifdef LOG - printf ("video_out: flushing out frame\n"); -#endif + lprintf ("flushing out frame\n"); img = vo_remove_from_img_buf_queue_int (this->display_img_buf_queue); @@ -1363,9 +1320,7 @@ static void vo_exit (xine_video_port_t *this_gen) { vos_t *this = (vos_t *) this_gen; -#ifdef LOG - printf ("video_out: vo_exit...\n"); -#endif + lprintf ("vo_exit...\n"); if (this->video_loop_running) { void *p; @@ -1379,9 +1334,7 @@ static void vo_exit (xine_video_port_t *this_gen) { this->driver->dispose (this->driver); -#ifdef LOG - printf ("video_out: vo_exit... done\n"); -#endif + lprintf ("vo_exit... done\n"); if (this->overlay_source) { this->overlay_source->dispose (this->overlay_source); diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index d915382d7..170e3158a 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: vo_scale.c,v 1.26 2003/11/11 18:45:01 f1rmb Exp $ + * $Id: vo_scale.c,v 1.27 2003/11/26 19:43:38 f1rmb Exp $ * * Contains common code to calculate video scaling parameters. * In short, it will map frame dimensions to screen/window size. @@ -28,14 +28,16 @@ #include #include -#include "xine_internal.h" -#include "video_out.h" -#include "vo_scale.h" - +#define LOG_MODULE "vo_scale" +#define LOG_VERBOSE /* #define LOG */ +#include "xine_internal.h" +#include "video_out.h" +#include "vo_scale.h" + /* * convert delivered height/width to ideal width/height * taking into account aspect ratio and zoom factor @@ -175,13 +177,10 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->displayed_xoffset = (this->delivered_width - this->displayed_width) / 2; this->displayed_yoffset = (this->delivered_height - this->displayed_height) / 2; -#ifdef LOG - printf ("vo_scale: frame source %d x %d (%d x %d) => screen output %d x %d\n", - this->delivered_width, this->delivered_height, - this->displayed_width, this->displayed_height, - this->output_width, this->output_height); -#endif - + lprintf ("frame source %d x %d (%d x %d) => screen output %d x %d\n", + this->delivered_width, this->delivered_height, + this->displayed_width, this->displayed_height, + this->output_width, this->output_height); /* calculate borders */ if (this->output_height < this->gui_height) { diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 18972acc7..a8e7d5587 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine.c,v 1.271 2003/11/26 13:33:55 miguelfreitas Exp $ + * $Id: xine.c,v 1.272 2003/11/26 19:43:38 f1rmb Exp $ */ /* @@ -46,10 +46,11 @@ #include #endif -/********** logging **********/ #define LOG_MODULE "xine" #define LOG_VERBOSE -/* #define LOG */ +/* +#define LOG +*/ #define XINE_ENABLE_EXPERIMENTAL_FEATURES #define XINE_ENGINE_INTERNAL diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index d0f328112..33a168aea 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -28,12 +28,14 @@ #include #include -#include "xineutils.h" - +#define LOG_MODULE "cpu_accel" +#define LOG_VERBOSE /* -#define LOG +#define LOG */ +#include "xineutils.h" + #if defined(ARCH_X86) || defined(ARCH_X86_64) #if defined __x86_64__ static uint32_t arch_accel (void) @@ -208,9 +210,7 @@ uint32_t xine_mm_accel (void) old_sigill_handler = signal (SIGILL, sigill_handler); if (setjmp(sigill_return)) { -#ifdef LOG - printf ("cpu_accel: OS doesn't support SSE instructions.\n"); -#endif + lprintf ("OS doesn't support SSE instructions.\n"); accel &= ~(MM_ACCEL_X86_SSE|MM_ACCEL_X86_SSE2); } else { __asm__ volatile ("xorps %xmm0, %xmm0"); diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index f9951a9e3..ca6c4444a 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -43,6 +43,13 @@ #include #include + +#define LOG_MODULE "memcpy" +#define LOG_VERBOSE +/* +#define LOG +*/ + #include "xine_internal.h" void *(* xine_fast_memcpy)(void *to, const void *from, size_t len); @@ -440,9 +447,7 @@ static void update_fast_memcpy(void *this_gen, xine_cfg_entry_t *entry) { if (method != 0 && (config_flags & memcpy_method[method].cpu_require) == memcpy_method[method].cpu_require ) { -#ifdef LOG - printf("xine: using %s\n", memcpy_method[method].name ); -#endif + lprintf("using %s\n", memcpy_method[method].name ); xine_fast_memcpy = memcpy_method[method].function; return; } else { @@ -480,9 +485,7 @@ void xine_probe_fast_memcpy(config_values_t *config) if( best != 0 && (config_flags & memcpy_method[best].cpu_require) == memcpy_method[best].cpu_require ) { -#ifdef LOG - printf("xine: using %s\n", memcpy_method[best].name ); -#endif + lprintf("using %s\n", memcpy_method[best].name ); xine_fast_memcpy = memcpy_method[best].function; return; } diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c index 47d580439..42623895b 100644 --- a/src/xine-utils/xine_buffer.c +++ b/src/xine-utils/xine_buffer.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xine_buffer.c,v 1.4 2003/09/16 02:12:54 storri Exp $ + * $Id: xine_buffer.c,v 1.5 2003/11/26 19:43:38 f1rmb Exp $ * * * generic dynamic buffer functions. The goals @@ -53,9 +53,14 @@ #include #include #include -#include "xineutils.h" +#define LOG_MODULE "xine_buffer" +#define LOG_VERBOSE +/* #define LOG +*/ + +#include "xineutils.h" #define CHECKS @@ -133,9 +138,7 @@ void *_xine_buffer_free(void *buf) { #ifdef CHECKS if (!buf) { -#ifdef LOG - printf("xine_buffer_free: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_free: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -155,9 +158,7 @@ void *xine_buffer_dup(void *buf) { #ifdef CHECKS if (!buf) { -#ifdef LOG - printf("xine_buffer_dup: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_dup: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -180,9 +181,7 @@ void *_xine_buffer_copyin(void *buf, int index, const void *data, int len) { #ifdef CHECKS if (!buf || !data) { -#ifdef LOG - printf("xine_buffer_copyin: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_copyin: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -204,9 +203,7 @@ void xine_buffer_copyout(void *buf, int index, void *data, int len) { #ifdef CHECKS if (!buf || !data) { -#ifdef LOG - printf("xine_buffer_copyout: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_copyout: warning: got NULL pointer\n"); return; } CHECK_MAGIC(buf); @@ -231,9 +228,7 @@ void *_xine_buffer_set(void *buf, int index, uint8_t b, int len) { #ifdef CHECKS if (!buf) { -#ifdef LOG - printf("xine_buffer_set: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_set: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -256,9 +251,7 @@ void *_xine_buffer_strcat(void *buf, char *data) { #ifdef CHECKS if (!buf || !data) { -#ifdef LOG - printf("xine_buffer_strcat: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_strcat: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -280,9 +273,7 @@ void *_xine_buffer_strcpy(void *buf, int index, char *data) { #ifdef CHECKS if (!buf || !data) { -#ifdef LOG - printf("xine_buffer_strcpy: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_strcpy: warning: got NULL pointer\n"); return NULL; } CHECK_MAGIC(buf); @@ -303,9 +294,7 @@ void *_xine_buffer_strcpy(void *buf, int index, char *data) { char *xine_buffer_strchr(void *buf, int ch) { #ifdef CHECKS if (!buf) { -#ifdef LOG - printf("xine_buffer_get_size: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_get_size: warning: got NULL pointer\n"); return 0; } CHECK_MAGIC(buf); @@ -321,9 +310,7 @@ int xine_buffer_get_size(void *buf) { #ifdef CHECKS if (!buf) { -#ifdef LOG - printf("xine_buffer_get_size: warning: got NULL pointer\n"); -#endif + lprintf("xine_buffer_get_size: warning: got NULL pointer\n"); return 0; } CHECK_MAGIC(buf); @@ -342,10 +329,8 @@ int xine_buffer_get_size(void *buf) { void *_xine_buffer_ensure_size(void *buf, int size) { #ifdef CHECKS - if (!buf) { -#ifdef LOG - printf("xine_buffer_ensure_size: warning: got NULL pointer\n"); -#endif + if (!buf) { + lprintf("xine_buffer_ensure_size: warning: got NULL pointer\n"); return 0; } CHECK_MAGIC(buf); @@ -355,5 +340,3 @@ void *_xine_buffer_ensure_size(void *buf, int size) { return buf; } - - diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c index 153a6cf32..e99ac692d 100644 --- a/src/xine-utils/xmllexer.c +++ b/src/xine-utils/xmllexer.c @@ -17,10 +17,17 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xmllexer.c,v 1.3 2003/09/16 02:12:54 storri Exp $ + * $Id: xmllexer.c,v 1.4 2003/11/26 19:43:38 f1rmb Exp $ * */ +#define LOG_MODULE "xmllexer" +#define LOG_VERBOSE +/* +#define LOG +*/ + +#include "xineutils.h" #include "xmllexer.h" #include #include @@ -30,10 +37,6 @@ #define NORMAL 0 /* normal lex mode */ #define DATA 1 /* data lex mode */ -/* -#define LOG -*/ - /* private global variables */ static char * lexbuf; static int lexbuf_size = 0; @@ -47,9 +50,8 @@ void lexer_init(char * buf, int size) { lexbuf_pos = 0; lex_mode = NORMAL; in_comment = 0; -#ifdef LOG - printf("xmllexer: buffer length %d\n", size); -#endif + + lprintf("buffer length %d\n", size); } int lexer_get_token(char * tok, int tok_size) { @@ -60,9 +62,8 @@ int lexer_get_token(char * tok, int tok_size) { if (tok) { while ((tok_pos < tok_size) && (lexbuf_pos < lexbuf_size)) { c = lexbuf[lexbuf_pos]; -#ifdef LOG - printf("xmllexer: c=%c, state=%d, in_comment=%d\n", c, state, in_comment); -#endif + lprintf("c=%c, state=%d, in_comment=%d\n", c, state, in_comment); + if (lex_mode == NORMAL) { /* normal mode */ switch (state) { @@ -108,7 +109,7 @@ int lexer_get_token(char * tok, int tok_size) { tok_pos++; break; - case '\"': + case '\"': /* " */ state = 7; break; @@ -220,7 +221,7 @@ int lexer_get_token(char * tok, int tok_size) { case 7: tok[tok_pos] = c; lexbuf_pos++; - if (c == '\"') { + if (c == '\"') { /* " */ tok[tok_pos] = '\0'; /* FIXME */ return T_STRING; } @@ -320,7 +321,7 @@ int lexer_get_token(char * tok, int tok_size) { case '<': case '>': case '\\': - case '\"': + case '\"': /* " */ case ' ': case '\t': case '=': @@ -362,10 +363,9 @@ int lexer_get_token(char * tok, int tok_size) { } } } -#ifdef LOG - printf ("xmllexer: loop done tok_pos = %d, tok_size=%d, lexbuf_pos=%d, lexbuf_size=%d\n", - tok_pos, tok_size, lexbuf_pos, lexbuf_size); -#endif + lprintf ("loop done tok_pos = %d, tok_size=%d, lexbuf_pos=%d, lexbuf_size=%d\n", + tok_pos, tok_size, lexbuf_pos, lexbuf_size); + /* pb */ if (tok_pos >= tok_size) { printf("xmllexer: token buffer is too little\n"); diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index b3d63a56e..e7a06f65d 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: xmlparser.c,v 1.10 2003/10/28 13:48:45 valtri Exp $ + * $Id: xmlparser.c,v 1.11 2003/11/26 19:43:38 f1rmb Exp $ * */ @@ -28,6 +28,14 @@ #include #include #include + +#define LOG_MODULE "xmlparser" +#define LOG_VERBOSE +/* +#define LOG +*/ + +#include "xineutils.h" #include "xmllexer.h" #include "xmlparser.h" @@ -36,10 +44,6 @@ #define DATA_SIZE 4 * 1024 #define MAX_RECURSION 10 -/* -#define LOG -*/ - /* private global variables */ static int xml_parser_mode; @@ -111,9 +115,8 @@ static void xml_parser_free_props(xml_property_t *current_property) { } static void xml_parser_free_tree_rec(xml_node_t *current_node, int free_next) { -#ifdef LOG - printf("xml_parser: xml_parser_free_tree_rec: %s\n", current_node->name); -#endif + lprintf("xml_parser_free_tree_rec: %s\n", current_node->name); + if (current_node) { /* properties */ if (current_node->props) { @@ -122,9 +125,7 @@ static void xml_parser_free_tree_rec(xml_node_t *current_node, int free_next) { /* child nodes */ if (current_node->child) { -#ifdef LOG - printf("xml_parser: xml_parser_free_tree_rec: child\n"); -#endif + lprintf("xml_parser_free_tree_rec: child\n"); xml_parser_free_tree_rec(current_node->child, 1); } @@ -135,9 +136,7 @@ static void xml_parser_free_tree_rec(xml_node_t *current_node, int free_next) { while (next_node) { next_next_node = next_node->next; -#ifdef LOG - printf("xml_parser: xml_parser_free_tree_rec: next\n"); -#endif + lprintf("xml_parser_free_tree_rec: next\n"); xml_parser_free_tree_rec(next_node, 0); next_node = next_next_node; } @@ -148,9 +147,7 @@ static void xml_parser_free_tree_rec(xml_node_t *current_node, int free_next) { } void xml_parser_free_tree(xml_node_t *current_node) { -#ifdef LOG - printf("xml_parser: xml_parser_free_tree\n"); -#endif + lprintf("xml_parser_free_tree\n"); xml_parser_free_tree_rec(current_node, 1); } @@ -175,9 +172,8 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r while ((bypass_get_token) || (res = lexer_get_token(tok, TOKEN_SIZE)) != T_ERROR) { bypass_get_token = 0; -#ifdef LOG - printf("xmlparser: info: %d - %d : '%s'\n", state, res, tok); -#endif + lprintf("info: %d - %d : '%s'\n", state, res, tok); + switch (state) { case STATE_IDLE: switch (res) { @@ -210,9 +206,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r free(current_node->data); } current_node->data = strdup(tok); -#ifdef LOG - printf("xmlparser: info: node data : %s\n", current_node->data); -#endif + lprintf("info: node data : %s\n", current_node->data); break; default: printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); @@ -233,9 +227,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r } strcpy(node_name, tok); state = 2; -#ifdef LOG - printf("xmlparser: info: current node name \"%s\"\n", node_name); -#endif + lprintf("info: current node name \"%s\"\n", node_name); break; default: printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); @@ -258,9 +250,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r /* set node propertys */ subtree->props = properties; -#ifdef LOG - printf("xmlparser: info: rec %d new subtree %s\n", rec, node_name); -#endif + lprintf("info: rec %d new subtree %s\n", rec, node_name); parse_res = xml_parser_get_node(subtree, node_name, rec + 1); if (parse_res != 0) { return parse_res; @@ -285,9 +275,8 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r /* set node propertys */ subtree->props = properties; -#ifdef LOG - printf("xmlparser: info: rec %d new subtree %s\n", rec, node_name); -#endif + lprintf("info: rec %d new subtree %s\n", rec, node_name); + if (current_subtree == NULL) { current_node->child = subtree; current_subtree = subtree; @@ -304,9 +293,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r } strcpy(property_name, tok); state = 5; -#ifdef LOG - printf("xmlparser: info: current property name \"%s\"\n", property_name); -#endif + lprintf("info: current property name \"%s\"\n", property_name); break; default: printf("xmlparser: error: unexpected token \"%s\", state %d\n", tok, state); @@ -373,9 +360,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r current_property = current_property->next; } current_property->name = strdup (property_name); -#ifdef LOG - printf("xmlparser: info: new property %s\n", current_property->name); -#endif + lprintf("info: new property %s\n", current_property->name); bypass_get_token = 1; /* jump to state 2 without get a new token */ state = 2; break; @@ -405,9 +390,7 @@ static int xml_parser_get_node (xml_node_t *current_node, char *root_name, int r } current_property->name = strdup(property_name); current_property->value = strdup(tok); -#ifdef LOG - printf("xmlparser: info: new property %s=%s\n", current_property->name, current_property->value); -#endif + lprintf("info: new property %s=%s\n", current_property->name, current_property->value); state = 2; break; default: @@ -494,14 +477,10 @@ char *xml_parser_get_property (xml_node_t *node, const char *name) { prop = node->props; while (prop) { -#ifdef LOG - printf ("xmlparser: looking for %s in %s\n", name, prop->name); -#endif + lprintf ("looking for %s in %s\n", name, prop->name); if (!strcasecmp (prop->name, name)) { -#ifdef LOG - printf ("xmlparser: found it. value=%s\n", prop->value); -#endif + lprintf ("found it. value=%s\n", prop->value); return prop->value; } -- cgit v1.2.3