diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-11-26 19:43:26 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2003-11-26 19:43:26 +0000 |
commit | 3050d97eb83cfdfb4d04a51231acba47e6addf1c (patch) | |
tree | 4337d69086ce7d870214e7e5f6a028f8b417521e /src/input | |
parent | ae2a2a8e08ab3140d5c7ee3a5f33e7db81f76b09 (diff) | |
download | xine-lib-3050d97eb83cfdfb4d04a51231acba47e6addf1c.tar.gz xine-lib-3050d97eb83cfdfb4d04a51231acba47e6addf1c.tar.bz2 |
lprintf cleanup, pass I.
CVS patchset: 5796
CVS date: 2003/11/26 19:43:26
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_cdda.c | 445 | ||||
-rw-r--r-- | src/input/input_dvb.c | 36 | ||||
-rw-r--r-- | src/input/input_file.c | 21 | ||||
-rw-r--r-- | src/input/input_http.c | 34 | ||||
-rw-r--r-- | src/input/input_mms.c | 40 | ||||
-rw-r--r-- | src/input/input_net.c | 31 | ||||
-rw-r--r-- | src/input/input_pnm.c | 25 | ||||
-rw-r--r-- | src/input/input_pvr.c | 109 | ||||
-rw-r--r-- | src/input/input_rtp.c | 47 | ||||
-rw-r--r-- | src/input/input_rtsp.c | 34 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 46 | ||||
-rw-r--r-- | src/input/input_v4l.c | 2 | ||||
-rw-r--r-- | src/input/libreal/asmrp.c | 72 | ||||
-rw-r--r-- | src/input/libreal/real.c | 79 | ||||
-rw-r--r-- | src/input/libreal/rmff.c | 54 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 22 | ||||
-rw-r--r-- | src/input/librtsp/rtsp.c | 48 | ||||
-rw-r--r-- | src/input/librtsp/rtsp_session.c | 22 | ||||
-rw-r--r-- | src/input/mms.c | 35 | ||||
-rw-r--r-- | src/input/mmsh.c | 184 | ||||
-rw-r--r-- | src/input/net_buf_ctrl.c | 34 | ||||
-rw-r--r-- | src/input/pnm.c | 34 |
22 files changed, 618 insertions, 836 deletions
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 <netinet/in.h> #include <sys/socket.h> +#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 <winioctl.h> #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 (total<len){ n = read (this->fd, &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 <string.h> #include <errno.h> +#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 <sys/time.h> +#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 <fcntl.h> #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 <errno.h> #include <sys/time.h> +#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 <fcntl.h> #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:/<prefix_to_tmp_files>\!<prefix_to_saved_files>\!<max_page_age> * - * $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 <sys/time.h> #include <stdlib.h> +#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 <fcntl.h> #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 <sys/stat.h> #include <errno.h> +#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 <stdio.h> #include <string.h> -#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 <stdio.h> #include <string.h> -#include "real.h" -#include "asmrp.h" -#include "sdpplin.h" -#include <xineutils.h> - +#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; i<desc->stream_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; j<n; j++) { -#ifdef LOG - printf("asmrp rule match: %u for stream %u\n", rulematches[j], desc->stream[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 <xineutils.h> -#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 <xineutils.h> - +#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 <sys/time.h> #include <sys/types.h> -#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 <stdlib.h> #include <string.h> +#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 <time.h> #include <assert.h> +#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 <sys/time.h> #include <sys/types.h> +#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; } |