diff options
Diffstat (limited to 'src/input')
52 files changed, 616 insertions, 297 deletions
diff --git a/src/input/.cvsignore b/src/input/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/.cvsignore +++ b/src/input/.hgignore diff --git a/src/input/Makefile.am b/src/input/Makefile.am index c0924f829..68adf84be 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -77,17 +77,17 @@ xineplug_inp_file_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_file_la_LDFLAGS = -avoid-version -module xineplug_inp_dvd_la_SOURCES = input_dvd.c media_helper.c -xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(THREAD_LIBS) +xineplug_inp_dvd_la_LIBADD = $(XINE_LIB) $(link_dvdnav) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) xineplug_inp_dvd_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvd_la_LDFLAGS = -avoid-version -module xineplug_inp_net_la_SOURCES = input_net.c net_buf_ctrl.c -xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_net_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_net_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_net_la_LDFLAGS = -avoid-version -module xineplug_inp_mms_la_SOURCES = input_mms.c net_buf_ctrl.c mms.c mmsh.c http_helper.c ../demuxers/asfheader.c -xineplug_inp_mms_la_LIBADD = $(XINE_LIB) @LIBICONV@ $(THREAD_LIBS) +xineplug_inp_mms_la_LIBADD = $(XINE_LIB) @LIBICONV@ $(PTHREAD_LIBS) xineplug_inp_mms_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_mms_la_LDFLAGS = -avoid-version -module @@ -97,32 +97,32 @@ xineplug_inp_vcdo_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_vcdo_la_LDFLAGS = -avoid-version -module xineplug_inp_stdin_fifo_la_SOURCES = input_stdin_fifo.c net_buf_ctrl.c -xineplug_inp_stdin_fifo_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_stdin_fifo_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_stdin_fifo_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_stdin_fifo_la_LDFLAGS = -avoid-version -module xineplug_inp_rtp_la_SOURCES = input_rtp.c net_buf_ctrl.c -xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_rtp_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_rtp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtp_la_LDFLAGS = -avoid-version -module xineplug_inp_http_la_SOURCES = input_http.c net_buf_ctrl.c http_helper.c -xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_http_la_LIBADD = $(XINE_LIB) $(NET_LIBS) $(PTHREAD_LIBS) xineplug_inp_http_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_http_la_LDFLAGS = -avoid-version -module xineplug_inp_pnm_la_SOURCES = input_pnm.c net_buf_ctrl.c pnm.c -xineplug_inp_pnm_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_pnm_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_pnm_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pnm_la_LDFLAGS = -avoid-version -module xineplug_inp_dvb_la_SOURCES = input_dvb.c net_buf_ctrl.c -xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_dvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_dvb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_dvb_la_LDFLAGS = -avoid-version -module xineplug_inp_rtsp_la_SOURCES = input_rtsp.c net_buf_ctrl.c -xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(THREAD_LIBS) libreal/libreal.la librtsp/librtsp.la +xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) libreal/libreal.la librtsp/librtsp.la xineplug_inp_rtsp_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_rtsp_la_LDFLAGS = -avoid-version -module @@ -137,7 +137,7 @@ xineplug_inp_v4l_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_v4l_la_LDFLAGS = -avoid-version -module xineplug_inp_gnome_vfs_la_SOURCES = input_gnome_vfs.c net_buf_ctrl.c -xineplug_inp_gnome_vfs_la_LIBADD = $(GNOME_VFS_LIBS) $(XINE_LIB) $(THREAD_LIBS) +xineplug_inp_gnome_vfs_la_LIBADD = $(GNOME_VFS_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_gnome_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_gnome_vfs_la_LDFLAGS = -avoid-version -module @@ -147,10 +147,10 @@ xineplug_inp_smb_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_smb_la_LDFLAGS = -avoid-version -module xineplug_inp_pvr_la_SOURCES = input_pvr.c -xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) +xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) xineplug_inp_pvr_la_CFLAGS = $(VISIBILITY_FLAG) $(AM_CFLAGS) xineplug_inp_pvr_la_LDFLAGS = -avoid-version -module -include_HEADERS = input_plugin.h +xineinclude_HEADERS = input_plugin.h noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h videodev2.h http_helper.h diff --git a/src/input/dvb/.cvsignore b/src/input/dvb/.hgignore index 282522db0..282522db0 100644 --- a/src/input/dvb/.cvsignore +++ b/src/input/dvb/.hgignore diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index f51ffc646..d21c8e4db 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.90 2006/08/11 21:40:02 dsalt Exp $ + * $Id: input_cdda.c,v 1.94 2007/03/10 00:48:59 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -86,6 +86,7 @@ #define CD_FRAMES_PER_SECOND 75 #define CD_RAW_FRAME_SIZE 2352 #define CD_LEADOUT_TRACK 0xAA +#define CD_BLOCK_OFFSET 150 typedef struct _cdrom_toc_entry { int track_mode; @@ -613,14 +614,20 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f return 0; } -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) #include <sys/cdio.h> +#include <sys/scsiio.h> static int read_cdrom_toc(int fd, cdrom_toc *toc) { struct ioc_toc_header tochdr; +#if defined(__FreeBSD__) struct ioc_read_toc_single_entry tocentry; +#elif defined(__NetBSD__) + struct ioc_read_toc_entry tocentry; + struct cd_toc_entry data; +#endif int i; /* fetch the table of contents */ @@ -646,13 +653,26 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { memset(&tocentry, 0, sizeof(tocentry)); +#if defined(__FreeBSD__) tocentry.track = i; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { perror("CDIOREADTOCENTRY"); return -1; } +#elif defined(__NetBSD__) + memset(&data, 0, sizeof(data)); + tocentry.data_len = sizeof(data); + tocentry.data = &data; + tocentry.starting_track = i; + tocentry.address_format = CD_MSF_FORMAT; + if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { + perror("CDIOREADTOCENTRYS"); + return -1; + } +#endif +#if defined(__FreeBSD__) toc->toc_entries[i-1].track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->toc_entries[i-1].first_frame_minute = tocentry.entry.addr.msf.minute; toc->toc_entries[i-1].first_frame_second = tocentry.entry.addr.msf.second; @@ -661,18 +681,41 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { (tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + (tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) + tocentry.entry.addr.msf.frame; +#elif defined(__NetBSD__) + toc->toc_entries[i-1].track_mode = (tocentry.data->control & 0x04) ? 1 : 0; + toc->toc_entries[i-1].first_frame_minute = tocentry.data->addr.msf.minute; + toc->toc_entries[i-1].first_frame_second = tocentry.data->addr.msf.second; + toc->toc_entries[i-1].first_frame_frame = tocentry.data->addr.msf.frame; + toc->toc_entries[i-1].first_frame = + (tocentry.data->addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + + (tocentry.data->addr.msf.second * CD_FRAMES_PER_SECOND) + + tocentry.data->addr.msf.frame - CD_BLOCK_OFFSET; +#endif } /* fetch the leadout as well */ memset(&tocentry, 0, sizeof(tocentry)); +#if defined(__FreeBSD__) tocentry.track = CD_LEADOUT_TRACK; tocentry.address_format = CD_MSF_FORMAT; if (ioctl(fd, CDIOREADTOCENTRY, &tocentry) == -1) { perror("CDIOREADTOCENTRY"); return -1; } +#elif defined(__NetBSD__) + memset(&data, 0, sizeof(data)); + tocentry.data_len = sizeof(data); + tocentry.data = &data; + tocentry.starting_track = CD_LEADOUT_TRACK; + tocentry.address_format = CD_MSF_FORMAT; + if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { + perror("CDIOREADTOCENTRYS"); + return -1; + } +#endif +#if defined(__FreeBSD__) toc->leadout_track.track_mode = (tocentry.entry.control & 0x04) ? 1 : 0; toc->leadout_track.first_frame_minute = tocentry.entry.addr.msf.minute; toc->leadout_track.first_frame_second = tocentry.entry.addr.msf.second; @@ -681,6 +724,16 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { (tocentry.entry.addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + (tocentry.entry.addr.msf.second * CD_FRAMES_PER_SECOND) + tocentry.entry.addr.msf.frame; +#elif defined(__NetBSD__) + toc->leadout_track.track_mode = (tocentry.data->control & 0x04) ? 1 : 0; + toc->leadout_track.first_frame_minute = tocentry.data->addr.msf.minute; + toc->leadout_track.first_frame_second = tocentry.data->addr.msf.second; + toc->leadout_track.first_frame_frame = tocentry.data->addr.msf.frame; + toc->leadout_track.first_frame = + (tocentry.data->addr.msf.minute * CD_SECONDS_PER_MINUTE * CD_FRAMES_PER_SECOND) + + (tocentry.data->addr.msf.second * CD_FRAMES_PER_SECOND) + + tocentry.data->addr.msf.frame - CD_BLOCK_OFFSET; +#endif return 0; } @@ -689,12 +742,12 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f unsigned char *data) { int fd = this_gen->fd; -#if __FreeBSD_version < 501106 - struct ioc_read_audio cdda; -#endif while( num_frames ) { +#if defined(__FreeBSD__) #if __FreeBSD_version < 501106 + struct ioc_read_audio cdda; + cdda.address_format = CD_MSF_FORMAT; cdda.address.msf.minute = frame / CD_SECONDS_PER_MINUTE / CD_FRAMES_PER_SECOND; cdda.address.msf.second = (frame / CD_FRAMES_PER_SECOND) % CD_SECONDS_PER_MINUTE; @@ -712,6 +765,33 @@ static int read_cdrom_frames(cdda_input_plugin_t *this_gen, int frame, int num_f perror("CDIOCREADAUDIO"); return -1; } +#elif defined(__NetBSD__) + scsireq_t req; + int nblocks = 1; + + memset(&req, 0, sizeof(req)); + req.cmd[0] = 0xbe; + req.cmd[1] = 0; + req.cmd[2] = (frame >> 24) & 0xff; + req.cmd[3] = (frame >> 16) & 0xff; + req.cmd[4] = (frame >> 8) & 0xff; + req.cmd[5] = (frame >> 0) & 0xff; + req.cmd[6] = (nblocks >> 16) & 0xff; + req.cmd[7] = (nblocks >> 8) & 0xff; + req.cmd[8] = (nblocks >> 0) & 0xff; + req.cmd[9] = 0x78; + req.cmdlen = 10; + + req.datalen = nblocks * CD_RAW_FRAME_SIZE; + req.databuf = data; + req.timeout = 10000; + req.flags = SCCMD_READ; + + if(ioctl(fd, SCIOCCOMMAND, &req) < 0) { + perror("SCIOCCOMMAND"); + return -1; + } +#endif data += CD_RAW_FRAME_SIZE; frame++; @@ -2270,7 +2350,7 @@ static uint32_t cdda_plugin_get_blocksize (input_plugin_t *this_gen) { return CD_RAW_FRAME_SIZE; } -static char* cdda_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* cdda_plugin_get_mrl (input_plugin_t *this_gen) { cdda_input_plugin_t *this = (cdda_input_plugin_t *) this_gen; return this->mrl; @@ -2623,7 +2703,7 @@ static const char *cdda_class_get_identifier (input_class_t *this_gen) { return "cdda"; } -static char *cdda_class_get_description (input_class_t *this_gen) { +static const char *cdda_class_get_description (input_class_t *this_gen) { return _("CD Digital Audio (aka. CDDA)"); } @@ -2675,8 +2755,8 @@ static void *init_plugin (xine_t *xine, void *data) { this->mrls_allocated_entries = 0; this->ip = NULL; - this->cdda_device = config->register_string(config, "media.audio_cd.device", - DEFAULT_CDDA_DEVICE, + this->cdda_device = config->register_filename(config, "media.audio_cd.device", + DEFAULT_CDDA_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for CD audio"), _("The path to the device, usually a " "CD or DVD drive, which you intend to use " @@ -2704,8 +2784,8 @@ static void *init_plugin (xine_t *xine, void *data) { "title and track information from."), XINE_CONFIG_SECURITY, port_changed_cb, (void *) this); - config->register_string(config, "media.audio_cd.cddb_cachedir", - (_cdda_cddb_get_default_location()), + config->register_filename(config, "media.audio_cd.cddb_cachedir", + (_cdda_cddb_get_default_location()), XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("CDDB cache directory"), _("The replies from the CDDB server will be " "cached in this directory.\nThis setting is security critical, because files " "with uncontrollable names will be created in this directory. Be sure to use " diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 8d06cb61e..39507ac15 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -2651,7 +2651,7 @@ static void dvb_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* dvb_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* dvb_plugin_get_mrl (input_plugin_t *this_gen) { dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; return this->mrl; @@ -3085,7 +3085,7 @@ static input_plugin_t *dvb_class_get_instance (input_class_t *class_gen, * dvb input plugin class stuff */ -static char *dvb_class_get_description (input_class_t *this_gen) { +static const char *dvb_class_get_description (input_class_t *this_gen) { return _("DVB (Digital TV) input plugin"); } @@ -3183,15 +3183,14 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, } if (lastchannel_enable.num_value){ - if (lastchannel.num_value>-1) /* plugin has been used before - channel is valid */ - sprintf(foobuffer,"dvb://%s",channels[lastchannel.num_value].name); - else /* set a reasonable default - the first channel */ - sprintf(foobuffer,"dvb://%s",channels[lastchannel_enable.num_value].name); - if(class->autoplaylist[0]) - free(class->autoplaylist[0]); - class->autoplaylist[0]=xine_xmalloc(128); - _x_assert(class->autoplaylist[0] != NULL); - class->autoplaylist[0]=strdup(foobuffer); + if (lastchannel.num_value > -1 && lastchannel.num_value < num_channels) + /* plugin has been used before - channel is valid */ + sprintf (foobuffer, "dvb://%s", channels[lastchannel.num_value].name); + else + /* set a reasonable default - the first channel */ + sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0"); + free(class->autoplaylist[0]); + class->autoplaylist[0]=strdup(foobuffer); } free(tmpbuffer); diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 26eb67e24..944ae88bd 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.211 2006/10/29 19:39:39 hadess Exp $ + * $Id: input_dvd.c,v 1.216 2007/02/20 01:04:07 dgp85 Exp $ * */ @@ -930,7 +930,7 @@ static uint32_t dvd_plugin_get_blocksize (input_plugin_t *this_gen) { return DVD_BLOCK_SIZE; } -static char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* dvd_plugin_get_mrl (input_plugin_t *this_gen) { dvd_input_plugin_t *this = (dvd_input_plugin_t*)this_gen; trace_print("Called\n"); @@ -1278,7 +1278,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, if(this && this->stream && this->dvdnav) { if(!(dvdnav_is_domain_vts(this->dvdnav))) { - sprintf(data, "%s", "menu"); + strcpy(data, "menu"); if (channel <= 0) return INPUT_OPTIONAL_SUCCESS; else @@ -1297,11 +1297,11 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, sprintf(data, " %c%c", lang >> 8, lang & 0xff); /* TODO: provide long version in XINE_META_INFO_FULL_LANG */ else - sprintf(data, " %c%c", '?', '?'); + strcpy(data, " ??"); return INPUT_OPTIONAL_SUCCESS; } else { if (channel == -1) { - sprintf(data, "%s", "none"); + strcpy(data, "none"); return INPUT_OPTIONAL_SUCCESS; } } @@ -1680,7 +1680,7 @@ static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_st return &this->input_plugin; } -static char *dvd_class_get_description (input_class_t *this_gen) { +static const char *dvd_class_get_description (input_class_t *this_gen) { trace_print("Called\n"); return "DVD Navigator"; @@ -1749,9 +1749,9 @@ static void *init_class (xine_t *xine, void *data) { dvd_input_class_t *this; config_values_t *config = xine->config; void *dvdcss; - static char *skip_modes[] = {"skip program", "skip part", "skip title", NULL}; - static char *seek_modes[] = {"seek in program chain", "seek in program", NULL}; - static char *play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; + static const char *skip_modes[] = {"skip program", "skip part", "skip title", NULL}; + static const char *seek_modes[] = {"seek in program chain", "seek in program", NULL}; + static const char *play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; trace_print("Called\n"); #ifdef INPUT_DEBUG @@ -1779,9 +1779,9 @@ static void *init_class (xine_t *xine, void *data) { this->ip = NULL; - this->dvd_device = config->register_string(config, + this->dvd_device = config->register_filename(config, "media.dvd.device", - DVD_PATH, + DVD_PATH, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for DVD playback"), _("The path to the device, usually a " "DVD drive, which you intend to use for playing DVDs."), @@ -1795,12 +1795,13 @@ static void *init_class (xine_t *xine, void *data) { { /* we have found libdvdcss, enable the specific config options */ char *raw_device; - static char *decrypt_modes[] = { "key", "disc", "title", NULL }; + static const char *decrypt_modes[] = { "key", "disc", "title", NULL }; char *css_cache_default, *css_cache; int mode; - raw_device = config->register_string(config, "media.dvd.raw_device", - RDVD_PATH, _("raw device set up for DVD access"), + raw_device = config->register_filename(config, "media.dvd.raw_device", + RDVD_PATH, XINE_CONFIG_STRING_IS_DEVICE_NAME, + _("raw device set up for DVD access"), _("If this points to a raw device connected to your " "DVD device, xine will use the raw device for playback. " "This has the advantage of being slightly faster and " @@ -1822,7 +1823,7 @@ static void *init_class (xine_t *xine, void *data) { css_cache_default = (char *)malloc(strlen(xine_get_homedir()) + 10); sprintf(css_cache_default, "%s/.dvdcss/", xine_get_homedir()); - css_cache = config->register_string(config, "media.dvd.css_cache_path", css_cache_default, + css_cache = config->register_filename(config, "media.dvd.css_cache_path", css_cache_default, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("path to the title key cache"), _("Since cracking the copy protection of scrambled DVDs can " "be quite time consuming, libdvdcss will cache the cracked " diff --git a/src/input/input_file.c b/src/input/input_file.c index 93d208c4e..fd2b0e733 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.117 2006/10/01 20:14:43 dgp85 Exp $ + * $Id: input_file.c,v 1.122 2007/03/29 19:47:17 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -66,8 +66,8 @@ typedef struct { xine_t *xine; config_values_t *config; - int show_hidden_files; char *origin_path; + int show_hidden_files; int mrls_allocated_entries; xine_mrl_t **mrls; @@ -280,11 +280,6 @@ static off_t file_plugin_get_length (input_plugin_t *this_gen) { } static uint32_t file_plugin_get_blocksize (input_plugin_t *this_gen) { - file_input_plugin_t *this = (file_input_plugin_t *) this_gen; -#if 0 && defined(HAVE_MMAP) - if ( check_mmap_file(this) ) - return this->mmap_len; -#endif return 0; } @@ -299,7 +294,7 @@ static int is_a_dir(char *filepathname) { return (S_ISDIR(pstat.st_mode)); } -static char* file_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* file_plugin_get_mrl (input_plugin_t *this_gen) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; return this->mrl; @@ -659,7 +654,7 @@ static off_t get_file_size(char *filepathname, char *origin) { return pstat.st_size; } -static char *file_class_get_description (input_class_t *this_gen) { +static const char *file_class_get_description (input_class_t *this_gen) { return _("file input plugin"); } @@ -1027,8 +1022,8 @@ static void *init_plugin (xine_t *xine, void *data) { if(getcwd(current_dir, sizeof(current_dir)) == NULL) strcpy(current_dir, "."); - this->origin_path = config->register_string(config, "media.files.origin_path", - current_dir, + this->origin_path = config->register_filename(config, "media.files.origin_path", + current_dir, XINE_CONFIG_STRING_IS_DIRECTORY_NAME, _("file browsing start location"), _("The browser to select the file to play will " "start at this location."), diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 3ada09d19..b9f516931 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.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_gnome_vfs.c,v 1.32 2006/09/08 06:20:37 tmattern Exp $ + * $Id: input_gnome_vfs.c,v 1.34 2007/01/19 01:05:25 dgp85 Exp $ */ @@ -204,7 +204,7 @@ gnomevfs_plugin_get_blocksize (input_plugin_t *this_gen) return 32 * 1024; } -static char* +static const char* gnomevfs_plugin_get_mrl (input_plugin_t *this_gen) { gnomevfs_input_t *this = (gnomevfs_input_t *) this_gen; @@ -212,7 +212,7 @@ gnomevfs_plugin_get_mrl (input_plugin_t *this_gen) return this->mrl; } -static char +static const char *gnomevfs_klass_get_description (input_class_t *this_gen) { return _("gnome-vfs input plugin as shipped with xine"); diff --git a/src/input/input_http.c b/src/input/input_http.c index 0ba143091..3adbc836b 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -19,7 +19,7 @@ * * input plugin for http network streams * - * $Id: input_http.c,v 1.124 2006/11/30 10:54:18 dgp85 Exp $ + * $Id: input_http.c,v 1.129 2007/03/17 16:47:16 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -335,12 +335,9 @@ static int http_plugin_read_metainf (http_input_plugin_t *this) { /* prepares the event */ radio = _x_meta_info_get(this->stream, XINE_META_INFO_ALBUM); if (radio) { - int len = strlen(radio); - strncpy(data.str, radio, sizeof(data.str)); - strncat(data.str, " - ", sizeof(data.str) - len); - strncat(data.str, songtitle, sizeof(data.str) - len - 3); + snprintf (data.str, sizeof(data.str), "%s - %s", radio, songtitle); } else { - strncpy(data.str, songtitle, sizeof(data.str)); + strncpy(data.str, songtitle, sizeof(data.str)-1); } data.str[sizeof(data.str) - 1] = '\0'; data.str_len = strlen(data.str) + 1; @@ -366,7 +363,7 @@ static off_t http_plugin_read_int (http_input_plugin_t *this, int read_bytes = 0; int nlen; - lprintf("total=%lld\n", total); + lprintf("total=%"PRId64"\n", total); while (total) { nlen = total; if (this->shoutcast_mode && @@ -418,7 +415,7 @@ static off_t http_plugin_read (input_plugin_t *this_gen, else n = nlen; - lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); + lprintf ("%"PRId64" bytes from preview (which has %"PRId64" bytes)\n", n, this->preview_size); memcpy (buf, &this->preview[this->curpos], n); num_bytes += n; @@ -577,7 +574,7 @@ static off_t http_plugin_seek(input_plugin_t *this_gen, off_t offset, int origin return this->curpos; } -static char* http_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* http_plugin_get_mrl (input_plugin_t *this_gen) { http_input_plugin_t *this = (http_input_plugin_t *) this_gen; return this->mrl; @@ -766,13 +763,11 @@ static int http_plugin_open (input_plugin_t *this_gen ) { } snprintf(this->buf + buflen, BUFSIZE - buflen, - "User-Agent: xine/%s\015\012", VERSION); - buflen = strlen(this->buf); - strncat (this->buf, "Accept: */*\015\012", BUFSIZE - buflen); - buflen = strlen(this->buf); - strncat (this->buf, "Icy-MetaData: 1\015\012", BUFSIZE - buflen); - buflen = strlen(this->buf); - strncat (this->buf, "\015\012", BUFSIZE - buflen); + "User-Agent: xine/%s\015\012" + "Accept: */*\015\012" + "Icy-MetaData: 1\015\012" + "\015\012", + VERSION); buflen = strlen(this->buf); if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "couldn't send request", NULL); @@ -809,18 +804,20 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (linenum == 1) { int httpver, httpsub; - char httpstatus[51]; - - if (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, - &httpcode, httpstatus) != 4) { - - /* icecast 1 ? */ - if (sscanf(this->buf, "ICY %d %50[^\015\012]", &httpcode, httpstatus) != 2) { + char httpstatus[51] = { 0, }; + + if ( + (sscanf(this->buf, "HTTP/%d.%d %d %50[^\015\012]", &httpver, &httpsub, + &httpcode, httpstatus) != 4) && + (sscanf(this->buf, "HTTP/%d.%d %d", &httpver, &httpsub, + &httpcode) != 3) && + (sscanf(this->buf, "ICY %d %50[^\015\012]", /* icecast 1 ? */ + &httpcode, httpstatus) != 2) + ) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "invalid http answer", NULL); xine_log (this->stream->xine, XINE_LOG_MSG, _("input_http: invalid http answer\n")); return -6; - } } if (httpcode >= 300 && httpcode < 400) { @@ -947,7 +944,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { return -12; } - lprintf("preview_size=%lld\n", this->preview_size); + lprintf("preview_size=%"PRId64"\n", this->preview_size); this->curpos = 0; return 1; @@ -995,7 +992,7 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str return &this->input_plugin; } -static char *http_class_get_description (input_class_t *this_gen) { +static const char *http_class_get_description (input_class_t *this_gen) { return _("http input plugin"); } diff --git a/src/input/input_mms.c b/src/input/input_mms.c index d4f6cb940..05c0b168b 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.64 2006/10/23 21:18:18 hadess Exp $ + * $Id: input_mms.c,v 1.70 2007/02/20 00:51:39 dgp85 Exp $ * * mms input plugin based on work from major mms */ @@ -56,18 +56,18 @@ #define PROTOCOL_MMSH 2 /* network bandwidth */ -const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, - 115200,262200,393216,524300,1544000,10485800}; +static const uint32_t mms_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; -const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char * mms_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; /* connection methods */ -const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; +static const char *mms_protocol_strs[]={"auto", "TCP", "HTTP", NULL}; typedef struct { input_plugin_t input_plugin; @@ -102,7 +102,7 @@ static off_t mms_plugin_read (input_plugin_t *this_gen, mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t n = 0; - lprintf ("mms_plugin_read: %lld bytes ...\n", len); + lprintf ("mms_plugin_read: %"PRId64" bytes ...\n", len); switch (this->protocol) { case PROTOCOL_MMST: @@ -122,7 +122,7 @@ static buf_element_t *mms_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("mms_plugin_read_block: %lld bytes...\n", todo); + lprintf ("mms_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -144,7 +144,7 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin off_t dest = 0; off_t curpos = 0; - lprintf ("mms_plugin_seek: %lld offset, %d origin...\n", offset, origin); + lprintf ("mms_plugin_seek: %"PRId64" offset, %d origin...\n", offset, origin); switch (this->protocol) { @@ -201,6 +201,28 @@ static off_t mms_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin return curpos; } +static off_t mms_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin) { + mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; + off_t curpos = 0; + + lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); + + switch (this->protocol) { + case PROTOCOL_MMST: + if (origin == SEEK_SET) + mms_set_start_time (this->mms, time_offset); + curpos = mms_get_current_pos (this->mms); + break; + case PROTOCOL_MMSH: + if (origin == SEEK_SET) + mmsh_set_start_time (this->mmsh, time_offset); + curpos = mmsh_get_current_pos (this->mmsh); + break; + } + + return curpos; +} + static off_t mms_plugin_get_length (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t length = 0; @@ -217,7 +239,7 @@ static off_t mms_plugin_get_length (input_plugin_t *this_gen) { break; } - lprintf ("length is %lld\n", length); + lprintf ("length is %"PRId64"\n", length); return length; @@ -270,7 +292,7 @@ static void mms_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* mms_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* mms_plugin_get_mrl (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; return this->mrl; @@ -400,6 +422,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre this->input_plugin.read = mms_plugin_read; this->input_plugin.read_block = mms_plugin_read_block; this->input_plugin.seek = mms_plugin_seek; + this->input_plugin.seek_time = mms_plugin_seek_time; this->input_plugin.get_current_pos = mms_plugin_get_current_pos; this->input_plugin.get_length = mms_plugin_get_length; this->input_plugin.get_blocksize = mms_plugin_get_blocksize; @@ -416,7 +439,7 @@ static input_plugin_t *mms_class_get_instance (input_class_t *cls_gen, xine_stre * mms input plugin class stuff */ -static char *mms_class_get_description (input_class_t *this_gen) { +static const char *mms_class_get_description (input_class_t *this_gen) { return _("mms streaming input plugin"); } @@ -452,7 +475,7 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.eject_media = NULL; xine->config->register_enum(xine->config, "media.network.bandwidth", 10, - (char **)mms_bandwidth_strs, + mms_bandwidth_strs, _("network bandwidth"), _("Specify the bandwidth of your internet connection here. " "This will be used when streaming servers offer different versions " @@ -462,7 +485,7 @@ static void *init_class (xine_t *xine, void *data) { this->protocol = xine->config->register_enum(xine->config, "media.network.mms_protocol", 0, - (char **)mms_protocol_strs, + mms_protocol_strs, _("MMS protocol"), _("Select the protocol to encapsulate MMS.\nTCP is better but you may need HTTP behind a firewall."), 20, diff --git a/src/input/input_net.c b/src/input/input_net.c index 19326c301..0ce2e1340 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.68 2006/07/10 22:08:15 dgp85 Exp $ + * $Id: input_net.c,v 1.70 2007/01/19 01:05:25 dgp85 Exp $ * * how to set up mp1e for use with this plugin: * @@ -367,7 +367,7 @@ static off_t net_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin } -static char* net_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* net_plugin_get_mrl (input_plugin_t *this_gen) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; return this->mrl; @@ -506,7 +506,7 @@ static input_plugin_t *net_class_get_instance (input_class_t *cls_gen, xine_stre * net plugin class */ -static char *net_class_get_description (input_class_t *this_gen) { +static const char *net_class_get_description (input_class_t *this_gen) { return _("net input plugin as shipped with xine"); } diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 2e9f0dca6..370dc6a71 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -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_plugin.h,v 1.60 2005/10/14 21:02:16 miguelfreitas Exp $ + * $Id: input_plugin.h,v 1.64 2007/01/19 01:05:25 dgp85 Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -60,7 +60,7 @@ struct input_class_s { * return human readable (verbose = 1 line) description for * this plugin class */ - char* (*get_description) (input_class_t *this); + const char* (*get_description) (input_class_t *this); /* * ls function, optional: may be NULL @@ -201,7 +201,7 @@ struct input_plugin_s { /* * return current MRL */ - char * (*get_mrl) (input_plugin_t *this); + const char * (*get_mrl) (input_plugin_t *this); /* @@ -297,6 +297,7 @@ struct input_plugin_s { #define INPUT_CAP_RIP_FORBIDDEN 0x00000100 + #define INPUT_IS_SEEKABLE(input) (((input)->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) #define INPUT_OPTIONAL_UNSUPPORTED 0 diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index 26fdd350e..e1413b0f7 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -80,7 +80,7 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen, pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; off_t n; - lprintf ("pnm_plugin_read: %lld bytes ...\n", len); + lprintf ("pnm_plugin_read: %"PRId64" bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -96,7 +96,7 @@ static buf_element_t *pnm_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("pnm_plugin_read_block: %lld bytes...\n", todo); + lprintf ("pnm_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -156,7 +156,7 @@ static off_t pnm_plugin_get_current_pos (input_plugin_t *this_gen){ pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; /* - printf ("current pos is %lld\n", this->curpos); + printf ("current pos is %"PRId64"\n", this->curpos); */ return this->curpos; @@ -181,7 +181,7 @@ static void pnm_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* pnm_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* pnm_plugin_get_mrl (input_plugin_t *this_gen) { pnm_input_plugin_t *this = (pnm_input_plugin_t *) this_gen; return this->mrl; @@ -258,7 +258,7 @@ static input_plugin_t *pnm_class_get_instance (input_class_t *cls_gen, xine_stre * pnm input plugin class stuff */ -static char *pnm_class_get_description (input_class_t *this_gen) { +static const char *pnm_class_get_description (input_class_t *this_gen) { return _("pnm streaming input plugin"); } diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 1461d0f9e..bcf93af2b 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.62 2006/07/10 22:08:15 dgp85 Exp $ + * $Id: input_pvr.c,v 1.65 2007/01/19 01:05:25 dgp85 Exp $ */ /************************************************************************** @@ -1317,7 +1317,7 @@ static uint32_t pvr_plugin_get_blocksize (input_plugin_t *this_gen) { return PVR_BLOCK_SIZE; } -static char* pvr_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* pvr_plugin_get_mrl (input_plugin_t *this_gen) { pvr_input_plugin_t *this = (pvr_input_plugin_t *) this_gen; return this->mrl; @@ -1524,7 +1524,7 @@ static input_plugin_t *pvr_class_get_instance (input_class_t *cls_gen, xine_stre * plugin class functions */ -static char *pvr_class_get_description (input_class_t *this_gen) { +static const char *pvr_class_get_description (input_class_t *this_gen) { return _("WinTV-PVR 250/350 input plugin"); } @@ -1548,9 +1548,9 @@ static void *init_plugin (xine_t *xine, void *data) { this->xine = xine; this->config = xine->config; - this->devname = this->config->register_string(this->config, + this->devname = this->config->register_filename(this->config, "media.wintv_pvr.device", - PVR_DEVICE, + PVR_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for WinTV-PVR 250/350 (pvr plugin)"), _("The path to the device of your WinTV card."), 10, NULL, diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index b23ecb895..d4ba804c6 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -174,7 +174,10 @@ static int host_connect_attempt(struct in_addr ia, int port, const char *interface, xine_t *xine) { int s=socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - struct sockaddr_in sin; + union { + struct sockaddr_in in; + struct sockaddr sa; + } saddr; int optval; int multicast = 0; /* boolean, assume unicast */ @@ -183,12 +186,12 @@ static int host_connect_attempt(struct in_addr ia, int port, return -1; } - sin.sin_family = AF_INET; - sin.sin_addr = ia; - sin.sin_port = htons(port); + saddr.in.sin_family = AF_INET; + saddr.in.sin_addr = ia; + saddr.in.sin_port = htons(port); /* Is it a multicast address? */ - if ((ntohl(sin.sin_addr.s_addr) >> 28) == 0xe) { + if ((ntohl(saddr.in.sin_addr.s_addr) >> 28) == 0xe) { LOG_MSG(xine, _("IP address specified is multicast\n")); multicast = 1; /* boolean true */ } @@ -205,14 +208,14 @@ static int host_connect_attempt(struct in_addr ia, int port, /* If multicast we allow multiple readers to open the same address */ if (multicast) { if ((setsockopt(s, SOL_SOCKET, SO_REUSEADDR, - &sin, sizeof(sin))) < 0) { + &saddr.in, sizeof(saddr.in))) < 0) { LOG_MSG(xine, _("setsockopt(SO_REUSEADDR): %s.\n"), strerror(errno)); return -1; } } /* datagram socket */ - if (bind(s, (struct sockaddr *)&sin, sizeof(sin))) { + if (bind(s, &saddr.sa, sizeof(saddr.in))) { LOG_MSG(xine, _("bind(): %s.\n"), strerror(errno)); return -1; } @@ -240,7 +243,7 @@ static int host_connect_attempt(struct in_addr ia, int port, } /* struct ip_mreq mreq; */ - mreq.imr_multiaddr.s_addr = sin.sin_addr.s_addr; + mreq.imr_multiaddr.s_addr = saddr.in.sin_addr.s_addr; if (interface == NULL) { mreq.imr_interface.s_addr = htonl(INADDR_ANY); } @@ -559,7 +562,7 @@ static uint32_t rtp_plugin_get_blocksize (input_plugin_t *this_gen) { /* * */ -static char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* rtp_plugin_get_mrl (input_plugin_t *this_gen) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; return this->mrl; @@ -739,7 +742,7 @@ static input_plugin_t *rtp_class_get_instance (input_class_t *cls_gen, * net plugin class */ -static char *rtp_class_get_description (input_class_t *this_gen) { +static const char *rtp_class_get_description (input_class_t *this_gen) { return _("RTP and UDP input plugin as shipped with xine"); } diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 0256edc8d..693e8af66 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -81,7 +81,7 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen, rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; off_t n; - lprintf ("rtsp_plugin_read: %lld bytes ...\n", len); + lprintf ("rtsp_plugin_read: %"PRId64" bytes ...\n", len); nbc_check_buffers (this->nbc); @@ -97,7 +97,7 @@ static buf_element_t *rtsp_plugin_read_block (input_plugin_t *this_gen, buf_element_t *buf = fifo->buffer_pool_alloc (fifo); int total_bytes; - lprintf ("rtsp_plugin_read_block: %lld bytes...\n", todo); + lprintf ("rtsp_plugin_read_block: %"PRId64" bytes...\n", todo); buf->content = buf->mem; buf->type = BUF_DEMUX_BLOCK; @@ -118,7 +118,7 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; - lprintf ("seek %lld bytes, origin %d\n", offset, origin); + lprintf ("seek %"PRId64" bytes, origin %d\n", offset, origin); /* only realtive forward-seeking is implemented */ @@ -134,6 +134,18 @@ static off_t rtsp_plugin_seek (input_plugin_t *this_gen, off_t offset, int origi return this->curpos; } +static off_t rtsp_plugin_seek_time (input_plugin_t *this_gen, int time_offset, int origin) { + + rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; + + lprintf ("seek_time %d msec, origin %d\n", time_offset, origin); + + if (origin == SEEK_SET) + rtsp_session_set_start_time (this->rtsp, time_offset); + + return this->curpos; +} + static off_t rtsp_plugin_get_length (input_plugin_t *this_gen) { /* @@ -156,7 +168,7 @@ static off_t rtsp_plugin_get_current_pos (input_plugin_t *this_gen){ rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; /* - printf ("current pos is %lld\n", this->curpos); + printf ("current pos is %"PRId64"\n", this->curpos); */ return this->curpos; @@ -184,7 +196,7 @@ static void rtsp_plugin_dispose (input_plugin_t *this_gen) { free (this); } -static char* rtsp_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* rtsp_plugin_get_mrl (input_plugin_t *this_gen) { rtsp_input_plugin_t *this = (rtsp_input_plugin_t *) this_gen; return this->public_mrl; @@ -212,7 +224,7 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { lprintf ("trying to open '%s'\n", this->mrl); - rtsp = rtsp_session_start(this->stream,this->mrl); + rtsp = rtsp_session_start(this->stream, this->mrl); if (!rtsp) { lprintf ("returning null.\n"); @@ -226,22 +238,19 @@ static int rtsp_plugin_open (input_plugin_t *this_gen) { } static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_stream_t *stream, - const char *data) { + const char *mrl) { /* rtsp_input_class_t *cls = (rtsp_input_class_t *) cls_gen; */ rtsp_input_plugin_t *this; - char *mrl = strdup(data); - if (strncasecmp (mrl, "rtsp://", 6)) { - free (mrl); + if (strncasecmp (mrl, "rtsp://", 6)) return NULL; - } this = (rtsp_input_plugin_t *) xine_xmalloc (sizeof (rtsp_input_plugin_t)); this->stream = stream; this->rtsp = NULL; - this->mrl = mrl; + this->mrl = strdup (mrl); /* since we handle only real streams yet, we can savely add * an .rm extention to force handling by demux_real. */ @@ -255,6 +264,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str this->input_plugin.read = rtsp_plugin_read; this->input_plugin.read_block = rtsp_plugin_read_block; this->input_plugin.seek = rtsp_plugin_seek; + this->input_plugin.seek_time = rtsp_plugin_seek_time; this->input_plugin.get_current_pos = rtsp_plugin_get_current_pos; this->input_plugin.get_length = rtsp_plugin_get_length; this->input_plugin.get_blocksize = rtsp_plugin_get_blocksize; @@ -270,7 +280,7 @@ static input_plugin_t *rtsp_class_get_instance (input_class_t *cls_gen, xine_str * rtsp input plugin class stuff */ -static char *rtsp_class_get_description (input_class_t *this_gen) { +static const char *rtsp_class_get_description (input_class_t *this_gen) { return _("rtsp streaming input plugin"); } diff --git a/src/input/input_smb.c b/src/input/input_smb.c index 21b45fa73..1b1f15565 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.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_smb.c,v 1.15 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_smb.c,v 1.16 2007/01/26 17:06:05 dgp85 Exp $ */ @@ -148,6 +148,10 @@ smb_plugin_get_mrl (input_plugin_t *this_gen) return this->mrl; } +static uint32_t smb_plugin_get_blocksize (input_plugin_t *this_gen) { + return 0; +} + static char *smb_class_get_description (input_class_t *this_gen) { @@ -485,7 +489,7 @@ smb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, this->input_plugin.seek = smb_plugin_seek; this->input_plugin.get_current_pos = smb_plugin_get_current_pos; this->input_plugin.get_length = smb_plugin_get_length; - this->input_plugin.get_blocksize = NULL; + this->input_plugin.get_blocksize = smb_plugin_get_blocksize; this->input_plugin.get_mrl = smb_plugin_get_mrl; this->input_plugin.get_optional_data = smb_plugin_get_optional_data; diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index 3780a1cef..939f56f25 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.67 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_stdin_fifo.c,v 1.70 2007/02/20 00:34:56 dgp85 Exp $ */ #ifdef HAVE_CONFIG_H @@ -86,14 +86,14 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; off_t n, total; - lprintf ("reading %lld bytes...\n", len); + lprintf ("reading %"PRId64" bytes...\n", len); total=0; if (this->curpos < this->preview_size) { n = this->preview_size - this->curpos; if (n > (len - total)) n = len - total; - lprintf ("%lld bytes from preview (which has %lld bytes)\n", n, this->preview_size); + lprintf ("%"PRId64" bytes from preview (which has %"PRId64" bytes)\n", n, this->preview_size); memcpy (&buf[total], &this->preview[this->curpos], n); this->curpos += n; @@ -103,7 +103,7 @@ static off_t stdin_plugin_read (input_plugin_t *this_gen, if( (len-total) > 0 ) { n = _x_io_file_read (this->stream, this->fh, &buf[total], len - total); - lprintf ("got %lld bytes (%lld/%lld bytes read)\n", n,total,len); + lprintf ("got %"PRId64" bytes (%"PRId64"/%"PRId64" bytes read)\n", n,total,len); if (n < 0) { _x_message(this->stream, XINE_MSG_READ_ERROR, NULL); @@ -143,7 +143,7 @@ static off_t stdin_plugin_seek (input_plugin_t *this_gen, off_t offset, int orig stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; - lprintf ("seek %lld offset, %d origin...\n", offset, origin); + lprintf ("seek %"PRId64" offset, %d origin...\n", offset, origin); if ((origin == SEEK_CUR) && (offset >= 0)) { @@ -202,7 +202,7 @@ static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen){ return this->curpos; } -static char* stdin_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* stdin_plugin_get_mrl (input_plugin_t *this_gen) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; return this->mrl; @@ -346,7 +346,7 @@ static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen, * stdin input plugin class stuff */ -static char *stdin_class_get_description (input_class_t *this_gen) { +static const char *stdin_class_get_description (input_class_t *this_gen) { return _("stdin streaming input plugin"); } diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index 1dfde167f..17c4223a2 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -1628,7 +1628,7 @@ static void v4l_plugin_dispose (input_plugin_t *this_gen) { * * Get the current MRL used by the plugin. */ -static char* v4l_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* v4l_plugin_get_mrl (input_plugin_t *this_gen) { v4l_input_plugin_t *this = (v4l_input_plugin_t *) this_gen; return this->mrl; @@ -1907,8 +1907,8 @@ static void *init_video_class (xine_t *xine, void *data) this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - config->register_string (config, "media.video4linux.video_device", - VIDEO_DEV, + config->register_filename (config, "media.video4linux.video_device", + VIDEO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l video device"), _("The path to your Video4Linux video device."), 10, NULL, NULL); @@ -1933,8 +1933,8 @@ static void *init_radio_class (xine_t *xine, void *data) this->input_class.dispose = v4l_class_dispose; this->input_class.eject_media = NULL; - config->register_string (config, "media.video4linux.radio_device", - RADIO_DEV, + config->register_filename (config, "media.video4linux.radio_device", + RADIO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("v4l radio device"), _("The path to your Video4Linux radio device."), 10, NULL, NULL); diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 0103027bf..bcd50ecc1 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.85 2006/07/10 22:08:16 dgp85 Exp $ + * $Id: input_vcd.c,v 1.89 2007/03/16 16:32:58 dgp85 Exp $ * */ @@ -25,7 +25,6 @@ #include "config.h" #endif -#include <netinet/in.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> @@ -34,6 +33,7 @@ #include <fcntl.h> #include <sys/ioctl.h> #include <string.h> +#include <netinet/in.h> #ifdef HAVE_LINUX_CDROM_H # include <linux/cdrom.h> #endif @@ -813,7 +813,7 @@ static void vcd_plugin_dispose (input_plugin_t *this_gen ) { free (this); } -static char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { +static const char* vcd_plugin_get_mrl (input_plugin_t *this_gen) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; return this->mrl; @@ -919,7 +919,7 @@ static input_plugin_t *vcd_class_get_instance (input_class_t *cls_gen, xine_stre * vcd input plugin class stuff */ -static char *vcd_class_get_description (input_class_t *this_gen) { +static const char *vcd_class_get_description (input_class_t *this_gen) { return _("Video CD input plugin"); } @@ -1094,7 +1094,7 @@ static void *init_class (xine_t *xine, void *data) { this->input_class.dispose = vcd_class_dispose; this->input_class.eject_media = vcd_class_eject_media; - this->device = config->register_string (config, "media.vcd.device", CDROM, + this->device = config->register_filename (config, "media.vcd.device", CDROM, XINE_CONFIG_STRING_IS_DEVICE_NAME, _("device used for VCD playback"), _("The path to the device, usually a CD or DVD drive, " "you intend to play your VideoCDs with."), diff --git a/src/input/libdvdnav/.cvsignore b/src/input/libdvdnav/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/libdvdnav/.cvsignore +++ b/src/input/libdvdnav/.hgignore diff --git a/src/input/libdvdnav/Makefile.am b/src/input/libdvdnav/Makefile.am index 2aadb3588..412828261 100644 --- a/src/input/libdvdnav/Makefile.am +++ b/src/input/libdvdnav/Makefile.am @@ -22,7 +22,7 @@ libdvdnav_la_SOURCES = \ dvd_reader.c \ dvd_input.c \ dvd_udf.c -libdvdnav_la_LIBADD = $(THREAD_LIBS) +libdvdnav_la_LIBADD = $(PTHREAD_LIBS) libdvdnav_la_CFLAGS = $(VISIBILITY_FLAG) libdvdnav_la_LDFLAGS = -avoid-version -module diff --git a/src/input/libdvdnav/bswap.h b/src/input/libdvdnav/bswap.h index 7d7acd556..c1fc7a045 100644 --- a/src/input/libdvdnav/bswap.h +++ b/src/input/libdvdnav/bswap.h @@ -41,6 +41,12 @@ #define B2N_32(x) x = bswap_32(x) #define B2N_64(x) x = bswap_64(x) +#elif defined(__APPLE__) +#include <libkern/OSByteOrder.h> +#define B2N_16(x) x = OSSwapBigToHostInt16(x) +#define B2N_32(x) x = OSSwapBigToHostInt32(x) +#define B2N_64(x) x = OSSwapBigToHostInt64(x) + #elif defined(__NetBSD__) #include <sys/endian.h> #define B2N_16(x) BE16TOH(x) diff --git a/src/input/libdvdnav/diff_against_cvs.patch b/src/input/libdvdnav/diff_against_cvs.patch index 6afca3a98..202474fef 100644 --- a/src/input/libdvdnav/diff_against_cvs.patch +++ b/src/input/libdvdnav/diff_against_cvs.patch @@ -263,6 +263,19 @@ diff -u -p -u -r1.3 bswap.h #include <byteswap.h> #define B2N_16(x) x = bswap_16(x) #define B2N_32(x) x = bswap_32(x) +@@ -41,6 +41,12 @@ + #define B2N_32(x) x = bswap_32(x) + #define B2N_64(x) x = bswap_64(x) + ++#elif defined(__APPLE__) ++#include <libkern/OSByteOrder.h> ++#define B2N_16(x) x = OSSwapBigToHostInt16(x) ++#define B2N_32(x) x = OSSwapBigToHostInt32(x) ++#define B2N_64(x) x = OSSwapBigToHostInt64(x) ++ + #elif defined(__NetBSD__) + #include <sys/endian.h> + #define B2N_16(x) BE16TOH(x) Index: src/input/libdvdnav/dvd_reader.c =================================================================== RCS file: /cvsroot/xine/xine-lib/src/input/libdvdnav/dvd_reader.c,v diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c index e71d6ca42..7ecd8f1ba 100644 --- a/src/input/libdvdnav/dvd_reader.c +++ b/src/input/libdvdnav/dvd_reader.c @@ -603,10 +603,12 @@ static int findDirFile( const char *path, const char *file, char *filename ) sprintf( filename, "%s%s%s", path, ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ), ent->d_name ); + closedir (dir); return 0; } } + closedir (dir); return -1; } diff --git a/src/input/libdvdnav/remap.c b/src/input/libdvdnav/remap.c index 86cf3a4ad..f2049ac06 100644 --- a/src/input/libdvdnav/remap.c +++ b/src/input/libdvdnav/remap.c @@ -15,7 +15,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: remap.c,v 1.5 2006/09/17 13:01:08 valtri Exp $ + * $Id: remap.c,v 1.6 2006/12/08 16:26:10 mshopf Exp $ */ #include <stdlib.h> @@ -193,10 +193,7 @@ remap_t* remap_loadmap( char *title) { /* Build the map filename */ home = getenv("HOME"); assert(home); - strncpy(fname, home, sizeof(fname)); - strncat(fname, "/.dvdnav/", sizeof(fname)); - strncat(fname, title, sizeof(fname)); - strncat(fname, ".map", sizeof(fname)); + snprintf (fname, sizeof(fname), "%s/.dvdnav/%s.map", home, title); /* Open the map file */ fp = fopen( fname, "r"); diff --git a/src/input/libreal/.cvsignore b/src/input/libreal/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/libreal/.cvsignore +++ b/src/input/libreal/.hgignore diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index 5fd5ae798..8afc19df6 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.9 2006/11/29 19:43:01 dgp85 Exp $ + * $Id: asmrp.c,v 1.10 2006/12/25 15:39:31 dgp85 Exp $ * * a parser for real's asm rules * @@ -417,7 +417,9 @@ static int asmrp_operand (asmrp_t *p) { i = asmrp_find_id (p, p->str); if (i<0) { - lprintf ("error: unknown identifier %s\n", p->str); + printf ("error: unknown identifier %s\n", p->str); + ret = 0; + break; } ret = p->sym_tab[i].v; diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 270fd16e4..dc0c001bd 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.24 2006/11/29 19:43:01 dgp85 Exp $ + * $Id: real.c,v 1.26 2007/01/19 01:19:06 dgp85 Exp $ * * special functions for real streams. * adopted from joschkas real tools. @@ -289,18 +289,15 @@ static void calc_response (char *result, char *field) { static void calc_response_string (char *result, char *challenge) { - char field[128]; + char field[128] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, + 0xFE, 0xDC, 0xBA, 0x98, 0x76, 0x54, 0x32, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; char zres[20]; int i; - /* initialize our field */ - BE_32C (field, 0x01234567); - BE_32C ((field+4), 0x89ABCDEF); - BE_32C ((field+8), 0xFEDCBA98); - BE_32C ((field+12), 0x76543210); - BE_32C ((field+16), 0x00000000); - BE_32C ((field+20), 0x00000000); - /* calculate response */ call_hash(field, challenge, 64); calc_response(zres,field); @@ -715,10 +712,6 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid rtsp_schedule_field(rtsp_session, subscribe); rtsp_request_setparameter(rtsp_session,NULL); - /* and finally send a play request */ - rtsp_schedule_field(rtsp_session, "Range: npt=0-"); - rtsp_request_play(rtsp_session,NULL); - xine_buffer_free(subscribe); xine_buffer_free(buf); return h; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index e77781253..019237243 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.6 2006/06/20 01:07:58 dgp85 Exp $ + * $Id: sdpplin.c,v 1.8 2006/12/25 16:21:56 dgp85 Exp $ * * sdp/sdpplin parser. * @@ -71,8 +71,9 @@ static char *b64_decode(const char *in, char *out, int *size) int c = in[i+j]; if (dtable[c] & 0x80) { - printf("Illegal character '%c' in input.\n", c); - exit(1); + fprintf(stderr, "Illegal character '%c' in input.\n", c); + *size = 0; + return NULL; } a[i] = (char) c; b[i] = (char) dtable[c]; @@ -200,11 +201,13 @@ 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); - memcpy(desc->mlti_data, decoded, desc->mlti_data_size); - handled=1; - *data=nl(*data); - lprintf("mlti_data_size: %i\n", desc->mlti_data_size); + if ( decoded != NULL ) { + desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); + memcpy(desc->mlti_data, decoded, desc->mlti_data_size); + handled=1; + *data=nl(*data); + lprintf("mlti_data_size: %i\n", desc->mlti_data_size); + } } if(filter(*data,"a=ASMRuleBook:string;",&buf)) { @@ -239,11 +242,17 @@ sdpplin_t *sdpplin_parse(char *data) { int handled; int len; + desc->stream = NULL; + while (data && *data) { handled=0; if (filter(data, "m=", &buf)) { + if ( ! desc->stream ) { + fprintf(stderr, "sdpplin.c: stream identifier found before stream count, skipping."); + continue; + } stream=sdpplin_parse_stream(&data); lprintf("got data for stream id %u\n", stream->stream_id); desc->stream[stream->stream_id]=stream; @@ -252,30 +261,38 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=Title:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->title=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->title=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Author:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->author=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->author=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Copyright:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->copyright=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->copyright=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=Abstract:buffer;",&buf)) { decoded=b64_decode(buf, decoded, &len); - desc->abstract=strdup(decoded); - handled=1; - data=nl(data); + if ( decoded != NULL ) { + desc->abstract=strdup(decoded); + handled=1; + data=nl(data); + } } if(filter(data,"a=StreamCount:integer;",&buf)) { diff --git a/src/input/librtsp/.cvsignore b/src/input/librtsp/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/librtsp/.cvsignore +++ b/src/input/librtsp/.hgignore diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 6f06693a9..66de10584 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.16 2004/04/24 16:55:42 miguelfreitas Exp $ + * $Id: rtsp_session.c,v 1.19 2006/12/22 18:08:10 klan Exp $ * * high level interface to rtsp servers. */ @@ -53,24 +53,49 @@ struct rtsp_session_s { rtsp_t *s; /* receive buffer */ - uint8_t *recv; + uint8_t *recv; int recv_size; int recv_read; /* header buffer */ uint8_t header[HEADER_SIZE]; int header_len; - int header_read; + int header_left; + int playing; + int start_time; }; +/* network bandwidth */ +const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; + +const char *rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; + + 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 = xine_xmalloc(sizeof(rtsp_session_t)); + xine_t *xine = stream->xine; char *server; char *mrl_line=strdup(mrl); rmff_header_t *h; - uint32_t bandwidth=10485800; + int bandwidth_id; + uint32_t bandwidth; + + bandwidth_id = xine->config->register_enum(xine->config, "media.network.bandwidth", 10, + (char **)rtsp_bandwidth_strs, + _("network bandwidth"), + _("Specify the bandwidth of your internet connection here. " + "This will be used when streaming servers offer different versions " + "with different bandwidth requirements of the same stream."), + 0, NULL, NULL); + bandwidth = rtsp_bandwidths[bandwidth_id]; rtsp_session->recv = xine_buffer_init(BUF_SIZE); @@ -123,7 +148,8 @@ connect: } } - rtsp_session->header_len=rmff_dump_header(h,rtsp_session->header,1024); + rtsp_session->header_left = + rtsp_session->header_len = rmff_dump_header(h,rtsp_session->header,HEADER_SIZE); xine_buffer_copyin(rtsp_session->recv, 0, rtsp_session->header, rtsp_session->header_len); rtsp_session->recv_size = rtsp_session->header_len; @@ -144,16 +170,48 @@ connect: return rtsp_session; } +void rtsp_session_set_start_time (rtsp_session_t *this, int start_time) { + + if (start_time >= 0) + this->start_time = start_time; +} + +static void rtsp_session_play (rtsp_session_t *this) { + + char buf[256]; + + snprintf (buf, sizeof(buf), "Range: npt=%d.%03d-", + this->start_time/1000, this->start_time%1000); + + rtsp_schedule_field (this->s, buf); + rtsp_request_play (this->s,NULL); +} + int rtsp_session_read (rtsp_session_t *this, char *data, int len) { - int to_copy=len; + int to_copy; char *dest=data; char *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; - if (len < 0) return 0; + if (len < 0) + return 0; + + if (this->header_left) { + if (len > this->header_left) + len = this->header_left; + + this->header_left -= len; + } + + to_copy = len; while (to_copy > fill) { + if (!this->playing) { + rtsp_session_play (this); + this->playing = 1; + } + memcpy(dest, source, fill); to_copy -= fill; dest += fill; diff --git a/src/input/librtsp/rtsp_session.h b/src/input/librtsp/rtsp_session.h index 140d09a0a..649842e7a 100644 --- a/src/input/librtsp/rtsp_session.h +++ b/src/input/librtsp/rtsp_session.h @@ -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.h,v 1.6 2003/12/09 00:02:31 f1rmb Exp $ + * $Id: rtsp_session.h,v 1.7 2006/12/18 21:31:47 klan Exp $ * * high level interface to rtsp servers. */ @@ -29,6 +29,8 @@ typedef struct rtsp_session_s rtsp_session_t; rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl); +void rtsp_session_set_start_time(rtsp_session_t *this, int start_time); + int rtsp_session_read(rtsp_session_t *session, char *data, int len); int rtsp_session_peek_header(rtsp_session_t *this, char *buf, int maxsize); diff --git a/src/input/mms.c b/src/input/mms.c index 86317a1ee..74087f7c5 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.63 2006/09/16 08:13:51 tmattern Exp $ + * $Id: mms.c,v 1.65 2007/02/20 00:34:56 dgp85 Exp $ * * MMS over TCP protocol * based on work from major mms @@ -144,9 +144,19 @@ struct mms_s { int eos; uint8_t live_flag; + + uint8_t playing; + double start_time; }; +#define D2Q(d) ({\ + union { double db; long long qw; } _tmp;\ + _tmp.db = d;\ + _tmp.qw;\ +})\ + + static void mms_buffer_init (mms_buffer_t *mms_buffer, char *buffer) { mms_buffer->buffer = (uint8_t*)buffer; mms_buffer->pos = 0; @@ -179,6 +189,20 @@ static void mms_buffer_put_32 (mms_buffer_t *mms_buffer, uint32_t value) { mms_buffer->pos += 4; } +static void mms_buffer_put_64 (mms_buffer_t *mms_buffer, uint64_t value) { + + mms_buffer->buffer[mms_buffer->pos] = value & 0xff; + mms_buffer->buffer[mms_buffer->pos + 1] = (value >> 8) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 2] = (value >> 16) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 3] = (value >> 24) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 4] = (value >> 32) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 5] = (value >> 40) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 6] = (value >> 48) & 0xff; + mms_buffer->buffer[mms_buffer->pos + 7] = (value >> 56) & 0xff; + + mms_buffer->pos += 8; +} + static void print_command (char *data, int len) { @@ -361,7 +385,7 @@ static int get_packet_header (mms_t *this, mms_packet_header_t *header) { return packet_type; error: - lprintf("read error, len=%d\n", len); + lprintf("read error, len=%zd\n", len); return MMS_PACKET_ERR; } @@ -839,11 +863,13 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { report_progress (stream, 80); /* command 0x07 */ + /* moved to mms_read() */ +#if 0 { mms_buffer_t command_buffer; mms_buffer_init(&command_buffer, this->scmd_body); mms_buffer_put_32 (&command_buffer, 0x00000000); /* 64 byte float timestamp */ - mms_buffer_put_32 (&command_buffer, 0x00000000); + mms_buffer_put_32 (&command_buffer, 0x00000000); mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* ?? */ mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* first packet sequence */ mms_buffer_put_8 (&command_buffer, 0xFF); /* max stream time limit (3 bytes) */ @@ -857,6 +883,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { goto fail; } } +#endif report_progress (stream, 100); @@ -1052,9 +1079,33 @@ int mms_read (mms_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; + + if (this->asf_header_read == this->asf_header_len) + break; } else { int n, bytes_left ; + + if (!this->playing) { + /* send command 0x07 with initial timestamp */ + mms_buffer_t command_buffer; + mms_buffer_init(&command_buffer, this->scmd_body); + mms_buffer_put_64 (&command_buffer, D2Q(this->start_time)); /* 64 byte float timestamp */ + mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* ?? */ + mms_buffer_put_32 (&command_buffer, 0xFFFFFFFF); /* first packet sequence */ + mms_buffer_put_8 (&command_buffer, 0xFF); /* max stream time limit (3 bytes) */ + mms_buffer_put_8 (&command_buffer, 0xFF); + mms_buffer_put_8 (&command_buffer, 0xFF); + mms_buffer_put_8 (&command_buffer, 0x00); /* stream time limit flag */ + mms_buffer_put_32 (&command_buffer, ASF_MEDIA_PACKET_ID_TYPE); /* asf media packet id type */ + if (!send_command (this, 0x07, 1, 0x0001FFFF, command_buffer.pos)) { + xprintf (this->stream->xine, XINE_VERBOSITY_LOG, + "libmms: failed to send command 0x07\n"); + this->eos = 1; + break; + } + this->playing = 1; + } bytes_left = this->buf_size - this->buf_read; if (bytes_left == 0) { @@ -1111,3 +1162,9 @@ uint32_t mms_get_length (mms_t *this) { off_t mms_get_current_pos (mms_t *this) { return this->current_pos; } + +void mms_set_start_time (mms_t *this, int time_offset) { + if (time_offset >= 0) + this->start_time = (double) time_offset / 1000.0; +} + diff --git a/src/input/mms.h b/src/input/mms.h index f4b2928cd..310a6d0cc 100644 --- a/src/input/mms.h +++ b/src/input/mms.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.h,v 1.12 2006/06/20 01:46:41 dgp85 Exp $ + * $Id: mms.h,v 1.13 2007/01/03 15:09:42 klan Exp $ * * libmms public header */ @@ -41,5 +41,7 @@ size_t mms_peek_header (mms_t *this, char *data, size_t maxsize); off_t mms_get_current_pos (mms_t *this); +void mms_set_start_time (mms_t *this, int time_offset); + #endif diff --git a/src/input/mmsh.c b/src/input/mmsh.c index 889596cf7..30c16001d 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.40 2006/11/11 00:05:22 dgp85 Exp $ + * $Id: mmsh.c,v 1.42 2007/01/11 16:20:55 klan Exp $ * * MMS over HTTP protocol * written by Thibaut Mattern @@ -99,7 +99,7 @@ "Pragma: no-cache,rate=1.000000,stream-time=%u,stream-offset=%u:%u,request-context=%u,max-duration=%u\r\n" \ CLIENTGUID \ "Pragma: xPlayStrm=1\r\n" \ - "Pragma: stream-switch-coun t=%d\r\n" \ + "Pragma: stream-switch-count=%d\r\n" \ "Pragma: stream-switch-entry=%s\r\n" /* ffff:1:0 ffff:2:0 */ \ "Connection: Close\r\n\r\n" @@ -180,9 +180,15 @@ struct mmsh_s { uint32_t asf_header_len; uint32_t asf_header_read; int seq_num; + + int video_stream; + int audio_stream; off_t current_pos; - int user_bandwitdh; + int user_bandwidth; + + int playing; + unsigned int start_time; }; static int send_command (mmsh_t *this, char *cmd) { @@ -382,7 +388,6 @@ static int get_header (mmsh_t *this) { lprintf("get_header\n"); this->asf_header_len = 0; - this->asf_header_read = 0; /* read chunk */ while (1) { @@ -514,13 +519,10 @@ static int mmsh_tcp_connect(mmsh_t *this) { return 0; } - +/* + * firts http request + */ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { - int i; - char stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */ - int offset; - int audio_stream, video_stream; - /* * let the negotiations begin... */ @@ -532,30 +534,45 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { this->host, this->port, 1); if (!send_command (this, this->str)) - goto fail; + return 0; if (!get_answer (this)) - goto fail; + return 0; - get_header(this); /* FIXME: it returns 0 */ + get_header (this); /* FIXME: it returns 0 */ - if (!interp_header(this)) - goto fail; + if (!interp_header (this)) + return 0; - close(this->s); + close (this->s); report_progress (this->stream, 20); - asf_header_choose_streams (this->asf_header, bandwidth, &video_stream, &audio_stream); + asf_header_choose_streams (this->asf_header, bandwidth, + &this->video_stream, &this->audio_stream); - lprintf("audio stream %d, video stream %d\n", audio_stream, video_stream); + lprintf("audio stream %d, video stream %d\n", + this->audio_stream, this->video_stream); + + asf_header_disable_streams (this->asf_header, + this->video_stream, this->audio_stream); + + if (mmsh_tcp_connect(this)) + return 0; + + return 1; +} + +/* + * second http request + */ +static int mmsh_connect_int2(mmsh_t *this, int bandwidth) { + int i; + char stream_selection[10 * ASF_MAX_NUM_STREAMS]; /* 10 chars per stream */ + int offset; /* second request */ lprintf("second http request\n"); - if (mmsh_tcp_connect(this)) { - goto fail; - } - /* stream selection string */ /* The same selection is done with mmst */ /* 0 means selected */ @@ -563,8 +580,8 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { offset = 0; for (i = 0; i < this->asf_header->stream_count; i++) { int size; - if ((i == audio_stream) || - (i == video_stream)) { + if ((i == this->audio_stream) || + (i == this->video_stream)) { size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset, "ffff:%d:0 ", this->asf_header->streams[i]->stream_number); } else { @@ -573,14 +590,15 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { size = snprintf(stream_selection + offset, sizeof(stream_selection) - offset, "ffff:%d:2 ", this->asf_header->streams[i]->stream_number); } - if (size < 0) goto fail; + if (size < 0) + return 0; offset += size; } switch (this->stream_type) { case MMSH_SEEKABLE: snprintf (this->str, SCRATCH_SIZE, mmsh_SeekableRequest, this->uri, - this->host, this->port, 0, 0, 0, 2, 0, + this->host, this->port, this->start_time, 0, 0, 2, 0, this->asf_header->stream_count, stream_selection); break; case MMSH_LIVE: @@ -591,25 +609,25 @@ static int mmsh_connect_int(mmsh_t *this, int bandwidth) { } if (!send_command (this, this->str)) - goto fail; + return 0; lprintf("before read \n"); if (!get_answer (this)) - goto fail; - - if (!get_header(this)) - goto fail; - - if (!interp_header(this)) - goto fail; + return 0; - asf_header_disable_streams (this->asf_header, video_stream, audio_stream); + if (!get_header (this)) + return 0; + +#if 0 + if (!interp_header (this)) + return 0; + + asf_header_disable_streams (this->asf_header, + this->video_stream, this->audio_stream); +#endif return 1; - -fail: - return 0; } mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { @@ -630,7 +648,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { this->buf_size = 0; this->buf_read = 0; this->current_pos = 0; - this->user_bandwitdh = bandwidth; + this->user_bandwidth = bandwidth; report_progress (stream, 0); @@ -650,7 +668,7 @@ mmsh_t *mmsh_connect (xine_stream_t *stream, const char *url, int bandwidth) { report_progress (stream, 30); - if (!mmsh_connect_int(this, this->user_bandwitdh)) + if (!mmsh_connect_int(this, this->user_bandwidth)) goto fail; report_progress (stream, 100); @@ -709,8 +727,10 @@ static int get_media_packet (mmsh_t *this) { if (mmsh_tcp_connect(this)) return 0; - if (!mmsh_connect_int(this, this->user_bandwitdh)) + if (!mmsh_connect_int(this, this->user_bandwidth)) return 0; + + this->playing = 0; /* mmsh_connect_int reads the first data packet */ /* this->buf_size is set by mmsh_connect_int */ @@ -784,7 +804,7 @@ int mmsh_read (mmsh_t *this, char *data, int len) { if (this->asf_header_read < this->asf_header_len) { int n, bytes_left ; - bytes_left = this->asf_header_len - this->asf_header_read ; + bytes_left = this->asf_header_len - this->asf_header_read; if ((len-total) < bytes_left) n = len-total; @@ -796,9 +816,18 @@ int mmsh_read (mmsh_t *this, char *data, int len) { this->asf_header_read += n; total += n; this->current_pos += n; + + if (this->asf_header_read == this->asf_header_len) + break; } else { int n, bytes_left ; + + if (!this->playing) { + if (!mmsh_connect_int2 (this, this->user_bandwidth)) + break; + this->playing = 1; + } bytes_left = this->buf_size - this->buf_read; @@ -867,3 +896,8 @@ uint32_t mmsh_get_length (mmsh_t *this) { off_t mmsh_get_current_pos (mmsh_t *this) { return this->current_pos; } + +void mmsh_set_start_time (mmsh_t *this, int time_offset) { + if (time_offset >= 0) + this->start_time = time_offset; +} diff --git a/src/input/mmsh.h b/src/input/mmsh.h index 8aee808f0..1ded6295a 100644 --- a/src/input/mmsh.h +++ b/src/input/mmsh.h @@ -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.h,v 1.5 2006/06/20 01:46:41 dgp85 Exp $ + * $Id: mmsh.h,v 1.6 2007/01/09 20:51:00 klan Exp $ * * libmmsh public header */ @@ -31,7 +31,7 @@ typedef struct mmsh_s mmsh_t; char* mmsh_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file); -mmsh_t* mmsh_connect (xine_stream_t *stream, const char *url_, int bandwidth); +mmsh_t* mmsh_connect (xine_stream_t *stream, const char *url_, int bandwidth); int mmsh_read (mmsh_t *this, char *data, int len); uint32_t mmsh_get_length (mmsh_t *this); @@ -41,4 +41,6 @@ size_t mmsh_peek_header (mmsh_t *this, char *data, size_t maxsize); off_t mmsh_get_current_pos (mmsh_t *this); +void mmsh_set_start_time (mmsh_t *this, int time_offset); + #endif diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index 75743a070..86514cdea 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -149,7 +149,7 @@ static void nbc_compute_fifo_length(nbc_t *this, fifo_buffer_t *fifo, buf_element_t *buf, int action) { - int fifo_free, fifo_fill; + int fifo_free, fifo_fill, fifo_div; int64_t video_br, audio_br, diff; int has_video, has_audio; @@ -160,10 +160,13 @@ static void nbc_compute_fifo_length(nbc_t *this, fifo_free = fifo->buffer_pool_num_free; fifo_fill = fifo->fifo_size; + fifo_div = fifo_fill + fifo_free - 1; + if (fifo_div == 0) + fifo_div = 1; /* avoid a possible divide-by-zero */ if (fifo == this->video_fifo) { this->video_fifo_free = fifo_free; - this->video_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1); + this->video_fifo_fill = (100 * fifo_fill) / fifo_div; this->video_fifo_size = fifo->fifo_data_size; if (buf->pts && (this->video_in_disc == 0)) { @@ -196,7 +199,7 @@ static void nbc_compute_fifo_length(nbc_t *this, } else { this->audio_fifo_free = fifo_free; - this->audio_fifo_fill = (100 * fifo_fill) / (fifo_fill + fifo_free - 1); + this->audio_fifo_fill = (100 * fifo_fill) / fifo_div; this->audio_fifo_size = fifo->fifo_data_size; if (buf->pts && (this->audio_in_disc == 0)) { diff --git a/src/input/vcd/.cvsignore b/src/input/vcd/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/vcd/.cvsignore +++ b/src/input/vcd/.hgignore diff --git a/src/input/vcd/Makefile.am b/src/input/vcd/Makefile.am index deb30e78f..98903aac8 100644 --- a/src/input/vcd/Makefile.am +++ b/src/input/vcd/Makefile.am @@ -18,7 +18,7 @@ xineplug_inp_vcd_la_LDFLAGS = -avoid-version -module if HAVE_VCDNAV xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCDINFO_LIBS) else -xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCD_LIBS) $(LIBVCDINFO_LIBS) +xineplug_inp_vcd_la_LIBADD = $(XINE_LIB) $(LIBVCD_LIBS) $(LIBVCDINFO_LIBS) -lm endif endif diff --git a/src/input/vcd/libcdio/.cvsignore b/src/input/vcd/libcdio/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/vcd/libcdio/.cvsignore +++ b/src/input/vcd/libcdio/.hgignore diff --git a/src/input/vcd/libcdio/MSWindows/.cvsignore b/src/input/vcd/libcdio/MSWindows/.hgignore index 282522db0..282522db0 100644 --- a/src/input/vcd/libcdio/MSWindows/.cvsignore +++ b/src/input/vcd/libcdio/MSWindows/.hgignore diff --git a/src/input/vcd/libcdio/cdio/.cvsignore b/src/input/vcd/libcdio/cdio/.hgignore index 282522db0..282522db0 100644 --- a/src/input/vcd/libcdio/cdio/.cvsignore +++ b/src/input/vcd/libcdio/cdio/.hgignore diff --git a/src/input/vcd/libcdio/image/.cvsignore b/src/input/vcd/libcdio/image/.hgignore index 282522db0..282522db0 100644 --- a/src/input/vcd/libcdio/image/.cvsignore +++ b/src/input/vcd/libcdio/image/.hgignore diff --git a/src/input/vcd/libcdio/iso9660_fs.c b/src/input/vcd/libcdio/iso9660_fs.c index 0a2de8fa1..fff12cd7c 100644 --- a/src/input/vcd/libcdio/iso9660_fs.c +++ b/src/input/vcd/libcdio/iso9660_fs.c @@ -1,5 +1,5 @@ /* - $Id: iso9660_fs.c,v 1.6 2006/09/28 08:19:14 dgp85 Exp $ + $Id: iso9660_fs.c,v 1.7 2006/12/08 16:26:10 mshopf Exp $ Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -51,7 +51,7 @@ #include <stdio.h> -static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.6 2006/09/28 08:19:14 dgp85 Exp $"; +static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.7 2006/12/08 16:26:10 mshopf Exp $"; /* Implementation of iso9660_t type */ struct _iso9660 { @@ -1200,9 +1200,7 @@ find_fs_lsn_recurse (CdIo *p_cdio, const char pathname[], lsn_t lsn) char _fullname[4096] = { 0, }; char *filename = (char *) statbuf->filename; - snprintf (_fullname, sizeof (_fullname), "%s%s", pathname, filename); - - strncat (_fullname, "/", sizeof (_fullname)); + snprintf (_fullname, sizeof (_fullname), "%s%s/", pathname, filename); if (statbuf->type == _STAT_DIR && strcmp ((char *) statbuf->filename, ".") diff --git a/src/input/vcd/libvcd/.cvsignore b/src/input/vcd/libvcd/.hgignore index 7d926a554..7d926a554 100644 --- a/src/input/vcd/libvcd/.cvsignore +++ b/src/input/vcd/libvcd/.hgignore diff --git a/src/input/vcd/libvcd/info.c b/src/input/vcd/libvcd/info.c index d178968a8..b01bd6eee 100644 --- a/src/input/vcd/libvcd/info.c +++ b/src/input/vcd/libvcd/info.c @@ -1,5 +1,5 @@ /* - $Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $ + $Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> @@ -59,7 +59,7 @@ #include <stddef.h> #include <errno.h> -static const char _rcsid[] = "$Id: info.c,v 1.7 2006/09/26 22:29:39 dgp85 Exp $"; +static const char _rcsid[] = "$Id: info.c,v 1.8 2007/03/23 21:47:31 dsalt Exp $"; #define BUF_COUNT 16 #define BUF_SIZE 80 @@ -1904,14 +1904,12 @@ vcdinfo_open(vcdinfo_obj_t **obj_p, char *source_name[], strlen (ISO_XA_MARKER_STRING)); } - if (!read_info(obj->img, &(obj->info), &(obj->vcd_type))) - return VCDINFO_OPEN_OTHER; - - if (vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID) - return VCDINFO_OPEN_OTHER; - - if (!read_entries(obj->img, &(obj->entries))) + if (!read_info(obj->img, &(obj->info), &(obj->vcd_type)) || + vcdinfo_get_format_version (obj) == VCD_TYPE_INVALID || + !read_entries(obj->img, &(obj->entries))) { + free (obj); /* match 0.7.23's behaviour */ return VCDINFO_OPEN_OTHER; + } { size_t len = strlen(*source_name)+1; diff --git a/src/input/vcd/libvcd/libvcd/.cvsignore b/src/input/vcd/libvcd/libvcd/.hgignore index 282522db0..282522db0 100644 --- a/src/input/vcd/libvcd/libvcd/.cvsignore +++ b/src/input/vcd/libvcd/libvcd/.hgignore diff --git a/src/input/vcd/libvcd/vcd.c b/src/input/vcd/libvcd/vcd.c index e9618a7d7..0772149ec 100644 --- a/src/input/vcd/libvcd/vcd.c +++ b/src/input/vcd/libvcd/vcd.c @@ -1,5 +1,5 @@ /* - $Id: vcd.c,v 1.3 2005/01/01 02:43:59 rockyb Exp $ + $Id: vcd.c,v 1.4 2006/12/08 16:26:10 mshopf Exp $ Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> @@ -49,7 +49,7 @@ #include "util.h" #include "vcd.h" -static const char _rcsid[] = "$Id: vcd.c,v 1.3 2005/01/01 02:43:59 rockyb Exp $"; +static const char _rcsid[] = "$Id: vcd.c,v 1.4 2006/12/08 16:26:10 mshopf Exp $"; static const char zero[CDIO_CD_FRAMESIZE_RAW] = { 0, }; @@ -1664,7 +1664,7 @@ _write_sequence (VcdObj *obj, int track_idx) track->info->ahdr[i].bitrate / 1024, _mode_str[track->info->ahdr[i].mode]); - strncat (buf2, buf, sizeof(buf)); + strncat (buf2, buf, sizeof(buf2) - strlen(buf2) - 1); } vcd_info ("writing track %d, %s, %s, %s...", track_idx + 2, diff --git a/src/input/vcd/vcdio.c b/src/input/vcd/vcdio.c index 7fee5a0db..387397cf4 100644 --- a/src/input/vcd/vcdio.c +++ b/src/input/vcd/vcdio.c @@ -1,5 +1,5 @@ /* - $Id: vcdio.c,v 1.7 2005/06/14 17:27:12 rockyb Exp $ + $Id: vcdio.c,v 1.9 2007/03/23 21:47:31 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -103,9 +103,20 @@ vcdio_open(vcdplayer_t *p_vcdplayer, char *intended_vcd_device) } } - if ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, DRIVER_UNKNOWN, - NULL) != VCDINFO_OPEN_VCD) { - return false; + switch ( vcdinfo_open(&p_vcdplayer->vcd, &intended_vcd_device, + DRIVER_UNKNOWN, NULL)) + { + case VCDINFO_OPEN_ERROR: + /* Failed to open the device => return failure */ + return false; + + case VCDINFO_OPEN_VCD: + /* Opened the device, and it's a VCD => proceed */ + break; + + default: + /* Opened the device, but it's not a VCD => is closed, return failure */ + return false; } p_vcdinfo = p_vcdplayer->vcd; diff --git a/src/input/vcd/vcdplayer.c b/src/input/vcd/vcdplayer.c index 27f726e3c..502d736cc 100644 --- a/src/input/vcd/vcdplayer.c +++ b/src/input/vcd/vcdplayer.c @@ -1,5 +1,5 @@ /* - $Id: vcdplayer.c,v 1.19 2005/06/20 02:17:41 rockyb Exp $ + $Id: vcdplayer.c,v 1.20 2007/02/21 23:17:14 dgp85 Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -46,6 +46,12 @@ #include "vcdplayer.h" #include "vcdio.h" +/* This function is _not_ exported by libvcd, its usage should be avoided, most + * likely. + */ +void vcdinfo_get_seg_resolution(const vcdinfo_obj_t *p_vcdinfo, segnum_t i_seg, + /*out*/ uint16_t *max_x, /*out*/ uint16_t *max_y); + #define LOG_ERR(p_vcdplayer, s, args...) \ if (p_vcdplayer != NULL && p_vcdplayer->log_err != NULL) \ p_vcdplayer->log_err("%s: "s, __func__ , ##args) diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index baa6b0d9a..920b5c1d8 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -1,5 +1,5 @@ /* - $Id: xineplug_inp_vcd.c,v 1.50 2006/07/10 22:08:29 dgp85 Exp $ + $Id: xineplug_inp_vcd.c,v 1.53 2007/02/08 02:40:23 dsalt Exp $ Copyright (C) 2002, 2003, 2004, 2005 Rocky Bernstein <rocky@panix.com> @@ -322,6 +322,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) unsigned int n, i=0; unsigned int i_entries; vcdinfo_obj_t *p_vcdinfo; + int was_open; if (NULL == class) { LOG_MSG("%s", _("was passed a null class parameter")); @@ -331,7 +332,7 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) vcdplayer = &(my_vcd.player); /* If VCD already open, we gotta close and stop it. */ - if (vcdplayer->b_opened) { + if ((was_open = vcdplayer->b_opened)) { vcd_close(class); } @@ -374,6 +375,8 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) if (NULL == class->mrls) { LOG_ERR("Can't calloc %d MRL entries", class->num_mrls); class->num_mrls = 0; + if (!was_open) + vcdio_close(vcdplayer); return false; } @@ -445,6 +448,8 @@ vcd_build_mrl_list(vcd_input_class_t *class, char *vcd_device) class->mrl_track_offset, class->mrl_entry_offset, class->mrl_play_offset, class->mrl_segment_offset); + if (!was_open) + vcdio_close(vcdplayer); return true; } @@ -1290,7 +1295,7 @@ vcd_get_optional_data (input_plugin_t *this_gen, dbg_print(INPUT_DBG_EXT, "AUDIO CHANNEL = %d\n", channel); if (channel == (uint8_t)-1) { - sprintf(data, " %s", "auto"); + strcpy(data, "auto"); } else { const vcdinfo_obj_t *p_vcdinfo= my_vcd.player.vcd; unsigned int audio_type; @@ -1315,9 +1320,9 @@ vcd_get_optional_data (input_plugin_t *this_gen, channel = (int8_t) _x_get_spu_channel(my_vcd.stream); dbg_print(INPUT_DBG_EXT, "SPU CHANNEL = %d\n", channel); if (-1 == channel) { - sprintf(data, " %s", "auto"); + strcpy(data, "auto"); } else { - sprintf(data, " %1d", channel); + sprintf(data, "%1d", channel); } } @@ -1824,9 +1829,9 @@ _("The VCD play unit to use when none is specified in an MRL, e.g. " class->vcd_device = - strdup (config->register_string(config, + strdup (config->register_filename(config, "media.vcd.device", - "", + "", XINE_CONFIG_STRING_IS_DEVICE_NAME, _("CD-ROM drive used for VCD when none given"), _("What to use if no drive specified. If the setting is empty, xine will scan for CD drives."), 20, |