summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/input_cda.c89
-rw-r--r--src/input/input_dvd.c102
-rw-r--r--src/input/input_file.c72
-rw-r--r--src/input/input_http.c103
-rw-r--r--src/input/input_net.c57
-rw-r--r--src/input/input_rtp.c72
-rw-r--r--src/input/input_stdin_fifo.c40
-rw-r--r--src/input/input_vcd.c103
8 files changed, 427 insertions, 211 deletions
diff --git a/src/input/input_cda.c b/src/input/input_cda.c
index e11413ea4..1ac7de2d4 100644
--- a/src/input/input_cda.c
+++ b/src/input/input_cda.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_cda.c,v 1.12 2001/12/14 21:03:03 f1rmb Exp $
+ * $Id: input_cda.c,v 1.13 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -69,6 +69,8 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
/*
#define DEBUG_DISC
#define DEBUG_POS
@@ -83,6 +85,26 @@
#define _LEAVE_FUNC()
#endif
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define CDROM "/vol/dev/aliases/cdrom0"
#else
@@ -115,6 +137,7 @@ typedef struct {
} trackinfo_t;
typedef struct {
+ xine_t *xine;
int fd;
char *device_name;
int cur_track;
@@ -435,7 +458,7 @@ static int _cda_load_cached_cddb_infos(cda_input_plugin_t *this) {
sprintf(cdir, "%s/%s", cdir, discid);
if((fd = fopen(cdir, "r")) == NULL) {
- fprintf(stderr, "input_cda: fopen(%s) failed: %s\n", cdir, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("input_cda: fopen(%s) failed: %s\n"), cdir, strerror(errno));
closedir(dir);
return 0;
}
@@ -493,7 +516,7 @@ static void _cda_save_cached_cddb_infos(cda_input_plugin_t *this, char *filecont
sprintf(cfile, "%s/%08lx", this->cddb.cache_dir, this->cda->disc_id);
if((fd = fopen(cfile, "w")) == NULL) {
- fprintf(stderr, "input_cda: fopen(%s) failed: %s\n", cfile, strerror(errno));
+ LOG_MSG(this->xine, _("input_cda: fopen(%s) failed: %s\n"), cfile, strerror(errno));
return;
}
else {
@@ -583,12 +606,12 @@ static void _cda_cddb_retrieve(cda_input_plugin_t *this) {
this->cddb.fd = _cda_cddb_socket_open(this);
if(this->cddb.fd >= 0) {
- printf("input_cda: server '%s:%d' successfuly connected.\n",
+ LOG_MSG(this->xine, _("input_cda: server '%s:%d' successfuly connected.\n"),
this->cddb.server, this->cddb.port);
}
else {
- printf("input_cda: opening server '%s:%d' failed: %s\n",
+ LOG_MSG(this->xine, _("input_cda: opening server '%s:%d' failed: %s\n"),
this->cddb.server, this->cddb.port, strerror(errno));
this->cda->have_cddb_info = 0;
return;
@@ -757,7 +780,7 @@ static int _cda_is_cd_changed(cdainfo_t *cda) {
return -1;
if((err = ioctl(cda->fd, CDROM_MEDIA_CHANGED, cd_changed)) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("input_cda: ioctl(CDROM_MEDIA_CHANGED) failed: %s.\n"), strerror(errno));
return -1;
}
@@ -824,7 +847,7 @@ static int _cda_get_status_cd(cdainfo_t *cda) {
if(ioctl(cda->fd, CDROMSUBCHNL, &sc) < 0) {
#endif
- fprintf(stderr, "input_cda: ioctl(CDROMSUBCHNL) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMSUBCHNL) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -959,25 +982,25 @@ static int _cda_play_chunk_cd(cdainfo_t *cda, int start, int end) {
#ifdef CDIOCSTART
if(ioctl(cda->fd, CDIOCSTART) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOCSTART) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOCSTART) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDROMSTART
if (ioctl(cda->fd, CDROMSTART)) {
- fprintf(stderr, "input_cda: ioctl(CDROMSTART) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMSTART) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDIOCPLAYMSF
if(ioctl(cda->fd, CDIOCPLAYMSF, (char *)&cdmsf) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOCPLAYMSF) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOCPLAYMSF) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
#ifdef CDROMPLAYMSF
if(ioctl(cda->fd, CDROMPLAYMSF, &msf)) {
- fprintf(stderr, "input_cda: ioctl(CDROMPLAYMSF) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMPLAYMSF) failed: %s.\n"), strerror(errno));
return 0;
}
#endif
@@ -998,10 +1021,10 @@ static int _cda_open_cd(cdainfo_t *cda) {
if((cda->fd = open(cda->device_name, O_RDONLY)) < 0) {
#endif
if(errno == EACCES) {
- fprintf(stderr, "input_cda: No rights to open %s.\n", cda->device_name);
+ LOG_MSG_STDERR(cda->xine, _("input_cda: No rights to open %s.\n"), cda->device_name);
}
else if(errno != ENXIO) {
- fprintf(stderr, "input_cda: open(%s) failed: %s.\n", cda->device_name, strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: open(%s) failed: %s.\n"), cda->device_name, strerror(errno));
}
return 0;
@@ -1095,33 +1118,33 @@ static int _cda_eject_cd(cdainfo_t *cda) {
switch(status) {
case CDS_TRAY_OPEN:
if((err = ioctl(cda->fd, CDROMCLOSETRAY)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMCLOSETRAY) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMCLOSETRAY) failed: %s\n"), strerror(errno));
}
break;
case CDS_DISC_OK:
if((err = ioctl(cda->fd, CDROMEJECT)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- fprintf(stderr, "input_cda: ioctl(CDROM_DRIVE_STATUS) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROM_DRIVE_STATUS) failed: %s\n"), strerror(errno));
_cda_close_cd(cda);
return 0;
}
#elif defined (__FreeBSD__)
if(ioctl(cda->fd, CDIOCALLOW) == -1) {
- fprintf(stderr, "input_cda: ioctl(CDROMALLOW) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMALLOW) failed: %s\n"), strerror(errno));
}
else {
if(ioctl(cda->fd, CDIOCEJECT) == -1) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
}
#elif defined (__sun)
if((err = ioctl(cda->fd, CDROMEJECT)) != 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMEJECT) failed: %s\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMEJECT) failed: %s\n"), strerror(errno));
}
#endif
@@ -1152,7 +1175,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
#ifdef CDIOREADTOCHEADER
if(ioctl(cda->fd, CDIOREADTOCHEADER, (char *)&cdth) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOREADTOCHEADER) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOREADTOCHEADER) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1160,7 +1183,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
#endif
#ifdef CDROMREADTOCHDR
if(ioctl(cda->fd, CDROMREADTOCHDR, &hdr) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDROMREADTOCHDR) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMREADTOCHDR) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1197,7 +1220,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
cdte.data_len = sizeof(toc_buffer);
if(ioctl(cda->fd, CDIOREADTOCENTRYS, (char *)&cdte) < 0) {
- fprintf(stderr, "input_cda: ioctl(CDIOREADTOCENTRYS) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDIOREADTOCENTRYS) failed: %s.\n"), strerror(errno));
return 0;
}
@@ -1220,7 +1243,7 @@ static int _cda_read_toc_cd(cdainfo_t *cda) {
entry.cdte_format = CDROM_MSF;
if(ioctl(cda->fd, CDROMREADTOCENTRY, &entry)) {
- fprintf(stderr, "input_cda: ioctl(CDROMREADTOCENTRY) failed: %s.\n", strerror(errno));
+ LOG_MSG_STDERR(cda->xine, _("input_cda: ioctl(CDROMREADTOCENTRY) failed: %s.\n"), strerror(errno));
return 0;
}
cda->track[i].track = i + 1;
@@ -1402,13 +1425,13 @@ static int cda_plugin_open (input_plugin_t *this_gen, char *mrl) {
filename = (char *) &mrl[6];
if(sscanf(filename, "%d", &this->cda->cur_track) != 1) {
- fprintf(stderr, "input_cda: malformed MRL. Use cda://<track #>\n");
+ LOG_MSG_STDERR(this->xine, _("input_cda: malformed MRL. Use cda://<track #>\n"));
_cda_free_cda(this->cda);
return 0;
}
if((!this->cda->cur_track) || (this->cda->cur_track > this->cda->num_tracks)) {
- fprintf(stderr, "input_cda: invalid track %d (valid range: 1 .. %d)\n",
+ LOG_MSG_STDERR(this->xine, _("input_cda: invalid track %d (valid range: 1 .. %d)\n"),
this->cda->cur_track, this->cda->num_tracks - 1);
_cda_free_cda(this->cda);
return 0;
@@ -1491,7 +1514,7 @@ static off_t cda_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
break;
default:
- fprintf (stderr, "input_cda: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_cda: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -1604,7 +1627,7 @@ static void cda_plugin_stop (input_plugin_t *this_gen) {
static char *cda_plugin_get_description (input_plugin_t *this_gen) {
_ENTER_FUNC();
_LEAVE_FUNC();
- return "cd audio plugin as shipped with xine";
+ return _("cd audio plugin as shipped with xine");
}
/*
@@ -1778,11 +1801,12 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
_ENTER_FUNC();
if (iface != 5) {
- printf("cda input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("cda input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
@@ -1819,6 +1843,7 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
this->mrl = NULL;
this->cda = (cdainfo_t *) xine_xmalloc(sizeof(cdainfo_t));
+ this->cda->xine = xine;
this->cda->cur_track = -1;
this->cda->cur_pos = -1;
diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c
index ddd20e73b..2edd6992f 100644
--- a/src/input/input_dvd.c
+++ b/src/input/input_dvd.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_dvd.c,v 1.40 2001/12/16 13:38:42 miguelfreitas Exp $
+ * $Id: input_dvd.c,v 1.41 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -52,6 +52,28 @@
#include "dvd_udf.h"
#include "read_cache.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define RDVD "/vol/dev/aliases/cdrom0"
#define DVD RDVD
@@ -63,6 +85,8 @@
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
char *mrl;
config_values_t *config;
@@ -118,7 +142,7 @@ static int openDrive (dvd_input_plugin_t *this) {
this->dvd_fd = open(this->device, O_RDONLY /* | O_NONBLOCK */ );
if (this->dvd_fd < 0) {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
return -1;
}
@@ -215,11 +239,11 @@ dvd_read_copyright(int fd, dvd_struct *s)
memset(buf, 0, sizeof(buf));
if (ioctl(fd, USCSICMD, &sc)) {
- perror("USCSICMD dvd_read_copyright");
+ LOG_MSG(this->xine, _("USCSICMD dvd_read_copyright: %s"), strerror(errno));
return -1;
}
if (sc.uscsi_status) {
- fprintf(stderr, "bad status: READ DVD STRUCTURE (copyright)\n");
+ LOG_MSG_STDERR(this->xine, _("bad status: READ DVD STRUCTURE (copyright)\n"));
return -1;
}
@@ -273,7 +297,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
int encrypted=0;
if (openDrive(this) < 0) {
- printf ("input_dvd: cannot open dvd drive >%s<\n", this->device);
+ LOG_MSG(this->xine, _("input_dvd: cannot open dvd drive >%s<\n"), this->device);
return 0;
}
@@ -284,7 +308,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.copyright.type = DVD_STRUCT_COPYRIGHT;
dvd.copyright.layer_num = 0;
if (ioctl (this->dvd_fd, DVD_READ_STRUCT, &dvd) < 0) {
- printf ("input_dvd: Could not read Copyright Structure\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure\n"));
return 0;
}
encrypted = (dvd.copyright.cpst != 0) ;
@@ -297,7 +321,7 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.layer_num = 0;
if (ioctl(this->dvd_fd, DVDIOCREADSTRUCTURE, &dvd) < 0) {
- printf ("input_dvd: Could not read Copyright Structure\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure\n"));
return 0;
}
@@ -310,23 +334,24 @@ static int openDVDFile (dvd_input_plugin_t *this,
dvd.copyright.type = DVD_STRUCT_COPYRIGHT;
dvd.copyright.layer_num = 0;
if (dvd_read_copyright(this->raw_fd, &dvd) < 0)
- printf ("input_dvd: Could not read Copyright Structure.\n"
- " Assuming disk is not encrypted.\n");
+ LOG_MSG(this->xine, _("input_dvd: Could not read Copyright Structure.\n"
+ " Assuming disk is not encrypted.\n"));
else
encrypted = (dvd.copyright.cpst != 0);
}
#endif
if( encrypted ) {
- printf("\ninput_dvd: Sorry, xine doesn't play encrypted DVDs. The legal status of CSS\n"
- " decryption is unclear and we will not provide such code.\n\n");
+ LOG_MSG(this->xine,
+ _("\ninput_dvd: Sorry, xine doesn't play encrypted DVDs. The legal status of CSS\n"
+ " decryption is unclear and we will not provide such code.\n\n"));
return 0;
}
snprintf (str, sizeof(str), "/VIDEO_TS/%s", filename);
if (!(lbnum = UDFFindFile(this->dvd_fd, str, size))) {
- printf ("input_dvd: cannot open file >%s<\n", filename);
+ LOG_MSG(this->xine, _("input_dvd: cannot open file >%s<\n"), filename);
closeDrive (this);
@@ -371,7 +396,7 @@ static int dvd_plugin_open (input_plugin_t *this_gen, char *mrl) {
this->file_lbcur = this->file_lbstart;
if (!this->file_lbstart) {
- printf ("input_dvd: Unable to find >%s< on dvd.\n", filename);
+ LOG_MSG(this->xine, _("input_dvd: Unable to find >%s< on dvd.\n"), filename);
return 0;
}
@@ -406,7 +431,7 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen,
if (nlen != DVD_VIDEO_LB_LEN) {
- printf ("input_dvd: error read: %Ld bytes is not a sector!\n",
+ LOG_MSG(this->xine, _("input_dvd: error read: %Ld bytes is not a sector!\n"),
nlen);
return 0;
@@ -422,12 +447,14 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen,
this->file_size_left -= DVD_VIDEO_LB_LEN;
return DVD_VIDEO_LB_LEN;
- } else if (bytes_read < 0)
- printf ("input_dvd: read error in input_dvd plugin (%s)\n",
+ } else if (bytes_read < 0) {
+ LOG_MSG(this->xine, _("input_dvd: read error in input_dvd plugin (%s)\n"),
strerror (errno));
- else
- printf ("input_dvd: short read in input_dvd (%d != %d)\n",
+ }
+ else {
+ LOG_MSG(this->xine, _("input_dvd: short read in input_dvd (%d != %d)\n"),
bytes_read, DVD_VIDEO_LB_LEN);
+ }
return 0;
}
@@ -443,8 +470,9 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
* at STAGE_BY_CONTENT probe stage
*/
if(nlen != DVD_VIDEO_LB_LEN)
- printf ("input_dvd: error in input_dvd plugin read: %Ld bytes "
- "is not a sector!\n", nlen);
+ LOG_MSG(this->xine,
+ _("input_dvd: error in input_dvd plugin read: %Ld bytes "
+ "is not a sector!\n"), nlen);
return NULL;
}
@@ -455,7 +483,7 @@ static buf_element_t *dvd_plugin_read_block (input_plugin_t *this_gen,
buf->type = BUF_DEMUX_BLOCK;
} else {
- printf ("input_dvd: read error in input_dvd plugin\n");
+ LOG_MSG(this->xine, _("input_dvd: read error in input_dvd plugin\n"));
}
@@ -488,7 +516,7 @@ static off_t dvd_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin
break;
default:
- printf ("input_dvd: seek: %d is an unknown origin\n", origin);
+ LOG_MSG(this->xine, _("input_dvd: seek: %d is an unknown origin\n"), origin);
}
return lseek (this->raw_fd,
@@ -529,19 +557,19 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) {
switch(status) {
case CDS_TRAY_OPEN:
if((ret = ioctl(fd, CDROMCLOSETRAY)) != 0) {
- printf ("input_dvd: CDROMCLOSETRAY failed: %s\n",
+ LOG_MSG(this->xine, _("input_dvd: CDROMCLOSETRAY failed: %s\n"),
strerror(errno));
}
break;
case CDS_DISC_OK:
if((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf ("input_dvd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_dvd: CDROMEJECT failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- printf ("input_dvd: CDROM_DRIVE_STATUS failed: %s\n",
+ LOG_MSG(this->xine, _("input_dvd: CDROM_DRIVE_STATUS failed: %s\n"),
strerror(errno));
close(fd);
return 0;
@@ -552,15 +580,15 @@ static int dvd_plugin_eject_media (input_plugin_t *this_gen) {
# if defined (__sun)
status = 0;
if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf("input_dvd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_dvd: CDROMEJECT failed: %s\n"), strerror(errno));
}
# else
if (ioctl(fd, CDIOCALLOW) == -1) {
- perror("ioctl(cdromallow)");
+ LOG_MSG(this->xine, _("ioctl(cdromallow): %s"), strerror(errno));
} else {
if (ioctl(fd, CDIOCEJECT) == -1) {
- perror("ioctl(cdromeject)");
+ LOG_MSG(this->xine, _("ioctl(cdromeject): %s"), strerror(errno));
}
}
# endif
@@ -587,7 +615,7 @@ static void dvd_plugin_stop (input_plugin_t *this_gen) {
static char *dvd_plugin_get_description (input_plugin_t *this_gen) {
- return "dvd device input plugin as shipped with xine";
+ return _("dvd device input plugin as shipped with xine");
}
@@ -661,7 +689,7 @@ static mrl_t **dvd_plugin_get_dir (input_plugin_t *this_gen,
}
else {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
return NULL;
}
@@ -721,7 +749,7 @@ static char **dvd_plugin_get_autoplay_list (input_plugin_t *this_gen,
close (fd);
} else {
- printf ("input_dvd: unable to open dvd drive (%s): %s\n",
+ LOG_MSG(this->xine, _("input_dvd: unable to open dvd drive (%s): %s\n"),
this->device, strerror(errno));
*nFiles = 0;
return NULL;
@@ -766,16 +794,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int i;
if (iface != 5) {
- printf("dvd input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("dvd input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (dvd_input_plugin_t *) xine_xmalloc (sizeof (dvd_input_plugin_t));
config = xine->config;
+ this->xine = xine;
for (i = 0; i < MAX_DIR_ENTRIES; i++) {
this->filelist[i] = (char *) xine_xmalloc(sizeof(char *) * 256);
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 2003cd546..d06833df0 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.35 2001/12/14 21:03:03 f1rmb Exp $
+ * $Id: input_file.c,v 1.36 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -43,6 +43,26 @@ extern int errno;
#define MAXFILES 65535
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#ifndef S_ISLNK
#define S_ISLNK(mode) 0
#endif
@@ -67,6 +87,8 @@ extern int errno;
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
int show_hidden_files;
@@ -175,7 +197,7 @@ static int _sortfiles_default(const mrl_t *s1, const mrl_t *s2) {
/*
* Return the type (OR'ed) of the given file *fully named*
*/
-static uint32_t get_file_type(char *filepathname, char *origin) {
+static uint32_t get_file_type(char *filepathname, char *origin, xine_t *xine) {
struct stat pstat;
int mode;
uint32_t file_type = 0;
@@ -184,7 +206,7 @@ static uint32_t get_file_type(char *filepathname, char *origin) {
if((lstat(filepathname, &pstat)) < 0) {
sprintf(buf, "%s/%s", origin, filepathname);
if((lstat(buf, &pstat)) < 0) {
- printf("lstat failed for %s{%s}\n", filepathname, origin);
+ LOG_MSG(xine, _("lstat failed for %s{%s}\n"), filepathname, origin);
file_type |= mrl_unknown;
return file_type;
}
@@ -267,7 +289,7 @@ static int file_plugin_open (input_plugin_t *this_gen, char *mrl) {
*subtitle = 0;
subtitle++;
- printf ("input_file: trying to open subtitle file '%s'\n",
+ LOG_MSG(this->xine, _("input_file: trying to open subtitle file '%s'\n"),
subtitle);
this->sub = fopen (subtitle, "r");
@@ -325,7 +347,7 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes <= 0) {
if (num_bytes < 0)
- fprintf (stderr, "input_file: read error (%s)\n", strerror (errno));
+ LOG_MSG_STDERR(this->xine, _("input_file: read error (%s)\n"), strerror(errno));
buf->free_buffer (buf);
buf = NULL;
break;
@@ -469,7 +491,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(dir_files[num_dir_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
dir_files[num_dir_files].link = NULL;
- dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir);
+ dir_files[num_dir_files].type = get_file_type(fullfilename, current_dir, this->xine);
dir_files[num_dir_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -481,13 +503,13 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
dir_files[num_dir_files].link = (char *) xine_xmalloc(linksize + 1);
strncpy(dir_files[num_dir_files].link, linkbuf, linksize);
- dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir);
+ dir_files[num_dir_files].type |= get_file_type(dir_files[num_dir_files].link, current_dir, this->xine);
}
}
@@ -508,7 +530,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(hide_files[num_hide_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
hide_files[num_hide_files].link = NULL;
- hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir);
+ hide_files[num_hide_files].type = get_file_type(fullfilename, current_dir, this->xine);
hide_files[num_hide_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -520,14 +542,14 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
hide_files[num_hide_files].link = (char *)
xine_xmalloc(linksize + 1);
strncpy(hide_files[num_hide_files].link, linkbuf, linksize);
- hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir);
+ hide_files[num_hide_files].type |= get_file_type(hide_files[num_hide_files].link, current_dir, this->xine);
}
}
@@ -544,7 +566,7 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
sprintf(norm_files[num_norm_files].mrl, "%s%s",
current_dir_slashed, pdirent->d_name);
norm_files[num_norm_files].link = NULL;
- norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir);
+ norm_files[num_norm_files].type = get_file_type(fullfilename, current_dir, this->xine);
norm_files[num_norm_files].size = get_file_size(fullfilename, current_dir);
/* The file is a link, follow it */
@@ -556,14 +578,14 @@ static mrl_t **file_plugin_get_dir (input_plugin_t *this_gen,
linksize = readlink(fullfilename, linkbuf, XINE_PATH_MAX + XINE_NAME_MAX);
if(linksize < 0) {
- fprintf(stderr, "%s(%d): readlink() failed: %s\n",
- __XINE_FUNCTION__, __LINE__, strerror(errno));
+ LOG_MSG_STDERR(this->xine, _("%s(%d): readlink() failed: %s\n"),
+ __XINE_FUNCTION__, __LINE__, strerror(errno));
}
else {
norm_files[num_norm_files].link = (char *)
xine_xmalloc(linksize + 1);
strncpy(norm_files[num_norm_files].link, linkbuf, linksize);
- norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir);
+ norm_files[num_norm_files].type |= get_file_type(norm_files[num_norm_files].link, current_dir, this->xine);
}
}
@@ -744,7 +766,7 @@ static void file_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *file_plugin_get_description (input_plugin_t *this_gen) {
- return "plain file input plugin as shipped with xine";
+ return _("plain file input plugin as shipped with xine");
}
/*
@@ -762,7 +784,7 @@ static int file_plugin_get_optional_data (input_plugin_t *this_gen,
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
- printf ("input_file: get optional data, type %08x, sub %p\n",
+ LOG_MSG(this->xine, _("input_file: get optional data, type %08x, sub %p\n"),
data_type, this->sub);
@@ -791,16 +813,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("file input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("file input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (file_input_plugin_t *) xine_xmalloc (sizeof (file_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = file_plugin_get_capabilities;
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 406d9e41d..cb5cfae38 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -40,12 +40,36 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define BUFSIZE 1024
#define DEFAULT_HTTP_PORT 80
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -74,7 +98,7 @@ typedef struct {
} http_input_plugin_t;
-static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
+static int http_plugin_host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s;
struct sockaddr_in sin;
@@ -82,7 +106,7 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s==-1) {
- printf ("input_http: failed to open socket\n");
+ LOG_MSG(xine, _("input_http: failed to open socket\n"));
return -1;
}
@@ -91,7 +115,7 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
sin.sin_port = htons(port);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS) {
- printf ("input_http: cannot connect to host\n");
+ LOG_MSG(xine, _("input_http: cannot connect to host\n"));
close(s);
return -1;
}
@@ -99,26 +123,26 @@ static int http_plugin_host_connect_attempt(struct in_addr ia, int port) {
return s;
}
-static int http_plugin_host_connect(const char *host, int port) {
+static int http_plugin_host_connect(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
h=gethostbyname(host);
if (h==NULL) {
- printf ("input_http: unable to resolve >%s<\n", host);
+ LOG_MSG(xine, _("input_http: 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=http_plugin_host_connect_attempt(ia, port);
+ s=http_plugin_host_connect_attempt(ia, port, xine);
if(s != -1)
return s;
}
- printf ("http: unable to connect to >%s<\n", host);
+ LOG_MSG(xine, _("http: unable to connect to >%s<\n"), host);
return -1;
}
@@ -312,16 +336,23 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE))
return 0;
- printf ("input_http: opening >/%s< on host >%s<", this->filename, this->host);
- if(proxy != NULL)
- printf (" via proxy >%s<", this->proxyhost);
-
- printf ("\n");
+ {
+ char buf[256];
+
+ sprintf(buf, _("input_http: opening >/%s< on host >%s<"), this->filename, this->host);
+
+ if(proxy != NULL)
+ sprintf(buf, _("%s via proxy >%s<"), buf, this->proxyhost);
+
+ sprintf(buf, "%s\n", buf);
+
+ LOG_MSG(this->xine, buf);
+ }
if (proxy != NULL)
- this->fh = http_plugin_host_connect (this->proxyhost, this->proxyport);
+ this->fh = http_plugin_host_connect (this->proxyhost, this->proxyport, this->xine);
else
- this->fh = http_plugin_host_connect (this->host, this->port);
+ this->fh = http_plugin_host_connect (this->host, this->port, this->xine);
this->curpos = 0;
@@ -383,10 +414,10 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
switch (errno) {
case EAGAIN:
- printf ("input_http: EAGAIN\n");
+ LOG_MSG(this->xine, _("input_http: EAGAIN\n"));
continue;
default:
- printf ("input_http: read error\n");
+ LOG_MSG(this->xine, _("input_http: read error\n"));
return 0;
}
}
@@ -403,7 +434,7 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
linenum++;
- printf ("input_http: answer: >%s<\n", this->buf);
+ LOG_MSG(this->xine, _("input_http: answer: >%s<\n"), this->buf);
if (linenum == 1)
{
@@ -411,20 +442,20 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
char httpstatus[BUFSIZE];
if (sscanf(this->buf, "HTTP/%d.%d %d %[^\015\012]", &httpver, &httpsub,
- &httpcode, httpstatus) != 4)
+ &httpcode, httpstatus) != 4)
{
- printf ("input_http: invalid http answer\n");
+ LOG_MSG(this->xine, _("input_http: invalid http answer\n"));
return 0;
}
if (httpcode >= 300 && httpcode < 400) {
- printf ("input_http: 3xx redirection not implemented: >%d %s<\n",
- httpcode, httpstatus);
+ LOG_MSG(this->xine, _("input_http: 3xx redirection not implemented: >%d %s<\n"),
+ httpcode, httpstatus);
return 0;
}
if (httpcode < 200 || httpcode >= 300) {
- printf ("input_http: http status not 2xx: >%d %s<\n", httpcode,
- httpstatus);
+ LOG_MSG(this->xine, _("input_http: http status not 2xx: >%d %s<\n"),
+ httpcode, httpstatus);
return 0;
}
} else {
@@ -432,14 +463,14 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
off_t contentlength;
if (sscanf(this->buf, "Content-Length: %Ld", &contentlength) == 1) {
- printf ("input_http: content length = %Ld bytes\n", contentlength);
+ LOG_MSG(this->xine, _("input_http: content length = %Ld bytes\n"), contentlength);
this->contentlength = contentlength;
}
}
if (!strncasecmp(this->buf, "Location: ", 10))
{
- printf ("input_http: Location redirection not implemented\n");
+ LOG_MSG(this->xine, _("input_http: Location redirection not implemented\n"));
return 0;
}
}
@@ -452,7 +483,7 @@ static int http_plugin_open (input_plugin_t *this_gen, char *mrl) {
len ++;
}
- printf ("input_http: end of headers\n");
+ LOG_MSG(this->xine, _("input_http: end of headers\n"));
return 1;
}
@@ -472,10 +503,10 @@ static off_t http_plugin_read (input_plugin_t *this_gen,
switch (errno) {
case EAGAIN:
- printf ("input_http: EAGAIN\n");
+ LOG_MSG(this->xine, _("input_http: EAGAIN\n"));
continue;
default:
- printf ("input_http: read error\n");
+ LOG_MSG(this->xine, _("input_http: read error\n"));
return 0;
}
}
@@ -513,7 +544,7 @@ static buf_element_t *http_plugin_read_block (input_plugin_t *this_gen, fifo_buf
pthread_testcancel();
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes < 0) {
- printf ("input_http: read error (%s)\n", strerror (errno));
+ LOG_MSG(this->xine, _("input_http: read error (%s)\n"), strerror (errno));
buf->free_buffer (buf);
buf = NULL;
break;
@@ -570,7 +601,7 @@ static void http_plugin_stop (input_plugin_t *this_gen) {
}
static char *http_plugin_get_description (input_plugin_t *this_gen) {
- return "http network stream input plugin";
+ return _("http network stream input plugin");
}
static char *http_plugin_get_identifier (input_plugin_t *this_gen) {
@@ -595,16 +626,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("http input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("http input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (http_input_plugin_t *) xine_xmalloc(sizeof(http_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = http_plugin_get_capabilities;
diff --git a/src/input/input_net.c b/src/input/input_net.c
index fcf0914d9..682a4b784 100644
--- a/src/input/input_net.c
+++ b/src/input/input_net.c
@@ -41,15 +41,38 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
#if !defined(NDELAY) && defined(O_NDELAY)
#define FNDELAY O_NDELAY
#endif
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
#define NET_BS_LEN 2324
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -64,7 +87,7 @@ typedef struct {
/* **************************************************************** */
-static int host_connect_attempt(struct in_addr ia, int port) {
+static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s=socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in sin;
@@ -74,13 +97,13 @@ static int host_connect_attempt(struct in_addr ia, int port) {
if(s==-1)
{
- perror("socket");
+ LOG_MSG_STDERR(xine, _("socket(): %s\n"), strerror(errno));
return -1;
}
if(fcntl(s, F_SETFL, FNDELAY)==-1)
{
- perror("nonblocking");
+ LOG_MSG_STDERR(xine, _("fcntl(nonblocking): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -91,7 +114,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
if(connect(s, (struct sockaddr *)&sin, sizeof(sin))==-1 && errno != EINPROGRESS)
{
- perror("connect");
+ LOG_MSG_STDERR(xine, _("connect(): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -110,7 +133,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
return -1;
case -1:
/* Ermm.. ?? */
- perror("select");
+ LOG_MSG(xine, _("select(): %s\n"), strerror(errno));
close(s);
return -1;
}
@@ -118,7 +141,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(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
@@ -126,7 +149,7 @@ static int host_connect(const char *host, int port) {
h=gethostbyname(host);
if(h==NULL)
{
- fprintf(stderr,"unable to resolve '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to resolve '%s'.\n"), host);
return -1;
}
@@ -135,11 +158,11 @@ 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(ia, port, xine);
if(s != -1)
return s;
}
- fprintf(stderr, "unable to connect to '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to connect to '%s'.\n"), host);
return -1;
}
/* **************************************************************** */
@@ -171,7 +194,7 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) {
sscanf(pptr,"%d", &port);
}
- this->fh = host_connect(filename, port);
+ this->fh = host_connect(filename, port, this->xine);
this->curpos = 0;
if (this->fh == -1) {
@@ -260,7 +283,7 @@ static void net_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *net_plugin_get_description (input_plugin_t *this_gen) {
- return "net input plugin as shipped with xine";
+ return _("net input plugin as shipped with xine");
}
/*
@@ -297,16 +320,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("net input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("net input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (net_input_plugin_t *) xine_xmalloc(sizeof(net_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = net_plugin_get_capabilities;
diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c
index 95ddc4363..9ca25cd0e 100644
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -84,6 +84,28 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#define RTP_BLOCKSIZE 2048
typedef struct _input_buffer {
@@ -96,6 +118,8 @@ typedef struct _input_buffer {
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
char *mrl;
config_values_t *config;
@@ -125,12 +149,12 @@ typedef struct {
/*
*
*/
-static int host_connect_attempt(struct in_addr ia, int port) {
+static int host_connect_attempt(struct in_addr ia, int port, xine_t *xine) {
int s=socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
struct sockaddr_in sin;
if(s==-1) {
- perror("socket");
+ LOG_MSG_STDERR(xine, _("socket(): %s.\n"), strerror(errno));
return -1;
}
@@ -140,7 +164,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
/* datagram socket */
if (bind(s, (struct sockaddr *)&sin, sizeof(sin))) {
- perror("bind failed");
+ LOG_MSG_STDERR(xine, _("bind(): %s.\n"), strerror(errno));
exit(1);
}
/* multicast ? */
@@ -158,7 +182,8 @@ static int host_connect_attempt(struct in_addr ia, int port) {
mreqn.imr_interface.s_addr = INADDR_ANY;
#endif
if (setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,&mreqn,sizeof(mreqn))) {
- perror("setsockopt IP_ADD_MEMBERSHIP failed (multicast kernel?)");
+ LOG_MSG_STDERR(xine, _("setsockopt(IP_ADD_MEMBERSHIP) failed (multicast kernel?): %s.\n"),
+ strerror(errno));
exit(1);
}
}
@@ -169,7 +194,7 @@ static int host_connect_attempt(struct in_addr ia, int port) {
/*
*
*/
-static int host_connect(const char *host, int port) {
+static int host_connect(const char *host, int port, xine_t *xine) {
struct hostent *h;
int i;
int s;
@@ -177,7 +202,7 @@ static int host_connect(const char *host, int port) {
h=gethostbyname(host);
if(h==NULL)
{
- fprintf(stderr,"unable to resolve '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to resolve '%s'.\n"), host);
return -1;
}
@@ -186,11 +211,11 @@ 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(ia, port, xine);
if(s != -1)
return s;
}
- fprintf(stderr, "unable to connect to '%s'.\n", host);
+ LOG_MSG_STDERR(xine, _("unable to connect to '%s'.\n"), host);
return -1;
}
@@ -213,7 +238,7 @@ static void * input_plugin_read_loop(void *arg) {
if (!(*this)->free_buffers) {
(*this)->input_eof = 1;
if (!warned) {
- printf("OUCH - ran out of buffers\n");
+ LOG_MSG((*this)->xine, _("OUCH - ran out of buffers\n"));
warned = 1;
}
pthread_cond_signal(&(*this)->buffer_notempty);
@@ -243,7 +268,8 @@ static void * input_plugin_read_loop(void *arg) {
/* For now - check whether we're dropping input */
if (++seq != *(unsigned short *)buf->buf) {
- printf("OUCH - dropped input packet %d %d\n", seq, *(unsigned short *)buf->buf);
+ LOG_MSG((*this)->xine, _("OUCH - dropped input packet %d %d\n"),
+ seq, *(unsigned short *)buf->buf);
seq = *(unsigned short *)buf->buf;
}
buf->buf[1] = buf->buf[0] = 0;
@@ -282,7 +308,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
if(strncmp(filename, "//", 2)==0)
filename+=2;
- printf ("Opening >%s<\n", filename);
+ LOG_MSG(this->xine, _("Opening >%s<\n"), filename);
pptr=strrchr(filename, ':');
if(pptr)
@@ -293,7 +319,7 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
if (this->fh != -1)
close(this->fh);
- this->fh = host_connect(filename, port);
+ this->fh = host_connect(filename, port, this->xine);
if (this->fh == -1) {
return 0;
@@ -310,8 +336,8 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) {
pthread_attr_setdetachstate(&thread_attrs, PTHREAD_CREATE_DETACHED);
if ((err = pthread_create(&this->reader_thread, &thread_attrs,
input_plugin_read_loop, (void *)&this)) != 0) {
- fprintf (stderr, "input_rtp: can't create new thread (%s)\n",
- strerror(err));
+ LOG_MSG_STDERR(this->xine, _("input_rtp: can't create new thread (%s)\n"),
+ strerror(err));
exit (1);
}
pthread_attr_destroy(&thread_attrs);
@@ -421,7 +447,7 @@ static int rtp_plugin_eject_media (input_plugin_t *this_gen) {
*/
static char *rtp_plugin_get_description (input_plugin_t *this_gen) {
- return "rtp input plugin as shipped with xine";
+ return _("rtp input plugin as shipped with xine");
}
/*
@@ -460,27 +486,29 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int bufn;
if (iface != 5) {
- printf("rtp input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("rtp input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (rtp_input_plugin_t *) xine_xmalloc(sizeof(rtp_input_plugin_t));
config = xine->config;
+ this->xine = xine;
for (bufn = 0; bufn < N_BUFFERS; bufn++) {
input_buffer_t *buf = xine_xmalloc(sizeof(input_buffer_t));
if (!buf) {
- fprintf(stderr, "unable to allocate input buffer.\n");
+ LOG_MSG_STDERR(xine, _("unable to allocate input buffer.\n"));
exit(1);
}
buf->buf = xine_xmalloc(IBUFFER_SIZE);
if (!buf->buf) {
- fprintf(stderr, "unable to allocate input buffer.\n");
+ LOG_MSG_STDERR(xine, _("unable to allocate input buffer.\n"));
exit(1);
}
buf->next = this->free_buffers;
diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
index 06b002b86..0db8e609e 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.17 2001/11/18 03:53:23 guenter Exp $
+ * $Id: input_stdin_fifo.c,v 1.18 2001/12/27 14:30:30 f1rmb Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -40,8 +40,32 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
typedef struct {
input_plugin_t input_plugin;
+
+ xine_t *xine;
int fh;
char *mrl;
@@ -225,7 +249,7 @@ static void stdin_plugin_stop(input_plugin_t *this_gen) {
*
*/
static char *stdin_plugin_get_description (input_plugin_t *this_gen) {
- return "stdin/fifo input plugin as shipped with xine";
+ return _("stdin/fifo input plugin as shipped with xine");
}
/*
@@ -253,16 +277,18 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
config_values_t *config;
if (iface != 5) {
- printf("rtp input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("stdin/fifo input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (stdin_input_plugin_t *) xine_xmalloc(sizeof(stdin_input_plugin_t));
config = xine->config;
+ this->xine = xine;
this->input_plugin.interface_version = INPUT_PLUGIN_IFACE_VERSION;
this->input_plugin.get_capabilities = stdin_plugin_get_capabilities;
diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c
index 99e685398..e86d8b57d 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.33 2001/12/10 12:56:54 f1rmb Exp $
+ * $Id: input_vcd.c,v 1.34 2001/12/27 14:30:30 f1rmb Exp $
*
*/
@@ -51,6 +51,28 @@
#include "xineutils.h"
#include "input_plugin.h"
+extern int errno;
+
+#ifdef __GNUC__
+#define LOG_MSG_STDERR(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ fprintf(stderr, message, ##args); \
+ }
+#define LOG_MSG(xine, message, args...) { \
+ xine_log(xine, XINE_LOG_INPUT, message, ##args); \
+ printf(message, ##args); \
+ }
+#else
+#define LOG_MSG_STDERR(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ fprintf(stderr, __VA_ARGS__); \
+ }
+#define LOG_MSG(xine, ...) { \
+ xine_log(xine, XINE_LOG_INPUT, __VAR_ARGS__); \
+ printf(__VA_ARGS__); \
+ }
+#endif
+
#if defined(__sun)
#define CDROM "/vol/dev/aliases/cdrom0"
#else
@@ -79,6 +101,8 @@ typedef struct {
input_plugin_t input_plugin;
+ xine_t *xine;
+
char *mrl;
config_values_t *config;
@@ -130,7 +154,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
/* read TOC header */
if ( ioctl(this->fd, CDROMREADTOCHDR, &this->tochdr) == -1 ) {
- fprintf (stderr, "input_vcd : error in ioctl CDROMREADTOCHDR\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd : error in ioctl CDROMREADTOCHDR\n"));
return -1;
}
@@ -139,7 +163,8 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
this->tocent[i-1].cdte_track = i;
this->tocent[i-1].cdte_format = CDROM_MSF;
if ( ioctl(this->fd, CDROMREADTOCENTRY, &this->tocent[i-1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n", i);
+ LOG_MSG_STDERR(this->xine,
+ _("input_vcd: error in ioctl CDROMREADTOCENTRY for track %d\n"), i);
return -1;
}
}
@@ -150,7 +175,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
if (ioctl(this->fd, CDROMREADTOCENTRY,
&this->tocent[this->tochdr.cdth_trk1]) == -1 ) {
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in ioctl CDROMREADTOCENTRY for lead-out\n"));
return -1;
}
@@ -166,7 +191,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
/* read TOC header */
if ( ioctl(this->fd, CDIOREADTOCHEADER, &this->tochdr) == -1 ) {
- fprintf (stderr, "input_vcd : error in ioctl CDROMREADTOCHDR\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd : error in ioctl CDROMREADTOCHDR\n"));
return -1;
}
@@ -181,7 +206,7 @@ static int input_vcd_read_toc (vcd_input_plugin_t *this) {
te.data = this->tocent;
if ( ioctl(this->fd, CDIOREADTOCENTRYS, &te) == -1 ){
- fprintf (stderr, "input_vcd: error in ioctl CDROMREADTOCENTRY\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in ioctl CDROMREADTOCENTRY\n"));
return -1;
}
@@ -299,7 +324,7 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data)
return -1;
}
if (sc.uscsi_status) {
- fprintf(stderr, "scsi command failed with status %d\n", sc.uscsi_status);
+ LOG_MSG_STDERR(this->xine, _("scsi command failed with status %d\n"), sc.uscsi_status);
return -1;
}
}
@@ -340,14 +365,14 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) {
filename = (char *) &mrl[6];
if (sscanf (filename, "%d", &this->cur_track) != 1) {
- fprintf (stderr, "input_vcd: malformed MRL. Use vcd://<track #>\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: malformed MRL. Use vcd://<track #>\n"));
close (this->fd);
this->fd = -1;
return 0;
}
if (this->cur_track>=this->total_tracks) {
- fprintf (stderr, "input_vcd: invalid track %d (valid range: 0 .. %d)\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: invalid track %d (valid range: 0 .. %d)\n"),
this->cur_track, this->total_tracks-1);
close (this->fd);
this->fd = -1;
@@ -362,7 +387,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) {
{
int bsize = 2352;
if (ioctl (this->fd, CDRIOCSETBLOCKSIZE, &bsize) == -1) {
- fprintf (stderr, "input_vcd: error in CDRIOCSETBLOCKSIZE %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDRIOCSETBLOCKSIZE %d\n"), errno);
return 0;
}
@@ -412,7 +437,7 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
memcpy (&data, &msf, sizeof (msf));
if (ioctl (this->fd, CDROMREADRAW, &data) == -1) {
- fprintf (stderr, "input_vcd: error in CDROMREADRAW\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDROMREADRAW\n"));
return 0;
}
@@ -447,11 +472,11 @@ static off_t vcd_plugin_read (input_plugin_t *this_gen,
do {
if (lseek (this->fd, this->cur_sector * bsize, SEEK_SET) == -1) {
- fprintf (stderr, "input_vcd: seek error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: seek error %d\n"), errno);
return 0;
}
if (read (this->fd, &data, bsize) == -1) {
- fprintf (stderr, "input_vcd: read error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read error %d\n"), errno);
return 0;
}
this->cur_sector++;
@@ -488,7 +513,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) {
- fprintf(stderr, "input_vcd: read data failed\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read data failed\n"));
return 0;
}
@@ -549,7 +574,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) {
- fprintf (stderr, "input_vcd: error in CDROMREADRAW\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error in CDROMREADRAW\n"));
return NULL;
}
@@ -589,11 +614,11 @@ static buf_element_t *vcd_plugin_read_block (input_plugin_t *this_gen,
do {
if (lseek (this->fd, this->cur_sector * bsize, SEEK_SET) == -1) {
- fprintf (stderr, "input_vcd: seek error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: seek error %d\n"), errno);
return NULL;
}
if (read (this->fd, &data, bsize) == -1) {
- fprintf (stderr, "input_vcd: read error %d\n", errno);
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read error %d\n"), errno);
return NULL;
}
this->cur_sector++;
@@ -635,7 +660,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) {
- fprintf (stderr, "input_vcd: read data failed\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: read data failed\n"));
return NULL;
}
@@ -706,7 +731,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
case SEEK_CUR:
if (offset)
- fprintf (stderr, "input_vcd: SEEK_CUR not implemented for offset != 0\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: SEEK_CUR not implemented for offset != 0\n"));
/*
printf ("input_vcd: current pos: %02d:%02d:%02d\n",
@@ -724,7 +749,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
default:
- fprintf (stderr, "input_vcd: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -757,7 +782,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
case SEEK_CUR:
if (offset)
- fprintf (stderr, "input_vcd: SEEK_CUR not implemented for offset != 0\n");
+ LOG_MSG_STDERR(this->xine, _("input_vcd: SEEK_CUR not implemented for offset != 0\n"));
sector_pos = this->cur_sector;
@@ -765,7 +790,7 @@ static off_t vcd_plugin_seek (input_plugin_t *this_gen,
break;
default:
- fprintf (stderr, "input_vcd: error seek to origin %d not implemented!\n",
+ LOG_MSG_STDERR(this->xine, _("input_vcd: error seek to origin %d not implemented!\n"),
origin);
return 0;
}
@@ -858,18 +883,18 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
switch(status) {
case CDS_TRAY_OPEN:
if((ret = ioctl(this->fd, CDROMCLOSETRAY)) != 0) {
- printf ("input_vcd: CDROMCLOSETRAY failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMCLOSETRAY failed: %s\n"), strerror(errno));
}
break;
case CDS_DISC_OK:
if((ret = ioctl(this->fd, CDROMEJECT)) != 0) {
- printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMEJECT failed: %s\n"), strerror(errno));
}
break;
}
}
else {
- printf ("input_vcd: CDROM_DRIVE_STATUS failed: %s\n",
+ LOG_MSG(this->xine, _("input_vcd: CDROM_DRIVE_STATUS failed: %s\n"),
strerror(errno));
close(this->fd);
return 0;
@@ -905,7 +930,7 @@ static int vcd_plugin_eject_media (input_plugin_t *this_gen) {
if ((fd = open(this->device, O_RDONLY|O_NONBLOCK)) > -1) {
if ((ret = ioctl(fd, CDROMEJECT)) != 0) {
- printf ("input_vcd: CDROMEJECT failed: %s\n", strerror(errno));
+ LOG_MSG(this->xine, _("input_vcd: CDROMEJECT failed: %s\n"), strerror(errno));
}
close(fd);
}
@@ -935,7 +960,7 @@ static void vcd_plugin_stop (input_plugin_t *this_gen) {
*
*/
static char *vcd_plugin_get_description (input_plugin_t *this_gen) {
- return "plain file input plugin as shipped with xine";
+ return _("plain file input plugin as shipped with xine");
}
/*
@@ -963,8 +988,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
this->fd = open (this->device, O_RDONLY);
if (this->fd == -1) {
- fprintf(stderr, "unable to open %s: ", this->device);
- perror ("");
+ LOG_MSG_STDERR(this->xine, _("unable to open %s: %s.\n"), this->device, strerror(errno));
return NULL;
}
@@ -972,7 +996,7 @@ static mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen,
close (this->fd);
this->fd = -1;
- printf ("vcd_read_toc failed\n");
+ LOG_MSG(this->xine, _("vcd_read_toc failed\n"));
return NULL;
}
@@ -1044,8 +1068,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen,
this->fd = open (this->device, O_RDONLY);
if (this->fd == -1) {
- fprintf(stderr, "unable to open %s: ", this->device);
- perror ("");
+ LOG_MSG_STDERR(this->xine, _("unable to open %s: %s."), this->device, strerror(errno));
return NULL;
}
@@ -1053,7 +1076,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen,
close (this->fd);
this->fd = -1;
- printf ("vcd_read_toc failed\n");
+ LOG_MSG(this->xine, _("vcd_read_toc failed\n"));
return NULL;
}
@@ -1108,17 +1131,19 @@ input_plugin_t *init_input_plugin (int iface, xine_t *xine) {
int i;
if (iface != 5) {
- printf("vcd input plugin doesn't support plugin API version %d.\n"
- "PLUGIN DISABLED.\n"
- "This means there's a version mismatch between xine and this input"
- "plugin.\nInstalling current input plugins should help.\n",
- iface);
+ LOG_MSG(xine,
+ _("vcd input plugin doesn't support plugin API version %d.\n"
+ "PLUGIN DISABLED.\n"
+ "This means there's a version mismatch between xine and this input"
+ "plugin.\nInstalling current input plugins should help.\n"),
+ iface);
return NULL;
}
this = (vcd_input_plugin_t *) xine_xmalloc(sizeof(vcd_input_plugin_t));
config = xine->config;
-
+ this->xine = xine;
+
for (i = 0; i < 100; i++) {
this->filelist[i] = (char *) xine_xmalloc(sizeof(char *) * 256);
}