From 35bde472b5455bab19157922dab06a5c2864bced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 20 May 2008 21:14:36 +0200 Subject: Add check for const attribute (for mathematical functions). Add CC_ATTRIBUTE_CONST macro to the attributes.h. Run CC_ATTRIBUTE_CONST in configure. Define SUPPORT_ATTRIBUTE_CONST for GCC 3. Define XINE_CONST to __attribute__((__const__)) if supported. --HG-- extra : transplant_source : /26%26%DF%C0%3C%AC%27%5C%B7%B1y%FEQ%8Ay%EE%F1%BD --- configure.ac | 1 + m4/attributes.m4 | 8 ++++++++ src/xine-utils/attributes.h | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 671bd0c18..79c93f448 100644 --- a/configure.ac +++ b/configure.ac @@ -2219,6 +2219,7 @@ CC_ATTRIBUTE_DEPRECATED CC_ATTRIBUTE_UNUSED CC_ATTRIBUTE_MALLOC CC_ATTRIBUTE_PACKED +CC_ATTRIBUTE_CONST AC_OPTIMIZATIONS diff --git a/m4/attributes.m4 b/m4/attributes.m4 index fa379a2fe..f71b3d0d0 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -188,6 +188,14 @@ AC_DEFUN([CC_ATTRIBUTE_PACKED], [ [$2]) ]) +AC_DEFUN([CC_ATTRIBUTE_CONST], [ + CC_CHECK_ATTRIBUTE( + [const], , + [int __attribute__((const)) twopow(int n) { return 1 << n; } ], + [$1], + [$2]) +]) + AC_DEFUN([CC_FLAG_VISIBILITY], [ AC_REQUIRE([CC_CHECK_WERROR]) AC_CACHE_CHECK([if $CC supports -fvisibility=hidden], diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 29bb9f28f..3819818d5 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -45,6 +45,7 @@ # define SUPPORT_ATTRIBUTE_FORMAT_ARG 1 # define SUPPORT_ATTRIBUTE_MALLOC 1 # define SUPPORT_ATTRIBUTE_UNUSED 1 +# define SUPPORT_ATTRIBUTE_CONST 1 # endif # if __GNUC__ >= 4 @@ -109,4 +110,10 @@ # define XINE_PACKED #endif +#ifdef SUPPORT_ATTRIBUTE_CONST +# define XINE_CONST __attribute__((__const__)) +#else +# define XINE_CONST +#endif + #endif /* ATTRIBUTE_H_ */ -- cgit v1.2.3 From 046552bc9db04ec6296fb8054b5d44270b0b9b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Tue, 20 May 2008 21:17:16 +0200 Subject: Make xine_mm_accel() appear like a constant function. Its result will be always the same during execution, as it depends on the hardware present. --HG-- extra : transplant_source : %F2%D1%1A%84%0F%D4%08%C0%12%09%1A%BBb%7Ef%CC%F2%FB%A3t --- src/xine-utils/xineutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 89aff96bf..c3808e3c3 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -125,7 +125,7 @@ extern "C" { #define MM_SSE MM_ACCEL_X86_SSE #define MM_SSE2 MM_ACCEL_X86_SSE2 -uint32_t xine_mm_accel (void) XINE_PROTECTED; +uint32_t xine_mm_accel (void) XINE_CONST XINE_PROTECTED; #if defined(ARCH_X86) || defined(ARCH_X86_64) -- cgit v1.2.3 From 08c066cac2efdfcf569e47609e9e1b0a947ce129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 23 May 2008 20:07:00 +0200 Subject: Mark initialisation functions with malloc attribute. All the initialisation functions returning a new object instance that was allocated through malloc() or calloc() can get the malloc attribute so that the compiler can optimise their call. --- src/demuxers/asfheader.h | 2 +- src/demuxers/demux_avi.c | 2 +- src/demuxers/demux_mpgaudio.c | 8 ++++---- src/demuxers/ebml.h | 2 +- src/input/input_dvb.c | 2 +- src/input/input_pvr.c | 2 +- src/input/input_v4l.c | 2 +- src/input/libreal/asmrp.c | 2 +- src/input/libreal/rmff.h | 6 +++--- src/input/libreal/sdpplin.c | 2 +- src/input/libreal/sdpplin.h | 2 +- src/input/librtsp/rtsp.h | 2 +- src/input/librtsp/rtsp_session.h | 2 +- src/input/net_buf_ctrl.h | 2 +- src/post/audio/stretch.c | 2 +- src/xine-engine/audio_out.c | 2 +- src/xine-engine/audio_out.h | 2 +- src/xine-engine/broadcaster.h | 2 +- src/xine-engine/buffer.h | 4 ++-- src/xine-engine/configfile.c | 2 +- src/xine-engine/configfile.h | 2 +- src/xine-engine/load_plugins.c | 2 +- src/xine-engine/metronom.c | 2 +- src/xine-engine/metronom.h | 4 ++-- src/xine-engine/osd.c | 2 +- src/xine-engine/osd.h | 2 +- src/xine-engine/refcounter.h | 2 +- src/xine-engine/scratch.h | 2 +- src/xine-engine/video_out.c | 2 +- src/xine-engine/video_out.h | 2 +- src/xine-engine/video_overlay.h | 2 +- src/xine-engine/xine.c | 2 +- src/xine-engine/xine_internal.h | 4 ++-- src/xine-utils/array.h | 2 +- src/xine-utils/list.c | 2 +- src/xine-utils/list.h | 2 +- src/xine-utils/pool.c | 2 +- src/xine-utils/pool.h | 2 +- src/xine-utils/ring_buffer.h | 2 +- src/xine-utils/sorted_array.h | 2 +- src/xine-utils/xineutils.h | 2 +- src/xine-utils/xmlparser.c | 3 ++- 42 files changed, 51 insertions(+), 50 deletions(-) diff --git a/src/demuxers/asfheader.h b/src/demuxers/asfheader.h index 4bd13ab3f..b895a1817 100644 --- a/src/demuxers/asfheader.h +++ b/src/demuxers/asfheader.h @@ -389,7 +389,7 @@ struct asf_stream_extension_s { int asf_find_object_id (GUID *g); void asf_get_guid (uint8_t *buffer, GUID *value); -asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len); +asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) XINE_MALLOC; void asf_header_choose_streams (asf_header_t *header, uint32_t bandwidth, int *video_id, int *audio_id); void asf_header_disable_streams (asf_header_t *header, diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index 37f74ddb1..16b897711 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -719,7 +719,7 @@ static void reset_idx(demux_avi_t *this, avi_t *AVI) { } } -static avi_t *AVI_init(demux_avi_t *this) { +static avi_t *XINE_MALLOC AVI_init(demux_avi_t *this) { avi_t *AVI; int i, j, idx_type; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index a32063515..3c3576fd2 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -316,8 +316,8 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con * Parse a Xing header * return the Xing header or NULL on error */ -static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, - uint8_t *buf, int bufsize) { +static xing_header_t *XINE_MALLOC parse_xing_header(mpg_audio_frame_t *frame, + uint8_t *buf, int bufsize) { uint8_t *ptr = buf; xing_header_t *xing = NULL; @@ -420,8 +420,8 @@ exit_error: * Parse a Vbri header * return the Vbri header or NULL on error */ -static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, - uint8_t *buf, int bufsize) { +static vbri_header_t *XINE_MALLOC parse_vbri_header(mpg_audio_frame_t *frame, + uint8_t *buf, int bufsize) { int i; uint8_t *ptr = buf; diff --git a/src/demuxers/ebml.h b/src/demuxers/ebml.h index a38515544..9aa471c0b 100644 --- a/src/demuxers/ebml.h +++ b/src/demuxers/ebml.h @@ -65,7 +65,7 @@ typedef struct ebml_parser_s { } ebml_parser_t; -ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input); +ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input) XINE_MALLOC; void dispose_ebml_parser (ebml_parser_t *ebml); diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 69a413bac..9f51da267 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -571,7 +571,7 @@ static void tuner_dispose(tuner_t * this) } -static tuner_t *tuner_init(xine_t * xine, int adapter) +static tuner_t *XINE_MALLOC tuner_init(xine_t * xine, int adapter) { tuner_t *this; diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index af6070a9e..009c76939 100644 --- a/src/input/input_pvr.c +++ b/src/input/input_pvr.c @@ -376,7 +376,7 @@ static void pvrscr_exit (scr_plugin_t *scr) { free(this); } -static pvrscr_t* pvrscr_init (void) { +static pvrscr_t *XINE_MALLOC pvrscr_init (void) { pvrscr_t *this; this = calloc(1, sizeof(pvrscr_t)); diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c index e010132ec..304f6f484 100644 --- a/src/input/input_v4l.c +++ b/src/input/input_v4l.c @@ -349,7 +349,7 @@ static void pvrscr_exit (scr_plugin_t *scr) free(this); } -static pvrscr_t* pvrscr_init (void) +static pvrscr_t *XINE_MALLOC pvrscr_init (void) { pvrscr_t *this; diff --git a/src/input/libreal/asmrp.c b/src/input/libreal/asmrp.c index f7206b583..970fcb0f7 100644 --- a/src/input/libreal/asmrp.c +++ b/src/input/libreal/asmrp.c @@ -95,7 +95,7 @@ typedef struct { } asmrp_t; -static asmrp_t *asmrp_new () { +static asmrp_t *XINE_MALLOC asmrp_new () { asmrp_t *p; diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index b03d12b1b..50656349d 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -32,10 +32,10 @@ #include #include - #ifndef HAVE_RMFF_H #define HAVE_RMFF_H +#include "attributes.h" #define RMFF_HEADER_SIZE 0x12 @@ -220,7 +220,7 @@ rmff_data_t *rmff_new_dataheader( /* * reads header infos from data and returns a newly allocated header struct */ -rmff_header_t *rmff_scan_header(const char *data); +rmff_header_t *rmff_scan_header(const char *data) XINE_MALLOC; /* * scans a data packet header. Notice, that this function does not allocate @@ -231,7 +231,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data); /* * reads header infos from stream and returns a newly allocated header struct */ -rmff_header_t *rmff_scan_header_stream(int fd); +rmff_header_t *rmff_scan_header_stream(int fd) XINE_MALLOC; /* * prints header information in human readible form to stdout diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index 4c1687d41..f3672559c 100644 --- a/src/input/libreal/sdpplin.c +++ b/src/input/libreal/sdpplin.c @@ -120,7 +120,7 @@ static int filter(const char *in, const char *filter, char **out) { return 0; } -static sdpplin_stream_t *sdpplin_parse_stream(char **data) { +static sdpplin_stream_t *XINE_MALLOC sdpplin_parse_stream(char **data) { sdpplin_stream_t *desc = calloc(1, sizeof(sdpplin_stream_t)); char *buf=xine_buffer_init(32); diff --git a/src/input/libreal/sdpplin.h b/src/input/libreal/sdpplin.h index 72cbaf731..1604ee38c 100644 --- a/src/input/libreal/sdpplin.h +++ b/src/input/libreal/sdpplin.h @@ -101,7 +101,7 @@ typedef struct { } sdpplin_t; -sdpplin_t *sdpplin_parse(char *data); +sdpplin_t *sdpplin_parse(char *data) XINE_MALLOC; void sdpplin_free(sdpplin_t *description); diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index dc2624459..2e1fd6aa0 100644 --- a/src/input/librtsp/rtsp.h +++ b/src/input/librtsp/rtsp.h @@ -40,7 +40,7 @@ typedef struct rtsp_s rtsp_t; -rtsp_t* rtsp_connect (xine_stream_t *stream, const char *mrl, const char *user_agent); +rtsp_t* rtsp_connect (xine_stream_t *stream, const char *mrl, const char *user_agent) XINE_MALLOC; int rtsp_request_options(rtsp_t *s, const char *what); int rtsp_request_describe(rtsp_t *s, const char *what); diff --git a/src/input/librtsp/rtsp_session.h b/src/input/librtsp/rtsp_session.h index b47db0730..33ac579e1 100644 --- a/src/input/librtsp/rtsp_session.h +++ b/src/input/librtsp/rtsp_session.h @@ -25,7 +25,7 @@ typedef struct rtsp_session_s rtsp_session_t; -rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl); +rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) XINE_MALLOC; void rtsp_session_set_start_time(rtsp_session_t *this, int start_time); diff --git a/src/input/net_buf_ctrl.h b/src/input/net_buf_ctrl.h index 79f698008..3f4b4b3bf 100644 --- a/src/input/net_buf_ctrl.h +++ b/src/input/net_buf_ctrl.h @@ -27,7 +27,7 @@ typedef struct nbc_s nbc_t; -nbc_t *nbc_init (xine_stream_t *xine); +nbc_t *nbc_init (xine_stream_t *xine) XINE_MALLOC; void nbc_check_buffers (nbc_t *this); diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index 8be58d8c5..6930fea3d 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -152,7 +152,7 @@ static void stretchscr_exit (scr_plugin_t *scr) { free(this); } -static stretchscr_t* stretchscr_init (double *stretch_factor) { +static stretchscr_t *XINE_MALLOC stretchscr_init (double *stretch_factor) { stretchscr_t *this; this = calloc(1, sizeof(stretchscr_t)); diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 30756b017..d28c45ea6 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -290,7 +290,7 @@ struct audio_fifo_s { static int ao_get_property (xine_audio_port_t *this_gen, int property); static int ao_set_property (xine_audio_port_t *this_gen, int property, int value); -static audio_fifo_t *fifo_new (xine_t *xine) { +static audio_fifo_t *XINE_MALLOC fifo_new (xine_t *xine) { audio_fifo_t *fifo; diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h index c4581ec24..5f4420363 100644 --- a/src/xine-engine/audio_out.h +++ b/src/xine-engine/audio_out.h @@ -259,7 +259,7 @@ struct audio_driver_class_s { * this initiates the audio_out sync routines * found in ./src/xine-engine/audio_out.c */ -xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only) XINE_PROTECTED; +xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only) XINE_MALLOC XINE_PROTECTED; /* * audio output modes + capabilities diff --git a/src/xine-engine/broadcaster.h b/src/xine-engine/broadcaster.h index 093fb4af0..0c6a291eb 100644 --- a/src/xine-engine/broadcaster.h +++ b/src/xine-engine/broadcaster.h @@ -33,7 +33,7 @@ extern "C" { typedef struct broadcaster_s broadcaster_t; -broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) XINE_PROTECTED; +broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) XINE_MALLOC XINE_PROTECTED; void _x_close_broadcaster(broadcaster_t *this) XINE_PROTECTED; int _x_get_broadcaster_port(broadcaster_t *this) XINE_PROTECTED; diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h index e0dc88bc7..5e43028e8 100644 --- a/src/xine-engine/buffer.h +++ b/src/xine-engine/buffer.h @@ -607,8 +607,8 @@ struct fifo_buffer_s * allocate num_buffers of buf_size bytes each */ -fifo_buffer_t *_x_fifo_buffer_new (int num_buffers, uint32_t buf_size) XINE_PROTECTED; -fifo_buffer_t *_x_dummy_fifo_buffer_new (int num_buffers, uint32_t buf_size) XINE_PROTECTED; +fifo_buffer_t *_x_fifo_buffer_new (int num_buffers, uint32_t buf_size) XINE_MALLOC XINE_PROTECTED; +fifo_buffer_t *_x_dummy_fifo_buffer_new (int num_buffers, uint32_t buf_size) XINE_MALLOC XINE_PROTECTED; /* return BUF_VIDEO_xxx given the fourcc diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index ad23f3b30..cfe6f6a35 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -319,7 +319,7 @@ static void config_insert(config_values_t *this, cfg_entry_t *new_entry) { this->first = new_entry; } -static cfg_entry_t *config_add (config_values_t *this, const char *key, int exp_level) { +static cfg_entry_t *XINE_MALLOC config_add (config_values_t *this, const char *key, int exp_level) { cfg_entry_t *entry; diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h index e21b08db0..e1dca7b18 100644 --- a/src/xine-engine/configfile.h +++ b/src/xine-engine/configfile.h @@ -200,7 +200,7 @@ struct config_values_s { /* * allocate and init a new xine config object */ -config_values_t *_x_config_init (void) XINE_PROTECTED; +config_values_t *_x_config_init (void) XINE_MALLOC XINE_PROTECTED; /* * interpret stream_setup part of mrls for config value changes diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 13f9b94c7..107e7d792 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -461,7 +461,7 @@ static int _plugin_node_comparator(void *a, void *b) { } } -static plugin_catalog_t *_new_catalog(void){ +static plugin_catalog_t *XINE_MALLOC _new_catalog(void){ plugin_catalog_t *catalog; int i; diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 49ac5cdfb..84b936941 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -172,7 +172,7 @@ static void unixscr_exit (scr_plugin_t *scr) { free(this); } -static scr_plugin_t* unixscr_init () { +static scr_plugin_t *XINE_MALLOC unixscr_init () { unixscr_t *this; this = calloc(1, sizeof(unixscr_t)); diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h index 20e31117c..c7a594d89 100644 --- a/src/xine-engine/metronom.h +++ b/src/xine-engine/metronom.h @@ -223,7 +223,7 @@ struct metronom_s { #define METRONOM_VPTS_OFFSET 6 #define METRONOM_PREBUFFER 7 -metronom_t *_x_metronom_init (int have_video, int have_audio, xine_t *xine) XINE_PROTECTED; +metronom_t *_x_metronom_init (int have_video, int have_audio, xine_t *xine) XINE_MALLOC XINE_PROTECTED; /* FIXME: reorder this structure on the next cleanup to remove the dummies */ struct metronom_clock_s { @@ -319,7 +319,7 @@ struct metronom_clock_s { #endif }; -metronom_clock_t *_x_metronom_clock_init(xine_t *xine) XINE_PROTECTED; +metronom_clock_t *_x_metronom_clock_init(xine_t *xine) XINE_MALLOC XINE_PROTECTED; /* * clock options diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index ac3c2bb92..7c74c50bc 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -143,7 +143,7 @@ struct osd_ft2context_s { * for the sake of simplicity) */ -static osd_object_t *osd_new_object (osd_renderer_t *this, int width, int height) { +static osd_object_t *XINE_MALLOC osd_new_object (osd_renderer_t *this, int width, int height) { osd_object_t *osd; diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h index 38b5d1fdd..70193a2ea 100644 --- a/src/xine-engine/osd.h +++ b/src/xine-engine/osd.h @@ -226,7 +226,7 @@ struct osd_renderer_s { /* * initialize the osd rendering engine */ -osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ); +osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ) XINE_MALLOC; /* diff --git a/src/xine-engine/refcounter.h b/src/xine-engine/refcounter.h index 87abd6321..d51973675 100644 --- a/src/xine-engine/refcounter.h +++ b/src/xine-engine/refcounter.h @@ -35,7 +35,7 @@ typedef struct { typedef void (*refcounter_destructor)(void*); -refcounter_t* _x_new_refcounter(void *object, refcounter_destructor destructor) XINE_PROTECTED; +refcounter_t* _x_new_refcounter(void *object, refcounter_destructor destructor) XINE_MALLOC XINE_PROTECTED; int _x_refcounter_inc(refcounter_t *refcounter) XINE_PROTECTED; diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h index c0e591d31..1029276e3 100644 --- a/src/xine-engine/scratch.h +++ b/src/xine-engine/scratch.h @@ -51,6 +51,6 @@ struct scratch_buffer_s { pthread_mutex_t lock; }; -scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_PROTECTED; +scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_MALLOC XINE_PROTECTED; #endif diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 98e2b800e..be062cc5d 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -139,7 +139,7 @@ typedef struct { * frame queue (fifo) util functions */ -static img_buf_fifo_t *vo_new_img_buf_queue () { +static img_buf_fifo_t *XINE_MALLOC vo_new_img_buf_queue () { img_buf_fifo_t *queue; diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h index 4d9c80565..fb01805df 100644 --- a/src/xine-engine/video_out.h +++ b/src/xine-engine/video_out.h @@ -448,7 +448,7 @@ struct video_overlay_manager_s { * build a video_out_port from * a given video driver */ -xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly) XINE_PROTECTED; +xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly) XINE_MALLOC XINE_PROTECTED; #ifdef __cplusplus } diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h index d580a1e83..01f3a2a3a 100644 --- a/src/xine-engine/video_overlay.h +++ b/src/xine-engine/video_overlay.h @@ -98,6 +98,6 @@ typedef struct video_overlay_event_s { video_overlay_object_t object; /* The image data. */ } video_overlay_event_t; -video_overlay_manager_t *_x_video_overlay_new_manager(xine_t *) XINE_PROTECTED; +video_overlay_manager_t *_x_video_overlay_new_manager(xine_t *) XINE_MALLOC XINE_PROTECTED; #endif diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 558aa996e..46d3b424f 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -304,7 +304,7 @@ static void ticket_dispose(xine_ticket_t *this) { free(this); } -static xine_ticket_t *ticket_init(void) { +static xine_ticket_t *XINE_MALLOC ticket_init(void) { xine_ticket_t *port_ticket; port_ticket = calloc(1, sizeof(xine_ticket_t)); diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h index 8fb4723a5..85f3d6489 100644 --- a/src/xine-engine/xine_internal.h +++ b/src/xine-engine/xine_internal.h @@ -389,8 +389,8 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) XI demux_plugin_t *_x_find_demux_plugin (xine_stream_t *stream, input_plugin_t *input) XINE_PROTECTED; demux_plugin_t *_x_find_demux_plugin_by_name (xine_stream_t *stream, const char *name, input_plugin_t *input) XINE_PROTECTED; demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const char *last_demux_name, input_plugin_t *input) XINE_PROTECTED; -input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *filename) XINE_PROTECTED; -input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahead_size) XINE_PROTECTED; +input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *filename) XINE_MALLOC XINE_PROTECTED; +input_plugin_t *_x_cache_plugin_get_instance (xine_stream_t *stream, int readahead_size) XINE_MALLOC XINE_PROTECTED; void _x_free_input_plugin (xine_stream_t *stream, input_plugin_t *input) XINE_PROTECTED; void _x_free_demux_plugin (xine_stream_t *stream, demux_plugin_t *demux) XINE_PROTECTED; diff --git a/src/xine-utils/array.h b/src/xine-utils/array.h index ae2093823..44f3c7632 100644 --- a/src/xine-utils/array.h +++ b/src/xine-utils/array.h @@ -27,7 +27,7 @@ typedef struct xine_array_s xine_array_t; /* Constructor */ -xine_array_t *xine_array_new(size_t initial_size) XINE_PROTECTED; +xine_array_t *xine_array_new(size_t initial_size) XINE_MALLOC XINE_PROTECTED; /* Destructor */ void xine_array_delete(xine_array_t *array) XINE_PROTECTED; diff --git a/src/xine-utils/list.c b/src/xine-utils/list.c index b157bda3f..eb654a3e3 100644 --- a/src/xine-utils/list.c +++ b/src/xine-utils/list.c @@ -67,7 +67,7 @@ struct xine_list_s { /* Allocates a new chunk of n elements * One malloc call is used to allocate the struct and the elements. */ -static xine_list_chunk_t *xine_list_alloc_chunk(size_t size) { +static xine_list_chunk_t *XINE_MALLOC xine_list_alloc_chunk(size_t size) { xine_list_chunk_t *new_chunk; size_t chunk_mem_size; diff --git a/src/xine-utils/list.h b/src/xine-utils/list.h index e00e30d6c..f05ed2b0e 100644 --- a/src/xine-utils/list.h +++ b/src/xine-utils/list.h @@ -48,7 +48,7 @@ typedef struct xine_list_s xine_list_t; typedef void* xine_list_iterator_t; /* Constructor */ -xine_list_t *xine_list_new(void) XINE_PROTECTED; +xine_list_t *xine_list_new(void) XINE_MALLOC XINE_PROTECTED; /* Destructor */ void xine_list_delete(xine_list_t *list) XINE_PROTECTED; diff --git a/src/xine-utils/pool.c b/src/xine-utils/pool.c index a1fddadd9..1b7fd63f3 100644 --- a/src/xine-utils/pool.c +++ b/src/xine-utils/pool.c @@ -55,7 +55,7 @@ struct xine_pool_s { /* Allocates a new chunk of n elements * One malloc call is used to allocate the struct and the elements. */ -static xine_pool_chunk_t *xine_pool_alloc_chunk(size_t object_size, size_t object_count) { +static xine_pool_chunk_t *XINE_MALLOC xine_pool_alloc_chunk(size_t object_size, size_t object_count) { xine_pool_chunk_t *new_chunk; size_t chunk_mem_size;; diff --git a/src/xine-utils/pool.h b/src/xine-utils/pool.h index 918da82a2..2667b7fdc 100644 --- a/src/xine-utils/pool.h +++ b/src/xine-utils/pool.h @@ -36,7 +36,7 @@ xine_pool_t *xine_pool_new(size_t object_size, void (create_object)(void *object), void (prepare_object)(void *object), void (return_object)(void *object), - void (delete_object)(void *object)) XINE_PROTECTED; + void (delete_object)(void *object)) XINE_MALLOC XINE_PROTECTED; /* Deletes a pool */ void xine_pool_delete(xine_pool_t *pool) XINE_PROTECTED; diff --git a/src/xine-utils/ring_buffer.h b/src/xine-utils/ring_buffer.h index efcffd3b7..5f104dc77 100644 --- a/src/xine-utils/ring_buffer.h +++ b/src/xine-utils/ring_buffer.h @@ -22,7 +22,7 @@ typedef struct xine_ring_buffer_s xine_ring_buffer_t; /* Creates a new ring buffer */ -xine_ring_buffer_t *xine_ring_buffer_new(size_t size) XINE_PROTECTED; +xine_ring_buffer_t *xine_ring_buffer_new(size_t size) XINE_MALLOC XINE_PROTECTED; /* Deletes a ring buffer */ void xine_ring_buffer_delete(xine_ring_buffer_t *ring_buffer) XINE_PROTECTED; diff --git a/src/xine-utils/sorted_array.h b/src/xine-utils/sorted_array.h index a1894eca3..c6fdd1c25 100644 --- a/src/xine-utils/sorted_array.h +++ b/src/xine-utils/sorted_array.h @@ -63,7 +63,7 @@ typedef struct xine_sarray_s xine_sarray_t; typedef int (*xine_sarray_comparator_t)(void*, void*); /* Constructor */ -xine_sarray_t *xine_sarray_new(size_t initial_size, xine_sarray_comparator_t comparator) XINE_PROTECTED; +xine_sarray_t *xine_sarray_new(size_t initial_size, xine_sarray_comparator_t comparator) XINE_MALLOC XINE_PROTECTED; /* Destructor */ void xine_sarray_delete(xine_sarray_t *sarray) XINE_PROTECTED; diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index c3808e3c3..3d630b066 100644 --- a/src/xine-utils/xineutils.h +++ b/src/xine-utils/xineutils.h @@ -956,7 +956,7 @@ void xine_xprintf(xine_t *xine, int verbose, const char *fmt, ...); /** * get encoding of current locale */ -char *xine_get_system_encoding(void) XINE_PROTECTED; +char *xine_get_system_encoding(void) XINE_MALLOC XINE_PROTECTED; /* * guess default encoding for the subtitles diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index 2922135e2..a4917429b 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -36,6 +36,7 @@ #include "xineutils.h" #else #define lprintf(...) +#define XINE_MALLOC #endif #include "xmllexer.h" #include "xmlparser.h" @@ -78,7 +79,7 @@ static void free_xml_node(xml_node_t * node) { free(node); } -static xml_property_t * new_xml_property(void) { +static xml_property_t *XINE_MALLOC new_xml_property(void) { xml_property_t * new_property; new_property = (xml_property_t*) malloc(sizeof(xml_property_t)); -- cgit v1.2.3 From 157f5234c463abe1b23a2f86dd182f40f99020fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 23 May 2008 23:31:33 +0200 Subject: Check for MIN/MAX macro and include the header for them if found. The MIN/MAX macro are quite often used on the source code to find the minimum or maximum value between two, instead of defining it per-unit, check if the system provides them include the right header, otherwise define them during configure run. --- configure.ac | 4 ++++ lib/os_internal.h | 4 ++++ m4/Makefile.am | 1 + m4/misc.m4 | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 m4/misc.m4 diff --git a/configure.ac b/configure.ac index 79c93f448..6490374c7 100644 --- a/configure.ac +++ b/configure.ac @@ -2177,6 +2177,10 @@ AC_CHECK_FUNC(opendir, AC_MSG_ERROR([dirent is needed (opendir, readdir, ...)]) fi]) +XINE_CHECK_MINMAX([], [ + AC_DEFINE([MIN(x, y)], [(x > y) ? y : x], [Get the minimum value between two]) + AC_DEFINE([MAX(x, y)], [(x > y) ? x : y], [Get the maximum value between two]) + ]) dnl --------------------------------------------- dnl cflags and debug cflags diff --git a/lib/os_internal.h b/lib/os_internal.h index 11601bbdf..6e6e14a3d 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -4,6 +4,10 @@ #include #include +#ifdef HAVE_SYS_PARAM_H +# include +#endif + #ifdef HOST_OS_DARWIN /* Darwin (Mac OS X) needs __STDC_LIBRARY_SUPPORTED__ for SCNx64 and * SCNxMAX macros */ diff --git a/m4/Makefile.am b/m4/Makefile.am index ddf3a9425..bcaa78a49 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -24,6 +24,7 @@ EXTRA_DIST = glibc2.m4 intdiv0.m4 intmax.m4 inttypes.m4 inttypes_h.m4 inttypes-p lcmessage.m4 \ libFLAC.m4 \ libfame.m4 \ + misc.m4 \ opengl.m4 \ optimizations.m4 \ pkg.m4 \ diff --git a/m4/misc.m4 b/m4/misc.m4 new file mode 100644 index 000000000..ab0d55510 --- /dev/null +++ b/m4/misc.m4 @@ -0,0 +1,58 @@ +dnl Miscellaneous M4 macros for configure +dnl Copyright (c) 2008 Diego Pettenò +dnl Copyright (c) 2008 xine project +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +dnl 02110-1301, USA. +dnl +dnl As a special exception, the copyright owners of the +dnl macro gives unlimited permission to copy, distribute and modify the +dnl configure scripts that are the output of Autoconf when processing the +dnl Macro. You need not follow the terms of the GNU General Public +dnl License when using or distributing such scripts, even though portions +dnl of the text of the Macro appear in them. The GNU General Public +dnl License (GPL) does govern all other use of the material that +dnl constitutes the Autoconf Macro. +dnl +dnl This special exception to the GPL applies to versions of the +dnl Autoconf Macro released by this project. When you make and +dnl distribute a modified version of the Autoconf Macro, you may extend +dnl this special exception to the GPL to apply to your modified version as +dnl well. + +AC_DEFUN([XINE_CHECK_MINMAX], [ + AC_CHECK_HEADERS([sys/param.h]) + AC_CACHE_CHECK([for MIN()/MAX() macros], + xine_cv_minmax, + [ + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ + #ifdef HAVE_SYS_PARAM_H + # include + #endif + ], [ + int a = MIN(1, 3); + int b = MAX(2, 3); + ])], + [xine_cv_minmax=yes], + [xine_cv_minmax=no]) + ]) + + if test x$xine_cv_minmax = xyes; then + ifelse([$1], , [:], [$1]) + else + ifelse([$2], , [:], [$2]) + fi +]) -- cgit v1.2.3 From 37f4983b76f90efb4e5715f3eca693daf668310a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 23 May 2008 23:43:00 +0200 Subject: Remove MIN/MAX macro definitions on unit. Now that the macro are either imported from the system or defined by configure. don't define them in every source file. --- src/demuxers/demux_matroska.c | 7 ------- src/demuxers/demux_ts.c | 3 --- src/input/libreal/real.c | 3 --- src/libspucc/cc_decoder.c | 2 -- src/post/planar/unsharp.c | 7 ------- src/video_out/video_out_directfb.c | 4 ---- src/video_out/yuv2rgb_mlib.c | 2 -- src/xine-engine/demux.c | 5 ----- src/xine-engine/osd.c | 11 ----------- 9 files changed, 44 deletions(-) diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index b05128fec..5faebf61d 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -58,13 +58,6 @@ #define WRAP_THRESHOLD 90000 -#if !defined(MIN) -#define MIN(a, b) ((a)<(b)?(a):(b)) -#endif -#if !defined(MAX) -#define MAX(a, b) ((a)>(b)?(a):(b)) -#endif - typedef struct { int track_num; off_t *pos; diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 6d854e4c3..5ccdd20de 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -185,9 +185,6 @@ #define INVALID_PROGRAM ((unsigned int)(-1)) #define INVALID_CC ((unsigned int)(-1)) -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) - #define PROG_STREAM_MAP 0xBC #define PRIVATE_STREAM1 0xBD #define PADDING_STREAM 0xBE diff --git a/src/input/libreal/real.c b/src/input/libreal/real.c index f4698a4fb..c0e11fa00 100644 --- a/src/input/libreal/real.c +++ b/src/input/libreal/real.c @@ -48,9 +48,6 @@ static const unsigned char xor_table[] = { #define _X_BE_32C(x,y) do { *(uint32_t *)(x) = be2me_32((y)); } while(0) #define _X_LE_32C(x,y) do { *(uint32_t *)(x) = le2me_32((y)); } while(0) -#define MAX(x,y) ((x>y) ? x : y) - - static void hash(char *field, char *param) { uint32_t a, b, c, d; diff --git a/src/libspucc/cc_decoder.c b/src/libspucc/cc_decoder.c index 1452a87ad..67767c61a 100644 --- a/src/libspucc/cc_decoder.c +++ b/src/libspucc/cc_decoder.c @@ -216,8 +216,6 @@ static const uint8_t *const cc_alpha_palettes[NUM_CC_PALETTES] = { #define TRANSP_SPACE 0x19 /* code for transparent space, essentially arbitrary */ -#define MAX(a, b) ((a) > (b)? (a) : (b)) - /* mapping from PAC row code to actual CC row */ static const int rowdata[] = {10, -1, 0, 1, 2, 3, 11, 12, 13, 14, 4, 5, 6, 7, 8, 9}; diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index e61d80076..da41708d0 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.c @@ -26,13 +26,6 @@ #include "xineutils.h" #include -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif -#ifndef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - /*===========================================================================*/ #define MIN_MATRIX_SIZE 3 diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index eea614779..2e9874cc0 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -168,10 +168,6 @@ typedef struct { "no-deinit-check" -#ifndef MAX -# define MAX( a, b ) (((a) > (b)) ? (a) : (b)) -#endif - #define YCBCR_TO_RGB( y, cb, cr, r, g, b ) \ do { \ int _y, _cb, _cr, _r, _g, _b; \ diff --git a/src/video_out/yuv2rgb_mlib.c b/src/video_out/yuv2rgb_mlib.c index 8635526ed..22e67efa8 100644 --- a/src/video_out/yuv2rgb_mlib.c +++ b/src/video_out/yuv2rgb_mlib.c @@ -38,8 +38,6 @@ #include "xineutils.h" #include "yuv2rgb.h" -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) - static void mlib_yuv420_rgb24(yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index c116d407f..257a72383 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -47,11 +47,6 @@ #include #endif -#ifdef MIN -#undef MIN -#endif -#define MIN(a,b) ( (a) < (b) ) ? (a) : (b) - /* * Flush audio and video buffers. It is called from demuxers on * seek/stop, and may be useful when user input changes a stream and diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 7c74c50bc..36ce47e44 100644 --- a/src/xine-engine/osd.c +++ b/src/xine-engine/osd.c @@ -83,17 +83,6 @@ # define UCS2_ENCODING "UCS-2LE" #endif -#ifdef MAX -#undef MAX -#endif -#define MAX(a,b) ( (a) > (b) ) ? (a) : (b) - -#ifdef MIN -#undef MIN -#endif -#define MIN(a,b) ( (a) < (b) ) ? (a) : (b) - - #if (FREETYPE_MAJOR > 2) || \ (FREETYPE_MAJOR == 2 && FREETYPE_MINOR > 1) || \ (FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 3) -- cgit v1.2.3 From fc24f6446e014c087e4a84ec2934784f89a6bbb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 May 2008 00:34:56 +0200 Subject: Use M4sh AS_IF rather than sh if statements for common macros. Instead of using directly the sh if statement, use AS_IF, which makes it possible for autotools to identify conditionally-called macros, and allows to avoid M4 ifelse macros. --- m4/attributes.m4 | 118 ++++++++++++++++++++++--------------------------------- m4/misc.m4 | 7 +--- 2 files changed, 50 insertions(+), 75 deletions(-) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index f71b3d0d0..49f71bddc 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -42,11 +42,8 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ CFLAGS="$ac_save_CFLAGS" ]) - if eval test [x$]AS_TR_SH([cc_cv_cflags_$1]) = xyes; then - ifelse([$2], , [:], [$2]) - else - ifelse([$3], , [:], [$3]) - fi + AS_IF([test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [$2], [$3]) ]) AC_DEFUN([CC_CHECK_CFLAGS], [ @@ -55,11 +52,8 @@ AC_DEFUN([CC_CHECK_CFLAGS], [ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here! ) - if eval test [x$]AS_TR_SH([cc_cv_cflags_$1]) = xyes; then - ifelse([$2], , [:], [$2]) - else - ifelse([$3], , [:], [$3]) - fi + AS_IF([test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes], + [$2], [$3]) ]) dnl Check for a -Werror flag or equivalent. -Werror is the GCC @@ -91,76 +85,69 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [ CFLAGS="$ac_save_CFLAGS" ]) - if eval test [x$]AS_TR_SH([cc_cv_attribute_$1]) = xyes; then - AC_DEFINE(AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]) - ifelse([$4], , [:], [$4]) - else - ifelse([$5], , [:], [$5]) - fi + AS_IF([test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes], + [AC_DEFINE( + AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1, + [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))] + ) + $4], + [$5]) ]) AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ CC_CHECK_ATTRIBUTE( [constructor],, [void __attribute__((constructor)) ctor() { int a; }], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT], [ CC_CHECK_ATTRIBUTE( [format], [format(printf, n, n)], [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ CC_CHECK_ATTRIBUTE( [format_arg], [format_arg(printf)], [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ CC_CHECK_ATTRIBUTE( [visibility_$1], [visibility("$1")], [void __attribute__((visibility("$1"))) $1_function() { }], - [$2], - [$3]) + [$2], [$3]) ]) AC_DEFUN([CC_ATTRIBUTE_NONNULL], [ CC_CHECK_ATTRIBUTE( [nonnull], [nonnull()], [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_UNUSED], [ CC_CHECK_ATTRIBUTE( [unused], , [void some_function(void *foo, __attribute__((unused)) void *bar);], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [ CC_CHECK_ATTRIBUTE( [sentinel], , [void some_function(void *foo, ...) __attribute__((sentinel));], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [ CC_CHECK_ATTRIBUTE( [deprecated], , [void some_function(void *foo, ...) __attribute__((deprecated));], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ @@ -168,32 +155,28 @@ AC_DEFUN([CC_ATTRIBUTE_ALIAS], [ [alias], [weak, alias], [void other_function(void *foo) { } void some_function(void *foo) __attribute__((weak, alias("other_function")));], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_MALLOC], [ CC_CHECK_ATTRIBUTE( [malloc], , [void * __attribute__((malloc)) my_alloc(int n);], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_PACKED], [ CC_CHECK_ATTRIBUTE( [packed], , [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_CONST], [ CC_CHECK_ATTRIBUTE( [const], , [int __attribute__((const)) twopow(int n) { return 1 << n; } ], - [$1], - [$2]) + [$1], [$2]) ]) AC_DEFUN([CC_FLAG_VISIBILITY], [ @@ -207,39 +190,34 @@ AC_DEFUN([CC_FLAG_VISIBILITY], [ cc_cv_flag_visibility='no') CFLAGS="$cc_flag_visibility_save_CFLAGS"]) - if test "x$cc_cv_flag_visibility" = "xyes"; then - AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, [Define this if the compiler supports the -fvisibility flag]) - ifelse([$1], , [:], [$1]) - else - ifelse([$2], , [:], [$2]) - fi + AS_IF([test "x$cc_cv_flag_visibility" = "xyes"], + [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1, + [Define this if the compiler supports the -fvisibility flag]) + $1], + [$2]) ]) AC_DEFUN([CC_FUNC_EXPECT], [ - AC_REQUIRE([CC_CHECK_WERROR]) - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $cc_cv_werror" - AC_CACHE_CHECK([if compiler has __builtin_expect function], - [cc_cv_func_expect], - [AC_COMPILE_IFELSE([ - int some_function() - { - int a = 3; - return (int)__builtin_expect(a, 3); - } - ], - [cc_cv_func_expect=yes], - [cc_cv_func_expect=no]) - ]) - CFLAGS="$ac_save_CFLAGS" - - if test "x$cc_cv_func_expect" = "xyes"; then - AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, [Define this if the compiler supports __builtin_expect() function]) - $1 - else - true - $2 - fi + AC_REQUIRE([CC_CHECK_WERROR]) + AC_CACHE_CHECK([if compiler has __builtin_expect function], + [cc_cv_func_expect], + [ac_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cc_cv_werror" + AC_COMPILE_IFELSE( + [int some_function() { + int a = 3; + return (int)__builtin_expect(a, 3); + }], + [cc_cv_func_expect=yes], + [cc_cv_func_expect=no]) + CFLAGS="$ac_save_CFLAGS" + ]) + + AS_IF([test "x$cc_cv_func_expect" = "xyes"], + [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1, + [Define this if the compiler supports __builtin_expect() function]) + $1], + [$2]) ]) AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ diff --git a/m4/misc.m4 b/m4/misc.m4 index ab0d55510..83246f36c 100644 --- a/m4/misc.m4 +++ b/m4/misc.m4 @@ -50,9 +50,6 @@ AC_DEFUN([XINE_CHECK_MINMAX], [ [xine_cv_minmax=no]) ]) - if test x$xine_cv_minmax = xyes; then - ifelse([$1], , [:], [$1]) - else - ifelse([$2], , [:], [$2]) - fi + AS_IF([test x$xine_cv_minmax = xyes], + [$1], [$2]) ]) -- cgit v1.2.3 From a2583761573b98127ae9396785875a88a4a4b8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 May 2008 02:01:21 +0200 Subject: Backport CC_CHECK_LDFLAGS macro from 1.2 branch. --- m4/attributes.m4 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/m4/attributes.m4 b/m4/attributes.m4 index 49f71bddc..3fee49ab5 100644 --- a/m4/attributes.m4 +++ b/m4/attributes.m4 @@ -56,6 +56,21 @@ AC_DEFUN([CC_CHECK_CFLAGS], [ [$2], [$3]) ]) +AC_DEFUN([CC_CHECK_LDFLAGS], [ + AC_CACHE_CHECK([if $CC supports $1 flag], + AS_TR_SH([cc_cv_ldflags_$1]), + [ac_save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + AC_LINK_IFELSE([int main() { return 1; }], + [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], + [eval "AS_TR_SH([cc_cv_ldflags_$1])="]) + LDFLAGS="$ac_save_LDFLAGS" + ]) + + AS_IF([test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes], + [$2], [$3]) +]) + dnl Check for a -Werror flag or equivalent. -Werror is the GCC dnl and ICC flag that tells the compiler to treat all the warnings dnl as fatal. We usually need this option to make sure that some -- cgit v1.2.3 From 0cb95cb5ae7e494f0ba776eeeceec3225ff15a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 May 2008 02:04:27 +0200 Subject: Backport pthreads.m4 from 1.2. Both attributes.m4 and pthread.m4 are two reusable M4 macro files, which can eaily be shared between different projects. For this reason it's better if they are kept identical between branches. --- m4/pthreads.m4 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/m4/pthreads.m4 b/m4/pthreads.m4 index fb1adaab8..facac076f 100644 --- a/m4/pthreads.m4 +++ b/m4/pthreads.m4 @@ -73,3 +73,28 @@ AC_DEFUN([CC_PTHREAD_FLAGS], [ ifelse([$2], , [:], [$2]) fi ]) + +AC_DEFUN([CC_PTHREAD_RECURSIVE_MUTEX], [ + AC_REQUIRE([CC_PTHREAD_FLAGS]) + AC_MSG_CHECKING([for recursive mutex support in pthread]) + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $PTHREAD_LIBS" + AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include + +int main() { + pthread_mutexattr_t attr; + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + return 0; +} + ]), [have_recursive_mutex=yes], [have_recursive_mutex=no]) + LIBS="$ac_save_LIBS" + + AC_MSG_RESULT([$have_recursive_mutex]) + + if test x"$have_recursive_mutex" = x"yes"; then + ifelse([$1], , [:], [$1]) + else + ifelse([$2], , [:], [$2]) + fi +]) -- cgit v1.2.3 From c9ad18a7e3b147c95c8b9132831259722aa95c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Sat, 24 May 2008 02:08:29 +0200 Subject: Rewrite CC_PTHREAD_RECURSIVE_MUTEX to use M4sh and AC_CACHE_CHECK. --- m4/pthreads.m4 | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/m4/pthreads.m4 b/m4/pthreads.m4 index facac076f..653a496da 100644 --- a/m4/pthreads.m4 +++ b/m4/pthreads.m4 @@ -75,26 +75,28 @@ AC_DEFUN([CC_PTHREAD_FLAGS], [ ]) AC_DEFUN([CC_PTHREAD_RECURSIVE_MUTEX], [ - AC_REQUIRE([CC_PTHREAD_FLAGS]) - AC_MSG_CHECKING([for recursive mutex support in pthread]) - - ac_save_LIBS="$LIBS" - LIBS="$LIBS $PTHREAD_LIBS" - AC_COMPILE_IFELSE(AC_LANG_SOURCE([#include - + AC_REQUIRE([CC_PTHREAD_FLAGS]) + AC_CACHE_CHECK( + [for recursive mutex support in pthread], + [cc_cv_pthread_recursive_mutex], + [ac_save_LIBS="$LIBS" + LIBS="$LIBS $PTHREAD_LIBS" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([ +#include + ], [ int main() { pthread_mutexattr_t attr; pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); return 0; } - ]), [have_recursive_mutex=yes], [have_recursive_mutex=no]) - LIBS="$ac_save_LIBS" - - AC_MSG_RESULT([$have_recursive_mutex]) + ]) + ], + [cc_cv_pthread_recursive_mutex=yes], + [cc_cv_pthread_recursive_mutex=no]) + LIBS="$ac_save_LIBS" + ]) - if test x"$have_recursive_mutex" = x"yes"; then - ifelse([$1], , [:], [$1]) - else - ifelse([$2], , [:], [$2]) - fi + AS_IF([test x"$cc_cv_pthread_recursive_mutex" = x"yes"], + [$1], [$2]) ]) -- cgit v1.2.3 From 86e3e7c72712e1704b12e93c27f6f493e2af5853 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 25 May 2008 03:53:49 +0100 Subject: Wherever possible, use enum constants for TS descriptor tags. --- src/demuxers/demux_ts.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index 5ccdd20de..f6a50a23d 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -217,7 +217,8 @@ ISO_13818_PART7_AUDIO = 0x0f, /* ISO/IEC 13818-7 Audio with ADTS transport sytax */ ISO_14496_PART2_VIDEO = 0x10, /* ISO/IEC 14496-2 Visual (MPEG-4) */ ISO_14496_PART3_AUDIO = 0x11, /* ISO/IEC 14496-3 Audio with LATM transport syntax */ - ISO_14496_PART10_VIDEO = 0x1b /* ISO/IEC 14496-10 Video (MPEG-4 part 10/AVC, aka H.264) */ + ISO_14496_PART10_VIDEO = 0x1b, /* ISO/IEC 14496-10 Video (MPEG-4 part 10/AVC, aka H.264) */ + STREAM_AUDIO_AC3 = 0x81, } streamType; #define WRAP_THRESHOLD 270000 @@ -750,14 +751,14 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, * do not include any of the ac3 header info in their audio tracks * these "raw" streams may begin with a byte that looks like a stream type. */ - if((m->descriptor_tag == 0x81) || /* ac3 - raw */ + if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */ (p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */ m->content = p; m->size = packet_len; m->type |= BUF_AUDIO_A52; return 1; - } else if (m->descriptor_tag == 0x06 + } else if (m->descriptor_tag == ISO_13818_PES_PRIVATE && p[0] == 0x20 && p[1] == 0x00) { /* DVBSUB */ long payload_len = ((buf[4] << 8) | buf[5]) - header_len - 3; @@ -1349,7 +1350,7 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num printf ("demux_ts: PMT AC3 audio pid 0x%.4x type %2.2x\n", pid, stream[0]); #endif demux_ts_pes_new(this, this->media_num, pid, - this->audio_fifo, 0x81); + this->audio_fifo, STREAM_AUDIO_AC3); this->audio_tracks[this->audio_tracks_count].pid = pid; this->audio_tracks[this->audio_tracks_count].media_index = this->media_num; -- cgit v1.2.3 From 38f7af230991974e68aae584d06021c61f24d350 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sun, 25 May 2008 03:58:52 +0100 Subject: Recognise TS descriptor tag 0x80 as MPEG video. --- src/demuxers/demux_ts.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index f6a50a23d..37b0603fa 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -218,6 +218,7 @@ ISO_14496_PART2_VIDEO = 0x10, /* ISO/IEC 14496-2 Visual (MPEG-4) */ ISO_14496_PART3_AUDIO = 0x11, /* ISO/IEC 14496-3 Audio with LATM transport syntax */ ISO_14496_PART10_VIDEO = 0x1b, /* ISO/IEC 14496-10 Video (MPEG-4 part 10/AVC, aka H.264) */ + STREAM_VIDEO_MPEG = 0x80, STREAM_AUDIO_AC3 = 0x81, } streamType; @@ -806,6 +807,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m, switch (m->descriptor_tag) { case ISO_11172_VIDEO: case ISO_13818_VIDEO: + case STREAM_VIDEO_MPEG: lprintf ("demux_ts: found MPEG video type.\n"); m->type = BUF_VIDEO_MPEG; break; -- cgit v1.2.3 From 681a7616d390e675b3afb8146ed1a05862ffab1c Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 29 May 2008 14:07:40 +0100 Subject: Ignore debian/*.debhelper.log. --- .hgignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgignore b/.hgignore index d310df4af..f5788f1cc 100644 --- a/.hgignore +++ b/.hgignore @@ -40,6 +40,7 @@ debian/libxine1-dbg debian/libxine1-doc debian/tmp debian/*.debhelper +debian/*.debhelper.log debian/*.substvars doc/faq/faq.html -- cgit v1.2.3 From a5dfeeb30093308da4e614e4bc8fd642d01affcc Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 29 May 2008 14:36:30 +0100 Subject: Define ARCH_{ALPHA,ARM} as needed; move one ARCH_SPARC which could be missed. --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6490374c7..42a56cc3e 100644 --- a/configure.ac +++ b/configure.ac @@ -2302,19 +2302,21 @@ case "$host_or_hostalias" in esac AC_DEFINE_UNQUOTED(FPM_SPARC,,[Define to select libmad fixed point arithmetic implementation]) - AC_DEFINE_UNQUOTED(ARCH_SPARC,,[Define this if you're running SPARC architecture]) else AC_DEFINE_UNQUOTED(FPM_64BIT,,[Define to select libmad fixed point arithmetic implementation]) fi + AC_DEFINE_UNQUOTED(ARCH_SPARC,,[Define this if you're running SPARC architecture]) ;; mips-*) AC_DEFINE_UNQUOTED(FPM_MIPS,,[Define to select libmad fixed point arithmetic implementation]) ;; alphaev56-* | alpha* | ia64-* | hppa*-linux-*) AC_DEFINE_UNQUOTED(FPM_64BIT,,[Define to select libmad fixed point arithmetic implementation]) + AC_DEFINE_UNQUOTED(ARCH_ALPHA,,[Define this if you're running Alpha architecture]) ;; armv4l-*-linux*) AC_DEFINE_UNQUOTED(FPM_ARM,,[Define to select libmad fixed point arithmetic implementation]) + AC_DEFINE_UNQUOTED(ARCH_ARM,,[Define this if you're running ARM architecture]) enable_armv4l="yes" ;; *) -- cgit v1.2.3