diff options
Diffstat (limited to 'src/input')
38 files changed, 127 insertions, 560 deletions
diff --git a/src/input/Makefile.am b/src/input/Makefile.am index 5de15d5c7..ddb2b466e 100644 --- a/src/input/Makefile.am +++ b/src/input/Makefile.am @@ -19,7 +19,6 @@ SUBDIRS += libdvdnav endif -xineinclude_HEADERS = input_plugin.h noinst_HEADERS = net_buf_ctrl.h mms.h mmsh.h pnm.h media_helper.h http_helper.h diff --git a/src/input/http_helper.c b/src/input/http_helper.c index 279d3ff05..83562c9dc 100644 --- a/src/input/http_helper.c +++ b/src/input/http_helper.c @@ -26,7 +26,7 @@ #include <string.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "http_helper.h" int _x_parse_url (char *url, char **proto, char** host, int *port, diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index f89697981..d266e12c3 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -68,9 +68,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "media_helper.h" #if defined(__sun) diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 9a40b1996..98a60134f 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -116,9 +116,9 @@ #define LOG_READS */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #define BUFSIZE 16384 @@ -237,9 +237,8 @@ typedef struct { int adapter_num; - char frontend_device[100]; - char dvr_device[100]; - char demux_device[100]; + char *dvr_device; + char *demux_device; struct dmx_pes_filter_params pesFilterParams[MAX_FILTERS]; struct dmx_pes_filter_params subFilterParams[MAX_SUBTITLES]; @@ -362,7 +361,7 @@ typedef struct { } dvb_input_plugin_t; typedef struct { - char *name; + const char *name; int value; } Param; @@ -551,9 +550,10 @@ static void tuner_dispose(tuner_t * this) for (x = 0; x < MAX_SUBTITLES; x++) if (this->fd_subfilter[x] >= 0) close(this->fd_subfilter[x]); - - if(this) - free(this); + + free(this->dvr_device); + free(this->demux_device); + free(this); } @@ -563,10 +563,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) tuner_t *this; int x; int test_video; - char *video_device=xine_xmalloc(200); + char *video_device = NULL; + char *frontend_device = NULL; - _x_assert(video_device != NULL); - this = (tuner_t *) xine_xmalloc(sizeof(tuner_t)); _x_assert(this != NULL); @@ -579,21 +578,24 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) this->xine = xine; this->adapter_num = adapter; - snprintf(this->frontend_device,100,"/dev/dvb/adapter%i/frontend0",this->adapter_num); - snprintf(this->demux_device,100,"/dev/dvb/adapter%i/demux0",this->adapter_num); - snprintf(this->dvr_device,100,"/dev/dvb/adapter%i/dvr0",this->adapter_num); - snprintf(video_device,100,"/dev/dvb/adapter%i/video0",this->adapter_num); - - if ((this->fd_frontend = open(this->frontend_device, O_RDWR)) < 0) { + asprintf(&this->demux_device,"/dev/dvb/adapter%i/demux0",this->adapter_num); + asprintf(&this->dvr_device,"/dev/dvb/adapter%i/dvr0",this->adapter_num); + asprintf(&video_device,"/dev/dvb/adapter%i/video0",this->adapter_num); + + asprintf(&frontend_device,"/dev/dvb/adapter%i/frontend0",this->adapter_num); + if ((this->fd_frontend = open(frontend_device, O_RDWR)) < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } + free(frontend_device); frontend_device = NULL; if ((ioctl(this->fd_frontend, FE_GET_INFO, &this->feinfo)) < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FE_GET_INFO: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } for (x = 0; x < MAX_FILTERS; x++) { @@ -601,7 +603,8 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) if (this->fd_pidfilter[x] < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE PIDfilter: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } } for (x = 0; x < MAX_SUBTITLES; x++) { @@ -633,7 +636,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) close(test_video); } + exit: free(video_device); + free(frontend_device); return this; } @@ -1594,7 +1599,7 @@ static void load_epg_data(dvb_input_plugin_t *this) case 0x54: { /* Content Descriptor, riveting stuff */ int content_bits = getbits(eit, 8, 4); - char *content[] = { + static const char *const content[] = { "UNKNOWN","MOVIE","NEWS","ENTERTAINMENT","SPORT", "CHILDRENS","MUSIC","ARTS/CULTURE","CURRENT AFFAIRS", "EDUCATIONAL","INFOTAINMENT","SPECIAL","COMEDY","DRAMA", diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 8656097bc..60f58d361 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -85,9 +85,9 @@ #endif /* Xine includes */ -#include "xineutils.h" -#include "buffer.h" -#include "xine_internal.h" +#include <xine/xineutils.h> +#include <xine/buffer.h> +#include <xine/xine_internal.h> #include "media_helper.h" /* Print debug messages? */ @@ -1621,12 +1621,12 @@ static int dvd_plugin_open (input_plugin_t *this_gen) { static input_plugin_t *dvd_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data) { dvd_input_plugin_t *this; dvd_input_class_t *class = (dvd_input_class_t*)class_gen; - static char *handled_mrl = "dvd:/"; + static const char handled_mrl[] = "dvd:/"; trace_print("Called\n"); /* Check we can handle this MRL */ - if (strncasecmp (data, handled_mrl, strlen(handled_mrl) ) != 0) + if (strncasecmp (data, handled_mrl, sizeof(handled_mrl)-1 ) != 0) return NULL; this = (dvd_input_plugin_t *) xine_xmalloc (sizeof (dvd_input_plugin_t)); diff --git a/src/input/input_file.c b/src/input/input_file.c index 1556afb09..2fe3925ea 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -44,10 +44,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/input_plugin.h> #define MAXFILES 65535 diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 71a4ada85..968945023 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -24,9 +24,9 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #include <libgnomevfs/gnome-vfs.h> @@ -291,7 +291,7 @@ gnomevfs_klass_dispose (input_class_t *this_gen) g_free (this); } -static const char *const ignore_scheme[] = { "cdda", "file", "http" }; +static const char ignore_scheme[][8] = { "cdda", "file", "http" }; static input_plugin_t * gnomevfs_klass_get_instance (input_class_t *klass_gen, xine_stream_t *stream, diff --git a/src/input/input_http.c b/src/input/input_http.c index 96841593f..dd9798bb1 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -48,9 +48,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #include "http_helper.h" @@ -79,7 +79,6 @@ typedef struct { off_t contentlength; char buf[BUFSIZE]; - char proxybuf[BUFSIZE]; char preview[MAX_PREVIEW_SIZE]; off_t preview_size; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index 0b9e6c7f2..0287e0060 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -41,9 +41,9 @@ */ #include "bswap.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "mms.h" #include "mmsh.h" diff --git a/src/input/input_net.c b/src/input/input_net.c index 7a52f670d..1d7288f41 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -66,9 +66,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #define NET_BS_LEN 2324 diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h deleted file mode 100644 index 2917721c9..000000000 --- a/src/input/input_plugin.h +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright (C) 2000-2004 the xine project - * - * This file is part of xine, a free video player. - * - * xine is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * xine is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - */ - -#ifndef HAVE_INPUT_PLUGIN_H -#define HAVE_INPUT_PLUGIN_H - -#include <sys/types.h> - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "xineutils.h" -# include "buffer.h" -# include "configfile.h" -#else -# include <xine/os_types.h> -# include <xine/xineutils.h> -# include <xine/buffer.h> -# include <xine/configfile.h> -#endif - -#define INPUT_PLUGIN_IFACE_VERSION 18 - -typedef struct input_class_s input_class_t ; -typedef struct input_plugin_s input_plugin_t; - -struct input_class_s { - - /* - * create a new instance of this plugin class - * return NULL if the plugin does'nt handle the given mrl - */ - input_plugin_t* (*get_instance) (input_class_t *this, xine_stream_t *stream, const char *mrl); - - /** - * @brief short human readable identifier for this plugin class - */ - const char *identifier; - - /** - * @brief human readable (verbose = 1 line) description for this plugin class - * - * The description is passed to gettext() to internationalise. - */ - const char *description; - - /** - * @brief Optional non-standard catalog to use with dgettext() for description. - */ - const char *textdomain; - - /* - * ls function, optional: may be NULL - * return value: NULL => filename is a file, **char=> filename is a dir - */ - xine_mrl_t ** (*get_dir) (input_class_t *this, const char *filename, int *nFiles); - - /* - * generate autoplay list, optional: may be NULL - * return value: list of MRLs - */ - char ** (*get_autoplay_list) (input_class_t *this, int *num_files); - - /* - * close down, free all resources - */ - void (*dispose) (input_class_t *this); - - /* - * eject/load the media (if possible), optional: may be NULL - * - * returns 0 for temporary failures - */ - int (*eject_media) (input_class_t *this); -}; - -#define default_input_class_dispose (void (*) (input_class_t *this))free - -struct input_plugin_s { - - /* - * open the stream - * return 0 if an error occured - */ - int (*open) (input_plugin_t *this); - - /* - * return capabilities of the current playable entity. See - * get_current_pos below for a description of a "playable entity" - * Capabilities a created by "OR"ing a mask of constants listed - * below which start "INPUT_CAP". - * - * depending on the values set, some of the functions below - * will or will not get called or should (not) be able to - * do certain tasks. - * - * for example if INPUT_CAP_SEEKABLE is set, - * the seek() function is expected to work fully at any time. - * however, if the flag is not set, the seek() function should - * make a best-effort attempt to seek, e.g. at least - * relative forward seeking should work. - */ - uint32_t (*get_capabilities) (input_plugin_t *this); - - /* - * read nlen bytes, return number of bytes read - * Should block until some bytes available for read; - * a return value of 0 indicates no data available - */ - off_t (*read) (input_plugin_t *this, void *buf, off_t nlen); - - - /* - * read one block, return newly allocated block (or NULL on failure) - * for blocked input sources len must be == blocksize - * the fifo parameter is only used to get access to the buffer_pool_alloc function - */ - buf_element_t *(*read_block)(input_plugin_t *this, fifo_buffer_t *fifo, off_t len); - - - /* - * seek position, return new position - * - * if seeking failed, -1 is returned - */ - off_t (*seek) (input_plugin_t *this, off_t offset, int origin); - - - /* - * seek to time position, return new position - * time_offset is given in miliseconds - * - * if seeking failed, -1 is returned - * - * note: only SEEK_SET (0) is currently supported as origin - * note: may be NULL is not supported - */ - off_t (*seek_time) (input_plugin_t *this, int time_offset, int origin); - - - /* - * get current position in stream. - * - */ - off_t (*get_current_pos) (input_plugin_t *this); - - - /* - * get current time position in stream in miliseconds. - * - * note: may be NULL is not supported - */ - int (*get_current_time) (input_plugin_t *this); - - - /* - * return number of bytes in the next playable entity or -1 if the - * input is unlimited, as would be the case in a network stream. - * - * A "playable entity" tends to be the entities listed in a playback - * list or the units on which playback control generally works on. - * It might be the number of bytes in a VCD "segment" or "track" (if - * the track has no "entry" subdivisions), or the number of bytes in - * a PS (Program Segment or "Chapter") of a DVD. If there are no - * subdivisions of the input medium and it is considered one - * indivisible entity, it would be the byte count of that entity; - * for example, the length in bytes of an MPEG file. - - * This length information is used, for example when in setting the - * absolute or relative play position or possibly calculating the - * bit rate. - */ - off_t (*get_length) (input_plugin_t *this); - - - /* - * return block size in bytes of next complete playable entity (if - * supported, 0 otherwise). See the description above under - * get_length for a description of a "complete playable entity". - * - * this block size is only used for mpeg streams stored on - * a block oriented storage media, e.g. DVDs and VCDs, to speed - * up the demuxing process. only set this (and the INPUT_CAP_BLOCK - * flag) if this is the case for your input plugin. - * - * make this function simply return 0 if unsure. - */ - - uint32_t (*get_blocksize) (input_plugin_t *this); - - - /* - * return current MRL - */ - const char * (*get_mrl) (input_plugin_t *this); - - - /* - * request optional data from input plugin. - */ - int (*get_optional_data) (input_plugin_t *this, void *data, int data_type); - - - /* - * close stream, free instance resources - */ - void (*dispose) (input_plugin_t *this); - - /* - * "backward" link to input plugin class struct - */ - - input_class_t *input_class; - - void *node; /* used by plugin loader */ - -}; - -/* - * possible capabilites an input plugin can have: - */ -#define INPUT_CAP_NOCAP 0x00000000 - -/* - * INPUT_CAP_SEEKABLE: - * seek () works reliably. - * even for plugins that do not have this flag set - * it is a good idea to implement the seek() function - * in a "best effort" style anyway, so at least - * throw away data for network streams when seeking forward - */ - -#define INPUT_CAP_SEEKABLE 0x00000001 - -/* - * INPUT_CAP_BLOCK: - * means more or less that a block device sits behind - * this input plugin. get_blocksize must be implemented. - * will be used for fast and efficient demuxing of - * mpeg streams (demux_mpeg_block). - */ - -#define INPUT_CAP_BLOCK 0x00000002 - -/* - * INPUT_CAP_AUDIOLANG: - * INPUT_CAP_SPULANG: - * input plugin knows something about audio/spu languages, - * e.g. knows that audio stream #0 is english, - * audio stream #1 is german, ... - * *((int *)data) will provide the requested channel number - * and awaits the language back in (char *)data - */ - -#define INPUT_CAP_AUDIOLANG 0x00000008 -#define INPUT_CAP_SPULANG 0x00000010 - -/* - * INPUT_CAP_PREVIEW: - * get_optional_data can handle INPUT_OPTIONAL_DATA_PREVIEW - * so a non-seekable stream plugin can povide the first - * few bytes for demuxers to look at them and decide wheter - * they can handle the stream or not. the preview data must - * be buffered and delivered again through subsequent - * read() calls. - * caller must provide a buffer allocated with at least - * MAX_PREVIEW_SIZE bytes. - */ - -#define INPUT_CAP_PREVIEW 0x00000040 - -/* - * INPUT_CAP_CHAPTERS: - * The media streams provided by this plugin have an internal - * structure dividing it into segments usable for navigation. - * For those plugins, the behaviour of the skip button in UIs - * should be changed from "next MRL" to "next chapter" by - * sending XINE_EVENT_INPUT_NEXT. - */ - -#define INPUT_CAP_CHAPTERS 0x00000080 - -/* - * INPUT_CAP_RIP_FORBIDDEN: - * means that rip/disk saving must not be used. - * (probably at author's request) - */ - -#define INPUT_CAP_RIP_FORBIDDEN 0x00000100 - - -#define INPUT_IS_SEEKABLE(input) (((input)->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) - -#define INPUT_OPTIONAL_UNSUPPORTED 0 -#define INPUT_OPTIONAL_SUCCESS 1 - -#define INPUT_OPTIONAL_DATA_AUDIOLANG 2 -#define INPUT_OPTIONAL_DATA_SPULANG 3 -#define INPUT_OPTIONAL_DATA_PREVIEW 7 - -#define MAX_MRL_ENTRIES 255 -#define MAX_PREVIEW_SIZE 4096 - -/* Types of mrls returned by get_dir() */ -#define mrl_unknown (0 << 0) -#define mrl_dvd (1 << 0) -#define mrl_vcd (1 << 1) -#define mrl_net (1 << 2) -#define mrl_rtp (1 << 3) -#define mrl_stdin (1 << 4) -#define mrl_cda (1 << 5) -#define mrl_file (1 << 6) -#define mrl_file_fifo (1 << 7) -#define mrl_file_chardev (1 << 8) -#define mrl_file_directory (1 << 9) -#define mrl_file_blockdev (1 << 10) -#define mrl_file_normal (1 << 11) -#define mrl_file_symlink (1 << 12) -#define mrl_file_sock (1 << 13) -#define mrl_file_exec (1 << 14) -#define mrl_file_backup (1 << 15) -#define mrl_file_hidden (1 << 16) - -/* - * Freeing/zeroing all of entries of given mrl. - */ -#define MRL_ZERO(m) { \ - if((m)) { \ - if((m)->origin) \ - free((m)->origin); \ - if((m)->mrl) \ - free((m)->mrl); \ - if((m)->link) \ - free((m)->link); \ - (m)->origin = NULL; \ - (m)->mrl = NULL; \ - (m)->link = NULL; \ - (m)->type = 0; \ - (m)->size = (off_t) 0; \ - } \ -} - -/* - * Duplicate two mrls entries (s = source, d = destination). - */ -#define MRL_DUPLICATE(s, d) { \ - _x_assert((s) != NULL); \ - _x_assert((d) != NULL); \ - \ - if((s)->origin) { \ - if((d)->origin) { \ - (d)->origin = (char *) realloc((d)->origin, strlen((s)->origin) + 1); \ - sprintf((d)->origin, "%s", (s)->origin); \ - } \ - else \ - (d)->origin = strdup((s)->origin); \ - } \ - else \ - (d)->origin = NULL; \ - \ - if((s)->mrl) { \ - if((d)->mrl) { \ - (d)->mrl = (char *) realloc((d)->mrl, strlen((s)->mrl) + 1); \ - sprintf((d)->mrl, "%s", (s)->mrl); \ - } \ - else \ - (d)->mrl = strdup((s)->mrl); \ - } \ - else \ - (d)->mrl = NULL; \ - \ - if((s)->link) { \ - if((d)->link) { \ - (d)->link = (char *) realloc((d)->link, strlen((s)->link) + 1); \ - sprintf((d)->link, "%s", (s)->link); \ - } \ - else \ - (d)->link = strdup((s)->link); \ - } \ - else \ - (d)->link = NULL; \ - \ - (d)->type = (s)->type; \ - (d)->size = (s)->size; \ -} - -/* - * Duplicate two arrays of mrls (s = source, d = destination). - */ -#define MRLS_DUPLICATE(s, d) { \ - int i = 0; \ - \ - _x_assert((s) != NULL); \ - _x_assert((d) != NULL); \ - \ - while((s) != NULL) { \ - d[i] = (xine_mrl_t *) malloc(sizeof(xine_mrl_t)); \ - MRL_DUPLICATE(s[i], d[i]); \ - i++; \ - } \ -} - - -#endif diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c index 3bc026b69..3271a04c9 100644 --- a/src/input/input_pnm.c +++ b/src/input/input_pnm.c @@ -41,9 +41,9 @@ */ #include "bswap.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "pnm.h" #include "net_buf_ctrl.h" diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index 40bb9dc79..d68b3fe34 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -108,10 +108,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/input_plugin.h> #define PVR_DEVICE "/dev/video0" diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index c3abf4bf5..33183e555 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -91,9 +91,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #ifdef __GNUC__ diff --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c index 690507d88..bee192c0d 100644 --- a/src/input/input_rtsp.c +++ b/src/input/input_rtsp.c @@ -41,9 +41,9 @@ */ #include "bswap.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "librtsp/rtsp_session.h" #include "net_buf_ctrl.h" diff --git a/src/input/input_smb.c b/src/input/input_smb.c index 8bbbfdfe5..44fa96bfd 100644 --- a/src/input/input_smb.c +++ b/src/input/input_smb.c @@ -23,10 +23,10 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/input_plugin.h> #include <libsmbclient.h> #include <sys/types.h> diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index e28a8d0c3..d67954ea8 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -36,9 +36,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "net_buf_ctrl.h" #define BUFSIZE 1024 diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index ff9ea87d0..162e2f7ab 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -88,9 +88,9 @@ static char *log_line_prefix() } #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #define NUM_FRAMES 15 @@ -110,8 +110,8 @@ static const resolution_t resolutions[] = { { 160, 120 } }; -static char *tv_standard_names[] = { "PAL", "NTSC", "SECAM", NULL }; -static int tv_standard_values[] = { VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_SECAM }; +static const char *const tv_standard_names[] = { "PAL", "NTSC", "SECAM", NULL }; +static const int tv_standard_values[] = { VIDEO_MODE_PAL, VIDEO_MODE_NTSC, VIDEO_MODE_SECAM }; #define NUM_RESOLUTIONS (sizeof(resolutions)/sizeof(resolutions[0])) #define RADIO_DEV "/dev/v4l/radio0" diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 14a924a2a..4b624a9e7 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -45,9 +45,9 @@ #error "you need to add cdrom / VCD support for your platform to input_vcd and configure.in" #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "media_helper.h" #if defined(__sun) diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c index 200a1dbec..c15a5c3f5 100644 --- a/src/input/libdvdnav/dvd_reader.c +++ b/src/input/libdvdnav/dvd_reader.c @@ -70,7 +70,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz ) #include <mntent.h> #endif -#include "compat.h" +#include <xine/compat.h> #include "dvd_udf.h" #include "dvd_input.h" #include "dvd_reader.h" diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index f7206b583..9fc7a3867 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -43,7 +43,7 @@ */ #include "asmrp.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define ASMRP_SYM_NONE 0 #define ASMRP_SYM_EOF 1 diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index 925b0fdf8..078b12757 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -33,8 +33,8 @@ #include "real.h" #include "asmrp.h" #include "sdpplin.h" -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" #define XOR_TABLE_LEN 37 @@ -316,14 +316,13 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe int ch_len, resp_len; int i; char *ptr; - char buf[128]; + char buf[128] = { 0, }; /* initialize return values */ memset(response, 0, 64); memset(chksum, 0, 34); /* initialize buffer */ - memset(buf, 0, 128); ptr=buf; _X_BE_32C(ptr, 0xa1e9149d); ptr+=4; @@ -353,10 +352,10 @@ void real_calc_response_and_checksum (char *response, char *chksum, char *challe calc_response_string (response, buf); /* add tail */ - resp_len = strlen (response); - strcpy (&response[resp_len], "01d0a8e3"); + strcat(response, "01d0a8e3"); /* calculate checksum */ + resp_len = strlen (response); for (i=0; i<resp_len/4; i++) chksum[i] = response[i*4]; } diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 4fea74636..c12fff1d6 100644 --- a/src/input/libreal/rmff.c +++ b/src/input/libreal/rmff.c @@ -27,7 +27,7 @@ #define LOG */ -#include "xineutils.h" +#include <xine/xineutils.h> #include "bswap.h" #include "rmff.h" @@ -311,19 +311,13 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) { mdpr->duration=_X_BE_32(&data[36]); mdpr->stream_name_size=data[40]; - mdpr->stream_name = calloc(mdpr->stream_name_size+1, sizeof(char)); - memcpy(mdpr->stream_name, &data[41], mdpr->stream_name_size); - mdpr->stream_name[mdpr->stream_name_size]=0; + mdpr->stream_name = xine_memdup0(&data[41], mdpr->stream_name_size); mdpr->mime_type_size=data[41+mdpr->stream_name_size]; - mdpr->mime_type = calloc(mdpr->mime_type_size+1, sizeof(char)); - memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size); - mdpr->mime_type[mdpr->mime_type_size]=0; + mdpr->mime_type = xine_memdup0(&data[42+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->type_specific_len=_X_BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data = calloc(mdpr->type_specific_len, sizeof(char)); - memcpy(mdpr->type_specific_data, - &data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); + mdpr->type_specific_data = xine_memdup(&data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); return mdpr; } @@ -341,24 +335,17 @@ static rmff_cont_t *rmff_scan_cont(const char *data) { lprintf("warning: unknown object version in CONT: 0x%04x\n", cont->object_version); } cont->title_len=_X_BE_16(&data[10]); - cont->title = calloc((cont->title_len+1), sizeof(char)); - memcpy(cont->title, &data[12], cont->title_len); - cont->title[cont->title_len]=0; + cont->title = xine_memdup0(&data[12], cont->title_len); pos=cont->title_len+12; cont->author_len=_X_BE_16(&data[pos]); - cont->author = calloc(cont->author_len+1, sizeof(char)); - memcpy(cont->author, &data[pos+2], cont->author_len); - cont->author[cont->author_len]=0; + cont->author = xine_memdup0(&data[pos+2], cont->author_len); pos=pos+2+cont->author_len; cont->copyright_len=_X_BE_16(&data[pos]); - cont->copyright = calloc(cont->copyright_len+1, sizeof(char)); - memcpy(cont->copyright, &data[pos+2], cont->copyright_len); + cont->copyright = xine_memdup0(&data[pos+2], cont->copyright_len); cont->copyright[cont->copyright_len]=0; pos=pos+2+cont->copyright_len; cont->comment_len=_X_BE_16(&data[pos]); - cont->comment = calloc(cont->comment_len+1, sizeof(char)); - memcpy(cont->comment, &data[pos+2], cont->comment_len); - cont->comment[cont->comment_len]=0; + cont->comment = xine_memdup0(&data[pos+2], cont->comment_len); return cont; } @@ -584,8 +571,7 @@ rmff_mdpr_t *rmff_new_mdpr( mdpr->mime_type_size=strlen(mime_type); } mdpr->type_specific_len=type_specific_len; - mdpr->type_specific_data = calloc(type_specific_len, sizeof(char)); - memcpy(mdpr->type_specific_data,type_specific_data,type_specific_len); + mdpr->type_specific_data = xine_memdup(type_specific_data,type_specific_len); mdpr->mlti_data=NULL; mdpr->size=mdpr->stream_name_size+mdpr->mime_type_size+mdpr->type_specific_len+46; diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index ad65bd491..0dc8709d8 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -29,7 +29,7 @@ #include "rmff.h" #include "rtsp.h" #include "sdpplin.h" -#include "xineutils.h" +#include <xine/xineutils.h> /* libavutil from FFmpeg */ #include <base64.h> @@ -142,8 +142,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { uint8_t decoded[32]; desc->mlti_data_size = av_base64_decode(decoded, buf, 32); if ( desc->mlti_data_size > 0 ) { - desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size); - memcpy(desc->mlti_data, decoded, desc->mlti_data_size); + desc->mlti_data = xine_memdup(decoded, desc->mlti_data_size); handled=1; *data=nl(*data); lprintf("mlti_data_size: %i\n", desc->mlti_data_size); diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index d0f09d563..7607f2221 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -45,8 +45,8 @@ */ #include "rtsp.h" -#include "io_helper.h" -#include "xineutils.h" +#include <xine/io_helper.h> +#include <xine/xineutils.h> #define BUF_SIZE 4096 #define HEADER_SIZE 1024 diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index 7f7a3ddba..3c829e2e8 100644 --- a/src/input/librtsp/rtsp.h +++ b/src/input/librtsp/rtsp.h @@ -25,7 +25,7 @@ #define HAVE_RTSP_H /*#include <inttypes.h> */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #ifdef __CYGWIN__ #define uint32_t unsigned int diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index 84552503b..e9ce5bc5c 100644 --- a/src/input/librtsp/rtsp_session.c +++ b/src/input/librtsp/rtsp_session.c @@ -41,7 +41,7 @@ #include "real.h" #include "rmff.h" #include "asmrp.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define BUF_SIZE 4096 #define HEADER_SIZE 4096 diff --git a/src/input/media_helper.h b/src/input/media_helper.h index 7e6303dfd..a8e376fdc 100644 --- a/src/input/media_helper.h +++ b/src/input/media_helper.h @@ -22,7 +22,7 @@ #ifndef HAVE_MEDIA_HELPER_H #define HAVE_MEDIA_HELPER_H -#include "xine_internal.h" +#include <xine/xine_internal.h> int media_eject_media (xine_t *xine, const char *device); diff --git a/src/input/mms.c b/src/input/mms.c index f11a89cf3..37e7ff395 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -56,8 +56,8 @@ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" #include "http_helper.h" @@ -532,7 +532,7 @@ static int interp_asf_header (mms_t *this) { return 1; } -static const char *const mmst_proto_s[] = { "mms", "mmst", NULL }; +static const char mmst_proto_s[][8] = { "mms", "mmst", "" }; static int mmst_valid_proto (char *proto) { int i = 0; @@ -542,7 +542,7 @@ static int mmst_valid_proto (char *proto) { if (!proto) return 0; - while(mmst_proto_s[i]) { + while(*(mmst_proto_s[i])) { if (!strcasecmp(proto, mmst_proto_s[i])) { return 1; } diff --git a/src/input/mms.h b/src/input/mms.h index a483fa0c6..67ea5ba0b 100644 --- a/src/input/mms.h +++ b/src/input/mms.h @@ -24,7 +24,7 @@ #define HAVE_MMS_H #include <inttypes.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct mms_s mms_t; diff --git a/src/input/mmsh.c b/src/input/mmsh.c index ae1c62bc1..3a33e8d7f 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -51,8 +51,8 @@ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" #include "http_helper.h" @@ -447,7 +447,7 @@ static int interp_header (mmsh_t *this) { return 1; } -static const char *const mmsh_proto_s[] = { "mms", "mmsh", NULL }; +static const char mmsh_proto_s[][8] = { "mms", "mmsh", "" }; static int mmsh_valid_proto (char *proto) { int i = 0; @@ -457,7 +457,7 @@ static int mmsh_valid_proto (char *proto) { if (!proto) return 0; - while(mmsh_proto_s[i]) { + while(*(mmsh_proto_s[i])) { if (!strcasecmp(proto, mmsh_proto_s[i])) { return 1; } diff --git a/src/input/mmsh.h b/src/input/mmsh.h index 633d3b5f6..eeceb030b 100644 --- a/src/input/mmsh.h +++ b/src/input/mmsh.h @@ -24,7 +24,7 @@ #define HAVE_MMSH_H #include <inttypes.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct mmsh_s mmsh_t; diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c index 624af4081..aaf575e40 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -118,8 +118,8 @@ void nbc_check_buffers (nbc_t *this) { } static void display_stats (nbc_t *this) { - const char *buffering[2] = {" ", "buf"}; - const char *enabled[2] = {"off", "on "}; + static const char buffering[2][4] = {" ", "buf"}; + static const char enabled[2][4] = {"off", "on "}; printf("bufing: %d, enb: %d\n", this->buffering, this->enabled); printf("net_buf_ctrl: vid %3d%% %4.1fs %4" PRId64 "kbps %1d, "\ diff --git a/src/input/net_buf_ctrl.h b/src/input/net_buf_ctrl.h index 79f698008..c35187179 100644 --- a/src/input/net_buf_ctrl.h +++ b/src/input/net_buf_ctrl.h @@ -23,7 +23,7 @@ #ifndef HAVE_NET_BUF_CTRL_H #define HAVE_NET_BUF_CTRL_H -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct nbc_s nbc_t; diff --git a/src/input/pnm.c b/src/input/pnm.c index 942e52957..3cb36ac3f 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -45,9 +45,9 @@ #include "pnm.h" #include "libreal/rmff.h" #include "bswap.h" -#include "io_helper.h" -#include "xineutils.h" -#include "xine_internal.h" +#include <xine/io_helper.h> +#include <xine/xineutils.h> +#include <xine/xine_internal.h> #define BUF_SIZE 4096 #define HEADER_SIZE 4096 diff --git a/src/input/pnm.h b/src/input/pnm.h index 838fbadcc..bf3514bae 100644 --- a/src/input/pnm.h +++ b/src/input/pnm.h @@ -26,7 +26,7 @@ #ifndef __CYGWIN__ #include <inttypes.h> #endif -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct pnm_s pnm_t; diff --git a/src/input/vcd/xine-extra.h b/src/input/vcd/xine-extra.h index 0650f863d..59f562cbd 100644 --- a/src/input/vcd/xine-extra.h +++ b/src/input/vcd/xine-extra.h @@ -36,9 +36,9 @@ #endif /* Xine includes */ -#include "xine_internal.h" -#include "input_plugin.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/input_plugin.h> +#include <xine/xineutils.h> /*! This routine is like xine_log, except it takes a va_list instead of diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index b794331f1..27b1cfbbf 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -52,8 +52,8 @@ #define xine_config_entry_t xine_cfg_entry_t /* Xine includes */ -#include "xineutils.h" -#include "input_plugin.h" +#include <xine/xineutils.h> +#include <xine/input_plugin.h> #include "xine-extra.h" |