diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/combined/xine_ogg_demuxer.c | 22 | ||||
-rw-r--r-- | src/demuxers/demux_flv.c | 24 | ||||
-rw-r--r-- | src/input/input_dvb.c | 45 | ||||
-rw-r--r-- | src/input/input_dvd.c | 4 | ||||
-rw-r--r-- | src/input/input_gnome_vfs.c | 2 | ||||
-rw-r--r-- | src/input/input_v4l.c | 4 | ||||
-rw-r--r-- | src/input/mms.c | 4 | ||||
-rw-r--r-- | src/input/mmsh.c | 4 | ||||
-rw-r--r-- | src/input/net_buf_ctrl.c | 4 | ||||
-rw-r--r-- | src/libmpeg2/stats.c | 10 | ||||
-rw-r--r-- | src/libspucc/cc_decoder.h | 2 | ||||
-rw-r--r-- | src/post/deinterlace/xine_plugin.c | 4 | ||||
-rw-r--r-- | src/post/planar/noise.c | 4 | ||||
-rw-r--r-- | src/post/planar/pp.c | 25 | ||||
-rw-r--r-- | src/xine-engine/configfile.c | 2 | ||||
-rw-r--r-- | src/xine-engine/osd.c | 96 |
16 files changed, 154 insertions, 102 deletions
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index 8c722f84f..d6b5ea214 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -1959,32 +1959,14 @@ static int detect_anx_content (int detection_method, demux_class_t *class_gen, case METHOD_BY_CONTENT: { uint8_t buf[ANNODEX_SIGNATURE_SEARCH]; - int found_annodex_signature = 0; - const char *annodex_signature = "Annodex"; - int annodex_signature_length = 7; /* = strlen(annodex_signature) */ - int i, j; if (_x_demux_read_header(input, buf, ANNODEX_SIGNATURE_SEARCH) != ANNODEX_SIGNATURE_SEARCH) return 0; /* scan for 'Annodex' signature in the first 64 bytes */ - for (i = 0, j = 0; i < ANNODEX_SIGNATURE_SEARCH; i++) { - if (buf[i] == annodex_signature[j]) { - if (j >= annodex_signature_length) { - /* found signature */ - found_annodex_signature = 1; - break; - } else { - j++; - } - } - } - - if (found_annodex_signature) - return 1; - else - return 0; + return !!memmem(buf, ANNODEX_SIGNATURE_SEARCH, + "Annodex", sizeof("Annodex")-1); } #undef ANNODEX_SIGNATURE_SEARCH diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 86f9a038b..e6a7e234a 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -870,30 +870,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str return &this->demux_plugin; } -static const char *get_description (demux_class_t *this_gen) { - return "Flash Video file demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "FLV"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "flv"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return "video/x-flv: flv: Flash video;" - "video/flv: flv: Flash video;" - "application/x-flash-video: flv: Flash video;"; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_flv_class_t *this = (demux_flv_class_t *) this_gen; - - free (this); -} - static void *init_plugin (xine_t *xine, void *data) { demux_flv_class_t *this; diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index b35f35fa6..146185845 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -234,9 +234,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]; @@ -359,7 +358,7 @@ typedef struct { } dvb_input_plugin_t; typedef struct { - char *name; + const char *name; int value; } Param; @@ -548,9 +547,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); } @@ -560,10 +560,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); @@ -576,21 +575,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++) { @@ -598,7 +600,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++) { @@ -630,7 +633,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) close(test_video); } + exit: free(video_device); + free(frontend_device); return this; } @@ -1591,7 +1596,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 3c06bdec5..60f58d361 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -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_gnome_vfs.c b/src/input/input_gnome_vfs.c index e93a747ee..968945023 100644 --- a/src/input/input_gnome_vfs.c +++ b/src/input/input_gnome_vfs.c @@ -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_v4l.c b/src/input/input_v4l.c index 58f982da6..162e2f7ab 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -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/mms.c b/src/input/mms.c index ccc56b094..37e7ff395 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -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/mmsh.c b/src/input/mmsh.c index f6bf0bcb6..3a33e8d7f 100644 --- a/src/input/mmsh.c +++ b/src/input/mmsh.c @@ -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/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/libmpeg2/stats.c b/src/libmpeg2/stats.c index 04de526f1..63c701179 100644 --- a/src/libmpeg2/stats.c +++ b/src/libmpeg2/stats.c @@ -51,7 +51,7 @@ static int debug_is_on (void) static void stats_picture (uint8_t * buffer) { - static char * picture_coding_type_str [8] = { + static const char *const picture_coding_type_str [8] = { "Invalid picture type", "I-type", "P-type", @@ -81,7 +81,7 @@ static void stats_user_data (uint8_t * buffer) static void stats_sequence (uint8_t * buffer) { - static char * aspect_ratio_information_str[8] = { + static const char *const aspect_ratio_information_str[8] = { "Invalid Aspect Ratio", "1:1", "4:3", @@ -91,7 +91,7 @@ static void stats_sequence (uint8_t * buffer) "Invalid Aspect Ratio", "Invalid Aspect Ratio" }; - static char * frame_rate_str[16] = { + static const char *const frame_rate_str[16] = { "Invalid frame_rate_code", "23.976", "24", "25" , "29.97", "30" , "50", "59.94", "60" , @@ -159,7 +159,7 @@ static void stats_slice (int code, uint8_t * buffer) static void stats_sequence_extension (uint8_t * buffer) { - static char * chroma_format_str[4] = { + static const char *const chroma_format_str[4] = { "Invalid Chroma Format", "4:2:0 Chroma", "4:2:2 Chroma", @@ -204,7 +204,7 @@ static void stats_picture_display_extension (uint8_t * buffer) static void stats_picture_coding_extension (uint8_t * buffer) { - static char * picture_structure_str[4] = { + static const char *const picture_structure_str[4] = { "Invalid Picture Structure", "Top field", "Bottom field", diff --git a/src/libspucc/cc_decoder.h b/src/libspucc/cc_decoder.h index 8698189a6..3924bb8be 100644 --- a/src/libspucc/cc_decoder.h +++ b/src/libspucc/cc_decoder.h @@ -31,7 +31,7 @@ typedef struct cc_decoder_s cc_decoder_t; typedef struct cc_renderer_s cc_renderer_t; #define NUM_CC_PALETTES 2 -static const char *cc_schemes[NUM_CC_PALETTES + 1] = { +static const char *const cc_schemes[NUM_CC_PALETTES + 1] = { "White/Gray/Translucent", "White/Black/Solid", NULL diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 5f3f8de97..4a7028b20 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -56,8 +56,8 @@ typedef struct post_plugin_deinterlace_s post_plugin_deinterlace_t; #define MAX_NUM_METHODS 30 static const char *enum_methods[MAX_NUM_METHODS]; -static const char *enum_pulldown[] = { "none", "vektor", NULL }; -static const char *enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; +static const char *const enum_pulldown[] = { "none", "vektor", NULL }; +static const char *const enum_framerate[] = { "full", "half_top", "half_bottom", NULL }; static void *help_string; diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 90ec331ee..efc3e49f8 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -318,8 +318,8 @@ typedef struct noise_parameters_s { type, quality, pattern; } noise_parameters_t; -static char *enum_types[] = {"uniform", "gaussian", NULL}; -static char *enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}; +static const char *const enum_types[] = {"uniform", "gaussian", NULL}; +static const char *const enum_quality[] = {"fixed", "temporal", "averaged temporal", NULL}; /* * description of params struct diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 484afdd31..f8c571dcb 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -20,6 +20,8 @@ * plugin for ffmpeg libpostprocess */ +#include <config.h> + #include <xine/xine_internal.h> #include <xine/post.h> #include <xine/xineutils.h> @@ -102,23 +104,18 @@ static xine_post_api_descr_t * get_param_descr (void) { } static char * get_help (void) { - char *help1 = - _("FFmpeg libpostprocess plugin.\n" - "\n" - "Parameters\n" - "\n"); - - char *help2 = - _("\n" - "* libpostprocess (C) Michael Niedermayer\n" - ); static char *help = NULL; if( !help ) { - help = malloc( strlen(help1) + strlen(help2) + strlen(pp_help) + 1); - strcpy(help, help1); - strcat(help, pp_help); - strcat(help, help2); + asprintf(&help, "%s%s%s", + _("FFmpeg libpostprocess plugin.\n" + "\n" + "Parameters\n" + "\n"), + pp_help, + _("\n" + "* libpostprocess (C) Michael Niedermayer\n") + ); } return help; } diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 47b77b03e..8f3f9c684 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -207,7 +207,7 @@ static const xine_config_entry_translation_t config_entry_translation[] = { static int config_section_enum(const char *sect) { - static char *known_section[] = { + static const char *const known_section[] = { "gui", "ui", "audio", diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 39687e83f..907b20c8e 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -20,8 +20,6 @@ * OSD stuff (text and graphic primitives) */ -#define __OSD_C__ - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -110,6 +108,100 @@ # define FT_LOAD_FLAGS (FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING) #endif +/* This text descriptions are used for config screen */ +static const char *const textpalettes_str[NUMBER_OF_TEXT_PALETTES+1] = { + "white-black-transparent", + "white-none-transparent", + "white-none-translucid", + "yellow-black-transparent", + NULL}; + +/* + Palette entries as used by osd fonts: + + 0: not used by font, always transparent + 1: font background, usually transparent, may be used to implement + translucid boxes where the font will be printed. + 2-5: transition between background and border (usually only alpha + value changes). + 6: font border. if the font is to be displayed without border this + will probably be adjusted to font background or near. + 7-9: transition between border and foreground + 10: font color (foreground) +*/ + +/* + The palettes below were made by hand, ie, i just throw + values that seemed to do the transitions i wanted. + This can surelly be improved a lot. [Miguel] +*/ + +static const clut_t textpalettes_color[NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE] = { +/* white, black border, transparent */ + { + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), /*0*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*1*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*2*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*3*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*4*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*5*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*6*/ + CLUT_Y_CR_CB_INIT(0x40, 0x80, 0x80), /*7*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*8*/ + CLUT_Y_CR_CB_INIT(0xc0, 0x80, 0x80), /*9*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*10*/ + }, + /* white, no border, transparent */ + { + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), /*0*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*1*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*2*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*3*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*4*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*5*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*6*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*7*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*8*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*9*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*10*/ + }, + /* white, no border, translucid */ + { + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), /*0*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*1*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*2*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*3*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*4*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*5*/ + CLUT_Y_CR_CB_INIT(0x80, 0x80, 0x80), /*6*/ + CLUT_Y_CR_CB_INIT(0xa0, 0x80, 0x80), /*7*/ + CLUT_Y_CR_CB_INIT(0xc0, 0x80, 0x80), /*8*/ + CLUT_Y_CR_CB_INIT(0xe0, 0x80, 0x80), /*9*/ + CLUT_Y_CR_CB_INIT(0xff, 0x80, 0x80), /*10*/ + }, + /* yellow, black border, transparent */ + { + CLUT_Y_CR_CB_INIT(0x00, 0x00, 0x00), /*0*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*1*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*2*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*3*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*4*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*5*/ + CLUT_Y_CR_CB_INIT(0x00, 0x80, 0x80), /*6*/ + CLUT_Y_CR_CB_INIT(0x40, 0x84, 0x60), /*7*/ + CLUT_Y_CR_CB_INIT(0x70, 0x88, 0x40), /*8*/ + CLUT_Y_CR_CB_INIT(0xb0, 0x8a, 0x20), /*9*/ + CLUT_Y_CR_CB_INIT(0xff, 0x90, 0x00), /*10*/ + }, +}; + +static const uint8_t textpalettes_trans[NUMBER_OF_TEXT_PALETTES][TEXT_PALETTE_SIZE] = { + {0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 }, + {0, 0, 0, 0, 0, 0, 2, 6, 9, 12, 15 }, + {0, 8, 9, 10, 11, 12, 13, 14, 15, 15, 15 }, + {0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 }, +}; + typedef struct osd_fontchar_s { uint8_t *bmp; uint16_t code; |