diff options
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_cdda.c | 189 | ||||
-rw-r--r-- | src/input/input_dvb.c | 108 | ||||
-rw-r--r-- | src/input/input_dvd.c | 47 | ||||
-rw-r--r-- | src/input/input_file.c | 11 | ||||
-rw-r--r-- | src/input/input_mms.c | 4 | ||||
-rw-r--r-- | src/input/input_net.c | 8 | ||||
-rw-r--r-- | src/input/input_pnm.c | 4 | ||||
-rw-r--r-- | src/input/input_pvr.c | 74 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 22 | ||||
-rw-r--r-- | src/input/input_v4l.c | 45 | ||||
-rw-r--r-- | src/input/input_vcd.c | 86 | ||||
-rw-r--r-- | src/input/libreal/asmrp.c | 6 | ||||
-rw-r--r-- | src/input/libreal/real.c | 19 | ||||
-rw-r--r-- | src/input/libreal/rmff.c | 84 | ||||
-rw-r--r-- | src/input/libreal/sdpplin.c | 12 | ||||
-rw-r--r-- | src/input/librtsp/rtsp.c | 36 | ||||
-rw-r--r-- | src/input/librtsp/rtsp_session.c | 17 | ||||
-rw-r--r-- | src/input/media_helper.c | 9 | ||||
-rw-r--r-- | src/input/media_helper.h | 8 | ||||
-rw-r--r-- | src/input/mmsh.c | 23 | ||||
-rw-r--r-- | src/input/net_buf_ctrl.c | 85 | ||||
-rw-r--r-- | src/input/pnm.c | 61 | ||||
-rw-r--r-- | src/input/vcd/vcdplayer.c | 4 |
23 files changed, 519 insertions, 443 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 4759f553a..4436edb22 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.39 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_cdda.c,v 1.40 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -409,7 +409,7 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->ignore_last_track = 0; } toc->total_tracks = toc->last_track - toc->first_track + 1; - + /* allocate space for the toc entries */ toc->toc_entries = (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); @@ -840,7 +840,7 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f #define _BUFSIZ 300 -static int host_connect_attempt (struct in_addr ia, int port) +static int host_connect_attempt (xine_t *xine, struct in_addr ia, int port) { int s; struct sockaddr_in sin; @@ -848,7 +848,7 @@ static int host_connect_attempt (struct in_addr ia, int port) s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s==-1) { - printf("input_cdda: failed to open socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: failed to open socket.\n"); return -1; } @@ -862,7 +862,7 @@ static int host_connect_attempt (struct in_addr ia, int port) if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && WSAGetLastError() != WSAEINPROGRESS) #endif /* WIN32 */ { - printf("input_cdda: cannot connect to host.\n"); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: cannot connect to host.\n")); close(s); return -1; } @@ -870,7 +870,7 @@ static int host_connect_attempt (struct in_addr ia, int port) return s; } -static int host_connect (const char *host, int port) +static int host_connect (xine_t *xine, const char *host, int port) { struct hostent *h; int i; @@ -878,21 +878,22 @@ static int host_connect (const char *host, int port) h=gethostbyname(host); if (h==NULL) { - printf("input_cdda: unable to resolve '%s'.\n", host); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: unable to resolve '%s'.\n"), host); return -1; } for(i=0; h->h_addr_list[i]; i++) { struct in_addr ia; memcpy(&ia, h->h_addr_list[i], 4); - s=host_connect_attempt(ia, port); + s=host_connect_attempt(xine, ia, port); if(s != -1) { signal( SIGPIPE, SIG_IGN ); return s; } } - printf("input_cdda: unable to connect to '%s'.\n", host); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_cdda: unable to connect to '%s'.\n"), host); + return -1; } @@ -961,7 +962,7 @@ static int sock_check_opened(int socket) { /* * read binary data from socket */ -static int sock_data_read (int socket, char *buf, int nlen) { +static int sock_data_read (xine_t *xine, int socket, char *buf, int nlen) { int n, num_bytes; if((socket < 0) || (buf == NULL)) @@ -989,12 +990,12 @@ static int sock_data_read (int socket, char *buf, int nlen) { timeout.tv_usec = 0; if (select (socket+1, &rset, NULL, NULL, &timeout) <= 0) { - printf ("input_cdda: timeout on read.\n"); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_cdda: timeout on read.\n"); return 0; } continue; } - printf ("input_cdda: read error %d.\n", errno); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_cdda: read error %d.\n", errno); return 0; } @@ -1076,7 +1077,7 @@ static int sock_data_write(int socket, char *buf, int len) { return wlen; } -static int network_command( int socket, char *data_buf, char *msg, ...) +static int network_command( xine_t *xine, int socket, char *data_buf, char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -1092,13 +1093,13 @@ static int network_command( int socket, char *data_buf, char *msg, ...) if( sock_data_write(socket, buf, strlen(buf)) < (int)strlen(buf) ) { - printf("input_cdda: error writing to socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error writing to socket.\n"); return -1; } if( sock_string_read(socket, buf, _BUFSIZ) <= 0 ) { - printf("input_cdda: error reading from socket.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error reading from socket.\n"); return -1; } @@ -1106,10 +1107,11 @@ static int network_command( int socket, char *data_buf, char *msg, ...) if( n ) { if( !data_buf ) { - printf("input_cdda: protocol error, data returned but no buffer provided.\n"); + xprintf(xine, XINE_VERBOSITY_DEBUG, + "input_cdda: protocol error, data returned but no buffer provided.\n"); return -1; } - if( sock_data_read(socket, data_buf, n) < n ) + if( sock_data_read(xine, socket, data_buf, n) < n ) return -1; } else if ( data_buf ) { @@ -1120,7 +1122,7 @@ static int network_command( int socket, char *data_buf, char *msg, ...) } -static int network_connect( char *url ) +static int network_connect(xine_t *xine, char *url ) { char *host; int port; @@ -1135,12 +1137,12 @@ static int network_connect( char *url ) return -1; } - fd = host_connect( host, port ); + fd = host_connect(xine, host, port ); free(url); if( fd != -1 ) { - if( network_command(fd, NULL, "cdda_open") < 0 ) { - printf("input_cdda: error opening remote drive.\n"); + if( network_command(xine, fd, NULL, "cdda_open") < 0 ) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: error opening remote drive.\n"); close(fd); return -1; } @@ -1148,14 +1150,14 @@ static int network_connect( char *url ) return fd; } -static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { +static int network_read_cdrom_toc(xine_t *xine, int fd, cdrom_toc *toc) { char buf[_BUFSIZ]; int i; /* fetch the table of contents */ - if( network_command( fd, buf, "cdda_tochdr" ) == -1) { - printf("input_cdda: network CDROMREADTOCHDR error.\n"); + if( network_command(xine, fd, buf, "cdda_tochdr" ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCHDR error.\n"); return -1; } @@ -1174,8 +1176,8 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { for (i = toc->first_track; i <= toc->last_track; i++) { /* fetch the table of contents */ - if( network_command( fd, buf, "cdda_tocentry %d", i ) == -1) { - printf("input_cdda: network CDROMREADTOCENTRY error.\n"); + if( network_command( xine, fd, buf, "cdda_tocentry %d", i ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -1191,8 +1193,8 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { } /* fetch the leadout as well */ - if( network_command( fd, buf, "cdda_tocentry %d", CD_LEADOUT_TRACK ) == -1) { - printf("input_cdda: network CDROMREADTOCENTRY error.\n"); + if( network_command( xine, fd, buf, "cdda_tocentry %d", CD_LEADOUT_TRACK ) == -1) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -1208,10 +1210,10 @@ static int network_read_cdrom_toc(int fd, cdrom_toc *toc) { return 0; } -static int network_read_cdrom_frames(int fd, int first_frame, int num_frames, +static int network_read_cdrom_frames(xine_t *xine, int fd, int first_frame, int num_frames, unsigned char data[CD_RAW_FRAME_SIZE]) { - return network_command( fd, data, "cdda_read %d %d", first_frame, num_frames ); + return network_command( xine, fd, data, "cdda_read %d %d", first_frame, num_frames ); } @@ -1274,7 +1276,8 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { return -1; if((err = ioctl(this->fd, CDROM_MEDIA_CHANGED, cd_changed)) < 0) { - printf("input_cdda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno)); return -1; } @@ -1301,49 +1304,50 @@ static int _cdda_is_cd_changed(cdda_input_plugin_t *this) { /* * create a directory, in safe mode */ -static void _cdda_mkdir_safe(char *path) { +static void _cdda_mkdir_safe(xine_t *xine, char *path) { if(path == NULL) return; - + #ifndef WIN32 { - struct stat pstat; - - if((lstat(path, &pstat)) < 0) { - /* file or directory no exist, create it */ - if(mkdir(path, 0755) < 0) { - fprintf(stderr, "input_cdda: mkdir(%s) failed: %s.\n", path, strerror(errno)); - return; - } - } - else { - /* Check of found file is a directory file */ - if(!S_ISDIR(pstat.st_mode)) { - fprintf(stderr, "input_cdda: %s is not a directory.\n", path); - } - } + struct stat pstat; + + if((lstat(path, &pstat)) < 0) { + /* file or directory no exist, create it */ + if(mkdir(path, 0755) < 0) { + xprintf(xine, XINE_VERBOSITY_DEBUG, + "input_cdda: mkdir(%s) failed: %s.\n", path, strerror(errno)); + return; + } + } + else { + /* Check of found file is a directory file */ + if(!S_ISDIR(pstat.st_mode)) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: %s is not a directory.\n", path); + } + } } #else { - HANDLE hList; - TCHAR szDir[MAX_PATH+1]; - WIN32_FIND_DATA FileData; - - // Get the proper directory path - sprintf(szDir, "%s\\*", path); - - // Get the first file - hList = FindFirstFile(szDir, &FileData); - if (hList == INVALID_HANDLE_VALUE) - { - if(_mkdir(path) != 0) { - fprintf(stderr, "input_cdda: mkdir(%s) failed.\n", path); - return; - } - } - - FindClose(hList); + HANDLE hList; + TCHAR szDir[MAX_PATH+1]; + WIN32_FIND_DATA FileData; + + // Get the proper directory path + sprintf(szDir, "%s\\*", path); + + // Get the first file + hList = FindFirstFile(szDir, &FileData); + if (hList == INVALID_HANDLE_VALUE) + { + if(_mkdir(path) != 0) { + xprintf(xine, XINE_VERBOSITY_DEBUG, "input_cdda: mkdir(%s) failed.\n", path); + return; + } + } + + FindClose(hList); } #endif /* WIN32 */ } @@ -1351,7 +1355,7 @@ static void _cdda_mkdir_safe(char *path) { /* * Make recursive directory creation */ -static void _cdda_mkdir_recursive_safe(char *path) { +static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { char *p, *pp; char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; char buf2[XINE_PATH_MAX + XINE_NAME_MAX + 1]; @@ -1381,7 +1385,7 @@ static void _cdda_mkdir_recursive_safe(char *path) { #endif /* WIN32 */ - _cdda_mkdir_safe(buf2); + _cdda_mkdir_safe(xine, buf2); } } } @@ -1543,7 +1547,8 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { sprintf(cdir, "%s/%s", cdir, discid); if((fd = fopen(cdir, "r")) == NULL) { - printf("input_cdda: fopen(%s) failed: %s.\n", cdir, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: fopen(%s) failed: %s.\n", cdir, strerror(errno)); closedir(dir); return 0; } @@ -1629,12 +1634,13 @@ static void _cdda_save_cached_cddb_infos(cdda_input_plugin_t *this, char *fileco /* Ensure "~/.xine/cddbcache" exist */ sprintf(cfile, "%s", this->cddb.cache_dir); - _cdda_mkdir_recursive_safe(cfile); + _cdda_mkdir_recursive_safe(this->stream->xine, cfile); sprintf(cfile, "%s/%08lx", this->cddb.cache_dir, this->cddb.disc_id); if((fd = fopen(cfile, "w")) == NULL) { - printf("input_cdda: fopen(%s) failed: %s.\n", cfile, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: fopen(%s) failed: %s.\n", cfile, strerror(errno)); return; } else { @@ -1715,10 +1721,14 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { else { this->cddb.fd = _cdda_cddb_socket_open(this); if(this->cddb.fd >= 0) { - printf("input_cdda: successfuly connected to cddb server '%s:%d'.\n", this->cddb.server, this->cddb.port); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_cdda: successfuly connected to cddb server '%s:%d'.\n"), + this->cddb.server, this->cddb.port); } else { - printf("input_cdda: failed to connect to cddb server '%s:%d' (%s).\n", this->cddb.server, this->cddb.port, strerror(errno)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_cdda: failed to connect to cddb server '%s:%d' (%s).\n"), + this->cddb.server, this->cddb.port, strerror(errno)); this->cddb.have_cddb_info = 0; return; } @@ -1727,7 +1737,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) < 0) { - printf("input_cdda: error while reading cddb welcome message.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while reading cddb welcome message.\n"); _cdda_cddb_socket_close(this); return; } @@ -1740,7 +1751,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "cddb hello unknown localhost xine %s\n", VERSION); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb hello command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb hello command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1748,7 +1760,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) < 0) { - printf("input_cdda: cddb hello command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb hello command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -1761,7 +1774,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { } sprintf(buffer, "%s%d\n", buffer, this->cddb.disc_length); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb query command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb query command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1769,7 +1783,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) != 200) { - printf("input_cdda: cddb query command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb query command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -1790,7 +1805,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); sprintf(buffer, "cddb read %s %s\n", this->cddb.disc_category, this->cddb.cdiscid); if ((err = _cdda_cddb_send_command(this, buffer)) <= 0) { - printf("input_cdda: error while sending cddb read command.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: error while sending cddb read command.\n"); _cdda_cddb_socket_close(this); return; } @@ -1798,7 +1814,8 @@ static void _cdda_cddb_retrieve(cdda_input_plugin_t *this) { memset(&buffer, 0, sizeof(buffer)); _cdda_cddb_socket_read(&buffer[0], 2047, this->cddb.fd); if ((err = _cdda_cddb_handle_code(buffer)) != 210) { - printf("input_cdda: cddb read command returned error code '%03d'.\n", err); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: cddb read command returned error code '%03d'.\n", err); _cdda_cddb_socket_close(this); return; } @@ -2195,7 +2212,7 @@ static buf_element_t *cdda_plugin_read_block (input_plugin_t *this_gen, fifo_buf this->cache_last - this->cache_first + 1, this->cache[0]); else if ( this->net_fd != -1 ) - err = network_read_cdrom_frames(this->net_fd, this->cache_first, + err = network_read_cdrom_frames(this->stream->xine, this->net_fd, this->cache_first, this->cache_last - this->cache_first + 1, this->cache[0]); } @@ -2302,11 +2319,11 @@ static int cdda_plugin_open (input_plugin_t *this_gen ) { #ifndef WIN32 if( strchr(cdda_device,':') ) { - fd = network_connect(cdda_device); + fd = network_connect(this->stream->xine, cdda_device); if( fd != -1 ) { this->net_fd = fd; - err = network_read_cdrom_toc(this->net_fd, toc); + err = network_read_cdrom_toc(this->stream->xine, this->net_fd, toc); } } #endif @@ -2447,9 +2464,9 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, #ifndef WIN32 if( strchr(this->cdda_device,':') ) { - fd = network_connect(this->cdda_device); + fd = network_connect(ip->stream->xine, this->cdda_device); if( fd != -1 ) { - err = network_read_cdrom_toc(fd, toc); + err = network_read_cdrom_toc(ip->stream->xine, fd, toc); } } #endif @@ -2601,7 +2618,7 @@ static void cdda_class_dispose (input_class_t *this_gen) { static int cdda_class_eject_media (input_class_t *this_gen) { cdda_input_class_t *this = (cdda_input_class_t *) this_gen; - return media_eject_media (this->cdda_device); + return media_eject_media (this->xine, this->cdda_device); } diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 4f2850dc0..e4e2a5a80 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -77,17 +77,18 @@ typedef struct { struct dmx_pes_filter_params pesFilterParamsV; struct dmx_pes_filter_params pesFilterParamsA; + xine_t *xine; } tuner_t; typedef struct { - char *name; - struct dvb_frontend_parameters front_param; - int vpid; - int apid; - int sat_no; - int tone; - int pol; + char *name; + struct dvb_frontend_parameters front_param; + int vpid; + int apid; + int sat_no; + int tone; + int pol; } channel_t; typedef struct { @@ -103,7 +104,7 @@ typedef struct { typedef struct { input_plugin_t input_plugin; - dvb_input_class_t *cls; + dvb_input_class_t *class; xine_stream_t *stream; @@ -209,38 +210,39 @@ static void tuner_dispose (tuner_t *this) { free (this); } -static tuner_t *tuner_init () { +static tuner_t *tuner_init (xine_t *xine) { tuner_t *this; - this = malloc (sizeof (tuner_t)); + this = (tuner_t *) xine_xmalloc(sizeof(tuner_t)); this->fd_frontend = -1; - this->fd_demuxa = -1; - this->fd_demuxv = -1; + this->fd_demuxa = -1; + this->fd_demuxv = -1; + this->xine = xine; if ((this->fd_frontend = open(FRONTEND_DEVICE, O_RDWR)) < 0){ - perror("FRONTEND DEVICE"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } if ((ioctl (this->fd_frontend, FE_GET_INFO, &this->feinfo)) < 0) { - perror("FE_GET_INFO"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FE_GET_INFO: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } this->fd_demuxa = open (DEMUX_DEVICE, O_RDWR); if (this->fd_demuxa < 0) { - perror ("DEMUX DEVICE audio"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE audio: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } this->fd_demuxv=open (DEMUX_DEVICE, O_RDWR); if (this->fd_demuxv < 0) { - perror ("DEMUX DEVICE video"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE video: %s\n", strerror(errno)); tuner_dispose(this); return NULL; } @@ -263,7 +265,7 @@ static void tuner_set_vpid (tuner_t *this, ushort vpid) { this->pesFilterParamsV.flags = DMX_IMMEDIATE_START; if (ioctl(this->fd_demuxv, DMX_SET_PES_FILTER, &this->pesFilterParamsV) < 0) - perror("set_vpid"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_vpid: %s\n", strerror(errno)); } static void tuner_set_apid (tuner_t *this, ushort apid) { @@ -279,7 +281,7 @@ static void tuner_set_apid (tuner_t *this, ushort apid) { this->pesFilterParamsA.flags = DMX_IMMEDIATE_START; if (ioctl (this->fd_demuxa, DMX_SET_PES_FILTER, &this->pesFilterParamsA) < 0) - perror("set_apid"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "set_apid: %s\n", strerror(errno)); } static int tuner_set_diseqc(tuner_t *this, channel_t *c) @@ -315,17 +317,19 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters fe_status_t status; if (ioctl(this->fd_frontend, FE_SET_FRONTEND, front_param) <0) { - perror("setfront front"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "setfront front: %s\n", strerror(errno)); } do { if (ioctl(this->fd_frontend, FE_READ_STATUS, &status) < 0) { - perror("fe get event"); + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "fe get event: %s\n", strerror(errno)); return 0; - } - printf("input_dvb: status: %x\n", status); - if (status & FE_HAS_LOCK) { - return 1; + } + + xprintf(this->xine, XINE_VERBOSITY_DEBUG, "input_dvb: status: %x\n", status); + + if (status & FE_HAS_LOCK) { + return 1; } usleep(500000); } @@ -334,19 +338,20 @@ static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters return 0; } -static void print_channel (channel_t *channel) { - printf ("input_dvb: channel '%s' freq %d vpid %d apid %d\n", - channel->name, - channel->front_param.frequency, - channel->vpid, - channel->apid); +static void print_channel (xine_t *xine, channel_t *channel) { + xprintf (xine, XINE_VERBOSITY_DEBUG, + "input_dvb: channel '%s' freq %d vpid %d apid %d\n", + channel->name, + channel->front_param.frequency, + channel->vpid, + channel->apid); } static int tuner_set_channel (tuner_t *this, channel_t *c) { - print_channel (c); + print_channel (this->xine, c); tuner_set_vpid (this, 0); tuner_set_apid (this, 0); @@ -402,18 +407,18 @@ static void switch_channel (dvb_input_plugin_t *this) { close (this->fd); if (!tuner_set_channel (this->tuner, &this->channels[this->channel])) { - printf ("input_dvb: tuner_set_channel failed\n"); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); pthread_mutex_unlock (&this->mutex); return; } - event.type = XINE_EVENT_PIDS_CHANGE; + event.type = XINE_EVENT_PIDS_CHANGE; data.vpid = this->channels[this->channel].vpid; data.apid = this->channels[this->channel].apid; event.data = &data; event.data_length = sizeof (xine_pids_data_t); - printf ("input_dvb: sending event\n"); + xprintf (this->class->xine, XINE_VERBOSITY_DEBUG, "input_dvb: sending event\n"); xine_event_send (this->stream, &event); @@ -429,7 +434,7 @@ static void switch_channel (dvb_input_plugin_t *this) { event.data_length = sizeof(ui_data); xine_event_send(this->stream, &event); - printf ("input_dvb: ui title event sent\n"); + lprintf ("input_dvb: ui title event sent\n"); this->fd = open (DVR_DEVICE, O_RDONLY); @@ -673,7 +678,7 @@ static int find_param(const Param *list, const char *name) return list->value;; } -static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { +static channel_t *load_channels (xine_t *xine, int *num_ch, fe_type_t fe_type) { FILE *f; char str[BUFSIZE]; @@ -685,7 +690,7 @@ static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { f = fopen (filename, "rb"); if (!f) { - printf ("input_dvb: failed to open dvb channel file '%s'\n", filename); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s'\n"), filename); return NULL; } @@ -697,7 +702,8 @@ static channel_t *load_channels (int *num_ch, fe_type_t fe_type) { num_channels++; } fclose (f); - printf ("input_dvb: %d channels found.\n", num_channels); + + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_dvb: %d channels found.\n", num_channels); channels = malloc (sizeof (channel_t) * num_channels); @@ -875,12 +881,12 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { int num_channels; char str[256]; - if ( !(tuner = tuner_init()) ) { - printf ("input_dvb: cannot open dvb device\n"); + if ( !(tuner = tuner_init(this->class->xine)) ) { + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: cannot open dvb device\n")); return 0; } - if ( !(channels = load_channels(&num_channels, tuner->feinfo.type)) ) { + if ( !(channels = load_channels(this->class->xine, &num_channels, tuner->feinfo.type)) ) { tuner_dispose (tuner); return 0; } @@ -893,14 +899,14 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { this->channel = 0; if (!tuner_set_channel (this->tuner, &this->channels[this->channel])) { - printf ("input_dvb: tuner_set_channel failed\n"); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: tuner_set_channel failed\n")); tuner_dispose(this->tuner); free(this->channels); return 0; } if ((this->fd = open (DVR_DEVICE, O_RDONLY)) < 0){ - printf ("input_dvb: cannot open dvr device '%s'\n", DVR_DEVICE); + xprintf (this->class->xine, XINE_VERBOSITY_LOG, _("input_dvb: cannot open dvr device '%s'\n"), DVR_DEVICE); tuner_dispose(this->tuner); free(this->channels); return 0; @@ -950,11 +956,11 @@ static int dvb_plugin_open (input_plugin_t *this_gen) { return 1; } -static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, +static input_plugin_t *dvb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data) { - dvb_input_class_t *cls = (dvb_input_class_t *) cls_gen; + dvb_input_class_t *class = (dvb_input_class_t *) class_gen; dvb_input_plugin_t *this; char *mrl = (char *) data; @@ -965,7 +971,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, this->stream = stream; this->mrl = strdup(mrl); - this->cls = cls; + this->class = class; this->tuner = NULL; this->channels = NULL; this->fd = -1; @@ -985,7 +991,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *cls_gen, this->input_plugin.get_mrl = dvb_plugin_get_mrl; this->input_plugin.get_optional_data = dvb_plugin_get_optional_data; this->input_plugin.dispose = dvb_plugin_dispose; - this->input_plugin.input_class = cls_gen; + this->input_plugin.input_class = class_gen; return &this->input_plugin; } @@ -1003,8 +1009,8 @@ static char *dvb_class_get_identifier (input_class_t *this_gen) { } static void dvb_class_dispose (input_class_t *this_gen) { - dvb_input_class_t *cls = (dvb_input_class_t *) this_gen; - free (cls); + dvb_input_class_t *class = (dvb_input_class_t *) this_gen; + free (class); } static int dvb_class_eject_media (input_class_t *this_gen) { @@ -1013,10 +1019,10 @@ static int dvb_class_eject_media (input_class_t *this_gen) { static char ** dvb_class_get_autoplay_list (input_class_t *this_gen, int *num_files) { - dvb_input_class_t *cls = (dvb_input_class_t *) this_gen; + dvb_input_class_t *class = (dvb_input_class_t *) this_gen; *num_files = 1; - return cls->mrls; + return class->mrls; } static void *init_class (xine_t *xine, void *data) { diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 291ae37ea..4003021d8 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.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: input_dvd.c,v 1.174 2003/11/26 23:44:09 f1rmb Exp $ + * $Id: input_dvd.c,v 1.175 2003/12/05 15:54:58 f1rmb Exp $ * */ @@ -538,7 +538,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, unsigned char *block; if(fifo == NULL) { - printf("input_dvd: values of \\beta will give rise to dom!\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_dvd: values of \\beta will give rise to dom!\n")); return NULL; } @@ -556,8 +557,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } result = dvdnav_get_next_cache_block (this->dvdnav, &block, &event, &len); if(result == DVDNAV_STATUS_ERR) { - printf("input_dvd: Error getting next block from DVD (%s)\n", - dvdnav_err_to_string(this->dvdnav)); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_dvd: Error getting next block from DVD (%s)\n"), dvdnav_err_to_string(this->dvdnav)); _x_message(this->stream, XINE_MSG_READ_ERROR, dvdnav_err_to_string(this->dvdnav), NULL); if (block != buf->mem) dvdnav_free_cache_block(this->dvdnav, block); @@ -741,7 +742,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, } break; default: - printf("input_dvd: FIXME: Unknown event (%i)\n", event); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: FIXME: Unknown event (%i)\n", event); break; } } @@ -762,7 +763,8 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen, /* the stack for storing the memory chunks from xine is full, we cannot * modify the buffer, because we would not be able to reconstruct it. * Therefore we copy the data and give the buffer back. */ - printf("input_dvd: too many buffers issued, memory stack exceeded\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: too many buffers issued, memory stack exceeded\n"); memcpy(buf->mem, block, DVD_BLOCK_SIZE); dvdnav_free_cache_block(this->dvdnav, block); buf->content = buf->mem; @@ -909,31 +911,31 @@ static void dvd_handle_events(dvd_input_plugin_t *this) { switch(event->type) { case XINE_EVENT_INPUT_MENU1: - printf("input_dvd: MENU1 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU1 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Escape); break; case XINE_EVENT_INPUT_MENU2: - printf("input_dvd: MENU2 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU2 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Title); break; case XINE_EVENT_INPUT_MENU3: - printf("input_dvd: MENU3 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU3 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Root); break; case XINE_EVENT_INPUT_MENU4: - printf("input_dvd: MENU4 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU4 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Subpicture); break; case XINE_EVENT_INPUT_MENU5: - printf("input_dvd: MENU5 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU5 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Audio); break; case XINE_EVENT_INPUT_MENU6: - printf("input_dvd: MENU6 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU6 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Angle); break; case XINE_EVENT_INPUT_MENU7: - printf("input_dvd: MENU7 key hit.\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_dvd: MENU7 key hit.\n"); dvdnav_menu_call(this->dvdnav, DVD_MENU_Part); break; case XINE_EVENT_INPUT_NEXT: @@ -1376,7 +1378,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { this->opened = 0; ret = dvdnav_open(&this->dvdnav, intended_dvd_device); if(ret == DVDNAV_STATUS_ERR) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_dvd: Error opening DVD device\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_dvd: Error opening DVD device\n")); _x_message (this->stream, XINE_MSG_READ_ERROR, intended_dvd_device, NULL); return 0; @@ -1387,7 +1389,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { } else { ret = dvdnav_open(&this->dvdnav, intended_dvd_device); if(ret == DVDNAV_STATUS_ERR) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "input_dvd: Error opening DVD device\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("input_dvd: Error opening DVD device\n")); _x_message (this->stream, XINE_MSG_READ_ERROR, intended_dvd_device, NULL); return 0; @@ -1436,8 +1438,8 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { tt = strtol(locator, NULL,10); dvdnav_get_number_of_titles(this->dvdnav, &titles); if((tt <= 0) || (tt > titles)) { - printf("input_dvd: Title %i is out of range (1 to %i).\n", tt, - titles); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: Title %i is out of range (1 to %i).\n", tt, titles); dvdnav_close(this->dvdnav); this->dvdnav = NULL; return 0; @@ -1450,8 +1452,8 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { } dvdnav_get_number_of_parts(this->dvdnav, tt, &parts); if ((pr == 0) || (pr > parts)) { - printf("input_dvd: Part %i is out of range (1 to %i).\n", pr, - parts); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_dvd: Part %i is out of range (1 to %i).\n", pr, parts); dvdnav_close(this->dvdnav); this->dvdnav = NULL; return 0; @@ -1610,7 +1612,7 @@ static void dvd_class_dispose(input_class_t *this_gen) { static int dvd_class_eject_media (input_class_t *this_gen) { dvd_input_class_t *this = (dvd_input_class_t*)this_gen; - return media_eject_media (this->dvd_device); + return media_eject_media (this->xine, this->dvd_device); } static void *init_class (xine_t *xine, void *data) { @@ -1626,7 +1628,7 @@ static void *init_class (xine_t *xine, void *data) { printf("input_dvd.c: config = %p\n", config); #endif - this = (dvd_input_class_t *) malloc (sizeof (dvd_input_class_t)); + this = (dvd_input_class_t *) xine_xmalloc (sizeof (dvd_input_class_t)); this->input_class.get_instance = dvd_class_get_instance; this->input_class.get_identifier = dvd_class_get_identifier; @@ -1725,6 +1727,9 @@ static void *init_class (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.175 2003/12/05 15:54:58 f1rmb + * cleanup phase II. use xprintf when it's relevant, use xine_xmalloc when it's relevant too. Small other little fix (can't remember). Change few internal function prototype because it xine_t pointer need to be used if some xine's internal sections. NOTE: libdvd{nav,read} is still too noisy, i will take a look to made it quit, without invasive changes. To be continued... + * * Revision 1.174 2003/11/26 23:44:09 f1rmb * xprintf clean pass. xprintf now log into new XINE_LOG_TRACE log buffer. scratch buffer enhancement (thanks Thibaut for the malloc tips), enlarge log buffer from 25 lines (very useless), to 150 (better). * diff --git a/src/input/input_file.c b/src/input/input_file.c index d05a9ba83..964c79488 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.87 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_file.c,v 1.88 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -588,7 +588,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); else { dir_files[num_dir_files].link = (char *) xine_xmalloc(linksize + 1); strncpy(dir_files[num_dir_files].link, linkbuf, linksize); @@ -625,7 +626,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); } else { hide_files[num_hide_files].link = (char *) @@ -660,7 +662,8 @@ static xine_mrl_t **file_class_get_dir (input_class_t *this_gen, linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX); if(linksize < 0) { - printf ("input_file: readlink() failed: %s\n", strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_file: readlink() failed: %s\n", strerror(errno)); } else { norm_files[num_norm_files].link = (char *) diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 76ada3774..b6cdf2daf 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.43 2003/11/26 23:44:09 f1rmb Exp $ + * $Id: input_mms.c,v 1.44 2003/12/05 15:54:58 f1rmb Exp $ * * mms input plugin based on work from major mms */ @@ -365,7 +365,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre return NULL; } - this = (mms_input_plugin_t *) malloc (sizeof (mms_input_plugin_t)); + this = (mms_input_plugin_t *) xine_xmalloc (sizeof (mms_input_plugin_t)); cls->ip = this; this->stream = stream; this->mms = NULL; diff --git a/src/input/input_net.c b/src/input/input_net.c index 666a33a1a..16640ce35 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.55 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_net.c,v 1.56 2003/12/05 15:54:58 f1rmb Exp $ * * how to set up mp1e for use with this plugin: * @@ -272,7 +272,8 @@ 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); - printf ("input_net: got %lld bytes (%lld/%lld bytes read)\n", n,total,len); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "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); @@ -348,7 +349,8 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin if( this->curpos <= this->preview_size ) this->curpos = offset; else - printf ("input_net: cannot seek back! (%lld > %lld)\n", this->curpos, offset); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_net: cannot seek back! (%lld > %lld)\n", this->curpos, offset); } else { offset -= this->curpos; diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index efa9bee59..879295ab2 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -120,8 +120,8 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, static off_t pnm_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; - printf ("input_pnm: seek %lld bytes, origin %d\n", - offset, origin); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: seek %lld bytes, origin %d\n", offset, origin); /* only realtive forward-seeking is implemented */ diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 8c6d8527c..d2c064142 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.37 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_pvr.c,v 1.38 2003/12/05 15:54:58 f1rmb Exp $ */ /************************************************************************** @@ -396,9 +396,8 @@ static void pvrscr_exit (scr_plugin_t *scr) { static pvrscr_t* pvrscr_init (void) { pvrscr_t *this; - this = malloc(sizeof(*this)); - memset(this, 0, sizeof(*this)); - + this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t)); + this->scr.interface_version = 2; this->scr.get_priority = pvrscr_get_priority; this->scr.set_speed = pvrscr_set_speed; @@ -614,7 +613,8 @@ static int pvr_break_rec_page (pvr_input_plugin_t *this) { this->rec_fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666 ); if( this->rec_fd == -1 ) { - printf("input_pvr: error creating pvr file (%s)\n", filename); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error creating pvr file (%s)\n"), filename); free(filename); return 0; } @@ -659,12 +659,14 @@ static int pvr_rec_file(pvr_input_plugin_t *this) { } pos = (off_t)(this->rec_blk - this->page_block[this->rec_page]) * PVR_BLOCK_SIZE; if( lseek (this->rec_fd, pos, SEEK_SET) != pos ) { - printf("input_pvr: error setting position for writing %lld\n", pos); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting position for writing %lld\n", pos); return 0; } if( this->rec_fd != -1 ) { if( write(this->rec_fd, this->data, PVR_BLOCK_SIZE) < PVR_BLOCK_SIZE ) { - printf("input_pvr: short write to pvr file (out of disk space?)\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: short write to pvr file (out of disk space?)\n"); return 0; } this->rec_blk++; @@ -766,7 +768,8 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t this->play_fd = open(filename, O_RDONLY ); if( this->play_fd == -1 ) { - printf("input_pvr: error opening pvr file (%s)\n", filename); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening pvr file (%s)\n"), filename); free(filename); return 0; } @@ -780,11 +783,13 @@ static int pvr_play_file(pvr_input_plugin_t *this, fifo_buffer_t *fifo, uint8_t pos = (off_t)(this->play_blk - this->page_block[this->play_page]) * PVR_BLOCK_SIZE; if( lseek (this->play_fd, pos, SEEK_SET) != pos ) { - printf("input_pvr: error setting position for reading %lld\n", pos); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting position for reading %lld\n", pos); return 0; } if( read(this->play_fd, buffer, PVR_BLOCK_SIZE) < PVR_BLOCK_SIZE ) { - printf("input_pvr: short read from pvr file\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: short read from pvr file\n"); return 0; } this->play_blk++; @@ -839,7 +844,8 @@ static void *pvr_loop (void *this_gen) { num_bytes = read (this->dev_fd, this->data + total_bytes, PVR_BLOCK_SIZE-total_bytes); if (num_bytes <= 0) { if (num_bytes < 0) - printf ("input_pvr: read error (%s)\n", strerror(errno)); + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: read error (%s)\n"), strerror(errno)); this->pvr_running = 0; break; } @@ -847,7 +853,7 @@ static void *pvr_loop (void *this_gen) { } if( this->data[0] || this->data[1] || this->data[2] != 1 || this->data[3] != 0xba ) { - lprintf("resyncing mpeg stream\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "resyncing mpeg stream\n"); if( !pvr_mpeg_resync(this->dev_fd) ) { this->pvr_running = 0; @@ -1040,12 +1046,14 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { pthread_mutex_lock(&this->dev_lock); #ifdef USE_V4L2 if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) ) - printf("input_pvr: error setting v4l2 input\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 input\n"); vf.frequency = this->frequency; vf.tuner = 0; if( ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) ) - printf("input_pvr: error setting v4l2 frequency\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 frequency\n"); /* workaround an ivtv bug where stream gets bad mpeg2 artifacts * after changing inputs. reopening the device fixes it. @@ -1053,16 +1061,19 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { close(this->dev_fd); this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error opening device %s\n", PVR_DEVICE ); return; } #else v.norm = VIDEO_MODE_NTSC; v.channel = this->input; if( ioctl(this->dev_fd, VIDIOCSCHAN, &v) ) - printf("input_pvr: error setting v4l input\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l input\n"); if( ioctl(this->dev_fd, VIDIOCSFREQ, &this->frequency) ) - printf("input_pvr: error setting v4l frequency\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l frequency\n"); #endif pthread_mutex_unlock(&this->dev_lock); @@ -1164,24 +1175,28 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { close(this->dev_fd); this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening device %s\n"), PVR_DEVICE ); return; } if (ioctl(this->dev_fd, IVTV_IOC_G_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n")); } else { codec.bitrate = mpeg_data->bitrate_mean; codec.bitrate_peak = mpeg_data->bitrate_peak; codec.stream_type = IVTV_STREAM_DVD; if (ioctl(this->dev_fd, IVTV_IOC_S_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n")); } } pthread_mutex_unlock(&this->dev_lock); #else - printf("input_pvr: mpeg2 settings not supported with old api\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: mpeg2 settings not supported with old api\n")); #endif } break; @@ -1210,7 +1225,7 @@ static buf_element_t *pvr_plugin_read_block (input_plugin_t *this_gen, fifo_buff int speed = this->stream->xine->clock->speed; if( !this->pvr_running ) { - printf("input_pvr: thread died, aborting\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "input_pvr: thread died, aborting\n"); return NULL; } @@ -1417,13 +1432,15 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { this->dev_fd = open (PVR_DEVICE, O_RDWR); if (this->dev_fd == -1) { - printf("input_pvr: error opening device %s\n", PVR_DEVICE ); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: error opening device %s\n"), PVR_DEVICE ); return 0; } #ifdef USE_V4L2 if (ioctl(this->dev_fd, IVTV_IOC_G_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_G_CODEC failed, maybe API changed?\n")); } else { codec.bitrate_mode = 0; codec.bitrate = 6000000; @@ -1431,7 +1448,8 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { codec.stream_type = IVTV_STREAM_DVD; if (ioctl(this->dev_fd, IVTV_IOC_S_CODEC, &codec) < 0) { - printf("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("input_pvr: IVTV_IOC_S_CODEC failed, maybe API changed?\n")); } } #endif @@ -1452,8 +1470,8 @@ static int pvr_plugin_open (input_plugin_t *this_gen ) { if ((err = pthread_create (&this->pvr_thread, NULL, pvr_loop, this)) != 0) { - fprintf (stderr, "input_pvr: can't create new thread (%s)\n", - strerror(err)); + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: can't create new thread (%s)\n", strerror(err)); abort(); } @@ -1557,13 +1575,11 @@ static void pvr_class_dispose (input_class_t *this_gen) { static void *init_plugin (xine_t *xine, void *data) { pvr_input_class_t *this; - config_values_t *config; this = (pvr_input_class_t *) xine_xmalloc (sizeof (pvr_input_class_t)); this->xine = xine; this->config = xine->config; - config = xine->config; this->input_class.get_instance = pvr_class_get_instance; this->input_class.get_identifier = pvr_class_get_identifier; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index ddd8456c4..02b410471 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.54 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: input_stdin_fifo.c,v 1.55 2003/12/05 15:54:58 f1rmb Exp $ */ #ifdef HAVE_CONFIG_H @@ -61,6 +61,7 @@ typedef struct { char seek_buf[BUFSIZE]; + xine_t *xine; } stdin_input_plugin_t; typedef struct { @@ -70,6 +71,8 @@ typedef struct { xine_t *xine; } stdin_input_class_t; +static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); + static off_t stdin_plugin_read (input_plugin_t *this_gen, @@ -131,8 +134,6 @@ static buf_element_t *stdin_plugin_read_block (input_plugin_t *this_gen, fifo_bu } /* forward reference */ -static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen); - static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; @@ -156,7 +157,8 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig if( this->curpos <= this->preview_size ) this->curpos = offset; else - printf ("stdin: cannot seek back! (%lld > %lld)\n", this->curpos, offset); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("stdin: cannot seek back! (%lld > %lld)\n"), this->curpos, offset); } else { offset -= this->curpos; @@ -243,8 +245,7 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { lprintf("filename '%s'\n", filename); if (this->fh == -1) { - printf ("stdin: failed to open '%s'\n", - filename); + xprintf (this->xine, XINE_VERBOSITY_LOG, _("stdin: failed to open '%s'\n"), filename); return 0; } } @@ -268,10 +269,10 @@ static int stdin_plugin_open (input_plugin_t *this_gen ) { } -static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, - const char *data) { +static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, + xine_stream_t *stream, const char *data) { - /* stdin_input_class_t *cls = (stdin_input_class_t *) cls_gen; */ + stdin_input_class_t *class = (stdin_input_class_t *) class_gen; stdin_input_plugin_t *this; char *mrl = strdup(data); int fh; @@ -308,6 +309,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_st this->curpos = 0; this->mrl = mrl; this->fh = fh; + this->xine = class->xine; this->input_plugin.open = stdin_plugin_open; this->input_plugin.get_capabilities = stdin_plugin_get_capabilities; @@ -320,7 +322,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *cls_gen, xine_st this->input_plugin.get_mrl = stdin_plugin_get_mrl; this->input_plugin.dispose = stdin_plugin_dispose; this->input_plugin.get_optional_data = stdin_plugin_get_optional_data; - this->input_plugin.input_class = cls_gen; + this->input_plugin.input_class = class_gen; /* * buffering control diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 2ccfc397a..9eacc3652 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -56,6 +56,8 @@ /* Used to capture the audio data */ +#define ALSA_PCM_NEW_HW_PARAMS_API +#define ALSA_PCM_NEW_SW_PARAMS_API #ifdef HAVE_ALSA #include <alsa/asoundlib.h> #endif @@ -88,15 +90,14 @@ static struct { /* #define LOG */ -#define PLUGIN "input_v4l" #ifdef LOG -#define DBGPRINT(args...) do { printf(PLUGIN ": " args); fflush(stdout); } while(0) +#define DBGPRINT(args...) do { printf("input_v4l: " args); fflush(stdout); } while(0) #else -#define DBGPRINT(args...) {} +#define DBGPRINT(args...) do {} while(0) #endif -#define PRINT(args...) printf(PLUGIN ": " args) +#define PRINT(args...) printf("input_v4l: " args) #if !defined(NDELAY) && defined(O_NDELAY) #define FNDELAY O_NDELAY @@ -341,8 +342,7 @@ static pvrscr_t* pvrscr_init (void) { pvrscr_t *this; - this = malloc(sizeof(*this)); - memset(this, 0, sizeof(*this)); + this = (pvrscr_t *) xine_xmalloc(sizeof(pvrscr_t)); this->scr.interface_version = 2; this->scr.get_priority = pvrscr_get_priority; @@ -665,7 +665,7 @@ static int search_by_channel(v4l_input_plugin_t *this, char *input_source) } if (strstr(this->video_channel.name, input_source) == NULL) { - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, "Tuner name not found\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, _("Tuner name not found\n")); return -1; } @@ -1117,7 +1117,7 @@ static int open_audio_capture_device(v4l_input_plugin_t *this) /* Set sample rate */ if (this->audio_capture) { this->exact_rate = snd_pcm_hw_params_set_rate_near(this->pcm_handle, - this->pcm_hwparams, rate, &this->dir); + this->pcm_hwparams, &rate, &this->dir); if (this->dir != 0) { PRINT("Audio :s The rate %d Hz is not supported by your hardware.\n", rate); @@ -1188,7 +1188,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi /* Buffer is empty, and we did not pause playback */ report_progress(this->stream, SCR_PAUSED); - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Buffer is empty, pausing playback (used: %d, num_free: %d)\r\n", num_used, num_free); @@ -1210,7 +1210,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi if (scr_tunning == SCR_PAUSED) { if (2 * num_used > num_free) { /* Playback was paused, but we have normal buffer usage again */ - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "Resuming playback (used: %d, free: %d)\r\n", num_used, num_free); this->scr_tunning = 0; @@ -1249,7 +1249,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi /* Check if speed adjustment should be changed */ if (scr_tunning != this->scr_tunning) { this->scr_tunning = scr_tunning; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "scr tunning = %d (used: %d, free: %d)\r\n", scr_tunning, num_used, num_free); pvrscr_speed_tunning(this->scr, 1.0 + (0.01 * scr_tunning)); } @@ -1261,7 +1261,7 @@ static int v4l_adjust_realtime_speed(v4l_input_plugin_t *this, fifo_buffer_t *fi */ this->scr_tunning = 0; - xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "scr tunning resetting (used: %d, free: %d\r\n", num_used, num_free); pvrscr_speed_tunning(this->scr, 1.0); @@ -1832,7 +1832,7 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, DBGPRINT("(%d) Cannot open v4l device: %s\n", this->video_fd, strerror(errno)); xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, could not open %s\n", entry->str_value); + _("input_v4l: Sorry, could not open %s\n"), entry->str_value); is_ok = 0; } else DBGPRINT("Device opened, tv %d\n", this->video_fd); @@ -1840,8 +1840,7 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, /* Get capabilities */ if (is_ok && ioctl(this->video_fd,VIDIOCGCAP,&this->video_cap) < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry your v4l card doesn't support some features" - " needed by xine\n"); + _("input_v4l: Sorry your v4l card doesn't support some features needed by xine\n")); DBGPRINT ("VIDIOCGCAP ioctl went wrong\n"); is_ok = 0;; } @@ -1849,8 +1848,8 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, if (is_ok && !(this->video_cap.type & VID_TYPE_CAPTURE)) { /* Capture is not supported by the device. This is a must though! */ xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, your v4l card doesn't support frame grabbing." - " This is needed by xine though\n"); + _("input_v4l: Sorry, your v4l card doesn't support frame grabbing." + " This is needed by xine though\n")); DBGPRINT("Grab device does not handle capture\n"); is_ok = 0; @@ -1858,8 +1857,8 @@ static input_plugin_t *v4l_class_get_video_instance (input_class_t *cls_gen, if (is_ok && set_input_source(this, this->tuner_name) <= 0) {\ xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Could not locate the tuner name [%s] on your v4l card\n", - this->tuner_name); + _("input_v4l: Could not locate the tuner name [%s] on your v4l card\n"), + this->tuner_name); is_ok = 0; } @@ -1904,16 +1903,16 @@ static input_plugin_t *v4l_class_get_radio_instance (input_class_t *cls_gen, if (this->radio_fd < 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Allthough normally we would be able to handle this MRL,\n" - PLUGIN ": I am unable to open the radio device.[%s]\n", - entry->str_value); + _("input_v4l: Allthough normally we would be able to handle this MRL,\n" + "input_v4l: I am unable to open the radio device.[%s]\n"), + entry->str_value); is_ok = 0; } else DBGPRINT("Device opened, radio %d\n", this->radio_fd); if (is_ok && set_input_source(this, this->tuner_name) <= 0) { xine_log(this->stream->xine, XINE_LOG_MSG, - PLUGIN ": Sorry, you Radio device doesn't support this tunername\n"); + _("input_v4l: Sorry, you Radio device doesn't support this tunername\n")); is_ok = 0; } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index f63c5ba09..523af25f7 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.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_vcd.c,v 1.69 2003/10/19 23:48:47 rockyb Exp $ + * $Id: input_vcd.c,v 1.70 2003/12/05 15:54:58 f1rmb Exp $ * */ @@ -78,9 +78,9 @@ typedef struct { typedef struct { - input_class_t input_class; + input_class_t input_class; - xine_t *xine; + xine_t *xine; /* FIXME: add thread/mutex stuff to protect against multiple instantiation */ @@ -148,7 +148,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDROMREADTOCHDR, &this->tochdr) == -1 ) { - printf ("input_vcd : error in ioctl CDROMREADTOCHDR\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } @@ -157,7 +158,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { this->tocent[i-1].cdte_track = i; this->tocent[i-1].cdte_format = CDROM_MSF; if ( ioctl(fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) { - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i); return -1; } } @@ -168,7 +170,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { if (ioctl(fd, CDROMREADTOCENTRY, &this->tocent[this->tochdr.cdth_trk1]) == -1 ) { - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"); return -1; } @@ -184,7 +187,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { /* read TOC header */ if ( ioctl(fd, CDIOREADTOCHEADER, &this->tochdr) == -1 ) { - printf ("input_vcd : error in ioctl CDROMREADTOCHDR\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd : error in ioctl CDROMREADTOCHDR\n"); return -1; } @@ -199,7 +203,8 @@ static int input_vcd_read_toc (vcd_input_class_t *this, int fd) { te.data = this->tocent; if ( ioctl(fd, CDIOREADTOCENTRYS, &te) == -1 ){ - printf ("input_vcd: error in ioctl CDROMREADTOCENTRY\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in ioctl CDROMREADTOCENTRY\n"); return -1; } @@ -246,8 +251,8 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; if(ioctl(this->fd,CDROMCDXA,&cdxa)==-1) { - perror("CDROMCDXA"); - return -1; + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "CDROMCDXA: %s\n", strerror(errno)); + return -1; } } #else @@ -258,8 +263,8 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) cdread.cdread_buflen = 2336; if(ioctl(this->fd,CDROMREADMODE2,&cdread)==-1) { - perror("CDROMREADMODE2"); - return -1; + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "CDROMREADMODE2: %s\n", strerror(errno)); + return -1; } } #endif @@ -314,11 +319,12 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ; sc.uscsi_timeout = 20; if (ioctl(this->fd, USCSICMD, &sc)) { - perror("USCSICMD: READ CD"); + xprintf(this->cls->xine, XINE_VERBOSITY_DEBUG, "USCSICMD: READ CD: %s\n", strerror(errno)); return -1; } if (sc.uscsi_status) { - printf ("scsi command failed with status %d\n", sc.uscsi_status); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "scsi command failed with status %d\n", sc.uscsi_status); return -1; } } @@ -365,7 +371,8 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, memcpy (&data, &msf, sizeof (msf)); if (ioctl (this->fd, CDROMREADRAW, &data) == -1) { - printf ("input_vcd: error in CDROMREADRAW\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error in CDROMREADRAW\n"); return 0; } @@ -400,11 +407,11 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, do { if (lseek (this->fd, this->cur_sec * bsize, SEEK_SET) == -1) { - printf ("input_vcd: seek error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: seek error %d\n", errno); return 0; } if (read (this->fd, &data, bsize) == -1) { - printf ("input_vcd: read error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read error %d\n", errno); return 0; } this->cur_sec++; @@ -442,7 +449,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen, lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame; if (sun_vcd_read(this, lba, &data) < 0) { - printf ("input_vcd: read data failed\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read data failed\n"); return 0; } @@ -500,7 +507,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, memcpy (&data, &msf, sizeof (msf)); if (ioctl (this->fd, CDROMREADRAW, &data) == -1) { - printf ("input_vcd: error in CDROMREADRAW\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDROMREADRAW\n"); return NULL; } @@ -540,11 +547,11 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, do { if (lseek (this->fd, this->cur_sec * bsize, SEEK_SET) == -1) { - printf ("input_vcd: seek error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: seek error %d\n", errno); return NULL; } if (read (this->fd, &data, bsize) == -1) { - printf ("input_vcd: read error %d\n", errno); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read error %d\n", errno); return NULL; } this->cur_sec++; @@ -587,7 +594,7 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen, lba = (this->cur_min * 60 + this->cur_sec) * 75L + this->cur_frame; if (sun_vcd_read (this, lba, &data) < 0) { - printf ("input_vcd: read data failed\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: read data failed\n"); return NULL; } @@ -659,7 +666,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; case SEEK_CUR: if (offset) - printf ("input_vcd: SEEK_CUR not implemented for offset != 0\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: SEEK_CUR not implemented for offset != 0\n"); /* printf ("input_vcd: current pos: %02d:%02d:%02d\n", @@ -677,8 +685,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - printf ("input_vcd: error seek to origin %d not implemented!\n", - origin); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -710,7 +718,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, case SEEK_CUR: if (offset) - printf ("input_vcd: SEEK_CUR not implemented for offset != 0\n"); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: SEEK_CUR not implemented for offset != 0\n"); sector_pos = this->cur_sec; @@ -718,8 +726,8 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen, break; default: - printf ("input_vcd: error seek to origin %d not implemented!\n", - origin); + xprintf (this->cls->xine, XINE_VERBOSITY_DEBUG, + "input_vcd: error seek to origin %d not implemented!\n", origin); return 0; } @@ -837,13 +845,15 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { while (*filename == '/') filename++; if (sscanf (filename, "%d", &this->cur_track) != 1) { - printf ("input_vcd: malformed MRL. Use vcdo:/<track #>\n"); + xprintf (cls->xine, XINE_VERBOSITY_LOG, + _("input_vcd: malformed MRL. Use vcdo:/<track #>\n")); return 0; } if (this->cur_track>=this->cls->total_tracks) { - printf ("input_vcd: invalid track %d (valid range: 0 .. %d)\n", - this->cur_track, this->cls->total_tracks-1); + xprintf (cls->xine, XINE_VERBOSITY_LOG, + _("input_vcd: invalid track %d (valid range: 0 .. %d)\n"), + this->cur_track, this->cls->total_tracks-1); return 0; } @@ -855,7 +865,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen) { { int bsize = 2352; if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) { - printf ("input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno); + xprintf (cls->xine, XINE_VERBOSITY_DEBUG, "input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno); return 0; } @@ -932,7 +942,7 @@ static int vcd_class_eject_media (input_class_t *this_gen) { vcd_input_class_t *this = (vcd_input_class_t *) this_gen; - return media_eject_media (this->device); + return media_eject_media (this->xine, this->device); } static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *filename, @@ -950,7 +960,8 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file fd = open (this->device, O_RDONLY); if (fd == -1) { - printf ("unable to open %s: %s.\n", this->device, strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("unable to open %s: %s.\n"), this->device, strerror(errno)); return NULL; } @@ -958,7 +969,7 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file close (fd); fd = -1; - printf ("vcd_read_toc failed\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "vcd_read_toc failed\n"); return NULL; } @@ -1025,7 +1036,8 @@ static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_fi fd = open (this->device, O_RDONLY); if (fd == -1) { - printf ("input_vcd: unable to open %s: %s.\n", this->device, strerror(errno)); + xprintf (this->xine, XINE_VERBOSITY_LOG, + _("input_vcd: unable to open %s: %s.\n"), this->device, strerror(errno)); return NULL; } @@ -1033,7 +1045,7 @@ static char ** vcd_class_get_autoplay_list (input_class_t *this_gen, int *num_fi close (fd); fd = -1; - printf ("input_vcd: vcd_read_toc failed\n"); + xprintf (this->xine, XINE_VERBOSITY_DEBUG, "input_vcd: vcd_read_toc failed\n"); return NULL; } diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 928e137fb..c426acbba 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.4 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: asmrp.c,v 1.5 2003/12/05 15:54:58 f1rmb Exp $ * * a parser for real's asm rules * @@ -417,7 +417,7 @@ static int asmrp_operand (asmrp_t *p) { i = asmrp_find_id (p, p->str); if (i<0) { - printf ("error: unknown identifier %s\n", p->str); + lprintf ("error: unknown identifier %s\n", p->str); } ret = p->sym_tab[i].v; @@ -444,7 +444,7 @@ static int asmrp_operand (asmrp_t *p) { break; default: - printf ("syntax error, $ number or ( expected\n"); + lprintf ("syntax error, $ number or ( expected\n"); abort(); } diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index c0a292ef9..c7f4c9793 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.11 2003/12/04 22:14:53 jstembridge Exp $ + * $Id: real.c,v 1.12 2003/12/05 15:54:58 f1rmb Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -36,6 +36,7 @@ #include "real.h" #include "asmrp.h" #include "sdpplin.h" +#include "xine_internal.h" #include "xineutils.h" const unsigned char xor_table[] = { @@ -418,7 +419,7 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection numrules=BE_16(mlti_chunk); if (codec >= numrules) { - printf("codec index >= number of codecs. %i %i\n", codec, numrules); + lprintf("codec index >= number of codecs. %i %i\n", codec, numrules); return 0; } @@ -462,7 +463,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth if (!desc) return NULL; - header=xine_xmalloc(sizeof(rmff_header_t)); + header = xine_xmalloc(sizeof(rmff_header_t)); header->fileheader=rmff_new_fileheader(4+desc->stream_count); header->cont=rmff_new_cont( @@ -471,7 +472,7 @@ rmff_header_t *real_parse_sdp(char *data, char *stream_rules, uint32_t bandwidth desc->copyright, desc->abstract); header->data=rmff_new_dataheader(0,0); - header->streams=xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); + header->streams = xine_xmalloc(sizeof(rmff_mdpr_t*)*(desc->stream_count+1)); lprintf("number of streams: %u\n", desc->stream_count); for (i=0; i<desc->stream_count; i++) { @@ -553,7 +554,7 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char *buffer) { if (n<8) return 0; if (header[0] != 0x24) { - printf("rdt chunk not recognized: got 0x%02x\n", header[0]); + lprintf("rdt chunk not recognized: got 0x%02x\n", header[0]); return 0; } size=(header[1]<<12)+(header[2]<<8)+(header[3]); @@ -637,7 +638,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid { char *alert=rtsp_search_answers(rtsp_session,"Alert"); if (alert) { - printf("real: got message from server:\n%s\n", alert); + lprintf("real: got message from server:\n%s\n", alert); } rtsp_send_ok(rtsp_session); return NULL; @@ -646,18 +647,18 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid /* receive description */ size=0; if (!rtsp_search_answers(rtsp_session,"Content-length")) - printf("real: got no Content-length!\n"); + lprintf("real: got no Content-length!\n"); else size=atoi(rtsp_search_answers(rtsp_session,"Content-length")); if (!rtsp_search_answers(rtsp_session,"ETag")) - printf("real: got no ETag!\n"); + lprintf("real: got no ETag!\n"); else session_id=strdup(rtsp_search_answers(rtsp_session,"ETag")); lprintf("Stream description size: %i\n", size); - description=malloc(sizeof(char)*(size+1)); + description = malloc(sizeof(char)*(size+1)); rtsp_read_data(rtsp_session, description, size); description[size]=0; diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 6a57255b9..4bddd6987 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.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: rmff.c,v 1.6 2003/12/04 22:11:25 jstembridge Exp $ + * $Id: rmff.c,v 1.7 2003/12/05 15:54:58 f1rmb Exp $ * * functions for real media file format * adopted from joschkas real tools @@ -38,7 +38,6 @@ (((uint8_t*)(x))[2] << 8) | \ ((uint8_t*)(x))[3]) - /* * writes header data to a buffer */ @@ -256,15 +255,14 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) { static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=BE_32(data); fileheader->size=BE_32(&data[4]); fileheader->object_version=BE_16(&data[8]); if (fileheader->object_version != 0) { - printf("warning: unknown object version in .RMF: 0x%04x\n", - fileheader->object_version); + lprintf("warning: unknown object version in .RMF: 0x%04x\n", fileheader->object_version); } fileheader->file_version=BE_32(&data[10]); fileheader->num_headers=BE_32(&data[14]); @@ -274,15 +272,14 @@ static rmff_fileheader_t *rmff_scan_fileheader(const char *data) { static rmff_prop_t *rmff_scan_prop(const char *data) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=BE_32(data); prop->size=BE_32(&data[4]); prop->object_version=BE_16(&data[8]); if (prop->object_version != 0) { - printf("warning: unknown object version in PROP: 0x%04x\n", - prop->object_version); + lprintf("warning: unknown object version in PROP: 0x%04x\n", prop->object_version); } prop->max_bit_rate=BE_32(&data[10]); prop->avg_bit_rate=BE_32(&data[14]); @@ -301,15 +298,14 @@ static rmff_prop_t *rmff_scan_prop(const char *data) { static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=BE_32(data); mdpr->size=BE_32(&data[4]); mdpr->object_version=BE_16(&data[8]); if (mdpr->object_version != 0) { - printf("warning: unknown object version in MDPR: 0x%04x\n", - mdpr->object_version); + lprintf("warning: unknown object version in MDPR: 0x%04x\n", mdpr->object_version); } mdpr->stream_number=BE_16(&data[10]); mdpr->max_bit_rate=BE_32(&data[12]); @@ -321,17 +317,17 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { mdpr->duration=BE_32(&data[36]); mdpr->stream_name_size=data[40]; - mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1)); + mdpr->stream_name = malloc(sizeof(char)*(mdpr->stream_name_size+1)); memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); mdpr->stream_name[mdpr->stream_name_size]=0; mdpr->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type=malloc(sizeof(char)*(mdpr->mime_type_size+1)); + mdpr->mime_type = malloc(sizeof(char)*(mdpr->mime_type_size+1)); memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->mime_type[mdpr->mime_type_size]=0; mdpr->type_specific_len=BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data=malloc(sizeof(char)*(mdpr->type_specific_len)); + mdpr->type_specific_data = malloc(sizeof(char)*(mdpr->type_specific_len)); memcpy(mdpr->type_specific_data, &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); @@ -340,7 +336,7 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { static rmff_cont_t *rmff_scan_cont(const char *data) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); int pos; cont->object_id=BE_32(data); @@ -348,26 +344,25 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { cont->object_version=BE_16(&data[8]); if (cont->object_version != 0) { - printf("warning: unknown object version in CONT: 0x%04x\n", - cont->object_version); + lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } cont->title_len=BE_16(&data[10]); - cont->title=malloc(sizeof(char)*(cont->title_len+1)); + cont->title = malloc(sizeof(char)*(cont->title_len+1)); memcpy(cont->title, &data[12], cont->title_len); cont->title[cont->title_len]=0; pos=cont->title_len+12; cont->author_len=BE_16(&data[pos]); - cont->author=malloc(sizeof(char)*(cont->author_len+1)); + cont->author = malloc(sizeof(char)*(cont->author_len+1)); memcpy(cont->author, &data[pos+2], cont->author_len); cont->author[cont->author_len]=0; pos=pos+2+cont->author_len; cont->copyright_len=BE_16(&data[pos]); - cont->copyright=malloc(sizeof(char)*(cont->copyright_len+1)); + cont->copyright = malloc(sizeof(char)*(cont->copyright_len+1)); memcpy(cont->copyright, &data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; cont->comment_len=BE_16(&data[pos]); - cont->comment=malloc(sizeof(char)*(cont->comment_len+1)); + cont->comment = malloc(sizeof(char)*(cont->comment_len+1)); memcpy(cont->comment, &data[pos+2], cont->comment_len); cont->comment[cont->comment_len]=0; @@ -376,15 +371,14 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { static rmff_data_t *rmff_scan_dataheader(const char *data) { - rmff_data_t *dh=malloc(sizeof(rmff_data_t)); + rmff_data_t *dh = malloc(sizeof(rmff_data_t)); dh->object_id=BE_32(data); dh->size=BE_32(&data[4]); dh->object_version=BE_16(&data[8]); if (dh->object_version != 0) { - printf("warning: unknown object version in DATA: 0x%04x\n", - dh->object_version); + lprintf("warning: unknown object version in DATA: 0x%04x\n", dh->object_version); } dh->num_packets=BE_32(&data[10]); dh->next_data_header=BE_32(&data[14]); @@ -394,7 +388,7 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) { rmff_header_t *rmff_scan_header(const char *data) { - rmff_header_t *header=malloc(sizeof(rmff_header_t)); + rmff_header_t *header = malloc(sizeof(rmff_header_t)); rmff_mdpr_t *mdpr=NULL; int chunk_size; uint32_t chunk_type; @@ -409,14 +403,14 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_type = BE_32(ptr); if (chunk_type != RMF_TAG) { - printf("rmff: not an real media file header (.RMF tag not found).\n"); + lprintf("rmff: not an real media file header (.RMF tag not found).\n"); free(header); return NULL; } header->fileheader=rmff_scan_fileheader(ptr); ptr += header->fileheader->size; - header->streams=malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); + header->streams = malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); for (i=0; i<header->fileheader->num_headers; i++) { header->streams[i]=NULL; } @@ -426,7 +420,7 @@ rmff_header_t *rmff_scan_header(const char *data) { if (ptr[0] == 0) { - printf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); + lprintf("rmff: warning: only %d of %d header found.\n", i, header->fileheader->num_headers); break; } @@ -450,8 +444,10 @@ rmff_header_t *rmff_scan_header(const char *data) { chunk_size=34; /* hard coded header size */ break; default: - printf("unknown chunk\n"); + lprintf("unknown chunk\n"); +#ifdef LOG xine_hexdump(ptr,10); +#endif chunk_size=1; break; } @@ -487,8 +483,10 @@ rmff_header_t *rmff_scan_header_stream(int fd) { index+=(chunk_size-8); break; default: - printf("rmff_scan_header_stream: unknown chunk"); + lprintf("rmff_scan_header_stream: unknown chunk"); +#ifdef LOG xine_hexdump(buf+index-8, 8); +#endif chunk_type=DATA_TAG; } } while (chunk_type != DATA_TAG); @@ -512,7 +510,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data) { rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) { - rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t)); + rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); fileheader->object_id=RMF_TAG; fileheader->size=18; @@ -536,7 +534,7 @@ rmff_prop_t *rmff_new_prop ( uint16_t num_streams, uint16_t flags ) { - rmff_prop_t *prop=malloc(sizeof(rmff_prop_t)); + rmff_prop_t *prop = malloc(sizeof(rmff_prop_t)); prop->object_id=PROP_TAG; prop->size=50; @@ -571,7 +569,7 @@ rmff_mdpr_t *rmff_new_mdpr( uint32_t type_specific_len, const char *type_specific_data ) { - rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t)); + rmff_mdpr_t *mdpr = malloc(sizeof(rmff_mdpr_t)); mdpr->object_id=MDPR_TAG; mdpr->object_version=0; @@ -595,7 +593,7 @@ rmff_mdpr_t *rmff_new_mdpr( mdpr->mime_type_size=strlen(mime_type); } mdpr->type_specific_len=type_specific_len; - mdpr->type_specific_data=malloc(sizeof(char)*type_specific_len); + mdpr->type_specific_data = malloc(sizeof(char)*type_specific_len); memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); mdpr->mlti_data=NULL; @@ -606,7 +604,7 @@ rmff_mdpr_t *rmff_new_mdpr( rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *copyright, const char *comment) { - rmff_cont_t *cont=malloc(sizeof(rmff_cont_t)); + rmff_cont_t *cont = malloc(sizeof(rmff_cont_t)); cont->object_id=CONT_TAG; cont->object_version=0; @@ -644,7 +642,7 @@ rmff_cont_t *rmff_new_cont(const char *title, const char *author, const char *co rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header) { - rmff_data_t *data=malloc(sizeof(rmff_data_t)); + rmff_data_t *data = malloc(sizeof(rmff_data_t)); data->object_id=DATA_TAG; data->size=18; @@ -707,7 +705,9 @@ void rmff_print_header(rmff_header_t *h) { printf("pre-buffer : %i ms\n", (*stream)->preroll); printf("duration : %i ms\n", (*stream)->duration); printf("type specific data:\n"); +#ifdef LOG xine_hexdump((*stream)->type_specific_data, (*stream)->type_specific_len); +#endif stream++; } } @@ -728,12 +728,12 @@ void rmff_fix_header(rmff_header_t *h) { int num_streams=0; if (!h) { - printf("rmff_fix_header: fatal: no header given.\n"); + lprintf("rmff_fix_header: fatal: no header given.\n"); return; } if (!h->streams) { - printf("rmff_fix_header: warning: no MDPR chunks\n"); + lprintf("rmff_fix_header: warning: no MDPR chunks\n"); } else { streams=h->streams; @@ -762,18 +762,18 @@ void rmff_fix_header(rmff_header_t *h) { num_headers++; header_size+=50; } else - printf("rmff_fix_header: warning: no PROP chunk.\n"); + lprintf("rmff_fix_header: warning: no PROP chunk.\n"); if (h->cont) { num_headers++; header_size+=h->cont->size; } else - printf("rmff_fix_header: warning: no CONT chunk.\n"); + lprintf("rmff_fix_header: warning: no CONT chunk.\n"); if (!h->data) { lprintf("rmff_fix_header: no DATA chunk, creating one\n"); - h->data=malloc(sizeof(rmff_data_t)); + h->data = malloc(sizeof(rmff_data_t)); h->data->object_id=DATA_TAG; h->data->object_version=0; h->data->size=34; @@ -786,7 +786,7 @@ void rmff_fix_header(rmff_header_t *h) { if (!h->fileheader) { lprintf("rmff_fix_header: no fileheader, creating one"); - h->fileheader=malloc(sizeof(rmff_fileheader_t)); + h->fileheader = malloc(sizeof(rmff_fileheader_t)); h->fileheader->object_id=RMF_TAG; h->fileheader->size=34; h->fileheader->object_version=0; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index fb803dd91..10a8436ac 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.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: sdpplin.c,v 1.2 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: sdpplin.c,v 1.3 2003/12/05 15:54:58 f1rmb Exp $ * * sdp/sdpplin parser. * @@ -117,7 +117,7 @@ static int filter(const char *in, const char *filter, char **out) { } static sdpplin_stream_t *sdpplin_parse_stream(char **data) { - sdpplin_stream_t *desc=xine_xmalloc(sizeof(sdpplin_stream_t)); + sdpplin_stream_t *desc = xine_xmalloc(sizeof(sdpplin_stream_t)); char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); int handled; @@ -126,7 +126,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { desc->id = strdup(buf); } else { - printf("sdpplin: no m= found.\n"); + lprintf("sdpplin: no m= found.\n"); free(desc); xine_buffer_free(buf); return NULL; @@ -193,7 +193,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); - desc->mlti_data=malloc(sizeof(char)*desc->mlti_data_size); + desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); memcpy(desc->mlti_data, decoded, desc->mlti_data_size); handled=1; *data=nl(*data); @@ -225,7 +225,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { sdpplin_t *sdpplin_parse(char *data) { - sdpplin_t *desc=xine_xmalloc(sizeof(sdpplin_t)); + sdpplin_t *desc = xine_xmalloc(sizeof(sdpplin_t)); sdpplin_stream_t *stream; char *buf=xine_buffer_init(32); char *decoded=xine_buffer_init(32); @@ -273,7 +273,7 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=StreamCount:integer;",&buf)) { desc->stream_count=atoi(buf); - desc->stream=malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); + desc->stream = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); handled=1; data=nl(data); } diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index dbf4d1487..02337cec3 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.14 2003/12/04 22:38:29 jstembridge Exp $ + * $Id: rtsp.c,v 1.15 2003/12/05 15:54:58 f1rmb Exp $ * * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. @@ -118,10 +118,10 @@ static char *rtsp_get(rtsp_t *s) { } if (n>=BUF_SIZE) { - printf("librtsp: buffer overflow in rtsp_get\n"); + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "librtsp: buffer overflow in rtsp_get\n"); exit(1); } - string=malloc(sizeof(char)*n); + string = malloc(sizeof(char)*n); memcpy(string,s->buffer,n-1); string[n-1]=0; @@ -137,7 +137,7 @@ static char *rtsp_get(rtsp_t *s) { static void rtsp_put(rtsp_t *s, const char *string) { int len=strlen(string); - char *buf=malloc(sizeof(char)*len+2); + char *buf = malloc(sizeof(char)*len+2); lprintf(">> '%s'", string); @@ -156,7 +156,7 @@ static void rtsp_put(rtsp_t *s, const char *string) { * extract server status code */ -static int rtsp_get_code(const char *string) { +static int rtsp_get_code(rtsp_t *s, const char *string) { char buf[4]; int code=0; @@ -171,7 +171,8 @@ static int rtsp_get_code(const char *string) { return RTSP_STATUS_SET_PARAMETER; } - if(code != 200) printf("librtsp: server responds: '%s'\n",string); + if(code != 200) + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, "librtsp: server responds: '%s'\n", string); return code; } @@ -219,7 +220,7 @@ static int rtsp_get_answers(rtsp_t *s) { int code; answer=rtsp_get(s); - code=rtsp_get_code(answer); + code=rtsp_get_code(s, answer); free(answer); rtsp_free_answers(s); @@ -246,7 +247,8 @@ static int rtsp_get_answers(rtsp_t *s) { sscanf(answer,"Session: %s",s->buffer); if (s->session) { if (strcmp(s->buffer, s->session)) { - printf("rtsp: warning: setting NEW session: %s\n", s->buffer); + xprintf(s->stream->xine, XINE_VERBOSITY_DEBUG, + "rtsp: warning: setting NEW session: %s\n", s->buffer); free(s->session); s->session=strdup(s->buffer); } @@ -296,7 +298,7 @@ int rtsp_request_options(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+16)); sprintf(buf,"rtsp://%s:%i", s->host, s->port); } rtsp_send_request(s,"OPTIONS",buf); @@ -313,7 +315,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"DESCRIBE",buf); @@ -337,7 +339,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"SET_PARAMETER",buf); @@ -354,7 +356,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); + buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"PLAY",buf); @@ -402,7 +404,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { } /* lets make the server happy */ rtsp_put(s, "RTSP/1.0 451 Parameter Not Understood"); - rest=malloc(sizeof(char)*16); + rest = malloc(sizeof(char)*16); sprintf(rest,"CSeq: %u", seq); rtsp_put(s, rest); rtsp_put(s, ""); @@ -426,14 +428,14 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_agent) { - rtsp_t *s=malloc(sizeof(rtsp_t)); + rtsp_t *s = malloc(sizeof(rtsp_t)); char *mrl_ptr=strdup(mrl); char *slash, *colon; int hostend, pathbegin, i; if (strncmp(mrl,"rtsp://",7)) { - printf("rtsp: bad mrl: %s\n", mrl); + xprintf(stream->xine, XINE_VERBOSITY_LOG, _("rtsp: bad mrl: %s\n"), mrl); free(s); return NULL; } @@ -474,7 +476,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - s->host=malloc(sizeof(char)*hostend+1); + s->host = malloc(sizeof(char)*hostend+1); strncpy(s->host, mrl_ptr, hostend); s->host[hostend]=0; @@ -490,7 +492,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag s->s = _x_io_tcp_connect (stream, s->host, s->port); if (s->s < 0) { - printf ("rtsp: failed to connect to '%s'\n", s->host); + xprintf (stream->xine, XINE_VERBOSITY_LOG, _("rtsp: failed to connect to '%s'\n"), s->host); rtsp_close(s); return NULL; } diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index e49a06b08..af11174d7 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.12 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: rtsp_session.c,v 1.13 2003/12/05 15:54:58 f1rmb Exp $ * * high level interface to rtsp servers. */ @@ -66,7 +66,7 @@ struct rtsp_session_s { rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { - rtsp_session_t *rtsp_session=malloc(sizeof(rtsp_session_t)); + rtsp_session_t *rtsp_session = malloc(sizeof(rtsp_session_t)); char *server; char *mrl_line=strdup(mrl); rmff_header_t *h; @@ -75,10 +75,11 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { connect: /* connect to server */ - rtsp_session->s=rtsp_connect(stream, mrl_line,NULL); + rtsp_session->s=rtsp_connect(stream, mrl_line, NULL); if (!rtsp_session->s) { - printf("rtsp_session: failed to connect to server %s\n", mrl_line); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: failed to connect to server %s\n"), mrl_line); free(rtsp_session); return NULL; } @@ -104,13 +105,14 @@ connect: { free(mrl_line); mrl_line=strdup(rtsp_search_answers(rtsp_session->s, "Location")); - printf("rtsp_session: redirected to %s\n", mrl_line); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "rtsp_session: redirected to %s\n", mrl_line); rtsp_close(rtsp_session->s); free(server); goto connect; /* *shudder* i made a design mistake somewhere */ } else { - printf("rtsp_session: session can not be established.\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: session can not be established.\n")); rtsp_close(rtsp_session->s); free(rtsp_session); return NULL; @@ -125,7 +127,8 @@ connect: } else { - printf("rtsp_session: rtsp server type '%s' not supported yet. sorry.\n",server); + xprintf(stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: rtsp server type '%s' not supported yet. sorry.\n"), server); rtsp_close(rtsp_session->s); free(server); free(rtsp_session); diff --git a/src/input/media_helper.c b/src/input/media_helper.c index ce8f0d701..86a456b3a 100644 --- a/src/input/media_helper.c +++ b/src/input/media_helper.c @@ -79,7 +79,7 @@ static int media_umount_media(const char *device) #endif /* WIN32 */ } -int media_eject_media (const char *device) { +int media_eject_media (xine_t *xine, const char *device) { #ifndef WIN32 int ret, status; @@ -127,10 +127,10 @@ int media_eject_media (const char *device) { #elif defined (__NetBSD__) || defined (__OpenBSD__) || defined (__FreeBSD__) if (ioctl(fd, CDIOCALLOW) == -1) { - perror("ioctl(cdromallow)"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromallow): %s\n", strerror(errno)); } else { if (ioctl(fd, CDIOCEJECT) == -1) { - perror("ioctl(cdromeject)"); + xprintf(xine, XINE_VERBOSITY_DEBUG, "ioctl(cdromeject): %s\n", strerror(errno)); } } @@ -138,7 +138,8 @@ int media_eject_media (const char *device) { close(fd); } else { - printf("input_dvd: Device %s failed to open during eject calls\n",device); + xprintf(xine, XINE_VERBOSITY_LOG, + _("input_dvd: Device %s failed to open during eject calls\n"), device); } return 1; #else diff --git a/src/input/media_helper.h b/src/input/media_helper.h index 48ef7b383..2f6aaee60 100644 --- a/src/input/media_helper.h +++ b/src/input/media_helper.h @@ -19,5 +19,11 @@ * */ -int media_eject_media (const char *device); +#ifndef HAVE_MEDIA_HELPER_H +#define HAVE_MEDIA_HELPER_H +#include "xine_internal.h" + +int media_eject_media (xine_t *xine, const char *device); + +#endif diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 3f3c012d7..f1c06da2e 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.23 2003/12/04 22:07:05 tmattern Exp $ + * $Id: mmsh.c,v 1.24 2003/12/05 15:54:58 f1rmb Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -226,8 +226,7 @@ static int send_command (mmsh_t *this, char *cmd) { length = strlen(cmd); if (_x_io_tcp_write(this->stream, this->s, cmd, length) != length) { - xprintf (this->stream->xine, XINE_LOG_MSG, - "libmmsh: send error\n"); + xprintf (this->stream->xine, XINE_LOG_MSG, _("libmmsh: send error\n")); return 0; } return 1; @@ -272,28 +271,28 @@ static int get_answer (mmsh_t *this) { if (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, &httpcode) != 3) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: bad response format\n")); + _("libmmsh: bad response format\n")); return 0; } if (httpcode >= 300 && httpcode < 400) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: 3xx redirection not implemented: >%d %s<\n"), - httpcode, httpstatus); + _("libmmsh: 3xx redirection not implemented: >%d %s<\n"), + httpcode, httpstatus); return 0; } if (httpcode < 200 || httpcode >= 300) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: http status not 2xx: >%d %s<\n"), - httpcode, httpstatus); + _("libmmsh: http status not 2xx: >%d %s<\n"), + httpcode, httpstatus); return 0; } } else { if (!strncasecmp(this->buf, "Location: ", 10)) { xine_log (this->stream->xine, XINE_LOG_MSG, - _("libmmsh: Location redirection not implemented\n")); + _("libmmsh: Location redirection not implemented\n")); return 0; } @@ -623,14 +622,12 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { if (!_x_parse_url (this->url, &this->proto, &this->host, &this->port, &this->user, &this->password, &this->uri)) { - xine_log (this->stream->xine, XINE_LOG_MSG, - "invalid url\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("invalid url\n")); goto fail; } if (!mmsh_valid_proto(this->proto)) { - xine_log (this->stream->xine, XINE_LOG_MSG, - "unsupported protocol\n"); + xine_log (this->stream->xine, XINE_LOG_MSG, _("unsupported protocol\n")); goto fail; } diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index bb8970e81..0a328d367 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -98,9 +98,7 @@ static void report_progress (xine_stream_t *stream, int p) { } static void nbc_set_speed_pause (xine_stream_t *stream) { -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); -#endif + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_pause\n"); 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) @@ -108,9 +106,7 @@ static void nbc_set_speed_pause (xine_stream_t *stream) { } static void nbc_set_speed_normal (xine_stream_t *stream) { -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); -#endif + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_put_cb: set_speed_normal\n"); 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) @@ -125,22 +121,19 @@ static void display_stats (nbc_t *this) { char *buffering[2] = {" ", "buf"}; char *enabled[2] = {"off", "on "}; - if (this->stream->xine->verbosity >= 2) { - printf("net_buf_ctrl: vid %3d%% %4.1fs %4lldkbps %1d, "\ - "aud %3d%% %4.1fs %4lldkbps %1d, %s %s\r", - this->video_fifo_fill, - (float)(this->video_fifo_length / 1000), - this->video_br / 1000, - this->video_in_disc, - this->audio_fifo_fill, - (float)(this->audio_fifo_length / 1000), - this->audio_br / 1000, - this->audio_in_disc, - buffering[this->buffering], - enabled[this->enabled] - ); - fflush(stdout); - } + printf("net_buf_ctrl: vid %3d%% %4.1fs %4lldkbps %1d, "\ + "aud %3d%% %4.1fs %4lldkbps %1d, %s %s\r", + this->video_fifo_fill, + (float)(this->video_fifo_length / 1000), + this->video_br / 1000, + this->video_in_disc, + this->audio_fifo_fill, + (float)(this->audio_fifo_length / 1000), + this->audio_br / 1000, + this->audio_in_disc, + buffering[this->buffering], + enabled[this->enabled]); + fflush(stdout); } /* Try to compute the length of the fifo in 1/1000 s @@ -361,14 +354,12 @@ static void nbc_put_cb (fifo_buffer_t *fifo, /* discontinuity management */ if (fifo == this->video_fifo) { this->video_in_disc++; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_put_cb video disc %d\n", this->video_in_disc); } else { this->audio_in_disc++; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_put_cb audio disc %d\n", this->audio_in_disc); } break; } @@ -383,7 +374,9 @@ static void nbc_put_cb (fifo_buffer_t *fifo, } - display_stats(this); + if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + display_stats(this); + pthread_mutex_unlock(&this->mutex); } @@ -438,14 +431,12 @@ static void nbc_get_cb (fifo_buffer_t *fifo, if (buf->type == BUF_CONTROL_NEWPTS) { if (fifo == this->video_fifo) { this->video_in_disc--; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_get_cb video disc %d\n", this->video_in_disc); } else { this->audio_in_disc--; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); -#endif + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: nbc_get_cb audio disc %d\n", this->audio_in_disc); } } @@ -457,12 +448,15 @@ static void nbc_get_cb (fifo_buffer_t *fifo, this->audio_fifo_size = fifo->fifo_data_size; } } - display_stats(this); + + if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG) + display_stats(this); + pthread_mutex_unlock(&this->mutex); } nbc_t *nbc_init (xine_stream_t *stream) { - + nbc_t *this = (nbc_t *) malloc (sizeof (nbc_t)); fifo_buffer_t *video_fifo = stream->video_fifo; fifo_buffer_t *audio_fifo = stream->audio_fifo; @@ -511,10 +505,9 @@ nbc_t *nbc_init (xine_stream_t *stream) { void nbc_close (nbc_t *this) { fifo_buffer_t *video_fifo = this->stream->video_fifo; fifo_buffer_t *audio_fifo = this->stream->audio_fifo; + xine_t *xine = this->stream->xine; -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_close\n"); -#endif + xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close\n"); video_fifo->unregister_alloc_cb(video_fifo, nbc_alloc_cb); video_fifo->unregister_put_cb(video_fifo, nbc_put_cb); @@ -535,11 +528,9 @@ void nbc_close (nbc_t *this) { } pthread_mutex_unlock(&this->mutex); - + free (this); -#ifdef LOG - printf("\nnet_buf_ctrl: nbc_close: done\n"); -#endif + xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close: done\n"); } @@ -548,7 +539,8 @@ void nbc_set_high_water_mark(nbc_t *this, int value) { Deprecated this->high_water_mark = value; */ - printf("\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); } void nbc_set_low_water_mark(nbc_t *this, int value) { @@ -556,5 +548,6 @@ void nbc_set_low_water_mark(nbc_t *this, int value) { Deprecated this->low_water_mark = value; */ - printf("\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); } diff --git a/src/input/pnm.c b/src/input/pnm.c index aa814236a..5c66329e0 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.17 2003/11/26 19:43:31 f1rmb Exp $ + * $Id: pnm.c,v 1.18 2003/12/05 15:54:58 f1rmb Exp $ * * pnm protocol implementation * based upon code from joschka @@ -183,7 +183,9 @@ unsigned char after_chunks[]={ +#ifdef LOG static void hexdump (char *buf, int length); +#endif /* * network utilities @@ -191,14 +193,14 @@ static void hexdump (char *buf, int length); * to connect to a host, send and receive data over this connection */ -static int host_connect_attempt(struct in_addr ia, int port) { +static int host_connect_attempt(xine_t *xine, struct in_addr ia, int port) { int s; struct sockaddr_in sin; s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s == -1) { - printf ("input_pnm: socket(): %s\n", strerror(errno)); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_pnm: socket(): %s\n", strerror(errno)); return -1; } @@ -208,7 +210,7 @@ static int host_connect_attempt(struct in_addr ia, int port) { if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) { - printf ("input_pnm: connect(): %s\n", strerror(errno)); + xprintf (xine, XINE_VERBOSITY_DEBUG, "input_pnm: connect(): %s\n", strerror(errno)); close(s); return -1; } @@ -216,14 +218,14 @@ static int host_connect_attempt(struct in_addr ia, int port) { return s; } -static int host_connect(const char *host, int port) { +static int host_connect(xine_t *xine, const char *host, int port) { struct hostent *h; int i, s; h = gethostbyname(host); if (h == NULL) { - printf ("input_pnm: unable to resolve '%s'.\n", host); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_pnm: unable to resolve '%s'.\n"), host); return -1; } @@ -231,11 +233,12 @@ static int host_connect(const char *host, int port) { struct in_addr ia; memcpy (&ia, h->h_addr_list[i], 4); - s = host_connect_attempt(ia, port); + s = host_connect_attempt(xine, ia, port); if(s != -1) return s; } - printf ("input_pnm: unable to connect to '%s'.\n", host); + xprintf (xine, XINE_VERBOSITY_LOG, _("input_pnm: unable to connect to '%s'.\n"), host); + return -1; } @@ -309,7 +312,7 @@ static ssize_t rm_read(pnm_t *p, void *buf, size_t count) { /* * a simple hexdump tool for debugging purposes */ - +#ifdef LOG static void hexdump (char *buf, int length) { int i; @@ -340,6 +343,7 @@ static void hexdump (char *buf, int length) { } printf ("\n"); } +#endif /* * pnm_get_chunk gets a chunk from stream @@ -395,7 +399,7 @@ static unsigned int pnm_get_chunk(pnm_t *p, rm_read (p, ptr, 2); if (*ptr == 'X') /* checking for server message */ { - printf("input_pnm: got a message from server:\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: got a message from server:\n"); rm_read (p, ptr+2, 1); /* two bytes of message length*/ @@ -404,14 +408,14 @@ static unsigned int pnm_get_chunk(pnm_t *p, /* message itself */ rm_read (p, ptr+3, n); ptr[3+n]=0; - printf("%s\n",ptr+3); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "%s\n", ptr+3); return -1; } if (*ptr == 'F') /* checking for server error */ { /* some error codes after 'F' were ignored */ - printf("input_pnm: server error.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: server error.\n"); return -1; } if (*ptr == 'i') /* the server want a response from us. it will be sent after these headers */ @@ -436,10 +440,12 @@ static unsigned int pnm_get_chunk(pnm_t *p, case MDPR_TAG: case CONT_TAG: if (chunk_size > max) { - printf("error: max chunk size exeeded (max was 0x%04x)\n", max); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "error: max chunk size exeeded (max was 0x%04x)\n", max); /* reading some bytes for debugging */ n=rm_read (p, &data[PREAMBLE_SIZE], 0x100 - PREAMBLE_SIZE); +#ifdef LOG hexdump(data,n+PREAMBLE_SIZE); +#endif return -1; } rm_read (p, &data[PREAMBLE_SIZE], chunk_size-PREAMBLE_SIZE); @@ -577,7 +583,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { while(1) { if (HEADER_SIZE-size<=0) { - printf("input_pnm: header buffer overflow. exiting\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: header buffer overflow. exiting\n"); return 0; } chunk_size=pnm_get_chunk(p,HEADER_SIZE-size,&chunk_type,ptr,&nr); @@ -600,7 +606,7 @@ static int pnm_get_headers(pnm_t *p, int *need_response) { } if (!prop_hdr) { - printf("input_pnm: error while parsing headers.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: error while parsing headers.\n"); return 0; } @@ -696,7 +702,8 @@ static int pnm_calc_stream(pnm_t *p) { return 0; break; } - printf("input_pnm: wow, something very nasty happened in pnm_calc_stream\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: wow, something very nasty happened in pnm_calc_stream\n"); return 2; } @@ -741,12 +748,13 @@ static int pnm_get_stream_chunk(pnm_t *p) { rm_read (p, &p->buffer[8], size-5); p->buffer[size+3]=0; - printf("input_pnm: got message from server while reading stream:\n%s\n", &p->buffer[3]); + xprintf(p->stream->xine, XINE_VERBOSITY_LOG, + _("input_pnm: got message from server while reading stream:\n%s\n"), &p->buffer[3]); return 0; } if (p->buffer[0] == 'F') { - printf("input_pnm: server error.\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: server error.\n"); return 0; } @@ -771,8 +779,10 @@ static int pnm_get_stream_chunk(pnm_t *p) { /* check for 'Z's */ if ((p->buffer[0] != 0x5a)||(p->buffer[7] != 0x5a)) { - printf("input_pnm: bad boundaries\n"); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, "input_pnm: bad boundaries\n"); +#ifdef LOG hexdump(p->buffer, 8); +#endif return 0; } @@ -781,7 +791,8 @@ static int pnm_get_stream_chunk(pnm_t *p) { fof2=be2me_16(*(uint16_t*)(&p->buffer[3])); if (fof1 != fof2) { - printf("input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2); + xprintf(p->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pnm: frame offsets are different: 0x%04x 0x%04x\n", fof1, fof2); return 0; } @@ -842,7 +853,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { mrl_ptr+=6; - p=xine_xmalloc(sizeof(pnm_t)); + p = xine_xmalloc(sizeof(pnm_t)); p->stream = stream; p->port=7070; p->url=strdup(mrl); @@ -858,7 +869,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - p->host=malloc(sizeof(char)*hostend+1); + p->host = malloc(sizeof(char)*hostend+1); strncpy(p->host, mrl_ptr, hostend); p->host[hostend]=0; @@ -873,10 +884,10 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { lprintf("got mrl: %s %i %s\n",p->host,p->port,p->path); - fd = host_connect (p->host, p->port); + fd = host_connect (stream->xine, p->host, p->port); if (fd == -1) { - printf ("input_pnm: failed to connect '%s'\n", p->host); + xprintf (p->stream->xine, XINE_VERBOSITY_LOG, _("input_pnm: failed to connect '%s'\n"), p->host); free(p->path); free(p->host); free(p->url); @@ -887,7 +898,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pnm_send_request(p,pnm_available_bandwidths[10]); if (!pnm_get_headers(p, &need_response)) { - printf ("input_pnm: failed to set up stream\n"); + xprintf (p->stream->xine, XINE_VERBOSITY_LOG, _("input_pnm: failed to set up stream\n")); free(p->path); free(p->host); free(p->url); diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c index c3f9069da..56640d7fa 100644 --- a/src/input/vcd/vcdplayer.c +++ b/src/input/vcd/vcdplayer.c @@ -1,5 +1,5 @@ /* - $Id: vcdplayer.c,v 1.1 2003/10/13 11:47:11 f1rmb Exp $ + $Id: vcdplayer.c,v 1.2 2003/12/05 15:54:58 f1rmb Exp $ Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com> @@ -850,7 +850,7 @@ vcdplayer_non_pbc_nav (vcdplayer_input_t *this, uint8_t *buf) return READ_END; break; case VCDINFO_ITEM_TYPE_SPAREID2: - printf("SPAREID2\n"); + /* printf("SPAREID2\n"); */ if (this->in_still) { RETURN_NULL_STILL ; /* Hack: Just go back and do still again */ |