diff options
Diffstat (limited to 'src')
401 files changed, 4463 insertions, 13196 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 256e28bfa..c9d9497ae 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,20 +5,14 @@ SUBDIRS = \ xine-utils \ xine-engine \ audio_out \ + audio_dec \ video_out \ + video_dec \ + spu_dec \ dxr3 \ input \ demuxers \ - libffmpeg \ - libmpeg2 \ - libspudec \ - libspucc \ - libspucmml \ - libspudvb \ - libsputext \ libw32dll \ - libxinevdec \ - libxineadec \ libreal \ post \ combined \ diff --git a/src/libxineadec/Makefile.am b/src/audio_dec/Makefile.am index a85497bbf..a85497bbf 100644 --- a/src/libxineadec/Makefile.am +++ b/src/audio_dec/Makefile.am diff --git a/src/libxineadec/fooaudio.c b/src/audio_dec/fooaudio.c index 42427611f..34a3f2d48 100644 --- a/src/libxineadec/fooaudio.c +++ b/src/audio_dec/fooaudio.c @@ -28,10 +28,10 @@ #include <sys/types.h> #include <unistd.h> -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" /* math.h required for fooaudio sine wave generation */ @@ -312,7 +312,7 @@ static void *init_plugin (xine_t *xine, void *data) { * this decoder is able to handle. Check src/xine-engine/buffer.h for a * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { /* BUF_AUDIO_FOO, */ 0 }; diff --git a/src/libxineadec/gsm610.c b/src/audio_dec/gsm610.c index 4ca3827d7..a0226638a 100644 --- a/src/libxineadec/gsm610.c +++ b/src/audio_dec/gsm610.c @@ -52,10 +52,10 @@ #include <stdlib.h> #include <string.h> -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #include "private.h" @@ -263,7 +263,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_MSGSM, BUF_AUDIO_GSM610, 0 diff --git a/src/libxineadec/xine_a52_decoder.c b/src/audio_dec/xine_a52_decoder.c index 2d901d00a..4928c38d0 100644 --- a/src/libxineadec/xine_a52_decoder.c +++ b/src/audio_dec/xine_a52_decoder.c @@ -44,8 +44,8 @@ #define LOG_PTS */ -#include "xine_internal.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> #ifdef HAVE_A52DEC_A52_H # include <a52dec/a52.h> @@ -59,8 +59,8 @@ # include "a52_internal.h" #endif -#include "buffer.h" -#include "xineutils.h" +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "../../contrib/a52dec/crc.c" @@ -673,8 +673,25 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre this->pts_list[0] = 0; this->pts_list_position = 0; - if( !this->a52_state ) - this->a52_state = a52_init (xine_mm_accel()); + if( !this->a52_state ) { + this->a52_state = +#ifdef HAVE_A52DEC_A52_H /* External liba52 */ + /* When using external liba52, enable _all_ capabilities, even + if that might break stuff if they add some new capability + that depends on CPU's caps. + At the moment the only capability is DJBFFT, which is tested + only if djbfft is being used at compile time. + + The actual question would be: why don't they check for + capabilities themselves? + */ +#warning "Enabling all external liba52 capabilities." + a52_init (0xFFFFFFFF) +#else + a52_init (xine_mm_accel()) +#endif + ; + } /* * find out if this driver supports a52 output @@ -831,7 +848,7 @@ static void surround_downmix_change_cb(void *this_gen, xine_cfg_entry_t *entry) } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_A52, BUF_AUDIO_DNET, 0 diff --git a/src/libxineadec/xine_dts_decoder.c b/src/audio_dec/xine_dts_decoder.c index 369c354fd..2b8dabd10 100644 --- a/src/libxineadec/xine_dts_decoder.c +++ b/src/audio_dec/xine_dts_decoder.c @@ -47,10 +47,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> #include "bswap.h" @@ -562,7 +562,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_DTS, 0 }; diff --git a/src/libxineadec/xine_faad_decoder.c b/src/audio_dec/xine_faad_decoder.c index 36d1d0679..0c7c6dd01 100644 --- a/src/libxineadec/xine_faad_decoder.c +++ b/src/audio_dec/xine_faad_decoder.c @@ -31,10 +31,10 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #ifdef HAVE_NEAACDEC_H #include <neaacdec.h> #else @@ -72,7 +72,7 @@ typedef struct faad_decoder_s { unsigned char *dec_config; int dec_config_size; - uint32_t rate; + unsigned long rate; int bits_per_sample; unsigned char num_channels; int sbr; @@ -199,6 +199,8 @@ static int faad_open_output( faad_decoder_t *this ) { case 2: ao_cap_mode=AO_CAP_MODE_STEREO; break; + default: + return 0; } this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, @@ -459,7 +461,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_AAC, 0 }; diff --git a/src/libxineadec/xine_lpcm_decoder.c b/src/audio_dec/xine_lpcm_decoder.c index 96c02906d..e84b112f4 100644 --- a/src/libxineadec/xine_lpcm_decoder.c +++ b/src/audio_dec/xine_lpcm_decoder.c @@ -39,9 +39,9 @@ #include <fcntl.h> #include <netinet/in.h> /* ntohs */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> #ifdef WIN32 #include <winsock.h> @@ -262,7 +262,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_LPCM_BE, BUF_AUDIO_LPCM_LE, 0 }; diff --git a/src/libxineadec/xine_mad_decoder.c b/src/audio_dec/xine_mad_decoder.c index 906db048a..74c04924f 100644 --- a/src/libxineadec/xine_mad_decoder.c +++ b/src/audio_dec/xine_mad_decoder.c @@ -34,10 +34,10 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #ifdef HAVE_MAD_H # include <mad.h> @@ -48,6 +48,20 @@ #define INPUT_BUF_SIZE 16384 +/* According to Rob Leslie (libmad author) : + * The absolute theoretical maximum frame size is 2881 bytes: MPEG 2.5 Layer II, + * 8000 Hz @ 160 kbps, with a padding slot. (Such a frame is unlikely, but it was + * a useful exercise to compute all possible frame sizes.) Add to this an 8 byte + * MAD_BUFFER_GUARD, and the minimum buffer size you should be streaming to + * libmad in the general case is 2889 bytes. + + * Theoretical frame sizes for Layer III range from 24 to 1441 bytes, but there + * is a "soft" limit imposed by the standard of 960 bytes. Nonetheless MAD can + * decode frames of any size as long as they fit entirely in the buffer you pass, + * not including the MAD_BUFFER_GUARD bytes. + */ +#define MAD_MIN_SIZE 2889 + typedef struct { audio_decoder_class_t decoder_class; } mad_class_t; @@ -135,9 +149,10 @@ static int head_check(mad_decoder_t *this) { static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_decoder_t *this = (mad_decoder_t *) this_gen; + int bytes_in_buffer_at_pts; + + lprintf ("decode data, size: %d, decoder_flags: %d\n", buf->size, buf->decoder_flags); - lprintf ("decode data, decoder_flags: %d\n", buf->decoder_flags); - if (buf->size>(INPUT_BUF_SIZE-this->bytes_in_buffer)) { xprintf (this->xstream->xine, XINE_VERBOSITY_DEBUG, "libmad: ALERT input buffer too small (%d bytes, %d avail)!\n", @@ -156,6 +171,8 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { this->preview_mode = 1; } + bytes_in_buffer_at_pts = this->bytes_in_buffer; + xine_fast_memcpy (&this->buffer[this->bytes_in_buffer], buf->content, buf->size); this->bytes_in_buffer += buf->size; @@ -167,6 +184,9 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); + if (this->bytes_in_buffer < MAD_MIN_SIZE) + return; + while (1) { if (mad_frame_decode (&this->frame, &this->stream) != 0) { @@ -187,6 +207,7 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { return; default: + lprintf ("error 0x%04X, mad_stream_buffer %d bytes\n", this->stream.error, this->bytes_in_buffer); mad_stream_buffer (&this->stream, this->buffer, this->bytes_in_buffer); } @@ -253,6 +274,8 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { struct mad_pcm *pcm = &this->synth.pcm; audio_buffer_t *audio_buffer; uint16_t *output; + int bitrate; + int pts_offset; audio_buffer = this->xstream->audio_out->get_buffer (this->xstream->audio_out); output = audio_buffer->mem; @@ -273,7 +296,22 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { } audio_buffer->num_frames = pcm->length; - audio_buffer->vpts = buf->pts; + + /* pts computing */ + if (this->frame.header.bitrate > 0) { + bitrate = this->frame.header.bitrate; + } else { + bitrate = _x_stream_info_get(this->xstream, XINE_STREAM_INFO_AUDIO_BITRATE); + lprintf("offset %d bps\n", bitrate); + } + audio_buffer->vpts = buf->pts; + if (audio_buffer->vpts && (bitrate > 0)) { + pts_offset = (bytes_in_buffer_at_pts * 8 * 90) / (bitrate / 1000); + lprintf("pts: %"PRId64", offset: %d pts, %d bytes\n", buf->pts, pts_offset, bytes_in_buffer_at_pts); + if (audio_buffer->vpts < pts_offset) + pts_offset = audio_buffer->vpts; + audio_buffer->vpts -= pts_offset; + } this->xstream->audio_out->put_buffer (this->xstream->audio_out, audio_buffer, this->xstream); @@ -349,7 +387,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_MPEG, 0 }; diff --git a/src/libxineadec/xine_musepack_decoder.c b/src/audio_dec/xine_musepack_decoder.c index ad5002439..c556c5b9a 100644 --- a/src/libxineadec/xine_musepack_decoder.c +++ b/src/audio_dec/xine_musepack_decoder.c @@ -39,10 +39,10 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include <mpcdec/mpcdec.h> @@ -129,7 +129,7 @@ static int32_t mpc_reader_tell(void *const data) { /* Returns the total length of the source stream, in bytes. */ static int32_t mpc_reader_get_size(void *const data) { - mpc_decoder_t *const this = (const mpc_decoder_t *) data; + mpc_decoder_t *const this = (mpc_decoder_t *) data; lprintf("mpc_reader_get_size\n"); @@ -444,7 +444,7 @@ static void *init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_MPC, 0 }; diff --git a/src/audio_out/Makefile.am b/src/audio_out/Makefile.am index 6eafd507e..2003383e6 100644 --- a/src/audio_out/Makefile.am +++ b/src/audio_out/Makefile.am @@ -77,11 +77,11 @@ xineplug_ao_out_oss_la_SOURCES = audio_oss_out.c xineplug_ao_out_oss_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) xineplug_ao_out_alsa_la_SOURCES = audio_alsa_out.c -xineplug_ao_out_alsa_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_ao_out_alsa_la_LIBADD = $(XINE_LIB) $(ALSA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_ao_out_alsa_la_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) xineplug_ao_out_esd_la_SOURCES = audio_esd_out.c -xineplug_ao_out_esd_la_LIBADD = $(ESD_LIBS) $(XINE_LIB) $(LTLIBINTL) +xineplug_ao_out_esd_la_LIBADD = $(XINE_LIB) $(ESD_LIBS) $(LTLIBINTL) xineplug_ao_out_esd_la_CFLAGS = $(AM_CFLAGS) $(ESD_CFLAGS) xineplug_ao_out_sun_la_SOURCES = audio_sun_out.c @@ -92,7 +92,7 @@ xineplug_ao_out_sun_la_LIBADD = $(XINE_LIB) #xineplug_ao_out_irixal_la_CFLAGS = $(AM_CFLAGS) $(IRIXAL_CFLAGS) xineplug_ao_out_directx_la_SOURCES = audio_directx_out.c -xineplug_ao_out_directx_la_LIBADD = $(DIRECTX_AUDIO_LIBS) $(XINE_LIB) +xineplug_ao_out_directx_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS) xineplug_ao_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_ao_out_coreaudio_la_SOURCES = audio_coreaudio_out.c @@ -100,7 +100,7 @@ xineplug_ao_out_coreaudio_la_LIBADD = $(XINE_LIB) xineplug_ao_out_coreaudio_la_LDFLAGS = $(AM_LDFLAGS) -framework CoreAudio -framework AudioUnit xineplug_ao_out_pulseaudio_la_SOURCES = audio_pulse_out.c -xineplug_ao_out_pulseaudio_la_LIBADD = $(PULSEAUDIO_LIBS) $(XINE_LIB) $(LTLIBINTL) +xineplug_ao_out_pulseaudio_la_LIBADD = $(XINE_LIB) $(PULSEAUDIO_LIBS) $(LTLIBINTL) xineplug_ao_out_pulseaudio_la_CFLAGS = $(AM_CFLAGS) $(PULSEAUDIO_CFLAGS) xineplug_ao_out_directx2_la_SOURCES = audio_directx2_out.c @@ -108,9 +108,9 @@ xineplug_ao_out_directx2_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_ao_out_directx2_la_LIBADD = $(XINE_LIB) $(DIRECTX_AUDIO_LIBS) $(PTHREAD_LIBS) xineplug_ao_out_fusionsound_la_SOURCES = audio_fusionsound_out.c -xineplug_ao_out_fusionsound_la_LIBADD = $(FUSIONSOUND_LIBS) $(XINE_LIB) +xineplug_ao_out_fusionsound_la_LIBADD = $(XINE_LIB) $(FUSIONSOUND_LIBS) xineplug_ao_out_fusionsound_la_CFLAGS = $(AM_CFLAGS) $(FUSIONSOUND_CFLAGS) xineplug_ao_out_jack_la_SOURCES = audio_jack_out.c -xineplug_ao_out_jack_la_LIBADD = $(JACK_LIBS) $(XINE_LIB) $(LTLIBINTL) +xineplug_ao_out_jack_la_LIBADD = $(XINE_LIB) $(JACK_LIBS) $(LTLIBINTL) xineplug_ao_out_jack_la_CFLAGS = $(AM_FLAGS) $(JACK_CFLAGS) diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 1a26b01e9..a6f81cb35 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -50,10 +50,10 @@ #include <inttypes.h> #include <pthread.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/audio_out.h> /* #define ALSA_LOG @@ -138,7 +138,7 @@ static int my_snd_mixer_wait(snd_mixer_t *mixer, int timeout) { return count; if ((unsigned int) count > sizeof(spfds) / sizeof(spfds[0])) { - pfds = malloc(count * sizeof(*pfds)); + pfds = calloc(count, sizeof(*pfds)); if (!pfds) return -ENOMEM; diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c index 551810e3e..001d873fa 100644 --- a/src/audio_out/audio_coreaudio_out.c +++ b/src/audio_out/audio_coreaudio_out.c @@ -41,9 +41,9 @@ #include <unistd.h> #include <inttypes.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #include <CoreAudio/CoreAudio.h> #include <CoreAudio/CoreAudioTypes.h> diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index 9bcc52233..309edf961 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.c @@ -58,8 +58,8 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> #define AO_OUT_DIRECTX2_IFACE_VERSION 9 diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c index c7dea4e04..5d16698b2 100644 --- a/src/audio_out/audio_directx_out.c +++ b/src/audio_out/audio_directx_out.c @@ -38,8 +38,8 @@ typedef unsigned char boolean; #define LOG */ -#include "audio_out.h" -#include "xine_internal.h" +#include <xine/audio_out.h> +#include <xine/xine_internal.h> #define MAX_CHANNELS 6 diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c index 9aec15c7a..81017f1ca 100644 --- a/src/audio_out/audio_esd_out.c +++ b/src/audio_out/audio_esd_out.c @@ -33,10 +33,10 @@ #include <sys/uio.h> #include <inttypes.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" -#include "metronom.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> +#include <xine/metronom.h> #define AO_OUT_ESD_IFACE_VERSION 9 diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c index fda5ec7df..666c9deeb 100644 --- a/src/audio_out/audio_file_out.c +++ b/src/audio_out/audio_file_out.c @@ -31,9 +31,9 @@ #include <unistd.h> #include <inttypes.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #include "bswap.h" #define AO_OUT_FILE_IFACE_VERSION 9 @@ -72,7 +72,7 @@ typedef struct file_driver_s { uint32_t bits_per_sample; uint32_t bytes_per_frame; - char *fname; + const char *fname; int fd; size_t bytes_written; struct timeval endtime; diff --git a/src/audio_out/audio_fusionsound_out.c b/src/audio_out/audio_fusionsound_out.c index ceda0a293..b33850c5e 100644 --- a/src/audio_out/audio_fusionsound_out.c +++ b/src/audio_out/audio_fusionsound_out.c @@ -34,9 +34,9 @@ #define LOG_VERBOSE #include "xine.h" -#include "xine_internal.h" -#include "audio_out.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/xineutils.h> #include <directfb.h> @@ -47,6 +47,12 @@ #define FUSIONSOUND_VERSION_CODE VERSION_CODE( FUSIONSOUND_MAJOR_VERSION, \ FUSIONSOUND_MINOR_VERSION, \ FUSIONSOUND_MICRO_VERSION ) + +#if FUSIONSOUND_VERSION_CODE >= VERSION_CODE(1,1,0) +# include <fusionsound_limits.h> /* defines FS_MAX_CHANNELS */ +#else +# define FS_MAX_CHANNELS 2 +#endif #define AO_OUT_FS_IFACE_VERSION 9 @@ -100,7 +106,29 @@ static int ao_fusionsound_open(ao_driver_t *ao_driver, break; case AO_CAP_MODE_STEREO: dsc.channels = 2; - break; + break; +#if FS_MAX_CHANNELS > 2 + case AO_CAP_MODE_4CHANNEL: + dsc.channels = 4; + dsc.channelmode = FSCM_SURROUND40_2F2R; + dsc.flags |= FSBDF_CHANNELMODE; + break; + case AO_CAP_MODE_4_1CHANNEL: + dsc.channels = 5; + dsc.channelmode = FSCM_SURROUND41_2F2R; + dsc.flags |= FSBDF_CHANNELMODE; + break; + case AO_CAP_MODE_5CHANNEL: + dsc.channels = 5; + dsc.channelmode = FSCM_SURROUND50; + dsc.flags |= FSBDF_CHANNELMODE; + break; + case AO_CAP_MODE_5_1CHANNEL: + dsc.channels = 6; + dsc.channelmode = FSCM_SURROUND51; + dsc.flags |= FSBDF_CHANNELMODE; + break; +#endif default: xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_fusionsound_out: mode %#x not supported\n", mode); @@ -250,13 +278,18 @@ static void ao_fusionsound_close(ao_driver_t *ao_driver){ */ static uint32_t ao_fusionsound_get_capabilities(ao_driver_t *ao_driver) { + uint32_t caps = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | + AO_CAP_MIXER_VOL | AO_CAP_MUTE_VOL | + AO_CAP_8BITS | AO_CAP_16BITS | + AO_CAP_24BITS; #if FUSIONSOUND_VERSION_CODE >= VERSION_CODE(0,9,26) - return (AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | - AO_CAP_8BITS | AO_CAP_16BITS | AO_CAP_24BITS | AO_CAP_FLOAT32); -#else - return (AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO | AO_CAP_MIXER_VOL | - AO_CAP_8BITS | AO_CAP_16BITS | AO_CAP_24BITS); + caps |= AO_CAP_FLOAT32; +#endif +#if FS_MAX_CHANNELS > 2 + caps |= AO_CAP_MODE_4CHANNEL | AO_CAP_MODE_4_1CHANNEL | + AO_CAP_MODE_5CHANNEL | AO_CAP_MODE_5_1CHANNEL; #endif + return caps; } static void ao_fusionsound_exit(ao_driver_t *ao_driver) { diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c index 1654cc1a7..e86b78e76 100644 --- a/src/audio_out/audio_irixal_out.c +++ b/src/audio_out/audio_irixal_out.c @@ -37,10 +37,10 @@ #include <dmedia/audio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/audio_out.h> //#ifndef AFMT_S16_NE //# if defined(sparc) || defined(__sparc__) || defined(PPC) diff --git a/src/audio_out/audio_jack_out.c b/src/audio_out/audio_jack_out.c index b3b2d4a19..7b8bb3eb3 100644 --- a/src/audio_out/audio_jack_out.c +++ b/src/audio_out/audio_jack_out.c @@ -8,9 +8,9 @@ #include <unistd.h> #include <inttypes.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #include <jack/jack.h> diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c index 0e5cf1864..fa6547880 100644 --- a/src/audio_out/audio_none_out.c +++ b/src/audio_out/audio_none_out.c @@ -31,9 +31,9 @@ #include <unistd.h> #include <inttypes.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #define AO_OUT_NONE_IFACE_VERSION 9 diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c index 5576b1d5f..7cae9b300 100644 --- a/src/audio_out/audio_oss_out.c +++ b/src/audio_out/audio_oss_out.c @@ -64,10 +64,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/audio_out.h> #include <sys/time.h> @@ -660,7 +660,7 @@ static int ao_oss_ctrl(ao_driver_t *this_gen, int cmd, ...) { * If not, the function returns 0. */ static int probe_audio_devices(oss_driver_t *this) { - const char *base_names[2] = {"/dev/dsp", "/dev/sound/dsp"}; + static const char *const base_names[2] = {"/dev/dsp", "/dev/sound/dsp"}; int base_num, i; int audio_fd, rate; int best_rate; @@ -1035,20 +1035,14 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da if ((parse = strstr(mixer_name, "dsp"))) { parse[0] = '\0'; parse += 3; - this->mixer.name = (char *)malloc(strlen(mixer_name) + sizeof("mixer") + 2); if (devname_val == 0) - sprintf(this->mixer.name, "%smixer%s", mixer_name, parse); - else { - if (mixer_num == -1) - sprintf(this->mixer.name, "%smixer", mixer_name); - else - sprintf(this->mixer.name, "%smixer%d", mixer_name, mixer_num); - } - } else { - this->mixer.name = (char *)malloc(1); - this->mixer.name[0] = '\0'; + asprintf(&this->mixer.name, "%smixer%s", mixer_name, parse); + else if (mixer_num == -1) + asprintf(&this->mixer.name, "%smixer", mixer_name); + else + asprintf(&this->mixer.name, "%smixer%d", mixer_name, mixer_num); } - _x_assert(this->mixer.name[0] != '\0'); + _x_assert(this->mixer.name); this->mixer.fd = open(this->mixer.name, O_RDONLY); diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c index 6054e137e..b4ec0b156 100644 --- a/src/audio_out/audio_pulse_out.c +++ b/src/audio_out/audio_pulse_out.c @@ -41,9 +41,9 @@ #include <pulse/pulseaudio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #include "bswap.h" #define GAP_TOLERANCE AO_MAX_GAP diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c index c37397639..921e5fd15 100644 --- a/src/audio_out/audio_sun_out.c +++ b/src/audio_out/audio_sun_out.c @@ -45,9 +45,9 @@ typedef unsigned uint_t; #endif -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> #ifdef __svr4__ #define CS4231_WORKAROUND 1 /* enable workaround for audiocs play.samples bug */ diff --git a/src/combined/Makefile.am b/src/combined/Makefile.am index 0784b8044..92d49a3e5 100644 --- a/src/combined/Makefile.am +++ b/src/combined/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = ffmpeg + include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) diff --git a/src/libffmpeg/Makefile.am b/src/combined/ffmpeg/Makefile.am index 42fe20f95..b9dee7ea6 100644 --- a/src/libffmpeg/Makefile.am +++ b/src/combined/ffmpeg/Makefile.am @@ -53,7 +53,7 @@ endif nodist_xineplug_decode_ff_la_SOURCES = ffmpeg_config.h -xineplug_decode_ff_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm $(ZLIB_LIBS) \ +xineplug_decode_ff_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) -lm $(ZLIB_LIBS) \ $(link_ffmpeg) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_decode_ff_la_LDFLAGS = $(AM_LDFLAGS) $(IMPURE_TEXT_LDFLAGS) diff --git a/src/libffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c index 6dd9205ea..f79014fde 100644 --- a/src/libffmpeg/ff_audio_decoder.c +++ b/src/combined/ffmpeg/ff_audio_decoder.c @@ -40,9 +40,9 @@ #define LOG */ -#include "xine_internal.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #include "ffmpeg_decoder.h" @@ -431,7 +431,7 @@ void *init_audio_plugin (xine_t *xine, void *data) { return this; } -static uint32_t supported_audio_types[] = { +static const uint32_t supported_audio_types[] = { #if defined(HAVE_FFMPEG) || CONFIG_WMAV1_DECODER BUF_AUDIO_WMAV1, #endif diff --git a/src/libffmpeg/ff_dvaudio_decoder.c b/src/combined/ffmpeg/ff_dvaudio_decoder.c index 482ae396e..aced7f5bb 100644 --- a/src/libffmpeg/ff_dvaudio_decoder.c +++ b/src/combined/ffmpeg/ff_dvaudio_decoder.c @@ -36,9 +36,9 @@ #define LOG */ -#include "xine_internal.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #ifdef _MSC_VER /* ffmpeg has own definitions of those types */ diff --git a/src/libffmpeg/ff_mpeg_parser.c b/src/combined/ffmpeg/ff_mpeg_parser.c index 70901d93b..70901d93b 100644 --- a/src/libffmpeg/ff_mpeg_parser.c +++ b/src/combined/ffmpeg/ff_mpeg_parser.c diff --git a/src/libffmpeg/ff_mpeg_parser.h b/src/combined/ffmpeg/ff_mpeg_parser.h index ea43a6ce4..504e746f9 100644 --- a/src/libffmpeg/ff_mpeg_parser.h +++ b/src/combined/ffmpeg/ff_mpeg_parser.h @@ -23,7 +23,7 @@ #ifndef HAVE_MPEG_PARSER_H #define HAVE_MPEG_PARSER_H -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "ffmpeg_decoder.h" #define BUFFER_SIZE (1194 * 1024) /* libmpeg2's buffer size */ diff --git a/src/libffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c index 0b8728f06..b7a5338fc 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/combined/ffmpeg/ff_video_decoder.c @@ -40,10 +40,10 @@ /* #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "bswap.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "ffmpeg_decoder.h" #include "ff_mpeg_parser.h" @@ -63,6 +63,8 @@ typedef struct ff_video_class_s { int pp_quality; int thread_count; + int8_t skip_loop_filter_enum; + int8_t choose_speed_over_accuracy; xine_t *xine; } ff_video_class_t; @@ -311,9 +313,28 @@ static const ff_codec_t ff_video_lookup[] = { {BUF_VIDEO_KMVC, CODEC_ID_KMVC, "Karl Morton's Video Codec (ffmpeg)"}, {BUF_VIDEO_FLASHSV, CODEC_ID_FLASHSV, "Flash Screen Video (ffmpeg)"}, {BUF_VIDEO_CAVS, CODEC_ID_CAVS, "Chinese AVS (ffmpeg)"}, + {BUF_VIDEO_VMNC, CODEC_ID_VMNC, "VMware Screen Codec (ffmpeg)"}, {BUF_VIDEO_THEORA_RAW, CODEC_ID_THEORA, "Theora (ffmpeg)"}, }; +static const char *const skip_loop_filter_enum_names[] = { + "default", /* AVDISCARD_DEFAULT */ + "none", /* AVDISCARD_NONE */ + "nonref", /* AVDISCARD_NONREF */ + "bidir", /* AVDISCARD_BIDIR */ + "nonkey", /* AVDISCARD_NONKEY */ + "all", /* AVDISCARD_ALL */ + NULL +}; + +static const int skip_loop_filter_enum_values[] = { + AVDISCARD_DEFAULT, + AVDISCARD_NONE, + AVDISCARD_NONREF, + AVDISCARD_BIDIR, + AVDISCARD_NONKEY, + AVDISCARD_ALL +}; static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) { size_t i; @@ -358,6 +379,9 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) this->context->flags |= CODEC_FLAG_EMU_EDGE; } + if (this->class->choose_speed_over_accuracy) + this->context->flags2 |= CODEC_FLAG2_FAST; + pthread_mutex_lock(&ffmpeg_lock); if (avcodec_open (this->context, this->codec) < 0) { pthread_mutex_unlock(&ffmpeg_lock); @@ -374,6 +398,8 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) this->context->thread_count = this->class->thread_count; } + this->context->skip_loop_filter = skip_loop_filter_enum_values[this->class->skip_loop_filter_enum]; + pthread_mutex_unlock(&ffmpeg_lock); lprintf("lavc decoder opened\n"); @@ -431,6 +457,18 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } +static void choose_speed_over_accuracy_cb(void *user_data, xine_cfg_entry_t *entry) { + ff_video_class_t *class = (ff_video_class_t *) user_data; + + class->choose_speed_over_accuracy = entry->num_value; +} + +static void skip_loop_filter_enum_cb(void *user_data, xine_cfg_entry_t *entry) { + ff_video_class_t *class = (ff_video_class_t *) user_data; + + class->skip_loop_filter_enum = entry->num_value; +} + static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; @@ -1158,7 +1196,7 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { int got_one_picture = 0; int offset = 0; int codec_type = buf->type & 0xFFFF0000; - int video_step_to_use; + int video_step_to_use = this->video_step; /* pad input data */ /* note: bitstream, alt bitstream reader or something will cause @@ -1558,14 +1596,32 @@ void *init_video_plugin (xine_t *xine, void *data) { _("You can adjust the number of video decoding threads which FFmpeg may use.\n" "Higher values should speed up decoding but it depends on the codec used " "whether parallel decoding is supported. A rule of thumb is to have one " - "decoding thread per logical CPU (typically 1 to 4). A change will take " - "effect with playing the next stream."), + "decoding thread per logical CPU (typically 1 to 4).\n" + "A change of this setting will take effect with playing the next stream."), 10, thread_count_cb, this); + this->skip_loop_filter_enum = xine->config->register_enum(config, "video.processing.ffmpeg_skip_loop_filter", 0, + (char **)skip_loop_filter_enum_names, + _("Skip loop filter"), + _("You can control for which frames the loop filter shall be skipped after " + "decoding.\n" + "Skipping the loop filter will speedup decoding but may lead to artefacts. " + "The number of frames for which it is skipped increases from 'none' to 'all'. " + "The default value leaves the decision up to the implementation.\n" + "A change of this setting will take effect with playing the next stream."), + 10, skip_loop_filter_enum_cb, this); + + this->choose_speed_over_accuracy = xine->config->register_bool(config, "video.processing.ffmpeg_choose_speed_over_accuracy", 0, + _("Choose speed over specification compliance"), + _("You may want to allow speed cheats which violate codec specification.\n" + "Cheating may speed up decoding but can also lead to decoding artefacts.\n" + "A change of this setting will take effect with playing the next stream."), + 10, choose_speed_over_accuracy_cb, this); + return this; } -static uint32_t supported_video_types[] = { +static const uint32_t supported_video_types[] = { #if defined(HAVE_FFMPEG) || CONFIG_MSMPEG4V1_DECODER BUF_VIDEO_MSMPEG4_V1, #endif @@ -1786,16 +1842,19 @@ static uint32_t supported_video_types[] = { #if defined(HAVE_FFMPEG) || CONFIG_CAVS_DECODER BUF_VIDEO_CAVS, #endif +#if defined(HAVE_FFMPEG) || CONFIG_VMNC_DECODER + BUF_VIDEO_VMNC, +#endif BUF_VIDEO_THEORA_RAW, 0 }; -static uint32_t wmv8_video_types[] = { +static const uint32_t wmv8_video_types[] = { BUF_VIDEO_WMV8, 0 }; -static uint32_t wmv9_video_types[] = { +static const uint32_t wmv9_video_types[] = { BUF_VIDEO_WMV9, 0 }; diff --git a/src/libffmpeg/ffmpeg_decoder.c b/src/combined/ffmpeg/ffmpeg_decoder.c index 45080590d..8a8a79270 100644 --- a/src/libffmpeg/ffmpeg_decoder.c +++ b/src/combined/ffmpeg/ffmpeg_decoder.c @@ -24,7 +24,7 @@ #include "config.h" #endif -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "ffmpeg_decoder.h" diff --git a/src/libffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h index bfe71a6b1..bfe71a6b1 100644 --- a/src/libffmpeg/ffmpeg_decoder.h +++ b/src/combined/ffmpeg/ffmpeg_decoder.h diff --git a/src/libffmpeg/ffmpeg_encoder.c b/src/combined/ffmpeg/ffmpeg_encoder.c index 7fe65c7fa..7fe65c7fa 100644 --- a/src/libffmpeg/ffmpeg_encoder.c +++ b/src/combined/ffmpeg/ffmpeg_encoder.c diff --git a/src/combined/flac_decoder.c b/src/combined/flac_decoder.c index cb7db0364..43bad327e 100644 --- a/src/combined/flac_decoder.c +++ b/src/combined/flac_decoder.c @@ -44,9 +44,9 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> typedef struct { audio_decoder_class_t decoder_class; @@ -388,7 +388,7 @@ init_plugin (xine_t *xine, void *data) { this->decoder_class.open_plugin = open_plugin; this->decoder_class.identifier = "flacdec"; this->decoder_class.description = N_("flac audio decoder plugin"); - this->decoder_class.dispose = default_audio_decoder_dispose; + this->decoder_class.dispose = default_audio_decoder_class_dispose; return this; @@ -396,7 +396,7 @@ init_plugin (xine_t *xine, void *data) { void *demux_flac_init_class (xine_t *xine, void *data); -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_FLAC, 0 }; diff --git a/src/combined/flac_demuxer.c b/src/combined/flac_demuxer.c index bee98d2a3..22ee2319b 100644 --- a/src/combined/flac_demuxer.c +++ b/src/combined/flac_demuxer.c @@ -51,9 +51,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "../demuxers/demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #ifndef LEGACY_FLAC # define FLAC__SeekableStreamDecoder FLAC__StreamDecoder @@ -713,7 +713,8 @@ demux_flac_init_class (xine_t *xine, void *data) { this->demux_class.open_plugin = open_plugin; this->demux_class.description = N_("FLAC demux plugin"); this->demux_class.identifier = "FLAC"; - this->demux_class.mimetypes = "application/x-flac: flac: FLAC Audio;"; + this->demux_class.mimetypes = "application/x-flac: flac: FLAC Audio;" + "application/flac: flac: FLAC Audio;"; this->demux_class.extensions = "flac"; this->demux_class.dispose = default_demux_class_dispose; diff --git a/src/combined/nsf_combined.c b/src/combined/nsf_combined.c index 085467937..0364e2db2 100644 --- a/src/combined/nsf_combined.c +++ b/src/combined/nsf_combined.c @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "nsf_combined.h" static const demuxer_info_t demux_info_nsf = { 10 /* priority */ }; -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_NSF, 0 }; diff --git a/src/combined/nsf_decoder.c b/src/combined/nsf_decoder.c index b2694e789..cb3b6e7b0 100644 --- a/src/combined/nsf_decoder.c +++ b/src/combined/nsf_decoder.c @@ -27,10 +27,10 @@ #include <sys/types.h> #include <unistd.h> -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" /* Nosefart includes */ diff --git a/src/combined/nsf_demuxer.c b/src/combined/nsf_demuxer.c index cce7c8983..451e6e938 100644 --- a/src/combined/nsf_demuxer.c +++ b/src/combined/nsf_demuxer.c @@ -46,10 +46,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "nsf_combined.h" diff --git a/src/combined/wavpack_combined.c b/src/combined/wavpack_combined.c index 9c5dade03..8a4b488ae 100644 --- a/src/combined/wavpack_combined.c +++ b/src/combined/wavpack_combined.c @@ -20,14 +20,14 @@ * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "wavpack_combined.h" static const demuxer_info_t demux_info_wv = { 0 /* priority */ }; -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_WAVPACK, 0 }; diff --git a/src/combined/wavpack_combined.h b/src/combined/wavpack_combined.h index 264609bf2..42b0bfd51 100644 --- a/src/combined/wavpack_combined.h +++ b/src/combined/wavpack_combined.h @@ -20,7 +20,7 @@ * xine interface to libwavpack by Diego Pettenò <flameeyes@gmail.com> */ -#include "os_types.h" +#include <xine/os_types.h> #include "bswap.h" typedef struct { diff --git a/src/combined/wavpack_decoder.c b/src/combined/wavpack_decoder.c index 8eb041664..80a14e678 100644 --- a/src/combined/wavpack_decoder.c +++ b/src/combined/wavpack_decoder.c @@ -27,8 +27,8 @@ #define LOG_MODULE "decode_wavpack" #define LOG_VERBOSE -#include "xine_internal.h" -#include "attributes.h" +#include <xine/xine_internal.h> +#include <xine/attributes.h> #include "bswap.h" #include <wavpack/wavpack.h> diff --git a/src/combined/wavpack_demuxer.c b/src/combined/wavpack_demuxer.c index ac5c66a8d..9c0831cfa 100644 --- a/src/combined/wavpack_demuxer.c +++ b/src/combined/wavpack_demuxer.c @@ -28,11 +28,11 @@ #define LOG_VERBOSE #define LOG -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #include "bswap.h" -#include "attributes.h" +#include <xine/attributes.h> #include <wavpack/wavpack.h> #include "wavpack_combined.h" @@ -302,12 +302,6 @@ static int demux_wv_seek (demux_plugin_t *this_gen, return this->status; } -static void demux_wv_dispose (demux_plugin_t *const this_gen) { - demux_wv_t *const this = (demux_wv_t *) this_gen; - - free(this); -} - static int demux_wv_get_status (demux_plugin_t *const this_gen) { const demux_wv_t *const this = (const demux_wv_t *) this_gen; @@ -339,7 +333,7 @@ static demux_plugin_t *open_plugin (demux_class_t *const class_gen, this->demux_plugin.send_headers = demux_wv_send_headers; this->demux_plugin.send_chunk = demux_wv_send_chunk; this->demux_plugin.seek = demux_wv_seek; - this->demux_plugin.dispose = demux_wv_dispose; + this->demux_plugin.dispose = default_demux_plugin_dispose; this->demux_plugin.get_status = demux_wv_get_status; this->demux_plugin.get_stream_length = demux_wv_get_stream_length; this->demux_plugin.get_capabilities = demux_wv_get_capabilities; diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c index bdaf73063..b09bc1a41 100644 --- a/src/combined/xine_ogg_demuxer.c +++ b/src/combined/xine_ogg_demuxer.c @@ -65,9 +65,9 @@ #define DEBUG_PTS 0 #define DEBUG_VIDEO_PACKETS 0 -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #include "bswap.h" #include "flacutils.h" @@ -1211,8 +1211,7 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac _x_assert(op->packet[0] == 0x7F); /* OggFLAC signature */ - _x_assert(op->packet[1] == 'F'); _x_assert(op->packet[2] == 'L'); - _x_assert(op->packet[3] == 'A'); _x_assert(op->packet[4] == 'C'); + _x_assert(_X_BE_32(&op->packet[1]) == ME_FOURCC('F', 'L', 'A', 'C')); /* Version: supported only 1.0 */ _x_assert(op->packet[5] == 1); _x_assert(op->packet[6] == 0); @@ -1221,8 +1220,7 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac this->si[stream_num]->headers = 0/*_X_BE_16(&op->packet[7]) +1*/; /* fLaC signature */ - _x_assert(op->packet[9] == 'f'); _x_assert(op->packet[10] == 'L'); - _x_assert(op->packet[11] == 'a'); _x_assert(op->packet[12] == 'C'); + _x_assert(_X_BE_32(&op->packet[9]) == ME_FOURCC('f', 'L', 'a', 'C')); _x_parse_flac_metadata_header(&op->packet[13], &header); @@ -1230,16 +1228,17 @@ static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_pac case FLAC_BLOCKTYPE_STREAMINFO: _x_assert(header.length == FLAC_STREAMINFO_SIZE); _x_parse_flac_streaminfo_block(&op->packet[17], &streaminfo); + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, streaminfo.samplerate); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, streaminfo.channels); + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, streaminfo.bits_per_sample); + break; } this->si[stream_num]->buf_types = BUF_AUDIO_FLAC +this->num_audio_streams++; - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, streaminfo.samplerate); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, streaminfo.channels); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, streaminfo.bits_per_sample); - this->si[stream_num]->factor = 90000; buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); @@ -1398,28 +1397,28 @@ static void send_header (demux_ogg_t *this) { if (!this->si[stream_num]->buf_types) { /* detect buftype */ - if (!strncmp (&op.packet[1], "vorbis", 6)) { + if (!memcmp (&op.packet[1], "vorbis", 6)) { decode_vorbis_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "Speex", 5)) { + } else if (!memcmp (&op.packet[0], "Speex", 5)) { decode_speex_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "video", 5)) { + } else if (!memcmp (&op.packet[1], "video", 5)) { decode_video_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "audio", 5)) { + } else if (!memcmp (&op.packet[1], "audio", 5)) { decode_audio_header(this, stream_num, &op); } else if (op.bytes >= 142 - && !strncmp (&op.packet[1], "Direct Show Samples embedded in Ogg", 35) ) { + && !memcmp (&op.packet[1], "Direct Show Samples embedded in Ogg", 35) ) { decode_dshow_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "text", 4)) { + } else if (!memcmp (&op.packet[1], "text", 4)) { decode_text_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "theora", 6)) { + } else if (!memcmp (&op.packet[1], "theora", 6)) { decode_theora_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[1], "FLAC", 4)) { + } else if (!memcmp (&op.packet[1], "FLAC", 4)) { decode_flac_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "Annodex", 7)) { + } else if (!memcmp (&op.packet[0], "Annodex", 7)) { decode_annodex_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "AnxData", 7)) { + } else if (!memcmp (&op.packet[0], "AnxData", 7)) { decode_anxdata_header(this, stream_num, &op); - } else if (!strncmp (&op.packet[0], "CMML", 4)) { + } else if (!memcmp (&op.packet[0], "CMML", 4)) { decode_cmml_header(this, stream_num, &op); } else { xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, @@ -1960,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 @@ -2098,7 +2079,13 @@ static void *anx_init_class (xine_t *xine, void *data) { this->demux_class.open_plugin = anx_open_plugin; this->demux_class.description = N_("Annodex demux plugin"); this->demux_class.identifier = "Annodex"; - this->demux_class.mimetypes = "application/x-annodex: ogg: Annodex media;"; + this->demux_class.mimetypes = + "application/annodex: anx: Annodex media;" + "application/x-annodex: anx: Annodex media;" + "audio/annodex: axa: Annodex audio;" + "audio/x-annodex: axa: Annodex audio;" + "video/annodex: axv: Annodex video;" + "video/x-annodex: axv: Annodex video;"; this->demux_class.extensions = "anx axa axv"; this->demux_class.dispose = default_demux_class_dispose; @@ -2117,11 +2104,13 @@ static void *ogg_init_class (xine_t *xine, void *data) { this->demux_class.description = N_("OGG demux plugin"); this->demux_class.identifier = "OGG"; this->demux_class.mimetypes = - "audio/x-ogg: ogg: OggVorbis Audio;" - "audio/x-speex: ogg: Speex Audio;" - "application/x-ogg: ogg: Ogg Stream;" - "application/ogg: ogg: Ogg Stream;"; - this->demux_class.extensions = "ogg ogm spx"; + "application/ogg: ogx: Ogg Stream;" + "application/x-ogg: ogx: Ogg Stream;" + "audio/ogg: oga: Ogg Audio;" + "audio/x-ogg: oga: Ogg Audio;" + "video/ogg: ogv: Ogg Video;"; + "video/x-ogg: ogv: Ogg Video;"; + this->demux_class.extensions = "ogx ogv oga ogg spx ogm"; this->demux_class.dispose = default_demux_class_dispose; return this; diff --git a/src/combined/xine_speex_decoder.c b/src/combined/xine_speex_decoder.c index e4fc44eec..865232e30 100644 --- a/src/combined/xine_speex_decoder.c +++ b/src/combined/xine_speex_decoder.c @@ -34,9 +34,9 @@ */ #define LOG_BUFFERS 0 -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> #include <ogg/ogg.h> @@ -92,8 +92,8 @@ static void speex_discontinuity (audio_decoder_t *this_gen) { } /* Known speex comment keys from ogg123 sources*/ -static struct { - char *key; /* includes the '=' for programming convenience */ +static const struct { + char key[16]; /* includes the '=' for programming convenience */ int xine_metainfo_index; } speex_comment_keys[] = { {"ARTIST=", XINE_META_INFO_ARTIST}, @@ -101,8 +101,7 @@ static struct { {"TITLE=", XINE_META_INFO_TITLE}, {"GENRE=", XINE_META_INFO_GENRE}, {"DESCRIPTION=", XINE_META_INFO_COMMENT}, - {"DATE=", XINE_META_INFO_YEAR}, - {NULL, 0} + {"DATE=", XINE_META_INFO_YEAR} }; #define readint(buf, base) (((buf[base+3]<<24)&0xff000000)| \ @@ -169,8 +168,7 @@ void read_metadata (speex_decoder_t *this, char * comments, int length) printf ("\n"); #endif - for (i = 0; speex_comment_keys[i].key != NULL; i++) { - + for (i = 0; i < (sizeof(speex_comment_keys)/sizeof(speex_comment_keys[0])); i++) { if ( !strncasecmp (speex_comment_keys[i].key, c, strlen(speex_comment_keys[i].key)) ) { int keylen = strlen(speex_comment_keys[i].key); @@ -390,7 +388,7 @@ void *speex_init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_SPEEX, 0 }; diff --git a/src/combined/xine_theora_decoder.c b/src/combined/xine_theora_decoder.c index 8d06a5510..96d4ca8f0 100644 --- a/src/combined/xine_theora_decoder.c +++ b/src/combined/xine_theora_decoder.c @@ -39,11 +39,11 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "metronom.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/metronom.h> +#include <xine/xineutils.h> typedef struct theora_class_s { video_decoder_class_t decoder_class; @@ -361,7 +361,7 @@ void *theora_init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t supported_types[] = { BUF_VIDEO_THEORA, 0 }; +static const uint32_t supported_types[] = { BUF_VIDEO_THEORA, 0 }; const decoder_info_t dec_info_theora = { supported_types, /* supported types */ diff --git a/src/combined/xine_vorbis_decoder.c b/src/combined/xine_vorbis_decoder.c index aa3546e2e..ad3a07188 100644 --- a/src/combined/xine_vorbis_decoder.c +++ b/src/combined/xine_vorbis_decoder.c @@ -33,14 +33,15 @@ #define LOG */ -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> #include <ogg/ogg.h> #include <vorbis/codec.h> #define MAX_NUM_SAMPLES 4096 +#define INIT_BUFSIZE 8192 typedef struct { audio_decoder_class_t decoder_class; @@ -70,6 +71,11 @@ typedef struct vorbis_decoder_s { xine_stream_t *stream; + /* data accumulation stuff */ + unsigned char *buf; + int bufsize; + int size; + } vorbis_decoder_t; @@ -78,6 +84,7 @@ static void vorbis_reset (audio_decoder_t *this_gen) { vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; if( this->header_count ) return; + this->size = 0; /* clear block first, as it might contain allocated data */ vorbis_block_clear(&this->vb); @@ -136,126 +143,147 @@ static void get_metadata (vorbis_decoder_t *this) { _x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "vorbis"); } +static void vorbis_check_bufsize (vorbis_decoder_t *this, int size) { + if (size > this->bufsize) { + this->bufsize = size + size / 2; + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + _("vorbis: increasing buffer to %d to avoid overflow.\n"), + this->bufsize); + this->buf = realloc(this->buf, this->bufsize); + } +} + static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) { vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen; memset( &this->op, 0, sizeof(this->op) ); - this->op.packet = buf->content; - this->op.bytes = buf->size; - - if ( (buf->decoder_flags & BUF_FLAG_HEADER) && - !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) { - lprintf ("%d headers to go\n", this->header_count); - if (this->header_count) { - int res = 0; + /* data accumulation */ + vorbis_check_bufsize(this, this->size + buf->size); + xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); + this->size += buf->size; - if (this->header_count == 3) - this->op.b_o_s = 1; + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { + this->op.packet = this->buf; + this->op.bytes = this->size; - - if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){ - /* error case; not a vorbis header */ - xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); - xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); - return; - } - - this->header_count--; - - if (!this->header_count) { - - int mode = AO_CAP_MODE_MONO; - - get_metadata (this); - - mode = _x_ao_channels2mode(this->vi.channels); - - this->convsize=MAX_NUM_SAMPLES/this->vi.channels; - - if (!this->output_open) { - this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, - this->stream, - 16, - this->vi.rate, - mode) ; - - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, - this->vi.bitrate_nominal); - - } - - /* OK, got and parsed all three headers. Initialize the Vorbis - * packet->PCM decoder. */ - lprintf("all three headers parsed. initializing decoder.\n"); - /* initialize central decode state */ - vorbis_synthesis_init(&this->vd,&this->vi); - /* initialize local state for most of the decode so multiple - * block decodes can proceed in parallel. We could init - * multiple vorbis_block structures for vd here */ - vorbis_block_init(&this->vd,&this->vb); + /* reset accumultaion buffer */ + this->size = 0; + + if ( (buf->decoder_flags & BUF_FLAG_HEADER) && + !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) { + + lprintf ("%d headers to go\n", this->header_count); + + if (this->header_count) { + int res = 0; + + if (this->header_count == 3) + this->op.b_o_s = 1; + + if ( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ) { + /* error case; not a vorbis header */ + xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res); + xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64); + return; + } + + this->header_count--; + + if (!this->header_count) { + + int mode = AO_CAP_MODE_MONO; + + get_metadata (this); + + mode = _x_ao_channels2mode(this->vi.channels); + + this->convsize=MAX_NUM_SAMPLES/this->vi.channels; + + if (!this->output_open) { + this->output_open = (this->stream->audio_out->open) (this->stream->audio_out, + this->stream, + 16, + this->vi.rate, + mode) ; + + _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, + this->vi.bitrate_nominal); + + } + + /* OK, got and parsed all three headers. Initialize the Vorbis + * packet->PCM decoder. */ + lprintf("all three headers parsed. initializing decoder.\n"); + /* initialize central decode state */ + vorbis_synthesis_init(&this->vd,&this->vi); + /* initialize local state for most of the decode so multiple + * block decodes can proceed in parallel. We could init + * multiple vorbis_block structures for vd here */ + vorbis_block_init(&this->vd,&this->vb); + } } - } - - } else if (this->output_open) { - - float **pcm; - int samples; - - if(vorbis_synthesis(&this->vb,&this->op)==0) - vorbis_synthesis_blockin(&this->vd,&this->vb); - - if (buf->pts!=0) - this->pts=buf->pts; - - while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){ - - /* **pcm is a multichannel float vector. In stereo, for - * example, pcm[0][...] is left, and pcm[1][...] is right. - * samples is the size of each channel. Convert the float - * values (-1.<=range<=1.) to whatever PCM format and write - * it out - */ - - int i,j; - int bout=(samples<this->convsize?samples:this->convsize); - audio_buffer_t *audio_buffer; - - audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); - - /* convert floats to 16 bit signed ints (host order) and - interleave */ - for(i=0;i<this->vi.channels;i++){ - ogg_int16_t *ptr=audio_buffer->mem+i; - float *mono=pcm[i]; - for(j=0;j<bout;j++){ - int val=(mono[j] + 1.0f) * 32768.f; - val -= 32768; - /* might as well guard against clipping */ - if(val>32767){ - val=32767; - } else if(val<-32768){ - val=-32768; - } - *ptr=val; - ptr+=this->vi.channels; - } + + } else if (this->output_open) { + + float **pcm; + int samples; + + if(vorbis_synthesis(&this->vb,&this->op)==0) + vorbis_synthesis_blockin(&this->vd,&this->vb); + + if (buf->pts!=0) + this->pts=buf->pts; + + while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){ + + /* **pcm is a multichannel float vector. In stereo, for + * example, pcm[0][...] is left, and pcm[1][...] is right. + * samples is the size of each channel. Convert the float + * values (-1.<=range<=1.) to whatever PCM format and write + * it out + */ + + int i,j; + int bout=(samples<this->convsize?samples:this->convsize); + audio_buffer_t *audio_buffer; + + audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out); + + /* convert floats to 16 bit signed ints (host order) and + interleave */ + for(i=0;i<this->vi.channels;i++){ + ogg_int16_t *ptr=audio_buffer->mem+i; + float *mono=pcm[i]; + for(j=0;j<bout;j++){ + int val=(mono[j] + 1.0f) * 32768.f; + val -= 32768; + /* might as well guard against clipping */ + if(val>32767){ + val=32767; + } else if(val<-32768){ + val=-32768; + } + *ptr=val; + ptr+=this->vi.channels; + } + } + + audio_buffer->vpts = this->pts; + this->pts=0; + audio_buffer->num_frames = bout; + + this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); + + buf->pts=0; + + /* tell libvorbis how many samples we actually consumed */ + vorbis_synthesis_read(&this->vd,bout); } - - audio_buffer->vpts = this->pts; - this->pts=0; - audio_buffer->num_frames = bout; - - this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream); - - buf->pts=0; - - /* tell libvorbis how many samples we actually consumed */ - vorbis_synthesis_read(&this->vd,bout); + } else { + lprintf("output not open\n"); } - } else { - lprintf("output not open\n"); } } @@ -299,6 +327,10 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, this->header_count = 3; this->convsize = 0; + this->bufsize = INIT_BUFSIZE; + this->buf = xine_xmalloc(INIT_BUFSIZE); + this->size = 0; + vorbis_info_init(&this->vi); vorbis_comment_init(&this->vc); @@ -324,7 +356,7 @@ void *vorbis_init_plugin (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_VORBIS, 0 }; diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index ba3041d5d..276505521 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -8,8 +8,6 @@ AM_LDFLAGS = $(xineplug_ldflags) # --------- # All of xine demuxer plugins should be named like the scheme "xineplug_dmx_" -xineinclude_HEADERS = demux.h - noinst_HEADERS = asfheader.h qtpalette.h group_games.h group_audio.h id3.h ebml.h matroska.h iff.h flacutils.h if ENABLE_ASF diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c index 26a61d8fd..75ad11c75 100644 --- a/src/demuxers/asfheader.c +++ b/src/demuxers/asfheader.c @@ -17,7 +17,7 @@ #define LOG
*/
-#include "xineutils.h"
+#include <xine/xineutils.h>
#include "bswap.h"
#include "asfheader.h"
@@ -63,7 +63,6 @@ struct asf_header_internal_s { /* private part */
int number_count;
uint16_t numbers[ASF_MAX_NUM_STREAMS];
- iconv_t iconv_cd;
uint8_t *bitrate_pointers[ASF_MAX_NUM_STREAMS];
};
@@ -130,8 +129,7 @@ static uint8_t *asf_reader_get_bytes(asf_reader_t *reader, size_t size) { if ((reader->size - reader->pos) < size)
return NULL;
- buffer = malloc(size);
- if (!buffer)
+ if (! (buffer = malloc(size)) )
return NULL;
memcpy(buffer, reader->buffer + reader->pos, size);
reader->pos += size;
@@ -142,9 +140,9 @@ static uint8_t *asf_reader_get_bytes(asf_reader_t *reader, size_t size) { static char *asf_reader_get_string(asf_reader_t *reader, size_t size, iconv_t cd) {
char *inbuf, *outbuf;
size_t inbytesleft, outbytesleft;
- char scratch[2048];
+ char scratch[2048];
- if ((reader->size - reader->pos) < size)
+ if ((size == 0) ||((reader->size - reader->pos) < size))
return NULL;
inbuf = (char *)reader->buffer + reader->pos;
@@ -241,8 +239,7 @@ static int asf_header_parse_file_properties(asf_header_t *header, uint8_t *buffe return 0;
}
- asf_file = malloc(sizeof(asf_file_t));
- if (!asf_file) {
+ if (! (asf_file = malloc(sizeof(asf_file_t))) ) {
lprintf("cannot allocate asf_file_struct\n");
return 0;
}
@@ -296,8 +293,7 @@ static int asf_header_parse_stream_properties(asf_header_t *header, uint8_t *buf if (buffer_len < 54)
goto exit_error;
- asf_stream = malloc(sizeof(asf_stream_t));
- if (!asf_stream)
+ if (! (asf_stream = malloc(sizeof(asf_stream_t))) )
goto exit_error;
asf_reader_init(&reader, buffer, buffer_len);
@@ -363,8 +359,7 @@ static int asf_header_parse_stream_extended_properties(asf_header_t *header, uin if (buffer_len < 64)
return 0;
- asf_stream_extension = malloc(sizeof(asf_stream_extension_t));
- if (!asf_stream_extension)
+ if (! (asf_stream_extension = malloc(sizeof(asf_stream_extension_t))) )
return 0;
asf_reader_init(&reader, buffer, buffer_len);
@@ -577,14 +572,16 @@ static int asf_header_parse_content_description(asf_header_t *header_pub, uint8_ asf_reader_t reader;
asf_content_t *content;
uint16_t title_length, author_length, copyright_length, description_length, rating_length;
+ iconv_t iconv_cd;
if (buffer_len < 10)
return 0;
- content = malloc(sizeof(asf_content_t));
- if (!content)
+ if (! (content = calloc(1, sizeof(asf_content_t))) )
+ return 0;
+
+ if ( (iconv_cd = iconv_open("UTF-8", "UCS-2LE")) == (iconv_t)-1 )
return 0;
- memset(content, 0, sizeof(asf_content_t));
asf_reader_init(&reader, buffer, buffer_len);
asf_reader_get_16(&reader, &title_length);
@@ -593,13 +590,21 @@ static int asf_header_parse_content_description(asf_header_t *header_pub, uint8_ asf_reader_get_16(&reader, &description_length);
asf_reader_get_16(&reader, &rating_length);
- content->title = asf_reader_get_string(&reader, title_length, header->iconv_cd);
- content->author = asf_reader_get_string(&reader, author_length, header->iconv_cd);
- content->copyright = asf_reader_get_string(&reader, copyright_length, header->iconv_cd);
- content->description = asf_reader_get_string(&reader, description_length, header->iconv_cd);
- content->rating = asf_reader_get_string(&reader, rating_length, header->iconv_cd);
+ content->title = asf_reader_get_string(&reader, title_length, iconv_cd);
+ content->author = asf_reader_get_string(&reader, author_length, iconv_cd);
+ content->copyright = asf_reader_get_string(&reader, copyright_length, iconv_cd);
+ content->description = asf_reader_get_string(&reader, description_length, iconv_cd);
+ content->rating = asf_reader_get_string(&reader, rating_length, iconv_cd);
+
+ lprintf("title: %d chars: \"%s\"\n", title_length, content->title);
+ lprintf("author: %d chars: \"%s\"\n", author_length, content->author);
+ lprintf("copyright: %d chars: \"%s\"\n", copyright_length, content->copyright);
+ lprintf("description: %d chars: \"%s\"\n", description_length, content->description);
+ lprintf("rating: %d chars: \"%s\"\n", rating_length, content->rating);
header->pub.content = content;
+
+ iconv_close(iconv_cd);
return 1;
}
@@ -611,24 +616,14 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) { uint32_t object_count;
uint16_t junk;
- asf_header = malloc(sizeof(asf_header_internal_t));
- if (!asf_header)
- return NULL;
- memset(asf_header, 0, sizeof(asf_header_internal_t));
-
lprintf("parsing_asf_header\n");
if (buffer_len < 6) {
printf("invalid buffer size\n");
- free(asf_header);
return NULL;
}
- asf_header->iconv_cd = iconv_open ("UTF-8", "UCS-2LE");
- if (asf_header->iconv_cd == (iconv_t)-1) {
- printf("iconv open error\n");
- free(asf_header);
+ if (! (asf_header = calloc(1, sizeof(asf_header_internal_t))) )
return NULL;
- }
asf_reader_init(&reader, buffer, buffer_len);
asf_reader_get_32(&reader, &object_count);
@@ -697,10 +692,8 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) { }
if (!asf_header->pub.content) {
lprintf("no content object present\n");
- asf_header->pub.content = malloc(sizeof(asf_content_t));
- if (!asf_header->pub.content)
+ if (! (asf_header->pub.content = calloc(1, sizeof(asf_content_t))) )
goto exit_error;
- memset(asf_header->pub.content, 0, sizeof(asf_content_t));
}
return &asf_header->pub;
@@ -766,9 +759,6 @@ void asf_header_delete (asf_header_t *header_pub) { asf_header_delete_stream_extended_properties(header->pub.stream_extensions[i]);
}
- if (header->iconv_cd != (iconv_t)-1)
- iconv_close (header->iconv_cd);
-
free(header);
}
diff --git a/src/demuxers/demux.h b/src/demuxers/demux.h deleted file mode 100644 index ee5ca42f0..000000000 --- a/src/demuxers/demux.h +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2000-2003 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_DEMUX_H -#define HAVE_DEMUX_H - -#ifdef XINE_COMPILE -# include "input/input_plugin.h" -# include "buffer.h" -# include "xine_internal.h" -#else -# include <xine/input_plugin.h> -# include <xine/buffer.h> -# include <xine/xine_internal.h> -#endif - -#define DEMUXER_PLUGIN_IFACE_VERSION 27 - -#define DEMUX_OK 0 -#define DEMUX_FINISHED 1 - -#define DEMUX_CANNOT_HANDLE 0 -#define DEMUX_CAN_HANDLE 1 - -#define METHOD_BY_CONTENT 1 -#define METHOD_BY_MRL 2 -#define METHOD_EXPLICIT 3 - -typedef struct demux_class_s demux_class_t ; -typedef struct demux_plugin_s demux_plugin_t; - -struct demux_class_s { - - /* - * open a new instance of this plugin class - */ - demux_plugin_t* (*open_plugin) (demux_class_t *this, xine_stream_t *stream, input_plugin_t *input); - - /** - * @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; - - /** - * @brief MIME types supported for this plugin - */ - - const char* mimetypes; - - /** - * @brief space separated list of file extensions this demuxer is - * likely to handle - * - * (will be used to filter media files in file selection dialogs) - */ - const char* extensions; - - /* - * close down, free all resources - */ - void (*dispose) (demux_class_t *this); -}; - -#define default_demux_class_dispose (void (*) (demux_class_t *this))free - -/* - * any demux plugin must implement these functions - */ - -struct demux_plugin_s { - - /* - * send headers, followed by BUF_CONTROL_HEADERS_DONE down the - * fifos, then return. do not start demux thread (yet) - */ - - void (*send_headers) (demux_plugin_t *this); - - /* - * ask demux to seek - * - * for seekable streams, a start position can be specified - * - * start_pos : position in input source (0..65535) - * this is defined as most convenient to demuxer, can be - * either time or offset based. - * start_time : position measured in miliseconds from stream start - * playing : true if this is a new seek within an already playing stream - * false if playback of this stream has not started yet - * - * if both parameters are !=0 start_pos will be used - * for non-seekable streams both values will be ignored - * - * returns the demux status (like get_status, but immediately after - * starting the demuxer) - */ - - int (*seek) (demux_plugin_t *this, - off_t start_pos, int start_time, int playing ); - - /* - * send a chunk of data down to decoder fifos - * - * the meaning of "chunk" is specific to every demux, usually - * it involves parsing one unit of data from stream. - * - * this function will be called from demux loop and should return - * the demux current status - */ - - int (*send_chunk) (demux_plugin_t *this); - - /* - * free resources - */ - - void (*dispose) (demux_plugin_t *this) ; - - /* - * returns DEMUX_OK or DEMUX_FINISHED - */ - - int (*get_status) (demux_plugin_t *this) ; - - /* - * gets stream length in miliseconds (might be estimated) - * may return 0 for non-seekable streams - */ - - int (*get_stream_length) (demux_plugin_t *this); - - /* - * return capabilities of demuxed stream - */ - - uint32_t (*get_capabilities) (demux_plugin_t *this); - - /* - * request optional data from input plugin. - */ - int (*get_optional_data) (demux_plugin_t *this, void *data, int data_type); - - /* - * "backwards" link to plugin class - */ - - demux_class_t *demux_class; - - void *node; /* used by plugin loader */ - -} ; - -#define default_demux_plugin_dispose (void (*) (demux_plugin_t *this))free - -/* - * possible capabilites a demux plugin can have: - */ -#define DEMUX_CAP_NOCAP 0x00000000 - -/* - * DEMUX_CAP_AUDIOLANG: - * DEMUX_CAP_SPULANG: - * demux plugin knows something about audio/spu languages, - * e.g. knows that audio stream #0 is english, - * audio stream #1 is german, ... Same bits as INPUT - * capabilities . - */ - -#define DEMUX_CAP_AUDIOLANG 0x00000008 -#define DEMUX_CAP_SPULANG 0x00000010 - -/* - * DEMUX_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. - * Same bits as INPUT capabilities. - */ - -#define DEMUX_CAP_CHAPTERS 0x00000080 - - -#define DEMUX_OPTIONAL_UNSUPPORTED 0 -#define DEMUX_OPTIONAL_SUCCESS 1 - -#define DEMUX_OPTIONAL_DATA_AUDIOLANG 2 -#define DEMUX_OPTIONAL_DATA_SPULANG 3 - -#endif diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c index 5ad5d5938..6256cb042 100644 --- a/src/demuxers/demux_4xm.c +++ b/src/demuxers/demux_4xm.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c index 3edd0bca4..0b02f1d99 100644 --- a/src/demuxers/demux_aac.c +++ b/src/demuxers/demux_aac.c @@ -39,10 +39,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c index e48416803..2ccd5217e 100644 --- a/src/demuxers/demux_ac3.c +++ b/src/demuxers/demux_ac3.c @@ -44,10 +44,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c index f873f5d4f..51bc624e3 100644 --- a/src/demuxers/demux_aiff.c +++ b/src/demuxers/demux_aiff.c @@ -33,10 +33,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" @@ -87,7 +87,6 @@ static int open_aiff_file(demux_aiff_t *this) { unsigned char preamble[PREAMBLE_SIZE]; unsigned int chunk_type; unsigned int chunk_size; - unsigned char buffer[100]; if (_x_demux_read_header(this->input, signature, AIFF_SIGNATURE_SIZE) != AIFF_SIGNATURE_SIZE) return 0; @@ -118,13 +117,15 @@ static int open_aiff_file(demux_aiff_t *this) { chunk_type = _X_BE_32(&preamble[0]); chunk_size = _X_BE_32(&preamble[4]); - if (chunk_size > sizeof(buffer) / sizeof(buffer[0])) { - /* the chunk is too large to fit in the buffer -> this cannot be an aiff chunk */ - this->status = DEMUX_FINISHED; - return 0; - } - if (chunk_type == COMM_TAG) { + unsigned char buffer[100]; + + if (chunk_size > sizeof(buffer) / sizeof(buffer[0])) { + /* the chunk is too large to fit in the buffer -> this cannot be an aiff chunk */ + this->status = DEMUX_FINISHED; + return 0; + } + if (this->input->read(this->input, buffer, chunk_size) != chunk_size) { this->status = DEMUX_FINISHED; diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c index 889299beb..827557333 100644 --- a/src/demuxers/demux_asf.c +++ b/src/demuxers/demux_asf.c @@ -45,12 +45,12 @@ /* #define LOG */ -#include "xine_internal.h" -#include "demux.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/demux.h> +#include <xine/xineutils.h> #include "bswap.h" #include "asfheader.h" -#include "xmlparser.h" +#include <xine/xmlparser.h> #define CODEC_TYPE_AUDIO 0 #define CODEC_TYPE_VIDEO 1 @@ -379,10 +379,21 @@ static int asf_read_header (demux_asf_t *this) { uint8_t *asf_header_buffer = NULL; asf_header_len = get_le64(this); - asf_header_buffer = alloca(asf_header_len); + if (asf_header_len > 4 * 1024 * 1024) + { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "demux_asf: asf_read_header: overly-large header? (%"PRIu64" bytes)\n", + asf_header_len); + return 0; + } + + asf_header_buffer = malloc (asf_header_len); if (this->input->read (this->input, asf_header_buffer, asf_header_len) != asf_header_len) + { + free (asf_header_buffer); return 0; + } /* delete previous header */ if (this->asf_header) { @@ -395,7 +406,11 @@ static int asf_read_header (demux_asf_t *this) { */ this->asf_header = asf_header_new(asf_header_buffer, asf_header_len); if (!this->asf_header) + { + free (asf_header_buffer); return 0; + } + free (asf_header_buffer); lprintf("asf header parsing ok\n"); @@ -514,7 +529,7 @@ static int asf_read_header (demux_asf_t *this) { lprintf ("palette_count: %d\n", demux_stream->palette_count); if (demux_stream->palette_count > 256) { - lprintf ("number of colors exceeded 256 (%d)", demux_stream->palette_count); + lprintf ("number of colours exceeded 256 (%d)", demux_stream->palette_count); demux_stream->palette_count = 256; } if ((asf_stream->private_data_length - sizeof(xine_bmiheader) - 11) >= (demux_stream->palette_count * 4)) { @@ -612,14 +627,14 @@ static int demux_asf_send_headers_common (demux_asf_t *this) { } static void asf_reorder(demux_asf_t *this, uint8_t *src, int len){ - uint8_t *dst = malloc(len); + uint8_t dst[len]; uint8_t *s2 = src; int i = 0, x, y; while(len-i >= this->reorder_h * this->reorder_w*this->reorder_b){ for(x = 0; x < this->reorder_w; x++) for(y = 0; y < this->reorder_h; y++){ - memcpy(dst + i, s2 + (y * this->reorder_w+x) * this->reorder_b, + memcpy(&dst[i], s2 + (y * this->reorder_w+x) * this->reorder_b, this->reorder_b); i += this->reorder_b; } @@ -627,7 +642,6 @@ static void asf_reorder(demux_asf_t *this, uint8_t *src, int len){ } xine_fast_memcpy(src,dst,i); - free(dst); } /* redefine abs as macro to handle 64-bit diffs. @@ -723,6 +737,9 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_demux_stream_t *str buf->size = bufsize; timestamp = 0; + if (stream->frag_offset == 0) + buf->decoder_flags |= BUF_FLAG_FRAME_START; + stream->frag_offset += bufsize; frag_len -= bufsize; @@ -733,10 +750,6 @@ static void asf_send_buffer_nodefrag (demux_asf_t *this, asf_demux_stream_t *str else check_newpts (this, buf->pts, PTS_AUDIO, package_done); - - if (frag_offset == 0) - buf->decoder_flags |= BUF_FLAG_FRAME_START; - /* test if whole packet read */ if (package_done) { buf->decoder_flags |= BUF_FLAG_FRAME_END; diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c index 2aa83d162..c58500ab2 100644 --- a/src/demuxers/demux_aud.c +++ b/src/demuxers/demux_aud.c @@ -45,10 +45,10 @@ #include <string.h> #include <stdlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c index d2e0c0412..239517777 100644 --- a/src/demuxers/demux_avi.c +++ b/src/demuxers/demux_avi.c @@ -70,9 +70,9 @@ #define DEBUG_ODML #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #include "bswap.h" /* @@ -949,7 +949,7 @@ static avi_t *AVI_init(demux_avi_t *this) { lprintf ("palette_count: %d\n", AVI->palette_count); if (AVI->palette_count > 256) { - lprintf ("number of colors exceeded 256 (%d)", AVI->palette_count); + lprintf ("number of colours exceeded 256 (%d)", AVI->palette_count); AVI->palette_count = 256; } if ((strf_size - sizeof(xine_bmiheader)) >= (AVI->palette_count * 4)) { @@ -1899,8 +1899,8 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) { * however, at least for this case (compressor: xvid biCompression: DIVX), the * xvid fourcc must prevail as it is used by ffmpeg to detect encoder bugs. [MF] */ - if( _x_fourcc_to_buf_video(this->avi->compressor) == BUF_VIDEO_XVID && - _x_fourcc_to_buf_video(this->avi->bih->biCompression) == BUF_VIDEO_MPEG4 ) { + if( this->avi->video_type == BUF_VIDEO_MPEG4 && + _x_fourcc_to_buf_video(this->avi->compressor) == BUF_VIDEO_XVID ) { this->avi->bih->biCompression = this->avi->compressor; this->avi->video_type = BUF_VIDEO_XVID; } diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c index d2a2b4db4..03dcc2605 100644 --- a/src/demuxers/demux_cdda.c +++ b/src/demuxers/demux_cdda.c @@ -41,10 +41,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c index be552653f..9d3313a72 100644 --- a/src/demuxers/demux_dts.c +++ b/src/demuxers/demux_dts.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c index b0d10dc1c..04cc714d7 100644 --- a/src/demuxers/demux_eawve.c +++ b/src/demuxers/demux_eawve.c @@ -39,10 +39,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" -#include "demux.h" +#include <xine/demux.h> #include "group_games.h" #define FOURCC_TAG BE_FOURCC diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c index a40d3053e..e653818c4 100644 --- a/src/demuxers/demux_elem.c +++ b/src/demuxers/demux_elem.c @@ -38,10 +38,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #define NUM_PREVIEW_BUFFERS 50 #define SCRATCH_SIZE 256 diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index d09f8f4f1..cc9e90d66 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -47,10 +47,10 @@ * demuxer is dispatching to the engine */ #define DEBUG_FILM_DEMUX 0 -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 0380de846..40cd5d265 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_audio.h" @@ -520,7 +520,9 @@ void *demux_flac_init_plugin (xine_t *xine, void *data) { this->demux_class.open_plugin = open_plugin; this->demux_class.description = N_("Free Lossless Audio Codec (flac) demux plugin"); this->demux_class.identifier = "FLAC"; - this->demux_class.mimetypes = NULL; + this->demux_class.mimetypes = + "audio/x-flac: flac: FLAC Audio;" + "audio/flac: flac: FLAC Audio;"; this->demux_class.extensions = "flac"; this->demux_class.dispose = default_demux_class_dispose; diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c index 2da3019b2..0dad5883a 100644 --- a/src/demuxers/demux_fli.c +++ b/src/demuxers/demux_fli.c @@ -35,10 +35,10 @@ #include <string.h> #include <stdlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #define FLI_HEADER_SIZE 128 diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index f0b29532b..38855c027 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -42,10 +42,10 @@ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" @@ -306,9 +306,12 @@ static int parse_flv_var(demux_flv_t *this, num = _X_BE_32(tmp); tmp += 4; if (key && keylen == 5 && !strncmp(key, "times", 5)) { - free (this->index); - this->index = xine_xcalloc(num, sizeof(flv_index_entry_t)); - this->num_indices = num; + if (!this->index || this->num_indices != num) { + if (this->index) + free(this->index); + this->index = xine_xcalloc(num, sizeof(flv_index_entry_t)); + this->num_indices = num; + } for (num = 0; num < this->num_indices && tmp < end; num++) { if (*tmp++ == FLV_DATA_TYPE_NUMBER) { lprintf(" got number (%f)\n", BE_F64(tmp)); @@ -319,16 +322,20 @@ static int parse_flv_var(demux_flv_t *this, break; } if (key && keylen == 13 && !strncmp(key, "filepositions", 13)) { - if (this->index && this->num_indices == num) { - for (num = 0; num < this->num_indices && tmp < end; num++) { - if (*tmp++ == FLV_DATA_TYPE_NUMBER) { - lprintf(" got number (%f)\n", BE_F64(tmp)); - this->index[num].offset = BE_F64(tmp); - tmp += 8; - } + if (!this->index || this->num_indices != num) { + if (this->index) + free(this->index); + this->index = xine_xcalloc(num, sizeof(flv_index_entry_t)); + this->num_indices = num; + } + for (num = 0; num < this->num_indices && tmp < end; num++) { + if (*tmp++ == FLV_DATA_TYPE_NUMBER) { + lprintf(" got number (%f)\n", BE_F64(tmp)); + this->index[num].offset = BE_F64(tmp); + tmp += 8; } - break; } + break; } while (num-- && tmp < end) { len = parse_flv_var(this, tmp, end-tmp, NULL, 0); @@ -501,9 +508,9 @@ static int read_flv_packet(demux_flv_t *this, int preview) { case FLV_TAG_TYPE_SCRIPT: lprintf(" got script tag...\n"); - parse_flv_script(this, remaining_bytes); - if (preview) { + parse_flv_script(this, remaining_bytes); + /* send init info to decoders using script information as reference */ if (!this->got_audio_header && this->audiocodec) { buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); @@ -569,7 +576,9 @@ static int read_flv_packet(demux_flv_t *this, int preview) { } return this->status; - } + } + /* no preview */ + this->input->seek(this->input, remaining_bytes, SEEK_CUR); continue; default: @@ -661,7 +670,7 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) { } } - if (seek_pos && this->videocodec) { + if (seek_pos && this->videocodec && abs(seek_pts-this->cur_pts) > 300000) { off_t pos, size; pos = this->input->get_current_pos(this->input); @@ -878,7 +887,9 @@ static void *init_plugin (xine_t *xine, void *data) { this->demux_class.open_plugin = open_plugin; this->demux_class.description = N_("Flash Video file demux plugin"); this->demux_class.identifier = "FLV"; - this->demux_class.mimetypes = "video/x-flv: flv: Flash video;"; + this->demux_class.mimetypes = "video/x-flv: flv: Flash video;" + "video/flv: flv: Flash video;" + "application/x-flash-video: flv: Flash video;"; this->demux_class.extensions = "flv"; this->demux_class.dispose = default_demux_class_dispose; diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 39b38c81d..695470415 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -83,10 +83,10 @@ * demuxer is dispatching to the engine */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index 9e91684d5..665d29cd2 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -47,10 +47,10 @@ #include <string.h> #include <stdlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "iff.h" diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c index 4731acfe4..cb6f8c8fe 100644 --- a/src/demuxers/demux_image.c +++ b/src/demuxers/demux_image.c @@ -38,10 +38,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" -#include "demux.h" +#include <xine/demux.h> #define IMAGE_HEADER_LEN 4 diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c index cc71da6d4..4d08af6fa 100644 --- a/src/demuxers/demux_ipmovie.c +++ b/src/demuxers/demux_ipmovie.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 7deceb500..c4f678427 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -42,10 +42,10 @@ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "ebml.h" @@ -779,7 +779,7 @@ static int vobsub_parse_custom_colors(matroska_track_t *t, const char *start) { use_custom_colors = 1; else if (!strncasecmp(start, "OFF", 3) || (*start == '0')) use_custom_colors = 0; - lprintf("VobSub custom colors: %s\n", use_custom_colors ? "ON" : "OFF"); + lprintf("VobSub custom colours: %s\n", use_custom_colors ? "ON" : "OFF"); if ((start = strstr(start, "colors:")) != NULL) { start += 7; while (isspace(*start)) @@ -793,7 +793,7 @@ static int vobsub_parse_custom_colors(matroska_track_t *t, const char *start) { } if (i == 4) { t->sub_track->custom_colors = 4; - lprintf("VobSub colors: %06x,%06x,%06x,%06x\n", t->sub_track->colors[0], + lprintf("VobSub colours: %06x,%06x,%06x,%06x\n", t->sub_track->colors[0], t->sub_track->colors[1], t->sub_track->colors[2], t->sub_track->colors[3]); } @@ -853,7 +853,7 @@ static void init_codec_vobsub(demux_matroska_t *this, things_found |= vobsub_parse_size(track, start); else if (!strncasecmp(start, "palette:", 8)) things_found |= vobsub_parse_palette(track, start); - else if (!strncasecmp(start, "custom colors:", 14)) + else if (!strncasecmp(start, "custom colours:", 14)) things_found |= vobsub_parse_custom_colors(track, start); else if (!strncasecmp(start, "forced subs:", 12)) things_found |= vobsub_parse_forced_subs(track, start); @@ -1749,10 +1749,7 @@ static int parse_tags(demux_matroska_t *this) { static void alloc_block_data (demux_matroska_t *this, int len) { /* memory management */ if (this->block_data_size < len) { - if (this->block_data) - this->block_data = realloc(this->block_data, len); - else - this->block_data = malloc(len); + this->block_data = realloc(this->block_data, len); this->block_data_size = len; } } diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c index f7af7ec42..18c4b1b57 100644 --- a/src/demuxers/demux_mng.c +++ b/src/demuxers/demux_mng.c @@ -46,9 +46,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> typedef struct { demux_plugin_t demux_plugin; diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 54dacdc8e..17e744b94 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -42,10 +42,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "modplug.h" #include "bswap.h" diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c index 60750b550..6a4cfb285 100644 --- a/src/demuxers/demux_mpc.c +++ b/src/demuxers/demux_mpc.c @@ -41,10 +41,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c index 0a97b27bc..8c339fd88 100644 --- a/src/demuxers/demux_mpeg.c +++ b/src/demuxers/demux_mpeg.c @@ -39,9 +39,9 @@ #define LOG */ -#include "xine_internal.h" -#include "demux.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/demux.h> +#include <xine/xineutils.h> #define NUM_PREVIEW_BUFFERS 150 #define SCRATCH_SIZE 256 diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c index 2f7c48d44..b46008b94 100644 --- a/src/demuxers/demux_mpeg_block.c +++ b/src/demuxers/demux_mpeg_block.c @@ -37,9 +37,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 @@ -1452,39 +1452,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str } break; - case METHOD_BY_MRL: { - char *ending; - - const char *const mrl = input->get_mrl (input); - - if(!strncmp(mrl, "vcd:", 4)) { - this->blocksize = 2324; - demux_mpeg_block_accept_input (this, input); - } else if(!strncmp(mrl, "dvd:", 4) || !strncmp(mrl, "pvr:", 4)) { - this->blocksize = 2048; - demux_mpeg_block_accept_input (this, input); - } else { - ending = strrchr(mrl, '.'); - - if (!ending) { - free (this->scratch_base); - free (this); - return NULL; - } - if ( (!strncasecmp (ending, ".vob", 4)) || - (!strncmp((ending + 3), "mpeg2", 5)) || - (!strncmp((ending + 3), "mpeg1", 5)) ) { - this->blocksize = 2048; - demux_mpeg_block_accept_input(this, input); - } else { - free (this->scratch_base); - free (this); - return NULL; - } - } - } - break; - + case METHOD_BY_MRL: case METHOD_EXPLICIT: { this->blocksize = input->get_blocksize(input); @@ -1525,7 +1493,7 @@ static void *init_plugin (xine_t *xine, void *data) { this->demux_class.description = N_("DVD/VOB demux plugin"); this->demux_class.identifier = "MPEG_BLOCK"; this->demux_class.mimetypes = NULL; - this->demux_class.extensions = "vob"; + this->demux_class.extensions = "vob vcd:/ dvd:/ pvr:/"; this->demux_class.dispose = default_demux_class_dispose; return this; diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 1ec5b8365..f5d554020 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -41,9 +41,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #define NUM_PREVIEW_BUFFERS 250 #define DISC_TRESHOLD 90000 @@ -1754,7 +1754,7 @@ static void *init_plugin (xine_t *xine, void *data) { this->demux_class.description = N_("mpeg pes demux plugin"); this->demux_class.identifier = "MPEG_PES"; this->demux_class.mimetypes = NULL; - this->demux_class.extensions = "pes"; + this->demux_class.extensions = "pes vdr:/ netvdr:/"; this->demux_class.dispose = default_demux_class_dispose; return this; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index 1648be926..79da40e36 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -33,15 +33,15 @@ #include <string.h> #include <stdlib.h> -#define LOG_MODULE "demux_mpeg_audio" +#define LOG_MODULE "demux_mpgaudio" #define LOG_VERBOSE /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "compat.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/compat.h> #include "bswap.h" #include "group_audio.h" #include "id3.h" @@ -51,8 +51,8 @@ * the second mp3 frame is sent to the decoder */ #define NUM_PREVIEW_BUFFERS 2 +#define NUM_VALID_FRAMES 3 -#define WRAP_THRESHOLD 120000 #define FOURCC_TAG BE_FOURCC #define RIFF_CHECK_BYTES 1024 @@ -64,6 +64,7 @@ /* Xing header stuff */ #define XING_TAG FOURCC_TAG('X', 'i', 'n', 'g') +#define INFO_TAG FOURCC_TAG('I', 'n', 'f', 'o') #define XING_FRAMES_FLAG 0x0001 #define XING_BYTES_FLAG 0x0002 #define XING_TOC_FLAG 0x0004 @@ -76,16 +77,16 @@ /* mp3 frame struct */ typedef struct { /* header */ - double duration; - uint32_t size; /* in bytes */ + double duration; /* in milliseconds */ + uint32_t size; /* in bytes; including padding */ uint32_t bitrate; /* in bit per second */ uint16_t freq; /* in Hz */ - uint8_t layer; - uint8_t version_idx:2; /* 0: mpeg1, 1: mpeg2, 2: mpeg2.5 */ uint8_t lsf_bit:1; uint8_t channel_mode:3; + uint8_t padding:3; /* in bytes */ + uint8_t is_free_bitrate:1; } mpg_audio_frame_t; /* Xing Vbr Header struct */ @@ -124,7 +125,13 @@ typedef struct { int br; /* bitrate in bits/second */ uint32_t blocksize; + /* current mp3 frame */ mpg_audio_frame_t cur_frame; + + /* next mp3 frame, used when the frame size cannot be computed from the + * current frame header */ + mpg_audio_frame_t next_frame; + double cur_time; /* in milliseconds */ off_t mpg_frame_start; /* offset */ @@ -134,7 +141,15 @@ typedef struct { int check_vbr_header; xing_header_t *xing_header; vbri_header_t *vbri_header; - + + int found_next_frame:1; + int free_bitrate_count; + off_t free_bitrate_size; /* use this size if 3 free bitrate frames are encountered */ + uint8_t next_header[4]; + int mpg_version; + int mpg_layer; + int valid_frames; + } demux_mpgaudio_t ; /* demuxer class struct */ @@ -205,14 +220,14 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con const uint32_t head = _X_BE_32(buf); const uint16_t frame_sync = head >> 21; - lprintf("header: %08X\n", head); if (frame_sync != 0x7ff) { - lprintf("invalid frame sync\n"); + lprintf("invalid frame sync %08X\n", head); return 0; } + lprintf("header: %08X\n", head); frame_header.mpeg25_bit = (head >> 20) & 0x1; - frame->lsf_bit = (head >> 19) & 0x1; + frame->lsf_bit = (head >> 19) & 0x1; if (!frame_header.mpeg25_bit) { if (frame->lsf_bit) { lprintf("reserved mpeg25 lsf combination\n"); @@ -233,14 +248,14 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con } frame_header.bitrate_idx = (head >> 12) & 0xf; - if ((frame_header.bitrate_idx == 0) || (frame_header.bitrate_idx == 15)) { - lprintf("invalid bitrate index\n"); + if (frame_header.bitrate_idx == 15) { + lprintf("invalid bitrate index: %d\n", frame_header.bitrate_idx); return 0; } frame_header.freq_idx = (head >> 10) & 0x3; if (frame_header.freq_idx == 3) { - lprintf("invalid frequence index\n"); + lprintf("invalid frequence index: %d\n", frame_header.freq_idx); return 0; } @@ -273,19 +288,27 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con const uint16_t samples = mp3_samples[frame->version_idx][frame->layer - 1]; frame->bitrate = mp3_bitrates[frame->version_idx][frame->layer - 1][frame_header.bitrate_idx] * 1000; frame->freq = mp3_freqs[frame->version_idx][frame_header.freq_idx]; - - frame->size = samples * (frame->bitrate / 8); - frame->size /= frame->freq; - /* Padding: only if padding_bit is set; 4 bytes for Layer 1 and 1 byte for others */ - frame->size += ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 ); - frame->duration = 1000.0f * (double)samples / (double)frame->freq; + frame->padding = ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 ); + frame->channel_mode = frame_header.channel_mode; + + if (frame->bitrate > 0) { + frame->size = samples * (frame->bitrate / 8); + frame->size /= frame->freq; + /* Padding: only if padding_bit is set; 4 bytes for Layer 1 and 1 byte for others */ + frame->size += frame->padding; + } else { + /* Free bitrate frame, the size of the frame cannot be computed from the header. */ + frame->is_free_bitrate = 1; + frame->size = 0; + } } - lprintf("mpeg %d, layer %d\n", frame->version_idx + 1, frame->layer); - lprintf("bitrate: %d bps, samplerate: %d Hz\n", frame->bitrate, frame->freq); + lprintf("mpeg %d, layer %d, channel_mode: %d\n", frame->version_idx + 1, + frame->layer, frame->channel_mode); + lprintf("bitrate: %d bps, output freq: %d Hz\n", frame->bitrate, frame->freq); lprintf("length: %d bytes, %f ms\n", frame->size, frame->duration); - lprintf("padding: %d bytes\n", ( frame_header.padding_bit ? ( frame->layer == 1 ? 4 : 1 ) : 0 )); + lprintf("padding: %d bytes\n", frame->padding); return 1; } @@ -295,16 +318,8 @@ static int parse_frame_header(mpg_audio_frame_t *const frame, const uint8_t *con */ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, uint8_t *buf, int bufsize) { - -#ifdef LOG - int i; -#endif uint8_t *ptr = buf; - xing_header_t *xing; - - xing = xine_xmalloc (sizeof (xing_header_t)); - if (!xing) - return NULL; + xing_header_t *xing = NULL; /* offset of the Xing header */ if (frame->lsf_bit) { @@ -319,52 +334,87 @@ static xing_header_t* parse_xing_header(mpg_audio_frame_t *frame, ptr += (9 + 4); } - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; lprintf("checking %08X\n", *ptr); + if (_X_BE_32(ptr) == XING_TAG) { - lprintf("Xing header found\n"); + int has_frames_flag = 0; + int has_bytes_flag = 0; + + xing = xine_xmalloc (sizeof (xing_header_t)); + if (!xing) + goto exit_error; + + lprintf("found Xing header\n"); ptr += 4; - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->flags = _X_BE_32(ptr); ptr += 4; if (xing->flags & XING_FRAMES_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->stream_frames = _X_BE_32(ptr); ptr += 4; lprintf("stream frames: %d\n", xing->stream_frames); + has_frames_flag = 1; } if (xing->flags & XING_BYTES_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->stream_size = _X_BE_32(ptr); ptr += 4; lprintf("stream size: %d\n", xing->stream_size); + has_bytes_flag = 1; + } + + /* check if it's a useful Xing header */ + if (!has_frames_flag || !has_bytes_flag) { + lprintf("Stupid Xing tag, cannot do anything with it !\n"); + goto exit_error; } + if (xing->flags & XING_TOC_FLAG) { + int i; + lprintf("toc found\n"); - if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) return 0; + if (ptr >= (buf + bufsize - XING_TOC_LENGTH)) goto exit_error; memcpy(xing->toc, ptr, XING_TOC_LENGTH); #ifdef LOG for (i = 0; i < XING_TOC_LENGTH; i++) { - lprintf("%d ", xing->toc[i]); + printf("%d ", xing->toc[i]); } - lprintf("\n"); + printf("\n"); #endif + /* check the table validity + * - MUST start with 0 + * - values MUST increase + */ + if (xing->toc[0] != 0) { + lprintf("invalid Xing toc\n"); + goto exit_error; + } + for (i = 1; i < XING_TOC_LENGTH; i++) { + if (xing->toc[i] < xing->toc[i-1]) { + lprintf("invalid Xing toc\n"); + goto exit_error; + } + } ptr += XING_TOC_LENGTH; } xing->vbr_scale = -1; if (xing->flags & XING_VBR_SCALE_FLAG) { - if (ptr >= (buf + bufsize - 4)) return 0; + if (ptr >= (buf + bufsize - 4)) goto exit_error; xing->vbr_scale = _X_BE_32(ptr); lprintf("vbr_scale: %d\n", xing->vbr_scale); } - - return xing; } else { lprintf("Xing header not found\n"); + } + return xing; + +exit_error: + lprintf("Xing header parse error\n"); free(xing); return NULL; } -} /* * Parse a Vbri header @@ -386,7 +436,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, if ((ptr + 4) >= (buf + bufsize)) return 0; lprintf("Checking %08X\n", *ptr); if (_X_BE_32(ptr) == VBRI_TAG) { - lprintf("Vbri header found\n"); + lprintf("found Vbri header\n"); ptr += 4; if ((ptr + 22) >= (buf + bufsize)) return 0; @@ -450,6 +500,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, } } + /* * Parse a mp3 frame paylod * return 1 on success, 0 on error @@ -460,43 +511,97 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf_element_t *buf; off_t frame_pos, len; uint64_t pts = 0; + int payload_size = 0; frame_pos = this->input->get_current_pos(this->input) - 4; - lprintf("frame_pos = %"PRId64"\n", frame_pos); + lprintf("frame_pos = %"PRId64", header: %08X\n", frame_pos, _X_BE_32(frame_header)); buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); if (this->cur_frame.size > buf->max_size) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - "demux_mpgaudio: frame size is greater than fifo buffer size\n"); + LOG_MODULE ": frame size is greater than fifo buffer size\n"); buf->free_buffer(buf); return 0; } - - /* the decoder needs the frame header */ - memcpy(buf->mem, frame_header, 4); - len = this->input->read(this->input, buf->mem + 4, this->cur_frame.size - 4); - if (len != (this->cur_frame.size - 4)) { - buf->free_buffer(buf); - return 0; + memcpy(buf->content, frame_header, 4); + + /* compute the payload size */ + if (this->cur_frame.size > 0) { + payload_size = this->cur_frame.size - 4; + this->free_bitrate_count = 0; + } else if (this->free_bitrate_count >= NUM_VALID_FRAMES) { + payload_size = this->free_bitrate_size + this->cur_frame.padding - 4; + this->cur_frame.size = payload_size + 4; + } else { + this->free_bitrate_count++; + payload_size = 0; + } + + /* Read the payload data. */ + if (payload_size > 0) { + off_t len; + + /* If we know the payload size, it's easy */ + this->found_next_frame = 0; + len = this->input->read(this->input, buf->content + 4, payload_size); + if (len != payload_size) { + buf->free_buffer(buf); + return 0; + } + } else { + /* Search for the beginning of the next frame and deduce the size of the + * current frame from the position of the next one. */ + int payload_size = 0; + int max_size = buf->max_size - 4; + + while (payload_size < max_size) { + len = this->input->read(this->input, &buf->content[4 + payload_size], 1); + if (len != 1) { + lprintf("EOF\n"); + buf->free_buffer(buf); + return 0; + } + payload_size += len; + + if (parse_frame_header(&this->next_frame, &buf->content[payload_size])) { + lprintf("found next frame header\n"); + + if (this->free_bitrate_size == 0) { + this->free_bitrate_size = payload_size - this->cur_frame.padding; + } + + /* don't read the frame header twice */ + this->found_next_frame = 1; + memcpy(&this->next_header[0], &buf->content[payload_size], 4); + payload_size -= 4; + break; + } + } + this->cur_frame.size = payload_size + 4; + this->cur_frame.bitrate = 8000 * this->cur_frame.size / this->cur_frame.duration; + lprintf("free bitrate: bitrate: %d, frame size: %d\n", this->br, this->cur_frame.size); } if (this->check_vbr_header) { this->check_vbr_header = 0; this->mpg_frame_start = frame_pos; - this->xing_header = parse_xing_header(&this->cur_frame, buf->mem, this->cur_frame.size); + this->xing_header = parse_xing_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->xing_header) { buf->free_buffer(buf); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": found Xing header at offset %"PRId64"\n", frame_pos); return 1; } - this->vbri_header = parse_vbri_header(&this->cur_frame, buf->mem, this->cur_frame.size); + this->vbri_header = parse_vbri_header(&this->cur_frame, buf->content, this->cur_frame.size); if (this->vbri_header) { buf->free_buffer(buf); + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": found Vbri header at offset %"PRId64"\n", frame_pos); return 1; } } - pts = (int64_t)(this->cur_time * 90.0f); @@ -505,14 +610,13 @@ static int parse_frame_payload(demux_mpgaudio_t *this, buf->extra_info->input_time = this->cur_time; buf->pts = pts; - buf->size = len + 4; - buf->content = buf->mem; + buf->size = this->cur_frame.size; buf->type = BUF_AUDIO_MPEG; buf->decoder_info[0] = 1; buf->decoder_flags = decoder_flags|BUF_FLAG_FRAME_END; + lprintf("send buffer: size=%d, pts=%"PRId64"\n", buf->size, pts); this->audio_fifo->put(this->audio_fifo, buf); - lprintf("send buffer: pts=%"PRId64"\n", pts); this->cur_time += this->cur_frame.duration; return 1; } @@ -576,40 +680,51 @@ static int read_frame_header(demux_mpgaudio_t *this, uint8_t *header_buf, int by * Parse next mp3 frame */ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int send_header) { - uint8_t header_buf[4]; - int bytes = 4; - - for (;;) { - - if (read_frame_header(this, header_buf, bytes)) { - - if (parse_frame_header(&this->cur_frame, header_buf)) { - - /* send header buffer */ - if ( send_header ) { - buf_element_t *buf; - - buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); - - buf->type = BUF_AUDIO_MPEG; - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; - - buf->decoder_info[0] = 0; - buf->decoder_info[1] = this->cur_frame.freq; - buf->decoder_info[2] = 0; /* bits_per_sample */ - - /* Only for channel_mode == 3 (mono) there is one channel, for any other case, there are 2 */ - buf->decoder_info[3] = ( this->cur_frame.channel_mode == 3 ) ? 1 : 2; - - buf->size = 0; /* No extra header data */ - - this->audio_fifo->put(this->audio_fifo, buf); - } - - return parse_frame_payload(this, header_buf, decoder_flags); - - } else if ( id3v2_istag(_X_ME_32(header_buf)) ) { - if (!id3v2_parse_tag(this->input, this->stream, _X_ME_32(header_buf))) { + uint8_t buffer[4]; + uint8_t *header = buffer; + + if (this->found_next_frame) { + lprintf("skip header reading\n"); + header = this->next_header; + memcpy(&this->cur_frame, &this->next_frame, sizeof(mpg_audio_frame_t)); + } else { + int bytes = 4; + int loose_sync = 0; + + for (;;) { + if (!read_frame_header(this, header, bytes)) + return 0; + if (parse_frame_header(&this->cur_frame, header)) { + lprintf("frame found\n"); + + /* additionnal checks */ + if ((this->mpg_version == (this->cur_frame.version_idx + 1)) && + (this->mpg_layer == this->cur_frame.layer)) { + this->valid_frames++; + break; + } else { + if (this->valid_frames >= NUM_VALID_FRAMES) { + lprintf("invalid frame. expected mpeg %d, layer %d\n", this->mpg_version, this->mpg_layer); + } else { + this->mpg_version = this->cur_frame.version_idx + 1; + this->mpg_layer = this->cur_frame.layer; + this->valid_frames = 0; + break; + } + } + } + + if (!loose_sync) { + off_t frame_pos = this->input->get_current_pos(this->input) - 4; + loose_sync = 1; + xprintf(this->stream->xine, XINE_VERBOSITY_LOG, + LOG_MODULE ": loose mp3 sync at offset %"PRId64"\n", frame_pos); + } + /* the stream is broken, don't keep info about previous frames */ + this->free_bitrate_size = 0; + + if ( id3v2_istag(header) ) { + if (!id3v2_parse_tag(this->input, this->stream, header)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2 tag parsing error\n"); bytes = 1; /* resync */ @@ -620,12 +735,31 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s /* skip */ bytes = 1; } - - } else { - lprintf("read error\n"); - return 0; } } + + /* send header buffer */ + if ( send_header ) { + buf_element_t *buf; + + buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo); + + buf->type = BUF_AUDIO_MPEG; + buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END; + + buf->decoder_info[0] = 0; + buf->decoder_info[1] = this->cur_frame.freq; + buf->decoder_info[2] = 0; /* bits_per_sample */ + + /* Only for channel_mode == 3 (mono) there is one channel, for any other case, there are 2 */ + buf->decoder_info[3] = ( this->cur_frame.channel_mode == 3 ) ? 1 : 2; + + buf->size = 0; /* No extra header data */ + + this->audio_fifo->put(this->audio_fifo, buf); + } + + return parse_frame_payload(this, header, decoder_flags); } static int demux_mpgaudio_send_chunk (demux_plugin_t *this_gen) { @@ -748,11 +882,12 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { */ this->check_vbr_header = 1; for (i = 0; i < NUM_PREVIEW_BUFFERS; i++) { + lprintf("preview buffer number %d / %d\n", i + 1, NUM_PREVIEW_BUFFERS); if (!demux_mpgaudio_next (this, BUF_FLAG_PREVIEW, i == 0)) { break; } } - + if (this->xing_header) { xing_header_t *xing = this->xing_header; @@ -763,7 +898,7 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { if (this->stream_length) { this->br = ((uint64_t)xing->stream_size * 8 * 1000) / this->stream_length; } - + } else if (this->vbri_header) { vbri_header_t *vbri = this->vbri_header; @@ -805,8 +940,8 @@ static void demux_mpgaudio_send_headers (demux_plugin_t *this_gen) { */ { char scratch_buf[256]; - char *mpeg_ver[3] = {"1", "2", "2.5"}; - + static const char mpeg_ver[3][4] = {"1", "2", "2.5"}; + snprintf(scratch_buf, 256, "MPEG %s Layer %1d%s", mpeg_ver[this->cur_frame.version_idx], this->cur_frame.layer, (this->xing_header)? " VBR" : " CBR" ); @@ -919,7 +1054,7 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, if (this->stream_length > 0) { if (this->xing_header && - (this->xing_header->flags & (XING_TOC_FLAG | XING_BYTES_FLAG))) { + (this->xing_header->flags & XING_TOC_FLAG)) { seek_pos += xing_get_seek_point(this->xing_header, start_time, this->stream_length); lprintf("time seek: xing: time=%d, pos=%"PRId64"\n", start_time, seek_pos); } else if (this->vbri_header) { @@ -934,7 +1069,8 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen, /* assume seeking is always perfect... */ this->cur_time = start_time; this->input->seek (this->input, seek_pos, SEEK_SET); - + this->found_next_frame = 0; + if (playing) { _x_demux_flush_engine(this->stream); } diff --git a/src/demuxers/demux_nsv.c b/src/demuxers/demux_nsv.c index d5ffed5f8..74f98c7cd 100644 --- a/src/demuxers/demux_nsv.c +++ b/src/demuxers/demux_nsv.c @@ -40,12 +40,12 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" -#include "buffer.h" +#include <xine/buffer.h> #define FOURCC_TAG BE_FOURCC #define NSVf_TAG FOURCC_TAG('N', 'S', 'V', 'f') diff --git a/src/demuxers/demux_playlist.c b/src/demuxers/demux_playlist.c index c6df006fe..3dd689657 100644 --- a/src/demuxers/demux_playlist.c +++ b/src/demuxers/demux_playlist.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" -#include "demux.h" +#include <xine/demux.h> typedef enum { XINE_PLT_NONE = 0, diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c index 2f85387b2..9987da057 100644 --- a/src/demuxers/demux_pva.c +++ b/src/demuxers/demux_pva.c @@ -39,10 +39,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #define PVA_PREAMBLE_SIZE 8 diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index b46cbc593..6b2aa5eea 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -43,10 +43,10 @@ #include <ctype.h> #include <zlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "qtpalette.h" @@ -651,8 +651,7 @@ static void free_qt_info(qt_info *info) { for (j = 0; j < info->traks[i].stsd_atoms_count; j++) { if (info->traks[i].type == MEDIA_AUDIO) { free(info->traks[i].stsd_atoms[j].audio.properties_atom); - if (info->traks[i].stsd_atoms[j].audio.wave) - free(info->traks[i].stsd_atoms[j].audio.wave); + free(info->traks[i].stsd_atoms[j].audio.wave); } else if (info->traks[i].type == MEDIA_VIDEO) free(info->traks[i].stsd_atoms[j].video.properties_atom); } @@ -686,34 +685,28 @@ static int is_qt_file(input_plugin_t *qt_file) { off_t moov_atom_offset = -1; int64_t moov_atom_size = -1; int i; - unsigned char atom_preamble[ATOM_PREAMBLE_SIZE]; - unsigned char preview[MAX_PREVIEW_SIZE]; int len; /* if the input is non-seekable, be much more stringent about qualifying * a QT file: In this case, the moov must be the first atom in the file */ if ((qt_file->get_capabilities(qt_file) & INPUT_CAP_SEEKABLE) == 0) { - memset (&preview, 0, MAX_PREVIEW_SIZE); + unsigned char preview[MAX_PREVIEW_SIZE] = { 0, }; len = qt_file->get_optional_data(qt_file, preview, INPUT_OPTIONAL_DATA_PREVIEW); if (_X_BE_32(&preview[4]) == MOOV_ATOM) return 1; else { - if (_X_BE_32(&preview[4]) == FTYP_ATOM) { - /* show some lenience if the first atom is 'ftyp'; the second atom - * could be 'moov' */ - moov_atom_size = _X_BE_32(&preview[0]); - /* compute the size of the current atom plus the preamble of the - * next atom; if the size is within the range on the preview buffer - * then the next atom's preamble is in the preview buffer */ - i = moov_atom_size + ATOM_PREAMBLE_SIZE; - if (i >= MAX_PREVIEW_SIZE) - return 0; - if (_X_BE_32(&preview[i - 4]) == MOOV_ATOM) - return 1; - else - return 0; - } else - return 0; + if (_X_BE_32(&preview[4]) != FTYP_ATOM) + return 0; + + /* show some lenience if the first atom is 'ftyp'; the second atom + * could be 'moov' + * compute the size of the current atom plus the preamble of the + * next atom; if the size is within the range on the preview buffer + * then the next atom's preamble is in the preview buffer */ + uint64_t ftyp_atom_size = _X_BE_32(&preview[0]) + ATOM_PREAMBLE_SIZE; + if (ftyp_atom_size >= MAX_PREVIEW_SIZE) + return 0; + return _X_BE_32(&preview[ftyp_atom_size - 4]) == MOOV_ATOM; } } @@ -721,6 +714,7 @@ static int is_qt_file(input_plugin_t *qt_file) { if (moov_atom_offset == -1) { return 0; } else { + unsigned char atom_preamble[ATOM_PREAMBLE_SIZE]; /* check that the next atom in the chunk contains alphanumeric * characters in the atom type field; if not, disqualify the file * as a QT file */ @@ -807,31 +801,33 @@ static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) { const uint8_t *const sub_atom = &meta_atom[j]; const qt_atom sub_atom_code = _X_BE_32(&sub_atom[4]); const uint32_t sub_atom_size = _X_BE_32(&sub_atom[0]); + char *const data_atom = parse_data_atom(&sub_atom[8]); switch(sub_atom_code) { case ART_ATOM: - info->artist = parse_data_atom(&sub_atom[8]); + info->artist = data_atom; break; case NAM_ATOM: - info->name = parse_data_atom(&sub_atom[8]); + info->name = data_atom; break; case ALB_ATOM: - info->album = parse_data_atom(&sub_atom[8]); + info->album = data_atom; break; case GEN_ATOM: - info->genre = parse_data_atom(&sub_atom[8]); + info->genre = data_atom; break; case CMT_ATOM: - info->comment = parse_data_atom(&sub_atom[8]); + info->comment = data_atom; break; case WRT_ATOM: - info->composer = parse_data_atom(&sub_atom[8]); + info->composer = data_atom; break; case DAY_ATOM: - info->year = parse_data_atom(&sub_atom[8]); + info->year = data_atom; break; default: debug_meta_load("unknown atom %08x in ilst\n", sub_atom_code); + free(data_atom); } j += sub_atom_size; @@ -1008,18 +1004,17 @@ static qt_error parse_trak_atom (qt_trak *trak, const uint32_t current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]); - /* for palette traversal */ - int color_depth; - int color_flag; - int color_start; - int color_count; - int color_end; - int color_index; - int color_dec; - int color_greyscale; - const unsigned char *color_table; - if (trak->type == MEDIA_VIDEO) { + /* for palette traversal */ + int color_depth; + int color_flag; + int color_start; + int color_count; + int color_end; + int color_index; + int color_dec; + int color_greyscale; + const unsigned char *color_table; trak->stsd_atoms[k].video.media_id = k + 1; trak->stsd_atoms[k].video.properties_offset = properties_offset; @@ -1148,7 +1143,7 @@ static qt_error parse_trak_atom (qt_trak *trak, trak_atom[atom_pos + 0x1], trak_atom[atom_pos + 0x2], trak_atom[atom_pos + 0x3]); - debug_atom_load(" %d RGB colors\n", + debug_atom_load(" %d RGB colours\n", trak->stsd_atoms[k].video.palette_count); for (j = 0; j < trak->stsd_atoms[k].video.palette_count; j++) @@ -1464,8 +1459,7 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stco atom (32-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); - trak->chunk_offset_table = (int64_t *)malloc( - trak->chunk_offset_count * sizeof(int64_t)); + trak->chunk_offset_table = calloc(trak->chunk_offset_count, sizeof(int64_t)); if (!trak->chunk_offset_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1492,8 +1486,7 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt co64 atom (64-bit chunk offset atom): %d chunk offsets\n", trak->chunk_offset_count); - trak->chunk_offset_table = (int64_t *)malloc( - trak->chunk_offset_count * sizeof(int64_t)); + trak->chunk_offset_table = calloc(trak->chunk_offset_count, sizeof(int64_t)); if (!trak->chunk_offset_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1523,8 +1516,7 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stsc atom (sample-to-chunk atom): %d entries\n", trak->sample_to_chunk_count); - trak->sample_to_chunk_table = (sample_to_chunk_table_t *)malloc( - trak->sample_to_chunk_count * sizeof(sample_to_chunk_table_t)); + trak->sample_to_chunk_table = calloc(trak->sample_to_chunk_count, sizeof(sample_to_chunk_table_t)); if (!trak->sample_to_chunk_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1558,8 +1550,7 @@ static qt_error parse_trak_atom (qt_trak *trak, debug_atom_load(" qt stts atom (time-to-sample atom): %d entries\n", trak->time_to_sample_count); - trak->time_to_sample_table = (time_to_sample_table_t *)malloc( - (trak->time_to_sample_count+1) * sizeof(time_to_sample_table_t)); + trak->time_to_sample_table = calloc(trak->time_to_sample_count+1, sizeof(time_to_sample_table_t)); if (!trak->time_to_sample_table) { last_error = QT_NO_MEMORY; goto free_trak; @@ -1752,8 +1743,7 @@ static qt_error build_frame_table(qt_trak *trak, /* in this case, the total number of frames is equal to the number of * entries in the sample size table */ trak->frame_count = trak->sample_size_count; - trak->frames = (qt_frame *)malloc( - trak->frame_count * sizeof(qt_frame)); + trak->frames = calloc(trak->frame_count, sizeof(qt_frame)); if (!trak->frames) return QT_NO_MEMORY; trak->current_frame = 0; @@ -1765,10 +1755,9 @@ static qt_error build_frame_table(qt_trak *trak, pts_index_countdown = trak->time_to_sample_table[pts_index].count; - media_id_counts = xine_xmalloc(trak->stsd_atoms_count * sizeof(int)); + media_id_counts = xine_xcalloc(trak->stsd_atoms_count, sizeof(int)); if (!media_id_counts) return QT_NO_MEMORY; - memset(media_id_counts, 0, trak->stsd_atoms_count * sizeof(int)); /* iterate through each start chunk in the stsc table */ for (i = 0; i < trak->sample_to_chunk_count; i++) { @@ -1903,8 +1892,7 @@ static qt_error build_frame_table(qt_trak *trak, /* in this case, the total number of frames is equal to the number of * chunks */ trak->frame_count = trak->chunk_offset_count; - trak->frames = (qt_frame *)malloc( - trak->frame_count * sizeof(qt_frame)); + trak->frames = calloc(trak->frame_count, sizeof(qt_frame)); if (!trak->frames) return QT_NO_MEMORY; @@ -2146,7 +2134,6 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, unsigned char *moov_atom = NULL; off_t moov_atom_offset = -1; int64_t moov_atom_size = -1; - unsigned char preview[MAX_PREVIEW_SIZE]; /* zlib stuff */ z_stream z_state; @@ -2169,7 +2156,7 @@ static qt_error open_qt_file(qt_info *info, input_plugin_t *input, if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE)) find_moov_atom(input, &moov_atom_offset, &moov_atom_size); else { - memset (&preview, 0, MAX_PREVIEW_SIZE); + unsigned char preview[MAX_PREVIEW_SIZE] = { 0, }; input->get_optional_data(input, preview, INPUT_OPTIONAL_DATA_PREVIEW); if (_X_BE_32(&preview[4]) != MOOV_ATOM) { /* special case if there is an ftyp atom first */ diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c index 0ae52b6bf..10b3170e6 100644 --- a/src/demuxers/demux_rawdv.c +++ b/src/demuxers/demux_rawdv.c @@ -32,10 +32,10 @@ #include <unistd.h> #include <string.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #define NTSC_FRAME_SIZE 120000 #define NTSC_FRAME_RATE 29.97 diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 761296ac4..8f6ce0611 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -49,10 +49,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #define FOURCC_TAG BE_FOURCC @@ -232,7 +232,7 @@ static void real_parse_index(demux_real_t *this) { if(index && entries) { /* Allocate memory for index */ - *index = xine_xmalloc(entries * sizeof(real_index_entry_t)); + *index = xine_xcalloc(entries, sizeof(real_index_entry_t)); /* Read index */ for(i = 0; i < entries; i++) { @@ -275,19 +275,13 @@ static mdpr_t *real_parse_mdpr(const char *data) { mdpr->duration=_X_BE_32(&data[28]); mdpr->stream_name_size=data[32]; - mdpr->stream_name=malloc(sizeof(char)*(mdpr->stream_name_size+1)); - memcpy(mdpr->stream_name, &data[33], mdpr->stream_name_size); - mdpr->stream_name[(int)mdpr->stream_name_size]=0; + mdpr->stream_name=xine_memdup0(&data[33], mdpr->stream_name_size); mdpr->mime_type_size=data[33+mdpr->stream_name_size]; - mdpr->mime_type=malloc(sizeof(char)*(mdpr->mime_type_size+1)); - memcpy(mdpr->mime_type, &data[34+mdpr->stream_name_size], mdpr->mime_type_size); - mdpr->mime_type[(int)mdpr->mime_type_size]=0; + mdpr->mime_type=xine_memdup0(&data[34+mdpr->stream_name_size], mdpr->mime_type_size); mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]); - mdpr->type_specific_data=malloc(sizeof(char)*(mdpr->type_specific_len)); - memcpy(mdpr->type_specific_data, - &data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); + mdpr->type_specific_data=xine_memdup(&data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len); lprintf("MDPR: stream number: %i\n", mdpr->stream_number); lprintf("MDPR: maximal bit rate: %i\n", mdpr->max_bit_rate); @@ -804,8 +798,27 @@ static int demux_real_parse_references( demux_real_t *this) { lprintf("received %d bytes [%s]\n", buf_used, buf); - for(i=0;i<buf_used;i++) { - + if (!strncmp(buf,"http://",7)) + { + i = 0; + while (buf[i]) + { + j = i; + while (buf[i] && !isspace(buf[i])) + ++i; /* skip non-space */ + len = buf[i]; + buf[i] = 0; + if (strncmp (buf + j, "http://", 7) || (i - j) < 8) + break; /* stop at the first non-http reference */ + lprintf("reference [%s] found\n", buf + j); + _x_demux_send_mrl_reference (this->stream, 0, buf + j, NULL, 0, 0); + buf[i] = (char) len; + while (buf[i] && isspace(buf[i])) + ++i; /* skip spaces */ + } + } + else for (i = 0; i < buf_used; ++i) + { /* "--stop--" is used to have pnm alternative for old real clients * new real clients will stop processing the file and thus use * rtsp protocol. @@ -1529,7 +1542,8 @@ static int real_check_stream_type(uint8_t *buf, int len) return 1; buf[len] = '\0'; - if( strstr(buf,"pnm://") || strstr(buf,"rtsp://") || strstr(buf,"<smil>") ) + if( strstr(buf,"pnm://") || strstr(buf,"rtsp://") || strstr(buf,"<smil>") || + !strncmp(buf,"http://",7) ) return 2; return 0; diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 0ce399e11..732ddfcc4 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -34,10 +34,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c index 95f81de9a..83e589be0 100644 --- a/src/demuxers/demux_roq.c +++ b/src/demuxers/demux_roq.c @@ -40,10 +40,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_shn.c b/src/demuxers/demux_shn.c index 445661b8f..d5e46f873 100644 --- a/src/demuxers/demux_shn.c +++ b/src/demuxers/demux_shn.c @@ -35,10 +35,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index fc42ae4c4..80a5ebbf8 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -42,10 +42,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #define SCRATCH_SIZE 1024 #define CHECK_VPTS_INTERVAL 2*90000 diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c index d24459f5b..10cdf8120 100644 --- a/src/demuxers/demux_smjpeg.c +++ b/src/demuxers/demux_smjpeg.c @@ -39,10 +39,10 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c index 728caf170..d7bdd0839 100644 --- a/src/demuxers/demux_snd.c +++ b/src/demuxers/demux_snd.c @@ -33,10 +33,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index ccb653ad2..f125f09c5 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -123,10 +123,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index e320a6760..2f88c8963 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -147,9 +147,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> /* #define TS_LOG @@ -1072,7 +1072,7 @@ static void demux_ts_parse_pmt (demux_ts_t *this, unsigned char *stream; unsigned int i; int count; - char *ptr = NULL; + uint8_t *ptr = NULL; unsigned char len; unsigned int offset=0; @@ -1169,6 +1169,15 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num return; } + if (!section_length) { + free (this->pmt[program_count]); + this->pmt[program_count] = NULL; +#ifdef TS_PMT_LOG + printf ("ts_demux: eek, zero-length section?\n"); +#endif + return; + } + #ifdef TS_PMT_LOG printf ("ts_demux: have all TS packets for the PMT section\n"); #endif diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 2a8af09bb..2d35a60e8 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -24,13 +24,13 @@ #define LOG_MODULE "demux_tta" #define LOG_VERBOSE -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" -#include "attributes.h" +#include <xine/attributes.h> typedef struct { demux_plugin_t demux_plugin; diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c index 41475f966..c2902eac1 100644 --- a/src/demuxers/demux_vmd.c +++ b/src/demuxers/demux_vmd.c @@ -45,10 +45,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c index ffd904a6f..ce42d61d8 100644 --- a/src/demuxers/demux_voc.c +++ b/src/demuxers/demux_voc.c @@ -37,10 +37,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c index 0e648263e..306f2414f 100644 --- a/src/demuxers/demux_vox.c +++ b/src/demuxers/demux_vox.c @@ -34,10 +34,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c index 3cbbced9d..3acd56bc1 100644 --- a/src/demuxers/demux_vqa.c +++ b/src/demuxers/demux_vqa.c @@ -40,10 +40,10 @@ #include <string.h> #include <stdlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c index 9cf2adefe..b8f0d0194 100644 --- a/src/demuxers/demux_wav.c +++ b/src/demuxers/demux_wav.c @@ -34,10 +34,10 @@ #include <stdlib.h> #include <ctype.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> +#include <xine/buffer.h> #include "bswap.h" #include "group_audio.h" diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index b3cf9dfb3..bb9a40306 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -42,10 +42,10 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #include "group_games.h" diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c index 54e8ebbaa..a0bf31bce 100644 --- a/src/demuxers/demux_yuv4mpeg2.c +++ b/src/demuxers/demux_yuv4mpeg2.c @@ -36,10 +36,10 @@ #include <string.h> #include <stdlib.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/compat.h> +#include <xine/demux.h> #include "bswap.h" #define Y4M_SIGNATURE_SIZE 9 diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c index 301a5978e..0cef51f60 100644 --- a/src/demuxers/demux_yuv_frames.c +++ b/src/demuxers/demux_yuv_frames.c @@ -39,9 +39,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #define WRAP_THRESHOLD 20000 diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c index 218046cf5..41a91371e 100644 --- a/src/demuxers/ebml.c +++ b/src/demuxers/ebml.c @@ -31,8 +31,8 @@ /* #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" #include "ebml.h" @@ -41,20 +41,10 @@ ebml_parser_t *new_ebml_parser (xine_t *xine, input_plugin_t *input) { ebml_parser_t *ebml; - ebml = malloc(sizeof(ebml_parser_t)); + ebml = xine_xmalloc(sizeof(ebml_parser_t)); ebml->xine = xine; ebml->input = input; - ebml->version = 0; - ebml->read_version = 0; - ebml->max_id_len = 0; - ebml->max_size_len = 0; - ebml->doctype = NULL; - ebml->doctype_version = 0; - ebml->doctype_read_version = 0; - - ebml->level = 0; - return ebml; } @@ -244,6 +234,7 @@ int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *num) { return 1; } +#if 0 int ebml_read_sint (ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *num) { uint8_t data[8]; uint64_t size = elem->len; @@ -270,6 +261,7 @@ int ebml_read_sint (ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *num) { return 1; } +#endif int ebml_read_float (ebml_parser_t *ebml, ebml_elem_t *elem, double *num) { @@ -314,6 +306,7 @@ int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str) { return 1; } +#if 0 int ebml_read_utf8 (ebml_parser_t *ebml, ebml_elem_t *elem, char *str) { return ebml_read_ascii (ebml, elem, str); } @@ -321,38 +314,36 @@ int ebml_read_utf8 (ebml_parser_t *ebml, ebml_elem_t *elem, char *str) { int ebml_read_date (ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date) { return ebml_read_sint (ebml, elem, date); } +#endif int ebml_read_master (ebml_parser_t *ebml, ebml_elem_t *elem) { ebml_elem_t *top_elem; - if (ebml->level >= 0) { - top_elem = &ebml->elem_stack[ebml->level]; - top_elem->start = elem->start; - top_elem->len = elem->len; - top_elem->id = elem->id; - - ebml->level++; - lprintf("id: 0x%x, len: %" PRIu64 ", level: %d\n", elem->id, elem->len, ebml->level); - if (ebml->level >= EBML_STACK_SIZE) { - xprintf(ebml->xine, XINE_VERBOSITY_LOG, - "ebml: max level exceeded\n"); - return 0; - } - return 1; - } else { + if (ebml->level < 0) { xprintf(ebml->xine, XINE_VERBOSITY_LOG, "ebml: invalid current level\n"); return 0; } -} -int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary) { - if (!ebml_read_elem_data(ebml, binary, elem->len)) + top_elem = &ebml->elem_stack[ebml->level]; + top_elem->start = elem->start; + top_elem->len = elem->len; + top_elem->id = elem->id; + + ebml->level++; + lprintf("id: 0x%x, len: %" PRIu64 ", level: %d\n", elem->id, elem->len, ebml->level); + if (ebml->level >= EBML_STACK_SIZE) { + xprintf(ebml->xine, XINE_VERBOSITY_LOG, + "ebml: max level exceeded\n"); return 0; - + } return 1; } +int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary) { + return !!ebml_read_elem_data(ebml, binary, elem->len); +} + int ebml_check_header(ebml_parser_t *ebml) { uint32_t next_level; ebml_elem_t master; diff --git a/src/demuxers/ebml.h b/src/demuxers/ebml.h index 7ebd68da2..31d825e35 100644 --- a/src/demuxers/ebml.h +++ b/src/demuxers/ebml.h @@ -83,15 +83,19 @@ int ebml_skip(ebml_parser_t *ebml, ebml_elem_t *elem); /* EBML types */ int ebml_read_uint(ebml_parser_t *ebml, ebml_elem_t *elem, uint64_t *val); +#if 0 int ebml_read_sint(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *val); +#endif int ebml_read_float(ebml_parser_t *ebml, ebml_elem_t *elem, double *val); int ebml_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem, char *str); +#if 0 int ebml_read_utf8(ebml_parser_t *ebml, ebml_elem_t *elem, char *str); int ebml_read_date(ebml_parser_t *ebml, ebml_elem_t *elem, int64_t *date); +#endif int ebml_read_master(ebml_parser_t *ebml, ebml_elem_t *elem); diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index 78bf4012b..250eeefb4 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -24,8 +24,8 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/demux.h> #include "group_audio.h" @@ -42,7 +42,7 @@ static const demuxer_info_t demux_info_ac3 = { }; static const demuxer_info_t demux_info_aud = { - 10 /* priority */ + -2 /* priority */ }; static const demuxer_info_t demux_info_aiff = { diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h index 11aac35d7..394cad2a3 100644 --- a/src/demuxers/group_audio.h +++ b/src/demuxers/group_audio.h @@ -21,7 +21,7 @@ #ifndef HAVE_GROUP_AUDIO_H #define HAVE_GROUP_AUDIO_H -#include "xine_internal.h" +#include <xine/xine_internal.h> void *demux_aac_init_plugin (xine_t *xine, void *data); void *demux_ac3_init_plugin (xine_t *xine, void *data); diff --git a/src/demuxers/group_games.c b/src/demuxers/group_games.c index cfae26848..2d01b726e 100644 --- a/src/demuxers/group_games.c +++ b/src/demuxers/group_games.c @@ -24,8 +24,8 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/demux.h> #include "group_games.h" diff --git a/src/demuxers/group_games.h b/src/demuxers/group_games.h index f93d4bb07..352ec5524 100644 --- a/src/demuxers/group_games.h +++ b/src/demuxers/group_games.h @@ -21,7 +21,7 @@ #ifndef HAVE_GROUP_GAMES_H #define HAVE_GROUP_GAMES_H -#include "xine_internal.h" +#include <xine/xine_internal.h> void *demux_eawve_init_plugin(xine_t *xine, void *data); void *demux_idcin_init_plugin (xine_t *xine, void *data); diff --git a/src/demuxers/id3.c b/src/demuxers/id3.c index 4149c0512..f65d5564c 100644 --- a/src/demuxers/id3.c +++ b/src/demuxers/id3.c @@ -40,8 +40,8 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" #include "id3.h" @@ -273,15 +273,9 @@ static int id3v22_parse_frame_header(input_plugin_t *input, static int id3v22_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v22_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -327,11 +321,9 @@ static int id3v22_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } @@ -349,21 +341,21 @@ int id3v22_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V22_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_COMPRESS_FLAG) { /* compressed tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: compressed tags are not supported\n"); + LOG_MODULE ": compressed tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V22_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: unsynchronized tags are not supported\n"); + LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -375,11 +367,11 @@ int id3v22_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v22_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -391,13 +383,13 @@ int id3v22_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -467,15 +459,9 @@ static int id3v23_parse_frame_ext_header(input_plugin_t *input, static int id3v23_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v23_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -521,11 +507,9 @@ static int id3v23_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } @@ -543,14 +527,14 @@ int id3v23_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V23_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } if (tag_header.flags & ID3V23_UNSYNCH_FLAG) { /* unsynchronized tag: not supported */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: unsynchronized tags are not supported\n"); + LOG_MODULE ": unsynchronized tags are not supported\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -568,11 +552,11 @@ int id3v23_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v23_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -584,13 +568,13 @@ int id3v23_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3v23: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -716,15 +700,9 @@ static int id3v24_parse_ext_header(input_plugin_t *input, static int id3v24_interp_frame(input_plugin_t *input, xine_stream_t *stream, id3v24_frame_header_t *frame_header) { - char *buf; + char buf[frame_header->size + 1]; int enc; - buf = malloc(frame_header->size + 1); - if (buf == NULL) { - lprintf("malloc error"); - return 0; - } - if (input->read (input, buf, frame_header->size) == frame_header->size) { buf[frame_header->size] = 0; enc = buf[0]; @@ -772,11 +750,9 @@ static int id3v24_interp_frame(input_plugin_t *input, lprintf("unhandled frame\n"); } - free(buf); return 1; } else { lprintf("read error\n"); - free(buf); return 0; } } @@ -794,7 +770,7 @@ int id3v24_parse_tag(input_plugin_t *input, if (tag_header.flags & ID3V24_ZERO_FLAG) { /* invalid flags */ xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid header flags (%02x)\n", tag_header.flags); + LOG_MODULE ": invalid header flags (%02x)\n", tag_header.flags); input->seek (input, tag_header.size - pos, SEEK_CUR); return 0; } @@ -818,11 +794,11 @@ int id3v24_parse_tag(input_plugin_t *input, if ((pos + tag_frame_header.size) <= tag_header.size) { if (!id3v24_interp_frame(input, stream, &tag_frame_header)) { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame content\n"); + LOG_MODULE ": invalid frame content\n"); } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: invalid frame header\n"); + LOG_MODULE ": invalid frame header\n"); input->seek (input, tag_header.size - pos, SEEK_CUR); return 1; } @@ -834,7 +810,7 @@ int id3v24_parse_tag(input_plugin_t *input, } } else { xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "id3: id3v2_parse_frame_header problem\n"); + LOG_MODULE ": id3v2_parse_frame_header problem\n"); return 0; } } @@ -844,7 +820,7 @@ int id3v24_parse_tag(input_plugin_t *input, } return 1; } else { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "id3v23: id3v2_parse_header problem\n"); + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": id3v2_parse_header problem\n"); return 0; } } @@ -856,19 +832,19 @@ int id3v2_parse_tag(input_plugin_t *input, switch(id3_signature) { case ID3V22_TAG: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.2 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.2 tag\n"); return id3v22_parse_tag(input, stream, id3_signature); case ID3V23_TAG: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.3 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.3 tag\n"); return id3v23_parse_tag(input, stream, id3_signature); case ID3V24_TAG: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "ID3V2.4 tag\n"); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.4 tag\n"); return id3v24_parse_tag(input, stream, id3_signature); default: - xprintf(stream->xine, XINE_VERBOSITY_LOG, "Unknown ID3v2 signature: 0x%08x.\n", be2me_32(id3_signature)); + xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": Unknown ID3v2 signature: 0x%08x.\n", be2me_32(id3_signature)); } return 0; diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h index 29285bf7a..542a17bc4 100644 --- a/src/demuxers/id3.h +++ b/src/demuxers/id3.h @@ -25,8 +25,8 @@ #ifndef ID3_H #define ID3_H -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "bswap.h" /* id3v2 */ diff --git a/src/demuxers/iff.h b/src/demuxers/iff.h index 94830f69c..fcfc54f16 100644 --- a/src/demuxers/iff.h +++ b/src/demuxers/iff.h @@ -136,7 +136,7 @@ typedef struct { uint8_t masking; /* masking technique */ uint8_t compression; /* compression algoithm */ uint8_t pad1; /* UNUSED. For consistency, put 0 here. */ - uint16_t transparentColor; /* transparent "color number" */ + uint16_t transparentColor; /* transparent "colour number" */ uint8_t xaspect; /* aspect ratio, a rational number x/y */ uint8_t yaspect; /* aspect ratio, a rational number x/y */ int16_t pagewidth; /* source "page" size in pixels */ diff --git a/src/demuxers/matroska.h b/src/demuxers/matroska.h index 6806c207d..215c63dd0 100644 --- a/src/demuxers/matroska.h +++ b/src/demuxers/matroska.h @@ -20,9 +20,9 @@ #ifndef MATROSKA_H #define MATROSKA_H -#include "xine_internal.h" -#include "xineutils.h" -#include "demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #include "ebml.h" diff --git a/src/dxr3/Makefile.am b/src/dxr3/Makefile.am index f53a2d081..8cef3753c 100644 --- a/src/dxr3/Makefile.am +++ b/src/dxr3/Makefile.am @@ -43,4 +43,4 @@ xineplug_vo_out_dxr3_la_SOURCES = \ dxr3_scr.c \ video_out_dxr3.c -xineplug_vo_out_dxr3_la_LIBADD = $(link_fame) $(link_rte) $(link_x_libs) $(XINE_LIB) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) -lm +xineplug_vo_out_dxr3_la_LIBADD = $(XINE_LIB) $(link_fame) $(link_rte) $(link_x_libs) $(LTLIBINTL) $(DYNAMIC_LD_LIBS) -lm diff --git a/src/dxr3/dxr3.h b/src/dxr3/dxr3.h index f08ddcd04..12dedf07f 100644 --- a/src/dxr3/dxr3.h +++ b/src/dxr3/dxr3.h @@ -23,7 +23,11 @@ #include "em8300.h" -#include "xine_internal.h" +#include <xine/xine_internal.h> + +#ifndef LOG_VID +#define LOG_VID 0 +#endif /* data for the device name config entry */ #define CONF_KEY "dxr3.device_number" @@ -37,5 +41,19 @@ * (used by decoders to check for dxr3 presence) */ #define DXR3_VO_ID "dxr3" -#endif +/* inline helper implementations */ +static inline int dxr3_present(xine_stream_t *stream) +{ + int present = 0; + + if (stream->video_driver && stream->video_driver->node && + stream->video_driver->node->plugin_class ) { + const video_driver_class_t *const vo_class = (video_driver_class_t *)stream->video_driver->node->plugin_class; + if (vo_class->identifier) + present = (strcmp(vo_class->identifier, DXR3_VO_ID) == 0); + } + llprintf(LOG_VID, "dxr3 %s\n", present ? "present" : "not present"); + return present; +} +#endif diff --git a/src/dxr3/dxr3_decode_spu.c b/src/dxr3/dxr3_decode_spu.c index 7c501e9d8..01dd20b05 100644 --- a/src/dxr3/dxr3_decode_spu.c +++ b/src/dxr3/dxr3_decode_spu.c @@ -42,9 +42,9 @@ #define LOG_SPU 0 #define LOG_BTN 0 -#include "xine_internal.h" -#include "xineutils.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/buffer.h> #include "xine-engine/bswap.h" #ifdef HAVE_DVDNAV # include <dvdnav/nav_types.h> @@ -64,7 +64,7 @@ static void *dxr3_spudec_init_plugin(xine_t *xine, void *); /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_DVD, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_DVD, 0 }; static const decoder_info_t dxr3_spudec_info = { supported_types, /* supported types */ @@ -142,24 +142,6 @@ static int dxr3_spudec_copy_nav_to_btn(dxr3_spudec_t *this, int32_t mode static inline void dxr3_swab_clut(int* clut); /* inline helper implementations */ -static inline int dxr3_present(xine_stream_t *stream) -{ - plugin_node_t *node; - video_driver_class_t *vo_class; - int present = 0; - - if (stream->video_driver && stream->video_driver->node) { - node = (plugin_node_t *)stream->video_driver->node; - if (node->plugin_class) { - vo_class = (video_driver_class_t *)node->plugin_class; - if (vo_class->identifier) - present = (strcmp(vo_class->identifier, DXR3_VO_ID) == 0); - } - } - llprintf(LOG_SPU, "dxr3 %s\n", present ? "present" : "not present"); - return present; -} - static inline void dxr3_spudec_clear_nav_list(dxr3_spudec_t *this) { while (this->pci_cur.next) { diff --git a/src/dxr3/dxr3_decode_video.c b/src/dxr3/dxr3_decode_video.c index e26e303a1..4347fb808 100644 --- a/src/dxr3/dxr3_decode_video.c +++ b/src/dxr3/dxr3_decode_video.c @@ -40,8 +40,8 @@ #define LOG_VID 0 #define LOG_PTS 0 -#include "xine_internal.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/buffer.h> #include "video_out_dxr3.h" #include "dxr3.h" @@ -65,7 +65,7 @@ static void *dxr3_init_plugin(xine_t *xine, void *); /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; +static const uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; static const decoder_info_t dxr3_video_decoder_info = { supported_types, /* supported types */ @@ -143,7 +143,6 @@ typedef struct dxr3_decoder_s { } dxr3_decoder_t; /* helper functions */ -static inline int dxr3_present(xine_stream_t *stream); static inline int dxr3_mvcommand(int fd_control, int command); static void parse_mpeg_header(dxr3_decoder_t *this, uint8_t *buffer); static int get_duration(dxr3_decoder_t *this); @@ -156,24 +155,6 @@ static void dxr3_update_enhanced_mode(void *this_gen, xine_cfg_entry_t *ent static void dxr3_update_correct_durations(void *this_gen, xine_cfg_entry_t *entry); /* inline helper implementations */ -static inline int dxr3_present(xine_stream_t *stream) -{ - plugin_node_t *node; - video_driver_class_t *vo_class; - int present = 0; - - if (stream->video_driver && stream->video_driver->node) { - node = (plugin_node_t *)stream->video_driver->node; - if (node->plugin_class) { - vo_class = (video_driver_class_t *)node->plugin_class; - if (vo_class->identifier) - present = (strcmp(vo_class->identifier, DXR3_VO_ID) == 0); - } - } - llprintf(LOG_VID, "dxr3 %s\n", present ? "present" : "not present"); - return present; -} - static inline int dxr3_mvcommand(int fd_control, int command) { em8300_register_t reg; @@ -208,7 +189,7 @@ static void *dxr3_init_plugin(xine_t *xine, void *data) static video_decoder_t *dxr3_open_plugin(video_decoder_class_t *class_gen, xine_stream_t *stream) { - static char *panscan_types[] = { "only when forced", "use MPEG hint", "use DVB hint", NULL }; + static const char *const panscan_types[] = { "only when forced", "use MPEG hint", "use DVB hint", NULL }; dxr3_decoder_t *this; dxr3_decoder_class_t *class = (dxr3_decoder_class_t *)class_gen; config_values_t *cfg; @@ -625,7 +606,7 @@ static void dxr3_flush(video_decoder_t *this_gen) * (the highlights won't move without), but some dvds have stills * with no sequence end code. Since it is very likely that flush() is called * in still situations, we send one here. */ - static uint8_t end_buffer[4] = { 0x00, 0x00, 0x01, 0xb7 }; + static const uint8_t end_buffer[4] = { 0x00, 0x00, 0x01, 0xb7 }; write(this->fd_video, &end_buffer, 4); this->sequence_open = 0; xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "dxr3_decode_video: WARNING: added missing end sequence\n"); diff --git a/src/dxr3/dxr3_mpeg_encoders.c b/src/dxr3/dxr3_mpeg_encoders.c index 0c59b0b93..19ff8b81d 100644 --- a/src/dxr3/dxr3_mpeg_encoders.c +++ b/src/dxr3/dxr3_mpeg_encoders.c @@ -48,7 +48,7 @@ /* #define LOG_VERBOSE */ /* #define LOG */ -#include "xineutils.h" +#include <xine/xineutils.h> #include "video_out_dxr3.h" /* buffer size for encoded mpeg1 stream; will hold one intra frame diff --git a/src/dxr3/dxr3_scr.h b/src/dxr3/dxr3_scr.h index d0e155c27..b9f35d643 100644 --- a/src/dxr3/dxr3_scr.h +++ b/src/dxr3/dxr3_scr.h @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ -#include "xine_internal.h" +#include <xine/xine_internal.h> /* plugin structure */ diff --git a/src/dxr3/dxr3_spu_encoder.c b/src/dxr3/dxr3_spu_encoder.c index 1dcc13b77..2517063ac 100644 --- a/src/dxr3/dxr3_spu_encoder.c +++ b/src/dxr3/dxr3_spu_encoder.c @@ -167,11 +167,11 @@ static void create_histogram(spu_encoder_t *this) #ifdef LOG for (i = 0; i < OVL_PALETTE_SIZE; i++) if (this->map[i]) - lprintf("histogram: color #%d 0x%.8x appears %d times\n", + lprintf("histogram: colour #%d 0x%.8x appears %d times\n", i, this->overlay->color[i], this->map[i]); for (i = 0; i < OVL_PALETTE_SIZE; i++) if (this->clip_map[i]) - lprintf("histogram: clip color #%d 0x%.8x appears %d times\n", + lprintf("histogram: clip colour #%d 0x%.8x appears %d times\n", i, this->overlay->hili_color[i], this->clip_map[i]); #endif } @@ -209,7 +209,7 @@ static void generate_clut(spu_encoder_t *this) } #ifdef LOG for (spu_color = 0; spu_color < 4; spu_color++) - lprintf("spu color %d: 0x%.8x, trans: %d\n", spu_color, + lprintf("spu colour %d: 0x%.8x, trans: %d\n", spu_color, this->color[spu_color], this->trans[spu_color]); #endif @@ -243,7 +243,7 @@ static void generate_clut(spu_encoder_t *this) } #ifdef LOG for (spu_color = 0; spu_color < 4; spu_color++) - lprintf("spu clip color %d: 0x%.8x, trans: %d\n", spu_color, + lprintf("spu clip colour %d: 0x%.8x, trans: %d\n", spu_color, this->hili_color[spu_color], this->hili_trans[spu_color]); #endif } diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index b073e6f63..69b2d3eed 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -60,9 +60,9 @@ #define LOG_VID 0 #define LOG_OVR 0 -#include "xine_internal.h" -#include "xineutils.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/video_out.h> #include "dxr3.h" #include "video_out_dxr3.h" @@ -208,13 +208,14 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v static char *available_encoders[SUPPORTED_ENCODER_COUNT + 2]; plugin_node_t *node; + static const char *const videoout_modes[] = { + "letterboxed tv", "widescreen tv", #ifdef HAVE_X11 - static const char const *videoout_modes[] = { "letterboxed tv", "widescreen tv", - "letterboxed overlay", "widescreen overlay", NULL }; -#else - static const char const *videoout_modes[] = { "letterboxed tv", "widescreen tv", NULL }; + "letterboxed overlay", "widescreen overlay", #endif - static const char const *tv_modes[] = { "ntsc", "pal", "pal60" , "default", NULL }; + NULL + }; + static const char *const tv_modes[] = { "ntsc", "pal", "pal60" , "default", NULL }; int list_id, list_size; xine_sarray_t *plugin_list; @@ -419,13 +420,13 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v this->tv_switchable = 1; this->widescreen_enabled = confnum - 2; confstr = config->register_string(config, "dxr3.output.keycolor", "0x80a040", - _("overlay colorkey value"), _("Hexadecimal RGB value of the key color.\n" + _("overlay colour key value"), _("Hexadecimal RGB value of the key colour.\n" "You can try different values, if you experience windows becoming transparent " "when using DXR3 overlay mode."), 20, NULL, NULL); sscanf(confstr, "%x", &this->overlay.colorkey); confstr = config->register_string(config, "dxr3.output.keycolor_interval", "50.0", - _("overlay colorkey tolerance"), _("A greater value widens the tolerance for " - "the overlay keycolor.\nYou can try lower values, if you experience windows " + _("overlay colour key tolerance"), _("A greater value widens the tolerance for " + "the overlay key colour.\nYou can try lower values, if you experience windows " "becoming transparent when using DXR3 overlay mode, but parts of the image borders may " "disappear when using a too low setting."), 20, NULL, NULL); sscanf(confstr, "%f", &this->overlay.color_interval); @@ -497,7 +498,7 @@ static vo_driver_t *dxr3_vo_open_plugin(video_driver_class_t *class_gen, const v if (dxr3_overlay_set_keycolor(&this->overlay) != 0) xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, - "video_out_dxr3: setting the overlay keycolor failed.\n"); + "video_out_dxr3: setting the overlay key colour failed.\n"); if (dxr3_overlay_set_attributes(&this->overlay) != 0) xprintf(this->class->xine, XINE_VERBOSITY_DEBUG, "video_out_dxr3: setting an overlay attribute failed.\n"); diff --git a/src/dxr3/video_out_dxr3.h b/src/dxr3/video_out_dxr3.h index 0297204dd..b3c607109 100644 --- a/src/dxr3/video_out_dxr3.h +++ b/src/dxr3/video_out_dxr3.h @@ -26,8 +26,8 @@ # include <X11/Xlib.h> #endif -#include "xine_internal.h" -#include "vo_scale.h" +#include <xine/xine_internal.h> +#include <xine/vo_scale.h> #include "dxr3_scr.h" #include "dxr3.h" diff --git a/src/input/Makefile.am b/src/input/Makefile.am index ed32ad7c5..ca7e6dabd 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 @@ -113,21 +112,21 @@ xineplug_inp_dvb_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) xineplug_inp_rtsp_la_SOURCES = input_rtsp.c net_buf_ctrl.c xineplug_inp_rtsp_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) libreal/libreal.la librtsp/librtsp.la -xineplug_inp_cdda_la_SOURCES = input_cdda.c media_helper.c sha1.c sha1.h base64.c base64.h +xineplug_inp_cdda_la_SOURCES = input_cdda.c media_helper.c sha1.c sha1.h xineplug_inp_cdda_la_DEPS = $(XDG_BASEDIR_DEPS) xineplug_inp_cdda_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(XDG_BASEDIR_LIBS) xineplug_inp_cdda_la_CPPFLAGS = $(AM_CPPFLAGS) $(XDG_BASEDIR_CPPFLAGS) xineplug_inp_v4l_la_SOURCES = input_v4l.c -xineplug_inp_v4l_la_LIBADD = $(ALSA_LIBS) $(XINE_LIB) $(LTLIBINTL) +xineplug_inp_v4l_la_LIBADD = $(XINE_LIB) $(ALSA_LIBS) $(LTLIBINTL) xineplug_inp_v4l_la_CFLAGS = $(AM_CFLAGS) $(ALSA_CFLAGS) xineplug_inp_gnome_vfs_la_SOURCES = input_gnome_vfs.c net_buf_ctrl.c -xineplug_inp_gnome_vfs_la_LIBADD = $(GNOME_VFS_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_inp_gnome_vfs_la_LIBADD = $(XINE_LIB) $(GNOME_VFS_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_inp_gnome_vfs_la_CFLAGS = $(AM_CFLAGS) $(GNOME_VFS_CFLAGS) xineplug_inp_smb_la_SOURCES = input_smb.c -xineplug_inp_smb_la_LIBADD = $(LIBSMBCLIENT_LIBS) $(XINE_LIB) $(LTLIBINTL) +xineplug_inp_smb_la_LIBADD = $(XINE_LIB) $(LIBSMBCLIENT_LIBS) $(LTLIBINTL) xineplug_inp_pvr_la_SOURCES = input_pvr.c xineplug_inp_pvr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) diff --git a/src/input/http_helper.c b/src/input/http_helper.c index 4883763b0..f4950a084 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, @@ -220,30 +220,6 @@ error: return 0; } -char *_x_canonicalise_url (const char *base, const char *url) { - - size_t base_length; - char *cut, *ret; - - if ((cut = strstr (url, "://"))) - return strdup (url); - - cut = strstr (base, "://"); - if (url[0] == '/') { - /* absolute - base up to first '/' after "://", then url */ - cut = strchr (cut + 3, '/'); - } - else { - /* relative - base up to & inc. last '/', then url */ - cut = strrchr (cut, '/'); - if (cut) - ++cut; - } - base_length = cut ? (size_t)(cut - base) : strlen (base); - ret = malloc (base_length + strlen (url) + 1); - sprintf (ret, "%.*s%s", (int)base_length, base, url); - return ret; -} #ifdef TEST_URL /* diff --git a/src/input/http_helper.h b/src/input/http_helper.h index 3ce3f2b7c..9baa05235 100644 --- a/src/input/http_helper.h +++ b/src/input/http_helper.h @@ -43,6 +43,28 @@ int _x_parse_url (char *url, char **proto, char** host, int *port, * return: * the canonicalised URL (caller must free() it) */ -char *_x_canonicalise_url (const char *base, const char *url); +static inline char *_x_canonicalise_url (const char *base, const char *url) { + + size_t base_length; + char *cut, *ret; + + if ((cut = strstr (url, "://"))) + return strdup (url); + + cut = strstr (base, "://"); + if (url[0] == '/') { + /* absolute - base up to first '/' after "://", then url */ + cut = strchr (cut + 3, '/'); + } + else { + /* relative - base up to & inc. last '/', then url */ + cut = strrchr (cut, '/'); + if (cut) + ++cut; + } + base_length = cut ? (size_t)(cut - base) : strlen (base); + asprintf (&ret, "%.*s%s", (int)base_length, base, url); + return ret; +} #endif /* HTTP_HELPER_H */ diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index df4617e22..64495c433 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -65,11 +65,11 @@ */ #include "sha1.h" -#include "base64.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 "media_helper.h" +#include "base64.h" #if defined(__sun) #define DEFAULT_CDDA_DEVICE "/vol/dev/aliases/cdrom0" @@ -422,10 +422,9 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->total_tracks = toc->last_track - toc->first_track + 1; /* allocate space for the toc entries */ - toc->toc_entries = - (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); + toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { - perror("malloc"); + perror("calloc"); return -1; } @@ -533,10 +532,9 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->total_tracks = toc->last_track - toc->first_track + 1; /* allocate space for the toc entries */ - toc->toc_entries = - (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); + toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { - perror("malloc"); + perror("calloc"); return -1; } @@ -646,10 +644,9 @@ static int read_cdrom_toc(int fd, cdrom_toc *toc) { toc->total_tracks = toc->last_track - toc->first_track + 1; /* allocate space for the toc entries */ - toc->toc_entries = - (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); + toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { - perror("malloc"); + perror("calloc"); return -1; } @@ -839,10 +836,9 @@ static int read_cdrom_toc(cdda_input_plugin_t *this_gen, cdrom_toc *toc) { /* allocate space for the toc entries */ - toc->toc_entries = - (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); + toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { - perror("malloc"); + perror("calloc"); return -1; } @@ -991,7 +987,7 @@ static int parse_url (char *urlbuf, char** host, int *port) { #endif static int XINE_FORMAT_PRINTF(4, 5) -network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, ...) +network_command( xine_stream_t *stream, int socket, void *data_buf, const char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -1040,13 +1036,13 @@ network_command( xine_stream_t *stream, int socket, char *data_buf, char *msg, . #ifndef WIN32 -static int network_connect(xine_stream_t *stream, char *url ) +static int network_connect(xine_stream_t *stream, const char *_url ) { char *host; int port; int fd; - url = strdup(url); + char *url = strdup(_url); parse_url(url, &host, &port); if( !host || !strlen(host) || !port ) @@ -1085,10 +1081,9 @@ static int network_read_cdrom_toc(xine_stream_t *stream, int fd, cdrom_toc *toc) toc->total_tracks = toc->last_track - toc->first_track + 1; /* allocate space for the toc entries */ - toc->toc_entries = - (cdrom_toc_entry *)malloc(toc->total_tracks * sizeof(cdrom_toc_entry)); + toc->toc_entries = calloc(toc->total_tracks, sizeof(cdrom_toc_entry)); if (!toc->toc_entries) { - perror("malloc"); + perror("calloc"); return -1; } @@ -1288,42 +1283,27 @@ static void _cdda_mkdir_safe(xine_t *xine, char *path) { } /* - * Make recursive directory creation + * Make recursive directory creation (given an absolute pathname) */ -static void _cdda_mkdir_recursive_safe(xine_t *xine, char *path) { - char *p, *pp; - char buf[XINE_PATH_MAX + XINE_NAME_MAX + 1]; - char buf2[XINE_PATH_MAX + XINE_NAME_MAX + 1]; - - if(path == NULL) +static void _cdda_mkdir_recursive_safe (xine_t *xine, char *path) +{ + if (!path) return; - memset(&buf, 0, sizeof(buf)); - memset(&buf2, 0, sizeof(buf2)); - - snprintf(buf, sizeof(buf), "%s", path); - pp = buf; - while((p = xine_strsep(&pp, "/")) != NULL) { - if(p && strlen(p)) { - -#ifdef WIN32 - if (*buf2 != '\0') { -#endif - - int size = strlen(buf2); - snprintf(buf2 + size, sizeof(buf2) - size, "/%s", p); + char buf[strlen (path) + 1]; + strcpy (buf, path); + char *p = strchr (buf, '/') ? : buf; -#ifdef WIN32 - } - else { - snprintf(buf2, sizeof(buf2), "%s", p); - } - -#endif /* WIN32 */ - - _cdda_mkdir_safe(xine, buf2); - } - } + do + { + while (*p++ == '/') /**/; + p = strchr (p, '/'); + if (p) + *p = 0; + _cdda_mkdir_safe (xine, buf); + if (p) + *p = '/'; + } while (p); } /* @@ -1443,7 +1423,6 @@ static int _cdda_load_cached_cddb_infos(cdda_input_plugin_t *this) { while((pdir = readdir(dir)) != NULL) { char discid[9]; - memset(&discid, 0, sizeof(discid)); snprintf(discid, sizeof(discid), "%08lx", this->cddb.disc_id); if(!strcasecmp(pdir->d_name, discid)) { @@ -1649,7 +1628,7 @@ static int _cdda_cddb_retrieve(cdda_input_plugin_t *this) { this->cddb.fd = _cdda_cddb_socket_open(this); if(this->cddb.fd >= 0) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, - _("input_cdda: successfuly connected to cddb server '%s:%d'.\n"), + _("input_cdda: successfully connected to cddb server '%s:%d'.\n"), this->cddb.server, this->cddb.port); } else { @@ -1957,7 +1936,7 @@ static void _cdda_cdindex(cdda_input_plugin_t *this, cdrom_toc *toc) { sha_final(digest, &sha); - base64 = rfc822_binary(digest, 20, &size); + base64 = _x_rfc822_binary(digest, 20, &size); base64[size] = 0; _x_meta_info_set_utf8(this->stream, XINE_META_INFO_CDINDEX_DISCID, base64); diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index a998d274b..07aefc362 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -113,9 +113,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 @@ -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]; @@ -291,7 +290,7 @@ typedef struct { xine_t *xine; - char *mrls[5]; + const char *mrls[5]; int numchannels; @@ -359,7 +358,7 @@ typedef struct { } dvb_input_plugin_t; typedef struct { - char *name; + const char *name; int value; } Param; @@ -432,7 +431,7 @@ static const Param transmissionmode_list [] = { }; -time_t dvb_mjdtime (char *buf); +static time_t dvb_mjdtime (uint8_t *buf); static void load_epg_data(dvb_input_plugin_t *this); static void show_eit(dvb_input_plugin_t *this); @@ -491,7 +490,7 @@ static int find_descriptor(uint8_t tag, const unsigned char *buf, int descriptor /* Extract UTC time and date encoded in modified julian date format and return it as a time_t. */ -time_t dvb_mjdtime (char *buf) +static time_t dvb_mjdtime (uint8_t *buf) { int i; unsigned int year, month, day, hour, min, sec; @@ -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; } @@ -1203,8 +1208,8 @@ static void parse_pmt(dvb_input_plugin_t *this, const unsigned char *buf, int se static void dvb_parse_si(dvb_input_plugin_t *this) { - char *tmpbuffer; - char *bufptr; + uint8_t *tmpbuffer; + uint8_t *bufptr; int service_id; int result; int section_len; @@ -1403,8 +1408,8 @@ static void load_epg_data(dvb_input_plugin_t *this) int section_len = 0; unsigned int service_id=-1; int n; - char *eit = NULL; - char *foo = NULL; + uint8_t *eit = NULL; + uint8_t *foo = NULL; char *seen_channels = NULL; int text_len; struct pollfd fd; @@ -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", @@ -2476,7 +2481,7 @@ static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char * origin static off_t dvb_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len) { dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen; - char *buf = (char *)buf_gen; + uint8_t *buf = buf_gen; off_t n=0, total=0; int have_mutex=0; @@ -2491,9 +2496,6 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen, "input_dvb: reading %" PRIdMAX " bytes...\n", (intmax_t)len); #endif -#ifndef DVB_NO_BUFFERING - nbc_check_buffers (this->nbc); -#endif /* protect against channel changes */ have_mutex = pthread_mutex_lock(&this->channel_change_mutex); total=0; diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 446b7c778..02017956e 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? */ @@ -225,7 +225,7 @@ typedef struct { int32_t region; int32_t play_single_chapter; - char *filelist[MAX_DIR_ENTRIES]; + const char *filelist[MAX_DIR_ENTRIES]; } dvd_input_class_t; @@ -332,7 +332,7 @@ static void send_mouse_enter_leave_event(dvd_input_plugin_t *this, int direction this->mouse_in = !this->mouse_in; if(direction != this->mouse_in) { - const xine_spu_button_t spu_event = { + xine_spu_button_t spu_event = { .direction = direction, .button = this->mouse_buttonN }; @@ -1374,10 +1374,7 @@ check_solaris_vold_device(dvd_input_class_t *this) (volume_action = getenv("VOLUME_ACTION")) != NULL && strcmp(volume_action, "insert") == 0) { - device = malloc(strlen(volume_device) + strlen(volume_name) + 2); - if (device == NULL) - return; - sprintf(device, "%s/%s", volume_device, volume_name); + asprintf(&device, "%s/%s", volume_device, volume_name); if (stat(device, &stb) != 0 || !S_ISCHR(stb.st_mode)) { free(device); return; @@ -1624,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)); @@ -1743,9 +1740,9 @@ static void *init_class (xine_t *xine, void *data) { dvd_input_class_t *this; config_values_t *config = xine->config; void *dvdcss; - static const char *skip_modes[] = {"skip program", "skip part", "skip title", NULL}; - static const char *seek_modes[] = {"seek in program chain", "seek in program", NULL}; - static const char *play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; + static const char *const skip_modes[] = {"skip program", "skip part", "skip title", NULL}; + static const char *const seek_modes[] = {"seek in program chain", "seek in program", NULL}; + static const char *const play_single_chapter_modes[] = {"entire dvd", "one chapter", NULL}; trace_print("Called\n"); #ifdef INPUT_DEBUG diff --git a/src/input/input_file.c b/src/input/input_file.c index 1916a71e4..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 @@ -337,7 +337,7 @@ static int file_plugin_open (input_plugin_t *this_gen ) { lprintf("file_plugin_open\n"); - if (strncasecmp (this->mrl, "file:", 5) == 0) + if (strncasecmp (this->mrl, "file:/", 6) == 0) { if (strncasecmp (this->mrl, "file://localhost/", 16) == 0) filename = decode_uri(&(this->mrl[16])); @@ -347,43 +347,27 @@ static int file_plugin_open (input_plugin_t *this_gen ) { filename = decode_uri(&(this->mrl[5])); } else - filename = decode_uri(this->mrl); + filename = strdup(this->mrl); /* NEVER unescape plain file names! */ this->fh = open (filename, O_RDONLY|O_BINARY); - - free(filename); if (this->fh == -1) { - /* try again without unescaping; such MRLs might be invalid, - * but we are a nice software */ - if (strncasecmp (this->mrl, "file:", 5) == 0) - { - if (strncasecmp (this->mrl, "file://localhost/", 16) == 0) - this->fh = open(&this->mrl[16], O_RDONLY|O_BINARY); - else if (strncasecmp (this->mrl, "file://127.0.0.1/", 16) == 0) - this->fh = open(&this->mrl[16], O_RDONLY|O_BINARY); - else - this->fh = open(&this->mrl[5], O_RDONLY|O_BINARY); + if (errno == EACCES) { + _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); + xine_log (this->stream->xine, XINE_LOG_MSG, + _("input_file: Permission denied: >%s<\n"), this->mrl); + } else if (errno == ENOENT) { + _x_message(this->stream, XINE_MSG_FILE_NOT_FOUND, this->mrl, NULL); + xine_log (this->stream->xine, XINE_LOG_MSG, + _("input_file: File not found: >%s<\n"), this->mrl); } - else - this->fh = open(this->mrl, O_RDONLY|O_BINARY); - - if (this->fh == -1) { - if (errno == EACCES) { - _x_message(this->stream, XINE_MSG_PERMISSION_ERROR, this->mrl, NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("input_file: Permission denied: >%s<\n"), this->mrl); - return -1; - } else if (errno == ENOENT) { - _x_message(this->stream, XINE_MSG_FILE_NOT_FOUND, this->mrl, NULL); - xine_log (this->stream->xine, XINE_LOG_MSG, - _("input_file: File not found: >%s<\n"), this->mrl); - } - return -1; - } + free(filename); + return -1; } + free(filename); + #ifdef HAVE_MMAP this->mmap_on = 0; this->mmap_base = NULL; diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c index 71a4ada85..7fb2d8b00 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> @@ -200,7 +200,7 @@ gnomevfs_plugin_get_length (input_plugin_t *this_gen) static uint32_t gnomevfs_plugin_get_blocksize (input_plugin_t *this_gen) { - return 32 * 1024; + return 8 * 1024; } static const char* @@ -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 38658b161..c2836affe 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -46,9 +46,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" @@ -77,11 +77,7 @@ typedef struct { off_t contentlength; char buf[BUFSIZE]; - char proxybuf[BUFSIZE]; - char auth[BUFSIZE]; - char proxyauth[BUFSIZE]; - char preview[MAX_PREVIEW_SIZE]; off_t preview_size; @@ -232,7 +228,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) { } static int http_plugin_basicauth (const char *user, const char *password, char* dest, int len) { - static char *enctable="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + static const char enctable[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; char *tmp; char *sptr; char *dptr; @@ -249,7 +245,7 @@ static int http_plugin_basicauth (const char *user, const char *password, char* if (len < enclen) return -1; - tmp = malloc (sizeof(char) * (totlen + 1)); + tmp = malloc (totlen + 1); strcpy (tmp, user); strcat (tmp, ":"); if (password != NULL) @@ -667,6 +663,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) { int use_proxy; int proxyport; int mpegurl_redirect = 0; + char auth[BUFSIZE]; + char proxyauth[BUFSIZE]; use_proxy = this_class->proxyhost && strlen(this_class->proxyhost); @@ -674,7 +672,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { if (this_class->proxyuser && strlen(this_class->proxyuser)) { if (http_plugin_basicauth (this_class->proxyuser, this_class->proxypassword, - this->proxyauth, BUFSIZE)) { + proxyauth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "proxy error", NULL); return 0; } @@ -693,7 +691,7 @@ static int http_plugin_open (input_plugin_t *this_gen ) { this->port = DEFAULT_HTTP_PORT; if (this->user && strlen(this->user)) { - if (http_plugin_basicauth (this->user, this->password, this->auth, BUFSIZE)) { + if (http_plugin_basicauth (this->user, this->password, auth, BUFSIZE)) { _x_message(this->stream, XINE_MSG_CONNECTION_REFUSED, "basic auth error", NULL); return -1; } @@ -776,12 +774,12 @@ static int http_plugin_open (input_plugin_t *this_gen ) { buflen = strlen(this->buf); if (this_class->proxyuser && strlen(this_class->proxyuser)) { snprintf (this->buf + buflen, BUFSIZE - buflen, - "Proxy-Authorization: Basic %s\015\012", this->proxyauth); + "Proxy-Authorization: Basic %s\015\012", proxyauth); buflen = strlen(this->buf); } if (this->user && strlen(this->user)) { snprintf (this->buf + buflen, BUFSIZE - buflen, - "Authorization: Basic %s\015\012", this->auth); + "Authorization: Basic %s\015\012", auth); buflen = strlen(this->buf); } 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..8a4874203 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 @@ -412,6 +412,8 @@ static int net_plugin_open (input_plugin_t *this_gen ) { char *filename; char *pptr; int port = 7658; + int toread = MAX_PREVIEW_SIZE; + int trycount = 0; filename = this->host_port; pptr=strrchr(filename, ':'); @@ -430,11 +432,15 @@ static int net_plugin_open (input_plugin_t *this_gen ) { /* * fill preview buffer */ + while ((toread > 0) && (trycount < 10)) { #ifndef WIN32 - this->preview_size = read (this->fh, this->preview, MAX_PREVIEW_SIZE); + this->preview_size += read (this->fh, this->preview + this->preview_size, toread); #else - this->preview_size = recv (this->fh, this->preview, MAX_PREVIEW_SIZE, 0); + this->preview_size += recv (this->fh, this->preview + this->preview_size, toread, 0); #endif + trycount++; + toread = MAX_PREVIEW_SIZE - this->preview_size; + } this->curpos = 0; 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..e11e3b361 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" @@ -83,8 +83,6 @@ static off_t pnm_plugin_read (input_plugin_t *this_gen, lprintf ("pnm_plugin_read: %"PRId64" bytes ...\n", len); - nbc_check_buffers (this->nbc); - n = pnm_read (this->pnm, buf, len); this->curpos += n; diff --git a/src/input/input_pvr.c b/src/input/input_pvr.c index ac7c5f2f0..740d51665 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" @@ -511,10 +511,7 @@ static char *make_temp_name(pvr_input_plugin_t *this, int page) { char *filename; - int size = strlen(this->tmp_prefix)+PVR_FILENAME_SIZE; - filename = malloc(size); - - snprintf(filename, size, PVR_FILENAME, this->tmp_prefix, this->session, page); + asprintf(&filename, PVR_FILENAME, this->tmp_prefix, this->session, page); return filename; } @@ -527,12 +524,9 @@ static char *make_base_save_name(int channel, time_t tm) { struct tm rec_time; char *filename; - int size = SAVE_BASE_FILENAME_SIZE; - filename = malloc(size); - localtime_r(&tm, &rec_time); - snprintf(filename, size, SAVE_BASE_FILENAME, + asprintf(&filename, SAVE_BASE_FILENAME, channel, rec_time.tm_mon+1, rec_time.tm_mday, rec_time.tm_year+1900, rec_time.tm_hour, rec_time.tm_min, rec_time.tm_sec); @@ -546,10 +540,7 @@ static char *make_save_name(pvr_input_plugin_t *this, char *base, int page) { char *filename; - int size = strlen(this->save_prefix)+strlen(base)+SAVE_FILENAME_SIZE; - filename = malloc(size); - - snprintf(filename, size, SAVE_FILENAME, this->save_prefix, base, page); + asprintf(&filename, SAVE_FILENAME, this->save_prefix, base, page); return filename; } @@ -988,69 +979,92 @@ static void pvr_event_handler (pvr_input_plugin_t *this) { /* make sure we are not paused */ _x_set_speed(this->stream, XINE_SPEED_NORMAL); - if( v4l2_data->session_id != this->session ) { - /* if session changes -> closes the old one */ - pthread_mutex_lock(&this->lock); - pvr_finish_recording(this); - time(&this->start_time); - this->show_time = this->start_time; - this->session = v4l2_data->session_id; - this->new_session = 1; - this->pvr_play_paused = 0; - this->scr_tunning = 0; - pvrscr_speed_tunning(this->scr, 1.0 ); - pvr_break_rec_page(this); - pthread_mutex_unlock(&this->lock); - _x_demux_flush_engine (this->stream); - } else { - /* no session change, break the page and store a new show_time */ - pthread_mutex_lock(&this->lock); - pvr_break_rec_page(this); - this->show_page = this->rec_page; - pthread_mutex_unlock(&this->lock); - time(&this->show_time); + if ( v4l2_data->session_id != -1) { + if( v4l2_data->session_id != this->session ) { + /* if session changes -> closes the old one */ + pthread_mutex_lock(&this->lock); + pvr_finish_recording(this); + time(&this->start_time); + this->show_time = this->start_time; + this->session = v4l2_data->session_id; + this->new_session = 1; + this->pvr_play_paused = 0; + this->scr_tunning = 0; + pvrscr_speed_tunning(this->scr, 1.0 ); + pvr_break_rec_page(this); + pthread_mutex_unlock(&this->lock); + _x_demux_flush_engine (this->stream); + } else { + /* no session change, break the page and store a new show_time */ + pthread_mutex_lock(&this->lock); + pvr_break_rec_page(this); + this->show_page = this->rec_page; + pthread_mutex_unlock(&this->lock); + time(&this->show_time); + } } - - if( (v4l2_data->input != -1 && v4l2_data->input != this->input) || - (v4l2_data->channel != -1 && v4l2_data->channel != this->channel) || - (v4l2_data->frequency != -1 && v4l2_data->frequency != this->frequency) ) { - struct v4l2_frequency vf; + pthread_mutex_lock(&this->dev_lock); + + /* change input */ + if (v4l2_data->input != -1 && v4l2_data->input != this->input) { this->input = v4l2_data->input; + + /* as of ivtv 0.10.6: must close and reopen to set input */ + close(this->dev_fd); + this->dev_fd = open (this->class->devname, O_RDWR); + if (this->dev_fd < 0) { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error opening device %s\n", this->class->devname ); + } else { + if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) == 0 ) { + lprintf("Tuner Input set to:%d\n", v4l2_data->input); + } else { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 input\n"); + } + } + } + + /* change channel */ + if (v4l2_data->channel != -1 && v4l2_data->channel != this->channel) { + lprintf("change channel to:%d\n", v4l2_data->channel); this->channel = v4l2_data->channel; + } + + /* change frequency */ + if (v4l2_data->frequency != -1 && v4l2_data->frequency != this->frequency) { + double freq = (double)v4l2_data->frequency / 1000.0; + struct v4l2_frequency vf; + struct v4l2_tuner vt; + double fac = 16; + + memset(&vf, 0, sizeof(vf)); + memset(&vt, 0, sizeof(vt)); + this->frequency = v4l2_data->frequency; - lprintf("switching to input:%d chan:%d freq:%.2f\n", - v4l2_data->input, - v4l2_data->channel, - (float)v4l2_data->frequency * 62.5); - - pthread_mutex_lock(&this->dev_lock); - if( ioctl(this->dev_fd, VIDIOC_S_INPUT, &this->input) ) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "input_pvr: error setting v4l2 input\n"); - - vf.frequency = this->frequency; + if (ioctl(this->dev_fd, VIDIOC_G_TUNER, &vt) == 0) { + fac = (vt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; + } + vf.tuner = 0; - if( ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) ) - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "input_pvr: error setting v4l2 frequency\n"); + vf.type = vt.type; + vf.frequency = (__u32)(freq * fac); - /* workaround an ivtv bug where stream gets bad mpeg2 artifacts - * after changing inputs. reopening the device fixes it. - */ - close(this->dev_fd); - this->dev_fd = open (this->class->devname, O_RDWR); - if (this->dev_fd == -1) { - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "input_pvr: error opening device %s\n", this->class->devname ); - return; + if (ioctl(this->dev_fd, VIDIOC_S_FREQUENCY, &vf) == 0) { + lprintf("Tuner Frequency set to %d (%f.3 MHz)\n", vf.frequency, vf.frequency / fac); + } else { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "input_pvr: error setting v4l2 frequency\n"); } - pthread_mutex_unlock(&this->dev_lock); - - /* FIXME: also flush the device */ - /* _x_demux_flush_engine(this->stream); */ } + + pthread_mutex_unlock(&this->dev_lock); + + /* FIXME: also flush the device */ + /* _x_demux_flush_engine(this->stream); */ + break; 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..e2b1bae99 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" @@ -83,8 +83,6 @@ static off_t rtsp_plugin_read (input_plugin_t *this_gen, lprintf ("rtsp_plugin_read: %"PRId64" bytes ...\n", len); - nbc_check_buffers (this->nbc); - n = rtsp_session_read (this->rtsp, buf, len); this->curpos += n; 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..df0e0e48b 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,12 +110,15 @@ 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" -#define VIDEO_DEV "/dev/v4l/video0" +#define RADIO_DEV "/dev/radio0" +#define VIDEO_DEV "/dev/video0" +#ifdef HAVE_ALSA +#define AUDIO_DEV "plughw:0,0" +#endif #if !defined(NDELAY) && defined(O_NDELAY) #define FNDELAY O_NDELAY @@ -913,7 +916,7 @@ static int open_video_capture_device(v4l_input_plugin_t *this) if (ret < 0) { close (this->video_fd); this->video_fd = -1; - lprintf("Grab: no colorspace format found\n"); + lprintf("Grab: no colour space format found\n"); return 0; } else @@ -1732,6 +1735,9 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, { /* v4l_input_class_t *cls = (v4l_input_class_t *) cls_gen; */ v4l_input_plugin_t *this; +#ifdef HAVE_ALSA + cfg_entry_t *entry; +#endif char *mrl = strdup(data); /* Example mrl: v4l:/Television/62500 */ @@ -1752,13 +1758,14 @@ static input_plugin_t *v4l_class_get_instance (input_class_t *cls_gen, this->event_queue = NULL; this->scr = NULL; #ifdef HAVE_ALSA - this->pcm_name = NULL; this->pcm_data = NULL; this->pcm_hwparams = NULL; /* Audio */ this->pcm_stream = SND_PCM_STREAM_CAPTURE; - this->pcm_name = strdup("plughw:0,0"); + entry = this->stream->xine->config->lookup_entry(this->stream->xine->config, + "media.video4linux.audio_device"); + this->pcm_name = strdup (entry->str_value); this->audio_capture = 1; #endif this->rate = 44100; @@ -1928,6 +1935,14 @@ static void *init_video_class (xine_t *xine, void *data) _("Selects the TV standard of the input signals. " "Either: PAL, NTSC and SECAM. "), 20, NULL, NULL); +#ifdef HAVE_ALSA + config->register_filename (config, "media.video4linux.audio_device", + AUDIO_DEV, 0, + _("v4l ALSA audio input device"), + _("The name of the audio device which corresponds " + "to your Video4Linux video device."), + 10, NULL, NULL); +#endif return this; } 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 9ea65d9df..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]; } @@ -660,7 +659,7 @@ rmff_header_t *real_setup_and_get_header(rtsp_t *rtsp_session, uint32_t bandwid lprintf("Stream description size: %i\n", size); - description = malloc(sizeof(char)*(size+1)); + description = calloc(size+1, sizeof(char)); if( rtsp_read_data(rtsp_session, description, size) <= 0) { xine_buffer_free(buf); diff --git a/src/input/libreal/rmff.c b/src/input/libreal/rmff.c index 159b81ee6..1600e967a 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" @@ -35,9 +35,13 @@ * writes header data to a buffer */ -static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { +static int rmff_dump_fileheader(rmff_fileheader_t *fileheader, uint8_t *buffer, int bufsize) { + + if (!fileheader) return 0; + + if (bufsize < RMFF_FILEHEADER_SIZE) + return -1; - if (!fileheader) return; fileheader->object_id=_X_BE_32(&fileheader->object_id); fileheader->size=_X_BE_32(&fileheader->size); fileheader->object_version=_X_BE_16(&fileheader->object_version); @@ -53,11 +57,17 @@ static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) { fileheader->file_version=_X_BE_32(&fileheader->file_version); fileheader->num_headers=_X_BE_32(&fileheader->num_headers); fileheader->object_id=_X_BE_32(&fileheader->object_id); + + return RMFF_FILEHEADER_SIZE; } -static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { +static int rmff_dump_prop(rmff_prop_t *prop, uint8_t *buffer, int bufsize) { + + if (!prop) return 0; + + if (bufsize < RMFF_PROPHEADER_SIZE) + return -1; - if (!prop) return; prop->object_id=_X_BE_32(&prop->object_id); prop->size=_X_BE_32(&prop->size); prop->object_version=_X_BE_16(&prop->object_version); @@ -93,13 +103,19 @@ static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) { prop->num_streams=_X_BE_16(&prop->num_streams); prop->flags=_X_BE_16(&prop->flags); prop->object_id=_X_BE_32(&prop->object_id); + + return RMFF_PROPHEADER_SIZE; } -static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { +static int rmff_dump_mdpr(rmff_mdpr_t *mdpr, uint8_t *buffer, int bufsize) { int s1, s2, s3; - if (!mdpr) return; + if (!mdpr) return 0; + + if (bufsize < RMFF_MDPRHEADER_SIZE + mdpr->type_specific_len + mdpr->stream_name_size + mdpr->mime_type_size) + return -1; + mdpr->object_id=_X_BE_32(&mdpr->object_id); mdpr->size=_X_BE_32(&mdpr->size); mdpr->object_version=_X_BE_16(&mdpr->object_version); @@ -141,13 +157,19 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) { mdpr->duration=_X_BE_32(&mdpr->duration); mdpr->object_id=_X_BE_32(&mdpr->object_id); + return RMFF_MDPRHEADER_SIZE + s1 + s2 + s3; } -static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { +static int rmff_dump_cont(rmff_cont_t *cont, uint8_t *buffer, int bufsize) { int p; - if (!cont) return; + if (!cont) return 0; + + if (bufsize < RMFF_CONTHEADER_SIZE + cont->title_len + cont->author_len + + cont->copyright_len + cont->comment_len) + return -1; + cont->object_id=_X_BE_32(&cont->object_id); cont->size=_X_BE_32(&cont->size); cont->object_version=_X_BE_16(&cont->object_version); @@ -181,11 +203,18 @@ static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) { cont->size=_X_BE_32(&cont->size); cont->object_version=_X_BE_16(&cont->object_version); cont->object_id=_X_BE_32(&cont->object_id); + + return RMFF_CONTHEADER_SIZE + cont->title_len + cont->author_len + + cont->copyright_len + cont->comment_len; } -static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { +static int rmff_dump_dataheader(rmff_data_t *data, uint8_t *buffer, int bufsize) { + + if (!data) return 0; + + if (bufsize < RMFF_DATAHEADER_SIZE) + return -1; - if (!data) return; data->object_id=_X_BE_32(&data->object_id); data->size=_X_BE_32(&data->size); data->object_version=_X_BE_16(&data->object_version); @@ -201,36 +230,48 @@ static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) { data->size=_X_BE_32(&data->size); data->object_version=_X_BE_16(&data->object_version); data->object_id=_X_BE_32(&data->object_id); + + return RMFF_DATAHEADER_SIZE; } -int rmff_dump_header(rmff_header_t *h, char *buffer, int max) { +int rmff_dump_header(rmff_header_t *h, void *buf_gen, int max) { + uint8_t *buffer = buf_gen; - int written=0; + int written=0, size; rmff_mdpr_t **stream=h->streams; - rmff_dump_fileheader(h->fileheader, &buffer[written]); - written+=h->fileheader->size; - rmff_dump_prop(h->prop, &buffer[written]); - written+=h->prop->size; - rmff_dump_cont(h->cont, &buffer[written]); - written+=h->cont->size; + if ((size=rmff_dump_fileheader(h->fileheader, &buffer[written], max)) < 0) + return -1; + written+=size; + max -= size; + if ((size=rmff_dump_prop(h->prop, &buffer[written], max)) < 0) + return -1; + written+=size; + max -= size; + if ((size=rmff_dump_cont(h->cont, &buffer[written], max)) < 0) + return -1; + written+=size; + max -= size; if (stream) { while(*stream) { - rmff_dump_mdpr(*stream, &buffer[written]); - written+=(*stream)->size; + if ((size=rmff_dump_mdpr(*stream, &buffer[written], max)) < 0) + return -1; + written+=size; + max -= size; stream++; } } - rmff_dump_dataheader(h->data, &buffer[written]); - written+=18; + if ((size=rmff_dump_dataheader(h->data, &buffer[written], max)) < 0) + return -1; + written+=size; return written; } -void rmff_dump_pheader(rmff_pheader_t *h, char *data) { +void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data) { data[0]=(h->object_version>>8) & 0xff; data[1]=h->object_version & 0xff; @@ -310,19 +351,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 = malloc(sizeof(char)*(mdpr->stream_name_size+1)); - 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 = malloc(sizeof(char)*(mdpr->mime_type_size+1)); - 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 = malloc(sizeof(char)*(mdpr->type_specific_len)); - 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; } @@ -340,24 +375,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 = malloc(sizeof(char)*(cont->title_len+1)); - 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 = malloc(sizeof(char)*(cont->author_len+1)); - 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 = malloc(sizeof(char)*(cont->copyright_len+1)); - 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 = malloc(sizeof(char)*(cont->comment_len+1)); - 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; } @@ -403,10 +431,7 @@ rmff_header_t *rmff_scan_header(const char *data) { header->fileheader=rmff_scan_fileheader(ptr); ptr += header->fileheader->size; - header->streams = malloc(sizeof(rmff_mdpr_t*)*(header->fileheader->num_headers)); - for (i=0; i<header->fileheader->num_headers; i++) { - header->streams[i]=NULL; - } + header->streams = calloc(header->fileheader->num_headers, sizeof(rmff_mdpr_t*)); for (i=1; i<header->fileheader->num_headers; i++) { chunk_type = _X_BE_32(ptr); @@ -450,6 +475,7 @@ rmff_header_t *rmff_scan_header(const char *data) { return header; } +#if 0 rmff_header_t *rmff_scan_header_stream(int fd) { rmff_header_t *header; @@ -500,6 +526,7 @@ void rmff_scan_pheader(rmff_pheader_t *h, char *data) { h->reserved=(uint8_t)data[10]; h->flags=(uint8_t)data[11]; } +#endif rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) { @@ -586,8 +613,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 = malloc(sizeof(char)*type_specific_len); - 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; @@ -646,6 +672,7 @@ rmff_data_t *rmff_new_dataheader(uint32_t num_packets, uint32_t next_data_header return data; } +#if 0 void rmff_print_header(rmff_header_t *h) { rmff_mdpr_t **stream; @@ -712,6 +739,7 @@ void rmff_print_header(rmff_header_t *h) { printf("next DATA : 0x%08x\n", h->data->next_data_header); } } +#endif void rmff_fix_header(rmff_header_t *h) { @@ -820,6 +848,7 @@ void rmff_fix_header(rmff_header_t *h) { } } +#if 0 int rmff_get_header_size(rmff_header_t *h) { if (!h) return 0; @@ -859,3 +888,4 @@ void rmff_free_header(rmff_header_t *h) { } free(h); } +#endif diff --git a/src/input/libreal/rmff.h b/src/input/libreal/rmff.h index d39942088..3fe3af284 100644 --- a/src/input/libreal/rmff.h +++ b/src/input/libreal/rmff.h @@ -39,6 +39,12 @@ #define RMFF_HEADER_SIZE 0x12 +#define RMFF_FILEHEADER_SIZE 18 +#define RMFF_PROPHEADER_SIZE 50 +#define RMFF_MDPRHEADER_SIZE 46 +#define RMFF_CONTHEADER_SIZE 18 +#define RMFF_DATAHEADER_SIZE 18 + #define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \ (((long)(unsigned char)(ch3) ) | \ ( (long)(unsigned char)(ch2) << 8 ) | \ @@ -216,6 +222,7 @@ rmff_data_t *rmff_new_dataheader( */ rmff_header_t *rmff_scan_header(const char *data); +#if 0 /* * scans a data packet header. Notice, that this function does not allocate * the header struct itself. @@ -231,30 +238,35 @@ rmff_header_t *rmff_scan_header_stream(int fd); * prints header information in human readible form to stdout */ void rmff_print_header(rmff_header_t *h); +#endif /* * does some checks and fixes header if possible */ void rmff_fix_header(rmff_header_t *h); +#if 0 /* * returns the size of the header (incl. first data-header) */ int rmff_get_header_size(rmff_header_t *h); +#endif /* * dumps the header <h> to <buffer>. <max> is the size of <buffer> */ -int rmff_dump_header(rmff_header_t *h, char *buffer, int max); +int rmff_dump_header(rmff_header_t *h, void *buffer, int max); /* * dumps a packet header */ -void rmff_dump_pheader(rmff_pheader_t *h, char *data); +void rmff_dump_pheader(rmff_pheader_t *h, uint8_t *data); +#if 0 /* * frees a header struct */ void rmff_free_header(rmff_header_t *h); +#endif #endif diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c index c62b6bbc1..d58a3d1fe 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> /* * Decodes base64 strings (based upon b64 package) @@ -199,8 +199,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { if(filter(*data,"a=OpaqueData:buffer;",&buf)) { decoded = b64_decode(buf, decoded, &(desc->mlti_data_size)); if ( decoded != NULL ) { - 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); @@ -294,7 +293,7 @@ sdpplin_t *sdpplin_parse(char *data) { if(filter(data,"a=StreamCount:integer;",&buf)) { desc->stream_count=atoi(buf); - desc->stream = malloc(sizeof(sdpplin_stream_t*)*desc->stream_count); + desc->stream = calloc(desc->stream_count, sizeof(sdpplin_stream_t*)); handled=1; data=nl(data); } diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index 530ffc6cf..c660751fe 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -21,6 +21,8 @@ * *not* RFC 2326 compilant yet. */ +#include <config.h> + #include <unistd.h> #include <stdio.h> #include <assert.h> @@ -43,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 @@ -77,7 +79,7 @@ struct rtsp_s { * constants */ -const char rtsp_protocol_version[]="RTSP/1.0"; +static const char rtsp_protocol_version[]="RTSP/1.0"; /* server states */ #define RTSP_CONNECTED 1 @@ -103,8 +105,7 @@ const char rtsp_protocol_version[]="RTSP/1.0"; */ static char *rtsp_get(rtsp_t *s) { - - char *buffer = malloc(BUF_SIZE); + char buffer[BUF_SIZE]; char *string = NULL; if ( _x_io_tcp_read_line(s->stream, s->s, buffer, BUF_SIZE) >= 0 ) { @@ -112,7 +113,6 @@ static char *rtsp_get(rtsp_t *s) { string = strdup( buffer ); } - free(buffer); return string; } @@ -124,7 +124,7 @@ static char *rtsp_get(rtsp_t *s) { static void rtsp_put(rtsp_t *s, const char *string) { int len=strlen(string); - char *buf = malloc(sizeof(char)*len+2); + char buf[len+2]; lprintf(">> '%s'", string); @@ -135,8 +135,6 @@ static void rtsp_put(rtsp_t *s, const char *string) { _x_io_tcp_write(s->stream, s->s, buf, len+2); lprintf("done.\n"); - - free(buf); } /* @@ -171,13 +169,11 @@ static int rtsp_get_code(rtsp_t *s, const char *string) { static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) { char **payload=s->scheduled; - char *buf; - - buf = malloc(strlen(type)+strlen(what)+strlen(rtsp_protocol_version)+3); + char buf[strlen(type)+strlen(what)+strlen(rtsp_protocol_version)+3]; sprintf(buf,"%s %s %s",type, what, rtsp_protocol_version); rtsp_put(s,buf); - free(buf); + if (payload) while (*payload) { rtsp_put(s,*payload); @@ -199,11 +195,9 @@ static void rtsp_schedule_standard(rtsp_t *s) { rtsp_schedule_field(s, tmp); if (s->session) { - char *buf; - buf = malloc(strlen(s->session)+15); + char buf[strlen(s->session)+15]; sprintf(buf, "Session: %s", s->session); rtsp_schedule_field(s, buf); - free(buf); } } /* @@ -241,14 +235,13 @@ static int rtsp_get_answers(rtsp_t *s) { } } if (!strncasecmp(answer,"Server:",7)) { - char *buf = xine_xmalloc(strlen(answer)); + char buf[strlen(answer)]; sscanf(answer,"%*s %s",buf); if (s->server) free(s->server); s->server=strdup(buf); - free(buf); } if (!strncasecmp(answer,"Session:",8)) { - char *buf = xine_xmalloc(strlen(answer)); + char buf[strlen(answer)]; sscanf(answer,"%*s %s",buf); if (s->session) { if (strcmp(buf, s->session)) { @@ -263,7 +256,6 @@ static int rtsp_get_answers(rtsp_t *s) { s->session=strdup(buf); } - free(buf); } *answer_ptr=answer; answer_ptr++; @@ -304,8 +296,7 @@ int rtsp_request_options(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+16)); - sprintf(buf,"rtsp://%s:%i", s->host, s->port); + asprintf(&buf,"rtsp://%s:%i", s->host, s->port); } rtsp_send_request(s,"OPTIONS",buf); free(buf); @@ -321,8 +312,7 @@ int rtsp_request_describe(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"DESCRIBE",buf); free(buf); @@ -345,8 +335,7 @@ int rtsp_request_setparameter(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"SET_PARAMETER",buf); free(buf); @@ -362,8 +351,7 @@ int rtsp_request_play(rtsp_t *s, const char *what) { buf=strdup(what); } else { - buf = malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); - sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); + asprintf(&buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } rtsp_send_request(s,"PLAY",buf); free(buf); @@ -371,19 +359,21 @@ int rtsp_request_play(rtsp_t *s, const char *what) { return rtsp_get_answers(s); } +#if 0 int rtsp_request_tearoff(rtsp_t *s, const char *what) { rtsp_send_request(s,"TEAROFF",what); return rtsp_get_answers(s); } +#endif /* * read opaque data from stream */ -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { - +int rtsp_read_data(rtsp_t *s, void *buffer_gen, unsigned int size) { + uint8_t *buffer = buffer_gen; int i,seq; if (size>=4) { @@ -412,8 +402,7 @@ int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size) { } /* lets make the server happy */ rtsp_put(s, "RTSP/1.0 451 Parameter Not Understood"); - rest = malloc(sizeof(char)*17); - sprintf(rest,"CSeq: %u", seq); + asprintf(&rest,"CSeq: %u", seq); rtsp_put(s, rest); free(rest); rtsp_put(s, ""); @@ -486,9 +475,7 @@ rtsp_t *rtsp_connect(xine_stream_t *stream, const char *mrl, const char *user_ag pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - s->host = malloc(sizeof(char)*hostend+1); - strncpy(s->host, mrl_ptr, hostend); - s->host[hostend]=0; + s->host = strndup(mrl_ptr, hostend); if (pathbegin < strlen(mrl_ptr)) s->path=strdup(mrl_ptr+pathbegin+1); if (colon != slash) { @@ -572,6 +559,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) { return NULL; } +#if 0 /* * session id management */ @@ -589,6 +577,7 @@ char *rtsp_get_session(rtsp_t *s) { return s->session; } +#endif char *rtsp_get_mrl(rtsp_t *s) { @@ -612,6 +601,7 @@ void rtsp_schedule_field(rtsp_t *s, const char *string) { s->scheduled[i]=strdup(string); } +#if 0 /* * removes the first scheduled field which prefix matches string. */ @@ -632,6 +622,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) { *(ptr-1)=*ptr; } while(*ptr); } +#endif /* * unschedule all fields diff --git a/src/input/librtsp/rtsp.h b/src/input/librtsp/rtsp.h index dc2624459..1cec57e1e 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 @@ -47,11 +47,13 @@ int rtsp_request_describe(rtsp_t *s, const char *what); int rtsp_request_setup(rtsp_t *s, const char *what); int rtsp_request_setparameter(rtsp_t *s, const char *what); int rtsp_request_play(rtsp_t *s, const char *what); +#if 0 int rtsp_request_tearoff(rtsp_t *s, const char *what); +#endif int rtsp_send_ok(rtsp_t *s); -int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size); +int rtsp_read_data(rtsp_t *s, void *buffer, unsigned int size); char* rtsp_search_answers(rtsp_t *s, const char *tag); void rtsp_add_to_payload(char **payload, const char *string); @@ -61,15 +63,19 @@ void rtsp_free_answers(rtsp_t *this); int rtsp_read (rtsp_t *this, char *data, int len); void rtsp_close (rtsp_t *this); +#if 0 void rtsp_set_session(rtsp_t *s, const char *id); char *rtsp_get_session(rtsp_t *s); +#endif char *rtsp_get_mrl(rtsp_t *s); /*int rtsp_peek_header (rtsp_t *this, char *data); */ void rtsp_schedule_field(rtsp_t *s, const char *string); +#if 0 void rtsp_unschedule_field(rtsp_t *s, const char *string); +#endif void rtsp_unschedule_all(rtsp_t *s); #endif diff --git a/src/input/librtsp/rtsp_session.c b/src/input/librtsp/rtsp_session.c index f3ddb59bc..d8f7ae583 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 @@ -65,15 +65,15 @@ struct rtsp_session_s { }; /* network bandwidth */ -const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, - 115200,262200,393216,524300,1544000,10485800}; +static const uint32_t rtsp_bandwidths[]={14400,19200,28800,33600,34430,57600, + 115200,262200,393216,524300,1544000,10485800}; -const char *rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", - "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", - "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", - "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", - "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", - "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; +static const char *const rtsp_bandwidth_strs[]={"14.4 Kbps (Modem)", "19.2 Kbps (Modem)", + "28.8 Kbps (Modem)", "33.6 Kbps (Modem)", + "34.4 Kbps (Modem)", "57.6 Kbps (Modem)", + "115.2 Kbps (ISDN)", "262.2 Kbps (Cable/DSL)", + "393.2 Kbps (Cable/DSL)","524.3 Kbps (Cable/DSL)", + "1.5 Mbps (T1)", "10.5 Mbps (LAN)", NULL}; rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { @@ -87,7 +87,7 @@ rtsp_session_t *rtsp_session_start(xine_stream_t *stream, char *mrl) { uint32_t bandwidth; bandwidth_id = xine->config->register_enum(xine->config, "media.network.bandwidth", 10, - (char **)rtsp_bandwidth_strs, + rtsp_bandwidth_strs, _("network bandwidth"), _("Specify the bandwidth of your internet connection here. " "This will be used when streaming servers offer different versions " @@ -148,6 +148,11 @@ connect: rtsp_session->header_left = rtsp_session->header_len = rmff_dump_header(h,rtsp_session->header,HEADER_SIZE); + if (rtsp_session->header_len < 0) { + xprintf (stream->xine, XINE_VERBOSITY_LOG, + _("rtsp_session: rtsp server returned overly-large headers, session can not be established.\n")); + goto session_abort; + } xine_buffer_copyin(rtsp_session->recv, 0, rtsp_session->header, rtsp_session->header_len); rtsp_session->recv_size = rtsp_session->header_len; @@ -157,6 +162,7 @@ connect: { xprintf(stream->xine, XINE_VERBOSITY_LOG, _("rtsp_session: rtsp server type '%s' not supported yet. sorry.\n"), server); + session_abort: rtsp_close(rtsp_session->s); free(server); xine_buffer_free(rtsp_session->recv); @@ -189,7 +195,7 @@ int rtsp_session_read (rtsp_session_t *this, char *data, int len) { int to_copy; char *dest=data; - char *source=this->recv + this->recv_read; + uint8_t *source=this->recv + this->recv_read; int fill=this->recv_size - this->recv_read; if (len < 0) 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..ba584b4f8 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; } @@ -601,7 +601,7 @@ static int mms_tcp_connect(mms_t *this) { } static void mms_gen_guid(char guid[]) { - static char digit[16] = "0123456789ABCDEF"; + static const char digit[16] = "0123456789ABCDEF"; int i = 0; srand(time(NULL)); @@ -742,7 +742,7 @@ mms_t *mms_connect (xine_stream_t *stream, const char *url, int bandwidth) { /* TODO: insert network timing request here */ /* command 0x2 */ lprintf("send command 0x02\n"); - string_utf16 (url_conv, &this->scmd_body[8], "\002\000\\\\192.168.0.129\\TCP\\1037\0000", 28); + string_utf16 (url_conv, &this->scmd_body[8], (ICONV_CONST char*)"\002\000\\\\192.168.0.129\\TCP\\1037\0000", 28); memset (this->scmd_body, 0, 8); if (!send_command (this, 2, 0, 0, 28 * 2 + 8)) { xprintf(this->stream->xine, XINE_VERBOSITY_LOG, 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..03a24d38f 100644 --- a/src/input/net_buf_ctrl.c +++ b/src/input/net_buf_ctrl.c @@ -113,13 +113,9 @@ static void nbc_set_speed_normal (nbc_t *this) { stream->xine->clock->set_option (stream->xine->clock, CLOCK_SCR_ADJUSTABLE, 1); } -void nbc_check_buffers (nbc_t *this) { - /* Deprecated */ -} - 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, "\ @@ -564,22 +560,3 @@ void nbc_close (nbc_t *this) { free (this); xprintf(xine, XINE_VERBOSITY_DEBUG, "\nnet_buf_ctrl: nbc_close: done\n"); } - - -void nbc_set_high_water_mark(nbc_t *this, int value) { -/* - Deprecated - this->high_water_mark = value; -*/ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); -} - -void nbc_set_low_water_mark(nbc_t *this, int value) { -/* - Deprecated - this->low_water_mark = value; -*/ - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, - "\nnet_buf_ctrl: this method is deprecated, please fix the input plugin\n"); -} diff --git a/src/input/net_buf_ctrl.h b/src/input/net_buf_ctrl.h index 79f698008..87d6d84a1 100644 --- a/src/input/net_buf_ctrl.h +++ b/src/input/net_buf_ctrl.h @@ -23,18 +23,12 @@ #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; nbc_t *nbc_init (xine_stream_t *xine); -void nbc_check_buffers (nbc_t *this); - void nbc_close (nbc_t *this); -void nbc_set_high_water_mark(nbc_t *this, int value); - -void nbc_set_low_water_mark(nbc_t *this, int value); - #endif diff --git a/src/input/pnm.c b/src/input/pnm.c index 38d65b850..564151279 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -21,6 +21,8 @@ * based upon code from joschka */ +#include <config.h> + #include <unistd.h> #include <stdio.h> #include <sys/socket.h> @@ -43,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 @@ -90,7 +92,7 @@ struct pnm_s { /* header of rm files */ #define RM_HEADER_SIZE 0x12 -const unsigned char rm_header[]={ +static const unsigned char rm_header[]={ 0x2e, 0x52, 0x4d, 0x46, /* object_id ".RMF" */ 0x00, 0x00, 0x00, 0x12, /* header_size 0x12 */ 0x00, 0x00, /* object_version 0x00 */ @@ -100,7 +102,7 @@ const unsigned char rm_header[]={ /* data chunk header */ #define PNM_DATA_HEADER_SIZE 18 -const unsigned char pnm_data_header[]={ +static const unsigned char pnm_data_header[]={ 'D','A','T','A', 0,0,0,0, /* data chunk size */ 0,0, /* object version */ @@ -732,9 +734,7 @@ pnm_t *pnm_connect(xine_stream_t *stream, const char *mrl) { pathbegin=slash-mrl_ptr; hostend=colon-mrl_ptr; - p->host = malloc(sizeof(char)*hostend+1); - strncpy(p->host, mrl_ptr, hostend); - p->host[hostend]=0; + p->host = strndup(mrl_ptr, hostend); if (pathbegin < strlen(mrl_ptr)) p->path=strdup(mrl_ptr+pathbegin+1); if (colon != slash) { 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/sha1.c b/src/input/sha1.c index b70e50d5f..98873e6f6 100644 --- a/src/input/sha1.c +++ b/src/input/sha1.c @@ -315,12 +315,12 @@ void sha_print(unsigned char digest[20]) } } -char *sha_version(void) +const char *sha_version(void) { #if (SHA_VERSION == 1) - static char *version = "SHA-1"; + static const char *version = "SHA-1"; #else - static char *version = "SHA"; + static const char *version = "SHA"; #endif return(version); } diff --git a/src/input/sha1.h b/src/input/sha1.h index 9f2659d60..810eecd96 100644 --- a/src/input/sha1.h +++ b/src/input/sha1.h @@ -30,7 +30,7 @@ void sha_final(unsigned char [20], SHA_INFO *); void sha_stream(unsigned char [20], SHA_INFO *, FILE *); void sha_print(unsigned char [20]); -char *sha_version(void); +const char *sha_version(void); #define SHA_VERSION 1 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 45d9789ba..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" @@ -272,11 +272,9 @@ vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, this->mrls[*i]->type = mrl_vcd; this->mrls[*i]->size = size * M2F2_SECTOR_SIZE; - this->mrls[*i]->mrl = (char *) malloc(strlen(mrl) + 1); + this->mrls[*i]->mrl = strdup(mrl); if (NULL==this->mrls[*i]->mrl) { - LOG_ERR("Can't malloc %zu bytes for MRL name %s", sizeof(xine_mrl_t), mrl); - } else { - sprintf(this->mrls[*i]->mrl, "%s", mrl); + LOG_ERR("Can't strndup %zu bytes for MRL name %s", strlen(mrl), mrl); } (*i)++; } diff --git a/src/libmpeg2new/libmpeg2/idct_alpha.c b/src/libmpeg2new/libmpeg2/idct_alpha.c index 8f9beaf22..1d8fd08ee 100644 --- a/src/libmpeg2new/libmpeg2/idct_alpha.c +++ b/src/libmpeg2new/libmpeg2/idct_alpha.c @@ -30,7 +30,7 @@ #include <inttypes.h> #include "mpeg2.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mpeg2_internal.h" #include "alpha_asm.h" diff --git a/src/libmpeg2new/libmpeg2/idct_altivec.c b/src/libmpeg2new/libmpeg2/idct_altivec.c index 6b1b8586c..f15bca165 100644 --- a/src/libmpeg2new/libmpeg2/idct_altivec.c +++ b/src/libmpeg2new/libmpeg2/idct_altivec.c @@ -31,7 +31,7 @@ #include <inttypes.h> #include "mpeg2.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mpeg2_internal.h" typedef vector signed char vector_s8_t; diff --git a/src/libmpeg2new/libmpeg2/motion_comp_alpha.c b/src/libmpeg2new/libmpeg2/motion_comp_alpha.c index 05cd55084..1b3712a1a 100644 --- a/src/libmpeg2new/libmpeg2/motion_comp_alpha.c +++ b/src/libmpeg2new/libmpeg2/motion_comp_alpha.c @@ -27,7 +27,7 @@ #include <inttypes.h> #include "mpeg2.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mpeg2_internal.h" #include "alpha_asm.h" diff --git a/src/libmpeg2new/libmpeg2/motion_comp_altivec.c b/src/libmpeg2new/libmpeg2/motion_comp_altivec.c index 4356aa6e7..ee740e14e 100644 --- a/src/libmpeg2new/libmpeg2/motion_comp_altivec.c +++ b/src/libmpeg2new/libmpeg2/motion_comp_altivec.c @@ -31,7 +31,7 @@ #include <inttypes.h> #include "mpeg2.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mpeg2_internal.h" typedef vector signed char vector_s8_t; diff --git a/src/libmpeg2new/libmpeg2/motion_comp_vis.c b/src/libmpeg2new/libmpeg2/motion_comp_vis.c index 54c0f7e75..e724d28a2 100644 --- a/src/libmpeg2new/libmpeg2/motion_comp_vis.c +++ b/src/libmpeg2new/libmpeg2/motion_comp_vis.c @@ -27,7 +27,7 @@ #include <inttypes.h> #include "mpeg2.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mpeg2_internal.h" #include "vis.h" diff --git a/src/libmpeg2new/libmpeg2/rgb.c b/src/libmpeg2new/libmpeg2/rgb.c index 8863b0b9f..e4abcacc2 100644 --- a/src/libmpeg2new/libmpeg2/rgb.c +++ b/src/libmpeg2new/libmpeg2/rgb.c @@ -22,7 +22,7 @@ */ #include "config.h" -#include "attributes.h" +#include <xine/attributes.h> #include <inttypes.h> diff --git a/src/libmpeg2new/libmpeg2/rgb_mmx.c b/src/libmpeg2new/libmpeg2/rgb_mmx.c index 912291c6a..6ca7e65a8 100644 --- a/src/libmpeg2new/libmpeg2/rgb_mmx.c +++ b/src/libmpeg2new/libmpeg2/rgb_mmx.c @@ -34,7 +34,7 @@ #include "mpeg2.h" #include "mpeg2convert.h" #include "convert_internal.h" -#include "attributes.h" +#include <xine/attributes.h> #include "mmx.h" #define CPU_MMXEXT 0 diff --git a/src/libmpeg2new/libmpeg2/rgb_vis.c b/src/libmpeg2new/libmpeg2/rgb_vis.c index 49d8d1d7c..cbd7c7072 100644 --- a/src/libmpeg2new/libmpeg2/rgb_vis.c +++ b/src/libmpeg2new/libmpeg2/rgb_vis.c @@ -30,7 +30,7 @@ #include "mpeg2.h" #include "mpeg2convert.h" #include "convert_internal.h" -#include "attributes.h" +#include <xine/attributes.h> #include "vis.h" /* Based partially upon the MMX yuv2rgb code, see there for credits. diff --git a/src/libmpeg2new/xine_mpeg2new_decoder.c b/src/libmpeg2new/xine_mpeg2new_decoder.c index 386b0049d..eeafee9c1 100644 --- a/src/libmpeg2new/xine_mpeg2new_decoder.c +++ b/src/libmpeg2new/xine_mpeg2new_decoder.c @@ -31,9 +31,9 @@ #include <assert.h> #include "./include/mpeg2.h" -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 531fb780e..6cc1d8785 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -77,8 +77,8 @@ void _x_real_codecs_init(xine_t *const xine) { default_real_codecs_path[0] = 0; -#define UL64 0x05 /* /usr/{,local/}lib64 */ -#define UL 0x0A /* /usr/{,local/}lib */ +#define UL64 0x03 /* /usr/{,local/}lib64 */ +#define UL 0x0C /* /usr/{,local/}lib */ #define O 0x10 /* /opt */ #define OL64 0x20 /* /opt/lib64 */ #define OL 0x40 /* /opt/lib */ diff --git a/src/libreal/real_common.h b/src/libreal/real_common.h index 1e3d8c264..74dc5e6e2 100644 --- a/src/libreal/real_common.h +++ b/src/libreal/real_common.h @@ -23,7 +23,7 @@ #ifndef __REAL_COMMON_H__ #define __REAL_COMMON_H__ -#include "xine_internal.h" +#include <xine/xine_internal.h> /* * some fake functions to make real codecs happy diff --git a/src/libreal/xine_real_audio_decoder.c b/src/libreal/xine_real_audio_decoder.c index 5c43f8480..b9231a2b7 100644 --- a/src/libreal/xine_real_audio_decoder.c +++ b/src/libreal/xine_real_audio_decoder.c @@ -38,10 +38,10 @@ */ #include "bswap.h" -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "real_common.h" @@ -350,7 +350,7 @@ static int init_codec (realdec_decoder_t *this, buf_element_t *buf) { return 1; } -static unsigned char sipr_swaps[38][2]={ +static const unsigned char sipr_swaps[38][2]={ {0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68}, {13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46}, {25,94},{26,54},{28,75},{29,50},{32,70},{33,92},{35,74},{38,85},{40,56}, @@ -603,7 +603,7 @@ void *init_realadec (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_COOK, BUF_AUDIO_ATRK, /* BUF_AUDIO_14_4, BUF_AUDIO_28_8, */ BUF_AUDIO_SIPRO, 0 }; diff --git a/src/libreal/xine_real_video_decoder.c b/src/libreal/xine_real_video_decoder.c index 617c9f6b5..28fddafda 100644 --- a/src/libreal/xine_real_video_decoder.c +++ b/src/libreal/xine_real_video_decoder.c @@ -37,10 +37,10 @@ #define LOG */ #include "bswap.h" -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "real_common.h" @@ -531,7 +531,7 @@ void *init_realvdec (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t supported_types[] = { BUF_VIDEO_RV20, +static const uint32_t supported_types[] = { BUF_VIDEO_RV20, BUF_VIDEO_RV30, BUF_VIDEO_RV40, 0 }; diff --git a/src/libspucc/Makefile.am b/src/libspucc/Makefile.am deleted file mode 100644 index 87266505c..000000000 --- a/src/libspucc/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_LDFLAGS = $(xineplug_ldflags) - -noinst_HEADERS = cc_decoder.h - -xineplug_LTLIBRARIES = xineplug_decode_spucc.la - -xineplug_decode_spucc_la_SOURCES = cc_decoder.c xine_cc_decoder.c -xineplug_decode_spucc_la_LIBADD = $(XINE_LIB) -xineplug_decode_spucc_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing diff --git a/src/libspucmml/Makefile.am b/src/libspucmml/Makefile.am deleted file mode 100644 index 85f5dbcd9..000000000 --- a/src/libspucmml/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_LDFLAGS = $(xineplug_ldflags) - -xineplug_LTLIBRARIES = xineplug_decode_spucmml.la - -xineplug_decode_spucmml_la_SOURCES = xine_cmml_decoder.c -xineplug_decode_spucmml_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) diff --git a/src/libspudec/Makefile.am b/src/libspudec/Makefile.am deleted file mode 100644 index 62de3774d..000000000 --- a/src/libspudec/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_CPPFLAGS = -I$(top_srcdir)/src/input/libdvdnav -AM_LDFLAGS = $(xineplug_ldflags) - -noinst_HEADERS = spu.h - -xineplug_LTLIBRARIES = xineplug_decode_spu.la - -if WITH_EXTERNAL_DVDNAV -external_dvdnav_libs = $(DVDNAV_LIBS) -internal_dvdnav_sources = -else -external_dvdnav_libs = -internal_dvdnav_sources = nav_read.c -endif - -xineplug_decode_spu_la_SOURCES = $(internal_dvdnav_sources) spu.c xine_spu_decoder.c -xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(external_dvdnav_libs) $(PTHREAD_LIBS) -xineplug_decode_spu_la_CFLAGS = $(AM_CFLAGS) $(DVDNAV_CFLAGS) diff --git a/src/libspudvb/Makefile.am b/src/libspudvb/Makefile.am deleted file mode 100644 index 1adb154db..000000000 --- a/src/libspudvb/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_LDFLAGS = $(xineplug_ldflags) - -xineplug_LTLIBRARIES = xineplug_decode_spudvb.la - -xineplug_decode_spudvb_la_SOURCES = xine_spudvb_decoder.c -xineplug_decode_spudvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) diff --git a/src/libsputext/Makefile.am b/src/libsputext/Makefile.am deleted file mode 100644 index 14c6f2323..000000000 --- a/src/libsputext/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -include $(top_srcdir)/misc/Makefile.common - -AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) -AM_LDFLAGS = $(xineplug_ldflags) - -xineplug_LTLIBRARIES = xineplug_decode_sputext.la xineplug_dmx_sputext.la - -xineplug_dmx_sputext_la_SOURCES = demux_sputext.c -xineplug_dmx_sputext_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) - -xineplug_decode_sputext_la_SOURCES = xine_sputext_decoder.c -xineplug_decode_sputext_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) diff --git a/src/libw32dll/DirectShow/DS_VideoDecoder.c b/src/libw32dll/DirectShow/DS_VideoDecoder.c index 44c6d26d7..c0a08d5e3 100644 --- a/src/libw32dll/DirectShow/DS_VideoDecoder.c +++ b/src/libw32dll/DirectShow/DS_VideoDecoder.c @@ -570,7 +570,7 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp if (result != 0) { if (csp) - printf("Warning: unsupported color space\n"); + printf("Warning: unsupported colour space\n"); else printf("Warning: unsupported bit depth\n"); diff --git a/src/libw32dll/dmo/DMO_VideoDecoder.c b/src/libw32dll/dmo/DMO_VideoDecoder.c index 3ad85645a..7b25085f0 100644 --- a/src/libw32dll/dmo/DMO_VideoDecoder.c +++ b/src/libw32dll/dmo/DMO_VideoDecoder.c @@ -524,7 +524,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c if (result != 0) { if (csp) - printf("Warning: unsupported color space\n"); + printf("Warning: unsupported colour space\n"); else printf("Warning: unsupported bit depth\n"); diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index ca358bb9b..2ef8ebc66 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.c @@ -38,9 +38,9 @@ */ #include "bswap.h" -#include "xine_internal.h" -#include "audio_out.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> #include "qtx/qtxsdk/components.h" #include "wine/win32.h" @@ -589,7 +589,7 @@ static void *qta_init_class (xine_t *xine, void *data) { return this; } -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_QDESIGN1, BUF_AUDIO_QDESIGN2, BUF_AUDIO_QCLP, @@ -1105,7 +1105,7 @@ static void *qtv_init_class (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t qtv_supported_types[] = { BUF_VIDEO_SORENSON_V3, 0 }; +static const uint32_t qtv_supported_types[] = { BUF_VIDEO_SORENSON_V3, 0 }; static const decoder_info_t qtv_dec_info = { qtv_supported_types, /* supported types */ diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 3b66dfb23..fb7d3a482 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.c @@ -50,11 +50,11 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" -#include "audio_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/audio_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "common.c" @@ -1647,7 +1647,7 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t video_types[] = { +static const uint32_t video_types[] = { BUF_VIDEO_MSMPEG4_V1, BUF_VIDEO_MSMPEG4_V2, BUF_VIDEO_MSMPEG4_V3, BUF_VIDEO_IV50, BUF_VIDEO_IV41, BUF_VIDEO_IV32, BUF_VIDEO_IV31, BUF_VIDEO_CINEPAK, /* BUF_VIDEO_ATIVCR1, */ @@ -1663,7 +1663,7 @@ static const decoder_info_t dec_info_video = { 1 /* priority */ }; -static uint32_t audio_types[] = { +static const uint32_t audio_types[] = { BUF_AUDIO_WMAV1, BUF_AUDIO_WMAV2, BUF_AUDIO_WMAV3, BUF_AUDIO_MSADPCM, BUF_AUDIO_MSIMAADPCM, BUF_AUDIO_MSGSM, BUF_AUDIO_IMC, BUF_AUDIO_LH, BUF_AUDIO_VOXWARE, BUF_AUDIO_ACELPNET, BUF_AUDIO_VIVOG723, BUF_AUDIO_WMAV, diff --git a/src/libw32dll/wine/debugtools.h b/src/libw32dll/wine/debugtools.h index 3b342e10c..c6fac518d 100644 --- a/src/libw32dll/wine/debugtools.h +++ b/src/libw32dll/wine/debugtools.h @@ -8,7 +8,7 @@ #include "config.h" #include "windef.h" -#include "compat.h" +#include <xine/compat.h> struct _GUID; diff --git a/src/libw32dll/wine/ext.h b/src/libw32dll/wine/ext.h index f0f505c4d..ad22edc5e 100644 --- a/src/libw32dll/wine/ext.h +++ b/src/libw32dll/wine/ext.h @@ -2,7 +2,7 @@ #define loader_ext_h #include "windef.h" -#include "attributes.h" +#include <xine/attributes.h> extern LPVOID FILE_dommap( int unix_handle, LPVOID start, DWORD size_high, DWORD size_low, diff --git a/src/libw32dll/wine/registry.c b/src/libw32dll/wine/registry.c index c8e3c4dd0..20c21888d 100644 --- a/src/libw32dll/wine/registry.c +++ b/src/libw32dll/wine/registry.c @@ -18,7 +18,7 @@ #include "debugtools.h" #ifdef XINE_MAJOR -#include "xineutils.h" +#include <xine/xineutils.h> #include <basedir.h> #endif diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 3b0941391..01a287c31 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -12,7 +12,7 @@ for DLL to know too much about its environment. ************************************************************/ #include "config.h" -#include "attributes.h" +#include <xine/attributes.h> #define QTX @@ -3037,9 +3037,9 @@ static int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntr static int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) { - const short name[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'S', 't', 'a', + static const short name[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'S', 't', 'a', 'n', 'd', 'a', 'r', 'd', ' ', 'T', 'i', 'm', 'e', 0}; - const short pname[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'D', 'a', 'y', + static const short pname[]={'C', 'e', 'n', 't', 'r', 'a', 'l', ' ', 'D', 'a', 'y', 'l', 'i', 'g', 'h', 't', ' ', 'T', 'i', 'm', 'e', 0}; dbgprintf("GetTimeZoneInformation(%p) => TIME_ZONE_ID_STANDARD\n", lpTimeZoneInformation); memset(lpTimeZoneInformation, 0, sizeof(TIME_ZONE_INFORMATION)); diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c index 8200db51b..517591b71 100644 --- a/src/post/audio/audio_filters.c +++ b/src/post/audio/audio_filters.c @@ -21,9 +21,9 @@ */ -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -36,9 +36,9 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, - { PLUGIN_POST, 9, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, - { PLUGIN_POST, 9, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, - { PLUGIN_POST, 9, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } + { PLUGIN_POST, 10, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin }, + { PLUGIN_POST, 10, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin }, + { PLUGIN_POST, 10, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin }, + { PLUGIN_POST, 10, "volnorm", XINE_VERSION_CODE, &volnorm_special_info, &volnorm_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h index 6c064945a..8a0202751 100644 --- a/src/post/audio/audio_filters.h +++ b/src/post/audio/audio_filters.h @@ -20,7 +20,7 @@ * catalog for audio filter plugins */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *upmix_init_plugin(xine_t *xine, void *data); diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c index f02b1b899..5a0382895 100644 --- a/src/post/audio/stretch.c +++ b/src/post/audio/stretch.c @@ -22,11 +22,11 @@ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" -#include "resample.h" +#include <xine/resample.h> #include "audio_filters.h" @@ -662,7 +662,7 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *stretch_init_plugin(xine_t *xine, void *data) { - post_class_stretch_t *class = (post_class_stretch_t *)malloc(sizeof(post_class_stretch_t)); + post_class_stretch_t *class = (post_class_stretch_t *)xine_xmalloc(sizeof(post_class_stretch_t)); if (!class) return NULL; diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c index 4d0e2c2a2..573354450 100644 --- a/src/post/audio/upmix.c +++ b/src/post/audio/upmix.c @@ -26,9 +26,9 @@ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" #include "audio_filters.h" @@ -417,7 +417,7 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *upmix_init_plugin(xine_t *xine, void *data) { - post_class_upmix_t *class = (post_class_upmix_t *)malloc(sizeof(post_class_upmix_t)); + post_class_upmix_t *class = (post_class_upmix_t *)xine_xmalloc(sizeof(post_class_upmix_t)); if (!class) return NULL; diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index b28b1f3f5..82ceb1877 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -31,8 +31,8 @@ #define LOG */ -#include "xineutils.h" -#include "post.h" +#include <xine/xineutils.h> +#include <xine/post.h> #include "audio_filters.h" @@ -332,7 +332,7 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs /* plugin class initialization function */ void *upmix_mono_init_plugin(xine_t *xine, void *data) { - post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)malloc(sizeof(post_class_upmix_mono_t)); + post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)xine_xmalloc(sizeof(post_class_upmix_mono_t)); if (!class) return NULL; diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index 7533ba94a..de4ebde87 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -25,9 +25,9 @@ #include <stdio.h> #include <math.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "dsp.h" #include "audio_filters.h" @@ -450,7 +450,7 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *volnorm_init_plugin(xine_t *xine, void *data) { - post_class_volnorm_t *class = (post_class_volnorm_t *)malloc(sizeof(post_class_volnorm_t)); + post_class_volnorm_t *class = (post_class_volnorm_t *)xine_xmalloc(sizeof(post_class_volnorm_t)); if (!class) return NULL; diff --git a/src/post/deinterlace/deinterlace.c b/src/post/deinterlace/deinterlace.c index 8e4a3bb00..5c0356c55 100644 --- a/src/post/deinterlace/deinterlace.c +++ b/src/post/deinterlace/deinterlace.c @@ -31,7 +31,7 @@ */ #include "deinterlace.h" -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef struct methodlist_item_s methodlist_item_t; diff --git a/src/post/deinterlace/plugins/greedy.c b/src/post/deinterlace/plugins/greedy.c index b5fcad3e5..fc8013a6d 100644 --- a/src/post/deinterlace/plugins/greedy.c +++ b/src/post/deinterlace/plugins/greedy.c @@ -32,8 +32,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/greedy2frame.c b/src/post/deinterlace/plugins/greedy2frame.c index 57e3228ac..af27d76ee 100644 --- a/src/post/deinterlace/plugins/greedy2frame.c +++ b/src/post/deinterlace/plugins/greedy2frame.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/greedy2frame_template.c b/src/post/deinterlace/plugins/greedy2frame_template.c index 1067e2cb8..0d9ab6769 100644 --- a/src/post/deinterlace/plugins/greedy2frame_template.c +++ b/src/post/deinterlace/plugins/greedy2frame_template.c @@ -100,8 +100,6 @@ static int64_t qwGreedyTwoFrameThreshold; #endif -#include <mangle.h> - #if defined(IS_SSE) static void DeinterlaceGreedy2Frame_SSE(uint8_t *output, int outstride, deinterlace_frame_data_t *data, diff --git a/src/post/deinterlace/plugins/greedyh.asm b/src/post/deinterlace/plugins/greedyh.asm index 11b28ca76..c96bfbf2c 100644 --- a/src/post/deinterlace/plugins/greedyh.asm +++ b/src/post/deinterlace/plugins/greedyh.asm @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////// #include "x86-64_macros.inc" -#include <mangle.h> #if !defined(MASKS_DEFINED) #define MASKS_DEFINED diff --git a/src/post/deinterlace/plugins/kdetv_greedyh.c b/src/post/deinterlace/plugins/kdetv_greedyh.c index 5ec48e4a2..2207772ca 100644 --- a/src/post/deinterlace/plugins/kdetv_greedyh.c +++ b/src/post/deinterlace/plugins/kdetv_greedyh.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/kdetv_tomsmocomp.c b/src/post/deinterlace/plugins/kdetv_tomsmocomp.c index ae0fa0363..0f87b913f 100644 --- a/src/post/deinterlace/plugins/kdetv_tomsmocomp.c +++ b/src/post/deinterlace/plugins/kdetv_tomsmocomp.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "deinterlace.h" #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/plugins/linearblend.c b/src/post/deinterlace/plugins/linearblend.c index 96e56063f..4664a4969 100644 --- a/src/post/deinterlace/plugins/linearblend.c +++ b/src/post/deinterlace/plugins/linearblend.c @@ -31,8 +31,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "speedtools.h" #include "speedy.h" #include "deinterlace.h" diff --git a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc index 5870d77be..3af46d8fa 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc +++ b/src/post/deinterlace/plugins/tomsmocomp/TomsMoCompAll.inc @@ -21,8 +21,6 @@ // See www.eff.org for details ///////////////////////////////////////////////////////////////////////////// -#include <mangle.h> - #if !defined(MASKS_DEFINED) #define MASKS_DEFINED static const int64_t __attribute__((__used__)) Max_Mov = 0x0404040404040404ull; diff --git a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h index a3b92a51c..5b81575d8 100644 --- a/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h +++ b/src/post/deinterlace/plugins/tomsmocomp/tomsmocompmacros.h @@ -2,6 +2,8 @@ #include <math.h> #include <stdlib.h> +#include <mangle.h> + #define USE_FOR_DSCALER #define MyMemCopy xine_fast_memcpy diff --git a/src/post/deinterlace/plugins/vfir.c b/src/post/deinterlace/plugins/vfir.c index e66d7c789..d66c92952 100644 --- a/src/post/deinterlace/plugins/vfir.c +++ b/src/post/deinterlace/plugins/vfir.c @@ -34,8 +34,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "speedy.h" #include "deinterlace.h" #include "plugins.h" diff --git a/src/post/deinterlace/speedy.c b/src/post/deinterlace/speedy.c index a980780d7..d93b56c7b 100644 --- a/src/post/deinterlace/speedy.c +++ b/src/post/deinterlace/speedy.c @@ -62,8 +62,8 @@ #include <stdint.h> #endif -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "speedtools.h" #include "speedy.h" diff --git a/src/post/deinterlace/xine_plugin.c b/src/post/deinterlace/xine_plugin.c index 6b6f99be6..3d14b6325 100644 --- a/src/post/deinterlace/xine_plugin.c +++ b/src/post/deinterlace/xine_plugin.c @@ -27,10 +27,10 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" -#include "xine_buffer.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> +#include <xine/xine_buffer.h> #include <pthread.h> #include "tvtime.h" @@ -47,7 +47,7 @@ static const post_info_t deinterlace_special_info = { XINE_POST_TYPE_VIDEO_FILTE const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, + { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "tvtime", XINE_VERSION_CODE, &deinterlace_special_info, &deinterlace_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -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 char *enum_pulldown[] = { "none", "vektor", NULL }; -static 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; @@ -234,7 +234,7 @@ static char * get_static_help (void) { "\n" " Chroma_filter: DVD/MPEG2 use an interlaced image format that has " "a very poor vertical chroma resolution. Upsampling the chroma for purposes " - "of deinterlacing may cause some artifacts to occur (eg. color stripes). Use " + "of deinterlacing may cause some artifacts to occur (eg. colour stripes). Use " "this option to blur the chroma vertically after deinterlacing to remove " "the artifacts. Warning: cpu intensive.\n" "\n" diff --git a/src/post/goom/goom_core.c b/src/post/goom/goom_core.c index b24f2f496..274059da4 100644 --- a/src/post/goom/goom_core.c +++ b/src/post/goom/goom_core.c @@ -26,7 +26,7 @@ #include "goom_fx.h" #include "goomsl.h" -#include "xine_internal.h" +#include <xine/xine_internal.h> /* #define VERBOSE */ diff --git a/src/post/goom/ifs.c b/src/post/goom/ifs.c index af84b777b..4c7ec75d1 100644 --- a/src/post/goom/ifs.c +++ b/src/post/goom/ifs.c @@ -64,7 +64,7 @@ IFSPoint; #define ifs_opts xlockmore_opts #define DEFAULTS "*delay: 20000 \n" \ -"*ncolors: 100 \n" +"*ncolours: 100 \n" #define SMOOTH_COLORS diff --git a/src/post/goom/mmx.h b/src/post/goom/mmx.h index 88789e86f..6861b7cfe 100644 --- a/src/post/goom/mmx.h +++ b/src/post/goom/mmx.h @@ -31,7 +31,7 @@ # include "config.h" #endif -#include "attributes.h" +#include <xine/attributes.h> #include "goom_graphic.h" diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c index 0b540694d..6971a5a1c 100644 --- a/src/post/goom/xine_goom.c +++ b/src/post/goom/xine_goom.c @@ -35,9 +35,9 @@ */ #include "config.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "goom.h" @@ -116,7 +116,7 @@ static const post_info_t goom_special_info = { const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, + { PLUGIN_POST | PLUGIN_MUST_PRELOAD, 10, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -219,8 +219,8 @@ static void *goom_init_plugin(xine_t *xine, void *data) cfg->register_enum (cfg, "effects.goom.csc_method", 0, goom_csc_methods, - _("colorspace conversion method"), - _("You can choose the colorspace conversion method used by goom.\n" + _("colour space conversion method"), + _("You can choose the colour space conversion method used by goom.\n" "The available selections should be self-explaining."), 20, csc_method_changed_cb, this); diff --git a/src/post/mosaico/mosaico.c b/src/post/mosaico/mosaico.c index ccfd641aa..6c01a66e1 100644 --- a/src/post/mosaico/mosaico.c +++ b/src/post/mosaico/mosaico.c @@ -28,8 +28,8 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* FIXME: This plugin needs to handle overlays as well. */ @@ -41,7 +41,7 @@ static const post_info_t mosaico_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE } const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, + { PLUGIN_POST, 10, "mosaico", XINE_VERSION_CODE, &mosaico_special_info, &mosaico_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -96,7 +96,6 @@ struct post_mosaico_s { static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void mosaico_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void mosaico_dispose(post_plugin_t *this_gen); @@ -128,7 +127,7 @@ static void *mosaico_init_plugin(xine_t *xine, void *data) this->class.open_plugin = mosaico_open_plugin; this->class.identifier = "mosaico"; this->class.description = N_("Mosaico is a picture in picture (pip) post plugin"); - this->class.dispose = mosaico_class_dispose; + this->class.dispose = default_post_class_dispose; this->xine = xine; return &this->class; @@ -200,12 +199,6 @@ static post_plugin_t *mosaico_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void mosaico_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void mosaico_dispose(post_plugin_t *this_gen) { post_mosaico_t *this = (post_mosaico_t *)this_gen; diff --git a/src/post/mosaico/switch.c b/src/post/mosaico/switch.c index 19e563680..a4de02715 100644 --- a/src/post/mosaico/switch.c +++ b/src/post/mosaico/switch.c @@ -28,8 +28,8 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* FIXME: This plugin needs to handle overlays as well. */ @@ -41,7 +41,7 @@ static const post_info_t switch_special_info = { XINE_POST_TYPE_VIDEO_COMPOSE }; const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, + { PLUGIN_POST, 10, "switch", XINE_VERSION_CODE, &switch_special_info, &switch_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; @@ -82,7 +82,6 @@ struct post_switch_s { static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void switch_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void switch_dispose(post_plugin_t *this_gen); @@ -107,7 +106,7 @@ static void *switch_init_plugin(xine_t *xine, void *data) this->class.open_plugin = switch_open_plugin; this->class.identifier = "switch"; this->class.description = N_("Switch is a post plugin able to switch at any time between different streams"); - this->class.dispose = switch_class_dispose; + this->class.dispose = default_post_class_dispose; this->xine = xine; return &this->class; @@ -166,12 +165,6 @@ static post_plugin_t *switch_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void switch_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void switch_dispose(post_plugin_t *this_gen) { post_switch_t *this = (post_switch_t *)this_gen; diff --git a/src/post/planar/boxblur.c b/src/post/planar/boxblur.c index 66af08e5c..988729af0 100644 --- a/src/post/planar/boxblur.c +++ b/src/post/planar/boxblur.c @@ -21,9 +21,9 @@ * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> /* plugin class initialization function */ @@ -120,7 +120,6 @@ static xine_post_api_t post_api = { static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void boxblur_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void boxblur_dispose(post_plugin_t *this_gen); @@ -134,7 +133,7 @@ static int boxblur_draw(vo_frame_t *frame, xine_stream_t *stream); void *boxblur_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -142,7 +141,7 @@ void *boxblur_init_plugin(xine_t *xine, void *data) class->open_plugin = boxblur_open_plugin; class->identifier = "boxblur"; class->description = N_("box blur filter from mplayer"); - class->dispose = boxblur_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -192,12 +191,6 @@ static post_plugin_t *boxblur_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void boxblur_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void boxblur_dispose(post_plugin_t *this_gen) { post_plugin_boxblur_t *this = (post_plugin_boxblur_t *)this_gen; diff --git a/src/post/planar/denoise3d.c b/src/post/planar/denoise3d.c index 647ab075e..bec59b35f 100644 --- a/src/post/planar/denoise3d.c +++ b/src/post/planar/denoise3d.c @@ -21,9 +21,9 @@ * Copyright (C) 2003 Daniel Moreno <comac@comac.darktech.org> */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> @@ -157,7 +157,6 @@ static xine_post_api_t post_api = { static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void denoise3d_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void denoise3d_dispose(post_plugin_t *this_gen); @@ -174,7 +173,7 @@ static int denoise3d_draw(vo_frame_t *frame, xine_stream_t *stream); void *denoise3d_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -182,7 +181,7 @@ void *denoise3d_init_plugin(xine_t *xine, void *data) class->open_plugin = denoise3d_open_plugin; class->identifier = "denoise3d"; class->description = N_("3D Denoiser (variable lowpass filter)"); - class->dispose = denoise3d_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -235,12 +234,6 @@ static post_plugin_t *denoise3d_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void denoise3d_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void denoise3d_dispose(post_plugin_t *this_gen) { post_plugin_denoise3d_t *this = (post_plugin_denoise3d_t *)this_gen; diff --git a/src/post/planar/eq.c b/src/post/planar/eq.c index cb28cafa2..e62a808c1 100644 --- a/src/post/planar/eq.c +++ b/src/post/planar/eq.c @@ -21,9 +21,9 @@ * Copyright (C) Richard Felker */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> @@ -208,7 +208,6 @@ static xine_post_api_t post_api = { static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void eq_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void eq_dispose(post_plugin_t *this_gen); @@ -226,7 +225,7 @@ static int eq_draw(vo_frame_t *frame, xine_stream_t *stream); void *eq_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -234,7 +233,7 @@ void *eq_init_plugin(xine_t *xine, void *data) class->open_plugin = eq_open_plugin; class->identifier = "eq"; class->description = N_("soft video equalizer"); - class->dispose = eq_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -290,12 +289,6 @@ static post_plugin_t *eq_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void eq_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void eq_dispose(post_plugin_t *this_gen) { post_plugin_eq_t *this = (post_plugin_eq_t *)this_gen; diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 277aca00e..42f4580d9 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -25,9 +25,9 @@ * Richard Felker (original MMX contrast/brightness code (vf_eq.c)) */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> @@ -389,7 +389,6 @@ static xine_post_api_t post_api = { static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void eq2_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void eq2_dispose(post_plugin_t *this_gen); @@ -407,7 +406,7 @@ static int eq2_draw(vo_frame_t *frame, xine_stream_t *stream); void *eq2_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -415,7 +414,7 @@ void *eq2_init_plugin(xine_t *xine, void *data) class->open_plugin = eq2_open_plugin; class->identifier = "eq2"; class->description = N_("Software video equalizer"); - class->dispose = eq2_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -487,12 +486,6 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void eq2_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void eq2_dispose(post_plugin_t *this_gen) { post_plugin_eq2_t *this = (post_plugin_eq2_t *)this_gen; diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c index df5fa874e..90547163f 100644 --- a/src/post/planar/expand.c +++ b/src/post/planar/expand.c @@ -27,8 +27,8 @@ * */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* The expand trick explained: * @@ -100,7 +100,6 @@ typedef struct post_expand_s { static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void expand_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void expand_dispose(post_plugin_t *this_gen); @@ -128,7 +127,7 @@ static int32_t expand_overlay_add_event(video_overlay_manager_t *this_gen void *expand_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -136,7 +135,7 @@ void *expand_init_plugin(xine_t *xine, void *data) class->open_plugin = expand_open_plugin; class->identifier = "expand"; class->description = N_("add black borders to top and bottom of video to expand it to 4:3 aspect ratio"); - class->dispose = expand_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -189,12 +188,6 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void expand_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void expand_dispose(post_plugin_t *this_gen) { post_expand_t *this = (post_expand_t *)this_gen; diff --git a/src/post/planar/fill.c b/src/post/planar/fill.c index 14bd55102..6dd5ce23b 100644 --- a/src/post/planar/fill.c +++ b/src/post/planar/fill.c @@ -22,8 +22,8 @@ * based on invert.c */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* plugin class initialization function */ void *fill_init_plugin(xine_t *xine, void *); @@ -32,7 +32,6 @@ void *fill_init_plugin(xine_t *xine, void *); static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void fill_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void fill_dispose(post_plugin_t *this_gen); @@ -46,7 +45,7 @@ static int fill_draw(vo_frame_t *frame, xine_stream_t *stream); void *fill_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -54,7 +53,7 @@ void *fill_init_plugin(xine_t *xine, void *data) class->open_plugin = fill_open_plugin; class->identifier = "fill"; class->description = N_("crops left and right of video to fill 4:3 aspect ratio"); - class->dispose = fill_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -90,11 +89,6 @@ static post_plugin_t *fill_open_plugin(post_class_t *class_gen, int inputs, return this; } -static void fill_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - static void fill_dispose(post_plugin_t *this) { if (_x_post_dispose(this)) diff --git a/src/post/planar/invert.c b/src/post/planar/invert.c index dd1d7ac07..8c1b6103a 100644 --- a/src/post/planar/invert.c +++ b/src/post/planar/invert.c @@ -22,8 +22,8 @@ * simple video inverter plugin */ -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> /* plugin class initialization function */ @@ -33,7 +33,6 @@ void *invert_init_plugin(xine_t *xine, void *); static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void invert_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void invert_dispose(post_plugin_t *this_gen); @@ -47,7 +46,7 @@ static int invert_draw(vo_frame_t *frame, xine_stream_t *stream); void *invert_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -55,7 +54,7 @@ void *invert_init_plugin(xine_t *xine, void *data) class->open_plugin = invert_open_plugin; class->identifier = "invert"; class->description = N_("inverts the colours of every video frame"); - class->dispose = invert_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -89,12 +88,6 @@ static post_plugin_t *invert_open_plugin(post_class_t *class_gen, int inputs, return this; } -static void invert_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void invert_dispose(post_plugin_t *this) { if (_x_post_dispose(this)) diff --git a/src/post/planar/noise.c b/src/post/planar/noise.c index 53dc3065d..efc3e49f8 100644 --- a/src/post/planar/noise.c +++ b/src/post/planar/noise.c @@ -21,9 +21,9 @@ * is copyright 2002 Michael Niedermayer <michaelni@gmx.at> */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <math.h> #include <pthread.h> @@ -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 @@ -429,7 +429,6 @@ static xine_post_api_t post_api = { static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void noise_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void noise_dispose(post_plugin_t *this_gen); @@ -443,7 +442,7 @@ static int noise_draw(vo_frame_t *frame, xine_stream_t *stream); void *noise_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -451,7 +450,7 @@ void *noise_init_plugin(xine_t *xine, void *data) class->open_plugin = noise_open_plugin; class->identifier = "noise"; class->description = N_("Adds noise"); - class->dispose = noise_class_dispose; + class->dispose = default_post_class_dispose; #ifdef ARCH_X86 if (xine_mm_accel() & MM_ACCEL_X86_MMX) { @@ -513,12 +512,6 @@ static post_plugin_t *noise_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void noise_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void noise_dispose(post_plugin_t *this_gen) { post_plugin_noise_t *this = (post_plugin_noise_t *)this_gen; diff --git a/src/post/planar/planar.c b/src/post/planar/planar.c index 5907d58e5..1d0c59254 100644 --- a/src/post/planar/planar.c +++ b/src/post/planar/planar.c @@ -20,9 +20,9 @@ * catalog for planar post plugins */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> extern void *invert_init_plugin(xine_t *xine, void *); static const post_info_t invert_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; @@ -56,15 +56,15 @@ static const post_info_t noise_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, - { PLUGIN_POST, 9, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, - { PLUGIN_POST, 9, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, - { PLUGIN_POST, 9, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, - { PLUGIN_POST, 9, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, - { PLUGIN_POST, 9, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, - { PLUGIN_POST, 9, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, - { PLUGIN_POST, 9, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, - { PLUGIN_POST, 9, "pp", XINE_VERSION_CODE, &pp_special_info, &pp_init_plugin }, - { PLUGIN_POST, 9, "noise", XINE_VERSION_CODE, &noise_special_info, &noise_init_plugin }, + { PLUGIN_POST, 10, "expand", XINE_VERSION_CODE, &expand_special_info, &expand_init_plugin }, + { PLUGIN_POST, 10, "fill", XINE_VERSION_CODE, &fill_special_info, &fill_init_plugin }, + { PLUGIN_POST, 10, "invert", XINE_VERSION_CODE, &invert_special_info, &invert_init_plugin }, + { PLUGIN_POST, 10, "eq", XINE_VERSION_CODE, &eq_special_info, &eq_init_plugin }, + { PLUGIN_POST, 10, "denoise3d", XINE_VERSION_CODE, &denoise3d_special_info, &denoise3d_init_plugin }, + { PLUGIN_POST, 10, "boxblur", XINE_VERSION_CODE, &boxblur_special_info, &boxblur_init_plugin }, + { PLUGIN_POST, 10, "eq2", XINE_VERSION_CODE, &eq2_special_info, &eq2_init_plugin }, + { PLUGIN_POST, 10, "unsharp", XINE_VERSION_CODE, &unsharp_special_info, &unsharp_init_plugin }, + { PLUGIN_POST, 10, "pp", XINE_VERSION_CODE, &pp_special_info, &pp_init_plugin }, + { PLUGIN_POST, 10, "noise", XINE_VERSION_CODE, &noise_special_info, &noise_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 22a25fc90..f8c571dcb 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -20,9 +20,11 @@ * plugin for ffmpeg libpostprocess */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <config.h> + +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include "postprocess.h" #include <pthread.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; } @@ -135,7 +132,6 @@ static xine_post_api_t post_api = { static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void pp_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void pp_dispose(post_plugin_t *this_gen); @@ -149,7 +145,7 @@ static int pp_draw(vo_frame_t *frame, xine_stream_t *stream); void *pp_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -157,7 +153,7 @@ void *pp_init_plugin(xine_t *xine, void *data) class->open_plugin = pp_open_plugin; class->identifier = "pp"; class->description = N_("plugin for ffmpeg libpostprocess"); - class->dispose = pp_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -219,12 +215,6 @@ static post_plugin_t *pp_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void pp_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - - static void pp_dispose(post_plugin_t *this_gen) { post_plugin_pp_t *this = (post_plugin_pp_t *)this_gen; diff --git a/src/post/planar/unsharp.c b/src/post/planar/unsharp.c index b850b05b7..591f32a7b 100644 --- a/src/post/planar/unsharp.c +++ b/src/post/planar/unsharp.c @@ -21,9 +21,9 @@ * Copyright (C) 2002 Rémi Guyomarch <rguyom@pobox.com> */ -#include "xine_internal.h" -#include "post.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include <xine/xineutils.h> #include <pthread.h> #ifndef MIN @@ -253,7 +253,6 @@ static xine_post_api_t post_api = { static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, xine_audio_port_t **audio_target, xine_video_port_t **video_target); -static void unsharp_class_dispose(post_class_t *class_gen); /* plugin instance functions */ static void unsharp_dispose(post_plugin_t *this_gen); @@ -267,7 +266,7 @@ static int unsharp_draw(vo_frame_t *frame, xine_stream_t *stream); void *unsharp_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof(post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof(post_class_t)); if (!class) return NULL; @@ -275,7 +274,7 @@ void *unsharp_init_plugin(xine_t *xine, void *data) class->open_plugin = unsharp_open_plugin; class->identifier = "unsharp"; class->description = N_("unsharp mask & gaussian blur"); - class->dispose = unsharp_class_dispose; + class->dispose = default_post_class_dispose; return class; } @@ -330,11 +329,6 @@ static post_plugin_t *unsharp_open_plugin(post_class_t *class_gen, int inputs, return &this->post; } -static void unsharp_class_dispose(post_class_t *class_gen) -{ - free(class_gen); -} - static void unsharp_free_SC(post_plugin_unsharp_t *this) { int i; diff --git a/src/post/visualizations/fft.c b/src/post/visualizations/fft.c index e9a99911a..01044987b 100644 --- a/src/post/visualizations/fft.c +++ b/src/post/visualizations/fft.c @@ -184,18 +184,6 @@ double fft_amp (int n, complex_t wave[], int bits) } /* - * Calculate phase of component n in the decimated wave[] array. - */ -double fft_phase (int n, complex_t wave[], int bits) -{ - n = PERMUTE (n, bits); - if (REAL(n) != 0.0) - return (atan (IMAG(n) / REAL(n))); - else - return (0.0); -} - -/* * Scale sampled values. * Do this *before* the fft. */ diff --git a/src/post/visualizations/fft.h b/src/post/visualizations/fft.h index dff3cd7e8..1600430bc 100644 --- a/src/post/visualizations/fft.h +++ b/src/post/visualizations/fft.h @@ -44,7 +44,6 @@ void fft_compute (fft_t *fft, complex_t wave[]); void fft_window (fft_t *fft, complex_t wave[]); double fft_amp (int n, complex_t wave[], int bits); -double fft_phase (int n, complex_t wave[], int bits); void fft_scale (complex_t wave[], int bits); #endif /* FFT_H */ diff --git a/src/post/visualizations/fftgraph.c b/src/post/visualizations/fftgraph.c index 7e7f52fbf..39d17c730 100644 --- a/src/post/visualizations/fftgraph.c +++ b/src/post/visualizations/fftgraph.c @@ -26,9 +26,9 @@ #include <assert.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "bswap.h" #include "visualizations.h" #include "fft.h" @@ -455,7 +455,7 @@ static post_plugin_t *fftgraph_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *fftgraph_init_plugin(xine_t *xine, void *data) { - post_class_fftgraph_t *class = (post_class_fftgraph_t *)malloc(sizeof(post_class_fftgraph_t)); + post_class_fftgraph_t *class = (post_class_fftgraph_t *)xine_xmalloc(sizeof(post_class_fftgraph_t)); if (!class) return NULL; diff --git a/src/post/visualizations/fftscope.c b/src/post/visualizations/fftscope.c index 917af508d..1a9ea905a 100644 --- a/src/post/visualizations/fftscope.c +++ b/src/post/visualizations/fftscope.c @@ -26,9 +26,9 @@ #include <stdio.h> #include <math.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "bswap.h" #include "visualizations.h" #include "fft.h" @@ -476,7 +476,7 @@ static post_plugin_t *fftscope_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *fftscope_init_plugin(xine_t *xine, void *data) { - post_class_fftscope_t *class = (post_class_fftscope_t *)malloc(sizeof(post_class_fftscope_t)); + post_class_fftscope_t *class = (post_class_fftscope_t *)xine_xmalloc(sizeof(post_class_fftscope_t)); if (!class) return NULL; diff --git a/src/post/visualizations/fooviz.c b/src/post/visualizations/fooviz.c index 78803f8d2..3e5702168 100644 --- a/src/post/visualizations/fooviz.c +++ b/src/post/visualizations/fooviz.c @@ -26,9 +26,9 @@ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #define FPS 20 @@ -287,7 +287,7 @@ static post_plugin_t *fooviz_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ static void *fooviz_init_plugin(xine_t *xine, void *data) { - post_class_fooviz_t *class = (post_class_fooviz_t *)malloc(sizeof(post_class_fooviz_t)); + post_class_fooviz_t *class = (post_class_fooviz_t *)xine_xmalloc(sizeof(post_class_fooviz_t)); if (!class) return NULL; @@ -307,6 +307,6 @@ static const post_info_t fooviz_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZAT const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, + { PLUGIN_POST, 10, "fooviz", XINE_VERSION_CODE, &fooviz_special_info, &fooviz_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/oscope.c b/src/post/visualizations/oscope.c index 86b8b2750..7c9faeeaa 100644 --- a/src/post/visualizations/oscope.c +++ b/src/post/visualizations/oscope.c @@ -23,9 +23,9 @@ #include <stdio.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/post.h> #include "visualizations.h" #define FPS 20 @@ -358,7 +358,7 @@ static post_plugin_t *oscope_open_plugin(post_class_t *class_gen, int inputs, /* plugin class initialization function */ void *oscope_init_plugin(xine_t *xine, void *data) { - post_class_oscope_t *class = (post_class_oscope_t *)malloc(sizeof(post_class_oscope_t)); + post_class_oscope_t *class = (post_class_oscope_t *)xine_xmalloc(sizeof(post_class_oscope_t)); if (!class) return NULL; diff --git a/src/post/visualizations/visualizations.c b/src/post/visualizations/visualizations.c index a26f0bd5b..17c8491d5 100644 --- a/src/post/visualizations/visualizations.c +++ b/src/post/visualizations/visualizations.c @@ -24,8 +24,8 @@ #include "config.h" #endif -#include "xine_internal.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/post.h> #include "visualizations.h" @@ -46,8 +46,8 @@ static const post_info_t fftgraph_special_info = { XINE_POST_TYPE_AUDIO_VISUALIZ const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, - { PLUGIN_POST, 9, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, - { PLUGIN_POST, 9, "fftgraph", XINE_VERSION_CODE, &fftgraph_special_info, &fftgraph_init_plugin }, + { PLUGIN_POST, 10, "oscope", XINE_VERSION_CODE, &oscope_special_info, &oscope_init_plugin }, + { PLUGIN_POST, 10, "fftscope", XINE_VERSION_CODE, &fftscope_special_info, &fftscope_init_plugin }, + { PLUGIN_POST, 10, "fftgraph", XINE_VERSION_CODE, &fftgraph_special_info, &fftgraph_init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/post/visualizations/visualizations.h b/src/post/visualizations/visualizations.h index 39d02e1cb..c72a1ad77 100644 --- a/src/post/visualizations/visualizations.h +++ b/src/post/visualizations/visualizations.h @@ -20,7 +20,7 @@ * This file contains plugin entries for several visualization post plugins. */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *oscope_init_plugin(xine_t *xine, void *data); void *fftscope_init_plugin(xine_t *xine, void *data); diff --git a/src/spu_dec/Makefile.am b/src/spu_dec/Makefile.am new file mode 100644 index 000000000..2511fc99d --- /dev/null +++ b/src/spu_dec/Makefile.am @@ -0,0 +1,36 @@ +include $(top_srcdir)/misc/Makefile.common + +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) +AM_LDFLAGS = $(xineplug_ldflags) + +xineplug_LTLIBRARIES = \ + xineplug_decode_spucc.la \ + xineplug_decode_spucmml.la \ + xineplug_decode_spu.la \ + xineplug_decode_spudvb.la \ + xineplug_sputext.la + +xineplug_decode_spucc_la_SOURCES = cc_decoder.c cc_decoder.h xine_cc_decoder.c +xineplug_decode_spucc_la_LIBADD = $(XINE_LIB) +xineplug_decode_spucc_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing + +xineplug_decode_spucmml_la_SOURCES = cmml_decoder.c +xineplug_decode_spucmml_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) + +if WITH_EXTERNAL_DVDNAV +external_dvdnav_libs = $(DVDNAV_LIBS) +internal_dvdnav_sources = +else +external_dvdnav_libs = +internal_dvdnav_sources = nav_read.c +endif + +xineplug_decode_spu_la_SOURCES = $(internal_dvdnav_sources) spudec.c spudec.h spu_decoder.c +xineplug_decode_spu_la_LIBADD = $(XINE_LIB) $(external_dvdnav_libs) $(PTHREAD_LIBS) +xineplug_decode_spu_la_CFLAGS = $(AM_CFLAGS) $(DVDNAV_CFLAGS) -I$(top_srcdir)/src/input/libdvdnav + +xineplug_decode_spudvb_la_SOURCES = spudvb_decoder.c +xineplug_decode_spudvb_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) + +xineplug_sputext_la_SOURCES = sputext_demuxer.c sputext_decoder.c +xineplug_sputext_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) diff --git a/src/libspucc/cc_decoder.c b/src/spu_dec/cc_decoder.c index 8d666e847..c0e0e4930 100644 --- a/src/libspucc/cc_decoder.c +++ b/src/spu_dec/cc_decoder.c @@ -35,12 +35,12 @@ #include <inttypes.h> -#include "xine_internal.h" -#include "video_out.h" -#include "xineutils.h" -#include "osd.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/xineutils.h> +#include <xine/osd.h> #include "cc_decoder.h" -#include "osd.h" +#include <xine/osd.h> /* #define LOG_DEBUG 3 @@ -230,13 +230,103 @@ static const char specialchar[] = { 234 /* ê */, 238 /* î */, 244 /* ô */, 251 /* û */ }; -/* character translation table - EIA 608 codes are not all the same as ASCII */ -static char chartbl[128]; - -/* CC codes use odd parity for error detection, since they originally were */ -/* transmitted via noisy video signals */ -static int parity_table[256]; +/** + * @brief Character translation table + * + * EIA 608 codes are not all the same as ASCII + * + * The code to produce the characters table would be the following: + * + * static void build_char_table(void) + * { + * int i; + * // first the normal ASCII codes + * for (i = 0; i < 128; i++) + * chartbl[i] = (char) i; + * // now the special codes + * chartbl[0x2a] = 225; // á + * chartbl[0x5c] = 233; // é + * chartbl[0x5e] = 237; // à + * chartbl[0x5f] = 243; // ó + * chartbl[0x60] = 250; // ú + * chartbl[0x7b] = 231; // ç + * chartbl[0x7c] = 247; // ÷ + * chartbl[0x7d] = 209; // Ñ + * chartbl[0x7e] = 241; // ñ + * chartbl[0x7f] = 164; // ¤ FIXME: should be a solid block ('â–ˆ'; U+2588) + * } + * + */ +static const int chartbl[128] = { + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', + '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', + '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', + '\x28', '\x29', '\xe1', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', + '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', + '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', + '\x58', '\x59', '\x5a', '\x5b', '\xe9', '\x5d', '\xed', '\xf3', + '\xfa', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', + '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', + '\x78', '\x79', '\x7a', '\xe7', '\xf7', '\xd1', '\xf1', '\xa4' +}; +/** + * @brief Parity table for packets + * + * CC codes use odd parity for error detection, since they originally were + * transmitted via noisy video signals. + * + * The code to produce the parity table would be the following: + * + * static int parity(uint8_t byte) + * { + * int i; + * int ones = 0; + * + * for (i = 0; i < 7; i++) { + * if (byte & (1 << i)) + * ones++; + * } + * + * return ones & 1; + * } + * + * static void build_parity_table(void) + * { + * uint8_t byte; + * int parity_v; + * for (byte = 0; byte <= 127; byte++) { + * parity_v = parity(byte); + * // CC uses odd parity (i.e., # of 1's in byte is odd.) + * parity_table[byte] = parity_v; + * parity_table[byte | 0x80] = !parity_v; + * } + * } + */ +static const int parity_table[256] = { + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, + 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 +}; /*---------------- decoder data structures -----------------------*/ @@ -373,10 +463,7 @@ static void get_font_metrics(osd_renderer_t *renderer, renderer->set_encoding(testc, "iso-8859-1"); for (c = 32; c < 256; c++) { int tw, th; - char buf[2]; - - buf[0] = (char)c; - buf[1] = '\0'; + const char buf[2] = { c, '\0' }; renderer->get_text_size(testc, buf, &tw, &th); *maxw = MAX(*maxw, tw); @@ -386,33 +473,6 @@ static void get_font_metrics(osd_renderer_t *renderer, } -static int parity(uint8_t byte) -{ - int i; - int ones = 0; - - for (i = 0; i < 7; i++) { - if (byte & (1 << i)) - ones++; - } - - return ones & 1; -} - - -static void build_parity_table(void) -{ - uint8_t byte; - int parity_v; - for (byte = 0; byte <= 127; byte++) { - parity_v = parity(byte); - /* CC uses odd parity (i.e., # of 1's in byte is odd.) */ - parity_table[byte] = parity_v; - parity_table[byte | 0x80] = !parity_v; - } -} - - static int good_parity(uint16_t data) { int ret = parity_table[data & 0xff] && parity_table[(data & 0xff00) >> 8]; @@ -422,24 +482,6 @@ static int good_parity(uint16_t data) } -static void build_char_table(void) -{ - int i; - /* first the normal ASCII codes */ - for (i = 0; i < 128; i++) - chartbl[i] = (char) i; - /* now the special codes */ - chartbl[0x2a] = 225; /* á */ - chartbl[0x5c] = 233; /* é */ - chartbl[0x5e] = 237; /* à */ - chartbl[0x5f] = 243; /* ó */ - chartbl[0x60] = 250; /* ú */ - chartbl[0x7b] = 231; /* ç */ - chartbl[0x7c] = 247; /* ÷ */ - chartbl[0x7d] = 209; /* Ñ */ - chartbl[0x7e] = 241; /* ñ */ - chartbl[0x7f] = 164; /* ¤ FIXME: should be a solid block ('â–ˆ'; U+2588) */ -} static clut_t interpolate_color(clut_t src, clut_t dest, int steps, @@ -658,12 +700,11 @@ static void ccrow_render(cc_renderer_t *renderer, cc_row_t *this, int rownum) static int ccbuf_has_displayable(cc_buffer_t *this) { int i; - int found = 0; - for (i = 0; !found && i < CC_ROWS; i++) { + for (i = 0; i < CC_ROWS; i++) if (this->rows[i].num_chars > 0) - found = 1; - } - return found; + return 1; + + return 0; } @@ -855,11 +896,11 @@ static int cc_renderer_on_display(cc_renderer_t *this) static void cc_renderer_hide_caption(cc_renderer_t *this, int64_t vpts) { - if (this->displayed) { - this->osd_renderer->hide(this->cap_display, vpts); - this->displayed = 0; - this->last_hide_vpts = vpts; - } + if ( ! this->displayed ) return; + + this->osd_renderer->hide(this->cap_display, vpts); + this->displayed = 0; + this->last_hide_vpts = vpts; } @@ -891,11 +932,11 @@ static void cc_renderer_show_caption(cc_renderer_t *this, cc_buffer_t *buf, static void cc_renderer_free_osd_object(cc_renderer_t *this) { /* hide and free old displayed caption object if necessary */ - if (this->cap_display) { - cc_renderer_hide_caption(this, this->display_vpts); - this->osd_renderer->free_object(this->cap_display); - this->cap_display = NULL; - } + if ( ! this->cap_display ) return; + + cc_renderer_hide_caption(this, this->display_vpts); + this->osd_renderer->free_object(this->cap_display); + this->cap_display = NULL; } @@ -1472,13 +1513,3 @@ void cc_decoder_close(cc_decoder_t *this) printf("spucc: cc_decoder_close\n"); #endif } - - -/*--------------- initialization methods --------------------------*/ - -void cc_decoder_init(void) -{ - build_parity_table(); - build_char_table(); -} - diff --git a/src/libspucc/cc_decoder.h b/src/spu_dec/cc_decoder.h index 8698189a6..a1130953f 100644 --- a/src/libspucc/cc_decoder.h +++ b/src/spu_dec/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 @@ -68,7 +68,6 @@ typedef struct cc_state_s { cc_decoder_t *cc_decoder_open(cc_state_t *cc_state); void cc_decoder_close(cc_decoder_t *this_obj); -void cc_decoder_init(void); void decode_cc(cc_decoder_t *this, uint8_t *buffer, uint32_t buf_len, int64_t pts); diff --git a/src/libspucmml/xine_cmml_decoder.c b/src/spu_dec/cmml_decoder.c index 6c045ee04..e63dc561d 100644 --- a/src/libspucmml/xine_cmml_decoder.c +++ b/src/spu_dec/cmml_decoder.c @@ -30,7 +30,7 @@ #define SUB_BUFSIZE 1024 #define SUB_MAX_TEXT 5 -#include "xine_internal.h" +#include <xine/xine_internal.h> typedef enum { SUBTITLE_SIZE_SMALL = 0, @@ -88,13 +88,13 @@ static void video_frame_format_change_callback (void *user_data, const xine_even static void update_font_size (spucmml_decoder_t *this) { - static int sizes[SUBTITLE_SIZE_NUM][4] = { + static const int sizes[SUBTITLE_SIZE_NUM][4] = { { 16, 16, 16, 20 }, /* SUBTITLE_SIZE_SMALL */ { 16, 16, 20, 24 }, /* SUBTITLE_SIZE_NORMAL */ { 16, 20, 24, 32 }, /* SUBTITLE_SIZE_LARGE */ }; - int *vec = sizes[this->subtitle_size]; + const int *vec = sizes[this->subtitle_size]; int y; if( this->cached_width >= 512 ) @@ -522,7 +522,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_CMML, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_CMML, 0 }; static const decoder_info_t spudec_info = { supported_types, /* supported types */ diff --git a/src/libspudec/nav_read.c b/src/spu_dec/nav_read.c index 5244bfdd6..5244bfdd6 100644 --- a/src/libspudec/nav_read.c +++ b/src/spu_dec/nav_read.c diff --git a/src/libspudec/xine_spu_decoder.c b/src/spu_dec/spu_decoder.c index 93ea3c3a2..c4cf3ae78 100644 --- a/src/libspudec/xine_spu_decoder.c +++ b/src/spu_dec/spu_decoder.c @@ -29,11 +29,10 @@ #include <sys/stat.h> #include <fcntl.h> -#include "xine_internal.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/buffer.h> #include "xine-engine/bswap.h" -#include "xineutils.h" -#include "spu.h" +#include <xine/xineutils.h> #ifdef HAVE_DVDNAV # include <dvdnav/nav_read.h> # include <dvdnav/nav_types.h> @@ -42,6 +41,8 @@ # include "nav_types.h" #endif +#include "spudec.h" + /* #define LOG_DEBUG 1 #define LOG_BUTTON 1 @@ -366,7 +367,7 @@ static void *init_plugin (xine_t *xine, void *data) { } /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_DVD, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_DVD, 0 }; static const decoder_info_t dec_info_data = { supported_types, /* supported types */ diff --git a/src/libspudec/spu.c b/src/spu_dec/spudec.c index ce3497ef0..3e8cd8a07 100644 --- a/src/libspudec/spu.c +++ b/src/spu_dec/spudec.c @@ -47,10 +47,9 @@ #include <sys/types.h> #include <fcntl.h> -#include "xine_internal.h" -#include "xineutils.h" -#include "spu.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/buffer.h> #include "xine-engine/bswap.h" #ifdef HAVE_DVDNAV # include <dvdnav/nav_read.h> @@ -60,6 +59,7 @@ # include "nav_print.h" #endif +#include "spudec.h" /* #define LOG_DEBUG 1 @@ -871,15 +871,14 @@ static void spudec_discover_clut(xine_t *xine, spudec_state_t *state, vo_overlay int n,i; rle_elem_t *rle; - int found[2][16]; + int found[2][16] = { { 0, }, }; - static clut_t text_clut[] = { + static const clut_t text_clut[] = { CLUT_Y_CR_CB_INIT(0x80, 0x90, 0x80), CLUT_Y_CR_CB_INIT(0x00, 0x90, 0x00), CLUT_Y_CR_CB_INIT(0xff, 0x90, 0x00) }; - memset(found,0,sizeof(found)); rle = ovl->rle; /* this seems to be a problem somewhere else, @@ -1010,7 +1009,7 @@ int spudec_copy_nav_to_overlay(xine_t *xine, pci_t* nav_pci, uint32_t* clut, #endif for (i = 0;i < 4; i++) { #ifdef LOG_BUTTON - printf("libspudec:btn_coln = 0, hili_color = color\n"); + printf("libspudec:btn_coln = 0, hili_color = colour\n"); #endif overlay->hili_color[i] = overlay->color[i]; overlay->hili_trans[i] = overlay->trans[i]; diff --git a/src/libspudec/spu.h b/src/spu_dec/spudec.h index 8d92146f0..1e7d80596 100644 --- a/src/libspudec/spu.h +++ b/src/spu_dec/spudec.h @@ -30,8 +30,8 @@ #endif #include <inttypes.h> -#include "video_out.h" -#include "video_overlay.h" +#include <xine/video_out.h> +#include <xine/video_overlay.h> #ifdef HAVE_DVDNAV # include <dvdnav/nav_types.h> #else diff --git a/src/libspudvb/xine_spudvb_decoder.c b/src/spu_dec/spudvb_decoder.c index 59790227c..331c9835d 100644 --- a/src/libspudvb/xine_spudvb_decoder.c +++ b/src/spu_dec/spudvb_decoder.c @@ -27,9 +27,9 @@ #include "pthread.h" #include <errno.h> -#include "xine_internal.h" -#include "spu.h" -#include "osd.h" +#include <xine/xine_internal.h> +#include <xine/spu.h> +#include <xine/osd.h> #define MAX_REGIONS 7 /*#define LOG 1*/ @@ -984,7 +984,7 @@ static void *init_spu_decoder_plugin (xine_t * xine, void *data) /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_DVB, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_DVB, 0 }; static const decoder_info_t spudec_info = { supported_types, /* supported types */ diff --git a/src/libsputext/xine_sputext_decoder.c b/src/spu_dec/sputext_decoder.c index f67fd7a7e..0cc0ee21b 100644 --- a/src/libsputext/xine_sputext_decoder.c +++ b/src/spu_dec/sputext_decoder.c @@ -33,17 +33,37 @@ #define LOG */ -#include "buffer.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "osd.h" +#include <xine/buffer.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/osd.h> #define SUB_MAX_TEXT 5 /* lines */ #define SUB_BUFSIZE 256 /* chars per line */ +/* alignment in SSA codes */ +#define ALIGN_LEFT 1 +#define ALIGN_CENTER 2 +#define ALIGN_RIGHT 3 +#define ALIGN_BOTTOM 0 +#define ALIGN_TOP 4 +#define ALIGN_MIDDLE 8 +#define GET_X_ALIGNMENT(a) ((a) & 3) +#define GET_Y_ALIGNMENT(a) ((a) - ((a) & 3)) + +/* subtitles projection */ +/* for subrip file with SSA tags, those values are always correct.*/ +/* But for SSA files, those values are the default ones. we have */ +/* to use PlayResX and PlayResY defined in [Script Info] section. */ +/* not implemented yet... */ +#define SPU_PROJECTION_X 384 +#define SPU_PROJECTION_Y 288 + + + #define rgb2yuv(R,G,B) ((((((66*R+129*G+25*B+128)>>8)+16)<<8)|(((112*R-94*G-18*B+128)>>8)+128))<<8|(((-38*R-74*G+112*B+128)>>8)+128)) -static uint32_t sub_palette[22]={ +static const uint32_t sub_palette[22]={ /* RED */ rgb2yuv(0,0,0), rgb2yuv(0,0,0), @@ -70,7 +90,7 @@ static uint32_t sub_palette[22]={ rgb2yuv(0,170,255) }; -static uint8_t sub_trans[22]={ +static const uint8_t sub_trans[22]={ 0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15, 0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15 }; @@ -106,6 +126,15 @@ typedef struct sputext_class_s { } sputext_class_t; +/* Convert subtiles coordinates in window coordinates. */ +/* (a, b) --> (x + a * dx, y + b * dy) */ +typedef struct video2wnd_s { + int x; + int y; + double dx; + double dy; +} video2wnd_t; + typedef struct sputext_decoder_s { spu_decoder_t spu_decoder; @@ -141,7 +170,9 @@ typedef struct sputext_decoder_s { int64_t last_subtitle_end; /* no new subtitle before this vpts */ int unscaled; /* use unscaled OSD */ + int last_y; /* location of the previous subtitle */ int last_lines; /* number of lines of the previous subtitle */ + video2wnd_t video2wnd; } sputext_decoder_t; static inline char *get_font (sputext_class_t *class) @@ -156,8 +187,6 @@ static inline char *get_font (sputext_class_t *class) static void update_font_size (sputext_decoder_t *this, int force_update) { static int sizes[SUBTITLE_SIZE_NUM] = { 16, 20, 24, 32, 48, 64 }; - int y; - if ((this->subtitle_size != this->class->subtitle_size) || (this->vertical_offset != this->class->vertical_offset) || force_update) { @@ -170,21 +199,17 @@ static void update_font_size (sputext_decoder_t *this, int force_update) { this->line_height = this->font_size + 10; - y = this->height - (SUB_MAX_TEXT * this->line_height) - 5; - - if(((y - this->class->vertical_offset) >= 0) && ((y - this->class->vertical_offset) <= this->height)) - y -= this->class->vertical_offset; - + /* Create a full-window OSD */ if( this->osd ) this->renderer->free_object (this->osd); - lprintf("new osd object, width %d, height %d*%d\n", this->width, SUB_MAX_TEXT, this->line_height); this->osd = this->renderer->new_object (this->renderer, this->width, - SUB_MAX_TEXT * this->line_height); + this->height); this->renderer->set_font (this->osd, get_font (this->class), this->font_size); - this->renderer->set_position (this->osd, 0, y); + + this->renderer->set_position (this->osd, 0, 0); } } @@ -208,7 +233,7 @@ static void update_output_size (sputext_decoder_t *this) { VO_PROP_WINDOW_HEIGHT) || !this->img_duration || !this->osd ) { - int width = 0, height = 0; /* dummy */ + int width = 0, height = 0; this->stream->video_out->status(this->stream->video_out, NULL, &width, &height, &this->img_duration ); @@ -220,8 +245,36 @@ static void update_output_size (sputext_decoder_t *this) { VO_PROP_WINDOW_HEIGHT); if(!this->osd || (this->width && this->height)) { + + /* in unscaled mode, we have to convert subtitle position in window coordinates. */ + /* we have a scale factor because video may be zommed */ + /* and a displacement factor because video may have blacks lines. */ + int output_width, output_height, output_xoffset, output_yoffset; + + output_width = this->stream->video_out->get_property(this->stream->video_out, + VO_PROP_OUTPUT_WIDTH); + output_height = this->stream->video_out->get_property(this->stream->video_out, + VO_PROP_OUTPUT_HEIGHT); + output_xoffset = this->stream->video_out->get_property(this->stream->video_out, + VO_PROP_OUTPUT_XOFFSET); + output_yoffset = this->stream->video_out->get_property(this->stream->video_out, + VO_PROP_OUTPUT_YOFFSET); + + /* driver don't seen to be capable to give us those values */ + /* fallback to a default full-window values */ + if (output_width <= 0 || output_height <= 0) { + output_width = this->width; + output_height = this->height; + output_xoffset = 0; + output_yoffset = 0; + } + + this->video2wnd.x = output_xoffset; + this->video2wnd.y = output_yoffset; + this->video2wnd.dx = (double)output_width / SPU_PROJECTION_X; + this->video2wnd.dy = (double)output_height / SPU_PROJECTION_Y; + this->renderer = this->stream->osd_renderer; - update_font_size (this, 1); } } @@ -238,14 +291,21 @@ static void update_output_size (sputext_decoder_t *this) { if(!this->osd || ( this->width && this->height)) { this->renderer = this->stream->osd_renderer; + /* in scaled mode, we have to convert subtitle position in film coordinates. */ + this->video2wnd.x = 0; + this->video2wnd.y = 0; + this->video2wnd.dx = (double)this->width / SPU_PROJECTION_X; + this->video2wnd.dy = (double)this->height / SPU_PROJECTION_Y; + update_font_size (this, 1); } } } } -static int parse_utf8_size(unsigned char *c) +static int parse_utf8_size(const void *buf) { + const uint8_t *c = buf; if ( c[0]<0x80 ) return 1; @@ -270,7 +330,8 @@ static int parse_utf8_size(unsigned char *c) static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const char *text, int render) { - int i = 0, w, dummy; + int i = 0, w, value; + char* end; char letter[5]={0, 0, 0, 0, 0}; const char *encoding = this->buf_encoding ? this->buf_encoding : this->class->src_encoding; @@ -278,55 +339,82 @@ static int ogm_render_line_internal(sputext_decoder_t *this, int x, int y, const size_t length = strlen (text); while (i <= length) { - switch (text[i]) { - case '<': + + if (text[i] == '<') { if (!strncmp("<b>", text+i, 3)) { /* enable Bold color */ if (render) this->current_osd_text = OSD_TEXT2; i=i+3; - break; + continue; } else if (!strncmp("</b>", text+i, 4)) { /* disable BOLD */ if (render) this->current_osd_text = OSD_TEXT1; i=i+4; - break; + continue; } else if (!strncmp("<i>", text+i, 3)) { /* enable italics color */ if (render) this->current_osd_text = OSD_TEXT3; i=i+3; - break; + continue; } else if (!strncmp("</i>", text+i, 4)) { /* disable italics */ if (render) this->current_osd_text = OSD_TEXT1; i=i+4; - break; + continue; } else if (!strncmp("<font>", text+i, 6)) { /*Do somethink to disable typing fixme - no teststreams*/ i=i+6; - break; + continue; } else if (!strncmp("</font>", text+i, 7)) { /*Do somethink to enable typing fixme - no teststreams*/ i=i+7; - break; - } - default: - shift = isutf8 ? parse_utf8_size (&text[i]) : 1; - memcpy(letter,&text[i],shift); - letter[shift]=0; - - if (render) - this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); - this->renderer->get_text_size(this->osd, letter, &w, &dummy); - x=x+w; - i+=shift; + continue; + } } + if (text[i] == '{') { + + if (!strncmp("{\\", text+i, 2)) { + + if (sscanf(text+i, "{\\b%d}", &value) == 1) { + if (render) { + if (value) + this->current_osd_text = OSD_TEXT2; + else + this->current_osd_text = OSD_TEXT1; + } + } else if (sscanf(text+i, "{\\i%d}", &value) == 1) { + if (render) { + if (value) + this->current_osd_text = OSD_TEXT3; + else + this->current_osd_text = OSD_TEXT1; + } + } + end = strstr(text+i+2, "}"); + if (end) { + i=end-text+1; + continue; + } + } + } + + shift = isutf8 ? parse_utf8_size (&text[i]) : 1; + memcpy(letter,&text[i],shift); + letter[shift]=0; + + if (render) + this->renderer->render_text(this->osd, x, y, letter, this->current_osd_text); + this->renderer->get_text_size(this->osd, letter, &w, &value); + x=x+w; + i+=shift; } + return x; } @@ -338,16 +426,144 @@ static inline void ogm_render_line(sputext_decoder_t *this, int x, int y, char* ogm_render_line_internal (this, x, y, text, 1); } +/* read SSA tags at begening of text. Suported tags are : */ +/* \a : alignment in SSA code (see #defines) */ +/* \an : alignment in 'numpad code' */ +/* \pos : absolute position of subtitles. Alignment define origin. */ +static void read_ssa_tag(sputext_decoder_t *this, const char* text, + int* alignment, int* sub_x, int* sub_y, int* max_width) { + + int in_tag = 0; + + (*alignment) = 2; + (*sub_x) = -1; + (*sub_y) = -1; + + while (*text) { + + /* wait for tag begin, allow space and tab */ + if (in_tag == 0) { + if (*text == '{') in_tag = 1; + else if ((*text != ' ') && (*text != '\t')) break; + + /* parse SSA command */ + } else { + if (*text == '\\') { + if (sscanf(text, "\\pos(%d,%d)", sub_x, sub_y) == 2) { + text += 8; /* just for speed up, 8 is the minimal with */ + } + + if (sscanf(text, "\\a%d", alignment) == 1) { + text += 2; + } + + if (sscanf(text, "\\an%d", alignment) == 1) { + text += 3; + if ((*alignment) > 6) (*alignment) = (*alignment) - 2; + else if ((*alignment) > 3) (*alignment) = (*alignment) + 5; + } + } + + if (*text == '}') in_tag = 0; + } + + text++; + } + + + /* check alignment validity */ + if ((*alignment) < 1 || (*alignment) > 11) { + (*alignment) = 2; + } + + /* convert to window coordinates */ + if ((*sub_x) >= 0 && (*sub_y) >= 0) { + (*sub_x) = this->video2wnd.x + this->video2wnd.dx * (*sub_x); + (*sub_y) = this->video2wnd.y + this->video2wnd.dy * (*sub_y); + } + + /* check validity, compute max width */ + if ( (*sub_x) < 0 || (*sub_x) >= this->width || + (*sub_y) < 0 || (*sub_y) >= this->height ) { + (*sub_x) = -1; + (*sub_y) = -1; + (*max_width) = this->width; + } else { + switch (GET_X_ALIGNMENT(*alignment)) { + case ALIGN_LEFT: + (*max_width) = this->width - (*sub_x); + break; + case ALIGN_CENTER: + (*max_width) = this->width; + break; + case ALIGN_RIGHT: + (*max_width) = (*sub_x); + break; + } + } + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libsputext: position : (%d, %d), max width : %d, alignment : %d\n", + (*sub_x), (*sub_y), (*max_width), (*alignment)); +} + +static int is_cjk_encoding(const char *enc) { + /* CJK charset strings defined in iconvdata/gconv-modules of glibc */ + static const char cjk_encoding_strings[][16] = { + "SJIS", + "CP932", + "EUC-KR", + "UHC", + "JOHAB", + "BIG5", + "BIG5HKSCS", + "EUC-JP-MS", + "EUC-JP", + "EUC-CN", + "GBBIG5", + "GBK", + "GBGBK", + "EUC-TW", + "ISO-2022-JP", + "ISO-2022-JP-2", + "ISO-2022-JP-3", + "ISO-2022-KR", + "ISO-2022-CN", + "ISO-2022-CN-EXT", + "GB18030", + "EUC-JISX0213", + "SHIFT_JISX0213", + }; + + int pstr; + + /* return 1 if encoding string is one of the CJK(Chinese,Jananese,Korean) + * character set strings. */ + for (pstr = 0; pstr < sizeof (cjk_encoding_strings) / sizeof (cjk_encoding_strings[0]); pstr++) + if (strcasecmp (enc, cjk_encoding_strings[pstr]) == 0) + return 1; + + return 0; +} + static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t sub_end ) { int line, y; int font_size; char *font; + const char *encoding = (this->buf_encoding)?this->buf_encoding: + this->class->src_encoding; + int sub_x, sub_y, max_width; + int alignment; + int rebuild_all; + _x_assert(this->renderer != NULL); if ( ! this->renderer ) return; + read_ssa_tag(this, this->text[0], &alignment, &sub_x, &sub_y, &max_width); + update_font_size(this, 0); font = get_font (this->class); @@ -363,178 +579,181 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su else this->renderer->set_encoding(this->osd, this->class->src_encoding); - for (line = 0; line < this->lines; line++) /* first, check lenghts and word-wrap if needed */ - { - int w; - w = ogm_get_width( this, this->text[line]); - if( w > this->width ) { /* line is too long */ - int chunks=(int)(w/this->width)+(w%this->width?1:0); - if( this->lines+chunks <= SUB_MAX_TEXT && chunks>1 ) { /* try adding newlines while keeping existing ones */ - int a; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,"Partial subtitle line splitting in %i chunks\n",chunks); - for(a=this->lines-1;a>=0;a--) { - if(a>line) /* lines after the too-long one */ - memcpy(this->text[a+chunks-1],this->text[a],SUB_BUFSIZE); - else if(a==line) { /* line to be splitted */ - int b,len=strlen(this->text[line]); - char *p=this->text[line]; - for(b=0;b<chunks;b++) { - char *c; - if(b==chunks-1) { /* if we are reading the last chunk, copy it completly */ - strncpy(this->text[line+b],p,SUB_BUFSIZE); - this->text[line+b][SUB_BUFSIZE - 1] = '\0'; - } else { - for(c=p+(int)(len/chunks)+(len%chunks?1:0);*c!=' ' && c>p && c!='\0';c--); - if(*c==' ') { - *c='\0'; - if(b) { /* we are reading something that has to be moved to another line */ - strncpy(this->text[line+b],p,SUB_BUFSIZE); - this->text[line+b][SUB_BUFSIZE - 1] = '\0'; - } - p=c+1; - } - } - } - } - } - this->lines+=chunks-1; - } else { /* regenerate all the lines to find something that better fits */ - char buf[SUB_BUFSIZE*SUB_MAX_TEXT]; - int a,w,chunks; - buf[0]='\0'; - for(a=0;a<this->lines;a++) { - if(a) { - int len=strlen(buf); - buf[len]=' '; - buf[len+1]='\0'; - } - strcat(buf,this->text[a]); + + rebuild_all = 0; + for (line = 0; line < this->lines; line++) { + int line_width = ogm_get_width(this, this->text[line]); + + /* line too long */ + if (line_width > max_width) { + char *current_cut, *best_cut; + int a; + + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libsputext: Line too long: %d > %d, split at max size.\n", + line_width, max_width); + + /* can't fit with keeping existing lines */ + if (this->lines + 1 > SUB_MAX_TEXT) { + xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, + "libsputext: Can't fit with keeping existing line, we have to rebuild all the subtitle\n"); + rebuild_all = 1; + break; + } + + /* find the longest sequence witch fit */ + line_width = 0; + current_cut = this->text[line]; + best_cut = NULL; + while (line_width < max_width) { + while (*current_cut && *current_cut != ' ') current_cut++; + if (*current_cut == ' ') { + *current_cut = 0; + line_width = ogm_get_width(this, this->text[line]); + *current_cut = ' '; + if (line_width < max_width) best_cut = current_cut; + current_cut++; + } else { + break; /* end of line */ } - w = ogm_get_width( this, buf); - chunks=(int)(w/this->width)+(w%this->width?1:0); - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Complete subtitle line splitting in %i chunks\n",chunks); - if(chunks<=SUB_MAX_TEXT) {/* if the length is over than SUB_MAX_TEXT*this->width nothing can be done */ - int b,len=strlen(buf); - char *p=buf; - for(b=0;b<chunks;b++) { - char *c; - if(b==chunks-1) { /* if we are reading the last chunk, copy it completly */ - strncpy(this->text[b],p,SUB_BUFSIZE); - this->text[b][SUB_BUFSIZE - 1] = '\0'; - } else { - for(c=p+(int)(len/chunks)+(len%chunks?1:0);*c!=' ' && c>p && c!='\0';c--); - if(*c==' ') { - *c='\0'; - strncpy(this->text[b],p,SUB_BUFSIZE); - this->text[b][SUB_BUFSIZE - 1] = '\0'; - p=c+1; - } - } - } - this->lines=chunks; - } else - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Subtitle too long to be splited\n"); - line=this->lines; } + + if (best_cut == NULL) { + xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, + "libsputext: Can't wrap line: a word is too long, abort.\n"); + break; + } + + /* move other lines */ + for (a = this->lines - 1; a > line; a--) + memcpy(this->text[a + 1], this->text[a], SUB_BUFSIZE); + + /* split current one */ + strncpy(this->text[line + 1], best_cut + 1, SUB_BUFSIZE); + *best_cut = 0; + + this->lines = this->lines + 1; } } - font_size = this->font_size; - if (this->buf_encoding) - this->renderer->set_encoding(this->osd, this->buf_encoding); - else - this->renderer->set_encoding(this->osd, this->class->src_encoding); + /* regenerate all the lines to find something that better fits */ + if (rebuild_all) { + int line, line_width; + char *stream, *current_cut, *best_cut; + char buf[SUB_BUFSIZE * SUB_MAX_TEXT]; + + buf[0] = 0; + for(line = 0; line < this->lines; line++) { + int len = strlen(buf); + if (len) { + buf[len] = ' '; + len++; + } + strncpy(buf + len, this->text[line], SUB_BUFSIZE); + *(buf + len + SUB_BUFSIZE) = 0; + } - for (line = 0; line < this->lines; line++) /* first, check lenghts and word-wrap if needed */ - { - int w; - w = ogm_get_width( this, this->text[line]); - if( w > this->width ) { /* line is too long */ - int chunks=(int)(w/this->width)+(w%this->width?1:0); - if( this->lines+chunks <= SUB_MAX_TEXT && chunks>1 ) { /* try adding newlines while keeping existing ones */ - int a; - xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,"Partial subtitle line splitting in %i chunks\n",chunks); - for(a=this->lines-1;a>=0;a--) { - if(a>line) /* lines after the too-long one */ - memcpy(this->text[a+chunks-1],this->text[a],SUB_BUFSIZE); - else if(a==line) { /* line to be splitted */ - int b,len=strlen(this->text[line]); - char *p=this->text[line]; - for(b=0;b<chunks;b++) { - char *c; - if(b==chunks-1) { /* if we are reading the last chunk, copy it completly */ - strncpy(this->text[line+b],p,SUB_BUFSIZE); - this->text[line+b][SUB_BUFSIZE - 1] = '\0'; - } else { - for(c=p+(int)(len/chunks)+(len%chunks?1:0);*c!=' ' && c>p && c!='\0';c--); - if(*c==' ') { - *c='\0'; - if(b) { /* we are reading something that has to be moved to another line */ - strncpy(this->text[line+b],p,SUB_BUFSIZE); - this->text[line+b][SUB_BUFSIZE - 1] = '\0'; - } - p=c+1; - } - } - } - } - } - this->lines+=chunks-1; - } else { /* regenerate all the lines to find something that better fits */ - char buf[SUB_BUFSIZE*SUB_MAX_TEXT]; - int a,w,chunks; - buf[0]='\0'; - for(a=0;a<this->lines;a++) { - if(a) { - int len=strlen(buf); - buf[len]=' '; - buf[len+1]='\0'; + stream = buf; + this->lines = 0; + + do { + + if (this->lines + 1 < SUB_MAX_TEXT) { + + /* find the longest sequence witch fit */ + line_width = 0; + current_cut = stream; + best_cut = NULL; + while (line_width < max_width) { + while (*current_cut && *current_cut != ' ') current_cut++; + if (*current_cut == ' ') { + *current_cut = 0; + line_width = ogm_get_width(this, stream); + *current_cut = ' '; + if (line_width < max_width) best_cut = current_cut; + current_cut++; + } else { + line_width = ogm_get_width(this, stream); + if (line_width < max_width) best_cut = current_cut; + break; /* end of line */ } - strcat(buf,this->text[a]); } - w = ogm_get_width( this, buf); - chunks=(int)(w/this->width)+(w%this->width?1:0); - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Complete subtitle line splitting in %i chunks\n",chunks); - if(chunks<=SUB_MAX_TEXT) {/* if the length is over than SUB_MAX_TEXT*this->width nothing can be done */ - int b,len=strlen(buf); - char *p=buf; - for(b=0;b<chunks;b++) { - char *c; - if(b==chunks-1) { /* if we are reading the last chunk, copy it completly */ - strncpy(this->text[b],p,SUB_BUFSIZE); - this->text[b][SUB_BUFSIZE - 1] = '\0'; - } else { - for(c=p+(int)(len/chunks)+(len%chunks?1:0);*c!=' ' && c>p && c!='\0';c--); - if(*c==' ') { - *c='\0'; - strncpy(this->text[b],p,SUB_BUFSIZE); - this->text[b][SUB_BUFSIZE - 1] = '\0'; - p=c+1; - } - } - } - this->lines=chunks; - } else - xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Subtitle too long to be splited\n"); - line=this->lines; } - } + + /* line maybe too long, but we have reached last subtitle line */ + else { + best_cut = current_cut = stream + strlen(stream); + } + + /* copy current line */ + if (best_cut != NULL) *best_cut = 0; + strncpy(this->text[this->lines], stream, SUB_BUFSIZE); + this->lines = this->lines + 1; + + stream = best_cut + 1; + + } while (best_cut != current_cut); + + } + + + /* Erase subtitle : use last_y and last_lines saved last turn. */ + if (this->last_lines) { + this->renderer->filled_rect (this->osd, 0, this->last_y, + this->width - 1, this->last_y + this->last_lines * this->line_height, + 0); + } + + switch (GET_Y_ALIGNMENT(alignment)) { + case ALIGN_TOP: + if (sub_y >= 0) y = sub_y; + else y = 5; + break; + + case ALIGN_MIDDLE: + if (sub_y >= 0) y = sub_y - (this->lines * this->line_height) / 2; + else y = (this->height - this->lines * this->line_height) / 2; + break; + + case ALIGN_BOTTOM: + default: + if (sub_y >= 0) y = sub_y - this->lines * this->line_height; + else y = this->height - this->lines * this->line_height - this->class->vertical_offset; + break; } + if (y < 0 || y >= this->height) + y = this->height - this->line_height * this->lines; + + this->last_lines = this->lines; + this->last_y = y; - if (this->last_lines) - this->renderer->filled_rect (this->osd, 0, this->line_height * (SUB_MAX_TEXT - this->last_lines), - this->width - 1, this->line_height * SUB_MAX_TEXT - 1, 0); - this->last_lines = this->lines; - y = (SUB_MAX_TEXT - this->lines) * this->line_height; for (line = 0; line < this->lines; line++) { int w, x; while(1) { w = ogm_get_width( this, this->text[line]); - x = (this->width - w) / 2; - - if( w > this->width && font_size > 16 ) { + + switch (GET_X_ALIGNMENT(alignment)) { + case ALIGN_LEFT: + if (sub_x >= 0) x = sub_x; + else x = 5; + break; + + case ALIGN_RIGHT: + if (sub_x >= 0) x = sub_x - w; + else x = max_width - w - 5; + break; + + case ALIGN_CENTER: + default: + if (sub_x >= 0) x = sub_x - w / 2; + else x = (max_width - w) / 2; + break; + } + + + if( w > max_width && font_size > 16 ) { font_size -= 4; this->renderer->set_font (this->osd, get_font (this->class), font_size); } else { @@ -542,7 +761,12 @@ static void draw_subtitle(sputext_decoder_t *this, int64_t sub_start, int64_t su } } - ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + if( is_cjk_encoding(encoding) ) { + this->renderer->render_text (this->osd, x, y + line * this->line_height, + this->text[line], OSD_TEXT1); + } else { + ogm_render_line(this, x, y + line*this->line_height, this->text[line]); + } } if( font_size != this->font_size ) @@ -977,15 +1201,18 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_TEXT, BUF_SPU_OGM, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_TEXT, BUF_SPU_OGM, 0 }; static const decoder_info_t spudec_info = { supported_types, /* supported types */ 1 /* priority */ }; +extern void *init_sputext_demux_class (xine_t *xine, void *data); + const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ { PLUGIN_SPU_DECODER | PLUGIN_MUST_PRELOAD, 17, "sputext", XINE_VERSION_CODE, &spudec_info, &init_spu_decoder_plugin }, + { PLUGIN_DEMUX, 27, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libsputext/demux_sputext.c b/src/spu_dec/sputext_demuxer.c index 811bdcbd6..d7d1361b1 100644 --- a/src/libsputext/demux_sputext.c +++ b/src/spu_dec/sputext_demuxer.c @@ -47,9 +47,9 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" -#include "../demuxers/demux.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/demux.h> #define ERR (void *)-1 #define SUB_MAX_TEXT 5 @@ -382,31 +382,6 @@ static subtitle_t *sub_read_line_subrip(demux_sputext_t *this,subtitle_t *curren } else temp_line[temp_index++]=*p; break; - case '{': -#if 0 /* italic not implemented in renderer, ignore them for now */ - if(!strncmp(p,"{\\i1}",5) && temp_index+3<SUB_BUFSIZE) { - temp_line[temp_index++]='<'; - temp_line[temp_index++]='i'; - temp_line[temp_index++]='>'; -#else - if(!strncmp(p,"{\\i1}",5)) { -#endif - p+=4; - } -#if 0 /* italic not implemented in renderer, ignore them for now */ - else if(!strncmp(p,"{\\i0}",5) && temp_index+4<SUB_BUFSIZE) { - temp_line[temp_index++]='<'; - temp_line[temp_index++]='/'; - temp_line[temp_index++]='i'; - temp_line[temp_index++]='>'; -#else - else if(!strncmp(p,"{\\i0}",5)) { -#endif - p+=4; - } - else - temp_line[temp_index++]=*p; - break; case '\r': /* just ignore '\r's */ break; case '\n': @@ -1449,7 +1424,7 @@ static void config_timeout_cb(void *this_gen, xine_cfg_entry_t *entry) { this->max_timeout = entry->num_value; } -static void *init_sputext_demux_class (xine_t *xine, void *data) { +void *init_sputext_demux_class (xine_t *xine, void *data) { demux_sputext_class_t *this ; @@ -1481,9 +1456,3 @@ static void *init_sputext_demux_class (xine_t *xine, void *data) { return this; } - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_DEMUX, 27, "sputext", XINE_VERSION_CODE, NULL, &init_sputext_demux_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; diff --git a/src/libspucc/xine_cc_decoder.c b/src/spu_dec/xine_cc_decoder.c index 1e31b6d4a..9b177deeb 100644 --- a/src/libspucc/xine_cc_decoder.c +++ b/src/spu_dec/xine_cc_decoder.c @@ -24,9 +24,9 @@ #include <stdio.h> #include <string.h> -#include "buffer.h" -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/buffer.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include "cc_decoder.h" /* @@ -316,8 +316,6 @@ static spu_decoder_t *spudec_open_plugin (spu_decoder_class_t *class, xine_strea this->config_version = 0; this->cc_open = 0; - cc_decoder_init(); - return &this->spu_decoder; } @@ -339,7 +337,7 @@ static void *init_spu_decoder_plugin (xine_t *xine, void *data) { } /* plugin catalog information */ -static uint32_t supported_types[] = { BUF_SPU_CC, 0 }; +static const uint32_t supported_types[] = { BUF_SPU_CC, 0 }; static const decoder_info_t spudec_info = { supported_types, /* supported types */ diff --git a/src/vdr/Makefile.am b/src/vdr/Makefile.am index fcdf6cae4..fe5ae3a52 100644 --- a/src/vdr/Makefile.am +++ b/src/vdr/Makefile.am @@ -3,15 +3,9 @@ include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) AM_LDFLAGS = $(xineplug_ldflags) -xineinclude_HEADERS = input_vdr.h - -if ENABLE_DVB -xineplug_LTLIBRARIES = xineplug_inp_vdr.la -xinepost_LTLIBRARIES = xineplug_post_vdr.la +if ENABLE_VDR +xineplug_LTLIBRARIES = xineplug_vdr.la endif -xineplug_inp_vdr_la_SOURCES = input_vdr.c -xineplug_inp_vdr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) - -xineplug_post_vdr_la_SOURCES = post_vdr.c post_vdr_video.c post_vdr_audio.c post_vdr.h -xineplug_post_vdr_la_LIBADD = $(XINE_LIB) +xineplug_vdr_la_SOURCES = combined_vdr.c combined_vdr.h input_vdr.c post_vdr_video.c post_vdr_audio.c +xineplug_vdr_la_LIBADD = $(XINE_LIB) $(PTHREAD_LIBS) diff --git a/src/vdr/post_vdr.c b/src/vdr/combined_vdr.c index a9b7cbc37..f067798c5 100644 --- a/src/vdr/post_vdr.c +++ b/src/vdr/combined_vdr.c @@ -22,21 +22,23 @@ * plugins for VDR */ -#include "xine_internal.h" -#include "post.h" -#include "post_vdr.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include "combined_vdr.h" static const post_info_t vdr_video_special_info = { XINE_POST_TYPE_VIDEO_FILTER }; static const post_info_t vdr_audio_special_info = { XINE_POST_TYPE_AUDIO_FILTER }; +/* exported plugin catalog entry */ const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_POST, 9, "vdr" , XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, - { PLUGIN_POST, 9, "vdr_video", XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, - { PLUGIN_POST, 9, "vdr_audio", XINE_VERSION_CODE, &vdr_audio_special_info, &vdr_audio_init_plugin }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } + /* type , API, "name" , version , special_info , init_function */ + { PLUGIN_INPUT, 18, "VDR" , XINE_VERSION_CODE, NULL , &vdr_input_init_plugin }, + { PLUGIN_POST , 10, "vdr" , XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, + { PLUGIN_POST , 10, "vdr_video", XINE_VERSION_CODE, &vdr_video_special_info, &vdr_video_init_plugin }, + { PLUGIN_POST , 10, "vdr_audio", XINE_VERSION_CODE, &vdr_audio_special_info, &vdr_audio_init_plugin }, + { PLUGIN_NONE , 0, "" , 0 , NULL , NULL } }; diff --git a/src/vdr/post_vdr.h b/src/vdr/combined_vdr.h index 46aa8dcb3..9757bff50 100644 --- a/src/vdr/post_vdr.h +++ b/src/vdr/combined_vdr.h @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ -#ifndef __POST_VDR_H -#define __POST_VDR_H +#ifndef __COMBINED_VDR_H +#define __COMBINED_VDR_H @@ -63,7 +63,7 @@ inline static int vdr_is_vdr_stream(xine_stream_t *stream) } if (stream->input_plugin->input_class->identifier && - strcmp(stream->input_plugin->input_class->identifier, "VDR")) + 0 == strcmp(stream->input_plugin->input_class->identifier, "VDR")) return 1; return 0; @@ -72,10 +72,11 @@ inline static int vdr_is_vdr_stream(xine_stream_t *stream) /* plugin class initialization function */ -void *vdr_video_init_plugin(xine_t *xine, void *); -void *vdr_audio_init_plugin(xine_t *xine, void *); +void *vdr_input_init_plugin(xine_t *xine, void *data); +void *vdr_video_init_plugin(xine_t *xine, void *data); +void *vdr_audio_init_plugin(xine_t *xine, void *data); -#endif /* __POST_VDR_H */ +#endif /* __COMBINED_VDR_H */ diff --git a/src/vdr/input_vdr.c b/src/vdr/input_vdr.c index 946e963a3..154bb9b56 100644 --- a/src/vdr/input_vdr.c +++ b/src/vdr/input_vdr.c @@ -41,12 +41,12 @@ /* #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 "input_vdr.h" -#include "post_vdr.h" +#include <xine/vdr.h> +#include "combined_vdr.h" @@ -120,7 +120,7 @@ typedef struct { input_class_t input_class; xine_t *xine; - char *mrls[ 2 ]; + const char *mrls[ 2 ]; } vdr_input_class_t; @@ -802,7 +802,7 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n"); READ_DATA_OR_FAIL(mute, lprintf("got MUTE\n")); { - int param_mute = (this->volume_mode == INPUT_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; + int param_mute = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; xine_set_param(this->stream, param_mute, data->mute); } } @@ -813,13 +813,13 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n"); READ_DATA_OR_FAIL(set_volume, lprintf("got SETVOLUME\n")); { - int change_volume = (this->volume_mode != INPUT_VDR_VOLUME_IGNORE); + int change_volume = (this->volume_mode != XINE_VDR_VOLUME_IGNORE); int do_mute = (this->last_volume != 0 && 0 == data->volume); int do_unmute = (this->last_volume <= 0 && 0 != data->volume); int report_change = 0; - int param_mute = (this->volume_mode == INPUT_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; - int param_volume = (this->volume_mode == INPUT_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_LEVEL : XINE_PARAM_AUDIO_VOLUME; + int param_mute = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_MUTE : XINE_PARAM_AUDIO_MUTE; + int param_volume = (this->volume_mode == XINE_VDR_VOLUME_CHANGE_SW) ? XINE_PARAM_AUDIO_AMP_LEVEL : XINE_PARAM_AUDIO_VOLUME; this->last_volume = data->volume; @@ -827,16 +827,16 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n"); { switch (this->mute_mode) { - case INPUT_VDR_MUTE_EXECUTE: + case XINE_VDR_MUTE_EXECUTE: report_change = 1; xine_set_param(this->stream, param_mute, do_mute); - case INPUT_VDR_MUTE_IGNORE: + case XINE_VDR_MUTE_IGNORE: if (do_mute) change_volume = 0; break; - case INPUT_VDR_MUTE_SIMULATE: + case XINE_VDR_MUTE_SIMULATE: change_volume = 1; break; @@ -851,7 +851,7 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n"); xine_set_param(this->stream, param_volume, this->last_volume); } - if (report_change && this->volume_mode != INPUT_VDR_VOLUME_CHANGE_SW) + if (report_change && this->volume_mode != XINE_VDR_VOLUME_CHANGE_SW) { xine_event_t event; xine_audio_level_data_t data; @@ -1051,7 +1051,7 @@ fprintf(stderr, "ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß\n"); result_get_version.header.func = data->header.func; result_get_version.header.len = sizeof (result_get_version); - result_get_version.version = XINE_INPUT_VDR_VERSION; + result_get_version.version = XINE_VDR_VERSION; if (sizeof (result_get_version) != vdr_write(this->fh_result, &result_get_version, sizeof (result_get_version))) return -1; @@ -1559,564 +1559,6 @@ static int vdr_plugin_get_optional_data(input_plugin_t *this_gen, return INPUT_OPTIONAL_UNSUPPORTED; } -static uint8_t preview_mpg_data[] = -{ -/* 0x0000 */ 0x00, 0x00, 0x01, 0xb3, 0x2d, 0x02, 0x40, 0x23, 0x12, 0x4f, 0xa3, 0x80, 0x00, 0x00, 0x01, 0xb5, -/* 0x0010 */ 0x14, 0x82, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb5, 0x23, 0x05, 0x05, 0x05, 0x0b, 0x42, -/* 0x0020 */ 0x12, 0x00, 0x00, 0x00, 0x01, 0xb8, 0x00, 0x08, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0f, -/* 0x0030 */ 0xff, 0xf8, 0x00, 0x00, 0x01, 0xb5, 0x8f, 0xff, 0xf7, 0xdd, 0x80, 0x00, 0x00, 0x01, 0x01, 0x0b, -/* 0x0040 */ 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0050 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0060 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0070 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0080 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0090 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x00a0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x00b0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x00c0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x00d0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x00e0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x00f0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0100 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0110 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0120 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, -/* 0x0130 */ 0x01, 0x02, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0140 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0150 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0160 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0170 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0180 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0190 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x01a0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x01b0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x01c0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x01d0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x01e0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x01f0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0200 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0210 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0220 */ 0x60, 0x00, 0x00, 0x01, 0x03, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0230 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0240 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0250 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0260 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0270 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0280 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0290 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x02a0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x02b0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x02c0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x02d0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x02e0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x02f0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0300 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0310 */ 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x04, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0320 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0330 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0340 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0350 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0360 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0370 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0380 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0390 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x03a0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x03b0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x03c0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x03d0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x03e0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x03f0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0400 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x05, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, -/* 0x0410 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0420 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0430 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0440 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0450 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0460 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0470 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0480 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0490 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x04a0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x04b0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x04c0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x04d0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x04e0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x04f0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x06, 0x0b, 0xfc, -/* 0x0500 */ 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0510 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0520 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0530 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0540 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0550 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0560 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0570 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0580 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0590 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x05a0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x05b0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x05c0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x05d0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x05e0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, -/* 0x05f0 */ 0x07, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0600 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0610 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0620 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0630 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0640 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0650 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0660 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0670 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0680 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0690 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x06a0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x06b0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x06c0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x06d0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, -/* 0x06e0 */ 0x00, 0x00, 0x01, 0x08, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x06f0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0700 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0710 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0720 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0730 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0740 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0750 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0760 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0770 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0780 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0790 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x07a0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x07b0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x07c0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x07d0 */ 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x09, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x07e0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x07f0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0800 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0810 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0820 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0830 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0840 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0850 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0860 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0870 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0880 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0890 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x08a0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x08b0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x08c0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x0a, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, -/* 0x08d0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x08e0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x08f0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0900 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0910 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0920 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0930 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0940 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0950 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0960 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0970 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0980 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0990 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x09a0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x09b0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x0b, 0x0b, 0xfc, 0x3e, -/* 0x09c0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x09d0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x09e0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x09f0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0a00 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0a10 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0a20 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0a30 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0a40 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0a50 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0a60 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0a70 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0a80 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0a90 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0aa0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x0c, -/* 0x0ab0 */ 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0ac0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0ad0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0ae0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0af0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0b00 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0b10 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0b20 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0b30 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0b40 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0b50 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0b60 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0b70 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0b80 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0b90 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, -/* 0x0ba0 */ 0x00, 0x01, 0x0d, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0bb0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0bc0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0bd0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0be0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0bf0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0c00 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0c10 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0c20 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0c30 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0c40 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0c50 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0c60 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0c70 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0c80 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0c90 */ 0x18, 0x60, 0x00, 0x00, 0x01, 0x0e, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0ca0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0cb0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0cc0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0cd0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0ce0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0cf0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0d00 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0d10 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0d20 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0d30 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0d40 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0d50 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0d60 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0d70 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0d80 */ 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x0f, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0d90 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0da0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0db0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0dc0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0dd0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0de0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x0df0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x0e00 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x0e10 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x0e20 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0e30 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0e40 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0e50 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0e60 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0e70 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x10, 0x0b, 0xfc, 0x3e, 0xd1, -/* 0x0e80 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x0e90 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x0ea0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x0eb0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x0ec0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x0ed0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x0ee0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x0ef0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x0f00 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x0f10 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0f20 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0f30 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0f40 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0f50 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0f60 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x11, 0x0b, -/* 0x0f70 */ 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x0f80 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x0f90 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x0fa0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x0fb0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x0fc0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x0fd0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x0fe0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x0ff0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1000 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1010 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1020 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1030 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1040 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1050 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, -/* 0x1060 */ 0x01, 0x12, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1070 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1080 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1090 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x10a0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x10b0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x10c0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x10d0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x10e0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x10f0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1100 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1110 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1120 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1130 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1140 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1150 */ 0x60, 0x00, 0x00, 0x01, 0x13, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1160 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1170 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1180 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1190 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x11a0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x11b0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x11c0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x11d0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x11e0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x11f0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1200 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1210 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1220 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1230 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1240 */ 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x14, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1250 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1260 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1270 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1280 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1290 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x12a0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x12b0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x12c0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x12d0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x12e0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x12f0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1300 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1310 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1320 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1330 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x15, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, -/* 0x1340 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1350 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1360 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1370 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1380 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1390 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x13a0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x13b0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x13c0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x13d0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x13e0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x13f0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1400 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1410 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1420 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x16, 0x0b, 0xfc, -/* 0x1430 */ 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1440 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1450 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1460 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1470 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1480 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1490 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x14a0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x14b0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x14c0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x14d0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x14e0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x14f0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1500 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1510 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, -/* 0x1520 */ 0x17, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1530 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1540 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1550 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1560 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1570 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1580 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1590 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x15a0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x15b0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x15c0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x15d0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x15e0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x15f0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1600 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, -/* 0x1610 */ 0x00, 0x00, 0x01, 0x18, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1620 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1630 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1640 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1650 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1660 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1670 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1680 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1690 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x16a0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x16b0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x16c0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x16d0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x16e0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x16f0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1700 */ 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x19, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1710 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1720 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1730 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1740 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1750 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1760 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1770 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1780 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1790 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x17a0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x17b0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x17c0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x17d0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x17e0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x17f0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x1a, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, -/* 0x1800 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1810 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1820 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1830 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1840 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1850 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1860 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1870 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1880 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1890 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x18a0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x18b0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x18c0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x18d0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x18e0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x1b, 0x0b, 0xfc, 0x3e, -/* 0x18f0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1900 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1910 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1920 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1930 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1940 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1950 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1960 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1970 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1980 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1990 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x19a0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x19b0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x19c0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x19d0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x1c, -/* 0x19e0 */ 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x19f0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1a00 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1a10 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1a20 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1a30 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1a40 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1a50 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1a60 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1a70 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1a80 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1a90 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1aa0 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1ab0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1ac0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, -/* 0x1ad0 */ 0x00, 0x01, 0x1d, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1ae0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1af0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1b00 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1b10 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1b20 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1b30 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1b40 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1b50 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1b60 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1b70 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1b80 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1b90 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1ba0 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1bb0 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1bc0 */ 0x18, 0x60, 0x00, 0x00, 0x01, 0x1e, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1bd0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1be0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1bf0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1c00 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1c10 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1c20 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1c30 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1c40 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1c50 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1c60 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1c70 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1c80 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1c90 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1ca0 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1cb0 */ 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x1f, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1cc0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1cd0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1ce0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1cf0 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1d00 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1d10 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1d20 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1d30 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1d40 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1d50 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1d60 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1d70 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1d80 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1d90 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1da0 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x20, 0x0b, 0xfc, 0x3e, 0xd1, -/* 0x1db0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1dc0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1dd0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1de0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x1df0 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x1e00 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x1e10 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x1e20 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x1e30 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x1e40 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1e50 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1e60 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1e70 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1e80 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1e90 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x21, 0x0b, -/* 0x1ea0 */ 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x1eb0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x1ec0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x1ed0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x1ee0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x1ef0 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x1f00 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x1f10 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x1f20 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x1f30 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1f40 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1f50 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1f60 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1f70 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1f80 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, -/* 0x1f90 */ 0x01, 0x22, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x1fa0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x1fb0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x1fc0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x1fd0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x1fe0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x1ff0 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x2000 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x2010 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x2020 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x2030 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x2040 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x2050 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x2060 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x2070 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x2080 */ 0x60, 0x00, 0x00, 0x01, 0x23, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x2090 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x20a0 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x20b0 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, -/* 0x20c0 */ 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, -/* 0x20d0 */ 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, -/* 0x20e0 */ 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, -/* 0x20f0 */ 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, -/* 0x2100 */ 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, -/* 0x2110 */ 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x2120 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x2130 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x2140 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x2150 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x2160 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x2170 */ 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0x24, 0x0b, 0xfc, 0x3e, 0xd1, 0xa3, 0x46, 0x18, 0x6e, -/* 0x2180 */ 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, -/* 0x2190 */ 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, -/* 0x21a0 */ 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, -/* 0x21b0 */ 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, -/* 0x21c0 */ 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, -/* 0x21d0 */ 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, -/* 0x21e0 */ 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, -/* 0x21f0 */ 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, -/* 0x2200 */ 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, -/* 0x2210 */ 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, -/* 0x2220 */ 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, -/* 0x2230 */ 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x6e, 0x34, 0x68, 0xd1, -/* 0x2240 */ 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, 0x61, 0xb8, 0xd1, 0xa3, 0x46, -/* 0x2250 */ 0x18, 0x6e, 0x34, 0x68, 0xd1, 0x86, 0x1b, 0x8d, 0x1a, 0x34, 0x61, 0x86, 0xe3, 0x46, 0x8d, 0x18, -/* 0x2260 */ 0x61, 0xb8, 0xd1, 0xa3, 0x46, 0x18, 0x60, 0x00, 0x00, 0x01, 0xb7 -/* 0x226b */ -}; - -static uint8_t preview_data[ sizeof (preview_mpg_data) + ((sizeof (preview_mpg_data) - 1) / (2048 - 6 - 3) + 1) * (6 + 3) ]; - static inline const char *mrl_to_fifo (const char *mrl) { /* vdr://foo -> /foo */ @@ -2383,44 +1825,8 @@ static int vdr_plugin_open(input_plugin_t *this_gen) * => create plugin instance */ - /* - * fill preview buffer - */ - - if (!preview_data[ 2 ]) - { - uint8_t *src = preview_mpg_data; - uint8_t *dst = preview_data; - int todo = sizeof (preview_mpg_data); - int bite = 2048 - 6 - 3; - - while (todo > 0) - { - if (bite > todo) - bite = todo; - - *dst++ = 0x00; - *dst++ = 0x00; - *dst++ = 0x01; - *dst++ = 0xe0; - - *dst++ = (bite + 3) >> 8; - *dst++ = (bite + 3) & 0xff; - - *dst++ = 0x80; - *dst++ = 0x00; - *dst++ = 0x00; - - memcpy(dst, src, bite); - dst += bite; - src += bite; - - todo -= bite; - } - } - - this->preview = (char *)&preview_data; - this->preview_size = 0; /* sizeof (preview_data); */ + this->preview = NULL; + this->preview_size = 0; this->curpos = 0; return 1; @@ -2596,8 +2002,8 @@ static input_plugin_t *vdr_class_get_instance(input_class_t *cls_gen, xine_strea this->osd_unscaled_blending = 0; this->trick_speed_mode = 0; this->audio_channels = 0; - this->mute_mode = INPUT_VDR_MUTE_SIMULATE; - this->volume_mode = INPUT_VDR_VOLUME_CHANGE_HW; + this->mute_mode = XINE_VDR_MUTE_SIMULATE; + this->volume_mode = XINE_VDR_VOLUME_CHANGE_HW; this->last_volume = -1; this->frame_size.x = 0; this->frame_size.y = 0; @@ -2636,7 +2042,7 @@ static char **vdr_class_get_autoplay_list(input_class_t *this_gen, return class->mrls; } -static void *init_class(xine_t *xine, void *data) +void *vdr_input_init_plugin(xine_t *xine, void *data) { vdr_input_class_t *this; @@ -2659,15 +2065,3 @@ static void *init_class(xine_t *xine, void *data) return this; } - -/* - * exported plugin catalog entry - */ - -const plugin_info_t xine_plugin_info[] EXPORTED = -{ - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_INPUT, 18, "VDR", XINE_VERSION_CODE, NULL, init_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; - diff --git a/src/vdr/input_vdr.h b/src/vdr/input_vdr.h deleted file mode 100644 index 41c96d741..000000000 --- a/src/vdr/input_vdr.h +++ /dev/null @@ -1,616 +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 __INPUT_VDR_H -#define __INPUT_VDR_H - - -#define XINE_INPUT_VDR_VERSION 712 - - -enum funcs -{ - func_unknown = -1 - , func_nop - , func_osd_new - , func_osd_free - , func_osd_show - , func_osd_hide - , func_osd_set_position - , func_osd_draw_bitmap - , func_set_color - , func_clear - , func_mute - , func_set_volume - , func_set_speed - , func_set_prebuffer - , func_metronom - , func_start - , func_wait - , func_setup - , func_grab_image - , func_get_pts - , func_flush - , func_first_frame - , func_still_frame - , func_video_size - , func_set_video_window - , func_osd_flush - , func_play_external - , func_key - , func_frame_size - , func_reset_audio - , func_select_audio - , func_trick_speed_mode - , func_get_version -}; - -enum keys -{ - key_none, - key_up, - key_down, - key_menu, - key_ok, - key_back, - key_left, - key_right, - key_red, - key_green, - key_yellow, - key_blue, - key_0, - key_1, - key_2, - key_3, - key_4, - key_5, - key_6, - key_7, - key_8, - key_9, - key_play, - key_pause, - key_stop, - key_record, - key_fast_fwd, - key_fast_rew, - key_power, - key_channel_plus, - key_channel_minus, - key_volume_plus, - key_volume_minus, - key_mute, - key_schedule, - key_channels, - key_timers, - key_recordings, - key_setup, - key_commands, - key_user1, - key_user2, - key_user3, - key_user4, - key_user5, - key_user6, - key_user7, - key_user8, - key_user9, - key_audio, - key_info, - key_channel_previous, - key_next, - key_previous, - key_subtitles, -}; - - - -typedef struct __attribute__((packed)) data_header_s -{ - uint32_t func:8; - uint32_t len:24; -} -data_header_t; - - - -typedef data_header_t result_header_t; -typedef data_header_t event_header_t; - - - -typedef struct __attribute__((packed)) data_nop_s -{ - data_header_t header; -} -data_nop_t; - - - -typedef struct __attribute__((packed)) data_osd_new_s -{ - data_header_t header; - - uint8_t window; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; -} -data_osd_new_t; - - - -typedef struct __attribute__((packed)) data_osd_free_s -{ - data_header_t header; - - uint8_t window; -} -data_osd_free_t; - - - -typedef struct __attribute__((packed)) data_osd_show_s -{ - data_header_t header; - - uint8_t window; -} -data_osd_show_t; - - - -typedef struct __attribute__((packed)) data_osd_hide_s -{ - data_header_t header; - - uint8_t window; -} -data_osd_hide_t; - - - -typedef struct __attribute__((packed)) data_osd_flush_s -{ - data_header_t header; -} -data_osd_flush_t; - - - -typedef struct __attribute__((packed)) data_play_external_s -{ - data_header_t header; -} -data_play_external_t; - - - -typedef struct __attribute__((packed)) data_osd_set_position_s -{ - data_header_t header; - - uint8_t window; - int16_t x; - int16_t y; -} -data_osd_set_position_t; - - - -typedef struct __attribute__((packed)) data_osd_draw_bitmap_s -{ - data_header_t header; - - uint8_t window; - int16_t x; - int16_t y; - uint16_t width; - uint16_t height; -} -data_osd_draw_bitmap_t; - - - -typedef struct __attribute__((packed)) data_set_color_s -{ - data_header_t header; - - uint8_t window; - uint8_t index; - uint8_t num; -} -data_set_color_t; - - - -typedef struct __attribute__((packed)) data_flush_s -{ - data_header_t header; - - int32_t ms_timeout; - uint8_t just_wait; -} -data_flush_t; - - - -typedef struct __attribute__((packed)) result_flush_s -{ - result_header_t header; - - uint8_t timed_out; -} -result_flush_t; - - - -typedef struct __attribute__((packed)) data_clear_s -{ - data_header_t header; - - int32_t n; - int8_t s; -} -data_clear_t; - - - -typedef struct __attribute__((packed)) data_mute_s -{ - data_header_t header; - - uint8_t mute; -} -data_mute_t; - - - -typedef struct __attribute__((packed)) data_set_volume_s -{ - data_header_t header; - - uint8_t volume; -} -data_set_volume_t; - - - -typedef struct __attribute__((packed)) data_set_speed_s -{ - data_header_t header; - - int32_t speed; -} -data_set_speed_t; - - - -typedef struct __attribute__((packed)) data_set_prebuffer_s -{ - data_header_t header; - - uint32_t prebuffer; -} -data_set_prebuffer_t; - - - -typedef struct __attribute__((packed)) data_metronom_s -{ - data_header_t header; - - int64_t pts; - uint32_t flags; -} -data_metronom_t; - - - -typedef struct __attribute__((packed)) data_start_s -{ - data_header_t header; -} -data_start_t; - - - -typedef struct __attribute__((packed)) data_wait_s -{ - data_header_t header; -} -data_wait_t; - - - -typedef struct __attribute__((packed)) result_wait_s -{ - result_header_t header; -} -result_wait_t; - - - -#define INPUT_VDR_VOLUME_IGNORE 0 -#define INPUT_VDR_VOLUME_CHANGE_HW 1 -#define INPUT_VDR_VOLUME_CHANGE_SW 2 - -#define INPUT_VDR_MUTE_IGNORE 0 -#define INPUT_VDR_MUTE_EXECUTE 1 -#define INPUT_VDR_MUTE_SIMULATE 2 - -typedef struct __attribute__((packed)) data_setup_s -{ - data_header_t header; - - uint8_t osd_unscaled_blending; - uint8_t volume_mode; - uint8_t mute_mode; - uint16_t image4_3_zoom_x; - uint16_t image4_3_zoom_y; - uint16_t image16_9_zoom_x; - uint16_t image16_9_zoom_y; -} -data_setup_t; - - - -typedef struct __attribute__((packed)) data_first_frame_s -{ - data_header_t header; -} -data_first_frame_t; - - - -typedef struct __attribute__((packed)) data_still_frame_s -{ - data_header_t header; -} -data_still_frame_t; - - - -typedef struct __attribute__((packed)) data_set_video_window_s -{ - data_header_t header; - - uint32_t x; - uint32_t y; - uint32_t w; - uint32_t h; - uint32_t w_ref; - uint32_t h_ref; -} -data_set_video_window_t; - - - -typedef struct __attribute__((packed)) data_grab_image_s -{ - data_header_t header; -} -data_grab_image_t; - - - -typedef struct __attribute__((packed)) result_grab_image_s -{ - result_header_t header; - - int32_t width; - int32_t height; - int32_t ratio; - int32_t format; -} -result_grab_image_t; - - - -typedef struct __attribute__((packed)) data_get_pts_s -{ - data_header_t header; -} -data_get_pts_t; - - - -typedef struct __attribute__((packed)) result_get_pts_s -{ - result_header_t header; - - int64_t pts; -} -result_get_pts_t; - - - -typedef struct __attribute__((packed)) data_get_version_s -{ - data_header_t header; -} -data_get_version_t; - - - -typedef struct __attribute__((packed)) result_get_version_s -{ - result_header_t header; - - int32_t version; -} -result_get_version_t; - - - -typedef struct __attribute__((packed)) data_video_size_s -{ - data_header_t header; -} -data_video_size_t; - - - -typedef struct __attribute__((packed)) result_video_size_s -{ - result_header_t header; - - int32_t left; - int32_t top; - int32_t width; - int32_t height; - int32_t ratio; - int32_t zoom_x; - int32_t zoom_y; -} -result_video_size_t; - - - -typedef struct __attribute__((packed)) data_reset_audio_s -{ - data_header_t header; -} -data_reset_audio_t; - - - -typedef struct __attribute__((packed)) event_key_s -{ - event_header_t header; - - uint32_t key; -} -event_key_t; - - - -typedef struct __attribute__((packed)) event_frame_size_s -{ - event_header_t header; - - int32_t left; - int32_t top; - int32_t width; - int32_t height; - int32_t zoom_x; - int32_t zoom_y; -} -event_frame_size_t; - - - -typedef struct __attribute__((packed)) event_play_external_s -{ - event_header_t header; - - uint32_t key; -} -event_play_external_t; - - - -typedef struct __attribute__((packed)) data_select_audio_s -{ - data_header_t header; - - uint8_t channels; -} -data_select_audio_t; - - - -typedef struct __attribute__((packed)) data_trick_speed_mode_s -{ - data_header_t header; - - uint8_t on; -} -data_trick_speed_mode_t; - - - -typedef union __attribute__((packed)) data_union_u -{ - data_header_t header; - data_nop_t nop; - data_osd_new_t osd_new; - data_osd_free_t osd_free; - data_osd_show_t osd_show; - data_osd_hide_t osd_hide; - data_osd_set_position_t osd_set_position; - data_osd_draw_bitmap_t osd_draw_bitmap; - data_set_color_t set_color; - data_flush_t flush; - data_clear_t clear; - data_mute_t mute; - data_set_volume_t set_volume; - data_set_speed_t set_speed; - data_set_prebuffer_t set_prebuffer; - data_metronom_t metronom; - data_start_t start; - data_wait_t wait; - data_setup_t setup; - data_grab_image_t grab_image; - data_get_pts_t get_pts; - data_first_frame_t first_frame; - data_still_frame_t still_frame; - data_video_size_t video_size; - data_set_video_window_t set_video_window; - data_osd_flush_t osd_flush; - data_play_external_t play_external; - data_reset_audio_t reset_audio; - data_select_audio_t select_audio; - data_trick_speed_mode_t trick_speed_mode; - data_get_version_t get_version; -} -data_union_t; - - - -typedef union __attribute__((packed)) result_union_u -{ - result_header_t header; - result_grab_image_t grab_image; - result_get_pts_t get_pts; - result_flush_t flush; - result_video_size_t video_size; - result_get_version_t get_version; - result_wait_t wait; -} -result_union_t; - - - -typedef union __attribute__((packed)) event_union_u -{ - event_header_t header; - event_key_t key; - event_frame_size_t frame_size; - event_play_external_t play_external; -} -event_union_t; - - - -#endif /* __INPUT_VDR_H */ - diff --git a/src/vdr/post_vdr_audio.c b/src/vdr/post_vdr_audio.c index 96fa84fb5..49de8f9cf 100644 --- a/src/vdr/post_vdr_audio.c +++ b/src/vdr/post_vdr_audio.c @@ -28,9 +28,9 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" -#include "post_vdr.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include "combined_vdr.h" @@ -71,7 +71,7 @@ static void vdr_audio_port_put_buffer(xine_audio_port_t *port_gen, aud void *vdr_audio_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof (post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof (post_class_t)); if (!class) return NULL; diff --git a/src/vdr/post_vdr_video.c b/src/vdr/post_vdr_video.c index ed0eafc35..4d1055aaf 100644 --- a/src/vdr/post_vdr_video.c +++ b/src/vdr/post_vdr_video.c @@ -28,9 +28,9 @@ #define LOG */ -#include "xine_internal.h" -#include "post.h" -#include "post_vdr.h" +#include <xine/xine_internal.h> +#include <xine/post.h> +#include "combined_vdr.h" @@ -94,7 +94,7 @@ static int vdr_video_draw(vo_frame_t *frame, xine_stream_t *stream); void *vdr_video_init_plugin(xine_t *xine, void *data) { - post_class_t *class = (post_class_t *)malloc(sizeof (post_class_t)); + post_class_t *class = (post_class_t *)xine_xmalloc(sizeof (post_class_t)); if (!class) return NULL; diff --git a/src/libxinevdec/Makefile.am b/src/video_dec/Makefile.am index 321d70c1f..91246eb4d 100644 --- a/src/libxinevdec/Makefile.am +++ b/src/video_dec/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = libmpeg2 + include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) diff --git a/src/libxinevdec/bitplane.c b/src/video_dec/bitplane.c index c8400f464..327e14aee 100644 --- a/src/libxinevdec/bitplane.c +++ b/src/video_dec/bitplane.c @@ -35,10 +35,10 @@ #include <sys/types.h> #include <unistd.h> -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #include "demuxers/iff.h" diff --git a/src/libxinevdec/foovideo.c b/src/video_dec/foovideo.c index b33705a3f..49c63422c 100644 --- a/src/libxinevdec/foovideo.c +++ b/src/video_dec/foovideo.c @@ -30,10 +30,10 @@ #include <sys/types.h> #include <unistd.h> -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #define VIDEOBUFSIZE 128*1024 diff --git a/src/libxinevdec/gdkpixbuf.c b/src/video_dec/gdkpixbuf.c index 7fd4a6a0e..34644241d 100644 --- a/src/libxinevdec/gdkpixbuf.c +++ b/src/video_dec/gdkpixbuf.c @@ -35,10 +35,10 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #include <gdk-pixbuf/gdk-pixbuf.h> @@ -280,7 +280,7 @@ static void *init_class (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t supported_types[] = { BUF_VIDEO_IMAGE, BUF_VIDEO_JPEG, 0 }; +static const uint32_t supported_types[] = { BUF_VIDEO_IMAGE, BUF_VIDEO_JPEG, 0 }; static const decoder_info_t dec_info_image = { supported_types, /* supported types */ diff --git a/src/libxinevdec/image.c b/src/video_dec/image.c index 7a97972c7..5c8439a67 100644 --- a/src/libxinevdec/image.c +++ b/src/video_dec/image.c @@ -44,10 +44,10 @@ #undef PACKAGE_VERSION #endif -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" typedef struct { @@ -258,7 +258,7 @@ static void *init_class (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t supported_types[] = { BUF_VIDEO_IMAGE, +static const uint32_t supported_types[] = { BUF_VIDEO_IMAGE, 0 }; static const decoder_info_t dec_info_image = { diff --git a/src/libmpeg2/Makefile.am b/src/video_dec/libmpeg2/Makefile.am index d772f0e09..2f7429942 100644 --- a/src/libmpeg2/Makefile.am +++ b/src/video_dec/libmpeg2/Makefile.am @@ -28,5 +28,5 @@ xineplug_decode_mpeg2_la_SOURCES = \ xine_mpeg2_decoder.c \ libmpeg2_accel.c -xineplug_decode_mpeg2_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) -lm +xineplug_decode_mpeg2_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) -lm xineplug_decode_mpeg2_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) diff --git a/src/libmpeg2/cpu_state.c b/src/video_dec/libmpeg2/cpu_state.c index 07b4c5b7e..12963644c 100644 --- a/src/libmpeg2/cpu_state.c +++ b/src/video_dec/libmpeg2/cpu_state.c @@ -27,7 +27,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> void (* mpeg2_cpu_state_save) (cpu_state_t * state) = NULL; void (* mpeg2_cpu_state_restore) (cpu_state_t * state) = NULL; diff --git a/src/libmpeg2/decode.c b/src/video_dec/libmpeg2/decode.c index 58f34ccbc..145d5f58b 100644 --- a/src/libmpeg2/decode.c +++ b/src/video_dec/libmpeg2/decode.c @@ -37,11 +37,11 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> #include "mpeg2.h" #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> #include "libmpeg2_accel.h" /* diff --git a/src/libmpeg2/header.c b/src/video_dec/libmpeg2/header.c index 7f1ef1fc8..0c2b76891 100644 --- a/src/libmpeg2/header.c +++ b/src/video_dec/libmpeg2/header.c @@ -31,7 +31,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "attributes.h" +#include <xine/attributes.h> /* default intra quant matrix, in zig-zag order */ static const uint8_t default_intra_quantizer_matrix[64] ATTR_ALIGN(16) = { @@ -101,6 +101,14 @@ static uint32_t get_bits(uint8_t *buffer, uint32_t count, uint32_t *bit_position return result; } +static int32_t get_bits_signed(uint8_t *buffer, uint32_t count, uint32_t *bit_position) { + uint32_t value = get_bits(buffer, count, bit_position); + uint32_t sign_mask = (uint32_t)(-1 << (count - 1)); + if (value & sign_mask) + value |= sign_mask; /* sign-extend value */ + return (int32_t)value; +} + void mpeg2_header_state_init (picture_t * picture) { picture->scan = mpeg2_scan_norm; @@ -291,13 +299,13 @@ static int picture_display_extension (picture_t * picture, uint8_t * buffer) { bit_position = 0; padding = get_bits(buffer, 4, &bit_position); - picture->frame_centre_horizontal_offset = get_bits(buffer, 16, &bit_position); + picture->frame_centre_horizontal_offset = get_bits_signed(buffer, 16, &bit_position); padding = get_bits(buffer, 1, &bit_position); - picture->frame_centre_vertical_offset = get_bits(buffer, 16, &bit_position); + picture->frame_centre_vertical_offset = get_bits_signed(buffer, 16, &bit_position); padding = get_bits(buffer, 1, &bit_position); #ifdef LOG_PAN_SCAN - printf("Pan & Scan centre (x,y) = (%u, %u)\n", + printf("Pan & Scan centre (x,y) = (%d, %d)\n", picture->frame_centre_horizontal_offset, picture->frame_centre_vertical_offset); #endif diff --git a/src/libmpeg2/idct.c b/src/video_dec/libmpeg2/idct.c index 157beea31..9f216db58 100644 --- a/src/libmpeg2/idct.c +++ b/src/video_dec/libmpeg2/idct.c @@ -46,7 +46,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */ #define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */ diff --git a/src/libmpeg2/idct_altivec.c b/src/video_dec/libmpeg2/idct_altivec.c index ed8b58cfd..de396560b 100644 --- a/src/libmpeg2/idct_altivec.c +++ b/src/video_dec/libmpeg2/idct_altivec.c @@ -30,7 +30,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define vector_s16_t vector signed short #define vector_u16_t vector unsigned short diff --git a/src/libmpeg2/idct_mlib.c b/src/video_dec/libmpeg2/idct_mlib.c index e573c9790..e573c9790 100644 --- a/src/libmpeg2/idct_mlib.c +++ b/src/video_dec/libmpeg2/idct_mlib.c diff --git a/src/libmpeg2/idct_mlib.h b/src/video_dec/libmpeg2/idct_mlib.h index 1fb0787dd..1fb0787dd 100644 --- a/src/libmpeg2/idct_mlib.h +++ b/src/video_dec/libmpeg2/idct_mlib.h diff --git a/src/libmpeg2/idct_mmx.c b/src/video_dec/libmpeg2/idct_mmx.c index ce4bd064b..6bb4bfbf0 100644 --- a/src/libmpeg2/idct_mmx.c +++ b/src/video_dec/libmpeg2/idct_mmx.c @@ -28,7 +28,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define ROW_SHIFT 11 #define COL_SHIFT 6 diff --git a/src/libmpeg2/libmpeg2_accel.c b/src/video_dec/libmpeg2/libmpeg2_accel.c index 63c7b1b9b..92c0e280b 100644 --- a/src/libmpeg2/libmpeg2_accel.c +++ b/src/video_dec/libmpeg2/libmpeg2_accel.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "mpeg2.h" #include "mpeg2_internal.h" #include "xvmc_vld.h" diff --git a/src/libmpeg2/libmpeg2_accel.h b/src/video_dec/libmpeg2/libmpeg2_accel.h index 5d0b37a78..5d0b37a78 100644 --- a/src/libmpeg2/libmpeg2_accel.h +++ b/src/video_dec/libmpeg2/libmpeg2_accel.h diff --git a/src/libmpeg2/motion_comp.c b/src/video_dec/libmpeg2/motion_comp.c index 8779c1296..9328dfb9f 100644 --- a/src/libmpeg2/motion_comp.c +++ b/src/video_dec/libmpeg2/motion_comp.c @@ -27,7 +27,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> mpeg2_mc_t mpeg2_mc; diff --git a/src/libmpeg2/motion_comp_altivec.c b/src/video_dec/libmpeg2/motion_comp_altivec.c index 99719b7fb..99719b7fb 100644 --- a/src/libmpeg2/motion_comp_altivec.c +++ b/src/video_dec/libmpeg2/motion_comp_altivec.c diff --git a/src/libmpeg2/motion_comp_mlib.c b/src/video_dec/libmpeg2/motion_comp_mlib.c index 1a37070ae..1a37070ae 100644 --- a/src/libmpeg2/motion_comp_mlib.c +++ b/src/video_dec/libmpeg2/motion_comp_mlib.c diff --git a/src/libmpeg2/motion_comp_mmx.c b/src/video_dec/libmpeg2/motion_comp_mmx.c index 80a53685a..f9b1f085d 100644 --- a/src/libmpeg2/motion_comp_mmx.c +++ b/src/video_dec/libmpeg2/motion_comp_mmx.c @@ -28,7 +28,7 @@ #include <inttypes.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define CPU_MMXEXT 0 #define CPU_3DNOW 1 diff --git a/src/libmpeg2/motion_comp_vis.c b/src/video_dec/libmpeg2/motion_comp_vis.c index d0a6673d6..d0a6673d6 100644 --- a/src/libmpeg2/motion_comp_vis.c +++ b/src/video_dec/libmpeg2/motion_comp_vis.c diff --git a/src/libmpeg2/mpeg2.h b/src/video_dec/libmpeg2/mpeg2.h index 253f300a2..253f300a2 100644 --- a/src/libmpeg2/mpeg2.h +++ b/src/video_dec/libmpeg2/mpeg2.h diff --git a/src/libmpeg2/mpeg2_internal.h b/src/video_dec/libmpeg2/mpeg2_internal.h index c2ffbf909..eeaa16227 100644 --- a/src/libmpeg2/mpeg2_internal.h +++ b/src/video_dec/libmpeg2/mpeg2_internal.h @@ -24,7 +24,7 @@ #ifndef MPEG2_INTERNAL_H #define MPEG2_INTERNAL_H -#include "video_out.h" +#include <xine/video_out.h> #include "accel_xvmc.h" #ifdef ENABLE_ALTIVEC @@ -177,8 +177,8 @@ typedef struct picture_s { int progressive_sequence; int repeat_first_field; int progressive_frame; - uint32_t frame_centre_horizontal_offset; - uint32_t frame_centre_vertical_offset; + int32_t frame_centre_horizontal_offset; + int32_t frame_centre_vertical_offset; uint32_t video_format; uint32_t colour_description; uint32_t colour_primatives; diff --git a/src/libmpeg2/slice.c b/src/video_dec/libmpeg2/slice.c index 91a4c47b1..8247a9a24 100644 --- a/src/libmpeg2/slice.c +++ b/src/video_dec/libmpeg2/slice.c @@ -25,10 +25,10 @@ #include <inttypes.h> -#include "xine_internal.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> #include "mpeg2_internal.h" -#include "attributes.h" +#include <xine/attributes.h> #include "vlc.h" diff --git a/src/libmpeg2/slice_xvmc.c b/src/video_dec/libmpeg2/slice_xvmc.c index e21b1eb98..014ae7924 100644 --- a/src/libmpeg2/slice_xvmc.c +++ b/src/video_dec/libmpeg2/slice_xvmc.c @@ -28,12 +28,12 @@ #include <stdlib.h> #include <inttypes.h> -#include "xine_internal.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> #include "mpeg2_internal.h" -#include "xineutils.h" +#include <xine/xineutils.h> -#include "attributes.h" +#include <xine/attributes.h> #include "accel_xvmc.h" #include "xvmc.h" diff --git a/src/libmpeg2/slice_xvmc_vld.c b/src/video_dec/libmpeg2/slice_xvmc_vld.c index 7e370a519..3606cf66b 100644 --- a/src/libmpeg2/slice_xvmc_vld.c +++ b/src/video_dec/libmpeg2/slice_xvmc_vld.c @@ -17,8 +17,8 @@ * */ -#include "xine_internal.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> #include "mpeg2.h" #include "mpeg2_internal.h" #include "xvmc_vld.h" diff --git a/src/libmpeg2/stats.c b/src/video_dec/libmpeg2/stats.c index 04de526f1..63c701179 100644 --- a/src/libmpeg2/stats.c +++ b/src/video_dec/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/libmpeg2/vis.h b/src/video_dec/libmpeg2/vis.h index 69dd49075..69dd49075 100644 --- a/src/libmpeg2/vis.h +++ b/src/video_dec/libmpeg2/vis.h diff --git a/src/libmpeg2/vlc.h b/src/video_dec/libmpeg2/vlc.h index 65de9a840..65de9a840 100644 --- a/src/libmpeg2/vlc.h +++ b/src/video_dec/libmpeg2/vlc.h diff --git a/src/libmpeg2/xine_mpeg2_decoder.c b/src/video_dec/libmpeg2/xine_mpeg2_decoder.c index ccce02186..fc8bd4dc2 100644 --- a/src/libmpeg2/xine_mpeg2_decoder.c +++ b/src/video_dec/libmpeg2/xine_mpeg2_decoder.c @@ -34,11 +34,11 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> #include "mpeg2.h" #include "mpeg2_internal.h" -#include "buffer.h" +#include <xine/buffer.h> typedef struct { video_decoder_class_t decoder_class; @@ -155,7 +155,7 @@ static void *init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; +static const uint32_t supported_types[] = { BUF_VIDEO_MPEG, 0 }; static const decoder_info_t dec_info_mpeg2 = { supported_types, /* supported types */ diff --git a/src/libmpeg2/xvmc.h b/src/video_dec/libmpeg2/xvmc.h index 5d61bcf83..5d61bcf83 100644 --- a/src/libmpeg2/xvmc.h +++ b/src/video_dec/libmpeg2/xvmc.h diff --git a/src/libmpeg2/xvmc_vld.h b/src/video_dec/libmpeg2/xvmc_vld.h index 561d1789d..561d1789d 100644 --- a/src/libmpeg2/xvmc_vld.h +++ b/src/video_dec/libmpeg2/xvmc_vld.h diff --git a/src/libxinevdec/rgb.c b/src/video_dec/rgb.c index 5360fd8b2..9c8409e5f 100644 --- a/src/libxinevdec/rgb.c +++ b/src/video_dec/rgb.c @@ -42,10 +42,10 @@ /* #define LOG */ -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" typedef struct { diff --git a/src/libxinevdec/yuv.c b/src/video_dec/yuv.c index 352f59e9a..c1e5825c5 100644 --- a/src/libxinevdec/yuv.c +++ b/src/video_dec/yuv.c @@ -28,10 +28,10 @@ #include <sys/types.h> #include <unistd.h> -#include "xine_internal.h" -#include "video_out.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #include "bswap.h" #define VIDEOBUFSIZE 128*1024 diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index c2ea443e0..c1d142263 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -12,7 +12,7 @@ endif EXTRA_DIST = video_out_directx.c video_out_macosx.m -noinst_HEADERS = video_out_syncfb.h yuv2rgb.h x11osd.h xcbosd.h +noinst_HEADERS = yuv2rgb.h x11osd.h xcbosd.h xv_common.h if HAVE_X11 X11OSD = x11osd.c @@ -29,9 +29,6 @@ endif if ENABLE_OPENGL opengl_module = xineplug_vo_out_opengl.la endif -if ENABLE_SYNCFB -syncfb_module = xineplug_vo_out_syncfb.la -endif if ENABLE_SUNFB if ENABLE_SUNDGA pgx64_module = xineplug_vo_out_pgx64.la @@ -93,7 +90,6 @@ endif xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ $(opengl_module) \ - $(syncfb_module) \ $(pgx64_module) $(pgx32_module)\ $(vidix_module) \ $(aa_module) \ @@ -109,7 +105,7 @@ xineplug_LTLIBRARIES = $(xshm_module) $(xv_module) $(xvmc_module) \ xineplug_vo_out_none.la xineplug_vo_out_xcbshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c video_out_xcbshm.c $(XCBOSD) -xineplug_vo_out_xcbshm_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) +xineplug_vo_out_xcbshm_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) $(PTHREAD_LIBS) $(XCB_LIBS) $(XCBSHM_LIBS) $(LTLIBINTL) xineplug_vo_out_xcbshm_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) $(XCB_CFLAGS) $(XCBSHM_CFLAGS) xineplug_vo_out_xcbxv_la_SOURCES = video_out_xcbxv.c $(XCBOSD) @@ -118,20 +114,20 @@ xineplug_vo_out_xcbxv_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS) $(XCBXV_CFLAGS) xineplug_vo_out_xshm_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_xshm.c $(X11OSD) -xineplug_vo_out_xshm_la_LIBADD = $(MLIB_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_xshm_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xshm_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xv_la_SOURCES = $(X11OSD) video_out_xv.c -xineplug_vo_out_xv_la_LIBADD = $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_xv_la_LIBADD = $(XINE_LIB) $(XV_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xv_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_xvmc_la_SOURCES = video_out_xvmc.c -xineplug_vo_out_xvmc_la_LIBADD = $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_xvmc_la_LIBADD = $(XINE_LIB) $(XVMC_LIBS) $(XV_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xvmc_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) xineplug_vo_out_xxmc_la_SOURCES = $(X11OSD) video_out_xxmc.c\ xvmc_mocomp.c xvmc_vld.c xxmc.h -xineplug_vo_out_xxmc_la_LIBADD = $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_xxmc_la_LIBADD = $(XINE_LIB) $(XXMC_LIBS) $(XV_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_xxmc_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(XV_CFLAGS) -fno-strict-aliasing xineplug_vo_out_opengl_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ @@ -140,9 +136,6 @@ xineplug_vo_out_opengl_la_LIBADD = $(MLIB_LIBS) $(OPENGL_LIBS) $(GLUT_LIBS) \ $(GLU_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) xineplug_vo_out_opengl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(MLIB_CFLAGS) -fno-strict-aliasing -xineplug_vo_out_syncfb_la_SOURCES = video_out_syncfb.c -xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) - xineplug_vo_out_pgx64_la_SOURCES = video_out_pgx64.c xineplug_vo_out_pgx64_la_LIBADD = $(XINE_LIB) $(X_LIBS) $(SUNDGA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_pgx64_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) @@ -154,7 +147,7 @@ xineplug_vo_out_pgx32_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) xineplug_vo_out_pgx32_la_CPPFLAGS = $(AM_CPPFLAGS) $(SUNDGA_CPPFLAGS) xineplug_vo_out_vidix_la_SOURCES = video_out_vidix.c $(X11OSD) -xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ +xineplug_vo_out_vidix_la_LIBADD = $(XINE_LIB) $(X_LIBS) \ $(top_builddir)/contrib/vidix/libvidix.la $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_vidix_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) -fno-strict-aliasing xineplug_vo_out_vidix_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/contrib/vidix \ @@ -162,17 +155,17 @@ xineplug_vo_out_vidix_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)/contrib/vid xineplug_vo_out_aa_la_SOURCES = video_out_aa.c -xineplug_vo_out_aa_la_LIBADD = $(AALIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_aa_la_LIBADD = $(XINE_LIB) $(AALIB_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_aa_la_CFLAGS = $(AM_CFLAGS) $(AALIB_CFLAGS) xineplug_vo_out_caca_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_caca.c -xineplug_vo_out_caca_la_LIBADD = $(CACA_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_caca_la_LIBADD = $(XINE_LIB) $(CACA_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_caca_la_CFLAGS = $(AM_CFLAGS) $(CACA_CFLAGS) xineplug_vo_out_fb_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c yuv2rgb_mlib.c \ video_out_fb.c -xineplug_vo_out_fb_la_LIBADD = $(MLIB_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_fb_la_LIBADD = $(XINE_LIB) $(MLIB_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_fb_la_CFLAGS = $(AM_CFLAGS) $(MLIB_CFLAGS) xineplug_vo_out_directfb_la_SOURCES = video_out_directfb.c @@ -184,7 +177,7 @@ xineplug_vo_out_xdirectfb_la_LIBADD = $(XINE_LIB) $(DIRECTFB_LIBS) $(X_LIBS) $(P xineplug_vo_out_xdirectfb_la_CFLAGS = $(AM_CFLAGS) $(DIRECTFB_CFLAGS) -fno-strict-aliasing -DDIRECTFB_X11 xineplug_vo_out_sdl_la_SOURCES = video_out_sdl.c -xineplug_vo_out_sdl_la_LIBADD = $(SDL_LIBS) $(X_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) $(LTLIBINTL) +xineplug_vo_out_sdl_la_LIBADD = $(XINE_LIB) $(SDL_LIBS) $(X_LIBS) $(PTHREAD_LIBS) $(LTLIBINTL) xineplug_vo_out_sdl_la_CFLAGS = $(AM_CFLAGS) $(X_CFLAGS) $(SDL_CFLAGS) xineplug_vo_out_stk_la_SOURCES = video_out_stk.c @@ -192,7 +185,7 @@ xineplug_vo_out_stk_la_LIBADD = $(XINE_LIB) $(LIBSTK_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_stk_la_CFLAGS = $(AM_CFLAGS) $(LIBSTK_CFLAGS) xineplug_vo_out_directx_la_SOURCES = yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c -xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(PTHREAD_LIBS) +xineplug_vo_out_directx_la_LIBADD = $(XINE_LIB) $(DIRECTX_VIDEO_LIBS) $(PTHREAD_LIBS) xineplug_vo_out_directx_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIRECTX_CPPFLAGS) xineplug_vo_out_none_la_SOURCES = video_out_none.c diff --git a/src/video_out/macosx/XineOpenGLView.m b/src/video_out/macosx/XineOpenGLView.m index a9ffee00f..cad087551 100644 --- a/src/video_out/macosx/XineOpenGLView.m +++ b/src/video_out/macosx/XineOpenGLView.m @@ -30,11 +30,7 @@ #import "XineOpenGLView.h" -#ifdef XINE_COMPILE -# include "xineutils.h" -#else -# include <xine/xineutils.h> -#endif +#include <xine/xineutils.h> NSString *XineViewDidResizeNotification EXPORTED = @"XineViewDidResizeNotification"; @@ -340,7 +336,7 @@ NSColorToYUV(NSColor *color) // http://developer.apple.com/samplecode/Sample_Code/Graphics_3D/TextureRange/MainOpenGLView.m.htm glTexSubImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, videoSize.width, videoSize.height, GL_YCBCR_422_APPLE, -#if WORDS_BIG_ENDIAN +#if WORDS_BIGENDIAN GL_UNSIGNED_SHORT_8_8_APPLE, #else GL_UNSIGNED_SHORT_8_8_REV_APPLE, diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c index bcbe2477e..ff9abd320 100644 --- a/src/video_out/video_out_aa.c +++ b/src/video_out/video_out_aa.c @@ -38,9 +38,9 @@ #include <aalib.h> #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> /* * global variables diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c index 231befcdb..6b9f3756e 100644 --- a/src/video_out/video_out_caca.c +++ b/src/video_out/video_out_caca.c @@ -38,10 +38,10 @@ #include <caca.h> #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> #include "yuv2rgb.h" -#include "xineutils.h" +#include <xine/xineutils.h> /* * structures diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c index 3445be127..d85df411a 100644 --- a/src/video_out/video_out_directfb.c +++ b/src/video_out/video_out_directfb.c @@ -39,10 +39,10 @@ #define LOG_VERBOSE #include "xine.h" -#include "xine_internal.h" -#include "video_out.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #ifdef DIRECTFB_X11 # include "x11osd.h" @@ -155,7 +155,7 @@ typedef struct { #define DEFAULT_COLORKEY 0x202040 #define DIRECTFB_OPTIONS "no-banner,"\ - "bg-color=00000000,"\ + "bg-colour=00000000,"\ "no-vt-switch,"\ "no-vt-switching,"\ "no-sighandler,"\ @@ -504,7 +504,7 @@ static void directfb_subpicture_paint (directfb_driver_t *this, colors[index].a = alpha | (alpha << 4); } - lprintf ("color change to %02x%02x%02x%02x.\n", + lprintf ("colour change to %02x%02x%02x%02x.\n", colors[index].a, colors[index].r, colors[index].g, colors[index].b); this->spic_surface->SetColor (this->spic_surface, @@ -922,7 +922,7 @@ static int directfb_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; - + case VO_PROP_MAX_NUM_FRAMES: return (this->type & DLTF_VIDEO) ? 8 : 15; @@ -949,7 +949,7 @@ static int directfb_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_NUM_RATIOS-1; xprintf (this->xine, XINE_VERBOSITY_DEBUG, "video_out_directfb: aspect ratio changed to %s.\n", - _x_vo_scale_aspect_ratio_name (value)); + _x_vo_scale_aspect_ratio_name_table[value]); this->sc.user_ratio = value; _x_vo_scale_compute_ideal_size (&this->sc); this->sc.force_redraw = 1; @@ -1008,7 +1008,7 @@ static int directfb_set_property (vo_driver_t *this_gen, if (value > 0xffffff) value = 0xffffff; xprintf (this->xine, XINE_VERBOSITY_DEBUG, - "video_out_directfb: setting colorkey to 0x%06x.\n", value); + "video_out_directfb: setting colour key to 0x%06x.\n", value); this->colorkey = value; this->layer->SetDstColorKey (this->layer, (value & 0xff0000) >> 16, (value & 0x00ff00) >> 8, @@ -1266,7 +1266,7 @@ static void update_config_cb (void *data, xine_cfg_entry_t *entry) { if (config.options != this->config.options) { if (this->layer->SetConfiguration (this->layer, &config) != DFB_OK) { xprintf (this->xine, XINE_VERBOSITY_LOG, - "video_out_directfb: failed to set colorkeying to %d!\n", + "video_out_directfb: failed to set colour keying to %d!\n", entry->num_value); return; } @@ -1354,15 +1354,15 @@ static void init_config (directfb_driver_t *this) { if (this->caps & DLCAPS_DST_COLORKEY) { this->colorkeying = config->register_bool (config, "video.device.directfb_colorkeying", this->colorkeying, - _("enable video color key"), - _("Enable using a color key to tell the graphics card " + _("enable video colour key"), + _("Enable using a colour key to tell the graphics card " "where to overlay the video image."), 20, update_config_cb, (void *)this); this->colorkey = config->register_range (config, "video.device.directfb_colorkey", this->colorkey, 0, 0xffffff, - _("video color key"), - _("The color key is used to tell the graphics card " + _("video colour key"), + _("The colour key is used to tell the graphics card " "where to overlay the video image. Try different values, " "if you experience windows becoming transparent."), 10, update_config_cb, (void *)this); diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index b70709856..c2b3aa101 100644 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -35,10 +35,10 @@ typedef unsigned char boolean; */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "yuv2rgb.h" #define NEW_YUV 1 diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c index 859959455..17224ecad 100644 --- a/src/video_out/video_out_fb.c +++ b/src/video_out/video_out_fb.c @@ -55,7 +55,7 @@ #include <fcntl.h> #include "xine.h" -#include "video_out.h" +#include <xine/video_out.h> #include <errno.h> @@ -78,10 +78,10 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "yuv2rgb.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> typedef struct fb_frame_s { @@ -600,7 +600,19 @@ static int fb_get_property(vo_driver_t *this_gen, int property) case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; - + + case VO_PROP_OUTPUT_WIDTH: + return this->cur_frame->sc.output_width; + + case VO_PROP_OUTPUT_HEIGHT: + return this->cur_frame->sc.output_height; + + case VO_PROP_OUTPUT_XOFFSET: + return this->cur_frame->sc.output_xoffset; + + case VO_PROP_OUTPUT_YOFFSET: + return this->cur_frame->sc.output_yoffset; + default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_fb: tried to get unsupported property %d\n", property); @@ -620,7 +632,7 @@ static int fb_set_property(vo_driver_t *this_gen, int property, int value) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + "video_out_fb: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); break; case VO_PROP_BRIGHTNESS: @@ -743,7 +755,7 @@ static int get_fb_fix_screeninfo(int fd, struct fb_fix_screeninfo *fix, xine_t * fix->type != FB_TYPE_PACKED_PIXELS) { xprintf(xine, XINE_VERBOSITY_LOG, - _("video_out_fb: only packed truecolor/directcolor is supported (%d).\n" + _("video_out_fb: only packed truecolour/directcolour is supported (%d).\n" " Check 'fbset -i' or try 'fbset -depth 16'.\n"), fix->visual); return 0; } @@ -797,7 +809,7 @@ static void register_callbacks(fb_driver_t *this) static int open_fb_device(config_values_t *config, xine_t *xine) { static const char devkey[] = "video.device.fb_device"; - char *device_name; + const char *device_name; int fd; /* This config entry is security critical, is it really necessary diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c index c28b0334e..c23c828a6 100644 --- a/src/video_out/video_out_none.c +++ b/src/video_out/video_out_none.c @@ -33,10 +33,10 @@ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> typedef struct { vo_frame_t vo_frame; diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index 04413eb80..21383453e 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -88,11 +88,11 @@ #endif #include "xine.h" -#include "video_out.h" +#include <xine/video_out.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "yuv2rgb.h" -#include "xineutils.h" +#include <xine/xineutils.h> #include "x11osd.h" @@ -1613,7 +1613,7 @@ static int opengl_set_property (vo_driver_t *this_gen, this->sc.force_redraw = 1; /* trigger re-calc of output size */ xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + "video_out_opengl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); break; case VO_PROP_BRIGHTNESS: this->yuv2rgb_brightness = value; diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c index 505a257ce..884f9939f 100644 --- a/src/video_out/video_out_pgx32.c +++ b/src/video_out/video_out_pgx32.c @@ -41,10 +41,10 @@ #include <X11/Xatom.h> #include <dga/dga.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "bswap.h" -#include "vo_scale.h" -#include "xineutils.h" +#include <xine/vo_scale.h> +#include <xine/xineutils.h> /* gfxp register defines */ diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c index 21dcdfb09..d0e74b1e3 100644 --- a/src/video_out/video_out_pgx64.c +++ b/src/video_out/video_out_pgx64.c @@ -43,10 +43,10 @@ #include <X11/Xatom.h> #include <dga/dga.h> -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "bswap.h" -#include "vo_scale.h" -#include "xineutils.h" +#include <xine/vo_scale.h> +#include <xine/xineutils.h> /* * The maximum number of frames that can be used in multi-buffering diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c index 6ee6b19bd..13a84475d 100644 --- a/src/video_out/video_out_sdl.c +++ b/src/video_out/video_out_sdl.c @@ -59,10 +59,10 @@ */ #include "xine.h" -#include "xine_internal.h" -#include "video_out.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #ifdef HAVE_X11 #include <X11/Xlib.h> @@ -360,6 +360,14 @@ static int sdl_get_property (vo_driver_t *this_gen, int property) { return this->sc.gui_width; case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; + case VO_PROP_OUTPUT_WIDTH: + return this->sc.output_width; + case VO_PROP_OUTPUT_HEIGHT: + return this->sc.output_height; + case VO_PROP_OUTPUT_XOFFSET: + return this->sc.output_xoffset; + case VO_PROP_OUTPUT_YOFFSET: + return this->sc.output_yoffset; case VO_PROP_ASPECT_RATIO: return this->sc.user_ratio; } @@ -376,7 +384,7 @@ static int sdl_set_property (vo_driver_t *this_gen, value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_sdl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + "video_out_sdl: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); sdl_compute_ideal_size (this); this->sc.force_redraw = 1; diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c index 45e9900fd..e68efb30b 100644 --- a/src/video_out/video_out_stk.c +++ b/src/video_out/video_out_stk.c @@ -59,10 +59,10 @@ */ #include "xine.h" -#include "xine_internal.h" -#include "video_out.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> /* Extend the video frame class with stk private data */ typedef struct stk_frame_s { @@ -327,7 +327,7 @@ static int stk_set_property (vo_driver_t* this_gen, int property, int value) { value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); + "video_out_stk: aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); stk_compute_ideal_size (this); this->sc.force_redraw = 1; diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c deleted file mode 100644 index 013695c46..000000000 --- a/src/video_out/video_out_syncfb.c +++ /dev/null @@ -1,1108 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine - * - * based on video_out_xv.c by (see file for original authors) - * - * with lot's of code from: - * video_out_syncfb.c by Joachim Koenig <joachim.koenig@gmx.net> - * and by Matthias Oelmann <mao@well.com> - * video_out_mga by Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * - * glued together for xine by Matthias Dahl <matthew2k@web.de> - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef __sun -#include <sys/ioccom.h> -#endif - -#include <sys/ioctl.h> -#if defined (__FreeBSD__) -#include <sys/types.h> -#endif -#include <sys/mman.h> -#include <math.h> -#include <fcntl.h> -#include <unistd.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> - -#include "video_out_syncfb.h" - -#include "xine.h" -#include "video_out.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "vo_scale.h" - -/*#define DEBUG_OUTPUT*/ - -typedef struct syncfb_driver_s syncfb_driver_t; - -typedef struct { - int value; - int min; - int max; -} syncfb_property_t; - -typedef struct { - vo_frame_t vo_frame; -/* uint8_t* data_mem[3];*/ - int width, height, format; - double ratio; -} syncfb_frame_t; - -struct syncfb_driver_s { - - vo_driver_t vo_driver; - - config_values_t *config; - - /* X11 related stuff */ - Display *display; - int screen; - Drawable drawable; - XVisualInfo vinfo; - GC gc; - XColor black; - - vo_scale_t sc; - - int virtual_screen_width; - int virtual_screen_height; - int screen_depth; - - syncfb_property_t props[VO_NUM_PROPERTIES]; - - syncfb_frame_t* cur_frame; - vo_overlay_t* overlay; - - /* syncfb module related stuff */ - int fd; /* file descriptor of the syncfb device */ - int yuv_format; /* either YUV420P3, YUV420P2 or YUV422 */ - int overlay_state; /* 0 = off, 1 = on */ - uint8_t* video_mem; /* mmapped video memory */ - int default_repeat; /* how many times a frame will be repeatedly displayed */ - uint32_t supported_capabilities; - - syncfb_config_t syncfb_config; - syncfb_capability_t capabilities; - syncfb_buffer_info_t bufinfo; - syncfb_param_t params; - - int video_win_visibility; - xine_t *xine; - - alphablend_t alphablend_extra_data; -}; - -typedef struct { - video_driver_class_t driver_class; - - config_values_t *config; - char *device_name; - xine_t *xine; -} syncfb_class_t; - -/* - * internal video_out_syncfb functions - */ - -/* returns boolean value (1 success, 0 failure) */ -static int syncfb_overlay_on(syncfb_driver_t* this) -{ - if(ioctl(this->fd, SYNCFB_ON)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (on ioctl failed)\n"); - return 0; - } else { - this->overlay_state = 1; - return 1; - } -} - -/* returns boolean value (1 success, 0 failure) */ -static int syncfb_overlay_off(syncfb_driver_t* this) -{ - if(ioctl(this->fd, SYNCFB_OFF)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (off ioctl failed)\n"); - return 0; - } else { - this->overlay_state = 0; - return 1; - } -} - -static void write_frame_YUV422(syncfb_driver_t* this, syncfb_frame_t* frame) -{ - uint8_t* y = (uint_8 *)frame->vo_frame.base[0]; - uint8_t* cb = (uint_8 *)frame->vo_frame.base[1]; - uint8_t* cr = (uint_8 *)frame->vo_frame.base[2]; - uint8_t* crp; - uint8_t* cbp; - uint32_t* dst32 = (uint32_t *)(this->video_mem + this->bufinfo.offset); - int h,w; - - for(h = 0; h < (frame->height / 2); h++) { - cbp = cb; - crp = cr; - - for(w = 0; w < (frame->width / 2); w++) { - *dst32++ = (*y) + ((*cb)<<8) + ((*(y+1))<<16) + ((*cr)<<24); - y++; y++; cb++; cr++; - } - - dst32 += (this->syncfb_config.src_pitch - frame->width) / 2; - - for(w=0; w < (frame->width / 2); w++) { - *dst32++ = (*y) + ((*cbp)<<8) + ((*(y+1))<<16) + ((*crp)<<24); - y++; y++; cbp++; crp++; - } - - dst32 += (this->syncfb_config.src_pitch - frame->width) / 2; - } -} - -static void write_frame_YUV420P2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ - uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; - uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; - uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; - uint8_t* dst8 = this->video_mem + this->bufinfo.offset_p2; - int h, w; - - register uint32_t* tmp32; - register uint8_t* rcr; - register uint8_t* rcb; - - rcr = cr; - rcb = cb; - - for(h = 0; h < (frame->height / 2); h++) { - tmp32 = (uint32_t *)dst8; - w = (frame->width / 8) * 2; - - while(w--) { - register uint32_t temp; - - temp = (*rcb) | (*rcr << 8); - rcr++; - rcb++; - temp |= (*rcb << 16) | (*rcr << 24); - rcr++; - rcb++; - *tmp32 = temp; - tmp32++; - } - - dst8 += this->syncfb_config.src_pitch; - } - - dst8 = this->video_mem + this->bufinfo.offset; - for(h = 0; h < frame->height; h++) { - xine_fast_memcpy(dst8, y, frame->width); - y += frame->width; - dst8 += this->syncfb_config.src_pitch; - } -} - -static void write_frame_YUV420P3(syncfb_driver_t* this, syncfb_frame_t* frame) -{ - uint8_t* y = (uint8_t *)frame->vo_frame.base[0]; - uint8_t* cb = (uint8_t *)frame->vo_frame.base[1]; - uint8_t* cr = (uint8_t *)frame->vo_frame.base[2]; - uint8_t* dst8 = this->video_mem + this->bufinfo.offset; - int h, half_width = (frame->width/2); - - for(h = 0; h < frame->height; h++) { - xine_fast_memcpy(dst8, y, frame->width); - y += frame->width; - dst8 += this->syncfb_config.src_pitch; - } - - dst8 = this->video_mem; - for(h = 0; h < (frame->height / 2); h++) { - xine_fast_memcpy((dst8 + this->bufinfo.offset_p2), cb, half_width); - xine_fast_memcpy((dst8 + this->bufinfo.offset_p3), cr, half_width); - - cb += half_width; - cr += half_width; - - dst8 += (this->syncfb_config.src_pitch / 2); - } -} - -static void write_frame_YUY2(syncfb_driver_t* this, syncfb_frame_t* frame) -{ - uint8_t* src8 = (uint8_t *)frame->vo_frame.base[0]; - uint8_t* dst8 = (uint8_t *)(this->video_mem + this->bufinfo.offset); - int h, double_width = (frame->width * 2); - - for(h = 0; h < frame->height; h++) { - xine_fast_memcpy(dst8, src8, double_width); - - dst8 += (this->syncfb_config.src_pitch * 2); - src8 += double_width; - } -} - -static void write_frame_sfb(syncfb_driver_t* this, syncfb_frame_t* frame) -{ - switch(frame->format) { - case XINE_IMGFMT_YUY2: - if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) - write_frame_YUY2(this, frame); - else - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_syncfb: error. (YUY2 not supported by your graphic card)\n")); - break; - - case XINE_IMGFMT_YV12: - switch(this->yuv_format) { - case VIDEO_PALETTE_YUV422: - write_frame_YUV422(this, frame); - break; - case VIDEO_PALETTE_YUV420P2: - write_frame_YUV420P2(this, frame); - break; - case VIDEO_PALETTE_YUV420P3: - write_frame_YUV420P3(this, frame); - break; - default: - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_syncfb: error. (YV12 not supported by your graphic card)\n")); - } - break; - - default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (unknown frame format)\n"); - break; - } - - frame->vo_frame.free(&frame->vo_frame); -} - -static void free_framedata(syncfb_frame_t* frame) -{ -/* if(frame->data_mem[0]) { - free(frame->data_mem[0]); - frame->data_mem[0] = NULL; - } - - if(frame->data_mem[1]) { - free(frame->data_mem[1]); - frame->data_mem[1] = NULL; - } - - if(frame->data_mem[2]) { - free(frame->data_mem[2]); - frame->data_mem[2] = NULL; - }*/ - - if(frame->vo_frame.base[0]) { - free(frame->vo_frame.base[0]); - frame->vo_frame.base[0] = NULL; - } - - if(frame->vo_frame.base[1]) { - free(frame->vo_frame.base[1]); - frame->vo_frame.base[1] = NULL; - } - - if(frame->vo_frame.base[2]) { - free(frame->vo_frame.base[2]); - frame->vo_frame.base[2] = NULL; - } -} - -static void syncfb_clean_output_area(syncfb_driver_t* this) -{ - XLockDisplay (this->display); - - XSetForeground (this->display, this->gc, this->black.pixel); - - XFillRectangle(this->display, this->drawable, this->gc, - this->sc.gui_x, this->sc.gui_y, this->sc.gui_width, this->sc.gui_height); - - XUnlockDisplay (this->display); -} - - -static void syncfb_compute_ideal_size (syncfb_driver_t *this) -{ - _x_vo_scale_compute_ideal_size( &this->sc ); -} - -/* make ideal width/height "fit" into the gui */ -static void syncfb_compute_output_size(syncfb_driver_t *this) -{ - _x_vo_scale_compute_output_size( &this->sc ); - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (frame source %d x %d, screen output %d x %d)\n", - this->sc.delivered_width, this->sc.delivered_height, - this->sc.output_width, this->sc.output_height); -#endif - - /* - * configuring SyncFB module from this point on. - */ - syncfb_overlay_off(this); - - /* sanity checking - certain situations *may* crash the SyncFB module, so - * take care that we always have valid numbers. - */ - if(this->sc.output_xoffset >= 0 && this->sc.output_yoffset >= 0 && - this->cur_frame->width > 0 && this->cur_frame->height > 0 && - this->sc.output_width > 0 && this->sc.output_height > 0 && - this->cur_frame->format > 0 && this->video_win_visibility) { - - if(ioctl(this->fd, SYNCFB_GET_CONFIG, &this->syncfb_config)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (get_config ioctl failed)\n"); - - this->syncfb_config.syncfb_mode = SYNCFB_FEATURE_SCALE | SYNCFB_FEATURE_CROP; - - if(this->props[VO_PROP_INTERLACED].value) - this->syncfb_config.syncfb_mode |= SYNCFB_FEATURE_DEINTERLACE; - - switch(this->cur_frame->format) { - case XINE_IMGFMT_YV12: - this->syncfb_config.src_palette = this->yuv_format; - break; - case XINE_IMGFMT_YUY2: - this->syncfb_config.src_palette = VIDEO_PALETTE_YUV422; - break; - default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (unknown frame format)\n"); - this->syncfb_config.src_palette = 0; - break; - } - - this->syncfb_config.fb_screen_size = this->virtual_screen_width * this->virtual_screen_height * (this->screen_depth / 8) * 2; - this->syncfb_config.src_width = this->cur_frame->width; - this->syncfb_config.src_height = this->cur_frame->height; - - this->syncfb_config.image_width = this->sc.output_width; - this->syncfb_config.image_height = this->sc.output_height; - - this->syncfb_config.image_xorg = this->sc.output_xoffset + this->sc.gui_win_x; - this->syncfb_config.image_yorg = this->sc.output_yoffset + this->sc.gui_win_y; - - this->syncfb_config.src_crop_top = this->sc.displayed_yoffset; - this->syncfb_config.src_crop_bot = (this->props[VO_PROP_INTERLACED].value && this->sc.displayed_yoffset == 0) ? 1 : this->sc.displayed_yoffset; - this->syncfb_config.src_crop_left = this->sc.displayed_xoffset; - this->syncfb_config.src_crop_right = this->sc.displayed_xoffset; - - this->syncfb_config.default_repeat = (this->props[VO_PROP_INTERLACED].value) ? 1 : this->default_repeat; - - if(this->capabilities.palettes & (1<<this->syncfb_config.src_palette)) { - if(ioctl(this->fd,SYNCFB_SET_CONFIG,&this->syncfb_config)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (set_config ioctl failed)\n"); - - syncfb_overlay_on(this); - } - } -} - -/* - * public functions defined and used by the xine interface - */ - -static int syncfb_redraw_needed(vo_driver_t* this_gen) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - int ret = 0; - - if( _x_vo_scale_redraw_needed( &this->sc ) ) { - - syncfb_compute_output_size (this); - - syncfb_clean_output_area (this); - - ret = 1; - } - - return ret; -} - -static uint32_t syncfb_get_capabilities (vo_driver_t *this_gen) -{ - syncfb_driver_t *this = (syncfb_driver_t *) this_gen; - - return this->supported_capabilities; -} - -static void syncfb_frame_field (vo_frame_t *vo_img, int which_field) -{ - /* not needed for SyncFB */ -} - -static void syncfb_frame_dispose(vo_frame_t* vo_img) -{ - syncfb_frame_t* frame = (syncfb_frame_t *) vo_img; - - if(frame) { - free_framedata(frame); - free(frame); - } -} - -static vo_frame_t* syncfb_alloc_frame(vo_driver_t* this_gen) -{ - /* syncfb_driver_t *this = (syncfb_driver_t *) this_gen; */ - syncfb_frame_t *frame; - - frame = (syncfb_frame_t *) xine_xmalloc(sizeof(syncfb_frame_t)); - if(!frame) - return NULL; - - pthread_mutex_init(&frame->vo_frame.mutex, NULL); - - frame->vo_frame.base[0] = NULL; - frame->vo_frame.base[1] = NULL; - frame->vo_frame.base[2] = NULL; - - /* - * supply required functions - */ - frame->vo_frame.proc_slice = NULL; - frame->vo_frame.proc_frame = NULL; - frame->vo_frame.field = syncfb_frame_field; - frame->vo_frame.dispose = syncfb_frame_dispose; - - frame->vo_frame.driver = this_gen; - - return (vo_frame_t *) frame; -} - -static void syncfb_update_frame_format(vo_driver_t* this_gen, - vo_frame_t* frame_gen, - uint32_t width, uint32_t height, - double ratio, int format, int flags) -{ - syncfb_driver_t *this = (syncfb_driver_t *) this_gen; - syncfb_frame_t *frame = (syncfb_frame_t *) frame_gen; - /* uint32_t frame_size = width*height; */ - - if((frame->width != width) - || (frame->height != height) - || (frame->format != format)) { - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (update frame format: old values [width=%d, height=%d, format=%04x], new values [width=%d, height=%d, format=%04x])\n", frame->width, frame->height, frame->format, width, height, format); -#endif - free_framedata(frame); - - frame->width = width; - frame->height = height; - frame->format = format; - - switch(format) { - case XINE_IMGFMT_YV12: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, frame_size, (void **)&frame->data_mem[0]); - frame->vo_frame.base[1] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[1]); - frame->vo_frame.base[2] = xine_xmalloc_aligned(16, frame_size/4, (void **)&frame->data_mem[2]);*/ - frame->vo_frame.pitches[0] = 8*((width + 7) / 8); - frame->vo_frame.pitches[1] = 8*((width + 15) / 16); - frame->vo_frame.pitches[2] = 8*((width + 15) / 16); - frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); - frame->vo_frame.base[1] = malloc(frame->vo_frame.pitches[1] * ((height+1)/2)); - frame->vo_frame.base[2] = malloc(frame->vo_frame.pitches[2] * ((height+1)/2)); - break; - case XINE_IMGFMT_YUY2: -/* frame->vo_frame.base[0] = xine_xmalloc_aligned(16, (frame_size*2), (void **)&frame->data_mem[0]);*/ - frame->vo_frame.pitches[0] = 8*((width + 3) / 4); - frame->vo_frame.base[0] = malloc(frame->vo_frame.pitches[0] * height); - frame->vo_frame.base[1] = NULL; - frame->vo_frame.base[2] = NULL; - break; - default: - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (unable to allocate " - "framedata because of unknown frame format: %04x)\n", format); - } - -/* if((format == IMGFMT_YV12 && (frame->data_mem[0] == NULL || frame->data_mem[1] == NULL || frame->data_mem[2] == NULL)) - || (format == IMGFMT_YUY2 && frame->data_mem[0] == NULL)) {*/ - if((format == XINE_IMGFMT_YV12 && (frame->vo_frame.base[0] == NULL || frame->vo_frame.base[1] == NULL || frame->vo_frame.base[2] == NULL)) - || (format == XINE_IMGFMT_YUY2 && frame->vo_frame.base[0] == NULL)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (framedata allocation failed: out of memory)\n"); - - free_framedata(frame); - } - } - - frame->ratio = ratio; -} - -static void syncfb_overlay_blend(vo_driver_t* this_gen, vo_frame_t* frame_gen, vo_overlay_t* overlay) -{ - syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - this->alphablend_extra_data.offset_x = frame_gen->overlay_offset_x; - this->alphablend_extra_data.offset_y = frame_gen->overlay_offset_y; - - /* alpha blend here */ - if (overlay->rle) { - if (frame->format == XINE_IMGFMT_YV12) - _x_blend_yuv(frame->vo_frame.base, overlay, frame->width, frame->height, frame->vo_frame.pitches, &this->alphablend_extra_data); - else - _x_blend_yuy2(frame->vo_frame.base[0], overlay, frame->width, frame->height, frame->vo_frame.pitches[0], &this->alphablend_extra_data); - } -} - -static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - syncfb_frame_t* frame = (syncfb_frame_t *) frame_gen; - - this->cur_frame = frame; - - /* - * let's see if this frame is different in size / aspect - * ratio from the previous one - */ - if((frame->width != this->sc.delivered_width) - || (frame->height != this->sc.delivered_height) - || (frame->ratio != this->sc.delivered_ratio)) { -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (frame format changed)\n"); -#endif - - this->sc.delivered_width = frame->width; - this->sc.delivered_height = frame->height; - this->sc.delivered_ratio = frame->ratio; - - this->sc.crop_left = frame->vo_frame.crop_left; - this->sc.crop_right = frame->vo_frame.crop_right; - this->sc.crop_top = frame->vo_frame.crop_top; - this->sc.crop_bottom = frame->vo_frame.crop_bottom; - - syncfb_compute_ideal_size(this); - - this->sc.force_redraw = 1; - } - - /* - * tell gui that we are about to display a frame, - * ask for offset and output size - */ - syncfb_redraw_needed(this_gen); - - /* the rest is only successful and safe, if the overlay is really on */ - if(this->overlay_state) { - if(this->bufinfo.id != -1) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (invalid syncfb image buffer state)\n"); - frame->vo_frame.free(&frame->vo_frame); - - return; - } - - if(ioctl(this->fd, SYNCFB_REQUEST_BUFFER, &this->bufinfo)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (request ioctl failed)\n"); - - if(this->bufinfo.id == -1) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (syncfb module couldn't allocate image buffer)\n"); - frame->vo_frame.free(&frame->vo_frame); - - /* - * there are several "fixable" situations when this request will fail. - * for example when the screen resolution changes, the kernel module - * will get confused - reinitializing everything will fix things for - * the next frame in that case. - */ - syncfb_compute_ideal_size(this); - syncfb_compute_output_size(this); - syncfb_clean_output_area(this); - - return; - } - - write_frame_sfb(this, frame); - - if(ioctl(this->fd, SYNCFB_COMMIT_BUFFER, &this->bufinfo)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, "video_out_syncfb: error. (commit ioctl failed)\n"); - } - else - frame->vo_frame.free(&frame->vo_frame); - - this->bufinfo.id = -1; -} - -static int syncfb_get_property(vo_driver_t* this_gen, int property) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - switch (property) { - case VO_PROP_WINDOW_WIDTH: - this->props[property].value = this->sc.gui_width; - break; - case VO_PROP_WINDOW_HEIGHT: - this->props[property].value = this->sc.gui_height; - break; - } - - return this->props[property].value; -} - -static int syncfb_set_property(vo_driver_t* this_gen, int property, int value) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - switch (property) { - case VO_PROP_INTERLACED: - this->props[property].value = value; - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_INTERLACED(%d))\n", - this->props[property].value); -#endif - - syncfb_compute_ideal_size(this); - syncfb_compute_output_size(this); - syncfb_clean_output_area(this); - break; - - case VO_PROP_ASPECT_RATIO: - if(value >= XINE_VO_ASPECT_NUM_RATIOS) - value = XINE_VO_ASPECT_AUTO; - - this->props[property].value = value; - this->sc.user_ratio = value; - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_ASPECT_RATIO(%d))\n", - this->props[property].value); -#endif - - syncfb_compute_ideal_size(this); - syncfb_compute_output_size(this); - syncfb_clean_output_area(this); - break; - - case VO_PROP_ZOOM_X: - if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { - this->props[property].value = value; - this->sc.zoom_factor_x = (double)value / (double)XINE_VO_ZOOM_STEP; - - syncfb_compute_ideal_size (this); - - this->sc.force_redraw = 1; - } -/* - printf("video_out_syncfb: info. (the zooming feature is not supported at the moment because of a bug with the SyncFB kernel driver, please refer to README.syncfb)\n"); -*/ - break; - - case VO_PROP_ZOOM_Y: - if ((value >= XINE_VO_ZOOM_MIN) && (value <= XINE_VO_ZOOM_MAX)) { - this->props[property].value = value; - this->sc.zoom_factor_y = (double)value / (double)XINE_VO_ZOOM_STEP; - - syncfb_compute_ideal_size (this); - - this->sc.force_redraw = 1; - } -/* - printf("video_out_syncfb: info. (the zooming feature is not supported at the moment because of a bug with the SyncFB kernel driver, please refer to README.syncfb)\n"); -*/ - break; - - case VO_PROP_CONTRAST: - this->props[property].value = value; - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_CONTRAST(%d))\n", - this->props[property].value); -#endif - - this->params.contrast = value; - this->params.brightness = this->props[VO_PROP_BRIGHTNESS].value; - this->params.image_width = this->syncfb_config.image_width; /* FIXME */ - this->params.image_height = this->syncfb_config.image_height; - this->params.image_xorg = this->syncfb_config.image_xorg; - this->params.image_yorg = this->syncfb_config.image_yorg; - - if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (setting of contrast value failed)\n"); - - break; - - case VO_PROP_BRIGHTNESS: - this->props[property].value = value; - -#ifdef DEBUG_OUTPUT - printf("video_out_syncfb: debug. (VO_PROP_BRIGHTNESS(%d))\n", - this->props[property].value); -#endif - - this->params.brightness = value; - this->params.contrast = this->props[VO_PROP_CONTRAST].value; - this->params.image_width = this->syncfb_config.image_width; /* FIXME */ - this->params.image_height = this->syncfb_config.image_height; - this->params.image_xorg = this->syncfb_config.image_xorg; - this->params.image_yorg = this->syncfb_config.image_yorg; - - if(ioctl(this->fd,SYNCFB_SET_PARAMS,&this->params)) - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: error. (setting of brightness value failed)\n"); - - break; - } - - return value; -} - -static void syncfb_get_property_min_max(vo_driver_t *this_gen, - int property, int *min, int *max) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - *min = this->props[property].min; - *max = this->props[property].max; -} - -static int syncfb_gui_data_exchange(vo_driver_t* this_gen, int data_type, - void *data) -{ - syncfb_driver_t* this = (syncfb_driver_t *) this_gen; - - switch (data_type) { - case XINE_GUI_SEND_DRAWABLE_CHANGED: - this->drawable = (Drawable) data; - - XLockDisplay (this->display); - XFreeGC(this->display, this->gc); - this->gc = XCreateGC (this->display, this->drawable, 0, NULL); - XUnlockDisplay (this->display); - break; - case XINE_GUI_SEND_TRANSLATE_GUI_TO_VIDEO: - { - int x1, y1, x2, y2; - x11_rectangle_t *rect = data; - - _x_vo_scale_translate_gui2video(&this->sc, rect->x, rect->y, - &x1, &y1); - _x_vo_scale_translate_gui2video(&this->sc, rect->x + rect->w, rect->y + rect->h, - &x2, &y2); - rect->x = x1; - rect->y = y1; - rect->w = x2-x1; - rect->h = y2-y1; - } - break; - /* - case XINE_GUI_DATA_EX_VIDEOWIN_VISIBLE: - this->video_win_visibility = (int)(int *)data; - syncfb_compute_output_size(this); - break; - */ - - default: - return -1; - } - - return 0; -} - -static void syncfb_dispose(vo_driver_t *this_gen) -{ - syncfb_driver_t *this = (syncfb_driver_t *) this_gen; - - /* get it off the screen - I wanna see my desktop again :-) */ - syncfb_overlay_off(this); - - /* don't know if it is necessary are even right, but anyway...?! */ - munmap(0, this->capabilities.memory_size); - - close(this->fd); - - XLockDisplay (this->display); - XFreeGC(this->display, this->gc); - XUnlockDisplay (this->display); - - _x_alphablend_free(&this->alphablend_extra_data); - - free(this); -} - -static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *visual_gen) { - - syncfb_class_t *class = (syncfb_class_t *) class_gen; - config_values_t *config = class->config; - syncfb_driver_t* this; - Display* display = NULL; - unsigned int i; - x11_visual_t* visual = (x11_visual_t *) visual_gen; - XColor dummy; - XWindowAttributes attr; - - display = visual->display; - - if(!(this = xine_xmalloc(sizeof (syncfb_driver_t)))) - return NULL; - - _x_alphablend_init(&this->alphablend_extra_data, class->xine); - - /* check for syncfb device */ - if((this->fd = open(class->device_name, O_RDWR)) < 0) { - xprintf(class->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", class->device_name); - free(this); - return NULL; - } - - this->xine = class->xine; - - /* get capabilities from the syncfb module */ - if(ioctl(this->fd, SYNCFB_GET_CAPS, &this->capabilities)) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: aborting. (syncfb_get_caps ioctl failed)\n"); - - close(this->fd); - free(this); - - return NULL; - } - - /* mmap whole video memory */ - this->video_mem = (uint8_t *) mmap(0, this->capabilities.memory_size, PROT_WRITE, MAP_SHARED, this->fd, 0); - - if(this->video_mem == MAP_FAILED) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: aborting. (mmap of video memory failed)\n"); - - close(this->fd); - free(this); - - return NULL; - } - - /* - * init properties and capabilities - */ - for (i = 0; i<VO_NUM_PROPERTIES; i++) { - this->props[i].value = 0; - this->props[i].min = 0; - this->props[i].max = 0; - } - - this->props[VO_PROP_INTERLACED].value = 0; - this->sc.user_ratio = this->props[VO_PROP_ASPECT_RATIO].value = XINE_VO_ASPECT_AUTO; - this->props[VO_PROP_ZOOM_X].value = 100; - this->props[VO_PROP_ZOOM_Y].value = 100; - - /* check for formats we need... */ - this->supported_capabilities = VO_CAP_CROP; - this->yuv_format = 0; - - /* - * simple fallback mechanism - we want YUV 4:2:0 (3 plane) but we can also - * convert YV12 material to YUV 4:2:0 (2 plane) and YUV 4:2:2 ... - */ - if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P3)) { - this->supported_capabilities |= VO_CAP_YV12; - this->yuv_format = VIDEO_PALETTE_YUV420P3; - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (3 plane))\n")); - } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV420P2)) { - this->supported_capabilities |= VO_CAP_YV12; - this->yuv_format = VIDEO_PALETTE_YUV420P2; - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:0 (2 plane))\n")); - } else if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { - this->supported_capabilities |= VO_CAP_YV12; - this->yuv_format = VIDEO_PALETTE_YUV422; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - _("video_out_syncfb: info. (SyncFB module supports YUV 4:2:2)\n")); - } - - if(this->capabilities.palettes & (1<<VIDEO_PALETTE_YUV422)) { - this->supported_capabilities |= VO_CAP_YUY2; - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - _("video_out_syncfb: info. (SyncFB module supports YUY2)\n")); - } - if(this->capabilities.palettes & (1<<VIDEO_PALETTE_RGB565)) { - /* FIXME: no RGB support yet - * this->supported_capabilities |= VO_CAP_RGB; - */ - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - _("video_out_syncfb: info. (SyncFB module supports RGB565)\n")); - } - - if(!this->supported_capabilities) { - xprintf(this->xine, XINE_VERBOSITY_DEBUG, - _("video_out_syncfb: aborting. (SyncFB module does not support YV12, YUY2 nor RGB565)\n")); - - munmap(0, this->capabilities.memory_size); - close(this->fd); - free(this); - - return NULL; - } - - if(ioctl(this->fd,SYNCFB_GET_PARAMS,&this->params) == 0) { - this->props[VO_PROP_CONTRAST].value = this->params.contrast; - this->props[VO_PROP_CONTRAST].min = 0; - this->props[VO_PROP_CONTRAST].max = 255; - - this->props[VO_PROP_BRIGHTNESS].value = this->params.brightness; - this->props[VO_PROP_BRIGHTNESS].min = -128; - this->props[VO_PROP_BRIGHTNESS].max = 127; - } else { - xprintf(this->xine, XINE_VERBOSITY_LOG, - _("video_out_syncfb: info. (brightness/contrast control won\'t be available because " - "your SyncFB kernel module seems to be outdated. Please refer to README." - "syncfb for informations on how to update it.)\n")); - } - - /* check for virtual screen size and screen depth - this is rather important - because that data is later used for free memory calculation */ - XGetWindowAttributes(visual->display, DefaultRootWindow(visual->display), &attr); - - this->virtual_screen_height = attr.height; - this->virtual_screen_width = attr.width; - this->screen_depth = attr.depth; - - /* initialize the rest of the variables now with default values */ - this->bufinfo.id = -1; - this->config = config; - this->cur_frame = NULL; - - /* FIXME: setting the default_repeat to anything higher than 1 will result - in a distorted video, so for now, set this manually to 0 until - the kernel driver is fixed... */ -#if 0 - this->default_repeat = config->register_range(config, - "video.device.syncfb_default_repeat", 3, 1, 4, - _("default number of frame repetitions"), - _("This specifies how many times a single video " - "frame will be displayed consecutively."), - 10, NULL, NULL); -#endif - this->default_repeat = 0; - - this->display = visual->display; - this->drawable = visual->d; - this->gc = XCreateGC (this->display, this->drawable, 0, NULL); - - _x_vo_scale_init (&this->sc, 1, 0, config ); - this->sc.frame_output_cb = visual->frame_output_cb; - this->sc.user_data = visual->user_data; - - this->overlay = NULL; - this->screen = visual->screen; - this->video_win_visibility = 1; - - XAllocNamedColor(this->display, - DefaultColormap(this->display, this->screen), - "black", &this->black, &dummy); - - this->vo_driver.get_capabilities = syncfb_get_capabilities; - this->vo_driver.alloc_frame = syncfb_alloc_frame; - this->vo_driver.update_frame_format = syncfb_update_frame_format; - this->vo_driver.overlay_begin = NULL; /* not used */ - this->vo_driver.overlay_blend = syncfb_overlay_blend; - this->vo_driver.overlay_end = NULL; /* not used */ - this->vo_driver.display_frame = syncfb_display_frame; - this->vo_driver.get_property = syncfb_get_property; - this->vo_driver.set_property = syncfb_set_property; - this->vo_driver.get_property_min_max = syncfb_get_property_min_max; - this->vo_driver.gui_data_exchange = syncfb_gui_data_exchange; - this->vo_driver.dispose = syncfb_dispose; - this->vo_driver.redraw_needed = syncfb_redraw_needed; - - return &this->vo_driver; -} - -/* - * class functions - */ -static void *init_class (xine_t *xine, void *visual_gen) { - - syncfb_class_t *this; - char* device_name; - int fd; - - device_name = xine->config->register_filename(xine->config, "video.device.syncfb_device", "/dev/syncfb", - XINE_CONFIG_STRING_IS_DEVICE_NAME, - _("SyncFB device name"), - _("Specifies the file name for the SyncFB (TeleTux) device " - "to be used.\nThis setting is security critical, " - "because when changed to a different file, xine " - "can be used to fill this file with arbitrary content. " - "So you should be careful that the value you enter " - "really is a proper framebuffer device."), - XINE_CONFIG_SECURITY, NULL, NULL); - - /* check for syncfb device */ - if((fd = open(device_name, O_RDWR)) < 0) { - xprintf(xine, XINE_VERBOSITY_DEBUG, - "video_out_syncfb: aborting. (unable to open syncfb device \"%s\")\n", device_name); - return NULL; - } - close(fd); - - /* - * from this point on, nothing should go wrong anymore - */ - this = (syncfb_class_t *) xine_xmalloc (sizeof (syncfb_class_t)); - - this->driver_class.open_plugin = open_plugin; - this->driver_class.identifier = "SyncFB"; - this->driver_class.description = N_("xine video output plugin using the SyncFB module for Matrox G200/G400 cards"); - this->driver_class.dispose = default_video_driver_class_dispose; - - this->config = xine->config; - this->xine = xine; - this->device_name = device_name; - - return this; -} - -static const vo_info_t vo_info_syncfb = { - 7, /* priority */ - XINE_VISUAL_TYPE_X11 /* visual type */ -}; - -/* - * exported plugin catalog entry - */ - -const plugin_info_t xine_plugin_info[] EXPORTED = { - /* type, API, "name", version, special_info, init_function */ - { PLUGIN_VIDEO_OUT, 22, "SyncFB", XINE_VERSION_CODE, &vo_info_syncfb, init_class }, - { PLUGIN_NONE, 0, "", 0, NULL, NULL } -}; - diff --git a/src/video_out/video_out_syncfb.h b/src/video_out/video_out_syncfb.h deleted file mode 100644 index 1fc3df83a..000000000 --- a/src/video_out/video_out_syncfb.h +++ /dev/null @@ -1,236 +0,0 @@ -#ifndef __LINUX_SYNCFB_H -#define __LINUX_SYNCFB_H - -#ifdef __KERNEL__ -#include <linux/version.h> -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/sched.h> -#include <linux/mm.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/malloc.h> -#include <linux/pci.h> -#include <linux/init.h> -#include <linux/videodev.h> - -#include <asm/mtrr.h> -#include <asm/uaccess.h> -#include <asm/system.h> -#include <asm/io.h> - -#define TRUE 1 -#define FALSE 0 - -#define SFB_STATUS_FREE 0 -#define SFB_STATUS_OFFS 1 -#define SFB_STATUS_WAIT 2 -#define SFB_STATUS_LIVE 3 - -#endif /* KERNEL */ - - -#ifndef AARONS_TYPES -typedef unsigned long uint_32; -typedef unsigned char uint_8; -#endif - -#define SYNCFB_MAJOR 178 - -#define SYNCFB_ERROR_NO_ERROR 0; -#define SYNCFB_ERROR_NO_BUFFER_AVAILABLE 1; -#define SYNCFB_ERROR_PALETTE_NOT_SUPPORTED 2; -#define SYNCFB_ERROR_NOT_ENOUGH_MEMORY 3; - - - -#ifndef __LINUX_VIDEODEV_H -#define VIDEO_PALETTE_GREY 1 /* Linear greyscale */ -#define VIDEO_PALETTE_HI240 2 /* High 240 cube (BT848) */ -#define VIDEO_PALETTE_RGB565 3 /* 565 16 bit RGB */ -#define VIDEO_PALETTE_RGB24 4 /* 24bit RGB */ -#define VIDEO_PALETTE_RGB32 5 /* 32bit RGB */ -#define VIDEO_PALETTE_RGB555 6 /* 555 15bit RGB */ -#define VIDEO_PALETTE_YUV422 7 /* YUV422 capture */ -#define VIDEO_PALETTE_YUYV 8 -#define VIDEO_PALETTE_UYVY 9 /* The great thing about standards is ... */ -#define VIDEO_PALETTE_YUV420 10 -#define VIDEO_PALETTE_YUV411 11 /* YUV411 capture */ -#define VIDEO_PALETTE_RAW 12 /* RAW capture (BT848) */ -#define VIDEO_PALETTE_YUV422P 13 /* YUV 4:2:2 Planar */ -#define VIDEO_PALETTE_YUV411P 14 /* YUV 4:1:1 Planar */ -#define VIDEO_PALETTE_YUV420P 15 /* YUV 4:2:0 Planar */ -#define VIDEO_PALETTE_YUV410P 16 /* YUV 4:1:0 Planar */ -#define VIDEO_PALETTE_PLANAR 13 /* start of planar entries */ -#define VIDEO_PALETTE_COMPONENT 7 /* start of component entries */ -#endif - - -#define VIDEO_PALETTE_YUV422P3 13 /* YUV 4:2:2 Planar (3 Plane, same as YUV422P) */ -#define VIDEO_PALETTE_YUV422P2 17 /* YUV 4:2:2 Planar (2 Plane) */ - -#define VIDEO_PALETTE_YUV411P3 14 /* YUV 4:1:1 Planar (3 Plane, same as YUV411P) */ -#define VIDEO_PALETTE_YUV411P2 18 /* YUV 4:1:1 Planar (2 Plane) */ - -#define VIDEO_PALETTE_YUV420P3 15 /* YUV 4:2:0 Planar (3 Plane, same as YUV420P) */ -#define VIDEO_PALETTE_YUV420P2 19 /* YUV 4:2:0 Planar (2 Plane) */ - -#define VIDEO_PALETTE_YUV410P3 16 /* YUV 4:1:0 Planar (3 Plane, same as YUV410P) */ -#define VIDEO_PALETTE_YUV410P2 20 /* YUV 4:1:0 Planar (2 Plane) */ - - - -#define SYNCFB_FEATURE_SCALE_H 1 -#define SYNCFB_FEATURE_SCALE_V 2 -#define SYNCFB_FEATURE_SCALE 3 -#define SYNCFB_FEATURE_CROP 4 -#define SYNCFB_FEATURE_OFFSET 8 -#define SYNCFB_FEATURE_DEINTERLACE 16 -#define SYNCFB_FEATURE_PROCAMP 32 -#define SYNCFB_FEATURE_TRANSITIONS 64 -#define SYNCFB_FEATURE_COLKEY 128 -#define SYNCFB_FEATURE_MIRROR_H 256 -#define SYNCFB_FEATURE_MIRROR_V 512 -#define SYNCFB_FEATURE_BLOCK_REQUEST 1024 -#define SYNCFB_FEATURE_FREQDIV2 2048 - - -typedef struct syncfb_config_s -{ - uint_32 syncfb_mode; /* bitfield: turn on/off the available features */ - uint_32 error_code; /* RO: returns 0 on successful config calls, error code otherwise */ - - uint_32 fb_screen_size; /* WO, size in bytes of video memory reserved for fbdev */ - uint_32 fb_screen_width; /* WO, visible screen width in pixel */ - uint_32 fb_screen_height; /* WO, visible screen height in pixel */ - - uint_32 buffers; /* RO, number of available buffers */ - uint_32 buffer_size; /* RO, filled in by syncfb */ - - uint_32 default_repeat; /* default repeat time for a single frame, can be overridden in syncfb_buffer_info_t */ - - uint_32 src_width; /* source image width in pixel */ - uint_32 src_height; /* source image height in pixel */ - uint_32 src_palette; /* set palette mode, see videodev.h for palettes */ - uint_32 src_pitch; /* RO: filled in by ioctl: actual line length in pixel */ - - uint_32 image_xorg; /* x position of the image on the screen */ - uint_32 image_yorg; /* y position of the image on the screen */ - - /* if syncfb has FEATURE_SCALE */ - uint_32 scale_filters; /* 0: no filtering, 255: all filters on */ - uint_32 image_width; /* onscreen image width */ - uint_32 image_height; /* onscreen image height */ - - /* if syncfb has FEATURE_CROP */ - uint_32 src_crop_left; /* */ - uint_32 src_crop_right; /* */ - uint_32 src_crop_top; /* */ - uint_32 src_crop_bot; /* */ - - /* if syncfb has FEATURE_OFFSET */ - uint_32 image_offset_left; /* */ - uint_32 image_offset_right; /* */ - uint_32 image_offset_top; /* */ - uint_32 image_offset_bot; /* */ - - /* if syncfb has FEATURE_COLKEY */ - uint_8 colkey_red; - uint_8 colkey_green; - uint_8 colkey_blue; - -} syncfb_config_t; - - -/* - picture parameters, -*/ -typedef struct syncfb_param_s -{ - /* the idea is to enable smooth transitions between eg. image sizes (not yet implemented) */ - /* if syncfb has FEATURE_TRANSITIONS */ - uint_32 transition_time; - - /* if syncfb has FEATURE_PROCAMP */ - uint_32 contrast; /* 0: least contrast, 1000: normal contrast, */ - uint_32 brightness; - uint_32 color; /* for syncfb_matrox: color=0: b/w else: full color */ - - /* if syncfb has FEATURE_SCALE , currently only supported in CONFIG call */ - uint_8 scale_filters; /* 0: no filtering, 255: all filters on */ - uint_32 image_xorg; /* x position of the image on the screen */ - uint_32 image_yorg; /* y position of the image on the screen */ - uint_32 image_width; /* onscreen image width */ - uint_32 image_height; /* onscreen image height */ - -} syncfb_param_t; - - - -typedef struct syncfb_status_info_s -{ - uint_32 field_cnt; /* basically all vbi's since the start of syncfb */ - uint_32 frame_cnt; /* number of frames comitted & output */ - - uint_32 hold_field_cnt; /* number of repeated fields becaus no new data was available */ - uint_32 skip_field_cnt; /* skipped fields when fifo was about to fill up */ - - uint_32 request_frames; /* number of request_buffer calls */ - uint_32 commit_frames; /* number of commit_buffer calls */ - - uint_32 failed_requests; /* number of calls to request_buffer that failed */ - - uint_32 buffers_waiting; - uint_32 buffers_free; - -} syncfb_status_info_t; - - - - -typedef struct syncfb_capability_s -{ - char name[64]; /* A name for the syncfb ... */ - uint_32 palettes; /* supported palettes - see videodev.h for palettes, test the corresponding bit here */ - uint_32 features; /* supported features - see SYNCFB_FEATURE_* */ - uint_32 memory_size; /* total size of mappable video memory */ - -} syncfb_capability_t; - - - -typedef struct syncfb_buffer_info_s -{ - int id; /* buffer id: a return value of -1 means no buffer available */ - uint_32 repeat; /* the buffer will be shown <repeat> times */ - uint_32 offset; /* buffer offset from start of video memory */ - uint_32 offset_p2; /* yuv plane 2 buffer offset from start of video memory */ - uint_32 offset_p3; /* yuv plane 3 buffer offset from start of video memory */ - -} syncfb_buffer_info_t; - - - - - - - -/* get syncfb capabilities */ -#define SYNCFB_GET_CAPS _IOR('J', 1, syncfb_config_t) - -#define SYNCFB_GET_CONFIG _IOR('J', 2, syncfb_config_t) -#define SYNCFB_SET_CONFIG _IOR('J', 3, syncfb_config_t) -#define SYNCFB_ON _IO ('J', 4) -#define SYNCFB_OFF _IO ('J', 5) -#define SYNCFB_REQUEST_BUFFER _IOR ('J', 6, syncfb_buffer_info_t) -#define SYNCFB_COMMIT_BUFFER _IOR ('J', 7, syncfb_buffer_info_t) -#define SYNCFB_STATUS _IOR ('J', 8, syncfb_status_info_t) -#define SYNCFB_VBI _IO ('J', 9) /* simulate interrupt - debugging only */ -#define SYNCFB_SET_PARAMS _IOR('J', 10, syncfb_param_t) -#define SYNCFB_GET_PARAMS _IOR('J', 11, syncfb_param_t) - - - - -#endif /* __LINUX_SYNCFB_H */ - diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c index 3228bbdbb..f4b74ad2a 100644 --- a/src/video_out/video_out_vidix.c +++ b/src/video_out/video_out_vidix.c @@ -57,10 +57,10 @@ #define LOG */ -#include "video_out.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #ifdef HAVE_X11 #include "x11osd.h" @@ -700,6 +700,18 @@ static int vidix_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } lprintf ("video_out_vidix: property #%d = %d\n", property, @@ -721,12 +733,12 @@ static int vidix_set_property (vo_driver_t *this_gen, this->props[property].value = value; if ( property == VO_PROP_ASPECT_RATIO) { - lprintf("video_out_vidix: aspect ratio changed to %s\n", - _x_vo_scale_aspect_ratio_name(value)); - - if(value == XINE_VO_ASPECT_NUM_RATIOS) + if(value >= XINE_VO_ASPECT_NUM_RATIOS) value = this->props[property].value = XINE_VO_ASPECT_AUTO; + lprintf("video_out_vidix: aspect ratio changed to %s\n", + _x_vo_scale_aspect_ratio_name_table[value]); + this->sc.user_ratio = value; vidix_compute_ideal_size (this); this->sc.force_redraw = 1; diff --git a/src/video_out/video_out_xcbshm.c b/src/video_out/video_out_xcbshm.c index c6ad9e2f1..9895d1852 100644 --- a/src/video_out/video_out_xcbshm.c +++ b/src/video_out/video_out_xcbshm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003, 2007 the xine project + * Copyright (C) 2000-2003, 2007-2008 the xine project * * This file is part of xine, a free video player. * @@ -37,7 +37,7 @@ #include <math.h> #include "xine.h" -#include "video_out.h" +#include <xine/video_out.h> #include <errno.h> @@ -56,10 +56,10 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "yuv2rgb.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "xcbosd.h" typedef struct { @@ -730,6 +730,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { return this->sc.gui_width; case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; + case VO_PROP_OUTPUT_WIDTH: + return this->cur_frame->sc.output_width; + case VO_PROP_OUTPUT_HEIGHT: + return this->cur_frame->sc.output_height; + case VO_PROP_OUTPUT_XOFFSET: + return this->cur_frame->sc.output_xoffset; + case VO_PROP_OUTPUT_YOFFSET: + return this->cur_frame->sc.output_yoffset; default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": tried to get unsupported property %d\n", property); @@ -742,45 +750,43 @@ static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - if ( property == VO_PROP_ASPECT_RATIO) { - + switch (property) { + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - LOG_MODULE ": aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); - - } else if (property == VO_PROP_BRIGHTNESS) { + LOG_MODULE ": aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); + break; + case VO_PROP_BRIGHTNESS: this->yuv2rgb_brightness = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else if (property == VO_PROP_CONTRAST) { - + case VO_PROP_CONTRAST: this->yuv2rgb_contrast = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else if (property == VO_PROP_SATURATION) { - + case VO_PROP_SATURATION: this->yuv2rgb_saturation = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else { + default: xprintf (this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": tried to set unsupported property %d\n", property); } @@ -970,8 +976,8 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { return 0; } - -static char *visual_class_name(xcb_visualtype_t *visual) { +/* TODO replace this with a string table. */ +static const char *visual_class_name(xcb_visualtype_t *visual) { switch (visual->_class) { case XCB_VISUAL_CLASS_STATIC_GRAY: diff --git a/src/video_out/video_out_xcbxv.c b/src/video_out/video_out_xcbxv.c index 1b59f5691..f61ae6a9c 100644 --- a/src/video_out/video_out_xcbxv.c +++ b/src/video_out/video_out_xcbxv.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004, 2007 the xine project + * Copyright (C) 2000-2004, 2007-2008 the xine project * * This file is part of xine, a free video player. * @@ -58,12 +58,13 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> /* #include "overlay.h" */ -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "xcbosd.h" +#include "xv_common.h" typedef struct xv_driver_s xv_driver_t; @@ -636,6 +637,18 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } lprintf(LOG_MODULE ": property #%d = %d\n", property, this->props[property].value); @@ -932,6 +945,8 @@ static int xv_check_yv12(xcb_connection_t *connection, xcb_xv_port_t port) { list_formats_cookie = xcb_xv_list_image_formats(connection, port); list_formats_reply = xcb_xv_list_image_formats_reply(connection, list_formats_cookie, NULL); + if (!list_formats_reply) + return 1; /* no formats listed; probably due to an invalid port no. */ format_it = xcb_xv_list_image_formats_format_iterator(list_formats_reply); for (; format_it.rem; xcb_xv_image_format_info_next(&format_it)) @@ -953,7 +968,7 @@ static void xv_check_capability (xv_driver_t *this, char *config_help) { int int_default; cfg_entry_t *entry; - char *str_prop = xcb_xv_attribute_info_name(attr); + const char *str_prop = xcb_xv_attribute_info_name(attr); xcb_xv_get_port_attribute_cookie_t get_attribute_cookie; xcb_xv_get_port_attribute_reply_t *get_attribute_reply; @@ -1077,13 +1092,60 @@ static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry this->use_pitch_alignment = entry->num_value; } +static xcb_xv_port_t xv_open_port (xv_driver_t *this, xcb_xv_port_t port) { + xcb_xv_grab_port_cookie_t grab_port_cookie; + xcb_xv_grab_port_reply_t *grab_port_reply; + + if (xv_check_yv12 (this->connection, port)) + return 0; + + grab_port_cookie = xcb_xv_grab_port (this->connection, port, XCB_CURRENT_TIME); + grab_port_reply = xcb_xv_grab_port_reply (this->connection, grab_port_cookie, NULL); + + if (grab_port_reply && (grab_port_reply->result == XCB_GRAB_STATUS_SUCCESS)) + { + free (grab_port_reply); + return port; + } + free (grab_port_reply); + return 0; +} + +static xcb_xv_adaptor_info_iterator_t * +xv_find_adaptor_by_port (int port, xcb_xv_adaptor_info_iterator_t *adaptor_it) +{ + for (; adaptor_it->rem; xcb_xv_adaptor_info_next(adaptor_it)) + if (adaptor_it->data->type & XCB_XV_TYPE_IMAGE_MASK) + if (port >= adaptor_it->data->base_id && + port < adaptor_it->data->base_id + adaptor_it->data->num_ports) + return adaptor_it; + return NULL; /* shouldn't happen */ +} + +static xcb_xv_port_t xv_autodetect_port(xv_driver_t *this, + xcb_xv_adaptor_info_iterator_t *adaptor_it) +{ + for (; adaptor_it->rem; xcb_xv_adaptor_info_next(adaptor_it)) + if (adaptor_it->data->type & XCB_XV_TYPE_IMAGE_MASK) + { + int j; + for (j = 0; j < adaptor_it->data->num_ports; ++j) + if (!xv_check_yv12 (this->connection, adaptor_it->data->base_id + j)) + { + xcb_xv_port_t port = xv_open_port (this, adaptor_it->data->base_id + j); + if (port) + return port; + } + } + return 0; +} + static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *visual_gen) { xv_class_t *class = (xv_class_t *) class_gen; config_values_t *config = class->config; xv_driver_t *this; int i; xcb_visual_t *visual = (xcb_visual_t *) visual_gen; - unsigned int j; xcb_xv_port_t xv_port; const xcb_query_extension_reply_t *query_extension_reply; @@ -1134,28 +1196,20 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis } adaptor_it = xcb_xv_query_adaptors_info_iterator(query_adaptors_reply); - - xv_port = 0; - - for (; adaptor_it.rem && !xv_port; xcb_xv_adaptor_info_next(&adaptor_it)) { - - if (adaptor_it.data->type & XCB_XV_TYPE_IMAGE_MASK) { - - for (j = 0; j < adaptor_it.data->num_ports; j++) - if (!xv_check_yv12(this->connection, adaptor_it.data->base_id + j)) { - xcb_xv_grab_port_cookie_t grab_port_cookie; - xcb_xv_grab_port_reply_t *grab_port_reply; - grab_port_cookie = xcb_xv_grab_port(this->connection, adaptor_it.data->base_id + j, XCB_CURRENT_TIME); - grab_port_reply = xcb_xv_grab_port_reply(this->connection, grab_port_cookie, NULL); - if (grab_port_reply && (grab_port_reply->result == XCB_GRAB_STATUS_SUCCESS)) { - free(grab_port_reply); - xv_port = adaptor_it.data->base_id + j; - break; - } - free(grab_port_reply); - } - } - } + xv_port = config->register_num (config, "video.device.xv_port", 0, + VIDEO_DEVICE_XV_PORT_HELP, + 10, NULL, NULL); + + if (xv_port != 0) { + if (! xv_open_port(this, xv_port)) { + xprintf(class->xine, XINE_VERBOSITY_NONE, + _("%s: could not open Xv port %d - autodetecting\n"), + LOG_MODULE, xv_port); + xv_port = xv_autodetect_port (this, &adaptor_it); + } else + xv_find_adaptor_by_port (xv_port, &adaptor_it); + } else + xv_port = xv_autodetect_port (this, &adaptor_it); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, @@ -1169,7 +1223,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis else xprintf(class->xine, XINE_VERBOSITY_LOG, _("%s: using Xv port %d from adaptor %s for hardware " - "colorspace conversion and scaling.\n"), LOG_MODULE, xv_port, + "colour space conversion and scaling.\n"), LOG_MODULE, xv_port, xcb_xv_adaptor_info_name(adaptor_it.data)); this->xv_port = xv_port; @@ -1233,10 +1287,11 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis for (; attribute_it.rem; xcb_xv_attribute_info_next(&attribute_it)) { if ((attribute_it.data->flags & XCB_XV_ATTRIBUTE_FLAG_SETTABLE) && (attribute_it.data->flags & XCB_XV_ATTRIBUTE_FLAG_GETTABLE)) { + const char *const name = xcb_xv_attribute_info_name(attribute_it.data); /* store initial port attribute value */ - xv_store_port_attribute(this, xcb_xv_attribute_info_name(attribute_it.data)); - - if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_HUE")) { + xv_store_port_attribute(this, name); + + if(!strcmp(name, "XV_HUE")) { if (!strncmp(xcb_xv_adaptor_info_name(adaptor_it.data), "NV", 2)) { xprintf (this->xine, XINE_VERBOSITY_NONE, LOG_MODULE ": ignoring broken XV_HUE settings on NVidia cards\n"); } else { @@ -1244,63 +1299,41 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis adaptor_it.data->base_id, NULL, NULL, NULL); } - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_SATURATION")) { + } else if(!strcmp(name, "XV_SATURATION")) { xv_check_capability (this, VO_PROP_SATURATION, attribute_it.data, adaptor_it.data->base_id, NULL, NULL, NULL); - - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_BRIGHTNESS")) { + } else if(!strcmp(name, "XV_BRIGHTNESS")) { xv_check_capability (this, VO_PROP_BRIGHTNESS, attribute_it.data, adaptor_it.data->base_id, NULL, NULL, NULL); - - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_CONTRAST")) { + } else if(!strcmp(name, "XV_CONTRAST")) { xv_check_capability (this, VO_PROP_CONTRAST, attribute_it.data, adaptor_it.data->base_id, NULL, NULL, NULL); - - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_COLORKEY")) { + } else if(!strcmp(name, "XV_COLORKEY")) { xv_check_capability (this, VO_PROP_COLORKEY, attribute_it.data, adaptor_it.data->base_id, "video.device.xv_colorkey", - _("video overlay colour key"), - _("The colour key is used to tell the graphics card where to " - "overlay the video image. Try different values, if you experience " - "windows becoming transparent.")); - - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_AUTOPAINT_COLORKEY")) { + VIDEO_DEVICE_XV_COLORKEY_HELP); + } else if(!strcmp(name, "XV_AUTOPAINT_COLORKEY")) { xv_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attribute_it.data, adaptor_it.data->base_id, "video.device.xv_autopaint_colorkey", - _("autopaint colour key"), - _("Make Xv autopaint its colorkey.")); - - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_FILTER")) { + VIDEO_DEVICE_XV_AUTOPAINT_COLORKEY_HELP); + } else if(!strcmp(name, "XV_FILTER")) { int xv_filter; /* This setting is specific to Permedia 2/3 cards. */ xv_filter = config->register_range (config, "video.device.xv_filter", 0, attribute_it.data->min, attribute_it.data->max, - _("bilinear scaling mode"), - _("Selects the bilinear scaling mode for Permedia cards. " - "The individual values are:\n\n" - "Permedia 2\n" - "0 - disable bilinear filtering\n" - "1 - enable bilinear filtering\n\n" - "Permedia 3\n" - "0 - disable bilinear filtering\n" - "1 - horizontal linear filtering\n" - "2 - enable full bilinear filtering"), + VIDEO_DEVICE_XV_FILTER_HELP, 20, xv_update_XV_FILTER, this); config->update_num(config,"video.device.xv_filter",xv_filter); - } else if(!strcmp(xcb_xv_attribute_info_name(attribute_it.data), "XV_DOUBLE_BUFFER")) { - int xv_double_buffer; - xv_double_buffer = + } else if(!strcmp(name, "XV_DOUBLE_BUFFER")) { + int xv_double_buffer = config->register_bool (config, "video.device.xv_double_buffer", 1, - _("enable double buffering"), - _("Double buffering will synchronize the update of the video image to the " - "repainting of the entire screen (\"vertical retrace\"). This eliminates " - "flickering and tearing artifacts, but will use more graphics memory."), - 20, xv_update_XV_DOUBLE_BUFFER, this); + VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, + 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); } } @@ -1346,8 +1379,7 @@ static vo_driver_t *open_plugin(video_driver_class_t *class_gen, const void *vis this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, - _("pitch alignment workaround"), - _("Some buggy video drivers need a workaround to function properly."), + VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); if(this->use_colorkey==1) { diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c index ddcdb677c..7801bb03b 100644 --- a/src/video_out/video_out_xshm.c +++ b/src/video_out/video_out_xshm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2003 the xine project + * Copyright (C) 2000-2003, 2008 the xine project * * This file is part of xine, a free video player. * @@ -35,7 +35,7 @@ #include <math.h> #include "xine.h" -#include "video_out.h" +#include <xine/video_out.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -57,10 +57,10 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "yuv2rgb.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "x11osd.h" #define LOCK_DISPLAY(this) {if(this->lock_display) this->lock_display(this->user_data); \ @@ -819,6 +819,14 @@ static int xshm_get_property (vo_driver_t *this_gen, int property) { return this->sc.gui_width; case VO_PROP_WINDOW_HEIGHT: return this->sc.gui_height; + case VO_PROP_OUTPUT_WIDTH: + return this->cur_frame->sc.output_width; + case VO_PROP_OUTPUT_HEIGHT: + return this->cur_frame->sc.output_height; + case VO_PROP_OUTPUT_XOFFSET: + return this->cur_frame->sc.output_xoffset; + case VO_PROP_OUTPUT_YOFFSET: + return this->cur_frame->sc.output_yoffset; default: xprintf(this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": tried to get unsupported property %d\n", property); @@ -831,45 +839,43 @@ static int xshm_set_property (vo_driver_t *this_gen, int property, int value) { xshm_driver_t *this = (xshm_driver_t *) this_gen; - if ( property == VO_PROP_ASPECT_RATIO) { - + switch (property) { + case VO_PROP_ASPECT_RATIO: if (value>=XINE_VO_ASPECT_NUM_RATIOS) value = XINE_VO_ASPECT_AUTO; this->sc.user_ratio = value; xprintf(this->xine, XINE_VERBOSITY_DEBUG, - LOG_MODULE ": aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name(value)); - - } else if (property == VO_PROP_BRIGHTNESS) { + LOG_MODULE ": aspect ratio changed to %s\n", _x_vo_scale_aspect_ratio_name_table[value]); + break; + case VO_PROP_BRIGHTNESS: this->yuv2rgb_brightness = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else if (property == VO_PROP_CONTRAST) { - + case VO_PROP_CONTRAST: this->yuv2rgb_contrast = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else if (property == VO_PROP_SATURATION) { - + case VO_PROP_SATURATION: this->yuv2rgb_saturation = value; this->yuv2rgb_factory->set_csc_levels (this->yuv2rgb_factory, this->yuv2rgb_brightness, this->yuv2rgb_contrast, this->yuv2rgb_saturation); - this->sc.force_redraw = 1; + break; - } else { + default: xprintf (this->xine, XINE_VERBOSITY_DEBUG, LOG_MODULE ": tried to set unsupported property %d\n", property); } @@ -1045,7 +1051,7 @@ static int ImlibPaletteLUTGet(xshm_driver_t *this) { } -static char *visual_class_name(Visual *visual) { +static const char *visual_class_name(Visual *visual) { switch (visual->class) { case StaticGray: diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c index ab5410ac3..6cdbc6b64 100644 --- a/src/video_out/video_out_xv.c +++ b/src/video_out/video_out_xv.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004 the xine project + * Copyright (C) 2000-2004, 2008 the xine project * * This file is part of xine, a free video player. * @@ -63,12 +63,13 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> /* #include "overlay.h" */ -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "x11osd.h" +#include "xv_common.h" #define LOCK_DISPLAY(this) {if(this->lock_display) this->lock_display(this->user_data); \ else XLockDisplay(this->display);} @@ -737,6 +738,18 @@ static int xv_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } lprintf(LOG_MODULE ": property #%d = %d\n", property, this->props[property].value); @@ -1016,14 +1029,13 @@ static int xv_check_yv12 (Display *display, XvPortID port) { /* called xlocked */ static void xv_check_capability (xv_driver_t *this, - int property, XvAttribute attr, - int base_id, - char *config_name, - char *config_desc, - char *config_help) { + int property, XvAttribute attr, int base_id, + const char *config_name, + const char *config_desc, + const char *config_help) { int int_default; cfg_entry_t *entry; - char *str_prop = attr.name; + const char *str_prop = attr.name; /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. @@ -1124,6 +1136,47 @@ static void xv_update_xv_pitch_alignment(void *this_gen, xine_cfg_entry_t *entry this->use_pitch_alignment = entry->num_value; } +static int xv_open_port (xv_driver_t *this, XvPortID port) { + int ret; + x11_InstallXErrorHandler (this); + ret = ! xv_check_yv12(this->display, port) + && XvGrabPort(this->display, port, 0) == Success; + x11_DeInstallXErrorHandler (this); + return ret; +} + +static unsigned int +xv_find_adaptor_by_port (int port, unsigned int adaptors, + XvAdaptorInfo *adaptor_info) +{ + unsigned int an; + for (an = 0; an < adaptors; an++) + if (adaptor_info[an].type & XvImageMask) + if (port >= adaptor_info[an].base_id && + port < adaptor_info[an].base_id + adaptor_info[an].num_ports) + return an; + return 0; /* shouldn't happen */ +} + +static XvPortID xv_autodetect_port(xv_driver_t *this, + unsigned int adaptors, + XvAdaptorInfo *adaptor_info, + unsigned int *adaptor_num) { + unsigned int an, j; + + for (an = 0; an < adaptors; an++) + if (adaptor_info[an].type & XvImageMask) + for (j = 0; j < adaptor_info[an].num_ports; j++) { + XvPortID port = adaptor_info[an].base_id + j; + if (xv_open_port(this, port)) { + *adaptor_num = an; + return port; + } + } + + return 0; +} + /* expects XINE_VISUAL_TYPE_X11_2 with configurable locking */ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void *visual_gen) { xv_class_t *class = (xv_class_t *) class_gen; @@ -1136,7 +1189,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * x11_visual_t *visual = (x11_visual_t *) visual_gen; XColor dummy; XvImage *myimage; - unsigned int adaptors, j; + unsigned int adaptors; unsigned int ver,rel,req,ev,err; XShmSegmentInfo myshminfo; XvPortID xv_port; @@ -1179,25 +1232,20 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * return NULL; } - xv_port = 0; - - for ( adaptor_num = 0; (adaptor_num < adaptors) && !xv_port; adaptor_num++ ) { - - if (adaptor_info[adaptor_num].type & XvImageMask) { - - for (j = 0; j < adaptor_info[adaptor_num].num_ports && !xv_port; j++) - if (( !(xv_check_yv12 (this->display, - adaptor_info[adaptor_num].base_id + j))) - && (XvGrabPort (this->display, - adaptor_info[adaptor_num].base_id + j, - 0) == Success)) { - xv_port = adaptor_info[adaptor_num].base_id + j; - } - - if( xv_port ) - break; - } - } + xv_port = config->register_num (config, "video.device.xv_port", 0, + VIDEO_DEVICE_XV_PORT_HELP, + 10, NULL, NULL); + + if (xv_port != 0) { + if (! xv_open_port(this, xv_port)) { + xprintf(class->xine, XINE_VERBOSITY_NONE, + _("%s: could not open Xv port %d - autodetecting\n"), + LOG_MODULE, xv_port); + xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); + } else + adaptor_num = xv_find_adaptor_by_port (xv_port, adaptors, adaptor_info); + } else + xv_port = xv_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, @@ -1212,7 +1260,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * else xprintf(class->xine, XINE_VERBOSITY_LOG, _("%s: using Xv port %ld from adaptor %s for hardware " - "colorspace conversion and scaling.\n"), LOG_MODULE, xv_port, + "colour space conversion and scaling.\n"), LOG_MODULE, xv_port, adaptor_info[adaptor_num].name); UNLOCK_DISPLAY(this); @@ -1286,10 +1334,11 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * for(k = 0; k < nattr; k++) { if((attr[k].flags & XvSettable) && (attr[k].flags & XvGettable)) { + const char *const name = attr[k].name; /* store initial port attribute value */ - xv_store_port_attribute(this, attr[k].name); + xv_store_port_attribute(this, name); - if(!strcmp(attr[k].name, "XV_HUE")) { + if(!strcmp(name, "XV_HUE")) { if (!strncmp(adaptor_info[adaptor_num].name, "NV", 2)) { xprintf (this->xine, XINE_VERBOSITY_NONE, LOG_MODULE ": ignoring broken XV_HUE settings on NVidia cards\n"); } else { @@ -1297,63 +1346,41 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } - } else if(!strcmp(attr[k].name, "XV_SATURATION")) { + } else if(!strcmp(name, "XV_SATURATION")) { xv_check_capability (this, VO_PROP_SATURATION, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_BRIGHTNESS")) { + } else if(!strcmp(name, "XV_BRIGHTNESS")) { xv_check_capability (this, VO_PROP_BRIGHTNESS, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_CONTRAST")) { + } else if(!strcmp(name, "XV_CONTRAST")) { xv_check_capability (this, VO_PROP_CONTRAST, attr[k], adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_COLORKEY")) { + } else if(!strcmp(name, "XV_COLORKEY")) { xv_check_capability (this, VO_PROP_COLORKEY, attr[k], adaptor_info[adaptor_num].base_id, "video.device.xv_colorkey", - _("video overlay colour key"), - _("The colour key is used to tell the graphics card where to " - "overlay the video image. Try different values, if you experience " - "windows becoming transparent.")); - - } else if(!strcmp(attr[k].name, "XV_AUTOPAINT_COLORKEY")) { + VIDEO_DEVICE_XV_COLORKEY_HELP); + } else if(!strcmp(name, "XV_AUTOPAINT_COLORKEY")) { xv_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attr[k], adaptor_info[adaptor_num].base_id, "video.device.xv_autopaint_colorkey", - _("autopaint colour key"), - _("Make Xv autopaint its colorkey.")); - - } else if(!strcmp(attr[k].name, "XV_FILTER")) { + VIDEO_DEVICE_XV_AUTOPAINT_COLORKEY_HELP); + } else if(!strcmp(name, "XV_FILTER")) { int xv_filter; /* This setting is specific to Permedia 2/3 cards. */ xv_filter = config->register_range (config, "video.device.xv_filter", 0, attr[k].min_value, attr[k].max_value, - _("bilinear scaling mode"), - _("Selects the bilinear scaling mode for Permedia cards. " - "The individual values are:\n\n" - "Permedia 2\n" - "0 - disable bilinear filtering\n" - "1 - enable bilinear filtering\n\n" - "Permedia 3\n" - "0 - disable bilinear filtering\n" - "1 - horizontal linear filtering\n" - "2 - enable full bilinear filtering"), + VIDEO_DEVICE_XV_FILTER_HELP, 20, xv_update_XV_FILTER, this); config->update_num(config,"video.device.xv_filter",xv_filter); - } else if(!strcmp(attr[k].name, "XV_DOUBLE_BUFFER")) { - int xv_double_buffer; - xv_double_buffer = + } else if(!strcmp(name, "XV_DOUBLE_BUFFER")) { + int xv_double_buffer = config->register_bool (config, "video.device.xv_double_buffer", 1, - _("enable double buffering"), - _("Double buffering will synchronize the update of the video image to the " - "repainting of the entire screen (\"vertical retrace\"). This eliminates " - "flickering and tearing artifacts, but will use more graphics memory."), - 20, xv_update_XV_DOUBLE_BUFFER, this); + VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, + 20, xv_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); } } @@ -1410,8 +1437,7 @@ static vo_driver_t *open_plugin_2 (video_driver_class_t *class_gen, const void * this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, - _("pitch alignment workaround"), - _("Some buggy video drivers need a workaround to function properly."), + VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xv_update_xv_pitch_alignment, this); LOCK_DISPLAY(this); diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c index 2c913dc0e..c0fb10be3 100644 --- a/src/video_out/video_out_xvmc.c +++ b/src/video_out/video_out_xvmc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004 the xine project + * Copyright (C) 2000-2004, 2008 the xine project * * This file is part of xine, a free video player. * @@ -66,12 +66,13 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> #include "accel_xvmc.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/xineutils.h> +#include <xine/vo_scale.h> +#include "xv_common.h" /* #define LOG1 */ /* #define DLOG */ @@ -217,8 +218,6 @@ typedef struct { Display *display; config_values_t *config; XvPortID xv_port; - XvAdaptorInfo *adaptor_info; - unsigned int adaptor_num; int surface_type_id; unsigned int max_surface_width; @@ -991,6 +990,18 @@ static int xvmc_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } return this->props[property].value; @@ -1212,13 +1223,13 @@ static void xvmc_dispose (vo_driver_t *this_gen) { /* called xlocked */ static void xvmc_check_capability (xvmc_driver_t *this, - int property, XvAttribute attr, - int base_id, char *str_prop, - char *config_name, - char *config_desc, - char *config_help) { + int property, XvAttribute attr, int base_id, + const char *config_name, + const char *config_desc, + const char *config_help) { int int_default; cfg_entry_t *entry; + const char *str_prop = attr.name; /* * some Xv drivers (Gatos ATI) report some ~0 as max values, this is confusing. @@ -1241,13 +1252,13 @@ static void xvmc_check_capability (xvmc_driver_t *this, if ((attr.min_value == 0) && (attr.max_value == 1)) { this->config->register_bool (this->config, config_name, int_default, config_desc, - NULL, 20, xvmc_property_callback, &this->props[property]); + config_help, 20, xvmc_property_callback, &this->props[property]); } else { this->config->register_range (this->config, config_name, int_default, this->props[property].min, this->props[property].max, config_desc, - NULL, 20, xvmc_property_callback, &this->props[property]); + config_help, 20, xvmc_property_callback, &this->props[property]); } entry = this->config->lookup_entry (this->config, config_name); @@ -1285,7 +1296,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi xvmc_class_t *class = (xvmc_class_t *) class_gen; config_values_t *config = class->config; xvmc_driver_t *this = NULL; - Display *display = NULL; unsigned int i, formats; XvPortID xv_port = class->xv_port; XvAttribute *attr; @@ -1293,13 +1303,12 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi int nattr; x11_visual_t *visual = (x11_visual_t *) visual_gen; XColor dummy; + XvAdaptorInfo *adaptor_info; + unsigned int adaptor_num; /* XvImage *myimage; */ lprintf ("open_plugin\n"); - display = visual->display; - - /* TODO ??? */ this = (xvmc_driver_t *) xine_xmalloc (sizeof (xvmc_driver_t)); if (!this) @@ -1381,56 +1390,47 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->capabilities |= VO_CAP_XVMC_IDCT; XLockDisplay(this->display); - attr = XvQueryPortAttributes(display, xv_port, &nattr); + attr = XvQueryPortAttributes(this->display, xv_port, &nattr); if(attr && nattr) { int k; for(k = 0; k < nattr; k++) { if((attr[k].flags & XvSettable) && (attr[k].flags & XvGettable)) { - if(!strcmp(attr[k].name, "XV_HUE")) { - xvmc_check_capability (this, VO_PROP_HUE, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_HUE", - NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_SATURATION")) { + const char *const name = attr[k].name; + if(!strcmp(name, "XV_HUE")) { + if (!strncmp(adaptor_info[adaptor_num].name, "NV", 2)) { + xprintf (this->xine, XINE_VERBOSITY_NONE, LOG_MODULE ": ignoring broken XV_HUE settings on NVidia cards\n"); + } else { + xvmc_check_capability (this, VO_PROP_HUE, attr[k], + adaptor_info[adaptor_num].base_id, + NULL, NULL, NULL); + } + } else if(!strcmp(name, "XV_SATURATION")) { xvmc_check_capability (this, VO_PROP_SATURATION, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_SATURATION", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - } else if(!strcmp(attr[k].name, "XV_BRIGHTNESS")) { xvmc_check_capability (this, VO_PROP_BRIGHTNESS, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_BRIGHTNESS", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_CONTRAST")) { + } else if(!strcmp(name, "XV_CONTRAST")) { xvmc_check_capability (this, VO_PROP_CONTRAST, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_CONTRAST", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_COLORKEY")) { + } else if(!strcmp(name, "XV_COLORKEY")) { xvmc_check_capability (this, VO_PROP_COLORKEY, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_COLORKEY", + adaptor_info[adaptor_num].base_id, "video.device.xv_colorkey", - _("video overlay colour key"), - _("The colour key is used to tell the graphics card where to " - "overlay the video image. Try different values, if you experience " - "windows becoming transparent.")); - - } else if(!strcmp(attr[k].name, "XV_AUTOPAINT_COLORKEY")) { + VIDEO_DEVICE_XV_COLORKEY_HELP); + } else if(!strcmp(name, "XV_AUTOPAINT_COLORKEY")) { xvmc_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attr[k], - class->adaptor_info[class->adaptor_num].base_id, "XV_AUTOPAINT_COLORKEY", + adaptor_info[adaptor_num].base_id, "video.device.xv_autopaint_colorkey", - _("autopaint colour key"), - _("Make Xv autopaint its colorkey.")); - - } else if(!strcmp(attr[k].name, "XV_DOUBLE_BUFFER")) { - int xvmc_double_buffer; - xvmc_double_buffer = config->register_bool (config, "video.device.xv_double_buffer", 1, - _("enable double buffering"), - _("Double buffering will synchronize the update of the video image to the " - "repainting of the entire screen (\"vertical retrace\"). This eliminates " - "flickering and tearing artifacts, but will use more graphics memory."), - 20, xvmc_update_XV_DOUBLE_BUFFER, this); + VIDEO_DEVICE_XV_AUTOPAINT_COLORKEY_HELP); + } else if(!strcmp(name, "XV_DOUBLE_BUFFER")) { + int xvmc_double_buffer = config->register_bool (config, "video.device.xv_double_buffer", 1, + VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, + 20, xvmc_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xvmc_double_buffer); } } @@ -1445,7 +1445,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi /* * check supported image formats */ - fo = XvListImageFormats(display, this->xv_port, (int*)&formats); + fo = XvListImageFormats(this->display, this->xv_port, (int*)&formats); XUnlockDisplay(this->display); this->xvmc_format_yv12 = 0; @@ -1497,10 +1497,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi static void dispose_class (video_driver_class_t *this_gen) { xvmc_class_t *this = (xvmc_class_t *) this_gen; - XLockDisplay(this->display); - XvFreeAdaptorInfo (this->adaptor_info); - XUnlockDisplay(this->display); - free (this); } @@ -1645,7 +1641,7 @@ static void *init_class (xine_t *xine, void *visual_gen) { else { xprintf (xine, XINE_VERBOSITY_LOG, _("video_out_xvmc: using Xv port %ld from adaptor %s\n" - " for hardware colorspace conversion and scaling\n"), + " for hardware colour space conversion and scaling\n"), xv_port, adaptor_info[adaptor_num].name); if(IDCTaccel&XINE_VO_IDCT_ACCEL) @@ -1673,8 +1669,6 @@ static void *init_class (xine_t *xine, void *visual_gen) { this->display = display; this->config = xine->config; this->xv_port = xv_port; - this->adaptor_info = adaptor_info; - this->adaptor_num = adaptor_num; this->surface_type_id = surface_type; this->max_surface_width = max_width; this->max_surface_height = max_height; diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index c66566233..107ed9c7b 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004 the xine project + * Copyright (C) 2000-2004, 2008 the xine project * Copyright (C) 2004 the Unichrome project * * This file is part of xine, a free video player. @@ -34,9 +34,9 @@ */ - #include "xxmc.h" #include <unistd.h> +#include "xv_common.h" static int gX11Fail; @@ -1796,6 +1796,18 @@ static int xxmc_get_property (vo_driver_t *this_gen, int property) { case VO_PROP_WINDOW_HEIGHT: this->props[property].value = this->sc.gui_height; break; + case VO_PROP_OUTPUT_WIDTH: + this->props[property].value = this->sc.output_width; + break; + case VO_PROP_OUTPUT_HEIGHT: + this->props[property].value = this->sc.output_height; + break; + case VO_PROP_OUTPUT_XOFFSET: + this->props[property].value = this->sc.output_xoffset; + break; + case VO_PROP_OUTPUT_YOFFSET: + this->props[property].value = this->sc.output_yoffset; + break; } lprintf("%s: property #%d = %d\n", LOG_MODULE, property, this->props[property].value); @@ -2089,13 +2101,13 @@ static int xxmc_check_yv12 (Display *display, XvPortID port) { /* called xlocked */ static void xxmc_check_capability (xxmc_driver_t *this, - int property, XvAttribute attr, - int base_id, char *str_prop, - char *config_name, - char *config_desc, - char *config_help) { + int property, XvAttribute attr, int base_id, + const char *config_name, + const char *config_desc, + const char *config_help) { int int_default; cfg_entry_t *entry; + const char *str_prop = attr.name; if (VO_PROP_COLORKEY && (attr.max_value == ~0)) attr.max_value = 2147483615; @@ -2225,6 +2237,47 @@ static void xxmc_update_disable_bob_for_scaled_osd(void *this_gen, xine_cfg_entr this->disable_bob_for_scaled_osd = entry->num_value; } +static int xxmc_open_port (xxmc_driver_t *this, XvPortID port) { + int ret; + x11_InstallXErrorHandler (this); + ret = ! xxmc_check_yv12(this->display, port) + && XvGrabPort(this->display, port, 0) == Success; + x11_DeInstallXErrorHandler (this); + return ret; +} + +static unsigned int +xxmc_find_adaptor_by_port (int port, unsigned int adaptors, + XvAdaptorInfo *adaptor_info) +{ + unsigned int an; + for (an = 0; an < adaptors; an++) + if (adaptor_info[an].type & XvImageMask) + if (port >= adaptor_info[an].base_id && + port < adaptor_info[an].base_id + adaptor_info[an].num_ports) + return an; + return 0; /* shouldn't happen */ +} + +static XvPortID xxmc_autodetect_port(xxmc_driver_t *this, + unsigned int adaptors, + XvAdaptorInfo *adaptor_info, + unsigned int *adaptor_num) { + unsigned int an, j; + + for (an = 0; an < adaptors; an++) + if (adaptor_info[an].type & XvImageMask) + for (j = 0; j < adaptor_info[an].num_ports; j++) { + XvPortID port = adaptor_info[an].base_id + j; + if (xxmc_open_port(this, port)) { + *adaptor_num = an; + return port; + } + } + + return 0; +} + static void checkXvMCCap( xxmc_driver_t *this, XvPortID xv_port) { @@ -2424,25 +2477,20 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi return NULL; } - xv_port = 0; - - for ( adaptor_num = 0; (adaptor_num < adaptors) && !xv_port; adaptor_num++ ) { - - if (adaptor_info[adaptor_num].type & XvImageMask) { + xv_port = config->register_num (config, "video.device.xv_port", 0, + VIDEO_DEVICE_XV_PORT_HELP, + 10, NULL, NULL); - for (j = 0; j < adaptor_info[adaptor_num].num_ports && !xv_port; j++) - if (( !(xxmc_check_yv12 (this->display, - adaptor_info[adaptor_num].base_id + j))) - && (XvGrabPort (this->display, - adaptor_info[adaptor_num].base_id + j, - 0) == Success)) { - xv_port = adaptor_info[adaptor_num].base_id + j; - } - - if( xv_port ) - break; - } - } + if (xv_port != 0) { + if (! xxmc_open_port(this, xv_port)) { + xprintf(class->xine, XINE_VERBOSITY_NONE, + _("%s: could not open Xv port %d - autodetecting\n"), + LOG_MODULE, xv_port); + xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); + } else + adaptor_num = xxmc_find_adaptor_by_port (xv_port, adaptors, adaptor_info); + } else + xv_port = xxmc_autodetect_port(this, adaptors, adaptor_info, &adaptor_num); if (!xv_port) { xprintf(class->xine, XINE_VERBOSITY_LOG, @@ -2457,7 +2505,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi else xprintf(class->xine, XINE_VERBOSITY_LOG, _("%s: using Xv port %ld from adaptor %s for hardware " - "colorspace conversion and scaling.\n"), LOG_MODULE, xv_port, + "colour space conversion and scaling.\n"), LOG_MODULE, xv_port, adaptor_info[adaptor_num].name); XUnlockDisplay(this->display); @@ -2531,70 +2579,49 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi for(k = 0; k < nattr; k++) { if((attr[k].flags & XvSettable) && (attr[k].flags & XvGettable)) { - if(!strcmp(attr[k].name, "XV_HUE")) { + const char *const name = attr[k].name; + if(!strcmp(name, "XV_HUE")) { if (!strncmp(adaptor_info[adaptor_num].name, "NV", 2)) { xprintf (this->xine, XINE_VERBOSITY_NONE, LOG_MODULE ": ignoring broken XV_HUE settings on NVidia cards\n"); } else { xxmc_check_capability (this, VO_PROP_HUE, attr[k], - adaptor_info[adaptor_num].base_id, "XV_HUE", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); } - } else if(!strcmp(attr[k].name, "XV_SATURATION")) { + } else if(!strcmp(name, "XV_SATURATION")) { xxmc_check_capability (this, VO_PROP_SATURATION, attr[k], - adaptor_info[adaptor_num].base_id, "XV_SATURATION", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_BRIGHTNESS")) { + } else if(!strcmp(name, "XV_BRIGHTNESS")) { xxmc_check_capability (this, VO_PROP_BRIGHTNESS, attr[k], - adaptor_info[adaptor_num].base_id, "XV_BRIGHTNESS", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_CONTRAST")) { + } else if(!strcmp(name, "XV_CONTRAST")) { xxmc_check_capability (this, VO_PROP_CONTRAST, attr[k], - adaptor_info[adaptor_num].base_id, "XV_CONTRAST", + adaptor_info[adaptor_num].base_id, NULL, NULL, NULL); - - } else if(!strcmp(attr[k].name, "XV_COLORKEY")) { + } else if(!strcmp(name, "XV_COLORKEY")) { xxmc_check_capability (this, VO_PROP_COLORKEY, attr[k], - adaptor_info[adaptor_num].base_id, "XV_COLORKEY", + adaptor_info[adaptor_num].base_id, "video.device.xv_colorkey", - _("video overlay colour key"), - _("The colour key is used to tell the graphics card where to " - "overlay the video image. Try different values, if you experience " - "windows becoming transparent.")); - - } else if(!strcmp(attr[k].name, "XV_AUTOPAINT_COLORKEY")) { + VIDEO_DEVICE_XV_COLORKEY_HELP); + } else if(!strcmp(name, "XV_AUTOPAINT_COLORKEY")) { xxmc_check_capability (this, VO_PROP_AUTOPAINT_COLORKEY, attr[k], - adaptor_info[adaptor_num].base_id, "XV_AUTOPAINT_COLORKEY", + adaptor_info[adaptor_num].base_id, "video.device.xv_autopaint_colorkey", - _("autopaint colour key"), - _("Make Xv autopaint its colorkey.")); - - } else if(!strcmp(attr[k].name, "XV_FILTER")) { + VIDEO_DEVICE_XV_AUTOPAINT_COLORKEY_HELP); + } else if(!strcmp(name, "XV_FILTER")) { int xv_filter; /* This setting is specific to Permedia 2/3 cards. */ xv_filter = config->register_range (config, "video.device.xv_filter", 0, attr[k].min_value, attr[k].max_value, - _("bilinear scaling mode"), - _("Selects the bilinear scaling mode for Permedia cards. " - "The individual values are:\n\n" - "Permedia 2\n" - "0 - disable bilinear filtering\n" - "1 - enable bilinear filtering\n\n" - "Permedia 3\n" - "0 - disable bilinear filtering\n" - "1 - horizontal linear filtering\n" - "2 - enable full bilinear filtering"), + VIDEO_DEVICE_XV_FILTER_HELP, 20, xxmc_update_XV_FILTER, this); config->update_num(config,"video.device.xv_filter",xv_filter); - } else if(!strcmp(attr[k].name, "XV_DOUBLE_BUFFER")) { - int xv_double_buffer; - xv_double_buffer = + } else if(!strcmp(name, "XV_DOUBLE_BUFFER")) { + int xv_double_buffer = config->register_bool (config, "video.device.xv_double_buffer", 1, - _("enable double buffering"), - _("Double buffering will synchronize the update of the video image to the " - "repainting of the entire screen (\"vertical retrace\"). This eliminates " - "flickering and tearing artifacts, but will use more graphics memory."), + VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP, 20, xxmc_update_XV_DOUBLE_BUFFER, this); config->update_num(config,"video.device.xv_double_buffer",xv_double_buffer); } @@ -2660,8 +2687,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi this->use_pitch_alignment = config->register_bool (config, "video.device.xv_pitch_alignment", 0, - _("pitch alignment workaround"), - _("Some buggy video drivers need a workaround to function properly."), + VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP, 10, xxmc_update_xv_pitch_alignment, this); use_more_frames= @@ -2680,8 +2706,8 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi 10, xxmc_update_cpu_save, this); this->reverse_nvidia_palette = config->register_bool (config, "video.device.xvmc_nvidia_color_fix", 0, - _("Fix buggy NVIDIA XvMC subpicture colors"), - _("There's a bug in NVIDIA's XvMC lib that makes red OSD colors\n" + _("Fix buggy NVIDIA XvMC subpicture colours"), + _("There's a bug in NVIDIA's XvMC lib that makes red OSD colours\n" "look blue and vice versa. This option provides a workaround.\n"), 10, xxmc_update_nvidia_fix, this); this->bob = diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c index e0cb6f1f6..450812f90 100644 --- a/src/video_out/x11osd.c +++ b/src/video_out/x11osd.c @@ -51,7 +51,7 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "x11osd.h" struct x11osd diff --git a/src/video_out/x11osd.h b/src/video_out/x11osd.h index fe0bf6208..0ffd6fba6 100644 --- a/src/video_out/x11osd.h +++ b/src/video_out/x11osd.h @@ -28,7 +28,7 @@ #ifndef X11OSD_H #define X11OSD_H -#include "vo_scale.h" +#include <xine/vo_scale.h> typedef struct x11osd x11osd; enum x11osd_mode {X11OSD_SHAPED, X11OSD_COLORKEY}; diff --git a/src/video_out/xcbosd.c b/src/video_out/xcbosd.c index 4bb2b60af..8bb96be1e 100644 --- a/src/video_out/xcbosd.c +++ b/src/video_out/xcbosd.c @@ -49,7 +49,7 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "xcbosd.h" struct xcbosd diff --git a/src/video_out/xcbosd.h b/src/video_out/xcbosd.h index 32af4965e..1d4fd1c3a 100644 --- a/src/video_out/xcbosd.h +++ b/src/video_out/xcbosd.h @@ -29,7 +29,7 @@ #ifndef XCBOSD_H #define XCBOSD_H -#include "vo_scale.h" +#include <xine/vo_scale.h> typedef struct xcbosd xcbosd; enum xcbosd_mode {XCBOSD_SHAPED, XCBOSD_COLORKEY}; diff --git a/src/video_out/xv_common.h b/src/video_out/xv_common.h new file mode 100644 index 000000000..ee2ab9a10 --- /dev/null +++ b/src/video_out/xv_common.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2008 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 + * + * xv_common.h: X11 Xv common bits + */ + +#define VIDEO_DEVICE_XV_COLORKEY_HELP \ + _("video overlay colour key"), \ + _("The colour key is used to tell the graphics card where to " \ + "overlay the video image. Try different values, if you "\ + "experience windows becoming transparent.") + +#define VIDEO_DEVICE_XV_AUTOPAINT_COLORKEY_HELP \ + _("autopaint colour key"), \ + _("Make Xv autopaint its colour key.") + +#define VIDEO_DEVICE_XV_FILTER_HELP \ + _("bilinear scaling mode"), \ + _("Selects the bilinear scaling mode for Permedia cards. " \ + "The individual values are:\n\n" \ + "Permedia 2\n" \ + "0 - disable bilinear filtering\n" \ + "1 - enable bilinear filtering\n\n" \ + "Permedia 3\n" \ + "0 - disable bilinear filtering\n" \ + "1 - horizontal linear filtering\n" \ + "2 - enable full bilinear filtering") + +#define VIDEO_DEVICE_XV_DOUBLE_BUFFER_HELP \ + _("enable double buffering"), \ + _("Double buffering will synchronize the update of the video " \ + "image to the repainting of the entire screen (\"vertical " \ + "retrace\"). This eliminates flickering and tearing artifacts, " \ + "but will use more graphics memory.") + +#define VIDEO_DEVICE_XV_PORT_HELP \ + _("Xv port number"), \ + _("Selects the Xv port number to use (0 to autodetect).") + +#define VIDEO_DEVICE_XV_PITCH_ALIGNMENT_HELP \ + _("pitch alignment workaround"), \ + _("Some buggy video drivers need a workaround to function properly.") diff --git a/src/video_out/xxmc.h b/src/video_out/xxmc.h index 84964af17..9aea10854 100644 --- a/src/video_out/xxmc.h +++ b/src/video_out/xxmc.h @@ -83,10 +83,10 @@ */ #include "xine.h" -#include "video_out.h" -#include "xine_internal.h" -#include "xineutils.h" -#include "vo_scale.h" +#include <xine/video_out.h> +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/vo_scale.h> #include "x11osd.h" #include "accel_xvmc.h" diff --git a/src/video_out/yuv2rgb.c b/src/video_out/yuv2rgb.c index 0ca6537a7..4cefe5e98 100644 --- a/src/video_out/yuv2rgb.c +++ b/src/video_out/yuv2rgb.c @@ -39,7 +39,7 @@ #define LOG */ -#include "xineutils.h" +#include <xine/xineutils.h> static int prof_scale_line = -1; @@ -1261,7 +1261,7 @@ static scale_line_func_t find_scale_line_func(int step) { int src_step; int dest_step; scale_line_func_t func; - char *desc; + const char *desc; /* FIXME: consider moving this to a char[] to avoid reloc */ } scale_line[] = { { 15, 16, scale_line_15_16, "dvd 4:3(pal)" }, { 45, 64, scale_line_45_64, "dvd 16:9(pal), fullscreen(1024x768)" }, @@ -3220,7 +3220,7 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, #ifdef LOG if (this->yuv2rgb_fun != NULL) - printf ("yuv2rgb: using MMXEXT for colorspace transform\n"); + printf ("yuv2rgb: using MMXEXT for colour space transform\n"); #endif } @@ -3230,7 +3230,7 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, #ifdef LOG if (this->yuv2rgb_fun != NULL) - printf ("yuv2rgb: using MMX for colorspace transform\n"); + printf ("yuv2rgb: using MMX for colour space transform\n"); #endif } #endif @@ -3241,12 +3241,12 @@ yuv2rgb_factory_t* yuv2rgb_factory_init (int mode, int swapped, #ifdef LOG if (this->yuv2rgb_fun != NULL) - printf ("yuv2rgb: using medialib for colorspace transform\n"); + printf ("yuv2rgb: using medialib for colour space transform\n"); #endif } #endif if (this->yuv2rgb_fun == NULL) { - lprintf ("no accelerated colorspace conversion found\n"); + lprintf ("no accelerated colour space conversion found\n"); yuv2rgb_c_init (this); } diff --git a/src/video_out/yuv2rgb_mlib.c b/src/video_out/yuv2rgb_mlib.c index 8635526ed..794ce437e 100644 --- a/src/video_out/yuv2rgb_mlib.c +++ b/src/video_out/yuv2rgb_mlib.c @@ -34,8 +34,8 @@ #include <mlib_algebra.h> #include <mlib_video.h> -#include "attributes.h" -#include "xineutils.h" +#include <xine/attributes.h> +#include <xine/xineutils.h> #include "yuv2rgb.h" #define MIN(a, b) (((a) < (b)) ? (a) : (b)) diff --git a/src/video_out/yuv2rgb_mmx.c b/src/video_out/yuv2rgb_mmx.c index 20a9b5a00..1835efe68 100644 --- a/src/video_out/yuv2rgb_mmx.c +++ b/src/video_out/yuv2rgb_mmx.c @@ -32,7 +32,7 @@ #include <inttypes.h> #include "yuv2rgb.h" -#include "xineutils.h" +#include <xine/xineutils.h> #define CPU_MMXEXT 0 #define CPU_MMX 1 diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index b90bd0ee9..2942d3560 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -16,12 +16,6 @@ endif noinst_HEADERS = bswap.h ffmpeg_bswap.h -xineinclude_HEADERS = buffer.h metronom.h configfile.h vo_scale.h \ - audio_out.h resample.h video_out.h xine_internal.h spu_decoder.h \ - video_overlay.h osd.h spu.h scratch.h xine_plugin.h xineintl.h \ - plugin_catalog.h audio_decoder.h video_decoder.h post.h \ - io_helper.h broadcaster.h info_helper.h refcounter.h alphablend.h - lib_LTLIBRARIES = libxine.la libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \ @@ -30,7 +24,8 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \ video_overlay.c osd.c spu.c scratch.c demux.c vo_scale.c \ xine_interface.c post.c broadcaster.c io_helper.c \ input_rip.c input_cache.c info_helper.c refcounter.c \ - alphablend.c + alphablend.c \ + load_plugins.h libxine_la_DEPENDENCIES = $(XINEUTILS_LIB) $(XDG_BASEDIR_DEPS) \ $(pthread_dep) $(LIBXINEPOSIX) @@ -38,7 +33,7 @@ libxine_la_LIBADD = $(PTHREAD_LIBS) $(DYNAMIC_LD_LIBS) $(LTLIBINTL) $(ZLIB_LIBS) -lm $(XINEUTILS_LIB) $(LTLIBICONV) $(FT2_LIBS) $(FONTCONFIG_LIBS) \ $(LIBXINEPOSIX) $(RT_LIBS) $(NET_LIBS) $(XDG_BASEDIR_LIBS) -libxine_la_LDFLAGS = $(AM_LDFLAGS) $(def_ldflags) \ +libxine_la_LDFLAGS = $(AM_LDFLAGS) $(def_ldflags) $(GCSECTIONS) \ -version-info $(XINE_LT_CURRENT):$(XINE_LT_REVISION):$(XINE_LT_AGE) $(XINEUTILS_LIB): diff --git a/src/xine-engine/alphablend.c b/src/xine-engine/alphablend.c index 4dffa09ad..41715decb 100644 --- a/src/xine-engine/alphablend.c +++ b/src/xine-engine/alphablend.c @@ -32,9 +32,9 @@ #include <stdlib.h> #include <stdio.h> -#include "xine_internal.h" -#include "video_out.h" -#include "alphablend.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/alphablend.h> #include "bswap.h" @@ -1959,7 +1959,7 @@ static int xx44_paletteIndex(xx44_palette_t *p, int color, uint32_t clut) } if (p->max_used == p->size -1) { - printf("video_out: Warning! Out of xx44 palette colors!\n"); + printf("video_out: Warning! Out of xx44 palette colours!\n"); return 1; } p->cluts[p->max_used] = clut; diff --git a/src/xine-engine/alphablend.h b/src/xine-engine/alphablend.h deleted file mode 100644 index f8c9ad540..000000000 --- a/src/xine-engine/alphablend.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * Copyright (C) 2000 Thomas Mirlacher - * - * This program 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. - * - * This program 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. - * - * The author may be reached as <dent@linuxvideo.org> - * - *------------------------------------------------------------ - * - */ - -#ifndef __ALPHABLEND_H__ -#define __ALPHABLEND_H__ - -#include "video_out.h" - -typedef struct { - void *buffer; - int buffer_size; - - int disable_exact_blending; - - int offset_x, offset_y; -} alphablend_t; - -void _x_alphablend_init(alphablend_t *extra_data, xine_t *xine) XINE_PROTECTED; -void _x_alphablend_free(alphablend_t *extra_data) XINE_PROTECTED; - -typedef struct { /* CLUT == Color LookUp Table */ - uint8_t cb; - uint8_t cr; - uint8_t y; - uint8_t foo; -} XINE_PACKED clut_t; - - -#define XX44_PALETTE_SIZE 32 - -typedef struct { - unsigned size; - unsigned max_used; - uint32_t cluts[XX44_PALETTE_SIZE]; - /* cache palette entries for both colors and hili_colors */ - int lookup_cache[OVL_PALETTE_SIZE*2]; -} xx44_palette_t; - - -void _x_blend_rgb16 (uint8_t * img, vo_overlay_t * img_overl, - int img_width, int img_height, - int dst_width, int dst_height, - alphablend_t *extra_data) XINE_PROTECTED; - -void _x_blend_rgb24 (uint8_t * img, vo_overlay_t * img_overl, - int img_width, int img_height, - int dst_width, int dst_height, - alphablend_t *extra_data) XINE_PROTECTED; - -void _x_blend_rgb32 (uint8_t * img, vo_overlay_t * img_overl, - int img_width, int img_height, - int dst_width, int dst_height, - alphablend_t *extra_data) XINE_PROTECTED; - -void _x_blend_yuv (uint8_t *dst_base[3], vo_overlay_t * img_overl, - int dst_width, int dst_height, int dst_pitches[3], - alphablend_t *extra_data) XINE_PROTECTED; - -void _x_blend_yuy2 (uint8_t * dst_img, vo_overlay_t * img_overl, - int dst_width, int dst_height, int dst_pitch, - alphablend_t *extra_data) XINE_PROTECTED; - -/* - * This function isn't too smart about blending. We want to avoid creating new - * colors in the palette as a result from two non-zero colors needed to be - * blended. Instead we choose the color with the highest alpha value to be - * visible. Some parts of the code taken from the "VeXP" project. - */ - -void _x_blend_xx44 (uint8_t *dst_img, vo_overlay_t *img_overl, - int dst_width, int dst_height, int dst_pitch, - alphablend_t *extra_data, - xx44_palette_t *palette,int ia44) XINE_PROTECTED; - -/* - * Functions to handle the xine-specific palette. - */ - -void _x_clear_xx44_palette(xx44_palette_t *p) XINE_PROTECTED; -void _x_init_xx44_palette(xx44_palette_t *p, unsigned num_entries) XINE_PROTECTED; -void _x_dispose_xx44_palette(xx44_palette_t *p) XINE_PROTECTED; - -/* - * Convert the xine-specific palette to something useful. - */ - -void _x_xx44_to_xvmc_palette(const xx44_palette_t *p,unsigned char *xvmc_palette, - unsigned first_xx44_entry, unsigned num_xx44_entries, - unsigned num_xvmc_components, char *xvmc_components) XINE_PROTECTED; - - -#endif diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 5476262d9..6a0688f0d 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -39,8 +39,8 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> static void *audio_decoder_loop (void *stream_gen) { diff --git a/src/xine-engine/audio_decoder.h b/src/xine-engine/audio_decoder.h deleted file mode 100644 index 307692b81..000000000 --- a/src/xine-engine/audio_decoder.h +++ /dev/null @@ -1,105 +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 - * - * xine audio decoder plugin interface - */ - -#ifndef HAVE_AUDIO_DECODER_H -#define HAVE_AUDIO_DECODER_H - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "buffer.h" -#else -# include <xine/os_types.h> -# include <xine/buffer.h> -#endif - -#define AUDIO_DECODER_IFACE_VERSION 16 - -/* - * generic xine audio decoder plugin interface - */ - -typedef struct audio_decoder_class_s audio_decoder_class_t; -typedef struct audio_decoder_s audio_decoder_t; - -struct audio_decoder_class_s { - - /* - * open a new instance of this plugin class - */ - audio_decoder_t* (*open_plugin) (audio_decoder_class_t *this, xine_stream_t *stream); - - /** - * @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; - - /* - * free all class-related resources - */ - - void (*dispose) (audio_decoder_class_t *this); -}; - -#define default_audio_decoder_class_dispose (void (*) (audio_decoder_class_t *this))free - -struct audio_decoder_s { - - /* - * decode data from buf and feed decoded samples to - * audio output - */ - void (*decode_data) (audio_decoder_t *this, buf_element_t *buf); - - /* - * reset decoder after engine flush (prepare for new - * audio data not related to recently decoded data) - */ - void (*reset) (audio_decoder_t *this); - - /* - * inform decoder that a time reference discontinuity has happened. - * that is, it must forget any currently held pts value - */ - void (*discontinuity) (audio_decoder_t *this); - - /* - * close down, free all resources - */ - void (*dispose) (audio_decoder_t *this); - - void *node; /* used by plugin loader */ - -}; - -#endif diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index aac1739aa..855051582 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -89,11 +89,11 @@ #define LOG_RESAMPLE_SYNC 0 -#include "xine_internal.h" -#include "xineutils.h" -#include "audio_out.h" -#include "resample.h" -#include "metronom.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> +#include <xine/audio_out.h> +#include <xine/resample.h> +#include <xine/metronom.h> #define NUM_AUDIO_BUFFERS 32 @@ -291,6 +291,7 @@ struct audio_fifo_s { int num_buffers; }; +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) { @@ -1614,13 +1615,17 @@ static void ao_close(xine_audio_port_t *this_gen, xine_stream_t *stream) { xprintf (this->xine, XINE_VERBOSITY_DEBUG, "audio_out: no streams left, closing driver\n"); if (this->audio_loop_running) { + /* make sure there are no more buffers on queue */ if (this->clock->speed == XINE_SPEED_PAUSE || (this->clock->speed != XINE_FINE_SPEED_NORMAL && !this->slow_fast_audio)) { - /* discard buffers, otherwise we'll wait forever */ + int discard = ao_get_property(this_gen, AO_PROP_DISCARD_BUFFERS); + /* discard buffers while waiting, otherwise we'll wait forever */ ao_set_property(this_gen, AO_PROP_DISCARD_BUFFERS, 1); + fifo_wait_empty(this->out_fifo); + ao_set_property(this_gen, AO_PROP_DISCARD_BUFFERS, discard); } - /* make sure there are no more buffers on queue */ - fifo_wait_empty(this->out_fifo); + else + fifo_wait_empty(this->out_fifo); } pthread_mutex_lock( &this->driver_lock ); @@ -2045,8 +2050,8 @@ xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int i, err; pthread_attr_t pth_attrs; pthread_mutexattr_t attr; - static const char* resample_modes[] = {"auto", "off", "on", NULL}; - static const char* av_sync_methods[] = {"metronom feedback", "resample", NULL}; + static const char *const resample_modes[] = {"auto", "off", "on", NULL}; + static const char *const av_sync_methods[] = {"metronom feedback", "resample", NULL}; this = xine_xmalloc (sizeof (aos_t)) ; diff --git a/src/xine-engine/audio_out.h b/src/xine-engine/audio_out.h deleted file mode 100644 index bd1b910df..000000000 --- a/src/xine-engine/audio_out.h +++ /dev/null @@ -1,352 +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_AUDIO_OUT_H -#define HAVE_AUDIO_OUT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(XINE_COMPILE) -#include <inttypes.h> -#include "metronom.h" -#include "configfile.h" -#include "xineutils.h" -#else -#include <xine/os_types.h> -#include <xine/metronom.h> -#include <xine/configfile.h> -#include <xine/xineutils.h> -#endif - - -#define AUDIO_OUT_IFACE_VERSION 9 - -/* - * ao_driver_s contains the driver every audio output - * driver plugin has to implement. - */ - -typedef struct ao_driver_s ao_driver_t; - -struct ao_driver_s { - - /* - * - * find out what output modes + capatilities are supported by - * this plugin (constants for the bit vector to return see above) - * - * See AO_CAP_* bellow. - */ - uint32_t (*get_capabilities) (ao_driver_t *); - - /* - * open the driver and make it ready to receive audio data - * buffers may be flushed(!) - * - * return value: 0 : failure, >0 : output sample rate - */ - int (*open)(ao_driver_t *, uint32_t bits, uint32_t rate, int mode); - - /* return the number of audio channels - */ - int (*num_channels)(ao_driver_t *self_gen); - - /* return the number of bytes per frame. - * A frame is equivalent to one sample being output on every audio channel. - */ - int (*bytes_per_frame)(ao_driver_t *self_gen); - - /* return the delay is frames measured by - * looking at pending samples in the audio output device - */ - int (*delay)(ao_driver_t *self_gen); - - /* - * return gap tolerance (in pts) needed for this driver - */ - int (*get_gap_tolerance) (ao_driver_t *self_gen); - - /* - * write audio data to audio output device - * return value: - * >0 => audio samples were processed ok - * 0 => audio samples were not yet processed, - * call write_audio_data with the _same_ samples again - */ - int (*write)(ao_driver_t *, - int16_t* audio_data, uint32_t num_samples); - - /* - * this is called when the decoder no longer uses the audio - * output driver - the driver should get ready to get opened() again - */ - void (*close)(ao_driver_t *); - - /* - * shut down this audio output driver plugin and - * free all resources allocated - */ - void (*exit) (ao_driver_t *); - - /* - * Get, Set a property of audio driver. - * - * get_property() return 1 in success, 0 on failure. - * set_property() return value on success, ~value on failure. - * - * See AO_PROP_* below for available properties. - */ - int (*get_property) (ao_driver_t *, int property); - - int (*set_property) (ao_driver_t *, int property, int value); - - - /* - * misc control operations on the audio device. - * - * See AO_CTRL_* below. - */ - int (*control) (ao_driver_t *, int cmd, /* arg */ ...); - - void *node; -}; - -typedef struct ao_format_s ao_format_t; - -struct ao_format_s { - uint32_t bits; - uint32_t rate; - int mode; -}; - -typedef struct audio_fifo_s audio_fifo_t; - -typedef struct audio_buffer_s audio_buffer_t; - -struct audio_buffer_s { - - audio_buffer_t *next; - - int16_t *mem; - int mem_size; - int num_frames; - - int64_t vpts; - uint32_t frame_header_count; - uint32_t first_access_unit; - - /* extra info coming from input or demuxers */ - extra_info_t *extra_info; - - xine_stream_t *stream; /* stream that send that buffer */ - - ao_format_t format; /* let each buffer carry it's own format info */ -}; - -/* - * xine_audio_port_s contains the port every audio decoder talks to - * - * Remember that adding new functions to this structure requires - * adaption of the post plugin decoration layer. Be sure to look into - * src/xine-engine/post.[ch]. - */ - -struct xine_audio_port_s { - uint32_t (*get_capabilities) (xine_audio_port_t *); /* for constants see below */ - - /* * Get/Set audio property - * - * See AO_PROP_* bellow - */ - int (*get_property) (xine_audio_port_t *, int property); - int (*set_property) (xine_audio_port_t *, int property, int value); - - /* open audio driver for audio output - * return value: 0:failure, >0:output sample rate - */ - /* when you are not a full-blown stream, but still need to open the port - * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ - int (*open) (xine_audio_port_t *, xine_stream_t *stream, - uint32_t bits, uint32_t rate, int mode); - - /* - * get a piece of memory for audio data - */ - audio_buffer_t * (*get_buffer) (xine_audio_port_t *); - - /* - * append a buffer filled with audio data to the audio fifo - * for output - */ - /* when the frame does not originate from a stream, it is legal to pass an anonymous stream */ - void (*put_buffer) (xine_audio_port_t *, audio_buffer_t *buf, xine_stream_t *stream); - - /* audio driver is no longer used by decoder => close */ - /* when you are not a full-blown stream, but still need to close the port - * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ - void (*close) (xine_audio_port_t *self, xine_stream_t *stream); - - /* called on xine exit */ - void (*exit) (xine_audio_port_t *); - - /* - * misc control operations on the audio device. - * - * See AO_CTRL_* below. - */ - int (*control) (xine_audio_port_t *, int cmd, /* arg */ ...); - - /* - * Flush audio_out fifo. - */ - void (*flush) (xine_audio_port_t *); - - /* - * Check if port is opened for this stream and get parameters. - * The stream can be anonymous. - */ - int (*status) (xine_audio_port_t *, xine_stream_t *stream, - uint32_t *bits, uint32_t *rate, int *mode); - -}; - -typedef struct audio_driver_class_s audio_driver_class_t; - -struct audio_driver_class_s { - - /* - * open a new instance of this plugin class - */ - ao_driver_t* (*open_plugin) (audio_driver_class_t *, const void *data); - - /** - * @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; - - /* - * free all class-related resources - */ - - void (*dispose) (audio_driver_class_t *); -}; - -#define default_audio_driver_class_dispose (void (*) (audio_driver_class_t *this))free - -/** - * @brief Initialise the audio_out sync routines - * - * @internal - */ -xine_audio_port_t *_x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only); - -/* - * audio output modes + capabilities - */ - -#define AO_CAP_NOCAP 0x00000000 /* driver has no capabilities */ -#define AO_CAP_MODE_A52 0x00000001 /* driver supports A/52 output */ -#define AO_CAP_MODE_AC5 0x00000002 /* driver supports AC5 output */ -/* 1 sample == 2 bytes (C) */ -#define AO_CAP_MODE_MONO 0x00000004 /* driver supports mono output */ -/* 1 sample == 4 bytes (L,R) */ -#define AO_CAP_MODE_STEREO 0x00000008 /* driver supports stereo output */ -/* 1 sample == 8 bytes (L,R,LR,RR) */ -#define AO_CAP_MODE_4CHANNEL 0x00000010 /* driver supports 4 channels */ -/* - * Sound cards generally support, 1,2,4,6 channels, but rarely 5. - * So xine will take 4.1, 5 and 6 channel a52 streams and - * down or upmix it correctly to fill the 6 output channels. - * Are there any requests for 2.1 out there? - */ -/* 1 sample == 12 bytes (L,R,LR,RR,Null,LFE) */ -#define AO_CAP_MODE_4_1CHANNEL 0x00000020 /* driver supports 4.1 channels */ -/* 1 sample == 12 bytes (L,R,LR,RR,C, Null) */ -#define AO_CAP_MODE_5CHANNEL 0x00000040 /* driver supports 5 channels */ -/* 1 sample == 12 bytes (L,R,LR,RR,C,LFE) */ -#define AO_CAP_MODE_5_1CHANNEL 0x00000080 /* driver supports 5.1 channels */ - -/* - * converts the audio output mode into the number of channels - */ -int _x_ao_mode2channels( int mode ) XINE_PROTECTED; -/* - * converts the number of channels into the audio output mode - */ -int _x_ao_channels2mode( int channels ) XINE_PROTECTED; - -#define AO_CAP_MIXER_VOL 0x00000100 /* driver supports mixer control */ -#define AO_CAP_PCM_VOL 0x00000200 /* driver supports pcm control */ -#define AO_CAP_MUTE_VOL 0x00000400 /* driver can mute volume */ -#define AO_CAP_8BITS 0x00000800 /* driver support 8-bit samples */ -#define AO_CAP_16BITS 0x00001000 /* driver support 16-bit samples */ -#define AO_CAP_24BITS 0x00002000 /* driver support 24-bit samples */ -#define AO_CAP_FLOAT32 0x00004000 /* driver support 32-bit samples. i.e. Floats */ - -/* properties supported by get/set_property() */ -#define AO_PROP_MIXER_VOL 0 -#define AO_PROP_PCM_VOL 1 -#define AO_PROP_MUTE_VOL 2 -#define AO_PROP_COMPRESSOR 3 -#define AO_PROP_DISCARD_BUFFERS 4 -#define AO_PROP_BUFS_IN_FIFO 5 /* read-only */ -#define AO_PROP_AMP 6 /* amplifier */ -#define AO_PROP_EQ_30HZ 7 /* equalizer */ -#define AO_PROP_EQ_60HZ 8 /* equalizer */ -#define AO_PROP_EQ_125HZ 9 /* equalizer */ -#define AO_PROP_EQ_250HZ 10 /* equalizer */ -#define AO_PROP_EQ_500HZ 11 /* equalizer */ -#define AO_PROP_EQ_1000HZ 12 /* equalizer */ -#define AO_PROP_EQ_2000HZ 13 /* equalizer */ -#define AO_PROP_EQ_4000HZ 14 /* equalizer */ -#define AO_PROP_EQ_8000HZ 15 /* equalizer */ -#define AO_PROP_EQ_16000HZ 16 /* equalizer */ -#define AO_PROP_CLOSE_DEVICE 17 /* force closing audio device */ -#define AO_PROP_AMP_MUTE 18 /* amplifier mute */ -#define AO_PROP_NUM_STREAMS 19 /* read-only */ -#define AO_PROP_CLOCK_SPEED 20 /* inform audio_out that speed has changed */ -#define AO_NUM_PROPERTIES 21 - -/* audio device control ops */ -#define AO_CTRL_PLAY_PAUSE 0 -#define AO_CTRL_PLAY_RESUME 1 -#define AO_CTRL_FLUSH_BUFFERS 2 - -/* above that value audio frames are discarded */ -#define AO_MAX_GAP 15000 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c index 1d2f01366..2157f0550 100644 --- a/src/xine-engine/broadcaster.c +++ b/src/xine-engine/broadcaster.c @@ -57,9 +57,9 @@ #include <dlfcn.h> #include <pthread.h> -#include "xine_internal.h" -#include "buffer.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/buffer.h> +#include <xine/xineutils.h> #define QLEN 5 /* maximum connection queue length */ #define _BUFSIZ 512 @@ -108,9 +108,10 @@ static int sock_check_opened(int socket) { /* * Write to socket. */ -static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { +static int sock_data_write(xine_t *xine, int socket, void *buf_gen, int len) { ssize_t size; int wlen = 0; + uint8_t *buf = buf_gen; if((socket < 0) || (buf == NULL)) return -1; @@ -135,7 +136,7 @@ static int sock_data_write(xine_t *xine, int socket, char *buf, int len) { } static int XINE_FORMAT_PRINTF(3, 4) -sock_string_write(xine_t *xine, int socket, char *msg, ...) { +sock_string_write(xine_t *xine, int socket, const char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -154,7 +155,7 @@ sock_string_write(xine_t *xine, int socket, char *msg, ...) { * this is the most important broadcaster function. * it sends data to every connected client (slaves). */ -static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { +static void broadcaster_data_write(broadcaster_t *this, void *buf, int len) { xine_list_iterator_t ite; ite = xine_list_front (this->connections); @@ -177,7 +178,7 @@ static void broadcaster_data_write(broadcaster_t *this, char *buf, int len) { } static void XINE_FORMAT_PRINTF(2, 3) -broadcaster_string_write(broadcaster_t *this, char *msg, ...) { +broadcaster_string_write(broadcaster_t *this, const char *msg, ...) { char buf[_BUFSIZ]; va_list args; @@ -247,7 +248,7 @@ static void *manager_loop (void *this_gen) { /* * receive xine buffers and send them through the broadcaster */ -static void send_buf (broadcaster_t *this, char *from, buf_element_t *buf) { +static void send_buf (broadcaster_t *this, const char *from, buf_element_t *buf) { int i; /* ignore END buffers since they would stop the slavery */ diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c index 93ad75ba0..8b8a8334a 100644 --- a/src/xine-engine/buffer.c +++ b/src/xine-engine/buffer.c @@ -43,9 +43,9 @@ #define LOG */ -#include "buffer.h" -#include "xineutils.h" -#include "xine_internal.h" +#include <xine/buffer.h> +#include <xine/xineutils.h> +#include <xine/xine_internal.h> /* * put a previously allocated buffer element back into the buffer pool diff --git a/src/xine-engine/buffer.h b/src/xine-engine/buffer.h deleted file mode 100644 index ce209c9da..000000000 --- a/src/xine-engine/buffer.h +++ /dev/null @@ -1,718 +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 - * - * - * contents: - * - * buffer_entry structure - serves as a transport encapsulation - * of the mpeg audio/video data through xine - * - * free buffer pool management routines - * - * FIFO buffer structures/routines - */ - -#ifndef HAVE_BUFFER_H -#define HAVE_BUFFER_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <pthread.h> -#include <sys/types.h> - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "attributes.h" -#else -# include <xine/os_types.h> -# include <xine/attributes.h> -#endif - -#define BUF_MAX_CALLBACKS 5 - -/** - * @defgroup buffer_types Buffer Types - * - * a buffer type ID describes the contents of a buffer - * it consists of three fields: - * - * buf_type = 0xMMDDCCCC - * - * MM : major buffer type (CONTROL, VIDEO, AUDIO, SPU) - * DD : decoder selection (e.g. MPEG, OPENDIVX ... for VIDEO) - * CCCC : channel number or other subtype information for the decoder - */ -/*@{*/ - -#define BUF_MAJOR_MASK 0xFF000000 -#define BUF_DECODER_MASK 0x00FF0000 - -/** - * @defgroup buffer_ctrl Control buffer types - */ -/*@{*/ -#define BUF_CONTROL_BASE 0x01000000 -#define BUF_CONTROL_START 0x01000000 -#define BUF_CONTROL_END 0x01010000 -#define BUF_CONTROL_QUIT 0x01020000 -#define BUF_CONTROL_DISCONTINUITY 0x01030000 /**< former AVSYNC_RESET */ -#define BUF_CONTROL_NOP 0x01040000 -#define BUF_CONTROL_AUDIO_CHANNEL 0x01050000 -#define BUF_CONTROL_SPU_CHANNEL 0x01060000 -#define BUF_CONTROL_NEWPTS 0x01070000 -#define BUF_CONTROL_RESET_DECODER 0x01080000 -#define BUF_CONTROL_HEADERS_DONE 0x01090000 -#define BUF_CONTROL_FLUSH_DECODER 0x010a0000 -#define BUF_CONTROL_RESET_TRACK_MAP 0x010b0000 -/*@}*/ - -/** - * @defgroup buffer_video Video buffer types - * @note (please keep in sync with buffer_types.c) - */ -/*@{*/ -#define BUF_VIDEO_BASE 0x02000000 -#define BUF_VIDEO_UNKNOWN 0x02ff0000 /**< no decoder should handle this one */ -#define BUF_VIDEO_MPEG 0x02000000 -#define BUF_VIDEO_MPEG4 0x02010000 -#define BUF_VIDEO_CINEPAK 0x02020000 -#define BUF_VIDEO_SORENSON_V1 0x02030000 -#define BUF_VIDEO_MSMPEG4_V2 0x02040000 -#define BUF_VIDEO_MSMPEG4_V3 0x02050000 -#define BUF_VIDEO_MJPEG 0x02060000 -#define BUF_VIDEO_IV50 0x02070000 -#define BUF_VIDEO_IV41 0x02080000 -#define BUF_VIDEO_IV32 0x02090000 -#define BUF_VIDEO_IV31 0x020a0000 -#define BUF_VIDEO_ATIVCR1 0x020b0000 -#define BUF_VIDEO_ATIVCR2 0x020c0000 -#define BUF_VIDEO_I263 0x020d0000 -#define BUF_VIDEO_RV10 0x020e0000 -#define BUF_VIDEO_RGB 0x02100000 -#define BUF_VIDEO_YUY2 0x02110000 -#define BUF_VIDEO_JPEG 0x02120000 -#define BUF_VIDEO_WMV7 0x02130000 -#define BUF_VIDEO_WMV8 0x02140000 -#define BUF_VIDEO_MSVC 0x02150000 -#define BUF_VIDEO_DV 0x02160000 -#define BUF_VIDEO_REAL 0x02170000 -#define BUF_VIDEO_VP31 0x02180000 -#define BUF_VIDEO_H263 0x02190000 -#define BUF_VIDEO_3IVX 0x021A0000 -#define BUF_VIDEO_CYUV 0x021B0000 -#define BUF_VIDEO_DIVX5 0x021C0000 -#define BUF_VIDEO_XVID 0x021D0000 -#define BUF_VIDEO_SMC 0x021E0000 -#define BUF_VIDEO_RPZA 0x021F0000 -#define BUF_VIDEO_QTRLE 0x02200000 -#define BUF_VIDEO_MSRLE 0x02210000 -#define BUF_VIDEO_DUCKTM1 0x02220000 -#define BUF_VIDEO_FLI 0x02230000 -#define BUF_VIDEO_ROQ 0x02240000 -#define BUF_VIDEO_SORENSON_V3 0x02250000 -#define BUF_VIDEO_MSMPEG4_V1 0x02260000 -#define BUF_VIDEO_MSS1 0x02270000 -#define BUF_VIDEO_IDCIN 0x02280000 -#define BUF_VIDEO_PGVV 0x02290000 -#define BUF_VIDEO_ZYGO 0x022A0000 -#define BUF_VIDEO_TSCC 0x022B0000 -#define BUF_VIDEO_YVU9 0x022C0000 -#define BUF_VIDEO_VQA 0x022D0000 -#define BUF_VIDEO_GREY 0x022E0000 -#define BUF_VIDEO_XXAN 0x022F0000 -#define BUF_VIDEO_WC3 0x02300000 -#define BUF_VIDEO_YV12 0x02310000 -#define BUF_VIDEO_SEGA 0x02320000 -#define BUF_VIDEO_RV20 0x02330000 -#define BUF_VIDEO_RV30 0x02340000 -#define BUF_VIDEO_MVI2 0x02350000 -#define BUF_VIDEO_UCOD 0x02360000 -#define BUF_VIDEO_WMV9 0x02370000 -#define BUF_VIDEO_INTERPLAY 0x02380000 -#define BUF_VIDEO_RV40 0x02390000 -#define BUF_VIDEO_PSX_MDEC 0x023A0000 -#define BUF_VIDEO_YUV_FRAMES 0x023B0000 /**< uncompressed YUV, delivered by v4l input plugin */ -#define BUF_VIDEO_HUFFYUV 0x023C0000 -#define BUF_VIDEO_IMAGE 0x023D0000 -#define BUF_VIDEO_THEORA 0x023E0000 -#define BUF_VIDEO_4XM 0x023F0000 -#define BUF_VIDEO_I420 0x02400000 -#define BUF_VIDEO_VP4 0x02410000 -#define BUF_VIDEO_VP5 0x02420000 -#define BUF_VIDEO_VP6 0x02430000 -#define BUF_VIDEO_VMD 0x02440000 -#define BUF_VIDEO_MSZH 0x02450000 -#define BUF_VIDEO_ZLIB 0x02460000 -#define BUF_VIDEO_8BPS 0x02470000 -#define BUF_VIDEO_ASV1 0x02480000 -#define BUF_VIDEO_ASV2 0x02490000 -#define BUF_VIDEO_BITPLANE 0x024A0000 /**< Amiga typical picture and animation format */ -#define BUF_VIDEO_BITPLANE_BR1 0x024B0000 /**< the same with Bytrun compression 1 */ -#define BUF_VIDEO_FLV1 0x024C0000 -#define BUF_VIDEO_H264 0x024D0000 -#define BUF_VIDEO_MJPEG_B 0x024E0000 -#define BUF_VIDEO_H261 0x024F0000 -#define BUF_VIDEO_AASC 0x02500000 -#define BUF_VIDEO_LOCO 0x02510000 -#define BUF_VIDEO_QDRW 0x02520000 -#define BUF_VIDEO_QPEG 0x02530000 -#define BUF_VIDEO_ULTI 0x02540000 -#define BUF_VIDEO_WNV1 0x02550000 -#define BUF_VIDEO_XL 0x02560000 -#define BUF_VIDEO_RT21 0x02570000 -#define BUF_VIDEO_FPS1 0x02580000 -#define BUF_VIDEO_DUCKTM2 0x02590000 -#define BUF_VIDEO_CSCD 0x025A0000 -#define BUF_VIDEO_ALGMM 0x025B0000 -#define BUF_VIDEO_ZMBV 0x025C0000 -#define BUF_VIDEO_AVS 0x025D0000 -#define BUF_VIDEO_SMACKER 0x025E0000 -#define BUF_VIDEO_NUV 0x025F0000 -#define BUF_VIDEO_KMVC 0x02600000 -#define BUF_VIDEO_FLASHSV 0x02610000 -#define BUF_VIDEO_CAVS 0x02620000 -#define BUF_VIDEO_VP6F 0x02630000 -#define BUF_VIDEO_THEORA_RAW 0x02640000 -#define BUF_VIDEO_VC1 0x02650000 -/*@}*/ - -/** - * @defgroup buffer_audio Audio buffer types - * @note (please keep in sync with buffer_types.c) - */ -/*@{*/ -#define BUF_AUDIO_BASE 0x03000000 -#define BUF_AUDIO_UNKNOWN 0x03ff0000 /**< no decoder should handle this one */ -#define BUF_AUDIO_A52 0x03000000 -#define BUF_AUDIO_MPEG 0x03010000 -#define BUF_AUDIO_LPCM_BE 0x03020000 -#define BUF_AUDIO_LPCM_LE 0x03030000 -#define BUF_AUDIO_WMAV1 0x03040000 -#define BUF_AUDIO_DTS 0x03050000 -#define BUF_AUDIO_MSADPCM 0x03060000 -#define BUF_AUDIO_MSIMAADPCM 0x03070000 -#define BUF_AUDIO_MSGSM 0x03080000 -#define BUF_AUDIO_VORBIS 0x03090000 -#define BUF_AUDIO_IMC 0x030a0000 -#define BUF_AUDIO_LH 0x030b0000 -#define BUF_AUDIO_VOXWARE 0x030c0000 -#define BUF_AUDIO_ACELPNET 0x030d0000 -#define BUF_AUDIO_AAC 0x030e0000 -#define BUF_AUDIO_DNET 0x030f0000 -#define BUF_AUDIO_VIVOG723 0x03100000 -#define BUF_AUDIO_DK3ADPCM 0x03110000 -#define BUF_AUDIO_DK4ADPCM 0x03120000 -#define BUF_AUDIO_ROQ 0x03130000 -#define BUF_AUDIO_QTIMAADPCM 0x03140000 -#define BUF_AUDIO_MAC3 0x03150000 -#define BUF_AUDIO_MAC6 0x03160000 -#define BUF_AUDIO_QDESIGN1 0x03170000 -#define BUF_AUDIO_QDESIGN2 0x03180000 -#define BUF_AUDIO_QCLP 0x03190000 -#define BUF_AUDIO_SMJPEG_IMA 0x031A0000 -#define BUF_AUDIO_VQA_IMA 0x031B0000 -#define BUF_AUDIO_MULAW 0x031C0000 -#define BUF_AUDIO_ALAW 0x031D0000 -#define BUF_AUDIO_GSM610 0x031E0000 -#define BUF_AUDIO_EA_ADPCM 0x031F0000 -#define BUF_AUDIO_WMAV2 0x03200000 -#define BUF_AUDIO_COOK 0x03210000 -#define BUF_AUDIO_ATRK 0x03220000 -#define BUF_AUDIO_14_4 0x03230000 -#define BUF_AUDIO_28_8 0x03240000 -#define BUF_AUDIO_SIPRO 0x03250000 -#define BUF_AUDIO_WMAV3 0x03260000 -#define BUF_AUDIO_INTERPLAY 0x03270000 -#define BUF_AUDIO_XA_ADPCM 0x03280000 -#define BUF_AUDIO_WESTWOOD 0x03290000 -#define BUF_AUDIO_DIALOGIC_IMA 0x032A0000 -#define BUF_AUDIO_NSF 0x032B0000 -#define BUF_AUDIO_FLAC 0x032C0000 -#define BUF_AUDIO_DV 0x032D0000 -#define BUF_AUDIO_WMAV 0x032E0000 -#define BUF_AUDIO_SPEEX 0x032F0000 -#define BUF_AUDIO_RAWPCM 0x03300000 -#define BUF_AUDIO_4X_ADPCM 0x03310000 -#define BUF_AUDIO_VMD 0x03320000 -#define BUF_AUDIO_XAN_DPCM 0x03330000 -#define BUF_AUDIO_ALAC 0x03340000 -#define BUF_AUDIO_MPC 0x03350000 -#define BUF_AUDIO_SHORTEN 0x03360000 -#define BUF_AUDIO_WESTWOOD_SND1 0x03370000 -#define BUF_AUDIO_WMALL 0x03380000 -#define BUF_AUDIO_TRUESPEECH 0x03390000 -#define BUF_AUDIO_TTA 0x033A0000 -#define BUF_AUDIO_SMACKER 0x033B0000 -#define BUF_AUDIO_FLVADPCM 0x033C0000 -#define BUF_AUDIO_WAVPACK 0x033D0000 -/*@}*/ - -/** - * @defgroup buffer_spu SPU buffer types - */ -/*@{*/ -#define BUF_SPU_BASE 0x04000000 -#define BUF_SPU_DVD 0x04000000 -#define BUF_SPU_TEXT 0x04010000 -#define BUF_SPU_CC 0x04020000 -#define BUF_SPU_DVB 0x04030000 -#define BUF_SPU_SVCD 0x04040000 -#define BUF_SPU_CVD 0x04050000 -#define BUF_SPU_OGM 0x04060000 -#define BUF_SPU_CMML 0x04070000 -/*@}*/ - -/** - * @defgroup buffer_demux Demuxer block types - */ -/*@{*/ -#define BUF_DEMUX_BLOCK 0x05000000 -/*@}*/ - -/*@}*/ - -typedef struct extra_info_s extra_info_t; - -/** - * @brief Structure to pass information from input or demuxer plugins - * to output frames (past decoder). - * - * New data must be added after the existing fields to not break ABI - * (backward compatibility). - */ - -struct extra_info_s { - - int input_normpos; /**< remember where this buf came from in - * the input source (0..65535). can be - * either time or offset based. */ - int input_time; /**< time offset in miliseconds from - * beginning of stream */ - uint32_t frame_number; /**< number of current frame if known */ - - int seek_count; /**< internal engine use */ - int64_t vpts; /**< set on output layers only */ - - int invalid; /**< do not use this extra info to update anything */ - int total_time; /**< duration in miliseconds of the stream */ -}; - - -#define BUF_NUM_DEC_INFO 5 - -typedef struct buf_element_s buf_element_t; -struct buf_element_s { - buf_element_t *next; - - unsigned char *mem; - unsigned char *content; /**< start of raw content in mem (without header etc) */ - - int32_t size ; /**< size of _content_ */ - int32_t max_size; /**< size of pre-allocated memory pointed to by "mem" */ - int64_t pts; /**< presentation time stamp, used for a/v sync */ - int64_t disc_off; /**< discontinuity offset */ - - extra_info_t *extra_info; /**< extra info will be passed to frames */ - - uint32_t decoder_flags; /**< stuff like keyframe, is_header ... see below */ - - /** additional decoder flags and other dec-spec. stuff */ - uint32_t decoder_info[BUF_NUM_DEC_INFO]; - /** pointers to dec-spec. stuff */ - void *decoder_info_ptr[BUF_NUM_DEC_INFO]; - - void (*free_buffer) (buf_element_t *buf); - - void *source; /**< pointer to source of this buffer for - * free_buffer */ - - uint32_t type; -} ; - -/** keyframe should be set whenever possible (that is, when demuxer - * knows about frames and keyframes). */ -#define BUF_FLAG_KEYFRAME 0x0001 - -/** frame start/end. BUF_FLAG_FRAME_END is sent on last buf of a frame */ -#define BUF_FLAG_FRAME_START 0x0002 -#define BUF_FLAG_FRAME_END 0x0004 - -/** any out-of-band data needed to initialize decoder must have - * this flag set. */ -#define BUF_FLAG_HEADER 0x0008 - -/** preview buffers are normal data buffers that must not produce any - * output in decoders (may be used to sneak details about the stream - * to come). */ -#define BUF_FLAG_PREVIEW 0x0010 - -/** set when user stop the playback */ -#define BUF_FLAG_END_USER 0x0020 - -/** set when stream finished naturaly */ -#define BUF_FLAG_END_STREAM 0x0040 - -/** decoder_info[0] carries the frame step (1/90000). */ -#define BUF_FLAG_FRAMERATE 0x0080 - -/** hint to metronom that seeking has occurred */ -#define BUF_FLAG_SEEK 0x0100 - -/** special information inside, see below. */ -#define BUF_FLAG_SPECIAL 0x0200 - -/** header use standard xine_bmiheader or xine_waveformatex structs. - * xine_waveformatex is actually optional since the most important - * information for audio init is available from decoder_info[]. - * note: BUF_FLAG_HEADER must also be set. */ -#define BUF_FLAG_STDHEADER 0x0400 - -/** decoder_info[1] carries numerator for display aspect ratio - * decoder_info[2] carries denominator for display aspect ratio */ -#define BUF_FLAG_ASPECT 0x0800 - - -/** - * \defgroup buffer_special Special buffer types: - * Sometimes there is a need to relay special information from a demuxer - * to a video decoder. For example, some file types store palette data in - * the file header independant of the video data. The special buffer type - * offers a way to communicate this or any other custom, format-specific - * data to the decoder. - * - * The interface was designed in a way that did not require an API - * version bump. To send a special buffer type, set a buffer's flags field - * to BUF_FLAG_SPECIAL. Set the buffer's decoder_info[1] field to a - * number according to one of the special buffer subtypes defined below. - * The second and third decoder_info[] fields are defined according to - * your buffer type's requirements. - * - * Finally, remember to set the buffer's size to 0. This way, if a special - * buffer is sent to a decode that does not know how to handle it, the - * buffer will fall through to the case where the buffer's data content - * is accumulated and no harm will be done. - */ -/*@{*/ - -/** - * In a BUF_SPECIAL_PALETTE buffer: - * decoder_info[1] = BUF_SPECIAL_PALETTE - * decoder_info[2] = number of entries in palette table - * decoder_info_ptr[2] = pointer to palette table - * This buffer type is used to provide a file- and decoder-independent - * facility to transport RGB color palettes from demuxers to decoders. - * A palette table is an array of palette_entry_t structures. A decoder - * should not count on this array to exist for the duration of the - * program's execution and should copy, manipulate, and store the palette - * data privately if it needs the palette information. - */ -#define BUF_SPECIAL_PALETTE 1 - - -/* special buffer type 2 used to be defined but is now available for use */ - - -/** - * In a BUF_SPECIAL_ASPECT buffer: - * decoder_info[1] = BUF_SPECIAL_ASPECT - * decoder_info[2] = MPEG2 aspect ratio code - * decoder_info[3] = stream scale prohibitions - * This buffer is used to force mpeg decoders to use a certain aspect. - * Currently xine-dvdnav uses this, because it has more accurate information - * about the aspect from the dvd ifo-data. - * The stream scale prohibitions are also delivered, with bit 0 meaning - * "deny letterboxing" and bit 1 meaning "deny pan&scan" - */ -#define BUF_SPECIAL_ASPECT 3 - -/** - * In a BUF_SPECIAL_DECODER_CONFIG buffer: - * decoder_info[1] = BUF_SPECIAL_DECODER_CONFIG - * decoder_info[2] = data size - * decoder_info_ptr[2] = pointer to data - * This buffer is used to pass config information from .mp4 files - * (atom esds) to decoders. both mpeg4 and aac streams use that. - */ -#define BUF_SPECIAL_DECODER_CONFIG 4 - -/** - * In a BUF_SPECIAL_STSD_ATOM buffer: - * decoder_info[1] = BUF_SPECIAL_STSD_ATOM - * decoder_info[2] = size of the ImageDescription atom, minus the - * four length bytes at the beginning - * decoder_info_ptr[2] = pointer to ImageDescription atom, starting with - * the codec fourcc - * Some Quicktime decoders need information contained within the - * ImageDescription atom inside a Quicktime file's stsd atom. This - * special buffer carries the ImageDescription atom from the QT demuxer - * to an A/V decoder. - */ -#define BUF_SPECIAL_STSD_ATOM 5 - -/** - * In a BUF_SPECIAL_LPCM_CONFIG buffer: - * decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG - * decoder_info[2] = config data - * lpcm data encoded into mpeg2 streams have a format configuration - * byte in every frame. this is used to detect the sample rate, - * number of bits and channels. - */ -#define BUF_SPECIAL_LPCM_CONFIG 6 - -/** - * In a BUF_SPECIAL_CHARSET_ENCODING buffer: - * decoder_info[1] = BUF_SPECIAL_CHARSET_ENCODING - * decoder_info[2] = size of charset encoding string - * decoder_info_ptr[2] = pointer to charset encoding string - * This is used mostly with subtitle buffers when encoding is - * known at demuxer level (take precedence over xine config - * settings such as subtitles.separate.src_encoding) - */ -#define BUF_SPECIAL_CHARSET_ENCODING 7 - - -/** - * In a BUF_SPECIAL_SPU_DVD_SUBTYPE: - * decoder_info[1] = BUF_SPECIAL_SPU_DVD_SUBTYPE - * decoder_info[2] = subtype - * decoder_info[3] = - * This buffer is pass SPU subtypes from DVDs - */ -#define BUF_SPECIAL_SPU_DVD_SUBTYPE 8 - - -#define SPU_DVD_SUBTYPE_CLUT 1 -#define SPU_DVD_SUBTYPE_PACKAGE 2 -#define SPU_DVD_SUBTYPE_VOBSUB_PACKAGE 3 -#define SPU_DVD_SUBTYPE_NAV 4 - -/** - * In a BUF_SPECIAL_SPU_DVB_DESCRIPTOR - * decoder_info[1] = BUF_SPECIAL_SPU_DVB_DESCRIPTOR - * decoder_info[2] = size of spu_dvb_descriptor_t - * decoder_info_ptr[2] = pointer to spu_dvb_descriptor_t, or NULL - * decoder_info[3] = - * - * This buffer is used to tell a DVBSUB decoder when the stream - * changes. For more information on how to write a DVBSUB decoder, - * see the comment at the top of src/demuxers/demux_ts.c - **/ -#define BUF_SPECIAL_SPU_DVB_DESCRIPTOR 9 - -/** - * In a BUF_SPECIAL_RV_CHUNK_TABLE: - * decoder_info[1] = BUF_SPECIAL_RV_CHUNK_TABLE - * decoder_info[2] = number of entries in chunk table - * decoder_info_ptr[2] = pointer to the chunk table - * - * This buffer transports the chunk table associated to each RealVideo frame. - */ -#define BUF_SPECIAL_RV_CHUNK_TABLE 10 -/*@}*/ - -typedef struct spu_dvb_descriptor_s spu_dvb_descriptor_t; -struct spu_dvb_descriptor_s -{ - char lang[4]; - long comp_page_id; - long aux_page_id; -} ; - -typedef struct palette_entry_s palette_entry_t; -struct palette_entry_s -{ - unsigned char r, g, b; -} ; - -typedef struct fifo_buffer_s fifo_buffer_t; -struct fifo_buffer_s -{ - buf_element_t *first, *last; - - int fifo_size; - uint32_t fifo_data_size; - void *fifo_empty_cb_data; - - pthread_mutex_t mutex; - pthread_cond_t not_empty; - - /* - * functions to access this fifo: - */ - - void (*put) (fifo_buffer_t *fifo, buf_element_t *buf); - - buf_element_t *(*get) (fifo_buffer_t *fifo); - - void (*clear) (fifo_buffer_t *fifo) ; - - int (*size) (fifo_buffer_t *fifo); - - int (*num_free) (fifo_buffer_t *fifo); - - uint32_t (*data_size) (fifo_buffer_t *fifo); - - void (*dispose) (fifo_buffer_t *fifo); - - /* - * alloc buffer for this fifo from global buf pool - * you don't have to use this function to allocate a buffer, - * an input plugin can decide to implement it's own - * buffer allocation functions - */ - - buf_element_t *(*buffer_pool_alloc) (fifo_buffer_t *self); - - - /* - * special functions, not used by demuxers - */ - - /* the same as buffer_pool_alloc but may fail if none is available */ - buf_element_t *(*buffer_pool_try_alloc) (fifo_buffer_t *self); - - /* the same as put but insert at the head of the fifo */ - void (*insert) (fifo_buffer_t *fifo, buf_element_t *buf); - - /* callbacks */ - void (*register_alloc_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, void *), void *cb_data); - void (*register_put_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *), void *cb_data); - void (*register_get_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *), void *cb_data); - void (*unregister_alloc_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, void *)); - void (*unregister_put_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *)); - void (*unregister_get_cb) (fifo_buffer_t *fifo, void (*cb)(fifo_buffer_t *fifo, buf_element_t *buf, void *)); - - /* - * private variables for buffer pool management - */ - buf_element_t *buffer_pool_top; /* a stack actually */ - pthread_mutex_t buffer_pool_mutex; - pthread_cond_t buffer_pool_cond_not_empty; - int buffer_pool_num_free; - int buffer_pool_capacity; - int buffer_pool_buf_size; - void *buffer_pool_base; /*used to free mem chunk */ - void (*alloc_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, void *data_cb); - void (*put_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, buf_element_t *buf, void *data_cb); - void (*get_cb[BUF_MAX_CALLBACKS])(fifo_buffer_t *fifo, buf_element_t *buf, void *data_cb); - void *alloc_cb_data[BUF_MAX_CALLBACKS]; - void *put_cb_data[BUF_MAX_CALLBACKS]; - void *get_cb_data[BUF_MAX_CALLBACKS]; -} ; - -/** - * @brief Allocate and initialise new (empty) FIFO buffers. - * @param num_buffer Number of buffers to allocate. - * @param buf_size Size of each buffer. - * @internal Only used by video and audio decoder loops. - */ -fifo_buffer_t *_x_fifo_buffer_new (int num_buffers, uint32_t buf_size); - -/** - * @brief Allocate and initialise new dummy FIFO buffers. - * @param num_buffer Number of dummy buffers to allocate. - * @param buf_size Size of each buffer. - * @internal Only used by video and audio decoder loops. - */ -fifo_buffer_t *_x_dummy_fifo_buffer_new (int num_buffers, uint32_t buf_size); - - -/** - * @brief Returns the \ref buffer_video "BUF_VIDEO_xxx" for the given fourcc. - * @param fourcc_int 32-bit FOURCC value in machine endianness - * @sa _x_formattag_to_buf_audio - * - * example: fourcc_int = *(uint32_t *)fourcc_char; - */ -uint32_t _x_fourcc_to_buf_video( uint32_t fourcc_int ) XINE_PROTECTED; - -/** - * @brief Returns video codec name given the buffer type. - * @param buf_type One of the \ref buffer_video "BUF_VIDEO_xxx" values. - * @sa _x_buf_audio_name - */ -const char *_x_buf_video_name( uint32_t buf_type ) XINE_PROTECTED; - -/** - * @brief Returns the \ref buffer_audio "BUF_AUDIO_xxx" for the given formattag. - * @param formattagg 32-bit format tag value in machine endianness - * @sa _x_fourcc_to_buf_video - */ -uint32_t _x_formattag_to_buf_audio( uint32_t formattag ) XINE_PROTECTED; - -/** - * @brief Returns audio codec name given the buffer type. - * @param buf_type One of the \ref buffer_audio "BUF_AUDIO_xxx" values. - * @sa _x_buf_video_name - */ -const char *_x_buf_audio_name( uint32_t buf_type ) XINE_PROTECTED; - - -/** - * @brief xine version of BITMAPINFOHEADER. - * @note Should be safe to compile on 64bits machines. - * @note Will always use machine endian format, so demuxers reading - * stuff from win32 formats must use the function below. - */ -typedef struct XINE_PACKED { - int32_t biSize; - int32_t biWidth; - int32_t biHeight; - int16_t biPlanes; - int16_t biBitCount; - uint32_t biCompression; - int32_t biSizeImage; - int32_t biXPelsPerMeter; - int32_t biYPelsPerMeter; - int32_t biClrUsed; - int32_t biClrImportant; -} xine_bmiheader; - -/** - * @brief xine version of WAVEFORMATEX. - * @note The same comments from xine_bmiheader applies. - */ -typedef struct XINE_PACKED { - int16_t wFormatTag; - int16_t nChannels; - int32_t nSamplesPerSec; - int32_t nAvgBytesPerSec; - int16_t nBlockAlign; - int16_t wBitsPerSample; - int16_t cbSize; -} xine_waveformatex; - -/** Convert xine_bmiheader struct from little endian */ -void _x_bmiheader_le2me( xine_bmiheader *bih ) XINE_PROTECTED; - -/** Convert xine_waveformatex struct from little endian */ -void _x_waveformatex_le2me( xine_waveformatex *wavex ) XINE_PROTECTED; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-engine/buffer_types.c b/src/xine-engine/buffer_types.c index eece2df90..c7b6ae860 100644 --- a/src/xine-engine/buffer_types.c +++ b/src/xine-engine/buffer_types.c @@ -32,7 +32,7 @@ #include <string.h> #include <stdlib.h> #include <inttypes.h> -#include "buffer.h" +#include <xine/buffer.h> #include "bswap.h" typedef struct video_db_s { @@ -771,6 +771,14 @@ static const video_db_t video_db[] = { BUF_VIDEO_KMVC, "Karl Morton's Video Codec" }, +{ + { + ME_FOURCC('V','M','n','c'), + 0 + }, + BUF_VIDEO_VMNC, + "VMware Screen Codec" +}, { { 0 }, 0, "last entry" } }; diff --git a/src/xine-engine/configfile.c b/src/xine-engine/configfile.c index 2f5e6214a..37a4e38ad 100644 --- a/src/xine-engine/configfile.c +++ b/src/xine-engine/configfile.c @@ -31,7 +31,9 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include "configfile.h" +#include <xine/configfile.h> +#include "bswap.h" +#include "base64.h" #define LOG_MODULE "configfile" #define LOG_VERBOSE @@ -39,8 +41,8 @@ #define LOG */ -#include "xineutils.h" -#include "xine_internal.h" +#include <xine/xineutils.h> +#include <xine/xine_internal.h> static const xine_config_entry_translation_t *config_entry_translation_user = NULL; static const xine_config_entry_translation_t config_entry_translation[] = { @@ -182,8 +184,6 @@ static const xine_config_entry_translation_t config_entry_translation[] = { { "video.pgx64_overlay_mode", "" }, { "video.pgx64_saturation", "video.output.pgx64_saturation" }, { "video.sdl_hw_accel", "video.device.sdl_hw_accel" }, - { "video.syncfb_default_repeat", "video.device.syncfb_default_repeat" }, - { "video.syncfb_device", "video.device.syncfb_device" }, { "video.unichrome_cpu_save", "video.device.unichrome_cpu_save" }, { "video.vertical_position", "video.output.vertical_position" }, { "video.vidix_blue_intensity", "video.output.vidix_blue_intensity" }, @@ -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", @@ -347,7 +347,7 @@ static void config_remove(config_values_t *this, cfg_entry_t *entry, cfg_entry_t prev->next = entry->next; } -static const char *config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans) +static char *config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans) { --trans; while ((++trans)->old_name) @@ -455,6 +455,8 @@ static void config_reset_value(cfg_entry_t *entry) { entry->num_value = 0; } +static void config_shallow_copy(xine_cfg_entry_t *dest, cfg_entry_t *src); + static cfg_entry_t *config_register_key (config_values_t *this, const char *key, int exp_level, @@ -488,6 +490,14 @@ static cfg_entry_t *config_register_key (config_values_t *this, entry->callback_data = cb_data; } + /* we created a new entry, call the callback */ + if (this->new_entry_cb) { + xine_cfg_entry_t cb_entry; + + config_shallow_copy(&cb_entry, entry); + this->new_entry_cb(this->new_entry_cbdata, &cb_entry); + } + return entry; } @@ -1060,7 +1070,7 @@ void xine_config_save (xine_t *xine, const char *filename) { if (!entry->key[0]) /* deleted key */ - continue; + goto next; lprintf ("saving key '%s'\n", entry->key); @@ -1130,6 +1140,7 @@ void xine_config_save (xine_t *xine, const char *filename) { break; } + next: entry = entry->next; } pthread_mutex_unlock(&this->config_lock); @@ -1194,6 +1205,322 @@ static void config_unregister_cb (config_values_t *this, const char *key) { } } +static void config_set_new_entry_callback (config_values_t *this, xine_config_cb_t new_entry_cb, void* cbdata) { + pthread_mutex_lock(&this->config_lock); + this->new_entry_cb = new_entry_cb; + this->new_entry_cbdata = cbdata; + pthread_mutex_unlock(&this->config_lock); +} + +static void config_unset_new_entry_callback (config_values_t *this) { + pthread_mutex_lock(&this->config_lock); + this->new_entry_cb = NULL; + this->new_entry_cbdata = NULL; + pthread_mutex_unlock(&this->config_lock); +} + +static int put_int(uint8_t *buffer, int pos, int value) { + int32_t value_int32 = (int32_t)value; + + buffer[pos] = value_int32 & 0xFF; + buffer[pos + 1] = (value_int32 >> 8) & 0xFF; + buffer[pos + 2] = (value_int32 >> 16) & 0xFF; + buffer[pos + 3] = (value_int32 >> 24) & 0xFF; + + return 4; +} + +static int put_string(uint8_t *buffer, int pos, const char *value, int value_len) { + pos += put_int(buffer, pos, value_len); + memcpy(&buffer[pos], value, value_len); + + return 4 + value_len; +} + +static char* config_get_serialized_entry (config_values_t *this, const char *key) { + char *output = NULL; + cfg_entry_t *entry, *prev; + + pthread_mutex_lock(&this->config_lock); + config_lookup_entry_int(this, key, &entry, &prev); + + if (entry) { + /* now serialize this stuff + fields to serialize : + int type; + int range_min; + int range_max; + int exp_level; + int num_default; + int num_value; + char *key; + char *str_default; + char *description; + char *help; + char **enum_values; + */ + + int key_len = 0; + int str_default_len = 0; + int description_len = 0; + int help_len = 0; + unsigned long output_len; + unsigned long total_len; + int value_count; + int value_len[10]; + int pos = 0; + int i; + + if (entry->key) + key_len = strlen(entry->key); + if (entry->str_default) + str_default_len = strlen(entry->str_default); + if (entry->description) + description_len = strlen(entry->description); + if (entry->help) + help_len = strlen(entry->help); + + /* integers */ + /* value: 4 bytes */ + total_len = 6 * sizeof(int32_t); + + /* strings (size + char buffer) + * length: 4 bytes + * buffer: length bytes + */ + total_len += sizeof(int32_t) + key_len; + total_len += sizeof(int32_t) + str_default_len; + total_len += sizeof(int32_t) + description_len; + total_len += sizeof(int32_t) + help_len; + + /* enum values... + * value count: 4 bytes + * for each value: + * length: 4 bytes + * buffer: length bytes + */ + value_count = 0; + total_len += sizeof(int32_t); /* value count */ + + char **cur_value = entry->enum_values; + if (cur_value) { + while (*cur_value && (value_count < (sizeof(value_len) / sizeof(int) ))) { + value_len[value_count] = strlen(*cur_value); + total_len += sizeof(int32_t) + value_len[value_count]; + value_count++; + cur_value++; + } + } + + /* Now we have the length needed to serialize the entry and the length of each string */ + uint8_t *buffer = malloc (total_len); + if (!buffer) return NULL; + + /* Let's go */ + + /* the integers */ + pos += put_int(buffer, pos, entry->type); + pos += put_int(buffer, pos, entry->range_min); + pos += put_int(buffer, pos, entry->range_max); + pos += put_int(buffer, pos, entry->exp_level); + pos += put_int(buffer, pos, entry->num_default); + pos += put_int(buffer, pos, entry->num_value); + + /* the strings */ + pos += put_string(buffer, pos, entry->key, key_len); + pos += put_string(buffer, pos, entry->str_default, str_default_len); + pos += put_string(buffer, pos, entry->description, description_len); + pos += put_string(buffer, pos, entry->help, help_len); + + /* the enum stuff */ + pos += put_int(buffer, pos, value_count); + cur_value = entry->enum_values; + + for (i = 0; i < value_count; i++) { + pos += put_string(buffer, pos, *cur_value, value_len[i]); + cur_value++; + } + + /* and now the output encoding */ + output = _x_base64_encode (buffer, total_len, &output_len); + + free(buffer); + } + pthread_mutex_unlock(&this->config_lock); + + return output; + +} + +static int get_int(uint8_t *buffer, int buffer_size, int pos, int *value) { + int32_t value_int32; + + if ((pos + sizeof(int32_t)) > buffer_size) + return 0; + + value_int32 = _X_LE_32(&buffer[pos]); + *value = (int)value_int32; + return sizeof(int32_t); +} + +static int get_string(uint8_t *buffer, int buffer_size, int pos, char **value) { + int len; + int bytes = get_int(buffer, buffer_size, pos, &len); + *value = NULL; + + if (!bytes || (len < 0) || (len > 1024*64)) + return 0; + + char *str = malloc(len + 1); + pos += bytes; + memcpy(str, &buffer[pos], len); + str[len] = 0; + + *value = str; + return bytes + len; +} + +static char* config_register_serialized_entry (config_values_t *this, const char *value) { + /* + fields serialized : + int type; + int range_min; + int range_max; + int exp_level; + int num_default; + int num_value; + char *key; + char *str_default; + char *description; + char *help; + char **enum_values; + */ + int type; + int range_min; + int range_max; + int exp_level; + int num_default; + int num_value; + char *key = NULL; + char *str_default = NULL; + char *description = NULL; + char *help = NULL; + char **enum_values = NULL; + + int bytes; + int pos; + void *output = NULL; + unsigned long output_len; + int value_count = 0; + int i; + + output = _x_base64_decode (value, strlen(value), &output_len); + + pos = 0; + pos += bytes = get_int(output, output_len, pos, &type); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &range_min); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &range_max); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &exp_level); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &num_default); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &num_value); + if (!bytes) goto exit; + + pos += bytes = get_string(output, output_len, pos, &key); + if (!bytes) goto exit; + + pos += bytes = get_string(output, output_len, pos, &str_default); + if (!bytes) goto exit; + + pos += bytes = get_string(output, output_len, pos, &description); + if (!bytes) goto exit; + + pos += bytes = get_string(output, output_len, pos, &help); + if (!bytes) goto exit; + + pos += bytes = get_int(output, output_len, pos, &value_count); + if (!bytes) goto exit; + if ((value_count < 0) || (value_count > 256)) goto exit; + + enum_values = malloc (sizeof(void*) * value_count + 1); + for (i = 0; i < value_count; i++) { + pos += bytes = get_string(output, output_len, pos, &enum_values[i]); + if (!bytes) goto exit; + } + enum_values[value_count] = NULL; + +#ifdef LOG + printf("config entry deserialization:\n"); + printf(" key : %s\n", key); + printf(" type : %d\n", type); + printf(" exp_level : %d\n", exp_level); + printf(" num_default: %d\n", num_default); + printf(" num_value : %d\n", num_value); + printf(" str_default: %s\n", str_default); + printf(" range_min : %d\n", range_min); + printf(" range_max : %d\n", range_max); + printf(" description: %s\n", description); + printf(" help : %s\n", help); + printf(" enum : %d values\n", value_count); + + for (i = 0; i < value_count; i++) { + printf(" enum[%2d]: %s\n", i, enum_values[i]); + } + printf("\n"); +#endif + + switch (type) { + case XINE_CONFIG_TYPE_STRING: + switch (num_value) { + case 0: + this->register_string(this, key, str_default, description, help, exp_level, NULL, NULL); + break; + default: + this->register_filename(this, key, str_default, num_value, description, help, exp_level, NULL, NULL); + break; + } + break; + case XINE_CONFIG_TYPE_RANGE: + this->register_range(this, key, num_default, range_min, range_max, description, help, exp_level, NULL, NULL); + break; + case XINE_CONFIG_TYPE_ENUM: + this->register_enum(this, key, num_default, enum_values, description, help, exp_level, NULL, NULL); + break; + case XINE_CONFIG_TYPE_NUM: + this->register_num(this, key, num_default, description, help, exp_level, NULL, NULL); + break; + case XINE_CONFIG_TYPE_BOOL: + this->register_bool(this, key, num_default, description, help, exp_level, NULL, NULL); + break; + case XINE_CONFIG_TYPE_UNKNOWN: + break; + } + +exit: + /* cleanup */ + free(str_default); + free(description); + free(help); + free(output); + + if (enum_values) { + for (i = 0; i < value_count; i++) { + free(enum_values[i]); + } + free(enum_values); + } + + return key; +} config_values_t *_x_config_init (void) { @@ -1220,18 +1547,22 @@ config_values_t *_x_config_init (void) { pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&this->config_lock, &attr); - this->register_string = config_register_string; - this->register_filename = config_register_filename; - this->register_range = config_register_range; - this->register_enum = config_register_enum; - this->register_num = config_register_num; - this->register_bool = config_register_bool; - this->update_num = config_update_num; - this->update_string = config_update_string; - this->parse_enum = config_parse_enum; - this->lookup_entry = config_lookup_entry; - this->unregister_callback = config_unregister_cb; - this->dispose = config_dispose; + this->register_string = config_register_string; + this->register_filename = config_register_filename; + this->register_range = config_register_range; + this->register_enum = config_register_enum; + this->register_num = config_register_num; + this->register_bool = config_register_bool; + this->register_serialized_entry = config_register_serialized_entry; + this->update_num = config_update_num; + this->update_string = config_update_string; + this->parse_enum = config_parse_enum; + this->lookup_entry = config_lookup_entry; + this->unregister_callback = config_unregister_cb; + this->dispose = config_dispose; + this->set_new_entry_callback = config_set_new_entry_callback; + this->unset_new_entry_callback = config_unset_new_entry_callback; + this->get_serialized_entry = config_get_serialized_entry; return this; } diff --git a/src/xine-engine/configfile.h b/src/xine-engine/configfile.h deleted file mode 100644 index 22a544c00..000000000 --- a/src/xine-engine/configfile.h +++ /dev/null @@ -1,218 +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 - * - * config file management - */ - -#ifndef HAVE_CONFIGFILE_H -#define HAVE_CONFIGFILE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <pthread.h> - -#ifdef XINE_COMPILE -# include "xine.h" -#else -# include <xine.h> -#endif - -#define CONFIG_FILE_VERSION 2 - -/** - * config entries above this experience - * level must never be changed from MRL - */ -#define XINE_CONFIG_SECURITY 30 - - -typedef struct cfg_entry_s cfg_entry_t; -typedef struct config_values_s config_values_t; - -struct cfg_entry_s { - cfg_entry_t *next; - config_values_t *config; - - char *key; - int type; - - /** user experience level */ - int exp_level; - - /** type unknown */ - char *unknown_value; - - /** type string */ - char *str_value; - char *str_default; - - /** common to range, enum, num, bool: */ - int num_value; - int num_default; - - /** type range specific: */ - int range_min; - int range_max; - - /** type enum specific: */ - char **enum_values; - - /** help info for the user */ - char *description; - char *help; - - /** callback function and data for live changeable values */ - xine_config_cb_t callback; - void *callback_data; -}; - -struct config_values_s { - - /* - * register config values - * - * these functions return the current value of the - * registered item, i.e. the default value if it was - * not found in the config file or the current value - * from the config file otherwise - */ - - char* (*register_string) (config_values_t *self, - const char *key, - const char *def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - char* (*register_filename) (config_values_t *self, - const char *key, - const char *def_value, - int req_type, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - int (*register_range) (config_values_t *self, - const char *key, - int def_value, - int min, int max, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - int (*register_enum) (config_values_t *self, - const char *key, - int def_value, - char **values, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - int (*register_num) (config_values_t *self, - const char *key, - int def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - int (*register_bool) (config_values_t *self, - const char *key, - int def_value, - const char *description, - const char *help, - int exp_level, - xine_config_cb_t changed_cb, - void *cb_data); - - /** convenience function to update range, enum, num and bool values */ - void (*update_num) (config_values_t *self, const char *key, int value); - - /** convenience function to update string values */ - void (*update_string) (config_values_t *self, const char *key, const char *value); - - /** small utility function for enum handling */ - int (*parse_enum) (const char *str, const char **values); - - /** - * @brief lookup config entries - * - * remember to call the changed_cb if it exists - * and you changed the value of this item - */ - - cfg_entry_t* (*lookup_entry) (config_values_t *self, const char *key); - - /** - * unregister callback function - */ - void (*unregister_callback) (config_values_t *self, const char *key); - - /** - * dispose of all config entries in memory - */ - void (*dispose) (config_values_t *self); - - /* - * config values are stored here: - */ - cfg_entry_t *first, *last, *cur; - - /** - * mutex for modification to the config - */ - pthread_mutex_t config_lock; - - /** - * current config file's version number - */ - int current_version; -}; - -/** - * @brief allocate and init a new xine config object - * @internal - */ -config_values_t *_x_config_init (void); - -/** - * @brief interpret stream_setup part of mrls for config value changes - * @internal - */ - -int _x_config_change_opt(config_values_t *config, const char *opt); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/xine-engine/demux.c b/src/xine-engine/demux.c index 187c27873..232e0342e 100644 --- a/src/xine-engine/demux.c +++ b/src/xine-engine/demux.c @@ -39,9 +39,9 @@ #define LOG */ -#include "xine_internal.h" -#include "demuxers/demux.h" -#include "buffer.h" +#include <xine/xine_internal.h> +#include <xine/demux.h> +#include <xine/buffer.h> #ifdef WIN32 #include <winsock.h> @@ -423,7 +423,7 @@ int _x_demux_stop_thread (xine_stream_t *stream) { return 0; } -int _x_demux_read_header( input_plugin_t *input, unsigned char *buffer, off_t size){ +int _x_demux_read_header( input_plugin_t *input, void *buffer, off_t size){ int read_size; unsigned char *buf; @@ -464,7 +464,7 @@ int _x_demux_check_extension (const char *mrl, const char *extensions){ while ( ( e = xine_strsep(&ext_work, " ")) != NULL ) { if ( strstr(e, ":/") ) { - if ( strcasecmp (mrl, e) == 0 ) { + if ( strncasecmp (mrl, e, strlen (e)) == 0 ) { found = 1; break; } diff --git a/src/xine-engine/events.c b/src/xine-engine/events.c index f79187682..bf0d88fae 100644 --- a/src/xine-engine/events.c +++ b/src/xine-engine/events.c @@ -26,7 +26,7 @@ #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" +#include <xine/xine_internal.h> xine_event_t *xine_event_get (xine_event_queue_t *queue) { diff --git a/src/xine-engine/info_helper.c b/src/xine-engine/info_helper.c index 1ac4ed982..bc66ba24e 100644 --- a/src/xine-engine/info_helper.c +++ b/src/xine-engine/info_helper.c @@ -35,7 +35,7 @@ #define XINE_ENGINE_INTERNAL -#include "info_helper.h" +#include <xine/info_helper.h> /* ******************* Stream Info *************************** */ diff --git a/src/xine-engine/info_helper.h b/src/xine-engine/info_helper.h deleted file mode 100644 index d4123ba2b..000000000 --- a/src/xine-engine/info_helper.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * stream metainfo helper functions - * hide some xine engine details from demuxers and reduce code duplication - * - * $id$ - */ - -#ifndef INFO_HELPER_H -#define INFO_HELPER_H - -#include <stdarg.h> -#include "xine_internal.h" - -/* - * set a stream info - * - * params: - * *stream the xine stream - * info stream info id (see xine.h, XINE_STREAM_INFO_*) - * value the value to assign - * - */ -void _x_stream_info_set(xine_stream_t *stream, int info, int value) XINE_PROTECTED; - -/* - * reset a stream info (internal ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_STREAM_INFO_*) - * - */ -void _x_stream_info_reset(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * reset a stream info (public ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_STREAM_INFO_*) - * - */ -void _x_stream_info_public_reset(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * retrieve stream info (internal ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_STREAM_INFO_*) - * - */ -uint32_t _x_stream_info_get(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * retrieve stream info (public ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_STREAM_INFO_*) - * - */ -uint32_t _x_stream_info_get_public(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * set a stream meta info - * - * params: - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * *str null-terminated string (using current locale) - * - */ -void _x_meta_info_set(xine_stream_t *stream, int info, const char *str) XINE_PROTECTED; - -/* - * set a stream meta info - * - * params: - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * *str null-terminated string (using utf8) - * - */ -void _x_meta_info_set_utf8(xine_stream_t *stream, int info, const char *str) XINE_PROTECTED; - -/* - * set a stream meta info - * - * params: - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * *str null-terminated string (using encoding below) - * *enc charset encoding of the string - * - */ -void _x_meta_info_set_generic(xine_stream_t *stream, int info, const char *str, const char *enc) XINE_PROTECTED; - -/* - * set a stream meta multiple info - * - * params: - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * ... one or more meta info, followed by a NULL pointer - * - */ -void _x_meta_info_set_multi(xine_stream_t *stream, int info, ...) XINE_SENTINEL XINE_PROTECTED; - -/* - * set a stream meta info - * - * params: - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * *buf char buffer (not a null-terminated string) - * len length of the metainfo - * - */ -void _x_meta_info_n_set(xine_stream_t *stream, int info, const char *buf, int len) XINE_PROTECTED; - -/* - * reset a stream meta info (internal ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * - */ -void _x_meta_info_reset(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * reset a stream meta info (public ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * - */ -void _x_meta_info_public_reset(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * retrieve stream meta info (internal ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * - */ -const char *_x_meta_info_get(xine_stream_t *stream, int info) XINE_PROTECTED; - -/* - * retrieve stream meta info (public ones only) - * - * params : - * *stream the xine stream - * info meta info id (see xine.h, XINE_META_INFO_*) - * - */ -const char *_x_meta_info_get_public(xine_stream_t *stream, int info) XINE_PROTECTED; - -#endif /* INFO_HELPER_H */ diff --git a/src/xine-engine/input_cache.c b/src/xine-engine/input_cache.c index 0535bc8f7..2989d8718 100644 --- a/src/xine-engine/input_cache.c +++ b/src/xine-engine/input_cache.c @@ -33,7 +33,7 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> #include <assert.h> #define DEFAULT_BUFFER_SIZE 1024 diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c index a8268552a..e7ef356b3 100644 --- a/src/xine-engine/input_rip.c +++ b/src/xine-engine/input_rip.c @@ -64,7 +64,7 @@ # define CLR_RST "\e[0;39m" #endif -#include "xine_internal.h" +#include <xine/xine_internal.h> #ifndef HAVE_FSEEKO # define fseeko fseek diff --git a/src/xine-engine/io_helper.c b/src/xine-engine/io_helper.c index c3654c762..d51feb4c6 100644 --- a/src/xine-engine/io_helper.c +++ b/src/xine-engine/io_helper.c @@ -38,7 +38,7 @@ #define XINE_ENGINE_INTERNAL -#include "io_helper.h" +#include <xine/io_helper.h> /* private constants */ #define XIO_FILE_READ 0 @@ -324,7 +324,8 @@ int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) { } -static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off_t todo) { +static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, void *buf_gen, off_t todo) { + uint8_t *buf = buf_gen; off_t ret = -1; off_t total = 0; @@ -411,19 +412,19 @@ static off_t xio_rw_abort(xine_stream_t *stream, int fd, int cmd, char *buf, off return total; } -off_t _x_io_tcp_read (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_tcp_read (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_TCP_READ, buf, todo); } -off_t _x_io_tcp_write (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_tcp_write (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_TCP_WRITE, buf, todo); } -off_t _x_io_file_read (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_file_read (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_FILE_READ, buf, todo); } -off_t _x_io_file_write (xine_stream_t *stream, int s, char *buf, off_t todo) { +off_t _x_io_file_write (xine_stream_t *stream, int s, void *buf, off_t todo) { return xio_rw_abort (stream, s, XIO_FILE_WRITE, buf, todo); } diff --git a/src/xine-engine/io_helper.h b/src/xine-engine/io_helper.h deleted file mode 100644 index 3e96e8dc1..000000000 --- a/src/xine-engine/io_helper.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * abortable i/o helper functions - */ - -#ifndef IO_HELPER_H -#define IO_HELPER_H - -#include "xine_internal.h" - - -/* select states */ -#define XIO_READ_READY 1 -#define XIO_WRITE_READY 2 - -/* xine select return codes */ -#define XIO_READY 0 -#define XIO_ERROR 1 -#define XIO_ABORTED 2 -#define XIO_TIMEOUT 3 - - -/* - * Waits for a file descriptor/socket to change status. - * - * network input plugins should use this function in order to - * not freeze the engine. - * - * params : - * stream needed for aborting and reporting errors but may be NULL - * fd file/socket descriptor - * state XIO_READ_READY, XIO_WRITE_READY - * timeout_sec timeout in seconds - * - * An other thread can abort this function if stream != NULL by setting - * stream->demux_action_pending. - * - * return value : - * XIO_READY the file descriptor is ready for cmd - * XIO_ERROR an i/o error occured - * XIO_ABORTED command aborted by an other thread - * XIO_TIMEOUT the file descriptor is not ready after timeout_msec milliseconds - */ -int _x_io_select (xine_stream_t *stream, int fd, int state, int timeout_msec) XINE_PROTECTED; - - -/* - * open a tcp connection - * - * params : - * stream needed for reporting errors but may be NULL - * host address of target - * port port on target - * - * returns a socket descriptor or -1 if an error occured - */ -int _x_io_tcp_connect(xine_stream_t *stream, const char *host, int port) XINE_PROTECTED; - -/* - * wait for finish connection - * - * params : - * stream needed for aborting and reporting errors but may be NULL - * fd socket descriptor - * timeout_msec timeout in milliseconds - * - * return value: - * XIO_READY host respond, the socket is ready for cmd - * XIO_ERROR an i/o error occured - * XIO_ABORTED command aborted by an other thread - * XIO_TIMEOUT the file descriptor is not ready after timeout - */ -int _x_io_tcp_connect_finish(xine_stream_t *stream, int fd, int timeout_msec) XINE_PROTECTED; - -/* - * read from tcp socket checking demux_action_pending - * - * network input plugins should use this function in order to - * not freeze the engine. - * - * aborts with zero if no data is available and *abort is set - */ -off_t _x_io_tcp_read (xine_stream_t *stream, int s, char *buf, off_t todo) XINE_PROTECTED; - - -/* - * write to a tcp socket checking demux_action_pending - * - * network input plugins should use this function in order to - * not freeze the engine. - * - * aborts with zero if no data is available and *abort is set - */ -off_t _x_io_tcp_write (xine_stream_t *stream, int s, char *buf, off_t todo) XINE_PROTECTED; - -/* - * read from a file descriptor checking demux_action_pending - * - * the fifo input plugin should use this function in order to - * not freeze the engine. - * - * aborts with zero if no data is available and *abort is set - */ -off_t _x_io_file_read (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; - - -/* - * write to a file descriptor checking demux_action_pending - * - * the fifo input plugin should use this function in order to - * not freeze the engine. - * - * aborts with zero if *abort is set - */ -off_t _x_io_file_write (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; - -/* - * read a string from socket, return string length (same as strlen) - * the string is always '\0' terminated but given buffer size is never exceeded - * that is, _x_io_tcp_read_line(,,,X) <= (X-1) ; X > 0 - */ -int _x_io_tcp_read_line(xine_stream_t *stream, int sock, char *str, int size) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 2d2f3f3e4..94afc5b01 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -42,26 +42,31 @@ #include <basedir.h> +#include "load_plugins.h" + #define LOG_MODULE "load_plugins" #define LOG_VERBOSE /* #define LOG +#define DEBUG */ #define XINE_ENABLE_EXPERIMENTAL_FEATURES 1 #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" -#include "xine_plugin.h" -#include "plugin_catalog.h" -#include "demuxers/demux.h" -#include "input/input_plugin.h" -#include "video_out.h" -#include "post.h" -#include "metronom.h" -#include "configfile.h" -#include "xineutils.h" -#include "compat.h" +#include <xine/xine_internal.h> +#include <xine/xine_plugin.h> +#include <xine/plugin_catalog.h> +#include <xine/demux.h> +#include <xine/input_plugin.h> +#include <xine/video_out.h> +#include <xine/post.h> +#include <xine/metronom.h> +#include <xine/configfile.h> +#include <xine/xineutils.h> +#include <xine/compat.h> + +#define LINE_MAX_LENGTH (1024 * 32) /* 32 KiB */ #if 0 @@ -94,7 +99,7 @@ static void remove_segv_handler(void){ #endif #endif /* 0 */ -#define CACHE_CATALOG_VERSION 2 +#define CACHE_CATALOG_VERSION 3 static const int plugin_iface_versions[] = { INPUT_PLUGIN_IFACE_VERSION, @@ -248,26 +253,26 @@ static void _decoder_priority_cb(void *data, xine_cfg_entry_t *cfg) { map_decoders((xine_t *)data); } -static plugin_info_t *_get_cached_info (xine_t *this, +static plugin_node_t *_get_cached_node (xine_t *this, char *filename, off_t filesize, time_t filemtime, - plugin_info_t *previous_info) { + plugin_node_t *previous_node) { xine_sarray_t *list = this->plugin_catalog->cache_list; int list_id, list_size; list_size = xine_sarray_size (list); for (list_id = 0; list_id < list_size; list_id++) { plugin_node_t *node = xine_sarray_get (list, list_id); - if( !previous_info && + if( !previous_node && node->file->filesize == filesize && node->file->filemtime == filemtime && !strcmp( node->file->filename, filename )) { - return node->info; + return node; } /* skip previously returned items */ - if( node->info == previous_info ) - previous_info = NULL; + if( node == previous_node ) + previous_node = NULL; } return NULL; @@ -297,6 +302,7 @@ static plugin_file_t *_insert_file (xine_t *this, static void _insert_node (xine_t *this, xine_sarray_t *list, plugin_file_t *file, + plugin_node_t *node_cache, plugin_info_t *info, int api_version){ @@ -336,6 +342,7 @@ static void _insert_node (xine_t *this, entry->file = file; entry->ref = 0; entry->priority = 0; /* default priority */ + entry->config_entry_list = (node_cache) ? node_cache->config_entry_list : NULL; switch (info->type & PLUGIN_TYPE_MASK){ @@ -478,7 +485,8 @@ static plugin_catalog_t *_new_catalog(void){ return catalog; } -static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin_info_t *info) { +static void _register_plugins_internal(xine_t *this, plugin_file_t *file, + plugin_node_t *node_cache, plugin_info_t *info) { _x_assert(this); _x_assert(info); @@ -504,7 +512,7 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin int plugin_type = info->type & PLUGIN_TYPE_MASK; if ((plugin_type > 0) && (plugin_type <= PLUGIN_TYPE_MAX)) { - _insert_node (this, this->plugin_catalog->plugin_lists[plugin_type - 1], file, info, + _insert_node (this, this->plugin_catalog->plugin_lists[plugin_type - 1], file, node_cache, info, plugin_iface_versions[plugin_type - 1]); if ((plugin_type == PLUGIN_AUDIO_DECODER) || @@ -528,15 +536,17 @@ static void _register_plugins_internal(xine_t *this, plugin_file_t *file, plugin /* get next info */ if( file && !file->lib_handle ) { lprintf("get cached info\n"); - info = _get_cached_info (this, file->filename, file->filesize, file->filemtime, info); + node_cache = _get_cached_node (this, file->filename, file->filesize, file->filemtime, node_cache); + info = (node_cache) ? node_cache->info : NULL; } else { + info++; } } } void xine_register_plugins(xine_t *self, plugin_info_t *info) { - _register_plugins_internal(self, NULL, info); + _register_plugins_internal(self, NULL, NULL, info); } /* @@ -567,6 +577,7 @@ static void collect_plugins(xine_t *this, char *path){ size_t new_str_size, d_len; void *lib = NULL; plugin_info_t *info = NULL; + plugin_node_t *node = NULL; struct stat statbuffer; @@ -609,7 +620,8 @@ static void collect_plugins(xine_t *this, char *path){ lib = NULL; /* get the first plugin_info_t */ - info = _get_cached_info (this, str, statbuffer.st_size, statbuffer.st_mtime, NULL); + node = _get_cached_node (this, str, statbuffer.st_size, statbuffer.st_mtime, NULL); + info = (node) ? node->info : NULL; #ifdef LOG if( info ) printf("load_plugins: using cached %s\n", str); @@ -630,7 +642,7 @@ static void collect_plugins(xine_t *this, char *path){ file = _insert_file(this, this->plugin_catalog->file_list, str, &statbuffer, lib); - _register_plugins_internal(this, file, info); + _register_plugins_internal(this, file, node, info); } else { const char *error = dlerror(); @@ -687,6 +699,25 @@ static inline int _plugin_info_equal(const plugin_info_t *a, return 1; } +static void _attach_entry_to_node (plugin_node_t *node, char *key) { + + if (!node->config_entry_list) { + node->config_entry_list = xine_list_new(); + } + + xine_list_push_back(node->config_entry_list, key); +} + +/* + * This callback is called by the config entry system when a plugin register a + * new config entry. + */ +static void _new_entry_cb (void *user_data, xine_cfg_entry_t *entry) { + plugin_node_t *node = (plugin_node_t *)user_data; + + _attach_entry_to_node(node, strdup(entry->key)); +} + static int _load_plugin_class(xine_t *this, plugin_node_t *node, void *data) { @@ -714,9 +745,17 @@ static int _load_plugin_class(xine_t *this, if ((info = dlsym(node->file->lib_handle, "xine_plugin_info"))) { /* TODO: use sigsegv handler */ - while (info->type != PLUGIN_NONE){ - if (_plugin_info_equal(info, target)){ - if ((node->plugin_class = info->init(this, data))) { + while (info->type != PLUGIN_NONE) { + if (_plugin_info_equal(info, target)) { + config_values_t *config = this->config; + + /* the callback is called for each entry registered by this plugin */ + lprintf("plugin init %s\n", node->info->id); + config->set_new_entry_callback(config, _new_entry_cb, node); + node->plugin_class = info->init(this, data); + config->unset_new_entry_callback(config); + + if (node->plugin_class) { inc_file_ref(node->file); return 1; } else { @@ -795,8 +834,12 @@ static void _load_required_plugins(xine_t *this, xine_sarray_t *list) { while (list_id < list_size) { plugin_node_t *node = xine_sarray_get(list, list_id); - if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class ) { - + /* + * preload plugins if not cached + */ + if( (node->info->type & PLUGIN_MUST_PRELOAD) && !node->plugin_class && + node->file->lib_handle ) { + lprintf("preload plugin %s from %s\n", node->info->id, node->file->filename); if (! _load_plugin_class (this, node, NULL)) { @@ -825,7 +868,7 @@ static void load_required_plugins(xine_t *this) { /* * save plugin list information to file (cached catalog) */ -static void save_plugin_list(FILE *fp, xine_sarray_t *list) { +static void save_plugin_list(xine_t *this, FILE *fp, xine_sarray_t *list) { const plugin_node_t *node; const plugin_file_t *file; @@ -835,7 +878,6 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { const vo_info_t *vo_info; const ao_info_t *ao_info; const post_info_t *post_info; - int i; int list_id = 0; int list_size; @@ -852,9 +894,9 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { fprintf(fp, "api=%d\n", node->info->API ); fprintf(fp, "id=%s\n", node->info->id ); fprintf(fp, "version=%lu\n", (unsigned long) node->info->version ); - + switch (node->info->type & PLUGIN_TYPE_MASK){ - + case PLUGIN_VIDEO_OUT: vo_info = node->info->special_info; fprintf(fp, "visual_type=%d\n", vo_info->visual_type ); @@ -882,7 +924,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { demuxer_info = node->info->special_info; fprintf(fp, "demuxer_priority=%d\n", demuxer_info->priority); break; - + case PLUGIN_INPUT: input_info = node->info->special_info; fprintf(fp, "input_priority=%d\n", input_info->priority); @@ -890,10 +932,27 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { case PLUGIN_POST: post_info = node->info->special_info; - fprintf(fp, "post_type=%lu\n", (unsigned long)post_info->type); - break; - } - + fprintf(fp, "post_type=%lu\n", (unsigned long)post_info->type); + break; + } + + /* config entries */ + if (node->config_entry_list) { + xine_list_iterator_t ite = xine_list_front(node->config_entry_list); + while (ite) { + char *key = xine_list_get_value(node->config_entry_list, ite); + + /* now serialize the config key */ + char *key_value = this->config->get_serialized_entry(this->config, key); + + lprintf(" config key: %s, serialization: %d bytes\n", key, strlen(key_value)); + fprintf(fp, "config_key=%s\n", key_value); + + free (key_value); + ite = xine_list_next(node->config_entry_list, ite); + } + } + fprintf(fp, "\n"); list_id++; } @@ -902,7 +961,7 @@ static void save_plugin_list(FILE *fp, xine_sarray_t *list) { /* * load plugin list information from file (cached catalog) */ -static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { +static void load_plugin_list(xine_t *this, FILE *fp, xine_sarray_t *plugins) { plugin_node_t *node; plugin_file_t *file; @@ -915,20 +974,29 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { int i; uint64_t llu; unsigned long lu; - char line[1024]; + char *line; char *value; + size_t line_len; int version_ok = 0; + line = malloc(LINE_MAX_LENGTH); + if (!line) + return; + node = NULL; file = NULL; - while (fgets (line, 1023, fp)) { + while (fgets (line, LINE_MAX_LENGTH, fp)) { if (line[0] == '#') continue; - - if( (value = strchr(line, '\r')) || (value = strchr(line, '\n')) ) - *value = (char) 0; /* eliminate any cr/lf */ + line_len = strlen(line); + if (line_len < 3) + continue; + + value = &line[line_len - 1]; + if( (*value == '\r') || (*value == '\n') ) + *value-- = (char) 0; /* eliminate any cr/lf */ - if( (value = strchr(line, '\r')) || (value = strchr(line, '\n')) ) + if( (*value == '\r') || (*value == '\n') ) *value = (char) 0; /* eliminate any cr/lf */ if (line[0] == '[' && version_ok) { @@ -1003,11 +1071,11 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { xine_xmalloc(sizeof(decoder_info_t)); break; - case PLUGIN_POST: - node->info->special_info = post_info = - xine_xmalloc(sizeof(post_info_t)); - break; - } + case PLUGIN_POST: + node->info->special_info = post_info = + xine_xmalloc(sizeof(post_info_t)); + break; + } } else if( !strcmp("api",line) ) { sscanf(value," %d",&i); @@ -1022,15 +1090,16 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { vo_info->visual_type = i; } else if( !strcmp("supported_types",line) && decoder_info ) { char *s; + uint32_t *supported_types; for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) { s = strchr(s+1, ' '); } - decoder_info->supported_types = xine_xcalloc((i+1), sizeof(uint32_t)); - for( s = value, i = 0; s && sscanf(s," %lu",&lu) > 0; i++ ) { - decoder_info->supported_types[i] = lu; + supported_types = xine_xcalloc((i+1), sizeof(uint32_t)); + for( s = value, i = 0; s && sscanf(s," %"SCNu32,&supported_types[i]) > 0; i++ ) { s = strchr(s+1, ' '); } + decoder_info->supported_types = supported_types; } else if( !strcmp("vo_priority",line) && vo_info ) { sscanf(value," %d",&i); vo_info->priority = i; @@ -1047,8 +1116,18 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { sscanf(value," %d",&i); input_info->priority = i; } else if( !strcmp("post_type",line) && post_info ) { - sscanf(value," %lu",&lu); - post_info->type = lu; + sscanf(value," %lu",&lu); + post_info->type = lu; + } else if( !strcmp("config_key",line) ) { + char* cfg_key; + + cfg_key = this->config->register_serialized_entry(this->config, value); + if (cfg_key) { + /* this node is a cached node */ + _attach_entry_to_node(node, cfg_key); + } else { + lprintf("failed to deserialize config entry key\n"); + } } } } @@ -1057,6 +1136,8 @@ static void load_plugin_list(FILE *fp, xine_sarray_t *plugins) { if( node ) { xine_sarray_add (plugins, node); } + + free (line); } /** @@ -1129,7 +1210,7 @@ static void save_catalog (xine_t *this) { fprintf(fp, "cache_catalog_version=%d\n\n", CACHE_CATALOG_VERSION); for (i = 0; i < PLUGIN_TYPE_MAX; i++) { - save_plugin_list (fp, this->plugin_catalog->plugin_lists[i]); + save_plugin_list (this, fp, this->plugin_catalog->plugin_lists[i]); } fclose(fp); } @@ -1146,7 +1227,7 @@ static void load_cached_catalog (xine_t *this) { /* It can't return NULL without creating directories */ if( (fp = fopen(cachefile,"r")) != NULL ) { - load_plugin_list (fp, this->plugin_catalog->cache_list); + load_plugin_list (this, fp, this->plugin_catalog->cache_list); fclose(fp); } free(cachefile); @@ -1172,7 +1253,7 @@ void _x_scan_plugins (xine_t *this) { homedir = strdup(xine_get_homedir()); this->plugin_catalog = _new_catalog(); - load_cached_catalog (this); + XINE_PROFILE(load_cached_catalog (this)); if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL) { pluginpath = strdup(pluginpath); @@ -1194,7 +1275,7 @@ void _x_scan_plugins (xine_t *this) { case XINE_PATH_SEPARATOR_CHAR: case '\0': plugindir[j] = '\0'; - collect_plugins(this, plugindir); + XINE_PROFILE(collect_plugins(this, plugindir)); j = 0; break; case '~': @@ -1211,9 +1292,9 @@ void _x_scan_plugins (xine_t *this) { free(pluginpath); free(homedir); - save_catalog (this); - load_required_plugins (this); + + XINE_PROFILE(save_catalog (this)); map_decoders (this); } @@ -1253,12 +1334,11 @@ input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) { void _x_free_input_plugin (xine_stream_t *stream, input_plugin_t *input) { plugin_catalog_t *catalog = stream->xine->plugin_catalog; - plugin_node_t *node = input->node; input->dispose(input); - if (node) { + if (input->node) { pthread_mutex_lock(&catalog->lock); - dec_node_ref(node); + dec_node_ref(input->node); pthread_mutex_unlock(&catalog->lock); } } @@ -1475,12 +1555,11 @@ demux_plugin_t *_x_find_demux_plugin_last_probe(xine_stream_t *stream, const cha void _x_free_demux_plugin (xine_stream_t *stream, demux_plugin_t *demux) { plugin_catalog_t *catalog = stream->xine->plugin_catalog; - plugin_node_t *node = demux->node; demux->dispose(demux); - if (node) { + if (demux->node) { pthread_mutex_lock(&catalog->lock); - dec_node_ref(node); + dec_node_ref(demux->node); pthread_mutex_unlock(&catalog->lock); } } @@ -1658,7 +1737,7 @@ xine_video_port_t *xine_new_framegrab_video_port (xine_t *this) { xine_video_port_t *port; vo_info_t *vo_info; plugin_catalog_t *catalog = this->plugin_catalog; - char *id; + const char *id; int list_id, list_size; driver = NULL; @@ -1970,13 +2049,12 @@ video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_typ void _x_free_video_decoder (xine_stream_t *stream, video_decoder_t *vd) { plugin_catalog_t *catalog = stream->xine->plugin_catalog; - plugin_node_t *node = vd->node; vd->dispose (vd); - if (node) { + if (vd->node) { pthread_mutex_lock (&catalog->lock); - dec_node_ref(node); + dec_node_ref(vd->node); pthread_mutex_unlock (&catalog->lock); } } @@ -2533,7 +2611,7 @@ char *xine_get_mime_types (xine_t *self) { cls = (demux_class_t *)node->plugin_class; - if ( cls->mimetypes ); + if ( cls->mimetypes ) len += strlen(cls->mimetypes); } } @@ -2604,7 +2682,7 @@ char *xine_get_demux_for_mime_type (xine_t *self, const char *mime_type) { } -static void dispose_plugin_list (xine_sarray_t *list) { +static void dispose_plugin_list (xine_sarray_t *list, int is_cache) { plugin_node_t *node; decoder_info_t *decoder_info; @@ -2641,6 +2719,19 @@ static void dispose_plugin_list (xine_sarray_t *list) { /* free info structure and string copies */ free (node->info->id); free (node->info); + + /* don't free the entry list if the node is cache */ + if (!is_cache) { + if (node->config_entry_list) { + xine_list_iterator_t ite = xine_list_front (node->config_entry_list); + while (ite) { + char *key = xine_list_get_value (node->config_entry_list, ite); + free (key); + ite = xine_list_next (node->config_entry_list, ite); + } + xine_list_delete(node->config_entry_list); + } + } free (node); } xine_sarray_delete(list); @@ -2673,10 +2764,10 @@ void _x_dispose_plugins (xine_t *this) { int i; for (i = 0; i < PLUGIN_TYPE_MAX; i++) { - dispose_plugin_list (this->plugin_catalog->plugin_lists[i]); + dispose_plugin_list (this->plugin_catalog->plugin_lists[i], 0); } - dispose_plugin_list (this->plugin_catalog->cache_list); + dispose_plugin_list (this->plugin_catalog->cache_list, 1); dispose_plugin_file_list (this->plugin_catalog->file_list); for (i = 0; this->plugin_catalog->prio_desc[i]; i++) diff --git a/src/xine-engine/broadcaster.h b/src/xine-engine/load_plugins.h index 093fb4af0..7e7d3cc93 100644 --- a/src/xine-engine/broadcaster.h +++ b/src/xine-engine/load_plugins.h @@ -1,8 +1,8 @@ /* - * Copyright (C) 2000-2003 the xine project - * + * Copyright (C) 2007 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 @@ -12,35 +12,39 @@ * 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 - * - * broadcaster.h */ -#ifndef HAVE_BROADCASTER_H -#define HAVE_BROADCASTER_H +/** + * @file + * @brief Internal functions related to the plugin catalog. + * + * @internal This code should not be used by plugins or frontends, it's only + * used by the xine-engine. + */ -#ifdef __cplusplus -extern "C" { -#endif +#ifndef __LOAD_PLUGINS_H__ +#define __LOAD_PLUGINS_H__ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include <xine.h> -typedef struct broadcaster_s broadcaster_t; +/* + * load plugins into catalog + * + * all input+demux plugins will be fully loaded+initialized + * decoder plugins are loaded on demand + * video/audio output plugins have special load/probe functions + */ +void _x_scan_plugins (xine_t *this); -broadcaster_t *_x_init_broadcaster(xine_stream_t *stream, int port) XINE_PROTECTED; -void _x_close_broadcaster(broadcaster_t *this) XINE_PROTECTED; -int _x_get_broadcaster_port(broadcaster_t *this) XINE_PROTECTED; +/* + * dispose all currently loaded plugins (shutdown) + */ -#ifdef __cplusplus -} -#endif +void _x_dispose_plugins (xine_t *this); #endif - diff --git a/src/xine-engine/lrb.c b/src/xine-engine/lrb.c index 6da846a7c..a2fc5d1da 100644 --- a/src/xine-engine/lrb.c +++ b/src/xine-engine/lrb.c @@ -23,7 +23,7 @@ #endif #include "lrb.h" -#include "xineutils.h" +#include <xine/xineutils.h> lrb_t *lrb_new (int max_num_entries, fifo_buffer_t *fifo) { diff --git a/src/xine-engine/lrb.h b/src/xine-engine/lrb.h index 491ae8843..0f524b7eb 100644 --- a/src/xine-engine/lrb.h +++ b/src/xine-engine/lrb.h @@ -24,11 +24,7 @@ #ifndef HAVE_LRB_H #define HAVE_LRB_H -#ifdef XINE_COMPILE -# include "buffer.h" -#else -# include <xine/buffer.h> -#endif +#include <xine/buffer.h> typedef struct { diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c index 328d2cb3c..42aed4e76 100644 --- a/src/xine-engine/metronom.c +++ b/src/xine-engine/metronom.c @@ -40,9 +40,9 @@ #define METRONOM_INTERNAL #define METRONOM_CLOCK_INTERNAL -#include "xine_internal.h" -#include "metronom.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/metronom.h> +#include <xine/xineutils.h> #define MAX_AUDIO_DELTA 1600 #define AUDIO_SAMPLE_NUM 32768 @@ -176,7 +176,6 @@ static scr_plugin_t* unixscr_init () { unixscr_t *this; this = (unixscr_t *) xine_xmalloc(sizeof(unixscr_t)); - memset(this, 0, sizeof(*this)); this->scr.interface_version = 3; this->scr.get_priority = unixscr_get_priority; diff --git a/src/xine-engine/metronom.h b/src/xine-engine/metronom.h deleted file mode 100644 index 77919f16e..000000000 --- a/src/xine-engine/metronom.h +++ /dev/null @@ -1,364 +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 - * - * metronom: general pts => virtual calculation/assoc - * - * virtual pts: unit 1/90000 sec, always increasing - * can be used for synchronization - * video/audio frame with same pts also have same vpts - * but pts is likely to differ from vpts - * - * the basic idea is: - * video_pts + video_wrap_offset = video_vpts - * audio_pts + audio_wrap_offset = audio_vpts - * - * - video_wrap_offset should be equal to audio_wrap_offset as to have - * perfect audio and video sync. They will differ on brief periods due - * discontinuity correction. - * - metronom should also interpolate vpts values most of the time as - * video_pts and audio_vpts are not given for every frame. - * - corrections to the frame rate may be needed to cope with bad - * encoded streams. - */ - -#ifndef HAVE_METRONOM_H -#define HAVE_METRONOM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <pthread.h> - -#ifdef XINE_COMPILE -# include "video_out.h" -# include "xine.h" -#else -# include <xine/video_out.h> -# include <xine.h> -#endif - -typedef struct metronom_s metronom_t ; -typedef struct metronom_clock_s metronom_clock_t; -typedef struct scr_plugin_s scr_plugin_t; - -/* metronom prebuffer can be adjusted with XINE_PARAM_METRONOM_PREBUFFER. - * it sets how much the first video/audio frame should be delayed to - * have some prebuffering at the output layers. reducing this value (about - * 1/8 sec) may result in faster seeking (good to simulate play backwards, - * for example). - */ -#define PREBUFFER_PTS_OFFSET 12000 - - /* see below */ -#define DISC_STREAMSTART 0 -#define DISC_RELATIVE 1 -#define DISC_ABSOLUTE 2 -#define DISC_STREAMSEEK 3 - -struct metronom_s { - - /* - * called by audio output driver to inform metronom about current audio - * samplerate - * - * parameter pts_per_smpls : 1/90000 sec per 65536 samples - */ - void (*set_audio_rate) (metronom_t *self, int64_t pts_per_smpls); - - /* - * called by video output driver for *every* frame - * - * parameter frame containing pts, scr, ... information - * - * will set vpts field in frame - * - * this function will also update video_wrap_offset if a discontinuity - * is detected (read the comentaries below about discontinuities). - * - */ - - void (*got_video_frame) (metronom_t *self, vo_frame_t *frame); - - /* - * called by audio output driver whenever audio samples are delivered to it - * - * parameter pts : pts for audio data if known, 0 otherwise - * nsamples : number of samples delivered - * - * return value: virtual pts for audio data - * - * this function will also update audio_wrap_offset if a discontinuity - * is detected (read the comentaries below about discontinuities). - * - */ - - int64_t (*got_audio_samples) (metronom_t *self, int64_t pts, - int nsamples); - - /* - * called by SPU decoder whenever a packet is delivered to it - * - * parameter pts : pts for SPU packet if known, 0 otherwise - * - * return value: virtual pts for SPU packet - * (this is the only pts to vpts function that cannot update the wrap_offset - * due to the lack of regularity on spu packets) - */ - - int64_t (*got_spu_packet) (metronom_t *self, int64_t pts); - - /* - * tell metronom about discontinuities. - * - * these functions are called due to a discontinuity detected at - * demux stage. - * - * there are different types of discontinuities: - * - * DISC_STREAMSTART : new stream starts, expect pts values to start - * from zero immediately - * DISC_RELATIVE : typically a wrap-around, expect pts with - * a specified offset from the former ones soon - * DISC_ABSOLUTE : typically a new menu stream (nav packets) - * pts will start from given value soon - * DISC_STREAMSEEK : used by video and audio decoder loop, - * when a buffer with BUF_FLAG_SEEK set is encountered; - * applies the necessary vpts offset for the seek in - * metronom, but keeps the vpts difference between - * audio and video, so that metronom doesn't cough - */ - void (*handle_audio_discontinuity) (metronom_t *self, int type, int64_t disc_off); - void (*handle_video_discontinuity) (metronom_t *self, int type, int64_t disc_off); - - /* - * set/get options for metronom, constants see below - */ - void (*set_option) (metronom_t *self, int option, int64_t value); - int64_t (*get_option) (metronom_t *self, int option); - - /* - * set a master metronom - * this is currently useful to sync independently generated streams - * (e.g. by post plugins) to the discontinuity domain of another - * metronom - */ - void (*set_master) (metronom_t *self, metronom_t *master); - - void (*exit) (metronom_t *self); - -#ifdef METRONOM_INTERNAL - /* - * metronom internal stuff - */ - xine_t *xine; - - metronom_t *master; - - int64_t pts_per_smpls; - - int64_t video_vpts; - int64_t spu_vpts; - int64_t audio_vpts; - int64_t audio_vpts_rmndr; /* the remainder for integer division */ - - int64_t vpts_offset; - - int64_t video_drift; - int64_t video_drift_step; - - int audio_samples; - int64_t audio_drift_step; - - int64_t prebuffer; - int64_t av_offset; - int64_t spu_offset; - - pthread_mutex_t lock; - - int have_video; - int have_audio; - int video_discontinuity_count; - int audio_discontinuity_count; - int discontinuity_handled_count; - pthread_cond_t video_discontinuity_reached; - pthread_cond_t audio_discontinuity_reached; - - int force_video_jump; - int force_audio_jump; - - int64_t img_duration; - int img_cpt; - int64_t last_video_pts; - int64_t last_audio_pts; - - int video_mode; -#endif -}; - -/* - * metronom options - */ - -#define METRONOM_AV_OFFSET 2 -#define METRONOM_ADJ_VPTS_OFFSET 3 -#define METRONOM_FRAME_DURATION 4 -#define METRONOM_SPU_OFFSET 5 -#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; - -/* FIXME: reorder this structure on the next cleanup to remove the dummies */ -struct metronom_clock_s { - - /* - * set/get options for clock, constants see below - */ - void (*set_option) (metronom_clock_t *self, int option, int64_t value); - int64_t (*get_option) (metronom_clock_t *self, int option); - - /* - * system clock reference (SCR) functions - */ - -#ifdef METRONOM_CLOCK_INTERNAL - /* - * start clock (no clock reset) - * at given pts - */ - void (*start_clock) (metronom_clock_t *self, int64_t pts); - - - /* - * stop metronom clock - */ - void (*stop_clock) (metronom_clock_t *self); - - - /* - * resume clock from where it was stopped - */ - void (*resume_clock) (metronom_clock_t *self); -#else - void *dummy1; - void *dummy2; - void *dummy3; -#endif - - - /* - * get current clock value in vpts - */ - int64_t (*get_current_time) (metronom_clock_t *self); - - - /* - * adjust master clock to external timer (e.g. audio hardware) - */ - void (*adjust_clock) (metronom_clock_t *self, int64_t desired_pts); - -#ifdef METRONOM_CLOCK_INTERNAL - /* - * set clock speed - * for constants see xine_internal.h - */ - - int (*set_fine_speed) (metronom_clock_t *self, int speed); -#else - void *dummy4; -#endif - - /* - * (un)register a System Clock Reference provider at the metronom - */ - int (*register_scr) (metronom_clock_t *self, scr_plugin_t *scr); - void (*unregister_scr) (metronom_clock_t *self, scr_plugin_t *scr); - -#ifdef METRONOM_CLOCK_INTERNAL - void (*exit) (metronom_clock_t *self); - - xine_t *xine; - - scr_plugin_t *scr_master; - scr_plugin_t **scr_list; - pthread_t sync_thread; - int thread_running; - int scr_adjustable; -#else - void *dummy5; - void *dummy6; - void *dummy7; - void *dummy8; - pthread_t dummy9; - int dummy10; - int dummy11; -#endif - - int speed; - -#ifdef METRONOM_CLOCK_INTERNAL - pthread_mutex_t lock; - pthread_cond_t cancel; -#endif -}; - -metronom_clock_t *_x_metronom_clock_init(xine_t *xine) XINE_PROTECTED; - -/* - * clock options - */ - -#define CLOCK_SCR_ADJUSTABLE 1 - -/* - * SCR (system clock reference) plugins - */ - -struct scr_plugin_s -{ - int (*get_priority) (scr_plugin_t *self); - - /* - * set/get clock speed - * - * for speed constants see xine_internal.h - * returns actual speed - */ - - int (*set_fine_speed) (scr_plugin_t *self, int speed); - - void (*adjust) (scr_plugin_t *self, int64_t vpts); - - void (*start) (scr_plugin_t *self, int64_t start_vpts); - - int64_t (*get_current) (scr_plugin_t *self); - - void (*exit) (scr_plugin_t *self); - - metronom_clock_t *clock; - - int interface_version; -}; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-engine/osd.c b/src/xine-engine/osd.c index 1587b76e4..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 @@ -50,11 +48,11 @@ #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" +#include <xine/xine_internal.h> #include "xine-engine/bswap.h" -#include "xineutils.h" -#include "video_out.h" -#include "osd.h" +#include <xine/xineutils.h> +#include <xine/video_out.h> +#include <xine/osd.h> #ifdef HAVE_FT2 #include <ft2build.h> @@ -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; diff --git a/src/xine-engine/osd.h b/src/xine-engine/osd.h deleted file mode 100644 index 7b04c0a17..000000000 --- a/src/xine-engine/osd.h +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * OSD stuff (text and graphic primitives) - */ - -#ifndef HAVE_OSD_H -#define HAVE_OSD_H - -#ifdef HAVE_ICONV -# include <iconv.h> -#endif - -#ifdef XINE_COMPILE -# include "video_overlay.h" -# ifdef __OSD_C__ -# include "alphablend.h" -# endif -#else -# include <xine/video_overlay.h> -#endif - -typedef struct osd_object_s osd_object_t; -typedef struct osd_renderer_s osd_renderer_t; -typedef struct osd_font_s osd_font_t; -typedef struct osd_ft2context_s osd_ft2context_t; - -struct osd_object_s { - osd_object_t *next; - osd_renderer_t *renderer; - - int width, height; /* work area dimentions */ - uint8_t *area; /* work area */ - int display_x,display_y; /* where to display it in screen */ - - /* clipping box inside work area */ - int x1, y1; - int x2, y2; - - uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ - uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ - -#ifdef HAVE_ICONV - iconv_t cd; /* iconv handle of encoding */ - char *encoding; /* name of encoding */ -#endif - - osd_font_t *font; - osd_ft2context_t *ft2; - - int32_t handle; -}; - -/* this one is public */ -struct xine_osd_s { - osd_object_t osd; -}; - -struct osd_renderer_s { - - xine_stream_t *stream; - - /* - * open a new osd object. this will allocated an empty (all zero) drawing - * area where graphic primitives may be used. - * It is ok to specify big width and height values. The render will keep - * track of the smallest changed area to not generate too big overlays. - * A default palette is initialized (i sugest keeping color 0 as transparent - * for the sake of simplicity) - */ - osd_object_t* (*new_object) (osd_renderer_t *this, int width, int height); - - /* - * free osd object - */ - void (*free_object) (osd_object_t *osd_to_close); - - - /* - * send the osd to be displayed at given pts (0=now) - * the object is not changed. there may be subsequent drawing on it. - */ - int (*show) (osd_object_t *osd, int64_t vpts ); - - /* - * send event to hide osd at given pts (0=now) - * the object is not changed. there may be subsequent drawing on it. - */ - int (*hide) (osd_object_t *osd, int64_t vpts ); - - /* - * draw point. - */ - void (*point) (osd_object_t *osd, int x, int y, int color); - - /* - * Bresenham line implementation on osd object - */ - void (*line) (osd_object_t *osd, - int x1, int y1, int x2, int y2, int color ); - - /* - * filled rectangle - */ - void (*filled_rect) (osd_object_t *osd, - int x1, int y1, int x2, int y2, int color ); - - /* - * set palette (color and transparency) - */ - void (*set_palette) (osd_object_t *osd, const uint32_t *color, const uint8_t *trans ); - - /* - * set on existing text palette - * (-1 to set used specified palette) - * - * color_base specifies the first color index to use for this text - * palette. The OSD palette is then modified starting at this - * color index, up to the size of the text palette. - * - * Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices. - */ - void (*set_text_palette) (osd_object_t *osd, int palette_number, - int color_base ); - - /* - * get palette (color and transparency) - */ - void (*get_palette) (osd_object_t *osd, uint32_t *color, - uint8_t *trans); - - /* - * set position were overlay will be blended - */ - void (*set_position) (osd_object_t *osd, int x, int y); - - /* - * set the font of osd object - */ - - int (*set_font) (osd_object_t *osd, const char *fontname, int size); - - /* - * set encoding of text - * - * NULL ... no conversion (iso-8859-1) - * "" ... locale encoding - */ - int (*set_encoding) (osd_object_t *osd, const char *encoding); - - /* - * render text in current encoding on x,y position - * no \n yet - * - * The text is assigned the colors starting at the index specified by - * color_base up to the size of the text palette. - * - * Use OSD_TEXT1, OSD_TEXT2, ... for some preasssigned color indices. - */ - int (*render_text) (osd_object_t *osd, int x1, int y1, - const char *text, int color_base); - - /* - * get width and height of how text will be renderized - */ - int (*get_text_size) (osd_object_t *osd, const char *text, - int *width, int *height); - - /* - * close osd rendering engine - * loaded fonts are unloaded - * osd objects are closed - */ - void (*close) (osd_renderer_t *this); - - /* - * clear an osd object (empty drawing area) - */ - void (*clear) (osd_object_t *osd ); - - /* - * paste a bitmap with optional palette mapping - */ - void (*draw_bitmap) (osd_object_t *osd, uint8_t *bitmap, - int x1, int y1, int width, int height, - uint8_t *palette_map); - - /* - * send the osd to be displayed (unscaled) at given pts (0=now) - * the object is not changed. there may be subsequent drawing on it. - * overlay is blended at output (screen) resolution. - */ - int (*show_unscaled) (osd_object_t *osd, int64_t vpts ); - - /* - * see xine.h for defined XINE_OSD_CAP_ values. - */ - uint32_t (*get_capabilities) (osd_object_t *osd); - - /* private stuff */ - - pthread_mutex_t osd_mutex; - video_overlay_event_t event; - osd_object_t *osds; /* instances of osd */ - osd_font_t *fonts; /* loaded fonts */ - int textpalette; /* default textpalette */ - -}; - -/* - * initialize the osd rendering engine - */ -osd_renderer_t *_x_osd_renderer_init( xine_stream_t *stream ); - - -/* - * The size of a text palette - */ - -#define TEXT_PALETTE_SIZE 11 - -/* - * Preassigned color indices for rendering text - * (more can be added, not exceeding OVL_PALETTE_SIZE) - */ - -#define OSD_TEXT1 (0 * TEXT_PALETTE_SIZE) -#define OSD_TEXT2 (1 * TEXT_PALETTE_SIZE) -#define OSD_TEXT3 (2 * TEXT_PALETTE_SIZE) -#define OSD_TEXT4 (3 * TEXT_PALETTE_SIZE) -#define OSD_TEXT5 (4 * TEXT_PALETTE_SIZE) -#define OSD_TEXT6 (5 * TEXT_PALETTE_SIZE) -#define OSD_TEXT7 (6 * TEXT_PALETTE_SIZE) -#define OSD_TEXT8 (7 * TEXT_PALETTE_SIZE) -#define OSD_TEXT9 (8 * TEXT_PALETTE_SIZE) -#define OSD_TEXT10 (9 * TEXT_PALETTE_SIZE) - -/* - * Defined palettes for rendering osd text - * (more can be added later) - */ - -#define NUMBER_OF_TEXT_PALETTES 4 -#define TEXTPALETTE_WHITE_BLACK_TRANSPARENT 0 -#define TEXTPALETTE_WHITE_NONE_TRANSPARENT 1 -#define TEXTPALETTE_WHITE_NONE_TRANSLUCID 2 -#define TEXTPALETTE_YELLOW_BLACK_TRANSPARENT 3 - -#ifdef __OSD_C__ - -/* This text descriptions are used for config screen */ -static const char *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 }, -}; - -#endif /* __OSD_C__ */ - -#endif - diff --git a/src/xine-engine/plugin_catalog.h b/src/xine-engine/plugin_catalog.h deleted file mode 100644 index fd9afb959..000000000 --- a/src/xine-engine/plugin_catalog.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * xine-internal header: Definitions for plugin lists - */ - -#ifndef _PLUGIN_CATALOG_H -#define _PLUGIN_CATALOG_H - -#ifdef XINE_COMPILE -# include "xine_plugin.h" -# include "xineutils.h" -#else -# include <xine/xine_plugin.h> -# include <xine/xineutils.h> -#endif - -#define DECODER_MAX 128 -#define PLUGIN_MAX 256 - -/* the engine takes this many plugins for one stream type */ -#define PLUGINS_PER_TYPE 10 - -typedef struct { - char *filename; - off_t filesize; - time_t filemtime; - void *lib_handle; - int ref; /* count number of classes */ - int no_unload; /* set if the file can't be unloaded */ -} plugin_file_t ; - -typedef struct { - plugin_file_t *file; - plugin_info_t *info; - void *plugin_class; - int ref; /* count intances of plugins */ - int priority; -} plugin_node_t ; - -struct plugin_catalog_s { - xine_sarray_t *plugin_lists[PLUGIN_TYPE_MAX]; - - xine_sarray_t *cache_list; - xine_list_t *file_list; - - plugin_node_t *audio_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; - plugin_node_t *video_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; - plugin_node_t *spu_decoder_map[DECODER_MAX][PLUGINS_PER_TYPE]; - - const char *ids[PLUGIN_MAX]; - - /* memory block for the decoder priority config entry descriptions */ - char *prio_desc[DECODER_MAX]; - - pthread_mutex_t lock; - - int plugin_count; - int decoder_count; -}; -typedef struct plugin_catalog_s plugin_catalog_t; - -/* - * load plugins into catalog - * - * all input+demux plugins will be fully loaded+initialized - * decoder plugins are loaded on demand - * video/audio output plugins have special load/probe functions - */ -void _x_scan_plugins (xine_t *this) XINE_PROTECTED; - - -/* - * dispose all currently loaded plugins (shutdown) - */ - -void _x_dispose_plugins (xine_t *this) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/post.c b/src/xine-engine/post.c index e54d2234f..651bb10f3 100644 --- a/src/xine-engine/post.c +++ b/src/xine-engine/post.c @@ -25,7 +25,7 @@ #define POST_INTERNAL #define XINE_ENGINE_INTERNAL -#include "post.h" +#include <xine/post.h> #include <stdarg.h> @@ -891,7 +891,7 @@ int _x_post_dispose(post_plugin_t *this) { /* since the plugin loader does not know, when the plugin gets disposed, * we have to handle the reference counter here */ pthread_mutex_lock(&this->xine->plugin_catalog->lock); - ((plugin_node_t *)this->node)->ref--; + this->node->ref--; pthread_mutex_unlock(&this->xine->plugin_catalog->lock); return 1; diff --git a/src/xine-engine/post.h b/src/xine-engine/post.h deleted file mode 100644 index 1995ca82f..000000000 --- a/src/xine-engine/post.h +++ /dev/null @@ -1,405 +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 - * - * post plugin definitions - */ - -#ifndef XINE_POST_H -#define XINE_POST_H - -#ifdef XINE_COMPILE -# include "xine.h" -# include "video_out.h" -# include "audio_out.h" -# include "xine_internal.h" -# include "xineutils.h" -#else -# include <xine.h> -# include <xine/video_out.h> -# include <xine/audio_out.h> -# include <xine/xine_internal.h> -# include <xine/xineutils.h> -#endif - -#define POST_PLUGIN_IFACE_VERSION 9 - - -typedef struct post_class_s post_class_t; -typedef struct post_plugin_s post_plugin_t; -typedef struct post_in_s post_in_t; -typedef struct post_out_s post_out_t; - -struct post_class_s { - - /* - * open a new instance of this plugin class - */ - post_plugin_t* (*open_plugin) (post_class_t *this, int inputs, - xine_audio_port_t **audio_target, - xine_video_port_t **video_target); - - /** - * @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; - - /* - * free all class-related resources - */ - - void (*dispose) (post_class_t *this); -}; - -#define default_post_class_dispose (void (*) (post_class_t *this))free - -struct post_plugin_s { - - /* public part of the plugin */ - xine_post_t xine_post; - - /* - * the connections announced by the plugin - * the plugin must fill these with xine_post_{in,out}_t on init - */ - xine_list_t *input; - xine_list_t *output; - - /* - * close down, free all resources - */ - void (*dispose) (post_plugin_t *this); - - /* plugins don't have to init the stuff below */ - - /* - * the running ticket - * - * the plugin must assure to check for ticket revocation in - * intervals of finite length; this means that you must release - * the ticket before any operation that might block; - * note that all port functions are safe in this respect - * - * the running ticket is assigned to you by the engine - */ - xine_ticket_t *running_ticket; - - /* this is needed by the engine to decrement the reference counter - * on disposal of the plugin, but since this is useful, we expose it */ - xine_t *xine; - - /* used when the user requests a list of all inputs/outputs */ - const char **input_ids; - const char **output_ids; - - /* used by plugin loader */ - void *node; - - /* has dispose been called */ - int dispose_pending; -}; - -/* helper function to initialize a post_plugin_t */ -void _x_post_init(post_plugin_t *post, int num_audio_inputs, int num_video_inputs) XINE_PROTECTED; - -struct post_in_s { - - /* public part of the input */ - xine_post_in_t xine_in; - - /* backward reference so that you have access to the post plugin */ - post_plugin_t *post; - - /* you can fill this to your liking */ - void *user_data; -}; - -struct post_out_s { - - /* public part of the output */ - xine_post_out_t xine_out; - - /* backward reference so that you have access to the post plugin */ - post_plugin_t *post; - - /* you can fill this to your liking */ - void *user_data; -}; - - -/* Post plugins work by intercepting calls to video or audio ports - * in the sense of the decorator design pattern. They reuse the - * functions of a given target port, but add own functionality in - * front of that port by creating a new port structure and filling in - * the function pointers with pointers to own functions that - * would do something and then call the original port function. - * - * Much the same is done with video frames which have their own - * set of functions attached that you might need to decorate. - */ - - -/* helper structure for intercepting video port calls */ -typedef struct post_video_port_s post_video_port_t; -struct post_video_port_s { - - /* the new public port with replaced function pointers */ - xine_video_port_t new_port; - - /* the original port to call its functions from inside yours */ - xine_video_port_t *original_port; - - /* if you want to decide yourself, whether a given frame should - * be intercepted, fill in this function; get_frame() acts as - * a template method and asks your function; return a boolean; - * the default is to intercept all frames */ - int (*intercept_frame)(post_video_port_t *self, vo_frame_t *frame); - - /* the new frame function pointers */ - vo_frame_t *new_frame; - - /* if you want to decide yourself, whether the preprocessing functions - * should still be routed when draw is intercepted, fill in this - * function; _x_post_intercept_video_frame() acts as a template method - * and asks your function; return a boolean; the default is _not_ to - * route preprocessing functions when draw is intercepted */ - int (*route_preprocessing_procs)(post_video_port_t *self, vo_frame_t *frame); - - /* if you want to decide yourself, whether the overlay manager should - * be intercepted, fill in this function; get_overlay_manager() acts as - * a template method and asks your function; return a boolean; - * the default is _not_ to intercept the overlay manager */ - int (*intercept_ovl)(post_video_port_t *self); - - /* the new public overlay manager with replaced function pointers */ - video_overlay_manager_t *new_manager; - - /* the original manager to call its functions from inside yours */ - video_overlay_manager_t *original_manager; - - /* usage counter: how many objects are floating around that need - * these pointers to exist */ - int usage_count; - pthread_mutex_t usage_lock; - - /* the stream we are being fed by; NULL means no stream is connected; - * this may be an anonymous stream */ - xine_stream_t *stream; - - /* point to a mutex here, if you need some synchronization */ - pthread_mutex_t *port_lock; - pthread_mutex_t *frame_lock; - pthread_mutex_t *manager_lock; - - /* backward reference so that you have access to the post plugin - * when the call only gives you the port */ - post_plugin_t *post; - - /* you can fill this to your liking */ - void *user_data; - -#ifdef POST_INTERNAL - /* some of the above members are to be directly included here, but - * adding the structures would mean that post_video_port_t becomes - * depended of the sizes of these structs; solution: we add pointers - * above and have them point into the memory provided here; - * note that the overlay manager needs to be first so that we can - * reconstruct the post_video_port_t* from overlay manager calls */ - - /* any change here requires a change in _x_post_ovl_manager_to_port() - * below! */ - - video_overlay_manager_t manager_storage; - vo_frame_t frame_storage; - - /* this is used to keep a linked list of free vo_frame_t's */ - vo_frame_t *free_frame_slots; - pthread_mutex_t free_frames_lock; -#endif -}; - -/* use this to create a new decorated video port in which - * port functions will be replaced with own implementations; - * for convenience, this can also create a related post_in_t and post_out_t */ -post_video_port_t *_x_post_intercept_video_port(post_plugin_t *post, xine_video_port_t *port, - post_in_t **input, post_out_t **output) XINE_PROTECTED; - -/* use this to decorate and to undecorate a frame so that its functions - * can be replaced with own implementations, decoration is usually done in - * get_frame(), undecoration in frame->free() */ -vo_frame_t *_x_post_intercept_video_frame(vo_frame_t *frame, post_video_port_t *port) XINE_PROTECTED; -vo_frame_t *_x_post_restore_video_frame(vo_frame_t *frame, post_video_port_t *port) XINE_PROTECTED; - -/* when you want to pass a frame call on to the original issuer of the frame, - * you need to propagate potential changes up and down the pipe, so the usual - * procedure for this situation would be: - * - * _x_post_frame_copy_down(frame, frame->next); - * frame->next->function(frame->next); - * _x_post_frame_copy_up(frame, frame->next); - */ -void _x_post_frame_copy_down(vo_frame_t *from, vo_frame_t *to) XINE_PROTECTED; -void _x_post_frame_copy_up(vo_frame_t *to, vo_frame_t *from) XINE_PROTECTED; - -/* when you shortcut a frames usual draw() travel so that it will never reach - * the draw() function of the original issuer, you still have to do some - * housekeeping on the frame, before returning control up the pipe */ -void _x_post_frame_u_turn(vo_frame_t *frame, xine_stream_t *stream) XINE_PROTECTED; - -/* use this to create a new, trivially decorated overlay manager in which - * port functions can be replaced with own implementations */ -void _x_post_intercept_overlay_manager(video_overlay_manager_t *manager, post_video_port_t *port) XINE_PROTECTED; - -/* pointer retrieval functions */ -static inline post_video_port_t *_x_post_video_frame_to_port(vo_frame_t *frame) { - return (post_video_port_t *)frame->port; -} - -static inline post_video_port_t *_x_post_ovl_manager_to_port(video_overlay_manager_t *manager) { -#ifdef POST_INTERNAL - return (post_video_port_t *)( (uint8_t *)manager - - (unsigned)&(((post_video_port_t *)NULL)->manager_storage) ); -#else - return (post_video_port_t *)( (uint8_t *)manager - sizeof(post_video_port_t) ); -#endif -} - - -/* helper structure for intercepting audio port calls */ -typedef struct post_audio_port_s post_audio_port_t; -struct post_audio_port_s { - - /* the new public port with replaced function pointers */ - xine_audio_port_t new_port; - - /* the original port to call its functions from inside yours */ - xine_audio_port_t *original_port; - - /* the stream we are being fed by; NULL means no stream is connected; - * this may be an anonymous stream */ - xine_stream_t *stream; - - pthread_mutex_t usage_lock; - /* usage counter: how many objects are floating around that need - * these pointers to exist */ - int usage_count; - - /* some values remembered by (port->open) () */ - uint32_t bits; - uint32_t rate; - uint32_t mode; - - /* point to a mutex here, if you need some synchronization */ - pthread_mutex_t *port_lock; - - /* backward reference so that you have access to the post plugin - * when the call only gives you the port */ - post_plugin_t *post; - - /* you can fill this to your liking */ - void *user_data; -}; - -/* use this to create a new decorated audio port in which - * port functions will be replaced with own implementations */ -post_audio_port_t *_x_post_intercept_audio_port(post_plugin_t *post, xine_audio_port_t *port, - post_in_t **input, post_out_t **output) XINE_PROTECTED; - - -/* this will allow pending rewire operations, calling this at the beginning - * of decoder-called functions like get_buffer() and open() is a good idea - * (if you do not intercept get_buffer() or open(), this will be done automatically) */ -static inline void _x_post_rewire(post_plugin_t *post) { - if (post->running_ticket->ticket_revoked) - post->running_ticket->renew(post->running_ticket, 1); -} - -/* with these functions you can switch interruptions like rewiring or engine pausing - * off for a block of code; use this only when really necessary */ -static inline void _x_post_lock(post_plugin_t *post) { - post->running_ticket->acquire(post->running_ticket, 1); -} -static inline void _x_post_unlock(post_plugin_t *post) { - post->running_ticket->release(post->running_ticket, 1); - _x_post_rewire(post); -} - -/* the standard disposal operation; returns 1 if the plugin is really - * disposed and you should free everything you malloc()ed yourself */ -int _x_post_dispose(post_plugin_t *post) XINE_PROTECTED; - - -/* macros to handle usage counter */ - -/* WARNING! - * note that _x_post_dec_usage() can call dispose, so be sure to - * not use any potentially already freed memory after this */ - -#define _x_post_inc_usage(port) \ -do { \ - pthread_mutex_lock(&(port)->usage_lock); \ - (port)->usage_count++; \ - pthread_mutex_unlock(&(port)->usage_lock); \ -} while(0) - -#define _x_post_dec_usage(port) \ -do { \ - pthread_mutex_lock(&(port)->usage_lock); \ - (port)->usage_count--; \ - if ((port)->usage_count == 0) { \ - if ((port)->post->dispose_pending) { \ - pthread_mutex_unlock(&(port)->usage_lock); \ - (port)->post->dispose((port)->post); \ - } else \ - pthread_mutex_unlock(&(port)->usage_lock); \ - } else \ - pthread_mutex_unlock(&(port)->usage_lock); \ -} while(0) - - -/* macros to create parameter descriptors */ - -#define START_PARAM_DESCR( param_t ) \ -static param_t temp_s; \ -static xine_post_api_parameter_t temp_p[] = { - -#define PARAM_ITEM( param_type, var, enumv, min, max, readonly, descr ) \ -{ param_type, #var, sizeof(temp_s.var), \ - (char*)&temp_s.var-(char*)&temp_s, enumv, min, max, readonly, descr }, - -#define END_PARAM_DESCR( name ) \ - { POST_PARAM_TYPE_LAST, NULL, 0, 0, NULL, 0, 0, 1, NULL } \ -}; \ -static xine_post_api_descr_t name = { \ - sizeof( temp_s ), \ - temp_p \ -}; - -#endif diff --git a/src/xine-engine/refcounter.c b/src/xine-engine/refcounter.c index 539abf3ed..4bb6a0351 100644 --- a/src/xine-engine/refcounter.c +++ b/src/xine-engine/refcounter.c @@ -23,8 +23,8 @@ #define LOG */ -#include "xine_internal.h" -#include "refcounter.h" +#include <xine/xine_internal.h> +#include <xine/refcounter.h> refcounter_t* _x_new_refcounter(void *object, void (*destructor)(void *)) { diff --git a/src/xine-engine/refcounter.h b/src/xine-engine/refcounter.h deleted file mode 100644 index a662a974e..000000000 --- a/src/xine-engine/refcounter.h +++ /dev/null @@ -1,46 +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_REFCOUNTER_H -#define HAVE_REFCOUNTER_H - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <pthread.h> - -typedef struct { - pthread_mutex_t lock; - void* object; /* referenced object */ - void (*destructor)(void *); /* object destructor */ - int count; -} refcounter_t; - -typedef void (*refcounter_destructor)(void*); - -refcounter_t* _x_new_refcounter(void *object, refcounter_destructor destructor) XINE_PROTECTED; - -int _x_refcounter_inc(refcounter_t *refcounter) XINE_PROTECTED; - -int _x_refcounter_dec(refcounter_t *refcounter) XINE_PROTECTED; - -void _x_refcounter_dispose(refcounter_t *refcounter) XINE_PROTECTED; - -#endif /* HAVE_REFCOUNTER_H */ diff --git a/src/xine-engine/resample.c b/src/xine-engine/resample.c index 43911c401..f907c965e 100644 --- a/src/xine-engine/resample.c +++ b/src/xine-engine/resample.c @@ -24,8 +24,8 @@ #include <string.h> #include <inttypes.h> -#include "attributes.h" -#include "resample.h" +#include <xine/attributes.h> +#include <xine/resample.h> /* contributed by paul flinders */ diff --git a/src/xine-engine/resample.h b/src/xine-engine/resample.h deleted file mode 100644 index 40b4de486..000000000 --- a/src/xine-engine/resample.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * utilitiy functions for audio drivers - * - * FIXME: not all of them are implemented yet - */ - -#ifndef HAVE_RESAMPLE_H -#define HAVE_RESAMPLE_H - -#define RESAMPLE_MAX_CHANNELS 6 - -void _x_audio_out_resample_stereo(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, - int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; - -void _x_audio_out_resample_mono(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, - int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; - -void _x_audio_out_resample_4channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, - int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; - -void _x_audio_out_resample_5channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, - int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; - -void _x_audio_out_resample_6channel(int16_t* last_sample, - int16_t* input_samples, uint32_t in_samples, - int16_t* output_samples, uint32_t out_samples) XINE_PROTECTED; - -void _x_audio_out_resample_8to16(int8_t* input_samples, - int16_t* output_samples, uint32_t samples) XINE_PROTECTED; - -void _x_audio_out_resample_16to8(int16_t* input_samples, - int8_t* output_samples, uint32_t samples) XINE_PROTECTED; - -void _x_audio_out_resample_monotostereo(int16_t* input_samples, - int16_t* output_samples, uint32_t frames) XINE_PROTECTED; - -void _x_audio_out_resample_stereotomono(int16_t* input_samples, - int16_t* output_samples, uint32_t frames) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/scratch.c b/src/xine-engine/scratch.c index 98fed2cdd..7376a3f9e 100644 --- a/src/xine-engine/scratch.c +++ b/src/xine-engine/scratch.c @@ -26,7 +26,6 @@ #include <stdio.h> #include <stdarg.h> -#include <string.h> /* For memset */ #define LOG_MODULE "scratch" #define LOG_VERBOSE @@ -34,8 +33,8 @@ #define LOG */ -#include "xineutils.h" -#include "scratch.h" +#include <xine/xineutils.h> +#include <xine/scratch.h> static void __attribute__((__format__(__printf__, 2, 0))) scratch_printf (scratch_buffer_t *this, const char *format, va_list argp) diff --git a/src/xine-engine/scratch.h b/src/xine-engine/scratch.h deleted file mode 100644 index c0e591d31..000000000 --- a/src/xine-engine/scratch.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * scratch buffer for log output - */ - -#ifndef HAVE_SCRATCH_H -#define HAVE_SCRATCH_H - -#include <stdarg.h> -#include <pthread.h> - -typedef struct scratch_buffer_s scratch_buffer_t; - -#define SCRATCH_LINE_LEN_MAX 1024 - -struct scratch_buffer_s { - - void -#if __GNUC__ >= 3 - __attribute__((__format__(__printf__, 2, 0))) -#endif - (*scratch_printf) (scratch_buffer_t *this, const char *format, va_list ap); - - char **(*get_content) (scratch_buffer_t *this); - - void (*dispose) (scratch_buffer_t *this); - - char **lines; - char **ordered; - - int num_lines; - int cur; - - pthread_mutex_t lock; -}; - -scratch_buffer_t *_x_new_scratch_buffer (int num_lines) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/spu.c b/src/xine-engine/spu.c index 813300fb0..c610a43c9 100644 --- a/src/xine-engine/spu.c +++ b/src/xine-engine/spu.c @@ -19,8 +19,8 @@ * */ -#include "xine_internal.h" -#include "spu.h" +#include <xine/xine_internal.h> +#include <xine/spu.h> #define BLACK_OPACITY 67 #define COLOUR_OPACITY 100 diff --git a/src/xine-engine/spu.h b/src/xine-engine/spu.h deleted file mode 100644 index daba7866b..000000000 --- a/src/xine-engine/spu.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2007 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-1301 USA. - * - */ - -#ifndef XINE_UTILS_SPU_H -#define XINE_UTILS_SPU_H - -#ifndef XINE_PROTECTED -#define XINE_PROTECTED -#endif - -typedef struct xine_spu_opacity_s xine_spu_opacity_t; - -struct xine_spu_opacity_s { - uint8_t black, colour; -}; - -void _x_spu_misc_init (xine_t *); - -void _x_spu_get_opacity (xine_t *, xine_spu_opacity_t *) XINE_PROTECTED; - -/* in: trans = 0..255, 0=opaque - * out: 0..255, 0=transparent - */ -int _x_spu_calculate_opacity (const clut_t *, uint8_t trans, const xine_spu_opacity_t *) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/spu_decoder.h b/src/xine-engine/spu_decoder.h deleted file mode 100644 index dcf9107f7..000000000 --- a/src/xine-engine/spu_decoder.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * spu_decoder_api.h - * - * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001 - * - * This file is part of xine, a unix 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 GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, - * - */ - -#ifndef HAVE_SPU_API_H -#define HAVE_SPU_API_H - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "buffer.h" -#else -# include <xine/os_types.h> -# include <xine/buffer.h> -#endif - -#define SPU_DECODER_IFACE_VERSION 17 - -/* - * generic xine spu decoder plugin interface - */ - -typedef struct spu_decoder_class_s spu_decoder_class_t; -typedef struct spu_decoder_s spu_decoder_t; - -struct spu_decoder_class_s { - - /* - * open a new instance of this plugin class - */ - spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this, xine_stream_t *stream); - - /** - * @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; - - /* - * free all class-related resources - */ - void (*dispose) (spu_decoder_class_t *this); -}; - -#define default_spu_decoder_class_dispose (void (*) (spu_decoder_class_t *this))free - -struct spu_decoder_s { - - /* - * decode data from buf and feed the overlay to overlay manager - */ - void (*decode_data) (spu_decoder_t *this, buf_element_t *buf); - - /* - * reset decoder after engine flush (prepare for new - * SPU data not related to recently decoded data) - */ - void (*reset) (spu_decoder_t *this); - - /* - * inform decoder that a time reference discontinuity has happened. - * that is, it must forget any currently held pts value - */ - void (*discontinuity) (spu_decoder_t *this); - - /* - * close down, free all resources - */ - void (*dispose) (spu_decoder_t *this); - - /* - * When the SPU decoder also handles data used in user interaction, - * you can query the related information here. The typical example - * for this is DVD NAV packets which are handled by the SPU decoder - * and can be received readily parsed from here. - * The caller and the decoder must agree on the structure which is - * passed here. - * This function pointer may be NULL, if the plugin does not have - * such functionality. - */ - int (*get_interact_info) (spu_decoder_t *this, void *data); - - /* - * When the SPU decoder also handles menu overlays for user inter- - * action, you can set a menu button here. The typical example for - * this is DVD menus. - * This function pointer may be NULL, if the plugin does not have - * such functionality. - */ - void (*set_button) (spu_decoder_t *this_gen, int32_t button, int32_t mode); - - void *node; /* used by plugin loader */ -}; - - -/* SPU decoders differ from video and audio decoders in one significant - * way: unlike audio and video, SPU streams are not continuous; - * this results in another difference, programmers have to consider: - * while both audio and video decoders are automatically blocked in - * their get_buffer()/get_frame() methods when the output cannot take - * any more data, this does not work for SPU, because it could take - * minutes before the next free slot becomes available and we must not - * block the decoder thread for that long; - * therefore, we provide a convenience function for SPU decoders which - * implements a wait until a timestamp sufficiently close to the VPTS - * of the next SPU is reached, but the waiting will end before that, - * if some outside condition requires us to release the decoder thread - * to other tasks; - * if this functions returns with 1, noone needs the decoder thread and - * you may continue waiting; if it returns 0, finish whatever you are - * doing and return; - * the usual pattern for SPU decoders is this: - * - * do { - * spu = prepare_spu(); - * int thread_vacant = _x_spu_decoder_sleep(this->stream, spu->vpts); - * int success = process_spu(spu); - * } while (!success && thread_vacant); - */ -int _x_spu_decoder_sleep(xine_stream_t *, int64_t next_spu_vpts) XINE_PROTECTED; - -#endif /* HAVE_SPUDEC_H */ diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c index c88e01714..ca6e7aa23 100644 --- a/src/xine-engine/video_decoder.c +++ b/src/xine-engine/video_decoder.c @@ -35,8 +35,8 @@ #define LOG */ -#include "xine_internal.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/xineutils.h> #include <sched.h> #define SPU_SLEEP_INTERVAL (90000/2) diff --git a/src/xine-engine/video_decoder.h b/src/xine-engine/video_decoder.h deleted file mode 100644 index 705efa3da..000000000 --- a/src/xine-engine/video_decoder.h +++ /dev/null @@ -1,111 +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 - * - * xine video decoder plugin interface - */ - -#ifndef HAVE_VIDEO_DECODER_H -#define HAVE_VIDEO_DECODER_H - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "buffer.h" -#else -# include <xine/os_types.h> -# include <xine/buffer.h> -#endif - -#define VIDEO_DECODER_IFACE_VERSION 19 - - -/* - * generic xine video decoder plugin interface - */ - -typedef struct video_decoder_class_s video_decoder_class_t; -typedef struct video_decoder_s video_decoder_t; - -struct video_decoder_class_s { - - /* - * open a new instance of this plugin class - */ - video_decoder_t* (*open_plugin) (video_decoder_class_t *this, xine_stream_t *stream); - - /** - * @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; - - /* - * free all class-related resources - */ - void (*dispose) (video_decoder_class_t *this); -}; - -#define default_video_decoder_class_dispose (void (*) (video_decoder_class_t *this))free - -struct video_decoder_s { - - /* - * decode data from buf and feed decoded frames to - * video output - */ - void (*decode_data) (video_decoder_t *this, buf_element_t *buf); - - /* - * reset decoder after engine flush (prepare for new - * video data not related to recently decoded data) - */ - void (*reset) (video_decoder_t *this); - - /* - * inform decoder that a time reference discontinuity has happened. - * that is, it must forget any currently held pts value - */ - void (*discontinuity) (video_decoder_t *this); - - /* - * flush out any frames that are still stored in the decoder - */ - void (*flush) (video_decoder_t *this); - - /* - * close down, free all resources - */ - void (*dispose) (video_decoder_t *this); - - - void *node; /*used by plugin loader */ - -}; - -#endif diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 575017301..0bab612ce 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -44,10 +44,10 @@ #define LOG */ -#include "xine_internal.h" -#include "video_out.h" -#include "metronom.h" -#include "xineutils.h" +#include <xine/xine_internal.h> +#include <xine/video_out.h> +#include <xine/metronom.h> +#include <xine/xineutils.h> #define NUM_FRAME_BUFFERS 15 #define MAX_USEC_TO_SLEEP 20000 @@ -979,6 +979,7 @@ static vo_frame_t *get_next_frame (vos_t *this, int64_t cur_vpts, if (!img->stream || _x_stream_info_get(img->stream, XINE_STREAM_INFO_VIDEO_HAS_STILL) || + !img->stream->video_fifo || img->stream->video_fifo->size(img->stream->video_fifo) < 10) { lprintf ("possible still frame\n"); diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h deleted file mode 100644 index 8efdae9f6..000000000 --- a/src/xine-engine/video_out.h +++ /dev/null @@ -1,466 +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 - * - * - * xine version of video_out.h - * - * vo_frame : frame containing yuv data and timing info, - * transferred between video_decoder and video_output - * - * vo_driver : lowlevel, platform-specific video output code - * - * vo_port : generic frame_handling code, uses - * a vo_driver for output - */ - -#ifndef HAVE_VIDEO_OUT_H -#define HAVE_VIDEO_OUT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <pthread.h> - -#ifdef XINE_COMPILE -# include "xine.h" -# include "buffer.h" -#else -# include <xine.h> -# include <xine/buffer.h> -#endif - - -typedef struct vo_frame_s vo_frame_t; -typedef struct vo_driver_s vo_driver_t; -typedef struct video_driver_class_s video_driver_class_t; -typedef struct vo_overlay_s vo_overlay_t; -typedef struct video_overlay_manager_s video_overlay_manager_t; - -/* public part, video drivers may add private fields - * - * Remember that adding new functions to this structure requires - * adaption of the post plugin decoration layer. Be sure to look into - * src/xine-engine/post.[ch]. - */ -struct vo_frame_s { - /* - * member functions - */ - - /* Duplicate picture data and acceleration specific data of a frame. */ - /* if the image format isn't already known by Xine. Currently this is needed */ - /* For all image formats except XINE_IMGFMT_YV12 and XINE_IMGFMT_YUY2 */ - void (*proc_duplicate_frame_data) (vo_frame_t *vo_img, vo_frame_t *src); - - /* tell video driver to copy/convert the whole of this frame, may be NULL */ - /* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */ - void (*proc_frame) (vo_frame_t *vo_img); - - /* tell video driver to copy/convert a slice of this frame, may be NULL */ - /* at least one of proc_frame() and proc_slice() MUST set the variable proc_called to 1 */ - void (*proc_slice) (vo_frame_t *vo_img, uint8_t **src); - - /* tell video driver that the decoder starts a new field */ - void (*field) (vo_frame_t *vo_img, int which_field); - - /* append this frame to the display queue, - returns number of frames to skip if decoder is late */ - /* when the frame does not originate from a stream, it is legal to pass an anonymous stream */ - int (*draw) (vo_frame_t *vo_img, xine_stream_t *stream); - - /* lock frame as reference, must be paired with free. - * most decoders/drivers do not need to call this function since - * newly allocated frames are already locked once. - */ - void (*lock) (vo_frame_t *vo_img); - - /* this frame is no longer used by the decoder, video driver, etc */ - void (*free) (vo_frame_t *vo_img); - - /* free memory/resources for this frame */ - void (*dispose) (vo_frame_t *vo_img); - - /* - * public variables to decoders and vo drivers - * changing anything here will require recompiling them both - */ - int64_t pts; /* presentation time stamp (1/90000 sec) */ - int64_t vpts; /* virtual pts, generated by metronom */ - int bad_frame; /* e.g. frame skipped or based on skipped frame */ - int duration; /* frame length in time, in 1/90000 sec */ - - /* yv12 (planar) base[0]: y, base[1]: u, base[2]: v */ - /* yuy2 (interleaved) base[0]: yuyv..., base[1]: --, base[2]: -- */ - uint8_t *base[3]; - int pitches[3]; - - /* info that can be used for interlaced output (e.g. tv-out) */ - int top_field_first; - int repeat_first_field; - /* note: progressive_frame is set wrong on many mpeg2 streams. for - * that reason, this flag should be interpreted as a "hint". - */ - int progressive_frame; - int picture_coding_type; - - /* cropping to be done */ - int crop_left, crop_right, crop_top, crop_bottom; - - int lock_counter; - pthread_mutex_t mutex; /* protect access to lock_count */ - - /* extra info coming from input or demuxers */ - extra_info_t *extra_info; - - /* additional information to be able to duplicate frames: */ - int width, height; - double ratio; /* aspect ratio */ - int format; /* IMGFMT_YV12 or IMGFMT_YUY2 */ - - int drawn; /* used by decoder, frame has already been drawn */ - int flags; /* remember the frame flags */ - int proc_called; /* track use of proc_*() methods */ - - /* Used to carry private data for accelerated plugins.*/ - void *accel_data; - - /* "backward" references to where this frame originates from */ - xine_video_port_t *port; - vo_driver_t *driver; - xine_stream_t *stream; - - /* displacement for overlays */ - int overlay_offset_x, overlay_offset_y; - - /* - * that part is used only by video_out.c for frame management - * obs: changing anything here will require recompiling vo drivers - */ - struct vo_frame_s *next; - - int id; /* debugging - track this frame */ - int is_first; -}; - - -/* - * Remember that adding new functions to this structure requires - * adaption of the post plugin decoration layer. Be sure to look into - * src/xine-engine/post.[ch]. - */ -struct xine_video_port_s { - - uint32_t (*get_capabilities) (xine_video_port_t *self); /* for constants see below */ - - /* open display driver for video output */ - /* when you are not a full-blown stream, but still need to open the port - * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ - void (*open) (xine_video_port_t *self, xine_stream_t *stream); - - /* - * get_frame - allocate an image buffer from display driver - * - * params : width == width of video to display. - * height == height of video to display. - * ratio == aspect ration information - * format == FOURCC descriptor of image format - * flags == field/prediction flags - */ - vo_frame_t* (*get_frame) (xine_video_port_t *self, uint32_t width, - uint32_t height, double ratio, - int format, int flags); - - /* retrieves the last displayed frame (useful for taking snapshots) */ - vo_frame_t* (*get_last_frame) (xine_video_port_t *self); - - /* overlay stuff */ - void (*enable_ovl) (xine_video_port_t *self, int ovl_enable); - - /* get overlay manager */ - video_overlay_manager_t* (*get_overlay_manager) (xine_video_port_t *self); - - /* flush video_out fifo */ - void (*flush) (xine_video_port_t *self); - - /* trigger immediate drawing */ - void (*trigger_drawing) (xine_video_port_t *self); - - /* Get/Set video property - * - * See VO_PROP_* bellow - */ - int (*get_property) (xine_video_port_t *self, int property); - int (*set_property) (xine_video_port_t *self, int property, int value); - - /* return true if port is opened for this stream, stream can be anonymous */ - int (*status) (xine_video_port_t *self, xine_stream_t *stream, - int *width, int *height, int64_t *img_duration); - - /* video driver is no longer used by decoder => close */ - /* when you are not a full-blown stream, but still need to close the port - * (e.g. you are a post plugin) it is legal to pass an anonymous stream */ - void (*close) (xine_video_port_t *self, xine_stream_t *stream); - - /* called on xine exit */ - void (*exit) (xine_video_port_t *self); - - /* the driver in use */ - vo_driver_t *driver; - -}; - -/* constants for the get/set property functions */ -#define VO_PROP_INTERLACED 0 -#define VO_PROP_ASPECT_RATIO 1 -#define VO_PROP_HUE 2 -#define VO_PROP_SATURATION 3 -#define VO_PROP_CONTRAST 4 -#define VO_PROP_BRIGHTNESS 5 -#define VO_PROP_COLORKEY 6 -#define VO_PROP_AUTOPAINT_COLORKEY 7 -#define VO_PROP_ZOOM_X 8 -#define VO_PROP_PAN_SCAN 9 -#define VO_PROP_TVMODE 10 -#define VO_PROP_MAX_NUM_FRAMES 11 -#define VO_PROP_ZOOM_Y 13 -#define VO_PROP_DISCARD_FRAMES 14 /* not used by drivers */ -#define VO_PROP_WINDOW_WIDTH 15 /* read-only */ -#define VO_PROP_WINDOW_HEIGHT 16 /* read-only */ -#define VO_PROP_BUFS_IN_FIFO 17 /* read-only */ -#define VO_PROP_NUM_STREAMS 18 /* read-only */ -#define VO_NUM_PROPERTIES 19 - -/* number of colors in the overlay palette. Currently limited to 256 - at most, because some alphablend functions use an 8-bit index into - the palette. This should probably be classified as a bug. */ -#define OVL_PALETTE_SIZE 256 - -#define OVL_MAX_OPACITY 0x0f - -/* number of recent frames to keep in memory - these frames are needed by some deinterlace algorithms - FIXME: we need a method to flush the recent frames (new stream) -*/ -#define VO_NUM_RECENT_FRAMES 2 - -/* get_frame flags */ -#define VO_TOP_FIELD 1 -#define VO_BOTTOM_FIELD 2 -#define VO_BOTH_FIELDS (VO_TOP_FIELD | VO_BOTTOM_FIELD) -#define VO_PAN_SCAN_FLAG 4 -#define VO_INTERLACED_FLAG 8 -#define VO_NEW_SEQUENCE_FLAG 16 /* set after MPEG2 Sequence Header Code (used by XvMC) */ - -/* video driver capabilities */ -#define VO_CAP_YV12 0x00000001 /* driver can handle YUV 4:2:0 pictures */ -#define VO_CAP_YUY2 0x00000002 /* driver can handle YUY2 pictures */ -#define VO_CAP_XVMC_MOCOMP 0x00000004 /* driver can use XvMC motion compensation */ -#define VO_CAP_XVMC_IDCT 0x00000008 /* driver can use XvMC idct acceleration */ -#define VO_CAP_UNSCALED_OVERLAY 0x00000010 /* driver can blend overlay at output resolution */ -#define VO_CAP_CROP 0x00000020 /* driver can crop */ -#define VO_CAP_XXMC 0x00000040 /* driver can use extended XvMC */ - - -/* - * vo_driver_s contains the functions every display driver - * has to implement. The vo_new_port function (see below) - * should then be used to construct a vo_port using this - * driver. Some of the function pointers will be copied - * directly into xine_video_port_s, others will be called - * from generic vo functions. - */ - -#define VIDEO_OUT_DRIVER_IFACE_VERSION 22 - -struct vo_driver_s { - - uint32_t (*get_capabilities) (vo_driver_t *self); /* for constants see above */ - - /* - * allocate an vo_frame_t struct, - * the driver must supply the copy, field and dispose functions - */ - vo_frame_t* (*alloc_frame) (vo_driver_t *self); - - /* - * check if the given image fullfills the format specified - * (re-)allocate memory if necessary - */ - void (*update_frame_format) (vo_driver_t *self, vo_frame_t *img, - uint32_t width, uint32_t height, - double ratio, int format, int flags); - - /* display a given frame */ - void (*display_frame) (vo_driver_t *self, vo_frame_t *vo_img); - - /* overlay_begin and overlay_end are used by drivers suporting - * persistent overlays. they can be optimized to update only when - * overlay image has changed. - * - * sequence of operation (pseudo-code): - * overlay_begin(this,img,true_if_something_changed_since_last_blend ); - * while(visible_overlays) - * overlay_blend(this,img,overlay[i]); - * overlay_end(this,img); - * - * any function pointer from this group may be set to NULL. - */ - void (*overlay_begin) (vo_driver_t *self, vo_frame_t *vo_img, int changed); - void (*overlay_blend) (vo_driver_t *self, vo_frame_t *vo_img, vo_overlay_t *overlay); - void (*overlay_end) (vo_driver_t *self, vo_frame_t *vo_img); - - /* - * these can be used by the gui directly: - */ - int (*get_property) (vo_driver_t *self, int property); - int (*set_property) (vo_driver_t *self, - int property, int value); - void (*get_property_min_max) (vo_driver_t *self, - int property, int *min, int *max); - - /* - * general purpose communication channel between gui and driver - * - * this should be used to propagate events, display data, window sizes - * etc. to the driver - */ - int (*gui_data_exchange) (vo_driver_t *self, int data_type, - void *data); - - /* check if a redraw is needed (due to resize) - * this is only used for still frames, normal video playback - * must call that inside display_frame() function. - */ - int (*redraw_needed) (vo_driver_t *self); - - /* - * free all resources, close driver - */ - void (*dispose) (vo_driver_t *self); - - void *node; /* needed by plugin_loader */ -}; - -struct video_driver_class_s { - - /* - * open a new instance of this plugin class - */ - vo_driver_t* (*open_plugin) (video_driver_class_t *self, const void *visual); - - /** - * @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; - - /* - * free all class-related resources - */ - void (*dispose) (video_driver_class_t *self); -}; - -#define default_video_driver_class_dispose (void (*) (video_driver_class_t *this))free - -typedef struct rle_elem_s { - uint16_t len; - uint16_t color; -} rle_elem_t; - -struct vo_overlay_s { - - rle_elem_t *rle; /* rle code buffer */ - int data_size; /* useful for deciding realloc */ - int num_rle; /* number of active rle codes */ - int x; /* x start of subpicture area */ - int y; /* y start of subpicture area */ - int width; /* width of subpicture area */ - int height; /* height of subpicture area */ - - uint32_t color[OVL_PALETTE_SIZE]; /* color lookup table */ - uint8_t trans[OVL_PALETTE_SIZE]; /* mixer key table */ - int rgb_clut; /* true if clut was converted to rgb */ - - /* define a highlight area with different colors */ - int hili_top; - int hili_bottom; - int hili_left; - int hili_right; - uint32_t hili_color[OVL_PALETTE_SIZE]; - uint8_t hili_trans[OVL_PALETTE_SIZE]; - int hili_rgb_clut; /* true if clut was converted to rgb */ - - int unscaled; /* true if it should be blended unscaled */ -}; - - -/* API to video_overlay manager - * - * Remember that adding new functions to this structure requires - * adaption of the post plugin decoration layer. Be sure to look into - * src/xine-engine/post.[ch]. - */ -struct video_overlay_manager_s { - void (*init) (video_overlay_manager_t *this_gen); - - void (*dispose) (video_overlay_manager_t *this_gen); - - int32_t (*get_handle) (video_overlay_manager_t *this_gen, int object_type ); - - void (*free_handle) (video_overlay_manager_t *this_gen, int32_t handle); - - int32_t (*add_event) (video_overlay_manager_t *this_gen, void *event); - - void (*flush_events) (video_overlay_manager_t *this_gen ); - - int (*redraw_needed) (video_overlay_manager_t *this_gen, int64_t vpts ); - - void (*multiple_overlay_blend) (video_overlay_manager_t *this_gen, int64_t vpts, - vo_driver_t *output, vo_frame_t *vo_img, int enabled); -}; - -/** - * @brief Build a video output port from a given video driver. - * - * @internal - */ -xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/src/xine-engine/video_overlay.c b/src/xine-engine/video_overlay.c index c189fa56b..44080c469 100644 --- a/src/xine-engine/video_overlay.c +++ b/src/xine-engine/video_overlay.c @@ -25,11 +25,11 @@ #include <sys/stat.h> #include <fcntl.h> -#include "buffer.h" -#include "xine_internal.h" +#include <xine/buffer.h> +#include <xine/xine_internal.h> #include "bswap.h" -#include "xineutils.h" -#include "video_overlay.h" +#include <xine/xineutils.h> +#include <xine/video_overlay.h> /* #define LOG_DEBUG diff --git a/src/xine-engine/video_overlay.h b/src/xine-engine/video_overlay.h deleted file mode 100644 index 6bb529204..000000000 --- a/src/xine-engine/video_overlay.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2000-2003 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_VIDEO_OVERLAY_H -#define HAVE_VIDEO_OVERLAY_H - -#ifdef XINE_COMPILE -# include "xine_internal.h" -#else -# include <xine/xine_internal.h> -#endif - -#ifdef __GNUC__ -#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) {y: (_y), cr: (_cr), cb: (_cb)} -#else -#define CLUT_Y_CR_CB_INIT(_y,_cr,_cb) { (_cb), (_cr), (_y) } -#endif - -#define MAX_OBJECTS 50 -#define MAX_EVENTS 50 -#define MAX_SHOWING (5 + 16) - -#define OVERLAY_EVENT_NULL 0 -#define OVERLAY_EVENT_SHOW 1 -#define OVERLAY_EVENT_HIDE 2 -#define OVERLAY_EVENT_MENU_BUTTON 3 -#define OVERLAY_EVENT_FREE_HANDLE 8 /* Frees a handle, previous allocated via get_handle */ - -typedef struct video_overlay_object_s { - int32_t handle; /* Used to match Show and Hide events. */ - uint32_t object_type; /* 0=Subtitle, 1=Menu */ - int64_t pts; /* Needed for Menu button compares */ - vo_overlay_t *overlay; /* The image data. */ - uint32_t *palette; /* If NULL, no palette contained in this event. */ - uint32_t palette_type; /* 1 Y'CrCB, 2 R'G'B' */ -} video_overlay_object_t; - -/* This will hold all details of an event item, needed for event queue to function */ -typedef struct video_overlay_event_s { - int64_t vpts; /* Time when event will action. 0 means action now */ -/* Once video_out blend_yuv etc. can take rle_elem_t with Colour, blend and length information. - * we can remove clut and blend from this structure. - * This will allow for many more colours for OSD. - */ - uint32_t event_type; /* Show SPU, Show OSD, Hide etc. */ - 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; - -#endif diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index ff30c47a6..567b3984a 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.c @@ -32,8 +32,8 @@ #define LOG */ -#include "xine_internal.h" -#include "vo_scale.h" +#include <xine/xine_internal.h> +#include <xine/vo_scale.h> /* * convert delivered height/width to ideal width/height @@ -311,28 +311,21 @@ void _x_vo_scale_translate_gui2video(vo_scale_t *this, *vid_y = y; } -/* - * Returns description of a given ratio code +/*/ + * @brief Table for description of a given ratio code. + * + * @note changing the size of the elements of the array will break + * ABI, so please don't do that unless you absolutely can't continue + * with the current size. */ - -char *_x_vo_scale_aspect_ratio_name(int a) { - - switch (a) { - case XINE_VO_ASPECT_AUTO: - return "auto"; - case XINE_VO_ASPECT_SQUARE: - return "square"; - case XINE_VO_ASPECT_4_3: - return "4:3"; - case XINE_VO_ASPECT_ANAMORPHIC: - return "16:9"; - case XINE_VO_ASPECT_DVB: - return "2:1"; - default: - return "unknown"; - } -} - +const char _x_vo_scale_aspect_ratio_name_table[][8] = { + "auto", /* XINE_VO_ASPECT_AUTO */ + "square", /* XINE_VO_ASPECT_SQUARE */ + "4:3", /* XINE_VO_ASPECT_4_3 */ + "16:9", /* XINE_VO_ASPECT_ANAMORPHIC */ + "2:1", /* XINE_VO_ASPECT_DVB */ + "unknown" /* All the rest */ +}; /* * config callbacks diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h deleted file mode 100644 index e502b2f62..000000000 --- a/src/xine-engine/vo_scale.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * vo_scale.h - * - * keeps video scaling information - */ - -#ifndef HAVE_VO_SCALE_H -#define HAVE_VO_SCALE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef XINE_COMPILE -# include "configfile.h" -#else -# include <xine/configfile.h> -#endif - -typedef struct { - int x, y; - int w, h; -} vo_scale_rect_t; - -struct vo_scale_s { - - /* true if driver supports frame zooming */ - int support_zoom; - - /* forces direct mapping between frame pixels and screen pixels */ - int scaling_disabled; - - /* size / aspect ratio calculations */ - - /* - * "delivered" size: - * frame dimension / aspect as delivered by the decoder - * used (among other things) to detect frame size changes - * units: frame pixels - */ - int delivered_width; - int delivered_height; - double delivered_ratio; - - /* - * required cropping: - * units: frame pixels - */ - int crop_left; - int crop_right; - int crop_top; - int crop_bottom; - - /* - * displayed part of delivered images, - * taking zoom into account - * units: frame pixels - */ - int displayed_xoffset; - int displayed_yoffset; - int displayed_width; - int displayed_height; - double zoom_factor_x, zoom_factor_y; - - /* - * user's aspect selection - */ - int user_ratio; - - /* - * "gui" size / offset: - * what gui told us about where to display the video - * units: screen pixels - */ - int gui_x, gui_y; - int gui_width, gui_height; - int gui_win_x, gui_win_y; - - /* */ - int force_redraw; - - /* - * video + display pixel aspect - * One pixel of height 1 has this width - * This may be corrected by the driver in order to fit the video seamlessly - */ - double gui_pixel_aspect; - double video_pixel_aspect; - - /* - * "output" size: - * - * this is finally the ideal size "fitted" into the - * gui size while maintaining the aspect ratio - * units: screen pixels - */ - int output_width; - int output_height; - int output_xoffset; - int output_yoffset; - - - /* gui callbacks */ - - void *user_data; - void (*frame_output_cb) (void *user_data, - int video_width, int video_height, - double video_pixel_aspect, - int *dest_x, int *dest_y, - int *dest_width, int *dest_height, - double *dest_pixel_aspect, - int *win_x, int *win_y); - - void (*dest_size_cb) (void *user_data, - int video_width, int video_height, - double video_pixel_aspect, - int *dest_width, int *dest_height, - double *dest_pixel_aspect); - - /* borders */ - vo_scale_rect_t border[4]; - - /* - * border ratios to determine image position in the - * viewport; these are set by user config - */ - double output_horizontal_position; - double output_vertical_position; - -}; - -typedef struct vo_scale_s vo_scale_t; - - -/* - * convert delivered height/width to ideal width/height - * taking into account aspect ratio and zoom factor - */ - -void _x_vo_scale_compute_ideal_size (vo_scale_t *self) XINE_PROTECTED; - - -/* - * make ideal width/height "fit" into the gui - */ - -void _x_vo_scale_compute_output_size (vo_scale_t *self) XINE_PROTECTED; - -/* - * return true if a redraw is needed due resizing, zooming, - * aspect ratio changing, etc. - */ - -int _x_vo_scale_redraw_needed (vo_scale_t *self) XINE_PROTECTED; - -/* - * - */ - -void _x_vo_scale_translate_gui2video(vo_scale_t *self, - int x, int y, - int *vid_x, int *vid_y) XINE_PROTECTED; - -/* - * Returns description of a given ratio code - */ - -char *_x_vo_scale_aspect_ratio_name(int a) XINE_PROTECTED; - -/* - * initialize rescaling struct - */ - -void _x_vo_scale_init(vo_scale_t *self, int support_zoom, - int scaling_disabled, config_values_t *config ) XINE_PROTECTED; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index 17ea5d679..c6dc8a2ce 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.c @@ -35,6 +35,7 @@ #include <pthread.h> #include <stdarg.h> #include <stdio.h> +#include <ctype.h> #if defined (__linux__) || defined (__GLIBC__) #include <endian.h> #elif defined (__FreeBSD__) @@ -51,33 +52,36 @@ #define LOG_VERBOSE /* #define LOG +#define DEBUG */ #define XINE_ENABLE_EXPERIMENTAL_FEATURES #define XINE_ENGINE_INTERNAL #define METRONOM_CLOCK_INTERNAL -#include "xine_internal.h" -#include "plugin_catalog.h" -#include "audio_out.h" -#include "video_out.h" -#include "demuxers/demux.h" -#include "buffer.h" -#include "spu_decoder.h" -#include "input/input_plugin.h" -#include "metronom.h" -#include "configfile.h" -#include "osd.h" -#include "spu.h" - -#include "xineutils.h" -#include "compat.h" +#include <xine/xine_internal.h> +#include <xine/plugin_catalog.h> +#include <xine/audio_out.h> +#include <xine/video_out.h> +#include <xine/demux.h> +#include <xine/buffer.h> +#include <xine/spu_decoder.h> +#include <xine/input_plugin.h> +#include <xine/metronom.h> +#include <xine/configfile.h> +#include <xine/osd.h> +#include <xine/spu.h> + +#include <xine/xineutils.h> +#include <xine/compat.h> #ifdef WIN32 # include <fcntl.h> # include <winsock.h> #endif /* WIN32 */ +#include "load_plugins.h" + static void mutex_cleanup (void *mutex) { pthread_mutex_unlock ((pthread_mutex_t *) mutex); @@ -590,7 +594,7 @@ static int stream_rewire_video(xine_post_out_t *output, void *data) return 1; } -void xine_dispose_internal (xine_stream_t *stream); +static void xine_dispose_internal (xine_stream_t *stream); xine_stream_t *xine_stream_new (xine_t *this, xine_audio_port_t *ao, xine_video_port_t *vo) { @@ -819,9 +823,22 @@ void _x_flush_events_queues (xine_stream_t *stream) { pthread_mutex_unlock (&stream->event_queues_lock); } +static inline int _x_path_looks_like_mrl (const char *path) +{ + if ((*path & 0xDF) < 'A' || (*path & 0xDF) > 'Z') + return 0; + + for (++path; *path; ++path) + if ((*path != '-' && *path < '0') || (*path > '9' && *path < 'A') || + (*path > 'Z' && *path < 'a') || *path > 'z') + break; + + return path[0] == ':' && path[1] == '/'; +} + static int open_internal (xine_stream_t *stream, const char *mrl) { - const char *stream_setup; + const char *stream_setup = NULL; int no_cache = 0; if (!mrl) { @@ -846,13 +863,19 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { * look for a stream_setup in MRL and try finding an input plugin */ - stream_setup = mrl; - /* look for the next '#' or try the whole MRL, if none is found */ - while (*stream_setup && - (stream_setup = (strchr(stream_setup, '#') ? strchr(stream_setup, '#') : strlen(mrl) + mrl))) { - char *input_source = (char *)malloc(stream_setup - mrl + 1); - memcpy(input_source, mrl, stream_setup - mrl); - input_source[stream_setup - mrl] = '\0'; + if (isalpha (*mrl)) + { + stream_setup = mrl + 1; + while (isalnum (*stream_setup) || *stream_setup == '+' || *stream_setup == '-' || *stream_setup == '.') + ++stream_setup; + if (stream_setup[0] == ':' && stream_setup[1] == '/') + stream_setup = strchr (mrl, '#'); + else + stream_setup = NULL; + } + + { + char *input_source = strndup (mrl, stream_setup ? stream_setup - mrl : strlen (mrl)); /* * find an input plugin @@ -872,7 +895,6 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { res = (stream->input_plugin->open) (stream->input_plugin); switch(res) { case 1: /* Open successfull */ - free(input_source); break; case -1: /* Open unsuccessfull, but correct plugin */ free(input_source); @@ -885,14 +907,9 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { stream->input_plugin = NULL; stream->err = XINE_ERROR_INPUT_FAILED; } - if ( res ) break; } free(input_source); - /* if we fail when passing up to the first '#' to the input plugins, - * maybe the user stated a (invalid) MRL, with a '#' belonging to the - * input source -> look for the next '#' and try again */ - if (*stream_setup) stream_setup++; } if (!stream->input_plugin) { @@ -902,7 +919,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { return 0; } - if (*stream_setup) { + if (stream_setup) { while (stream_setup && *stream_setup && *(++stream_setup)) { if (strncasecmp(stream_setup, "demux", 5) == 0) { @@ -957,6 +974,7 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { memcpy(filename, tmp, strlen(tmp)); filename[strlen(tmp)] = '\0'; } + _x_mrl_unescape(filename); xine_log(stream->xine, XINE_LOG_MSG, _("xine: join rip input plugin\n")); input_saver = _x_rip_plugin_get_instance (stream, filename); @@ -1131,7 +1149,9 @@ static int open_internal (xine_stream_t *stream, const char *mrl) { memcpy(subtitle_mrl, tmp, strlen(tmp)); subtitle_mrl[strlen(tmp)] = '\0'; } - _x_mrl_unescape(subtitle_mrl); + /* unescape for xine_open() if the MRL looks like a raw pathname */ + if (!_x_path_looks_like_mrl(subtitle_mrl)) + _x_mrl_unescape(subtitle_mrl); stream->slave = xine_stream_new (stream->xine, NULL, stream->video_out ); stream->slave_affection = XINE_MASTER_SLAVE_PLAY | XINE_MASTER_SLAVE_STOP; if( xine_open( stream->slave, subtitle_mrl ) ) { @@ -1444,7 +1464,7 @@ int xine_eject (xine_stream_t *stream) { return status; } -void xine_dispose_internal (xine_stream_t *stream) { +static void xine_dispose_internal (xine_stream_t *stream) { xine_list_iterator_t *ite; @@ -1640,9 +1660,8 @@ static void config_demux_strategy_cb (void *this_gen, xine_cfg_entry_t *entry) { static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { xine_t *this = (xine_t *)this_gen; - char *homedir_trail_slash; + char homedir_trail_slash[strlen(xine_get_homedir()) + 2]; - homedir_trail_slash = (char *)malloc(strlen(xine_get_homedir()) + 2); sprintf(homedir_trail_slash, "%s/", xine_get_homedir()); if (entry->str_value[0] && (entry->str_value[0] != '/' || strstr(entry->str_value, "/.") || @@ -1662,7 +1681,6 @@ static void config_save_cb (void *this_gen, xine_cfg_entry_t *entry) { pthread_mutex_unlock(&this->streams_lock); } - free(homedir_trail_slash); this->save_path = entry->str_value; } @@ -1682,7 +1700,7 @@ void xine_init (xine_t *this) { /* * plugins */ - _x_scan_plugins(this); + XINE_PROFILE(_x_scan_plugins(this)); #ifdef HAVE_SETLOCALE if (!setlocale(LC_CTYPE, "")) diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c index 7913a18d6..c731a936f 100644 --- a/src/xine-engine/xine_interface.c +++ b/src/xine-engine/xine_interface.c @@ -40,11 +40,11 @@ #define XINE_ENGINE_INTERNAL -#include "xine_internal.h" -#include "audio_out.h" -#include "video_out.h" -#include "demuxers/demux.h" -#include "post.h" +#include <xine/xine_internal.h> +#include <xine/audio_out.h> +#include <xine/video_out.h> +#include <xine/demux.h> +#include <xine/post.h> /* * version information / checking @@ -941,7 +941,7 @@ int _x_message(xine_stream_t *stream, int type, ...) { va_list ap; char *s, *params; char *args[1025]; - static const char *std_explanation[] = { + static const char *const std_explanation[] = { "", N_("Warning:"), N_("Unknown host:"), diff --git a/src/xine-engine/xine_internal.h b/src/xine-engine/xine_internal.h deleted file mode 100644 index 7e57640c0..000000000 --- a/src/xine-engine/xine_internal.h +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Copyright (C) 2000-2005 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_XINE_INTERNAL_H -#define HAVE_XINE_INTERNAL_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * include public part of xine header - */ - -#ifdef XINE_COMPILE -# include "xine.h" -# include "refcounter.h" -# include "input/input_plugin.h" -# include "demuxers/demux.h" -# include "video_out.h" -# include "audio_out.h" -# include "metronom.h" -# include "osd.h" -# include "xineintl.h" -# include "plugin_catalog.h" -# include "video_decoder.h" -# include "audio_decoder.h" -# include "spu_decoder.h" -# include "scratch.h" -# include "broadcaster.h" -# include "io_helper.h" -# include "info_helper.h" -# include "alphablend.h" -#else -# include <xine.h> -# include <xine/refcounter.h> -# include <xine/input_plugin.h> -# include <xine/demux.h> -# include <xine/video_out.h> -# include <xine/audio_out.h> -# include <xine/metronom.h> -# include <xine/osd.h> -# include <xine/xineintl.h> -# include <xine/plugin_catalog.h> -# include <xine/video_decoder.h> -# include <xine/audio_decoder.h> -# include <xine/spu_decoder.h> -# include <xine/scratch.h> -# include <xine/broadcaster.h> -# include <xine/io_helper.h> -# include <xine/info_helper.h> -# include <xine/alphablend.h> -#endif - -#define XINE_MAX_EVENT_LISTENERS 50 -#define XINE_MAX_EVENT_TYPES 100 -#define XINE_MAX_TICKET_HOLDER_THREADS 64 - -/* used by plugin loader */ -#define XINE_VERSION_CODE XINE_MAJOR_VERSION*10000+XINE_MINOR_VERSION*100+XINE_SUB_VERSION - - -/* - * log constants - */ - -#define XINE_LOG_MSG 0 /* warnings, errors, ... */ -#define XINE_LOG_PLUGIN 1 -#define XINE_LOG_TRACE 2 -#define XINE_LOG_NUM 3 /* # of log buffers defined */ - -#define XINE_STREAM_INFO_MAX 99 - -typedef struct xine_ticket_s xine_ticket_t; - -/* - * the "big" xine struct, holding everything together - */ - -struct xine_s { - - config_values_t *config; - - plugin_catalog_t *plugin_catalog; - - int verbosity; - - int demux_strategy; - char *save_path; - - /* log output that may be presented to the user */ - scratch_buffer_t *log_buffers[XINE_LOG_NUM]; - - xine_list_t *streams; - pthread_mutex_t streams_lock; - - metronom_clock_t *clock; - - /** Handle for libxdg-basedir functions. It's actually an xdgHandle. */ - void * basedir_handle; - -#ifdef XINE_ENGINE_INTERNAL - xine_ticket_t *port_ticket; - pthread_mutex_t log_lock; -#endif -}; - -/* - * xine thread tickets - */ - -struct xine_ticket_s { - - /* the ticket owner must assure to check for ticket revocation in - * intervals of finite length; this means that you must release - * the ticket before any operation that might block - * - * you must never write to this member directly - */ - int ticket_revoked; - - /* apply for a ticket; between acquire and relese of an irrevocable - * ticket (be sure to pair them properly!), it is guaranteed that you - * will never be blocked by ticket revocation */ - void (*acquire)(xine_ticket_t *self, int irrevocable); - - /* give a ticket back */ - void (*release)(xine_ticket_t *self, int irrevocable); - - /* renew a ticket, when it has been revoked, see ticket_revoked above; - * irrevocable must be set to one, if your thread might have acquired - * irrevocable tickets you don't know of; set it to zero only when - * you know that this is impossible */ - void (*renew)(xine_ticket_t *self, int irrevocable); - -#ifdef XINE_ENGINE_INTERNAL - /* allow handing out new tickets */ - void (*issue)(xine_ticket_t *self, int atomic); - - /* revoke all tickets and deny new ones; - * a pair of atomic revoke and issue cannot be interrupted by another - * revocation or by other threads acquiring tickets */ - void (*revoke)(xine_ticket_t *self, int atomic); - - /* behaves like acquire() but doesn't block the calling thread; when - * the thread would have been blocked, 0 is returned otherwise 1 - * this function acquires a ticket even if ticket revocation is active */ - int (*acquire_nonblocking)(xine_ticket_t *self, int irrevocable); - - /* behaves like release() but doesn't block the calling thread; should - * be used in combination with acquire_nonblocking() */ - void (*release_nonblocking)(xine_ticket_t *self, int irrevocable); - - int (*lock_port_rewiring)(xine_ticket_t *self, int ms_timeout); - void (*unlock_port_rewiring)(xine_ticket_t *self); - - void (*dispose)(xine_ticket_t *self); - - pthread_mutex_t lock; - pthread_mutex_t revoke_lock; - pthread_cond_t issued; - pthread_cond_t revoked; - int tickets_granted; - int irrevocable_tickets; - int pending_revocations; - int atomic_revoke; - pthread_t atomic_revoker_thread; - pthread_mutex_t port_rewiring_lock; - struct { - int count; - pthread_t holder; - } *holder_threads; - unsigned holder_thread_count; -#endif -}; - -/* - * xine event queue - */ - -struct xine_event_queue_s { - xine_list_t *events; - pthread_mutex_t lock; - pthread_cond_t new_event; - pthread_cond_t events_processed; - xine_stream_t *stream; - pthread_t *listener_thread; - void *user_data; - xine_event_listener_cb_t callback; - int callback_running; -}; - -/* - * xine_stream - per-stream parts of the xine engine - */ - -struct xine_stream_s { - - /* reference to xine context */ - xine_t *xine; - - /* metronom instance used by current stream */ - metronom_t *metronom; - - /* demuxers use input_plugin to read data */ - input_plugin_t *input_plugin; - - /* used by video decoders */ - xine_video_port_t *video_out; - - /* demuxers send data to video decoders using this fifo */ - fifo_buffer_t *video_fifo; - - /* used by audio decoders */ - xine_audio_port_t *audio_out; - - /* demuxers send data to audio decoders using this fifo */ - fifo_buffer_t *audio_fifo; - - /* provide access to osd api */ - osd_renderer_t *osd_renderer; - - /* master/slave streams */ - xine_stream_t *master; /* usually a pointer to itself */ - xine_stream_t *slave; - - /* input_dvd uses this one. is it possible to add helper functions instead? */ - spu_decoder_t *spu_decoder_plugin; - - /* dxr3 use this one, should be possible to fix to use the port instead */ - vo_driver_t *video_driver; - - /* these definitely should be made private! */ - int audio_channel_auto; - int spu_decoder_streamtype; - int spu_channel_user; - int spu_channel_auto; - int spu_channel_letterbox; - int spu_channel; - - /* current content detection method, see METHOD_BY_xxx */ - int content_detection_method; - -#ifdef XINE_ENGINE_INTERNAL - /* these are private variables, plugins must not access them */ - - int status; - - /* lock controlling speed change access */ - pthread_mutex_t speed_change_lock; - uint32_t ignore_speed_change:1; /*< speed changes during stop can be disastrous */ - uint32_t video_thread_created:1; - uint32_t audio_thread_created:1; - uint32_t first_frame_flag:2; - uint32_t demux_action_pending:1; - uint32_t demux_thread_created:1; - uint32_t demux_thread_running:1; - uint32_t slave_is_subtitle:1; /*< ... and will be automaticaly disposed */ - uint32_t emergency_brake:1; /*< something went really wrong and this stream must be - * stopped. usually due some fatal error on output - * layers as they cannot call xine_stop. */ - uint32_t early_finish_event:1; /*< do not wait fifos get empty before sending event */ - uint32_t gapless_switch:1; /*< next stream switch will be gapless */ - - input_class_t *eject_class; - demux_plugin_t *demux_plugin; - -/* vo_driver_t *video_driver;*/ - pthread_t video_thread; - video_decoder_t *video_decoder_plugin; - extra_info_t *video_decoder_extra_info; - int video_decoder_streamtype; - int video_channel; - - uint32_t audio_track_map[50]; - int audio_track_map_entries; - - int audio_decoder_streamtype; - pthread_t audio_thread; - audio_decoder_t *audio_decoder_plugin; - extra_info_t *audio_decoder_extra_info; - - uint32_t audio_type; - /* *_user: -2 => off - -1 => auto (use *_auto value) - >=0 => respect the user's choice - */ - int audio_channel_user; -/* int audio_channel_auto; */ - -/* spu_decoder_t *spu_decoder_plugin; */ -/* int spu_decoder_streamtype; */ - uint32_t spu_track_map[50]; - int spu_track_map_entries; -/* int spu_channel_user; */ -/* int spu_channel_auto; */ -/* int spu_channel_letterbox; */ - int spu_channel_pan_scan; -/* int spu_channel; */ - - /* lock for public xine player functions */ - pthread_mutex_t frontend_lock; - - /* stream meta information */ - /* NEVER access directly, use helpers (see info_helper.c) */ - pthread_mutex_t info_mutex; - int stream_info_public[XINE_STREAM_INFO_MAX]; - int stream_info[XINE_STREAM_INFO_MAX]; - pthread_mutex_t meta_mutex; - char *meta_info_public[XINE_STREAM_INFO_MAX]; - char *meta_info[XINE_STREAM_INFO_MAX]; - - /* seeking slowdown */ - pthread_mutex_t first_frame_lock; - pthread_cond_t first_frame_reached; - - /* wait for headers sent / stream decoding finished */ - pthread_mutex_t counter_lock; - pthread_cond_t counter_changed; - int header_count_audio; - int header_count_video; - int finished_count_audio; - int finished_count_video; - - /* event mechanism */ - xine_list_t *event_queues; - pthread_mutex_t event_queues_lock; - - /* demux thread stuff */ - pthread_t demux_thread; - pthread_mutex_t demux_lock; - pthread_mutex_t demux_mutex; /* used in _x_demux_... functions to synchronize order of pairwise A/V buffer operations */ - - extra_info_t *current_extra_info; - pthread_mutex_t current_extra_info_lock; - int video_seek_count; - - int delay_finish_event; /* delay event in 1/10 sec units. 0=>no delay, -1=>forever */ - - int slave_affection; /* what operations need to be propagated down to the slave? */ - - int err; - - xine_post_out_t video_source; - xine_post_out_t audio_source; - - broadcaster_t *broadcaster; - - refcounter_t *refcounter; -#endif -}; - -/* when explicitly noted, some functions accept an anonymous stream, - * which is a valid stream that does not want to be addressed. */ -#define XINE_ANON_STREAM ((xine_stream_t *)-1) - - -/* - * private function prototypes: - */ - -int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *num_audio_buffers, int *num_video_frames, int *num_audio_frames) XINE_PROTECTED; -int _x_lock_port_rewiring(xine_t *xine, int ms_to_time_out) XINE_PROTECTED; -void _x_unlock_port_rewiring(xine_t *xine) XINE_PROTECTED; -int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out) XINE_PROTECTED; -void _x_unlock_frontend(xine_stream_t *stream) XINE_PROTECTED; -int _x_query_unprocessed_osd_events(xine_stream_t *stream) XINE_PROTECTED; -int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing) XINE_PROTECTED; -int _x_continue_stream_processing(xine_stream_t *stream) XINE_PROTECTED; -void _x_trigger_relaxed_frame_drop_mode(xine_stream_t *stream) XINE_PROTECTED; -void _x_reset_relaxed_frame_drop_mode(xine_stream_t *stream) XINE_PROTECTED; - -void _x_handle_stream_end (xine_stream_t *stream, int non_user) XINE_PROTECTED; - -/* report message to UI. usually these are async errors */ - -int _x_message(xine_stream_t *stream, int type, ...) XINE_SENTINEL XINE_PROTECTED; - -/* flush the message queues */ - -void _x_flush_events_queues (xine_stream_t *stream) XINE_PROTECTED; - - -/* find and instantiate input and demux plugins */ - -input_plugin_t *_x_find_input_plugin (xine_stream_t *stream, const char *mrl) XINE_PROTECTED; -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; -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; - -/* create decoder fifos and threads */ - -int _x_video_decoder_init (xine_stream_t *stream) XINE_PROTECTED; -void _x_video_decoder_shutdown (xine_stream_t *stream) XINE_PROTECTED; - -int _x_audio_decoder_init (xine_stream_t *stream) XINE_PROTECTED; -void _x_audio_decoder_shutdown (xine_stream_t *stream) XINE_PROTECTED; - -/* extra_info operations */ -void _x_extra_info_reset( extra_info_t *extra_info ) XINE_PROTECTED; - -void _x_extra_info_merge( extra_info_t *dst, extra_info_t *src ) XINE_PROTECTED; - -void _x_get_current_info (xine_stream_t *stream, extra_info_t *extra_info, int size) XINE_PROTECTED; - - -/* demuxer helper functions from demux.c */ - -/* - * Flush audio and video buffers. It is called from demuxers on - * seek/stop, and may be useful when user input changes a stream and - * xine-lib has cached buffers that have yet to be played. - * - * warning: after clearing decoders fifos an absolute discontinuity - * indication must be sent. relative discontinuities are likely - * to cause "jumps" on metronom. - */ -void _x_demux_flush_engine (xine_stream_t *stream) XINE_PROTECTED; - -void _x_demux_control_nop (xine_stream_t *stream, uint32_t flags) XINE_PROTECTED; -void _x_demux_control_newpts (xine_stream_t *stream, int64_t pts, uint32_t flags) XINE_PROTECTED; -void _x_demux_control_headers_done (xine_stream_t *stream) XINE_PROTECTED; -void _x_demux_control_start (xine_stream_t *stream) XINE_PROTECTED; -void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_PROTECTED; -int _x_demux_start_thread (xine_stream_t *stream) XINE_PROTECTED; -int _x_demux_stop_thread (xine_stream_t *stream) XINE_PROTECTED; -int _x_demux_read_header (input_plugin_t *input, unsigned char *buffer, off_t size) XINE_PROTECTED; -int _x_demux_check_extension (const char *mrl, const char *extensions); - -off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED; - -int _x_action_pending (xine_stream_t *stream) XINE_PROTECTED; - -void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, - int64_t pts, uint32_t type, uint32_t decoder_flags, - int input_normpos, int input_time, int total_time, - uint32_t frame_number) XINE_PROTECTED; - -int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, - int size, int64_t pts, uint32_t type, - uint32_t decoder_flags, off_t input_normpos, - int input_time, int total_time, - uint32_t frame_number) XINE_PROTECTED; - -void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative, - const char *mrl, const char *title, - int start_time, int duration) XINE_PROTECTED; - -/* - * MRL escaped-character decoding (overwrites the source string) - */ -void _x_mrl_unescape(char *mrl) XINE_PROTECTED; - -/* - * plugin_loader functions - * - */ - -/* on-demand loading of audio/video/spu decoder plugins */ - -video_decoder_t *_x_get_video_decoder (xine_stream_t *stream, uint8_t stream_type) XINE_PROTECTED; -void _x_free_video_decoder (xine_stream_t *stream, video_decoder_t *decoder) XINE_PROTECTED; -audio_decoder_t *_x_get_audio_decoder (xine_stream_t *stream, uint8_t stream_type) XINE_PROTECTED; -void _x_free_audio_decoder (xine_stream_t *stream, audio_decoder_t *decoder) XINE_PROTECTED; -spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) XINE_PROTECTED; -void _x_free_spu_decoder (xine_stream_t *stream, spu_decoder_t *decoder) XINE_PROTECTED; -/* check for decoder availability - but don't try to initialize it */ -int _x_decoder_available (xine_t *xine, uint32_t buftype) XINE_PROTECTED; - -/* - * load_video_output_plugin - * - * load a specific video output plugin - */ - -vo_driver_t *_x_load_video_output_plugin(xine_t *this, - char *id, int visual_type, void *visual) XINE_PROTECTED; - -/* - * audio output plugin dynamic loading stuff - */ - -/* - * load_audio_output_plugin - * - * load a specific audio output plugin - */ - -ao_driver_t *_x_load_audio_output_plugin (xine_t *self, const char *id) XINE_PROTECTED; - - -void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED; - -int _x_get_speed (xine_stream_t *stream) XINE_PROTECTED; - -void _x_set_fine_speed (xine_stream_t *stream, int speed) XINE_PROTECTED; - -int _x_get_fine_speed (xine_stream_t *stream) XINE_PROTECTED; - -void _x_select_spu_channel (xine_stream_t *stream, int channel) XINE_PROTECTED; - -int _x_get_audio_channel (xine_stream_t *stream) XINE_PROTECTED; - -int _x_get_spu_channel (xine_stream_t *stream) XINE_PROTECTED; - -/* - * internal events - */ - -/* sent by dvb frontend to inform ts demuxer of new pids */ -#define XINE_EVENT_PIDS_CHANGE 0x80000000 - -/* - * pids change event - inform ts demuxer of new pids - */ -typedef struct { - int vpid; /* video program id */ - int apid; /* audio program id */ -} xine_pids_data_t; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-engine/xine_plugin.h b/src/xine-engine/xine_plugin.h deleted file mode 100644 index 74e7523e9..000000000 --- a/src/xine-engine/xine_plugin.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2000-2003 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 - * - * generic plugin definitions - */ - -#ifndef XINE_PLUGIN_H -#define XINE_PLUGIN_H - -#define PLUGIN_NONE 0 -#define PLUGIN_INPUT 1 -#define PLUGIN_DEMUX 2 -#define PLUGIN_AUDIO_DECODER 3 -#define PLUGIN_VIDEO_DECODER 4 -#define PLUGIN_SPU_DECODER 5 -#define PLUGIN_AUDIO_OUT 6 -#define PLUGIN_VIDEO_OUT 7 -#define PLUGIN_POST 8 - -#define PLUGIN_TYPE_MAX PLUGIN_POST - -/* this flag may be or'ed with type in order to force preloading the plugin. - * very useful to register config items on xine initialization. - */ -#define PLUGIN_MUST_PRELOAD (1 << 7) - -/* this flag may be or'ed with type to prevent the plugin loader from unloading - * the plugin - */ -#define PLUGIN_NO_UNLOAD (1 << 6) - -#define PLUGIN_TYPE_MASK ((1 << 6) - 1) - -typedef struct { - uint8_t type; /* one of the PLUGIN_* constants above */ - uint8_t API; /* API version supported by this plugin */ - char *id; /* a name that identifies this plugin */ - uint32_t version; /* version number, increased every release */ - const void *special_info; /* plugin-type specific, see structs below */ - void *(*init)(xine_t *, void *); /* init the plugin class */ -} plugin_info_t; - - -/* special_info for a video output plugin */ -typedef struct { - int priority; /* priority of this plugin for auto-probing */ - int visual_type; /* visual type supported by this plugin */ -} vo_info_t; - -/* special info for a audio output plugin */ -typedef struct { - int priority; -} ao_info_t; - -/* special_info for a decoder plugin */ -typedef struct { - uint32_t *supported_types; /* streamtypes this decoder can handle */ - int priority; -} decoder_info_t; - -/* special info for a post plugin */ -typedef struct { - uint32_t type; /* type of the post plugin, use one of XINE_POST_TYPE_* */ -} post_info_t; - -/* special info for a demuxer plugin */ -typedef struct { - int priority; -} demuxer_info_t; - -/* special info for an input plugin */ -typedef struct { - int priority; -} input_info_t; - - -/* register a list of statically linked plugins - * info is a list of plugin_info_t terminated by PLUGIN_NONE - * example: - * plugin_info_t acme_plugin_info[] = { - * { PLUGIN_VIDEO_OUT, 21, "acme", XINE_VERSION_CODE, &vo_info_acme, - * init_class_acme }, - * { PLUGIN_NONE, 0, "", 0, NULL, NULL } - * }; - * - */ -void xine_register_plugins(xine_t *self, plugin_info_t *info) XINE_PROTECTED; - -#endif diff --git a/src/xine-engine/xineintl.h b/src/xine-engine/xineintl.h deleted file mode 100644 index 113a033fa..000000000 --- a/src/xine-engine/xineintl.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2000-2005 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_XINEINTL_H -#define HAVE_XINEINTL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <locale.h> - -#ifdef ENABLE_NLS -# include <libintl.h> -# define _(String) dgettext (XINE_TEXTDOMAIN, String) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -/* Stubs that do something close enough. */ -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,Message) (Message) -# define dcgettext(Domain,Message,Type) (Message) -# define ngettext(Singular, Plural, IsPlural) (Singular) -# define bindtextdomain(Domain,Directory) (Domain) -# define _(String) (String) -# define N_(String) (String) -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index bacb2720f..6509f1178 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -7,19 +7,6 @@ EXTRA_DIST = ppcasm_string.S ppc_asm.tmpl noinst_HEADERS = ppcasm_string.h xine_check.h -xineinclude_HEADERS = \ - attributes.h \ - compat.h \ - xine_buffer.h \ - xineutils.h \ - xmllexer.h \ - xmlparser.h \ - list.h \ - array.h \ - sorted_array.h \ - pool.h \ - ring_buffer.h - noinst_LTLIBRARIES = libxineutils.la if ARCH_PPC @@ -29,6 +16,8 @@ endif endif libxineutils_la_SOURCES = $(pppc_files) \ + base64.h \ + base64.c \ cpu_accel.c \ color.c \ copy.c \ diff --git a/src/xine-utils/array.c b/src/xine-utils/array.c index 6c226c7ef..0db45be0c 100644 --- a/src/xine-utils/array.c +++ b/src/xine-utils/array.c @@ -23,8 +23,8 @@ #include <stdlib.h> #include <string.h> -#include "attributes.h" -#include "array.h" +#include <xine/attributes.h> +#include <xine/array.h> #define MIN_CHUNK_SIZE 32 @@ -56,7 +56,7 @@ xine_array_t *xine_array_new(size_t initial_size) { if (initial_size < MIN_CHUNK_SIZE) initial_size = MIN_CHUNK_SIZE; - new_array->chunk = (void**)malloc(sizeof(void*) * initial_size); + new_array->chunk = (void**)calloc(initial_size, sizeof(void*)); if (!new_array->chunk) { free(new_array); return NULL; diff --git a/src/xine-utils/array.h b/src/xine-utils/array.h deleted file mode 100644 index ae2093823..000000000 --- a/src/xine-utils/array.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * Array that can grow automatically when you add elements. - * Inserting an element in the middle of the array implies memory moves. - */ -#ifndef XINE_ARRAY_H -#define XINE_ARRAY_H - -/* Array type */ -typedef struct xine_array_s xine_array_t; - -/* Constructor */ -xine_array_t *xine_array_new(size_t initial_size) XINE_PROTECTED; - -/* Destructor */ -void xine_array_delete(xine_array_t *array) XINE_PROTECTED; - -/* Returns the number of element stored in the array */ -size_t xine_array_size(const xine_array_t *array) XINE_PROTECTED; - -/* Removes all elements from an array */ -void xine_array_clear(xine_array_t *array) XINE_PROTECTED; - -/* Adds the element at the end of the array */ -void xine_array_add(xine_array_t *array, void *value) XINE_PROTECTED; - -/* Inserts an element into an array at the position specified */ -void xine_array_insert(xine_array_t *array, unsigned int position, void *value) XINE_PROTECTED; - -/* Removes one element from an array at the position specified */ -void xine_array_remove(xine_array_t *array, unsigned int position) XINE_PROTECTED; - -/* Get the element at the position specified */ -void *xine_array_get(const xine_array_t *array, unsigned int position) XINE_PROTECTED; - -/* Set the element at the position specified */ -void xine_array_set(xine_array_t *array, unsigned int position, void *value) XINE_PROTECTED; - -#endif - diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h deleted file mode 100644 index b25c76572..000000000 --- a/src/xine-utils/attributes.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * attributes.h - * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca> - * Copyright (C) 2001-2007 xine developers - * - * This file was originally part of mpeg2dec, a free MPEG-2 video stream - * decoder. - * - * mpeg2dec 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. - * - * mpeg2dec 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 - */ - -/* use gcc attribs to align critical data structures */ - -#ifndef ATTRIBUTE_H_ -#define ATTRIBUTE_H_ - -#ifdef ATTRIBUTE_ALIGNED_MAX -#define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) -#else -#define ATTR_ALIGN(align) -#endif - -#ifdef XINE_COMPILE -# include "configure.h" -#endif - -/* Export protected only for libxine functions */ -#if defined(XINE_LIBRARY_COMPILE) && defined(SUPPORT_ATTRIBUTE_VISIBILITY_PROTECTED) -# define XINE_PROTECTED __attribute__((__visibility__("protected"))) -#elif defined(XINE_LIBRARY_COMPILE) && defined(SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT) -# define XINE_PROTECTED __attribute__((__visibility__("default"))) -#else -# define XINE_PROTECTED -#endif - -#ifdef SUPPORT_ATTRIBUTE_SENTINEL -# define XINE_SENTINEL __attribute__((__sentinel__)) -#else -# define XINE_SENTINEL -#endif - -#ifndef __attr_unused -# ifdef SUPPORT_ATTRIBUTE_UNUSED -# define __attr_unused __attribute__((__unused__)) -# else -# define __attr_unused -# endif -#endif - -/* Format attributes */ -#ifdef SUPPORT_ATTRIBUTE_FORMAT -# define XINE_FORMAT_PRINTF(fmt,var) __attribute__((__format__(__printf__, fmt, var))) -#else -# define XINE_FORMAT_PRINTF(fmt,var) -#endif -#ifdef SUPPORT_ATTRIBUTE_FORMAT_ARG -# define XINE_FORMAT_PRINTF_ARG(fmt) __attribute__((__format_arg__(fmt))) -#else -# define XINE_FORMAT_PRINTF_ARG(fmt) -#endif - -#ifdef SUPPORT_ATTRIBUTE_PACKED -# define XINE_PACKED __attribute__((packed)) -#else -# define XINE_PACKED -#endif - -#ifdef SUPPORT_ATTRIBUTE_MALLOC -# define XINE_MALLOC __attribute__((__malloc__)) -#else -# define XINE_MALLOC -#endif - -#endif /* ATTRIBUTE_H_ */ diff --git a/src/input/base64.c b/src/xine-utils/base64.c index ffb039802..5730f30db 100644 --- a/src/input/base64.c +++ b/src/xine-utils/base64.c @@ -83,6 +83,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <ctype.h> #include <stdio.h> #include <time.h> @@ -103,11 +107,11 @@ * Returns: destination as BASE64 */ -unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len) +unsigned char *_x_rfc822_binary (void *src,unsigned long srcl,unsigned long *len) { unsigned char *ret,*d; unsigned char *s = (unsigned char *) src; - char *v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; + static const char v[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; unsigned long i = ((srcl + 2) / 3) * 4; *len = i += 2 * ((i / 60) + 1); d = ret = (unsigned char *) malloc ((size_t) ++i); @@ -129,3 +133,66 @@ unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len) return ret; /* return the resulting string */ } + +char *_x_base64_encode (const void *src, unsigned long srcl, unsigned long *len) +{ + char *ret, *d; + unsigned char *s = (unsigned char *) src; + char *v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; + unsigned long i = ((srcl + 2) / 3) * 4; + *len = i; + d = ret = (char *) malloc ((size_t) ++i); + for (i = 0; srcl; s += 3) { /* process tuplets */ + *d++ = v[s[0] >> 2]; /* byte 1: high 6 bits (1) */ + /* byte 2: low 2 bits (1), high 4 bits (2) */ + *d++ = v[((s[0] << 4) + (--srcl ? (s[1] >> 4) : 0)) & 0x3f]; + /* byte 3: low 4 bits (2), high 2 bits (3) */ + *d++ = srcl ? v[((s[1] << 2) + (--srcl ? (s[2] >> 6) : 0)) & 0x3f] : '-'; + /* byte 4: low 6 bits (3) */ + *d++ = srcl ? v[s[2] & 0x3f] : '-'; + if (srcl) srcl--; /* count third character if processed */ + } + *d = '\0'; /* tie off string */ + + return ret; /* return the resulting string */ +} + +void *_x_base64_decode (const char *src, unsigned long srcl, unsigned long *len) +{ + void *ret; + unsigned char *d; + unsigned long i = ((srcl + 3) / 4) * 3; + *len = i; + d = ret = (void *) malloc ((size_t)i); + for (i = 0; srcl; src += 4) { /* process tuplets */ + unsigned char tuplet[4]; + int j; + + for (j = 0; j < 4; j += 1) { + if (srcl) { + if ((src[j] >= 'A') && (src[j] <= 'Z')) { + tuplet[j] = src[j] - 'A'; + } else if ((src[j] >= 'a') && (src[j] <= 'z')) { + tuplet[j] = src[j] - 'a' + 26; + } else if ((src[j] >= '0') && (src[j] <= '9')) { + tuplet[j] = src[j] - '0' + 52; + } else if (src[j] == '.') { + tuplet[j] = 62; + } else if (src[j] == '_') { + tuplet[j] = 63; + } else { + tuplet[j] = 64; + } + srcl--; + } else { + (*len)--; + } + } + + *d++ = (tuplet[0] << 2) + ((tuplet[1] & 0x3f) >> 4); + *d++ = (tuplet[1] << 4) + ((tuplet[2] & 0x3f) >> 2); + *d++ = (tuplet[2] << 6) + (tuplet[3] & 0x3f); + } + + return ret; /* return the resulting string */ +} diff --git a/src/input/base64.h b/src/xine-utils/base64.h index 5cc94d7f0..f22f9b0c4 100644 --- a/src/input/base64.h +++ b/src/xine-utils/base64.h @@ -86,6 +86,9 @@ #ifndef BASE64_H #define BASE64_H -unsigned char *rfc822_binary (void *src,unsigned long srcl,unsigned long *len); +unsigned char *_x_rfc822_binary (void *src,unsigned long srcl,unsigned long *len) XINE_PROTECTED; + +char *_x_base64_encode (const void *src, unsigned long srcl, unsigned long *len) XINE_PROTECTED; +void *_x_base64_decode (const char *src, unsigned long srcl, unsigned long *len) XINE_PROTECTED; #endif diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index 0b9cf0188..dc2c7e5e5 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -62,7 +62,7 @@ * instructions. */ -#include "xine_internal.h" +#include <xine/xine_internal.h> /* * In search of the perfect colorspace conversion formulae... diff --git a/src/xine-utils/compat.h b/src/xine-utils/compat.h deleted file mode 100644 index d4b95aeb3..000000000 --- a/src/xine-utils/compat.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2000-2001 the xine project - * - * This file is part of xine, a unix 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 XINE_COMPAT_H -#define XINE_COMPAT_H - -#include <limits.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined _MSC_VER -#define __XINE_FUNCTION__ __FILE__ -#elif defined __GNUC__ -#define __XINE_FUNCTION__ __FUNCTION__ -#else -#define __XINE_FUNCTION__ __func__ -#endif - -#ifndef NAME_MAX -#define XINE_NAME_MAX 256 -#else -#define XINE_NAME_MAX NAME_MAX -#endif - -#ifndef PATH_MAX -#define XINE_PATH_MAX 768 -#else -#define XINE_PATH_MAX PATH_MAX -#endif - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-utils/copy.c b/src/xine-utils/copy.c index ed42b3a88..500b6db73 100644 --- a/src/xine-utils/copy.c +++ b/src/xine-utils/copy.c @@ -25,7 +25,7 @@ #include "config.h" #endif -#include "xineutils.h" +#include <xine/xineutils.h> void yv12_to_yv12 (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dst, int y_dst_pitch, diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 8bad23db9..07978b55f 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -39,7 +39,7 @@ #define LOG */ -#include "xineutils.h" +#include <xine/xineutils.h> #if defined(__i386__) || defined(__x86_64__) diff --git a/src/xine-utils/crc.c b/src/xine-utils/crc.c index ba0e3010b..4f720e9cc 100644 --- a/src/xine-utils/crc.c +++ b/src/xine-utils/crc.c @@ -20,7 +20,7 @@ * Common CRC calculation code. */ -#include "xineutils.h" +#include <xine/xineutils.h> static const uint32_t crc32_table[256] = { 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, diff --git a/src/xine-utils/list.c b/src/xine-utils/list.c index 65bdaec26..7a2b521bd 100644 --- a/src/xine-utils/list.c +++ b/src/xine-utils/list.c @@ -23,8 +23,8 @@ #endif #include <stdlib.h> -#include "attributes.h" -#include "list.h" +#include <xine/attributes.h> +#include <xine/list.h> #define MIN_CHUNK_SIZE 32 #define MAX_CHUNK_SIZE 65536 diff --git a/src/xine-utils/list.h b/src/xine-utils/list.h deleted file mode 100644 index e00e30d6c..000000000 --- a/src/xine-utils/list.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * Doubly-linked linked list. - * - * Exemples: - * - * Create a list: - * xine_list_t *list = xine_list_new(); - * - * Delete a list: - * xine_list_delete(list); - * - * Walk thru a list: - * xine_list_iterator_t ite = xine_list_front(list); - * while (ite) { - * _useful code here_ - * ite = xine_list_next(list, ite); - * } - * - * The list elements are managed using memory chunks and a free list. The first - * chunk contains 32 elements, each following chunk is two time as big as the - * previous one, with a limit of 64K elements. - */ -#ifndef XINE_LIST_H -#define XINE_LIST_H - -/* Doubly-linked list type */ -typedef struct xine_list_s xine_list_t; - -/* List iterator */ -typedef void* xine_list_iterator_t; - -/* Constructor */ -xine_list_t *xine_list_new(void) XINE_PROTECTED; - -/* Destructor */ -void xine_list_delete(xine_list_t *list) XINE_PROTECTED; - -/* Returns the number of element stored in the list */ -unsigned int xine_list_size(xine_list_t *list) XINE_PROTECTED; - -/* Returns true if the number of elements is zero, false otherwise */ -unsigned int xine_list_empty(xine_list_t *list) XINE_PROTECTED; - -/* Adds the element at the beginning of the list */ -void xine_list_push_front(xine_list_t *list, void *value) XINE_PROTECTED; - -/* Adds the element at the end of the list */ -void xine_list_push_back(xine_list_t *list, void *value) XINE_PROTECTED; - -/* Remove all elements from a list */ -void xine_list_clear(xine_list_t *list) XINE_PROTECTED; - -/* Insert the element elem into the list at the position specified by the - iterator (before the element, if any, that was previously at the iterator's - position). The return value is an iterator that specifies the position of - the inserted element. */ -xine_list_iterator_t xine_list_insert(xine_list_t *list, - xine_list_iterator_t position, - void *value) XINE_PROTECTED; - -/* Remove one element from a list.*/ -void xine_list_remove(xine_list_t *list, xine_list_iterator_t position) XINE_PROTECTED; - -/* Returns an iterator that references the first element of the list */ -xine_list_iterator_t xine_list_front(xine_list_t *list) XINE_PROTECTED; - -/* Returns an iterator that references the last element of the list */ -xine_list_iterator_t xine_list_back(xine_list_t *list) XINE_PROTECTED; - -/* Perform a linear search of a given value, and returns an iterator that - references this value or NULL if not found */ -xine_list_iterator_t xine_list_find(xine_list_t *list, void *value) XINE_PROTECTED; - -/* Increments the iterator's value, so it specifies the next element in the list - or NULL at the end of the list */ -xine_list_iterator_t xine_list_next(xine_list_t *list, xine_list_iterator_t ite) XINE_PROTECTED; - -/* Increments the iterator's value, so it specifies the previous element in the list - or NULL at the beginning of the list */ -xine_list_iterator_t xine_list_prev(xine_list_t *list, xine_list_iterator_t ite) XINE_PROTECTED; - -/* Returns the value at the position specified by the iterator */ -void *xine_list_get_value(xine_list_t *list, xine_list_iterator_t ite) XINE_PROTECTED; - -#endif - diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index da4b83b09..45009d23c 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -50,7 +50,7 @@ #define LOG */ -#include "xine_internal.h" +#include <xine/xine_internal.h> void *(* xine_fast_memcpy)(void *to, const void *from, size_t len); @@ -382,30 +382,29 @@ static void *linux_kernel_memcpy(void *to, const void *from, size_t len) { #endif /* _MSC_VER */ #endif /* ARCH_X86 */ -static struct { - char *const name; +static const struct { + const char name[16]; void *(*const function)(void *to, const void *from, size_t len); - uint64_t time; /* This type could be used for non-MSC build too! */ - uint32_t cpu_require; } memcpy_method[] = { - { NULL, NULL, 0, 0 }, - { "libc memcpy()", memcpy, 0, 0 }, + { "", NULL, 0 }, + { "libc", memcpy, 0 }, #if (defined(ARCH_X86) || defined(ARCH_X86_64)) && !defined(_MSC_VER) - { "linux kernel memcpy()", linux_kernel_memcpy, 0, 0 }, - { "MMX optimized memcpy()", mmx_memcpy, 0, MM_MMX }, - { "MMXEXT optimized memcpy()", mmx2_memcpy, 0, MM_MMXEXT }, - { "SSE optimized memcpy()", sse_memcpy, 0, MM_MMXEXT|MM_SSE }, + { "linux kernel", linux_kernel_memcpy, 0 }, + { "MMX ", mmx_memcpy, MM_MMX }, + { "MMXEXT", mmx2_memcpy, MM_MMXEXT }, + { "SSE", sse_memcpy, MM_MMXEXT|MM_SSE }, #endif /* ARCH_X86 */ #if defined (ARCH_PPC) && !defined (HOST_OS_DARWIN) - { "ppcasm_memcpy()", ppcasm_memcpy, 0, 0 }, - { "ppcasm_cacheable_memcpy()", ppcasm_cacheable_memcpy, 0, MM_ACCEL_PPC_CACHE32 }, + { "ppcasm", ppcasm_memcpy, 0 }, + { "ppcasm_cached", ppcasm_cacheable_memcpy, MM_ACCEL_PPC_CACHE32 }, #endif /* ARCH_PPC && !HOST_OS_DARWIN */ - { NULL, NULL, 0, 0 } }; +static uint64_t memcpy_timing[sizeof(memcpy_method)/sizeof(memcpy_method[0])] = { 0, }; + #if (defined(ARCH_X86) || defined(ARCH_X86_64)) && defined(HAVE_SYS_TIMES_H) static int64_t rdtsc(int config_flags) { @@ -446,7 +445,7 @@ static void update_fast_memcpy(void *user_data, xine_cfg_entry_t *entry) { if (method != 0 && (config_flags & memcpy_method[method].cpu_require) == memcpy_method[method].cpu_require ) { - lprintf("using %s\n", memcpy_method[method].name ); + lprintf("using %s memcpy()\n", memcpy_method[method].name ); xine_fast_memcpy = memcpy_method[method].function; return; } else { @@ -487,7 +486,7 @@ void xine_probe_fast_memcpy(xine_t *xine) if( best != 0 && (config_flags & memcpy_method[best].cpu_require) == memcpy_method[best].cpu_require ) { - lprintf("using %s\n", memcpy_method[best].name ); + lprintf("using %s memcpy()\n", memcpy_method[best].name ); xine_fast_memcpy = memcpy_method[best].function; return; } @@ -509,7 +508,7 @@ void xine_probe_fast_memcpy(xine_t *xine) memset(buf1,0,BUFSIZE); memset(buf2,0,BUFSIZE); - for(i=1; memcpy_method[i].name; i++) + for(i = 1; i < sizeof(memcpy_method)/sizeof(memcpy_method[0]); i++) { if( (config_flags & memcpy_method[i].cpu_require) != memcpy_method[i].cpu_require ) @@ -522,11 +521,11 @@ void xine_probe_fast_memcpy(xine_t *xine) } t = rdtsc(config_flags) - t; - memcpy_method[i].time = t; + memcpy_timing[i] = t; - xprintf(xine, XINE_VERBOSITY_LOG, "\t%s : %" PRIu64 "\n", memcpy_method[i].name, t); + xprintf(xine, XINE_VERBOSITY_LOG, "\t%s memcpy() : %" PRIu64 "\n", memcpy_method[i].name, t); - if( best == 0 || t < memcpy_method[best].time ) + if( best == 0 || t < memcpy_timing[best] ) best = i; } diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index 3c7c3e10a..8cbfdaa72 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -26,7 +26,7 @@ #include <stdio.h> #include <sys/time.h> -#include "xineutils.h" +#include <xine/xineutils.h> #define MAX_ID 10 diff --git a/src/xine-utils/pool.c b/src/xine-utils/pool.c index a1fddadd9..60330ef53 100644 --- a/src/xine-utils/pool.c +++ b/src/xine-utils/pool.c @@ -22,9 +22,9 @@ #endif #include <assert.h> -#include "attributes.h" -#include "pool.h" -#include "array.h" +#include <xine/attributes.h> +#include <xine/pool.h> +#include <xine/array.h> #define MIN_CHUNK_SIZE 32 #define MAX_CHUNK_SIZE 65536 diff --git a/src/xine-utils/pool.h b/src/xine-utils/pool.h deleted file mode 100644 index 918da82a2..000000000 --- a/src/xine-utils/pool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * Object Pool - */ - -#include <stdlib.h> -#include <inttypes.h> - -typedef struct xine_pool_s xine_pool_t; - -/* Creates a new pool - * object_size: sizeof(your struct) - * create_object: function called to create an object (can be NULL) - * prepare_object: function called to prepare an object to returned to the client (can be NULL) - * return_object: function called to prepare an object to returned to the pool (can be NULL) - * delete_object: function called to delete an object (can be NULL) - */ -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; - -/* Deletes a pool */ -void xine_pool_delete(xine_pool_t *pool) XINE_PROTECTED; - -/* Get an object from the pool */ -void *xine_pool_get(xine_pool_t *pool) XINE_PROTECTED; - -/* Returns an object to the pool */ -void xine_pool_put(xine_pool_t *pool, void *object) XINE_PROTECTED; diff --git a/src/xine-utils/ring_buffer.c b/src/xine-utils/ring_buffer.c index 031fda4fc..7042eaa68 100644 --- a/src/xine-utils/ring_buffer.c +++ b/src/xine-utils/ring_buffer.c @@ -27,10 +27,10 @@ #include <assert.h> #include <stdio.h> #include <string.h> -#include "attributes.h" -#include "pool.h" -#include "list.h" -#include "ring_buffer.h" +#include <xine/attributes.h> +#include <xine/pool.h> +#include <xine/list.h> +#include <xine/ring_buffer.h> #define RING_BUFFER_EXTRA_BUFFER_SIZE (1024 * 8) diff --git a/src/xine-utils/ring_buffer.h b/src/xine-utils/ring_buffer.h deleted file mode 100644 index efcffd3b7..000000000 --- a/src/xine-utils/ring_buffer.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * Fifo + Ring Buffer - */ -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; - -/* Deletes a ring buffer */ -void xine_ring_buffer_delete(xine_ring_buffer_t *ring_buffer) XINE_PROTECTED; - -/* Returns a new chunk of the specified size */ -/* Might block if the ring buffer is full */ -void *xine_ring_buffer_alloc(xine_ring_buffer_t *ring_buffer, size_t size) XINE_PROTECTED; - -/* Put a chunk into the ring */ -void xine_ring_buffer_put(xine_ring_buffer_t *ring_buffer, void *chunk) XINE_PROTECTED; - -/* Get a chunk of a specified size from the ring buffer - * Might block if the ring buffer is empty - * param size: the desired size - * param rsize: the size of the chunk returned - * rsize is not equal to size at the end of stream, the caller MUST check - * rsize value. - */ -void *xine_ring_buffer_get(xine_ring_buffer_t *ring_buffer, size_t size, size_t *rsize) XINE_PROTECTED; - -/* Releases the chunk, makes memory available for the alloc function */ -void xine_ring_buffer_release(xine_ring_buffer_t *ring_buffer, void *chunk) XINE_PROTECTED; - -/* Closes the ring buffer - * The writer uses this function to signal the end of stream to the reader. - * The reader MUST check the rsize value returned by the get function. - */ -void xine_ring_buffer_close(xine_ring_buffer_t *ring_buffer) XINE_PROTECTED; - - diff --git a/src/xine-utils/sorted_array.c b/src/xine-utils/sorted_array.c index 363325f0b..9dbe1fd0e 100644 --- a/src/xine-utils/sorted_array.c +++ b/src/xine-utils/sorted_array.c @@ -23,8 +23,8 @@ #include <stdlib.h> #include <string.h> -#include "attributes.h" -#include "sorted_array.h" +#include <xine/attributes.h> +#include <xine/sorted_array.h> /* Array internal struct */ struct xine_sarray_s { diff --git a/src/xine-utils/sorted_array.h b/src/xine-utils/sorted_array.h deleted file mode 100644 index a1894eca3..000000000 --- a/src/xine-utils/sorted_array.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 - * - * Sorted array which grows automatically when you add elements. - * A binary search is used to find the position of a new element. - * - * Example: - * Let's create de comparison method for integers: - * - * int int_comparator(void *a, void *b) { - * if ((int)a < (int)b) { - * return -1; - * } else if ((int)a == (int)b) { - * return 0; - * } else { - * return 1; - * } - * } - * - * Create a sorted array for integers: - * xine_sarray_t *sarray = xine_sarray_new(10, int_comparator); - * - * Add elements: - * xine_sarray_add(sarray, (void*)4); - * xine_sarray_add(sarray, (void*)28); - * xine_sarray_add(sarray, (void*)7); - * - * Find an element: - * int pos = xine_sarray_binary_search(sarray, (void*)7); - * if (pos >= 0) - * FOUND - * else - * NOT FOUND - * - * Delete the array: - * xine_sarray_delete(sarray); - */ -#ifndef XINE_SORTED_ARRAY_H -#define XINE_SORTED_ARRAY_H - -#include "array.h" - -/* Array type */ -typedef struct xine_sarray_s xine_sarray_t; - -/* Array element comparator */ -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; - -/* Destructor */ -void xine_sarray_delete(xine_sarray_t *sarray) XINE_PROTECTED; - -/* Returns the number of element stored in the array */ -size_t xine_sarray_size(const xine_sarray_t *sarray) XINE_PROTECTED; - -/* Removes all elements from an array */ -void xine_sarray_clear(xine_sarray_t *sarray) XINE_PROTECTED; - -/* Adds the element into the array - Returns the insertion position */ -int xine_sarray_add(xine_sarray_t *sarray, void *value) XINE_PROTECTED; - -/* Removes one element from an array at the position specified */ -void xine_sarray_remove(xine_sarray_t *sarray, unsigned int position) XINE_PROTECTED; - -/* Get the element at the position specified */ -void *xine_sarray_get(xine_sarray_t *sarray, unsigned int position) XINE_PROTECTED; - -/* Returns the index of the search key, if it is contained in the list. - Otherwise, (-(insertion point) - 1) or ~(insertion point). - The insertion point is defined as the point at which the key would be - inserted into the array. */ -int xine_sarray_binary_search(xine_sarray_t *sarray, void *key) XINE_PROTECTED; - -#endif - diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index d9eb7fb3f..8421b2374 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -27,10 +27,10 @@ #include "config.h" #endif -#include "xineutils.h" -#include "xineintl.h" +#include <xine/xineutils.h> +#include <xine/xineintl.h> #ifdef _MSC_VER -#include "xine_internal.h" +#include <xine/xine_internal.h> #endif #include <errno.h> @@ -57,10 +57,10 @@ #endif typedef struct { - char *language; /* name of the locale */ - char *encoding; /* typical encoding */ - char *spu_encoding; /* default spu encoding */ - char *modifier; + const char language[16]; /* name of the locale */ + const char encoding[16]; /* typical encoding */ + const char spu_encoding[16]; /* default spu encoding */ + const char modifier[8]; } lang_locale_t; @@ -68,172 +68,172 @@ typedef struct { * information about locales used in xine */ static const lang_locale_t lang_locales[] = { - { "af_ZA", "iso-8859-1", "iso-8859-1", NULL }, - { "ar_AE", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_BH", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_DZ", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_EG", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_IN", "utf-8", "utf-8", NULL }, - { "ar_IQ", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_JO", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_KW", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_LB", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_LY", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_MA", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_OM", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_QA", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_SA", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_SD", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_SY", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_TN", "iso-8859-6", "iso-8859-6", NULL }, - { "ar_YE", "iso-8859-6", "iso-8859-6", NULL }, - { "be_BY", "cp1251", "cp1251", NULL }, - { "bg_BG", "cp1251", "cp1251", NULL }, - { "br_FR", "iso-8859-1", "iso-88591", NULL }, - { "bs_BA", "iso-8859-2", "cp1250", NULL }, - { "ca_ES", "iso-8859-1", "iso-88591", NULL }, + { "af_ZA", "iso-8859-1", "iso-8859-1", "" }, + { "ar_AE", "iso-8859-6", "iso-8859-6", "" }, + { "ar_BH", "iso-8859-6", "iso-8859-6", "" }, + { "ar_DZ", "iso-8859-6", "iso-8859-6", "" }, + { "ar_EG", "iso-8859-6", "iso-8859-6", "" }, + { "ar_IN", "utf-8", "utf-8", "" }, + { "ar_IQ", "iso-8859-6", "iso-8859-6", "" }, + { "ar_JO", "iso-8859-6", "iso-8859-6", "" }, + { "ar_KW", "iso-8859-6", "iso-8859-6", "" }, + { "ar_LB", "iso-8859-6", "iso-8859-6", "" }, + { "ar_LY", "iso-8859-6", "iso-8859-6", "" }, + { "ar_MA", "iso-8859-6", "iso-8859-6", "" }, + { "ar_OM", "iso-8859-6", "iso-8859-6", "" }, + { "ar_QA", "iso-8859-6", "iso-8859-6", "" }, + { "ar_SA", "iso-8859-6", "iso-8859-6", "" }, + { "ar_SD", "iso-8859-6", "iso-8859-6", "" }, + { "ar_SY", "iso-8859-6", "iso-8859-6", "" }, + { "ar_TN", "iso-8859-6", "iso-8859-6", "" }, + { "ar_YE", "iso-8859-6", "iso-8859-6", "" }, + { "be_BY", "cp1251", "cp1251", "" }, + { "bg_BG", "cp1251", "cp1251", "" }, + { "br_FR", "iso-8859-1", "iso-88591", "" }, + { "bs_BA", "iso-8859-2", "cp1250", "" }, + { "ca_ES", "iso-8859-1", "iso-88591", "" }, { "ca_ES", "iso-8859-15", "iso-8859-15", "euro" }, - { "cs_CZ", "iso-8859-2", "cp1250", NULL }, - { "cy_GB", "iso-8859-14", "iso-8859-14", NULL }, - { "da_DK", "iso-8859-1", "iso-8859-1", NULL }, - { "de_AT", "iso-8859-1", "iso-8859-1", NULL }, + { "cs_CZ", "iso-8859-2", "cp1250", "" }, + { "cy_GB", "iso-8859-14", "iso-8859-14", "" }, + { "da_DK", "iso-8859-1", "iso-8859-1", "" }, + { "de_AT", "iso-8859-1", "iso-8859-1", "" }, { "de_AT", "iso-8859-15", "iso-8859-15", "euro" }, - { "de_BE", "iso-8859-1", "iso-8859-1", NULL }, + { "de_BE", "iso-8859-1", "iso-8859-1", "" }, { "de_BE", "iso-8859-15", "iso-8859-15", "euro" }, - { "de_CH", "iso-8859-1", "iso-8859-1", NULL }, - { "de_DE", "iso-8859-1", "iso-8859-1", NULL }, + { "de_CH", "iso-8859-1", "iso-8859-1", "" }, + { "de_DE", "iso-8859-1", "iso-8859-1", "" }, { "de_DE", "iso-8859-15", "iso-8859-15", "euro" }, - { "de_LU", "iso-8859-1", "iso-8859-1", NULL }, + { "de_LU", "iso-8859-1", "iso-8859-1", "" }, { "de_LU", "iso-8859-15", "iso-8859-15", "euro" }, - { "el_GR", "iso-8859-7", "iso-8859-7", NULL }, - { "en_AU", "iso-8859-1", "iso-8859-1", NULL }, - { "en_BW", "iso-8859-1", "iso-8859-1", NULL }, - { "en_CA", "iso-8859-1", "iso-8859-1", NULL }, - { "en_DK", "iso-8859-1", "iso-8859-1", NULL }, - { "en_GB", "iso-8859-1", "iso-8859-1", NULL }, - { "en_HK", "iso-8859-1", "iso-8859-1", NULL }, - { "en_IE", "iso-8859-1", "iso-8859-1", NULL }, + { "el_GR", "iso-8859-7", "iso-8859-7", "" }, + { "en_AU", "iso-8859-1", "iso-8859-1", "" }, + { "en_BW", "iso-8859-1", "iso-8859-1", "" }, + { "en_CA", "iso-8859-1", "iso-8859-1", "" }, + { "en_DK", "iso-8859-1", "iso-8859-1", "" }, + { "en_GB", "iso-8859-1", "iso-8859-1", "" }, + { "en_HK", "iso-8859-1", "iso-8859-1", "" }, + { "en_IE", "iso-8859-1", "iso-8859-1", "" }, { "en_IE", "iso-8859-15", "iso-8859-15", "euro" }, - { "en_IN", "utf-8", "utf-8", NULL }, - { "en_NZ", "iso-8859-1", "iso-8859-1", NULL }, - { "en_PH", "iso-8859-1", "iso-8859-1", NULL }, - { "en_SG", "iso-8859-1", "iso-8859-1", NULL }, - { "en_US", "iso-8859-1", "iso-8859-1", NULL }, - { "en_ZA", "iso-8859-1", "iso-8859-1", NULL }, - { "en_ZW", "iso-8859-1", "iso-8859-1", NULL }, - { "es_AR", "iso-8859-1", "iso-8859-1", NULL }, - { "es_BO", "iso-8859-1", "iso-8859-1", NULL }, - { "es_CL", "iso-8859-1", "iso-8859-1", NULL }, - { "es_CO", "iso-8859-1", "iso-8859-1", NULL }, - { "es_CR", "iso-8859-1", "iso-8859-1", NULL }, - { "es_DO", "iso-8859-1", "iso-8859-1", NULL }, - { "es_EC", "iso-8859-1", "iso-8859-1", NULL }, - { "es_ES", "iso-8859-1", "iso-8859-1", NULL }, + { "en_IN", "utf-8", "utf-8", "" }, + { "en_NZ", "iso-8859-1", "iso-8859-1", "" }, + { "en_PH", "iso-8859-1", "iso-8859-1", "" }, + { "en_SG", "iso-8859-1", "iso-8859-1", "" }, + { "en_US", "iso-8859-1", "iso-8859-1", "" }, + { "en_ZA", "iso-8859-1", "iso-8859-1", "" }, + { "en_ZW", "iso-8859-1", "iso-8859-1", "" }, + { "es_AR", "iso-8859-1", "iso-8859-1", "" }, + { "es_BO", "iso-8859-1", "iso-8859-1", "" }, + { "es_CL", "iso-8859-1", "iso-8859-1", "" }, + { "es_CO", "iso-8859-1", "iso-8859-1", "" }, + { "es_CR", "iso-8859-1", "iso-8859-1", "" }, + { "es_DO", "iso-8859-1", "iso-8859-1", "" }, + { "es_EC", "iso-8859-1", "iso-8859-1", "" }, + { "es_ES", "iso-8859-1", "iso-8859-1", "" }, { "es_ES", "iso-8859-15", "iso-8859-15", "euro" }, - { "es_GT", "iso-8859-1", "iso-8859-1", NULL }, - { "es_HN", "iso-8859-1", "iso-8859-1", NULL }, - { "es_MX", "iso-8859-1", "iso-8859-1", NULL }, - { "es_NI", "iso-8859-1", "iso-8859-1", NULL }, - { "es_PA", "iso-8859-1", "iso-8859-1", NULL }, - { "es_PE", "iso-8859-1", "iso-8859-1", NULL }, - { "es_PR", "iso-8859-1", "iso-8859-1", NULL }, - { "es_PY", "iso-8859-1", "iso-8859-1", NULL }, - { "es_SV", "iso-8859-1", "iso-8859-1", NULL }, - { "es_US", "iso-8859-1", "iso-8859-1", NULL }, - { "es_UY", "iso-8859-1", "iso-8859-1", NULL }, - { "es_VE", "iso-8859-1", "iso-8859-1", NULL }, - { "et_EE", "iso-8859-1", "iso-8859-1", NULL }, - { "eu_ES", "iso-8859-1", "iso-8859-1", NULL }, + { "es_GT", "iso-8859-1", "iso-8859-1", "" }, + { "es_HN", "iso-8859-1", "iso-8859-1", "" }, + { "es_MX", "iso-8859-1", "iso-8859-1", "" }, + { "es_NI", "iso-8859-1", "iso-8859-1", "" }, + { "es_PA", "iso-8859-1", "iso-8859-1", "" }, + { "es_PE", "iso-8859-1", "iso-8859-1", "" }, + { "es_PR", "iso-8859-1", "iso-8859-1", "" }, + { "es_PY", "iso-8859-1", "iso-8859-1", "" }, + { "es_SV", "iso-8859-1", "iso-8859-1", "" }, + { "es_US", "iso-8859-1", "iso-8859-1", "" }, + { "es_UY", "iso-8859-1", "iso-8859-1", "" }, + { "es_VE", "iso-8859-1", "iso-8859-1", "" }, + { "et_EE", "iso-8859-1", "iso-8859-1", "" }, + { "eu_ES", "iso-8859-1", "iso-8859-1", "" }, { "eu_ES", "iso-8859-15", "iso-8859-15", "euro" }, - { "fa_IR", "utf-8", "utf-8", NULL }, - { "fi_FI", "iso-8859-1", "iso-8859-1", NULL }, + { "fa_IR", "utf-8", "utf-8", "" }, + { "fi_FI", "iso-8859-1", "iso-8859-1", "" }, { "fi_FI", "iso-8859-15", "iso-8859-15", "euro" }, - { "fo_FO", "iso-8859-1", "iso-8859-1", NULL }, - { "fr_BE", "iso-8859-1", "iso-8859-1", NULL }, + { "fo_FO", "iso-8859-1", "iso-8859-1", "" }, + { "fr_BE", "iso-8859-1", "iso-8859-1", "" }, { "fr_BE", "iso-8859-15", "iso-8859-15", "euro" }, - { "fr_CA", "iso-8859-1", "iso-8859-1", NULL }, - { "fr_CH", "iso-8859-1", "iso-8859-1", NULL }, - { "fr_FR", "iso-8859-1", "iso-8859-1", NULL }, + { "fr_CA", "iso-8859-1", "iso-8859-1", "" }, + { "fr_CH", "iso-8859-1", "iso-8859-1", "" }, + { "fr_FR", "iso-8859-1", "iso-8859-1", "" }, { "fr_FR", "iso-8859-15", "iso-8859-15", "euro" }, - { "fr_LU", "iso-8859-1", "iso-8859-1", NULL }, + { "fr_LU", "iso-8859-1", "iso-8859-1", "" }, { "fr_LU", "iso-8859-15", "iso-8859-15", "euro" }, - { "ga_IE", "iso-8859-1", "iso-8859-1", NULL }, + { "ga_IE", "iso-8859-1", "iso-8859-1", "" }, { "ga_IE", "iso-8859-15", "iso-8859-15", "euro" }, - { "gl_ES", "iso-8859-1", "iso-8859-1", NULL }, + { "gl_ES", "iso-8859-1", "iso-8859-1", "" }, { "gl_ES", "iso-8859-15", "iso-8859-15", "euro" }, - { "gv_GB", "iso-8859-1", "iso-8859-1", NULL }, - { "he_IL", "iso-8859-8", "iso-8859-8", NULL }, - { "hi_IN", "utf-8", "utf-8", NULL }, - { "hr_HR", "iso-8859-2", "cp1250", NULL }, - { "hu_HU", "iso-8859-2", "cp1250", NULL }, - { "id_ID", "iso-8859-1", "iso-8859-1", NULL }, - { "is_IS", "iso-8859-1", "iso-8859-1", NULL }, - { "it_CH", "iso-8859-1", "iso-8859-1", NULL }, - { "it_IT", "iso-8859-1", "iso-8859-1", NULL }, + { "gv_GB", "iso-8859-1", "iso-8859-1", "" }, + { "he_IL", "iso-8859-8", "iso-8859-8", "" }, + { "hi_IN", "utf-8", "utf-8", "" }, + { "hr_HR", "iso-8859-2", "cp1250", "" }, + { "hu_HU", "iso-8859-2", "cp1250", "" }, + { "id_ID", "iso-8859-1", "iso-8859-1", "" }, + { "is_IS", "iso-8859-1", "iso-8859-1", "" }, + { "it_CH", "iso-8859-1", "iso-8859-1", "" }, + { "it_IT", "iso-8859-1", "iso-8859-1", "" }, { "it_IT", "iso-8859-15", "iso-8859-15", "euro" }, - { "iw_IL", "iso-8859-8", "iso-8859-8", NULL }, - { "ja_JP", "euc-jp", "euc-jp", NULL }, - { "ja_JP", "ujis", "ujis", NULL }, - { "japanese", "euc", "euc", NULL }, - { "ka_GE", "georgian-ps", "georgian-ps", NULL }, - { "kl_GL", "iso-8859-1", "iso-8859-1", NULL }, - { "ko_KR", "euc-kr", "euc-kr", NULL }, - { "ko_KR", "utf-8", "utf-8", NULL }, - { "korean", "euc", "euc", NULL }, - { "kw_GB", "iso-8859-1", "iso-8859-1", NULL }, - { "lt_LT", "iso-8859-13", "iso-8859-13", NULL }, - { "lv_LV", "iso-8859-13", "iso-8859-13", NULL }, - { "mi_NZ", "iso-8859-13", "iso-8859-13", NULL }, - { "mk_MK", "iso-8859-5", "cp1251", NULL }, - { "mr_IN", "utf-8", "utf-8", NULL }, - { "ms_MY", "iso-8859-1", "iso-8859-1", NULL }, - { "mt_MT", "iso-8859-3", "iso-8859-3", NULL }, - { "nb_NO", "ISO-8859-1", "ISO-8859-1", NULL }, - { "nl_BE", "iso-8859-1", "iso-8859-1", NULL }, + { "iw_IL", "iso-8859-8", "iso-8859-8", "" }, + { "ja_JP", "euc-jp", "euc-jp", "" }, + { "ja_JP", "ujis", "ujis", "" }, + { "japanese", "euc", "euc", "" }, + { "ka_GE", "georgian-ps", "georgian-ps", "" }, + { "kl_GL", "iso-8859-1", "iso-8859-1", "" }, + { "ko_KR", "euc-kr", "euc-kr", "" }, + { "ko_KR", "utf-8", "utf-8", "" }, + { "korean", "euc", "euc", "" }, + { "kw_GB", "iso-8859-1", "iso-8859-1", "" }, + { "lt_LT", "iso-8859-13", "iso-8859-13", "" }, + { "lv_LV", "iso-8859-13", "iso-8859-13", "" }, + { "mi_NZ", "iso-8859-13", "iso-8859-13", "" }, + { "mk_MK", "iso-8859-5", "cp1251", "" }, + { "mr_IN", "utf-8", "utf-8", "" }, + { "ms_MY", "iso-8859-1", "iso-8859-1", "" }, + { "mt_MT", "iso-8859-3", "iso-8859-3", "" }, + { "nb_NO", "ISO-8859-1", "ISO-8859-1", "" }, + { "nl_BE", "iso-8859-1", "iso-8859-1", "" }, { "nl_BE", "iso-8859-15", "iso-8859-15", "euro" }, - { "nl_NL", "iso-8859-1", "iso-8859-1", NULL }, + { "nl_NL", "iso-8859-1", "iso-8859-1", "" }, { "nl_NL", "iso-8859-15", "iso-8859-15", "euro" }, - { "nn_NO", "iso-8859-1", "iso-8859-1", NULL }, - { "no_NO", "iso-8859-1", "iso-8859-1", NULL }, - { "oc_FR", "iso-8859-1", "iso-8859-1", NULL }, - { "pl_PL", "iso-8859-2", "cp1250", NULL }, - { "pt_BR", "iso-8859-1", "iso-8859-1", NULL }, - { "pt_PT", "iso-8859-1", "iso-8859-1", NULL }, + { "nn_NO", "iso-8859-1", "iso-8859-1", "" }, + { "no_NO", "iso-8859-1", "iso-8859-1", "" }, + { "oc_FR", "iso-8859-1", "iso-8859-1", "" }, + { "pl_PL", "iso-8859-2", "cp1250", "" }, + { "pt_BR", "iso-8859-1", "iso-8859-1", "" }, + { "pt_PT", "iso-8859-1", "iso-8859-1", "" }, { "pt_PT", "iso-8859-15", "iso-8859-15", "euro" }, - { "ro_RO", "iso-8859-2", "cp1250", NULL }, - { "ru_RU", "iso-8859-5", "cp1251", NULL }, - { "ru_RU", "koi8-r", "cp1251", NULL }, - { "ru_UA", "koi8-u", "cp1251", NULL }, - { "se_NO", "utf-8", "utf-8", NULL }, - { "sk_SK", "iso-8859-2", "cp1250", NULL }, - { "sl_SI", "iso-8859-2", "cp1250", NULL }, - { "sq_AL", "iso-8859-1", "iso-8859-1", NULL }, - { "sr_YU", "iso-8859-2", "cp1250", NULL }, + { "ro_RO", "iso-8859-2", "cp1250", "" }, + { "ru_RU", "iso-8859-5", "cp1251", "" }, + { "ru_RU", "koi8-r", "cp1251", "" }, + { "ru_UA", "koi8-u", "cp1251", "" }, + { "se_NO", "utf-8", "utf-8", "" }, + { "sk_SK", "iso-8859-2", "cp1250", "" }, + { "sl_SI", "iso-8859-2", "cp1250", "" }, + { "sq_AL", "iso-8859-1", "iso-8859-1", "" }, + { "sr_YU", "iso-8859-2", "cp1250", "" }, { "sr_YU", "iso-8859-5", "cp1251", "cyrillic" }, - { "sv_FI", "iso-8859-1", "iso-8859-1", NULL }, + { "sv_FI", "iso-8859-1", "iso-8859-1", "" }, { "sv_FI", "iso-8859-15", "iso-8859-15", "euro" }, - { "sv_SE", "iso-8859-1", "iso-8859-1", NULL }, - { "ta_IN", "utf-8", "utf-8", NULL }, - { "te_IN", "utf-8", "utf-8", NULL }, - { "tg_TJ", "koi8-t", "cp1251", NULL }, - { "th_TH", "tis-620", "tis-620", NULL }, - { "tl_PH", "iso-8859-1", "iso-8859-1", NULL }, - { "tr_TR", "iso-8859-9", "iso-8859-9", NULL }, - { "uk_UA", "koi8-u", "cp1251", NULL }, - { "ur_PK", "utf-8", "utf-8", NULL }, - { "uz_UZ", "iso-8859-1", "iso-8859-1", NULL }, - { "vi_VN", "tcvn", "tcvn", NULL }, - { "vi_VN", "utf-8", "utf-8", NULL }, - { "wa_BE", "iso-8859-1", "iso-8859-1", NULL }, + { "sv_SE", "iso-8859-1", "iso-8859-1", "" }, + { "ta_IN", "utf-8", "utf-8", "" }, + { "te_IN", "utf-8", "utf-8", "" }, + { "tg_TJ", "koi8-t", "cp1251", "" }, + { "th_TH", "tis-620", "tis-620", "" }, + { "tl_PH", "iso-8859-1", "iso-8859-1", "" }, + { "tr_TR", "iso-8859-9", "iso-8859-9", "" }, + { "uk_UA", "koi8-u", "cp1251", "" }, + { "ur_PK", "utf-8", "utf-8", "" }, + { "uz_UZ", "iso-8859-1", "iso-8859-1", "" }, + { "vi_VN", "tcvn", "tcvn", "" }, + { "vi_VN", "utf-8", "utf-8", "" }, + { "wa_BE", "iso-8859-1", "iso-8859-1", "" }, { "wa_BE", "iso-8859-15", "iso-8859-15", "euro" }, - { "yi_US", "cp1255", "cp1255", NULL }, - { "zh_CN", "gb18030", "gb18030", NULL }, - { "zh_CN", "gb2312", "gb2312", NULL }, - { "zh_CN", "gbk", "gbk", NULL }, - { "zh_HK", "big5-hkscs", "big5-hkscs", NULL }, - { "zh_TW", "big-5", "big-5", NULL }, - { "zh_TW", "euc-tw", "euc-tw", NULL }, - { NULL, NULL, NULL, NULL } + { "yi_US", "cp1255", "cp1255", "" }, + { "zh_CN", "gb18030", "gb18030", "" }, + { "zh_CN", "gb2312", "gb2312", "" }, + { "zh_CN", "gbk", "gbk", "" }, + { "zh_HK", "big5-hkscs", "big5-hkscs", "" }, + { "zh_TW", "big-5", "big-5", "" }, + { "zh_TW", "euc-tw", "euc-tw", "" }, + { "" } }; @@ -286,6 +286,19 @@ void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) { return ptr; } +void *xine_memdup (const void *src, size_t length) +{ + void *dst = malloc (length); + return xine_fast_memcpy (dst, src, length); +} + +void *xine_memdup0 (const void *src, size_t length) +{ + char *dst = xine_xmalloc (length + 1); + dst[length] = 0; + return xine_fast_memcpy (dst, src, length); +} + #ifdef WIN32 /* * Parse command line with Windows XP syntax and copy the command (argv[0]). @@ -531,7 +544,7 @@ static const lang_locale_t *_get_first_lang_locale(const char *lcal) { else lang_len = strlen(lcal); - while(llocale->language) { + while(*(llocale->language)) { if(!strncmp(lcal, llocale->language, lang_len)) { if ((!mod && !llocale->modifier) || (mod && llocale->modifier && !strcmp(mod, llocale->modifier))) return llocale; diff --git a/src/xine-utils/xine_buffer.c b/src/xine-utils/xine_buffer.c index 190ab5197..3891aec11 100644 --- a/src/xine-utils/xine_buffer.c +++ b/src/xine-utils/xine_buffer.c @@ -58,7 +58,7 @@ #define LOG */ -#include "xineutils.h" +#include <xine/xineutils.h> #define CHECKS diff --git a/src/xine-utils/xine_buffer.h b/src/xine-utils/xine_buffer.h deleted file mode 100644 index 84511bd1b..000000000 --- a/src/xine-utils/xine_buffer.h +++ /dev/null @@ -1,136 +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 - * - * - * generic dynamic buffer functions. The goals - * of these functions are (in fact many of these points - * are todos): - * - dynamic allocation and reallocation depending - * on the size of data written to it. - * - fast and transparent access to the data. - * The user sees only the raw data chunk as it is - * returned by the well-known malloc function. - * This is necessary since not all data-accessing - * functions can be wrapped here. - * - some additional health checks are made during - * development (eg boundary checks after direct - * access to a buffer). This can be turned off in - * production state for higher performance. - * - A lot of convenient string and memory manipulation - * functions are implemented here, where the user - * do not have to care about memory chunk sizes. - * - Some garbage collention could be implemented as well; - * i think of a global structure containing infos - * about all allocated chunks. This must be implemented - * in a thread-save way... - * - * Here are some drawbacks (aka policies): - * - The user must not pass indexed buffers to xine_buffer_* - * functions. - * - The pointers passed to xine_buffer_* functions may change - * (eg during reallocation). The user must respect that. - */ - -#ifndef HAVE_XINE_BUFFER_H -#define HAVE_XINE_BUFFER_H - -#ifdef XINE_COMPILE -# include <inttypes.h> -#else -# include <xine/os_types.h> -#endif - -/* - * returns an initialized pointer to a buffer. - * The buffer will be allocated in blocks of - * chunk_size bytes. This will prevent permanent - * reallocation on slow growing buffers. - */ -void *xine_buffer_init(int chunk_size) XINE_PROTECTED; - -/* - * frees a buffer, the macro ensures, that a freed - * buffer pointer is set to NULL - */ -#define xine_buffer_free(buf) buf=_xine_buffer_free(buf) -void *_xine_buffer_free(void *buf) XINE_PROTECTED; - -/* - * duplicates a buffer - */ -void *xine_buffer_dup(const void *buf) XINE_PROTECTED; - -/* - * will copy len bytes of data into buf at position index. - */ -#define xine_buffer_copyin(buf,i,data,len) \ - buf=_xine_buffer_copyin(buf,i,data,len) -void *_xine_buffer_copyin(void *buf, int index, const void *data, int len) XINE_PROTECTED; - -/* - * will copy len bytes out of buf+index into data. - * no checks are made in data. It is treated as an ordinary - * user-malloced data chunk. - */ -void xine_buffer_copyout(const void *buf, int index, void *data, int len) XINE_PROTECTED; - -/* - * set len bytes in buf+index to b. - */ -#define xine_buffer_set(buf,i,b,len) \ - buf=_xine_buffer_set(buf,i,b,len) -void *_xine_buffer_set(void *buf, int index, uint8_t b, int len) XINE_PROTECTED; - -/* - * concatenates given buf (which should contain a null terminated string) - * with another string. - */ -#define xine_buffer_strcat(buf,data) \ - buf=_xine_buffer_strcat(buf,data) -void *_xine_buffer_strcat(void *buf, const char *data) XINE_PROTECTED; - -/* - * copies given string to buf+index - */ -#define xine_buffer_strcpy(buf,index,data) \ - buf=_xine_buffer_strcpy(buf,index,data) -void *_xine_buffer_strcpy(void *buf, int index, const char *data) XINE_PROTECTED; - -/* - * returns a pointer to the first occurence of ch. - * note, that the returned pointer cannot be used - * in any other xine_buffer_* functions. - */ -char *xine_buffer_strchr(const void *buf, int ch) XINE_PROTECTED; - -/* - * get allocated memory size - */ -int xine_buffer_get_size(const void *buf) XINE_PROTECTED; - -/* - * ensures a specified buffer size if the user want to - * write directly to the buffer. Normally the special - * access functions defined here should be used. - */ -#define xine_buffer_ensure_size(buf,data) \ - buf=_xine_buffer_ensure_size(buf,data) -void *_xine_buffer_ensure_size(void *buf, int size) XINE_PROTECTED; - -#endif diff --git a/src/xine-utils/xine_check.c b/src/xine-utils/xine_check.c index f00a23832..e850f9f48 100644 --- a/src/xine-utils/xine_check.c +++ b/src/xine-utils/xine_check.c @@ -45,7 +45,7 @@ #include <unistd.h> #include "xine_check.h" -#include "xineutils.h" +#include <xine/xineutils.h> #if defined(__linux__) diff --git a/src/xine-utils/xine_check.h b/src/xine-utils/xine_check.h index 4b21bf74e..75eda102d 100644 --- a/src/xine-utils/xine_check.h +++ b/src/xine-utils/xine_check.h @@ -2,11 +2,7 @@ #define XINE_CHECK_H #include <stdio.h> -#ifdef XINE_COMPILE -# include "xine.h" -#else -# include <xine.h> -#endif +#include <xine.h> /* * Start checking xine setup here diff --git a/src/xine-utils/xine_mutex.c b/src/xine-utils/xine_mutex.c index c94f32be0..52d17d8e5 100644 --- a/src/xine-utils/xine_mutex.c +++ b/src/xine-utils/xine_mutex.c @@ -24,7 +24,7 @@ #include <stdio.h> #include <pthread.h> -#include "xineutils.h" +#include <xine/xineutils.h> /* #define DBG_MUTEX diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h deleted file mode 100644 index 3296b2ba9..000000000 --- a/src/xine-utils/xineutils.h +++ /dev/null @@ -1,987 +0,0 @@ -/* - * Copyright (C) 2000-2006 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 XINEUTILS_H -#define XINEUTILS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <pthread.h> - -#ifdef XINE_COMPILE -# include <inttypes.h> -# include "attributes.h" -# include "compat.h" -# include "xmlparser.h" -# include "xine_buffer.h" -# include "configfile.h" -# include "list.h" -# include "array.h" -# include "sorted_array.h" -#else -# ifdef WIN32 -# include <winsock.h> -# else -# include <sys/time.h> -# endif -# include <xine/os_types.h> -# include <xine/attributes.h> -# include <xine/compat.h> -# include <xine/xmlparser.h> -# include <xine/xine_buffer.h> -# include <xine/configfile.h> -# include <xine/list.h> -# include <xine/array.h> -# include <xine/sorted_array.h> -#endif - -#include <stdio.h> -#include <string.h> - -/* - * Mark exported data symbols for link engine library clients with older - * Win32 compilers - */ -#if defined(WIN32) && !defined(XINE_LIBRARY_COMPILE) -# define DL_IMPORT __declspec(dllimport) -# define extern DL_IMPORT extern -#endif - - /* - * debugable mutexes - */ - - typedef struct { - pthread_mutex_t mutex; - char id[80]; - char *locked_by; - } xine_mutex_t; - - int xine_mutex_init (xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr, - const char *id) XINE_PROTECTED; - - int xine_mutex_lock (xine_mutex_t *mutex, const char *who) XINE_PROTECTED; - int xine_mutex_unlock (xine_mutex_t *mutex, const char *who) XINE_PROTECTED; - int xine_mutex_destroy (xine_mutex_t *mutex) XINE_PROTECTED; - - - - /* CPU Acceleration */ - -/* - * The type of an value that fits in an MMX register (note that long - * long constant values MUST be suffixed by LL and unsigned long long - * values by ULL, lest they be truncated by the compiler) - */ - -/* generic accelerations */ -#define MM_ACCEL_MLIB 0x00000001 - -/* x86 accelerations */ -#define MM_ACCEL_X86_MMX 0x80000000 -#define MM_ACCEL_X86_3DNOW 0x40000000 -#define MM_ACCEL_X86_MMXEXT 0x20000000 -#define MM_ACCEL_X86_SSE 0x10000000 -#define MM_ACCEL_X86_SSE2 0x08000000 - -/* powerpc accelerations and features */ -#define MM_ACCEL_PPC_ALTIVEC 0x04000000 -#define MM_ACCEL_PPC_CACHE32 0x02000000 - -/* SPARC accelerations */ - -#define MM_ACCEL_SPARC_VIS 0x01000000 -#define MM_ACCEL_SPARC_VIS2 0x00800000 - -/* x86 compat defines */ -#define MM_MMX MM_ACCEL_X86_MMX -#define MM_3DNOW MM_ACCEL_X86_3DNOW -#define MM_MMXEXT MM_ACCEL_X86_MMXEXT -#define MM_SSE MM_ACCEL_X86_SSE -#define MM_SSE2 MM_ACCEL_X86_SSE2 - -uint32_t xine_mm_accel (void) XINE_PROTECTED; - -#if defined(ARCH_X86) || defined(ARCH_X86_64) - -typedef union { - int64_t q; /* Quadword (64-bit) value */ - uint64_t uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} ATTR_ALIGN(8) mmx_t; /* On an 8-byte (64-bit) boundary */ - - - -#define mmx_i2r(op,imm,reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "i" (imm) ) - -#define mmx_m2r(op,mem,reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "m" (mem)) - -#define mmx_r2m(op,reg,mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=m" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op,regs,regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - - -#define emms() __asm__ __volatile__ ("emms") - -#define movd_m2r(var,reg) mmx_m2r (movd, var, reg) -#define movd_r2m(reg,var) mmx_r2m (movd, reg, var) -#define movd_r2r(regs,regd) mmx_r2r (movd, regs, regd) - -#define movq_m2r(var,reg) mmx_m2r (movq, var, reg) -#define movq_r2m(reg,var) mmx_r2m (movq, reg, var) -#define movq_r2r(regs,regd) mmx_r2r (movq, regs, regd) - -#define packssdw_m2r(var,reg) mmx_m2r (packssdw, var, reg) -#define packssdw_r2r(regs,regd) mmx_r2r (packssdw, regs, regd) -#define packsswb_m2r(var,reg) mmx_m2r (packsswb, var, reg) -#define packsswb_r2r(regs,regd) mmx_r2r (packsswb, regs, regd) - -#define packuswb_m2r(var,reg) mmx_m2r (packuswb, var, reg) -#define packuswb_r2r(regs,regd) mmx_r2r (packuswb, regs, regd) - -#define paddb_m2r(var,reg) mmx_m2r (paddb, var, reg) -#define paddb_r2r(regs,regd) mmx_r2r (paddb, regs, regd) -#define paddd_m2r(var,reg) mmx_m2r (paddd, var, reg) -#define paddd_r2r(regs,regd) mmx_r2r (paddd, regs, regd) -#define paddw_m2r(var,reg) mmx_m2r (paddw, var, reg) -#define paddw_r2r(regs,regd) mmx_r2r (paddw, regs, regd) - -#define paddsb_m2r(var,reg) mmx_m2r (paddsb, var, reg) -#define paddsb_r2r(regs,regd) mmx_r2r (paddsb, regs, regd) -#define paddsw_m2r(var,reg) mmx_m2r (paddsw, var, reg) -#define paddsw_r2r(regs,regd) mmx_r2r (paddsw, regs, regd) - -#define paddusb_m2r(var,reg) mmx_m2r (paddusb, var, reg) -#define paddusb_r2r(regs,regd) mmx_r2r (paddusb, regs, regd) -#define paddusw_m2r(var,reg) mmx_m2r (paddusw, var, reg) -#define paddusw_r2r(regs,regd) mmx_r2r (paddusw, regs, regd) - -#define pand_m2r(var,reg) mmx_m2r (pand, var, reg) -#define pand_r2r(regs,regd) mmx_r2r (pand, regs, regd) - -#define pandn_m2r(var,reg) mmx_m2r (pandn, var, reg) -#define pandn_r2r(regs,regd) mmx_r2r (pandn, regs, regd) - -#define pcmpeqb_m2r(var,reg) mmx_m2r (pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs,regd) mmx_r2r (pcmpeqb, regs, regd) -#define pcmpeqd_m2r(var,reg) mmx_m2r (pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs,regd) mmx_r2r (pcmpeqd, regs, regd) -#define pcmpeqw_m2r(var,reg) mmx_m2r (pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs,regd) mmx_r2r (pcmpeqw, regs, regd) - -#define pcmpgtb_m2r(var,reg) mmx_m2r (pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs,regd) mmx_r2r (pcmpgtb, regs, regd) -#define pcmpgtd_m2r(var,reg) mmx_m2r (pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs,regd) mmx_r2r (pcmpgtd, regs, regd) -#define pcmpgtw_m2r(var,reg) mmx_m2r (pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs,regd) mmx_r2r (pcmpgtw, regs, regd) - -#define pmaddwd_m2r(var,reg) mmx_m2r (pmaddwd, var, reg) -#define pmaddwd_r2r(regs,regd) mmx_r2r (pmaddwd, regs, regd) - -#define pmulhw_m2r(var,reg) mmx_m2r (pmulhw, var, reg) -#define pmulhw_r2r(regs,regd) mmx_r2r (pmulhw, regs, regd) - -#define pmullw_m2r(var,reg) mmx_m2r (pmullw, var, reg) -#define pmullw_r2r(regs,regd) mmx_r2r (pmullw, regs, regd) - -#define por_m2r(var,reg) mmx_m2r (por, var, reg) -#define por_r2r(regs,regd) mmx_r2r (por, regs, regd) - -#define pslld_i2r(imm,reg) mmx_i2r (pslld, imm, reg) -#define pslld_m2r(var,reg) mmx_m2r (pslld, var, reg) -#define pslld_r2r(regs,regd) mmx_r2r (pslld, regs, regd) -#define psllq_i2r(imm,reg) mmx_i2r (psllq, imm, reg) -#define psllq_m2r(var,reg) mmx_m2r (psllq, var, reg) -#define psllq_r2r(regs,regd) mmx_r2r (psllq, regs, regd) -#define psllw_i2r(imm,reg) mmx_i2r (psllw, imm, reg) -#define psllw_m2r(var,reg) mmx_m2r (psllw, var, reg) -#define psllw_r2r(regs,regd) mmx_r2r (psllw, regs, regd) - -#define psrad_i2r(imm,reg) mmx_i2r (psrad, imm, reg) -#define psrad_m2r(var,reg) mmx_m2r (psrad, var, reg) -#define psrad_r2r(regs,regd) mmx_r2r (psrad, regs, regd) -#define psraw_i2r(imm,reg) mmx_i2r (psraw, imm, reg) -#define psraw_m2r(var,reg) mmx_m2r (psraw, var, reg) -#define psraw_r2r(regs,regd) mmx_r2r (psraw, regs, regd) - -#define psrld_i2r(imm,reg) mmx_i2r (psrld, imm, reg) -#define psrld_m2r(var,reg) mmx_m2r (psrld, var, reg) -#define psrld_r2r(regs,regd) mmx_r2r (psrld, regs, regd) -#define psrlq_i2r(imm,reg) mmx_i2r (psrlq, imm, reg) -#define psrlq_m2r(var,reg) mmx_m2r (psrlq, var, reg) -#define psrlq_r2r(regs,regd) mmx_r2r (psrlq, regs, regd) -#define psrlw_i2r(imm,reg) mmx_i2r (psrlw, imm, reg) -#define psrlw_m2r(var,reg) mmx_m2r (psrlw, var, reg) -#define psrlw_r2r(regs,regd) mmx_r2r (psrlw, regs, regd) - -#define psubb_m2r(var,reg) mmx_m2r (psubb, var, reg) -#define psubb_r2r(regs,regd) mmx_r2r (psubb, regs, regd) -#define psubd_m2r(var,reg) mmx_m2r (psubd, var, reg) -#define psubd_r2r(regs,regd) mmx_r2r (psubd, regs, regd) -#define psubw_m2r(var,reg) mmx_m2r (psubw, var, reg) -#define psubw_r2r(regs,regd) mmx_r2r (psubw, regs, regd) - -#define psubsb_m2r(var,reg) mmx_m2r (psubsb, var, reg) -#define psubsb_r2r(regs,regd) mmx_r2r (psubsb, regs, regd) -#define psubsw_m2r(var,reg) mmx_m2r (psubsw, var, reg) -#define psubsw_r2r(regs,regd) mmx_r2r (psubsw, regs, regd) - -#define psubusb_m2r(var,reg) mmx_m2r (psubusb, var, reg) -#define psubusb_r2r(regs,regd) mmx_r2r (psubusb, regs, regd) -#define psubusw_m2r(var,reg) mmx_m2r (psubusw, var, reg) -#define psubusw_r2r(regs,regd) mmx_r2r (psubusw, regs, regd) - -#define punpckhbw_m2r(var,reg) mmx_m2r (punpckhbw, var, reg) -#define punpckhbw_r2r(regs,regd) mmx_r2r (punpckhbw, regs, regd) -#define punpckhdq_m2r(var,reg) mmx_m2r (punpckhdq, var, reg) -#define punpckhdq_r2r(regs,regd) mmx_r2r (punpckhdq, regs, regd) -#define punpckhwd_m2r(var,reg) mmx_m2r (punpckhwd, var, reg) -#define punpckhwd_r2r(regs,regd) mmx_r2r (punpckhwd, regs, regd) - -#define punpcklbw_m2r(var,reg) mmx_m2r (punpcklbw, var, reg) -#define punpcklbw_r2r(regs,regd) mmx_r2r (punpcklbw, regs, regd) -#define punpckldq_m2r(var,reg) mmx_m2r (punpckldq, var, reg) -#define punpckldq_r2r(regs,regd) mmx_r2r (punpckldq, regs, regd) -#define punpcklwd_m2r(var,reg) mmx_m2r (punpcklwd, var, reg) -#define punpcklwd_r2r(regs,regd) mmx_r2r (punpcklwd, regs, regd) - -#define pxor_m2r(var,reg) mmx_m2r (pxor, var, reg) -#define pxor_r2r(regs,regd) mmx_r2r (pxor, regs, regd) - - -/* 3DNOW extensions */ - -#define pavgusb_m2r(var,reg) mmx_m2r (pavgusb, var, reg) -#define pavgusb_r2r(regs,regd) mmx_r2r (pavgusb, regs, regd) - - -/* AMD MMX extensions - also available in intel SSE */ - - -#define mmx_m2ri(op,mem,reg,imm) \ - __asm__ __volatile__ (#op " %1, %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem), "X" (imm)) -#define mmx_r2ri(op,regs,regd,imm) \ - __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \ - : /* nothing */ \ - : "X" (imm) ) - -#define mmx_fetch(mem,hint) \ - __asm__ __volatile__ ("prefetch" #hint " %0" \ - : /* nothing */ \ - : "X" (mem)) - - -#define maskmovq(regs,maskreg) mmx_r2ri (maskmovq, regs, maskreg) - -#define movntq_r2m(mmreg,var) mmx_r2m (movntq, mmreg, var) - -#define pavgb_m2r(var,reg) mmx_m2r (pavgb, var, reg) -#define pavgb_r2r(regs,regd) mmx_r2r (pavgb, regs, regd) -#define pavgw_m2r(var,reg) mmx_m2r (pavgw, var, reg) -#define pavgw_r2r(regs,regd) mmx_r2r (pavgw, regs, regd) - -#define pextrw_r2r(mmreg,reg,imm) mmx_r2ri (pextrw, mmreg, reg, imm) - -#define pinsrw_r2r(reg,mmreg,imm) mmx_r2ri (pinsrw, reg, mmreg, imm) - -#define pmaxsw_m2r(var,reg) mmx_m2r (pmaxsw, var, reg) -#define pmaxsw_r2r(regs,regd) mmx_r2r (pmaxsw, regs, regd) - -#define pmaxub_m2r(var,reg) mmx_m2r (pmaxub, var, reg) -#define pmaxub_r2r(regs,regd) mmx_r2r (pmaxub, regs, regd) - -#define pminsw_m2r(var,reg) mmx_m2r (pminsw, var, reg) -#define pminsw_r2r(regs,regd) mmx_r2r (pminsw, regs, regd) - -#define pminub_m2r(var,reg) mmx_m2r (pminub, var, reg) -#define pminub_r2r(regs,regd) mmx_r2r (pminub, regs, regd) - -#define pmovmskb(mmreg,reg) \ - __asm__ __volatile__ ("movmskps %" #mmreg ", %" #reg) - -#define pmulhuw_m2r(var,reg) mmx_m2r (pmulhuw, var, reg) -#define pmulhuw_r2r(regs,regd) mmx_r2r (pmulhuw, regs, regd) - -#define prefetcht0(mem) mmx_fetch (mem, t0) -#define prefetcht1(mem) mmx_fetch (mem, t1) -#define prefetcht2(mem) mmx_fetch (mem, t2) -#define prefetchnta(mem) mmx_fetch (mem, nta) - -#define psadbw_m2r(var,reg) mmx_m2r (psadbw, var, reg) -#define psadbw_r2r(regs,regd) mmx_r2r (psadbw, regs, regd) - -#define pshufw_m2r(var,reg,imm) mmx_m2ri(pshufw, var, reg, imm) -#define pshufw_r2r(regs,regd,imm) mmx_r2ri(pshufw, regs, regd, imm) - -#define sfence() __asm__ __volatile__ ("sfence\n\t") - -typedef union { - float sf[4]; /* Single-precision (32-bit) value */ -} ATTR_ALIGN(16) sse_t; /* On a 16 byte (128-bit) boundary */ - - -#define sse_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm) ) - -#define sse_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)) - -#define sse_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ) - -#define sse_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define sse_r2ri(op, regs, regd, imm) \ - __asm__ __volatile__ (#op " %0, %%" #regs ", %%" #regd \ - : /* nothing */ \ - : "X" (imm) ) - -#define sse_m2ri(op, mem, reg, subop) \ - __asm__ __volatile__ (#op " %0, %%" #reg ", " #subop \ - : /* nothing */ \ - : "X" (mem)) - - -#define movaps_m2r(var, reg) sse_m2r(movaps, var, reg) -#define movaps_r2m(reg, var) sse_r2m(movaps, reg, var) -#define movaps_r2r(regs, regd) sse_r2r(movaps, regs, regd) - -#define movntps_r2m(xmmreg, var) sse_r2m(movntps, xmmreg, var) - -#define movups_m2r(var, reg) sse_m2r(movups, var, reg) -#define movups_r2m(reg, var) sse_r2m(movups, reg, var) -#define movups_r2r(regs, regd) sse_r2r(movups, regs, regd) - -#define movhlps_r2r(regs, regd) sse_r2r(movhlps, regs, regd) - -#define movlhps_r2r(regs, regd) sse_r2r(movlhps, regs, regd) - -#define movhps_m2r(var, reg) sse_m2r(movhps, var, reg) -#define movhps_r2m(reg, var) sse_r2m(movhps, reg, var) - -#define movlps_m2r(var, reg) sse_m2r(movlps, var, reg) -#define movlps_r2m(reg, var) sse_r2m(movlps, reg, var) - -#define movss_m2r(var, reg) sse_m2r(movss, var, reg) -#define movss_r2m(reg, var) sse_r2m(movss, reg, var) -#define movss_r2r(regs, regd) sse_r2r(movss, regs, regd) - -#define shufps_m2r(var, reg, index) sse_m2ri(shufps, var, reg, index) -#define shufps_r2r(regs, regd, index) sse_r2ri(shufps, regs, regd, index) - -#define cvtpi2ps_m2r(var, xmmreg) sse_m2r(cvtpi2ps, var, xmmreg) -#define cvtpi2ps_r2r(mmreg, xmmreg) sse_r2r(cvtpi2ps, mmreg, xmmreg) - -#define cvtps2pi_m2r(var, mmreg) sse_m2r(cvtps2pi, var, mmreg) -#define cvtps2pi_r2r(xmmreg, mmreg) sse_r2r(cvtps2pi, mmreg, xmmreg) - -#define cvttps2pi_m2r(var, mmreg) sse_m2r(cvttps2pi, var, mmreg) -#define cvttps2pi_r2r(xmmreg, mmreg) sse_r2r(cvttps2pi, mmreg, xmmreg) - -#define cvtsi2ss_m2r(var, xmmreg) sse_m2r(cvtsi2ss, var, xmmreg) -#define cvtsi2ss_r2r(reg, xmmreg) sse_r2r(cvtsi2ss, reg, xmmreg) - -#define cvtss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg) -#define cvtss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg) - -#define cvttss2si_m2r(var, reg) sse_m2r(cvtss2si, var, reg) -#define cvttss2si_r2r(xmmreg, reg) sse_r2r(cvtss2si, xmmreg, reg) - -#define movmskps(xmmreg, reg) \ - __asm__ __volatile__ ("movmskps %" #xmmreg ", %" #reg) - -#define addps_m2r(var, reg) sse_m2r(addps, var, reg) -#define addps_r2r(regs, regd) sse_r2r(addps, regs, regd) - -#define addss_m2r(var, reg) sse_m2r(addss, var, reg) -#define addss_r2r(regs, regd) sse_r2r(addss, regs, regd) - -#define subps_m2r(var, reg) sse_m2r(subps, var, reg) -#define subps_r2r(regs, regd) sse_r2r(subps, regs, regd) - -#define subss_m2r(var, reg) sse_m2r(subss, var, reg) -#define subss_r2r(regs, regd) sse_r2r(subss, regs, regd) - -#define mulps_m2r(var, reg) sse_m2r(mulps, var, reg) -#define mulps_r2r(regs, regd) sse_r2r(mulps, regs, regd) - -#define mulss_m2r(var, reg) sse_m2r(mulss, var, reg) -#define mulss_r2r(regs, regd) sse_r2r(mulss, regs, regd) - -#define divps_m2r(var, reg) sse_m2r(divps, var, reg) -#define divps_r2r(regs, regd) sse_r2r(divps, regs, regd) - -#define divss_m2r(var, reg) sse_m2r(divss, var, reg) -#define divss_r2r(regs, regd) sse_r2r(divss, regs, regd) - -#define rcpps_m2r(var, reg) sse_m2r(rcpps, var, reg) -#define rcpps_r2r(regs, regd) sse_r2r(rcpps, regs, regd) - -#define rcpss_m2r(var, reg) sse_m2r(rcpss, var, reg) -#define rcpss_r2r(regs, regd) sse_r2r(rcpss, regs, regd) - -#define rsqrtps_m2r(var, reg) sse_m2r(rsqrtps, var, reg) -#define rsqrtps_r2r(regs, regd) sse_r2r(rsqrtps, regs, regd) - -#define rsqrtss_m2r(var, reg) sse_m2r(rsqrtss, var, reg) -#define rsqrtss_r2r(regs, regd) sse_r2r(rsqrtss, regs, regd) - -#define sqrtps_m2r(var, reg) sse_m2r(sqrtps, var, reg) -#define sqrtps_r2r(regs, regd) sse_r2r(sqrtps, regs, regd) - -#define sqrtss_m2r(var, reg) sse_m2r(sqrtss, var, reg) -#define sqrtss_r2r(regs, regd) sse_r2r(sqrtss, regs, regd) - -#define andps_m2r(var, reg) sse_m2r(andps, var, reg) -#define andps_r2r(regs, regd) sse_r2r(andps, regs, regd) - -#define andnps_m2r(var, reg) sse_m2r(andnps, var, reg) -#define andnps_r2r(regs, regd) sse_r2r(andnps, regs, regd) - -#define orps_m2r(var, reg) sse_m2r(orps, var, reg) -#define orps_r2r(regs, regd) sse_r2r(orps, regs, regd) - -#define xorps_m2r(var, reg) sse_m2r(xorps, var, reg) -#define xorps_r2r(regs, regd) sse_r2r(xorps, regs, regd) - -#define maxps_m2r(var, reg) sse_m2r(maxps, var, reg) -#define maxps_r2r(regs, regd) sse_r2r(maxps, regs, regd) - -#define maxss_m2r(var, reg) sse_m2r(maxss, var, reg) -#define maxss_r2r(regs, regd) sse_r2r(maxss, regs, regd) - -#define minps_m2r(var, reg) sse_m2r(minps, var, reg) -#define minps_r2r(regs, regd) sse_r2r(minps, regs, regd) - -#define minss_m2r(var, reg) sse_m2r(minss, var, reg) -#define minss_r2r(regs, regd) sse_r2r(minss, regs, regd) - -#define cmpps_m2r(var, reg, op) sse_m2ri(cmpps, var, reg, op) -#define cmpps_r2r(regs, regd, op) sse_r2ri(cmpps, regs, regd, op) - -#define cmpeqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 0) -#define cmpeqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 0) - -#define cmpltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 1) -#define cmpltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 1) - -#define cmpleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 2) -#define cmpleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 2) - -#define cmpunordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 3) -#define cmpunordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 3) - -#define cmpneqps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 4) -#define cmpneqps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 4) - -#define cmpnltps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 5) -#define cmpnltps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 5) - -#define cmpnleps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 6) -#define cmpnleps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 6) - -#define cmpordps_m2r(var, reg) sse_m2ri(cmpps, var, reg, 7) -#define cmpordps_r2r(regs, regd) sse_r2ri(cmpps, regs, regd, 7) - -#define cmpss_m2r(var, reg, op) sse_m2ri(cmpss, var, reg, op) -#define cmpss_r2r(regs, regd, op) sse_r2ri(cmpss, regs, regd, op) - -#define cmpeqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 0) -#define cmpeqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 0) - -#define cmpltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 1) -#define cmpltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 1) - -#define cmpless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 2) -#define cmpless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 2) - -#define cmpunordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 3) -#define cmpunordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 3) - -#define cmpneqss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 4) -#define cmpneqss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 4) - -#define cmpnltss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 5) -#define cmpnltss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 5) - -#define cmpnless_m2r(var, reg) sse_m2ri(cmpss, var, reg, 6) -#define cmpnless_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 6) - -#define cmpordss_m2r(var, reg) sse_m2ri(cmpss, var, reg, 7) -#define cmpordss_r2r(regs, regd) sse_r2ri(cmpss, regs, regd, 7) - -#define comiss_m2r(var, reg) sse_m2r(comiss, var, reg) -#define comiss_r2r(regs, regd) sse_r2r(comiss, regs, regd) - -#define ucomiss_m2r(var, reg) sse_m2r(ucomiss, var, reg) -#define ucomiss_r2r(regs, regd) sse_r2r(ucomiss, regs, regd) - -#define unpcklps_m2r(var, reg) sse_m2r(unpcklps, var, reg) -#define unpcklps_r2r(regs, regd) sse_r2r(unpcklps, regs, regd) - -#define unpckhps_m2r(var, reg) sse_m2r(unpckhps, var, reg) -#define unpckhps_r2r(regs, regd) sse_r2r(unpckhps, regs, regd) - -#define fxrstor(mem) \ - __asm__ __volatile__ ("fxrstor %0" \ - : /* nothing */ \ - : "X" (mem)) - -#define fxsave(mem) \ - __asm__ __volatile__ ("fxsave %0" \ - : /* nothing */ \ - : "X" (mem)) - -#define stmxcsr(mem) \ - __asm__ __volatile__ ("stmxcsr %0" \ - : /* nothing */ \ - : "X" (mem)) - -#define ldmxcsr(mem) \ - __asm__ __volatile__ ("ldmxcsr %0" \ - : /* nothing */ \ - : "X" (mem)) -#endif /*ARCH_X86 */ - - - /* Optimized/fast memcpy */ - -extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len) XINE_PROTECTED; - -#ifdef HAVE_XINE_INTERNAL_H -/* Benchmark available memcpy methods */ -void xine_probe_fast_memcpy(xine_t *xine) XINE_PROTECTED; -#endif - - -/* - * Debug stuff - */ -/* - * profiling (unworkable in non DEBUG isn't defined) - */ -void xine_profiler_init (void) XINE_PROTECTED; -int xine_profiler_allocate_slot (const char *label) XINE_PROTECTED; -void xine_profiler_start_count (int id) XINE_PROTECTED; -void xine_profiler_stop_count (int id) XINE_PROTECTED; -void xine_profiler_print_results (void) XINE_PROTECTED; - -/* - * Allocate and clean memory size_t 'size', then return the pointer - * to the allocated memory. - */ -void *xine_xmalloc(size_t size) XINE_MALLOC XINE_PROTECTED; - -void *xine_xcalloc(size_t nmemb, size_t size) XINE_MALLOC XINE_PROTECTED; - -/* - * Same as above, but memory is aligned to 'alignement'. - * **base is used to return pointer to un-aligned memory, use - * this to free the mem chunk - */ -void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) XINE_PROTECTED; - -/* - * Get user home directory. - */ -const char *xine_get_homedir(void) XINE_PROTECTED; - -#if defined(WIN32) || defined(__CYGWIN__) -/* - * Get other xine directories. - */ -const char *xine_get_plugindir(void) XINE_PROTECTED; -const char *xine_get_fontdir(void) XINE_PROTECTED; -const char *xine_get_localedir(void) XINE_PROTECTED; -#endif - -/* - * Clean a string (remove spaces and '=' at the begin, - * and '\n', '\r' and spaces at the end. - */ -char *xine_chomp (char *str) XINE_PROTECTED; - -/* - * A thread-safe usecond sleep - */ -void xine_usec_sleep(unsigned usec) XINE_PROTECTED; - - - /* - * Some string functions - */ - - -void xine_strdupa(char *dest, char *src) XINE_PROTECTED; -#define xine_strdupa(d, s) do { \ - (d) = NULL; \ - if((s) != NULL) { \ - (d) = (char *) alloca(strlen((s)) + 1); \ - strcpy((d), (s)); \ - } \ - } while(0) - -/* compatibility macros */ -#define xine_strpbrk(S, ACCEPT) strpbrk((S), (ACCEPT)) -#define xine_strsep(STRINGP, DELIM) strsep((STRINGP), (DELIM)) -#define xine_setenv(NAME, VAL, XX) setenv((NAME), (VAL), (XX)) - -/* - * Color Conversion Utility Functions - * The following data structures and functions facilitate the conversion - * of RGB images to packed YUV (YUY2) images. There are also functions to - * convert from YUV9 -> YV12. All of the meaty details are written in - * color.c. - */ - -typedef struct yuv_planes_s { - - unsigned char *y; - unsigned char *u; - unsigned char *v; - unsigned int row_width; /* frame width */ - unsigned int row_count; /* frame height */ - -} yuv_planes_t; - -void init_yuv_conversion(void) XINE_PROTECTED; -void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height) XINE_PROTECTED; -void free_yuv_planes(yuv_planes_t *yuv_planes) XINE_PROTECTED; - -extern void (*yuv444_to_yuy2) - (const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch) XINE_PROTECTED; -extern void (*yuv9_to_yv12) - (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, - const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, - const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, - int width, int height) XINE_PROTECTED; -extern void (*yuv411_to_yv12) - (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, - const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, - const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, - int width, int height) XINE_PROTECTED; -extern void (*yv12_to_yuy2) - (const unsigned char *y_src, int y_src_pitch, - const unsigned char *u_src, int u_src_pitch, - const unsigned char *v_src, int v_src_pitch, - unsigned char *yuy2_map, int yuy2_pitch, - int width, int height, int progressive) XINE_PROTECTED; -extern void (*yuy2_to_yv12) - (const unsigned char *yuy2_map, int yuy2_pitch, - unsigned char *y_dst, int y_dst_pitch, - unsigned char *u_dst, int u_dst_pitch, - unsigned char *v_dst, int v_dst_pitch, - int width, int height) XINE_PROTECTED; - -#define SCALEFACTOR 65536 -#define CENTERSAMPLE 128 - -#define COMPUTE_Y(r, g, b) \ - (unsigned char) \ - ((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR) -#define COMPUTE_U(r, g, b) \ - (unsigned char) \ - ((u_r_table[r] + u_g_table[g] + u_b_table[b]) / SCALEFACTOR + CENTERSAMPLE) -#define COMPUTE_V(r, g, b) \ - (unsigned char) \ - ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE) - -#define UNPACK_BGR15(packed_pixel, r, g, b) \ - b = (packed_pixel & 0x7C00) >> 7; \ - g = (packed_pixel & 0x03E0) >> 2; \ - r = (packed_pixel & 0x001F) << 3; - -#define UNPACK_BGR16(packed_pixel, r, g, b) \ - b = (packed_pixel & 0xF800) >> 8; \ - g = (packed_pixel & 0x07E0) >> 3; \ - r = (packed_pixel & 0x001F) << 3; - -#define UNPACK_RGB15(packed_pixel, r, g, b) \ - r = (packed_pixel & 0x7C00) >> 7; \ - g = (packed_pixel & 0x03E0) >> 2; \ - b = (packed_pixel & 0x001F) << 3; - -#define UNPACK_RGB16(packed_pixel, r, g, b) \ - r = (packed_pixel & 0xF800) >> 8; \ - g = (packed_pixel & 0x07E0) >> 3; \ - b = (packed_pixel & 0x001F) << 3; - -extern int y_r_table[256] XINE_PROTECTED; -extern int y_g_table[256] XINE_PROTECTED; -extern int y_b_table[256] XINE_PROTECTED; - -extern int u_r_table[256] XINE_PROTECTED; -extern int u_g_table[256] XINE_PROTECTED; -extern int u_b_table[256] XINE_PROTECTED; - -extern int v_r_table[256] XINE_PROTECTED; -extern int v_g_table[256] XINE_PROTECTED; -extern int v_b_table[256] XINE_PROTECTED; - -/* frame copying functions */ -extern void yv12_to_yv12 - (const unsigned char *y_src, int y_src_pitch, unsigned char *y_dst, int y_dst_pitch, - const unsigned char *u_src, int u_src_pitch, unsigned char *u_dst, int u_dst_pitch, - const unsigned char *v_src, int v_src_pitch, unsigned char *v_dst, int v_dst_pitch, - int width, int height) XINE_PROTECTED; -extern void yuy2_to_yuy2 - (const unsigned char *src, int src_pitch, - unsigned char *dst, int dst_pitch, - int width, int height) XINE_PROTECTED; - -/* print a hexdump of the given data */ -void xine_hexdump (const void *buf, int length) XINE_PROTECTED; - -/* - * Optimization macros for conditions - * Taken from the FIASCO L4 microkernel sources - */ -#if !defined(__GNUC__) || __GNUC__ < 3 -# define EXPECT_TRUE(x) (x) -# define EXPECT_FALSE(x) (x) -#else -# define EXPECT_TRUE(x) __builtin_expect((x),1) -# define EXPECT_FALSE(x) __builtin_expect((x),0) -#endif - -#ifdef NDEBUG -#define _x_assert(exp) \ - do { \ - if (!(exp)) \ - fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \ - __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \ - } while(0) -#else -#define _x_assert(exp) \ - do { \ - if (!(exp)) { \ - fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \ - __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \ - abort(); \ - } \ - } while(0) -#endif - -#define _x_abort() \ - do { \ - fprintf(stderr, "abort: %s:%d: %s: Aborting.\n", \ - __FILE__, __LINE__, __XINE_FUNCTION__); \ - abort(); \ - } while(0) - - -/****** logging with xine **********************************/ - -#ifndef LOG_MODULE - #define LOG_MODULE __FILE__ -#endif /* LOG_MODULE */ - -#define LOG_MODULE_STRING printf("%s: ", LOG_MODULE ); - -#ifdef LOG_VERBOSE - #define LONG_LOG_MODULE_STRING \ - printf("%s: (%s:%d) ", LOG_MODULE, __XINE_FUNCTION__, __LINE__ ); -#else - #define LONG_LOG_MODULE_STRING LOG_MODULE_STRING -#endif /* LOG_VERBOSE */ - -#ifdef LOG - #ifdef __GNUC__ - #define lprintf(fmt, args...) \ - do { \ - LONG_LOG_MODULE_STRING \ - printf(fmt, ##args); \ - fflush(stdout); \ - } while(0) - #else /* __GNUC__ */ - #ifdef _MSC_VER - #define lprintf(fmtargs) \ - do { \ - LONG_LOG_MODULE_STRING \ - printf("%s", fmtargs); \ - fflush(stdout); \ - } while(0) - #else /* _MSC_VER */ - #define lprintf(...) \ - do { \ - LONG_LOG_MODULE_STRING \ - printf(__VA_ARGS__); \ - fflush(stdout); \ - } while(0) - #endif /* _MSC_VER */ - #endif /* __GNUC__ */ -#else /* LOG */ - #ifdef __GNUC__ - #define lprintf(fmt, args...) do {} while(0) - #else - #ifdef _MSC_VER -void __inline lprintf(const char * fmt, ...) {} - #else - #define lprintf(...) do {} while(0) - #endif /* _MSC_VER */ - #endif /* __GNUC__ */ -#endif /* LOG */ - -#ifdef __GNUC__ - #define llprintf(cat, fmt, args...) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( fmt, ##args ); \ - } \ - }while(0) -#else -#ifdef _MSC_VER - #define llprintf(cat, fmtargs) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( "%s", fmtargs ); \ - } \ - }while(0) -#else - #define llprintf(cat, ...) \ - do{ \ - if(cat){ \ - LONG_LOG_MODULE_STRING \ - printf( __VA_ARGS__ ); \ - } \ - }while(0) -#endif /* _MSC_VER */ -#endif /* __GNUC__ */ - -#ifdef __GNUC__ - #define xprintf(xine, verbose, fmt, args...) \ - do { \ - if((xine) && (xine)->verbosity >= verbose){ \ - xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \ - } \ - } while(0) -#else -#ifdef _MSC_VER -void xine_xprintf(xine_t *xine, int verbose, const char *fmt, ...); - #define xprintf xine_xprintf -#else - #define xprintf(xine, verbose, ...) \ - do { \ - if((xine) && (xine)->verbosity >= verbose){ \ - xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \ - } \ - } while(0) -#endif /* _MSC_VER */ -#endif /* __GNUC__ */ - -/* time measuring macros for profiling tasks */ - -#ifdef DEBUG -# define XINE_PROFILE(function) \ - do { \ - struct timeval current_time; \ - double dtime; \ - gettimeofday(¤t_time, NULL); \ - dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \ - function; \ - gettimeofday(¤t_time, NULL); \ - dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ - printf("%s: (%s:%d) took %lf seconds\n", \ - LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ - } while(0) -# define XINE_PROFILE_ACCUMULATE(function) \ - do { \ - struct timeval current_time; \ - static double dtime = 0; \ - gettimeofday(¤t_time, NULL); \ - dtime -= current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ - function; \ - gettimeofday(¤t_time, NULL); \ - dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ - printf("%s: (%s:%d) took %lf seconds\n", \ - LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ - } while(0) -#else -# define XINE_PROFILE(function) function -# define XINE_PROFILE_ACCUMULATE(function) function -#endif /* DEBUG */ - -/** - * get encoding of current locale - */ -char *xine_get_system_encoding(void) XINE_PROTECTED; - -/* - * guess default encoding for the subtitles - */ -const char *xine_guess_spu_encoding(void) XINE_PROTECTED; - -/* - * use the best clock reference (API compatible with gettimeofday) - * note: it will be a monotonic clock, if available. - */ -int xine_monotonic_clock(struct timeval *tv, struct timezone *tz) XINE_PROTECTED; - -/** - * CRC functions - */ -uint32_t _x_compute_crc32 (const uint8_t * data, int32_t length, uint32_t crc32) XINE_PROTECTED; - -/* don't harm following code */ -#ifdef extern -# undef extern -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-utils/xmllexer.c b/src/xine-utils/xmllexer.c index 39632938f..75a1aafec 100644 --- a/src/xine-utils/xmllexer.c +++ b/src/xine-utils/xmllexer.c @@ -26,12 +26,12 @@ */ #ifdef XINE_COMPILE -#include "xineutils.h" +#include <xine/xineutils.h> #else #define lprintf(...) #define xine_xmalloc malloc #endif -#include "xmllexer.h" +#include <xine/xmllexer.h> #include <stdio.h> #include <ctype.h> #include <string.h> @@ -40,6 +40,8 @@ #include <iconv.h> #endif +#include "bswap.h" + /* private constants*/ /* private global variables */ @@ -47,6 +49,45 @@ static const char * lexbuf; static int lexbuf_size = 0; static int lexbuf_pos = 0; static int in_comment = 0; +static char *lex_malloc = NULL; + +enum utf { UTF32BE, UTF32LE, UTF16BE, UTF16LE }; + +static void lex_convert (const char * buf, int size, enum utf utf) +{ + char *utf8 = malloc (size * (utf >= UTF16BE ? 3 : 6) + 1); + char *bp = utf8; + while (size > 0) + { + uint32_t c = 0; + switch (utf) + { + case UTF32BE: c = _X_BE_32 (buf); buf += 4; break; + case UTF32LE: c = _X_LE_32 (buf); buf += 4; break; + case UTF16BE: c = _X_BE_16 (buf); buf += 2; break; + case UTF16LE: c = _X_LE_16 (buf); buf += 2; break; + } + if (!c) + break; /* embed a NUL, get a truncated string */ + if (c < 128) + *bp++ = c; + else + { + int count = (c >= 0x04000000) ? 5 : + (c >= 0x00200000) ? 4 : + (c >= 0x00010000) ? 3 : + (c >= 0x00000800) ? 2 : 1; + *bp = (char)(0x1F80 >> count); + count *= 6; + *bp++ |= c >> count; + while ((count -= 6) >= 0) + *bp++ = 128 | ((c >> count) & 0x3F); + } + } + *bp = 0; + lexbuf_size = bp - utf8; + lexbuf = lex_malloc = realloc (utf8, lexbuf_size + 1); +} static enum { NORMAL, @@ -55,8 +96,29 @@ static enum { } lex_mode = NORMAL; void lexer_init(const char * buf, int size) { + static const char boms[] = { 0xFF, 0xFE, 0, 0, 0xFE, 0xFF }, + bom_utf8[] = { 0xEF, 0xBB, 0xBF }; + + free (lex_malloc); + lex_malloc = NULL; + lexbuf = buf; lexbuf_size = size; + + if (size >= 4 && !memcmp (buf, boms + 2, 4)) + lex_convert (buf + 4, size - 4, UTF32BE); + else if (size >= 4 && !memcmp (buf, boms, 4)) + lex_convert (buf + 4, size - 4, UTF32LE); + else if (size >= 3 && !memcmp (buf, bom_utf8, 3)) + { + lexbuf += 3; + lexbuf_size -= 3; + } + else if (size >= 2 && !memcmp (buf, boms + 4, 2)) + lex_convert (buf + 2, size - 2, UTF16BE); + else if (size >= 2 && !memcmp (buf, boms, 2)) + lex_convert (buf + 2, size - 2, UTF16LE); + lexbuf_pos = 0; lex_mode = NORMAL; in_comment = 0; @@ -82,7 +144,9 @@ typedef enum { STATE_IDENT /* must be last */ } lexer_state_t; -int lexer_get_token(char * tok, int tok_size) { +int lexer_get_token_d(char ** _tok, int * _tok_size, int fixed) { + char *tok = *_tok; + int tok_size = *_tok_size; int tok_pos = 0; lexer_state_t state = STATE_IDLE; char c; @@ -451,33 +515,44 @@ int lexer_get_token(char * tok, int tok_size) { /* pb */ if (tok_pos >= tok_size) { - lprintf("token buffer is too little\n"); + if (fixed) + return T_ERROR; + *_tok_size *= 2; + *_tok = realloc (*_tok, *_tok_size); + lprintf("token buffer is too small\n"); + lprintf("increasing buffer size to %d bytes\n", *_tok_size); + if (*_tok) { + return lexer_get_token_d (_tok, _tok_size, 0); + } else { + return T_ERROR; + } } else { if (lexbuf_pos >= lexbuf_size) { /* Terminate the current token */ tok[tok_pos] = '\0'; switch (state) { - case 0: - case 1: - case 2: + case STATE_IDLE: + case STATE_EOL: + case STATE_SEPAR: return T_EOF; break; - case 3: + case STATE_T_M_START: return T_M_START_1; break; - case 4: + case STATE_T_M_STOP_1: return T_M_STOP_1; break; - case 5: + case STATE_T_M_STOP_2: return T_ERROR; break; - case 6: + case STATE_T_EQUAL: return T_EQUAL; break; - case 7: + case STATE_T_STRING_SINGLE: + case STATE_T_STRING_DOUBLE: return T_STRING; break; - case 100: + case STATE_IDENT: return T_DATA; break; default: @@ -494,6 +569,12 @@ int lexer_get_token(char * tok, int tok_size) { return T_ERROR; } +/* for ABI compatibility */ +int lexer_get_token (char *tok, int tok_size) +{ + return lexer_get_token_d (&tok, &tok_size, 1); +} + static struct { char code; unsigned char namelen; diff --git a/src/xine-utils/xmllexer.h b/src/xine-utils/xmllexer.h deleted file mode 100644 index 10bcc8676..000000000 --- a/src/xine-utils/xmllexer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2002-2003,2007 the xine project - * - * This file is part of xine, a free video player. - * - * The xine-lib XML parser is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The xine-lib XML parser 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110, USA - */ - -/* xml lexer */ -#ifndef XML_LEXER_H -#define XML_LEXER_H - -#ifndef XINE_PROTECTED -#define XINE_PROTECTED -#endif - -/* public constants */ -#define T_ERROR -1 /* lexer error */ -#define T_EOF 0 /* end of file */ -#define T_EOL 1 /* end of line */ -#define T_SEPAR 2 /* separator ' ' '/t' '\n' '\r' */ -#define T_M_START_1 3 /* markup start < */ -#define T_M_START_2 4 /* markup start </ */ -#define T_M_STOP_1 5 /* markup stop > */ -#define T_M_STOP_2 6 /* markup stop /> */ -#define T_EQUAL 7 /* = */ -#define T_QUOTE 8 /* \" or \' */ -#define T_STRING 9 /* "string" */ -#define T_IDENT 10 /* identifier */ -#define T_DATA 11 /* data */ -#define T_C_START 12 /* <!-- */ -#define T_C_STOP 13 /* --> */ -#define T_TI_START 14 /* <? */ -#define T_TI_STOP 15 /* ?> */ -#define T_DOCTYPE_START 16 /* <!DOCTYPE */ -#define T_DOCTYPE_STOP 17 /* > */ -#define T_CDATA_START 18 /* <![CDATA[ */ -#define T_CDATA_STOP 19 /* ]]> */ - - -/* public functions */ -void lexer_init(const char * buf, int size) XINE_PROTECTED; -int lexer_get_token(char * tok, int tok_size) XINE_PROTECTED; -char *lexer_decode_entities (const char *tok) XINE_PROTECTED; - -#endif diff --git a/src/xine-utils/xmlparser.c b/src/xine-utils/xmlparser.c index a7bc146a9..8ef828105 100644 --- a/src/xine-utils/xmlparser.c +++ b/src/xine-utils/xmlparser.c @@ -37,13 +37,13 @@ */ #ifdef XINE_COMPILE -#include "xineutils.h" +#include <xine/xineutils.h> #else #define lprintf(...) #define xine_xmalloc malloc #endif -#include "xmllexer.h" -#include "xmlparser.h" +#include <xine/xmllexer.h> +#include <xine/xmlparser.h> #define TOKEN_SIZE 4 * 1024 @@ -219,11 +219,14 @@ static xml_node_t *xml_parser_append_text (xml_node_t *node, xml_node_t *subnode #define Q_STATE(CURRENT,NEW) (STATE_##NEW + state - STATE_##CURRENT) -static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_names[], int rec, int flags) +static int xml_parser_get_node_internal (char ** token_buffer, int * token_buffer_size, + char ** pname_buffer, int * pname_buffer_size, + char ** nname_buffer, int * nname_buffer_size, + xml_node_t *current_node, char *root_names[], int rec, int flags) { - char tok[TOKEN_SIZE]; - char property_name[TOKEN_SIZE]; - char node_name[TOKEN_SIZE]; + char *tok = *token_buffer; + char *property_name = *pname_buffer; + char *node_name = *nname_buffer; parser_state_t state = STATE_IDLE; int res = 0; int parse_res; @@ -236,9 +239,10 @@ static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_na if (rec < MAX_RECURSION) { - memset (tok, 0, TOKEN_SIZE); + memset (tok, 0, *token_buffer_size); - while ((bypass_get_token) || (res = lexer_get_token(tok, TOKEN_SIZE)) != T_ERROR) { + while ((bypass_get_token) || (res = lexer_get_token_d(token_buffer, token_buffer_size, 0)) != T_ERROR) { + tok = *token_buffer; bypass_get_token = 0; lprintf("info: %d - %d : '%s'\n", state, res, tok); @@ -298,10 +302,15 @@ static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_na strtoupper(tok); } if (state == STATE_Q_NODE) { - snprintf (node_name, TOKEN_SIZE, "?%s", tok); + asprintf (&node_name, "?%s", tok); + free (*nname_buffer); + *nname_buffer = node_name; + *nname_buffer_size = strlen (node_name) + 1; state = STATE_Q_ATTRIBUTE; } else { - strcpy(node_name, tok); + free (*nname_buffer); + *nname_buffer = node_name = strdup (tok); + *nname_buffer_size = strlen (node_name) + 1; state = STATE_ATTRIBUTE; } lprintf("info: current node name \"%s\"\n", node_name); @@ -329,8 +338,12 @@ static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_na /* set node propertys */ subtree->props = properties; lprintf("info: rec %d new subtree %s\n", rec, node_name); - root_names[rec + 1] = node_name; - parse_res = xml_parser_get_node_internal(subtree, root_names, rec + 1, flags); + root_names[rec + 1] = strdup (node_name); + parse_res = xml_parser_get_node_internal (token_buffer, token_buffer_size, + pname_buffer, pname_buffer_size, + nname_buffer, nname_buffer_size, + subtree, root_names, rec + 1, flags); + free (root_names[rec + 1]); if (parse_res == -1 || parse_res > 0) { return parse_res; } @@ -376,6 +389,12 @@ static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_na if (xml_parser_mode == XML_PARSER_CASE_INSENSITIVE) { strtoupper(tok); } + /* make sure the buffer for the property name is big enough */ + if (*token_buffer_size > *pname_buffer_size) { + *pname_buffer_size = *token_buffer_size; + *pname_buffer = realloc (*pname_buffer, *pname_buffer_size); + property_name = *pname_buffer; + } strcpy(property_name, tok); state = Q_STATE(ATTRIBUTE, ATTRIBUTE_EQUALS); lprintf("info: current property name \"%s\"\n", property_name); @@ -622,9 +641,25 @@ static int xml_parser_get_node_internal (xml_node_t *current_node, char *root_na static int xml_parser_get_node (xml_node_t *current_node, int flags) { + int res = 0; + int token_buffer_size = TOKEN_SIZE; + int pname_buffer_size = TOKEN_SIZE; + int nname_buffer_size = TOKEN_SIZE; + char *token_buffer = xine_xmalloc (token_buffer_size); + char *pname_buffer = xine_xmalloc (pname_buffer_size); + char *nname_buffer = xine_xmalloc (nname_buffer_size); char *root_names[MAX_RECURSION + 1]; root_names[0] = ""; - return xml_parser_get_node_internal (current_node, root_names, 0, flags); + res = xml_parser_get_node_internal (&token_buffer, &token_buffer_size, + &pname_buffer, &pname_buffer_size, + &nname_buffer, &nname_buffer_size, + current_node, root_names, 0, flags); + + free (token_buffer); + free (pname_buffer); + free (nname_buffer); + + return res; } int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) { diff --git a/src/xine-utils/xmlparser.h b/src/xine-utils/xmlparser.h deleted file mode 100644 index c89cb6dd3..000000000 --- a/src/xine-utils/xmlparser.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2002-2003,2007 the xine project - * - * This file is part of xine, a free video player. - * - * The xine-lib XML parser is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * The xine-lib XML parser 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with the Gnome Library; see the file COPYING.LIB. If not, - * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110, USA - */ - -#ifndef XML_PARSER_H -#define XML_PARSER_H - -#ifndef XINE_PROTECTED -#define XINE_PROTECTED -#endif - -/* parser modes */ -#define XML_PARSER_CASE_INSENSITIVE 0 -#define XML_PARSER_CASE_SENSITIVE 1 - -/* return codes */ -#define XML_PARSER_OK 0 -#define XML_PARSER_ERROR 1 - -/* xml_parser_build_tree_with_options flag bits */ -#define XML_PARSER_RELAXED 1 -#define XML_PARSER_MULTI_TEXT 2 - -/* node name for extra text chunks */ -#define CDATA_MARKER "[CDATA]" - -/* xml property */ -typedef struct xml_property_s { - char *name; - char *value; - struct xml_property_s *next; -} xml_property_t; - -/* xml node */ -/* .data contains any text which precedes any subtree elements; - * subtree elements may also contain only text; if so, name is "[CDATA]". - * e.g. <a>b<c />d</a> - * node1: .name="a" .data="b" .child=node2 .next=NULL - * node2: .name="c" .data=NULL .child=NULL .next=node3 - * node3: .name="[CDATA]" .data="d" .child=NULL .next=NULL - * Adjacent text items are merged. - */ -typedef struct xml_node_s { - char *name; - char *data; - struct xml_property_s *props; - struct xml_node_s *child; - struct xml_node_s *next; -} xml_node_t; - -void xml_parser_init(const char * buf, int size, int mode) XINE_PROTECTED; - -int xml_parser_build_tree(xml_node_t **root_node) XINE_PROTECTED; -int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) XINE_PROTECTED; - -void xml_parser_free_tree(xml_node_t *root_node) XINE_PROTECTED; - -const char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED; -int xml_parser_get_property_int (const xml_node_t *node, const char *name, - int def_value) XINE_PROTECTED; -int xml_parser_get_property_bool (const xml_node_t *node, const char *name, - int def_value) XINE_PROTECTED; - -/* for output: - * returns an escaped string (free() it when done) - * input must be in ASCII or UTF-8 - */ - -typedef enum { - XML_ESCAPE_NO_QUOTE, - XML_ESCAPE_SINGLE_QUOTE, - XML_ESCAPE_DOUBLE_QUOTE -} xml_escape_quote_t; -char *xml_escape_string (const char *s, xml_escape_quote_t quote_type) XINE_PROTECTED; - -/* for debugging purposes: dump read-in xml tree in a nicely - * indented fashion - */ - -void xml_parser_dump_tree (const xml_node_t *node) XINE_PROTECTED; - -#endif |