diff options
Diffstat (limited to 'src/demuxers')
-rw-r--r-- | src/demuxers/Makefile.am | 54 | ||||
-rw-r--r-- | src/demuxers/demux_film.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_flac.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_flv.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_matroska.c | 11 | ||||
-rw-r--r-- | src/demuxers/demux_mod.c | 14 | ||||
-rw-r--r-- | src/demuxers/demux_mpgaudio.c | 2 | ||||
-rw-r--r-- | src/demuxers/demux_nsf.c | 392 | ||||
-rw-r--r-- | src/demuxers/demux_qt.c | 13 | ||||
-rw-r--r-- | src/demuxers/demux_real.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_ts.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_tta.c | 10 | ||||
-rw-r--r-- | src/demuxers/demux_wc3movie.c | 8 | ||||
-rw-r--r-- | src/demuxers/group_audio.c | 14 | ||||
-rw-r--r-- | src/demuxers/group_audio.h | 5 |
15 files changed, 64 insertions, 475 deletions
diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am index 8a931c2d6..aa6bc5d5e 100644 --- a/src/demuxers/Makefile.am +++ b/src/demuxers/Makefile.am @@ -1,30 +1,43 @@ include $(top_srcdir)/misc/Makefile.common -AM_CFLAGS = $(VISIBILITY_FLAG) +AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG) AM_LDFLAGS = $(xineplug_ldflags) -if HAVE_VORBIS +## +# IMPORTANT: +# --------- +# 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_VORBIS ogg_module = xineplug_dmx_ogg.la endif -if BUILD_ASF +if ENABLE_ASF asf_module = xineplug_dmx_asf.la endif -if HAVE_LIBMNG +if ENABLE_MNG mng_module = xineplug_dmx_mng.la endif +if ENABLE_MODPLUG +modplug_module = xineplug_dmx_modplug.la +endif + if BUILD_DMX_IMAGE image_module = xineplug_dmx_image.la endif -## -# IMPORTANT: -# --------- -# All of xine demuxer plugins should be named like the scheme "xineplug_dmx_" - -xineplug_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module) \ +xineplug_LTLIBRARIES = \ + $(ogg_module) \ + $(asf_module) \ + $(mng_module) \ + $(image_module) \ + $(modplug_module) \ xineplug_dmx_games.la \ xineplug_dmx_audio.la \ xineplug_dmx_mpeg_ts.la \ @@ -70,7 +83,7 @@ xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) xineplug_dmx_qt_la_SOURCES = demux_qt.c xineplug_dmx_qt_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) -xineplug_dmx_qt_la_CPPFLAGS = $(ZLIB_CPPFLAGS) +xineplug_dmx_qt_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CPPFLAGS) xineplug_dmx_asf_la_SOURCES = demux_asf.c asfheader.c xineplug_dmx_asf_la_LIBADD = $(XINE_LIB) @@ -90,7 +103,7 @@ xineplug_dmx_rawdv_la_LIBADD = $(XINE_LIB) xineplug_dmx_mng_la_SOURCES = demux_mng.c xineplug_dmx_mng_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) $(MNG_LIBS) -xineplug_dmx_mng_la_CPPFLAGS = $(ZLIB_CPPFLAGS) +xineplug_dmx_mng_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CPPFLAGS) xineplug_dmx_pva_la_SOURCES = demux_pva.c xineplug_dmx_pva_la_LIBADD = $(XINE_LIB) @@ -101,17 +114,19 @@ xineplug_dmx_games_la_SOURCES = group_games.c demux_eawve.c \ demux_film.c demux_smjpeg.c demux_4xm.c \ demux_vmd.c xineplug_dmx_games_la_LIBADD = $(XINE_LIB) -xineplug_dmx_games_la_LDFLAGS = -avoid-version -module xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \ - demux_cdda.c demux_mpgaudio.c demux_nsf.c \ + demux_cdda.c demux_mpgaudio.c \ demux_realaudio.c demux_snd.c demux_voc.c \ demux_vox.c demux_wav.c demux_ac3.c id3.c \ - demux_aac.c demux_mod.c demux_flac.c \ + demux_aac.c demux_flac.c \ demux_mpc.c demux_dts.c demux_shn.c \ demux_tta.c -xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) -xineplug_dmx_audio_la_CFLAGS = $(AM_CFLAGS) $(LIBMODPLUG_CFLAGS) +xineplug_dmx_audio_la_LIBADD = $(XINE_LIB) + +xineplug_dmx_modplug_la_SOURCES = demux_mod.c +xineplug_dmx_modplug_la_LIBADD = $(XINE_LIB) $(LIBMODPLUG_LIBS) +xineplug_dmx_modplug_la_CFLAGS = $(LIBMODPLUG_CFLAGS) xineplug_dmx_yuv_frames_la_SOURCES = demux_yuv_frames.c xineplug_dmx_yuv_frames_la_LIBADD = $(XINE_LIB) @@ -127,14 +142,11 @@ xineplug_dmx_nsv_la_LIBADD = $(XINE_LIB) xineplug_dmx_matroska_la_SOURCES = demux_matroska.c ebml.c xineplug_dmx_matroska_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) -xineplug_dmx_matroska_la_CPPFLAGS = $(ZLIB_CPPFLAGS) xineplug_dmx_matroska_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing +xineplug_dmx_matroska_la_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CPPFLAGS) xineplug_dmx_iff_la_SOURCES = demux_iff.c xineplug_dmx_iff_la_LIBADD = $(XINE_LIB) xineplug_dmx_flv_la_SOURCES = demux_flv.c xineplug_dmx_flv_la_LIBADD = $(XINE_LIB) - -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 diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index d3cedc0e1..69c3eea60 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -258,7 +258,7 @@ static int open_film_file(demux_film_t *film) { film->frequency = BE_32(&film_header[i + 8]); film->sample_count = BE_32(&film_header[i + 12]); film->sample_table = - xine_xmalloc(film->sample_count * sizeof(film_sample_t)); + xine_xcalloc(film->sample_count, sizeof(film_sample_t)); for (j = 0; j < film->sample_count; j++) { film->sample_table[j].sample_offset = diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c index 3c343bdf2..ac7458726 100644 --- a/src/demuxers/demux_flac.c +++ b/src/demuxers/demux_flac.c @@ -166,8 +166,8 @@ static int open_flac_file(demux_flac_t *flac) { case 3: lprintf ("SEEKTABLE metadata, %d bytes\n", block_length); flac->seekpoint_count = block_length / FLAC_SEEKPOINT_SIZE; - flac->seekpoints = xine_xmalloc(flac->seekpoint_count * - sizeof(flac_seekpoint_t)); + flac->seekpoints = xine_xcalloc(flac->seekpoint_count, + sizeof(flac_seekpoint_t)); for (i = 0; i < flac->seekpoint_count; i++) { if (flac->input->read(flac->input, buffer, FLAC_SEEKPOINT_SIZE) != FLAC_SEEKPOINT_SIZE) return 0; diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index 0588b408e..5de878b4d 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -278,7 +278,7 @@ static int parse_flv_var(demux_flv_t *this, if (key && keylen == 5 && !strncmp(key, "times", 5)) { if (this->index) free (this->index); - this->index = xine_xmalloc(num*sizeof(flv_index_entry_t)); + 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) { diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 2bd8f3540..92986bf83 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -68,13 +68,6 @@ #define MAX(a, b) ((a)>(b)?(a):(b)) #endif -/* FOURCC will be manipulated using machine endian */ -#ifdef WORDS_BIGENDIAN -#define meFOURCC BE_FOURCC -#else -#define meFOURCC LE_FOURCC -#endif - typedef struct { int track_num; off_t *pos; @@ -1320,7 +1313,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { /* create a bitmap info header struct for MPEG 4 */ bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len); bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len; - bih->biCompression = meFOURCC('M', 'P', '4', 'S'); + bih->biCompression = ME_FOURCC('M', 'P', '4', 'S'); bih->biWidth = track->video_track->pixel_width; bih->biHeight = track->video_track->pixel_height; _x_bmiheader_le2me(bih); @@ -1341,7 +1334,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) { /* create a bitmap info header struct for h264 */ bih = malloc(sizeof(xine_bmiheader) + track->codec_private_len); bih->biSize = sizeof(xine_bmiheader) + track->codec_private_len; - bih->biCompression = meFOURCC('a', 'v', 'c', '1'); + bih->biCompression = ME_FOURCC('a', 'v', 'c', '1'); bih->biWidth = track->video_track->pixel_width; bih->biHeight = track->video_track->pixel_height; _x_bmiheader_le2me(bih); diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c index 37e066b13..9acddd878 100644 --- a/src/demuxers/demux_mod.c +++ b/src/demuxers/demux_mod.c @@ -31,8 +31,6 @@ #include "config.h" #endif -#ifdef HAVE_MODPLUG - #include <stdio.h> #include <fcntl.h> #include <unistd.h> @@ -48,7 +46,6 @@ #include "xineutils.h" #include "compat.h" #include "demux.h" -#include "group_audio.h" #include "modplug.h" #include "bswap.h" @@ -377,7 +374,7 @@ static void class_dispose (demux_class_t *this_gen) { free (this); } -void *demux_mod_init_plugin (xine_t *xine, void *data) { +static void *demux_mod_init_plugin (xine_t *xine, void *data) { demux_mod_class_t *this; this = xine_xmalloc (sizeof (demux_mod_class_t)); @@ -392,4 +389,11 @@ void *demux_mod_init_plugin (xine_t *xine, void *data) { return this; } -#endif /* HAVE_MODPLUG */ +static const demuxer_info_t demux_info_mod = { + 10 /* priority */ +}; + +const plugin_info_t xine_plugin_info[] EXPORTED = { + { PLUGIN_DEMUX, 26, "modplug", XINE_VERSION_CODE, &demux_info_mod, demux_mod_init_plugin }, + { PLUGIN_NONE, 0, "", 0, NULL, NULL } +}; diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c index f675e227a..64bae2794 100644 --- a/src/demuxers/demux_mpgaudio.c +++ b/src/demuxers/demux_mpgaudio.c @@ -413,7 +413,7 @@ static vbri_header_t* parse_vbri_header(mpg_audio_frame_t *frame, lprintf("entry_frames: %d\n", vbri->entry_frames); if ((ptr + (vbri->toc_entries + 1) * vbri->entry_size) >= (buf + bufsize)) return 0; - vbri->toc = xine_xmalloc (sizeof(int) * (vbri->toc_entries + 1)); + vbri->toc = xine_xcalloc ((vbri->toc_entries + 1), sizeof(int)); if (!vbri->toc) { free (vbri); return NULL; diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c deleted file mode 100644 index 7408274d5..000000000 --- a/src/demuxers/demux_nsf.c +++ /dev/null @@ -1,392 +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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* - * NSF File "Demuxer" by Mike Melanson (melanson@pcisys.net) - * This is really just a loader for NES Music File Format (extension NSF) - * which loads an entire NSF file and passes it over to the NSF audio - * decoder. - * - * After the file is sent over, the demuxer controls the playback by - * sending empty buffers with incrementing pts values. - * - * For more information regarding the NSF format, visit: - * http://www.tripoint.org/kevtris/nes/nsfspec.txt - * - * $Id: demux_nsf.c,v 1.24 2007/03/29 17:03:06 dgp85 Exp $ - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> - -/********** logging **********/ -#define LOG_MODULE "demux_nsf" -/* #define LOG_VERBOSE */ -/* #define LOG */ - -#include "xine_internal.h" -#include "xineutils.h" -#include "compat.h" -#include "demux.h" -#include "bswap.h" -#include "group_audio.h" - -#define NSF_HEADER_SIZE 0x80 -#define NSF_SAMPLERATE 44100 -#define NSF_BITS 8 -#define NSF_CHANNELS 1 -#define NSF_REFRESH_RATE 60 -#define NSF_PTS_INC (90000 / NSF_REFRESH_RATE) - -typedef struct { - demux_plugin_t demux_plugin; - - xine_stream_t *stream; - fifo_buffer_t *video_fifo; - fifo_buffer_t *audio_fifo; - input_plugin_t *input; - int status; - - int total_songs; - int current_song; - int new_song; /* indicates song change */ - - char *title; - char *artist; - char *copyright; - - off_t filesize; - - int64_t current_pts; - int file_sent; -} demux_nsf_t; - -typedef struct { - demux_class_t demux_class; -} demux_nsf_class_t; - -/* returns 1 if the NSF file was opened successfully, 0 otherwise */ -static int open_nsf_file(demux_nsf_t *this) { - unsigned char header[NSF_HEADER_SIZE]; - - this->input->seek(this->input, 0, SEEK_SET); - if (this->input->read(this->input, header, NSF_HEADER_SIZE) != - NSF_HEADER_SIZE) - return 0; - - /* check for the signature */ - if ((header[0] != 'N') || - (header[1] != 'E') || - (header[2] != 'S') || - (header[3] != 'M') || - (header[4] != 0x1A)) - return 0; - - this->total_songs = header[6]; - this->current_song = header[7]; - this->title = strdup(&header[0x0E]); - this->artist = strdup(&header[0x2E]); - this->copyright = strdup(&header[0x4E]); - - this->filesize = this->input->get_length(this->input); - - return 1; -} - -static int demux_nsf_send_chunk(demux_plugin_t *this_gen) { - demux_nsf_t *this = (demux_nsf_t *) this_gen; - buf_element_t *buf; - int bytes_read; - char title[100]; - - /* send chunks of the file to the decoder until file is completely - * loaded; then send control buffers */ - if (!this->file_sent) { - buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->type = BUF_AUDIO_NSF; - bytes_read = this->input->read(this->input, buf->content, buf->max_size); - - if (bytes_read == 0) { - /* the file has been completely loaded, free the buffer and start - * sending control buffers */ - buf->free_buffer(buf); - this->file_sent = 1; - - } else { - - /* keep loading the file */ - if (bytes_read < buf->max_size) - buf->size = bytes_read; - else - buf->size = buf->max_size; - - buf->extra_info->input_normpos = 0; - buf->extra_info->input_time = 0; - buf->pts = 0; - - this->audio_fifo->put (this->audio_fifo, buf); - } - } - - /* this is not an 'else' because control might fall through from above */ - if (this->file_sent) { - /* send a control buffer */ - buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - - if (this->new_song) { - - buf->decoder_info[1] = this->current_song; - this->new_song = 0; - sprintf(title, "%s, song %d/%d", - this->title, this->current_song, this->total_songs); - - _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, title); - - _x_demux_control_newpts(this->stream, this->current_pts, 0); - - } else - buf->decoder_info[1] = 0; - - buf->type = BUF_AUDIO_NSF; - if(this->total_songs) - buf->extra_info->input_normpos = (this->current_song - 1) * 65535 / this->total_songs; - buf->extra_info->input_time = this->current_pts / 90; - buf->pts = this->current_pts; - buf->size = 0; - this->audio_fifo->put (this->audio_fifo, buf); - - this->current_pts += NSF_PTS_INC; - } - - return this->status; -} - -static void demux_nsf_send_headers(demux_plugin_t *this_gen) { - demux_nsf_t *this = (demux_nsf_t *) this_gen; - buf_element_t *buf; - char copyright[100]; - - this->video_fifo = this->stream->video_fifo; - this->audio_fifo = this->stream->audio_fifo; - - this->status = DEMUX_OK; - - /* load stream information */ - _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, - NSF_CHANNELS); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, - NSF_SAMPLERATE); - _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, - NSF_BITS); - - _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, this->title); - _x_meta_info_set(this->stream, XINE_META_INFO_ARTIST, this->artist); - sprintf(copyright, "(C) %s", this->copyright); - _x_meta_info_set(this->stream, XINE_META_INFO_COMMENT, copyright); - - /* send start buffers */ - _x_demux_control_start(this->stream); - - /* send init info to the audio decoder */ - if (this->audio_fifo) { - buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo); - buf->type = BUF_AUDIO_NSF; - buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_FRAME_END; - buf->decoder_info[0] = 5; - buf->decoder_info[1] = NSF_SAMPLERATE; - buf->decoder_info[2] = NSF_BITS; - buf->decoder_info[3] = NSF_CHANNELS; - - /* send the NSF filesize in the body, big endian format */ - buf->content[0] = (this->filesize >> 24) & 0xFF; - buf->content[1] = (this->filesize >> 16) & 0xFF; - buf->content[2] = (this->filesize >> 8) & 0xFF; - buf->content[3] = (this->filesize >> 0) & 0xFF; - /* send the requested song */ - buf->content[4] = this->current_song + 5; - - this->audio_fifo->put (this->audio_fifo, buf); - } -} - -static int demux_nsf_seek (demux_plugin_t *this_gen, - off_t start_pos, int start_time, int playing) { - - demux_nsf_t *this = (demux_nsf_t *) this_gen; - start_pos = (off_t) ( (double) start_pos / 65535 * - this->total_songs ); - - /* if thread is not running, initialize demuxer */ - if( !playing ) { - - /* send new pts */ - _x_demux_control_newpts(this->stream, 0, 0); - - this->status = DEMUX_OK; - - /* reposition stream at the start for loading */ - this->input->seek(this->input, 0, SEEK_SET); - - this->file_sent = 0; - this->current_pts = 0; - this->new_song = 1; - } else { - this->current_song = start_pos + 1; - this->new_song = 1; - this->current_pts = 0; - _x_demux_flush_engine(this->stream); - } - - return this->status; -} - -static void demux_nsf_dispose (demux_plugin_t *this_gen) { - demux_nsf_t *this = (demux_nsf_t *) this_gen; - - free(this->title); - free(this->artist); - free(this->copyright); - free(this); -} - -static int demux_nsf_get_status (demux_plugin_t *this_gen) { - demux_nsf_t *this = (demux_nsf_t *) this_gen; - - return this->status; -} - -/* return the approximate length in miliseconds */ -static int demux_nsf_get_stream_length (demux_plugin_t *this_gen) { - return 0; -} - -static uint32_t demux_nsf_get_capabilities(demux_plugin_t *this_gen) { - return DEMUX_CAP_NOCAP; -} - -static int demux_nsf_get_optional_data(demux_plugin_t *this_gen, - void *data, int data_type) { - return DEMUX_OPTIONAL_UNSUPPORTED; -} - -static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *stream, - input_plugin_t *input) { - - demux_nsf_t *this; - - if (!INPUT_IS_SEEKABLE(input)) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input not seekable, can not handle!\n"); - return NULL; - } - - this = xine_xmalloc (sizeof (demux_nsf_t)); - this->stream = stream; - this->input = input; - - this->demux_plugin.send_headers = demux_nsf_send_headers; - this->demux_plugin.send_chunk = demux_nsf_send_chunk; - this->demux_plugin.seek = demux_nsf_seek; - this->demux_plugin.dispose = demux_nsf_dispose; - this->demux_plugin.get_status = demux_nsf_get_status; - this->demux_plugin.get_stream_length = demux_nsf_get_stream_length; - this->demux_plugin.get_capabilities = demux_nsf_get_capabilities; - this->demux_plugin.get_optional_data = demux_nsf_get_optional_data; - this->demux_plugin.demux_class = class_gen; - - this->status = DEMUX_FINISHED; - - switch (stream->content_detection_method) { - - case METHOD_BY_EXTENSION: { - const char *extensions, *mrl; - - mrl = input->get_mrl (input); - extensions = class_gen->get_extensions (class_gen); - - if (!_x_demux_check_extension (mrl, extensions)) { - free (this); - return NULL; - } - } - /* falling through is intended */ - - case METHOD_BY_CONTENT: - case METHOD_EXPLICIT: - - if (!open_nsf_file(this)) { - free (this); - return NULL; - } - - break; - - default: - free (this); - return NULL; - } - - return &this->demux_plugin; -} - -static const char *get_description (demux_class_t *this_gen) { - return "NES Music file demux plugin"; -} - -static const char *get_identifier (demux_class_t *this_gen) { - return "NSF"; -} - -static const char *get_extensions (demux_class_t *this_gen) { - return "nsf"; -} - -static const char *get_mimetypes (demux_class_t *this_gen) { - return NULL; -} - -static void class_dispose (demux_class_t *this_gen) { - demux_nsf_class_t *this = (demux_nsf_class_t *) this_gen; - - free (this); -} - -void *demux_nsf_init_plugin (xine_t *xine, void *data) { - demux_nsf_class_t *this; - - this = xine_xmalloc (sizeof (demux_nsf_class_t)); - - this->demux_class.open_plugin = open_plugin; - this->demux_class.get_description = get_description; - this->demux_class.get_identifier = get_identifier; - this->demux_class.get_mimetypes = get_mimetypes; - this->demux_class.get_extensions = get_extensions; - this->demux_class.dispose = class_dispose; - - return this; -} diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 23a45c792..1b82a288d 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -136,8 +136,10 @@ typedef unsigned int qt_atom; #define MAX_PTS_DIFF 100000 -/* network bandwidth, cribbed from src/input/input_mms.c */ -const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600, +/** + * @brief Network bandwidth, cribbed from src/input/input_mms.c + */ +static const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600, 115200,262200,393216,524300,1544000,10485800}; /* these are things that can go wrong */ @@ -411,10 +413,6 @@ typedef struct { #define DEBUG_DUMP_MOOV 0 #define RAW_MOOV_FILENAME "moovatom.raw" -#ifndef __GNUC__ -#define __attribute__(x) -#endif - #if DEBUG_ATOM_LOAD #define debug_atom_load printf #else @@ -936,12 +934,11 @@ static qt_error parse_trak_atom (qt_trak *trak, /* allocate space for each of the properties unions */ trak->stsd_atoms_count = BE_32(&trak_atom[i + 8]); - trak->stsd_atoms = xine_xmalloc(trak->stsd_atoms_count * sizeof(properties_t)); + trak->stsd_atoms = xine_xcalloc(trak->stsd_atoms_count, sizeof(properties_t)); if (!trak->stsd_atoms) { last_error = QT_NO_MEMORY; goto free_trak; } - memset(trak->stsd_atoms, 0, trak->stsd_atoms_count * sizeof(properties_t)); atom_pos = i + 0x10; properties_offset = 0x0C; diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 11b0dbf38..f0488bc47 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -692,7 +692,7 @@ unknown: this->video_stream->mdpr->avg_bit_rate); /* Allocate fragment offset table */ - this->fragment_tab = xine_xmalloc(FRAGMENT_TAB_SIZE*sizeof(uint32_t)); + this->fragment_tab = xine_xcalloc(FRAGMENT_TAB_SIZE, sizeof(uint32_t)); this->fragment_tab_max = FRAGMENT_TAB_SIZE; } @@ -1282,7 +1282,7 @@ static int demux_real_send_chunk(demux_plugin_t *this_gen) { frames = (stream_read_word(this) & 0xf0) >> 4; /* 2 bytes per frame size */ - sizes = xine_xmalloc(frames*sizeof(int)); + sizes = xine_xcalloc(frames, sizeof(int)); for(i = 0; i < frames; i++) sizes[i] = stream_read_word(this); diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index f2da5f268..b40c7d49f 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2226,9 +2226,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->status = DEMUX_FINISHED; #ifdef TS_READ_STATS - for (i=0; i<=NPKT_PER_READ; i++) { - this->rstat[i] = 0; - } + memset(this-rstat, 0, sizeof(*this->rstat)*NPKT_PER_READ); #endif /* DVBSUB */ diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c index 2e4808b9c..724404a5b 100644 --- a/src/demuxers/demux_tta.c +++ b/src/demuxers/demux_tta.c @@ -65,16 +65,14 @@ typedef struct { demux_class_t demux_class; } demux_tta_class_t; -#define FOURCC_32(a, b, c, d) (d + (c<<8) + (b<<16) + (a<<24)) - static int open_tta_file(demux_tta_t *this) { - uint8_t peek[4]; + uint32_t peek; uint32_t framelen; - if (_x_demux_read_header(this->input, peek, 4) != 4) + if (_x_demux_read_header(this->input, &peek, 4) != 4) return 0; - if ( BE_32(peek) != FOURCC_32('T', 'T', 'A', '1') ) + if ( peek != ME_FOURCC('T', 'T', 'A', '1') ) return 0; if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) ) @@ -89,7 +87,7 @@ static int open_tta_file(demux_tta_t *this) { return 0; } - this->seektable = xine_xmalloc(sizeof(uint32_t)*this->totalframes); + this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t)); this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes); /* Skip the CRC32 */ diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index fa1cfb17d..8645c9189 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -380,17 +380,15 @@ static int open_mve_file(demux_mve_t *this) { this->number_of_shots = LE_32(&preamble[0]); /* allocate space for the shot offset index and set offsets to 0 */ - this->shot_offsets = xine_xmalloc(this->number_of_shots * sizeof(off_t)); + this->shot_offsets = xine_xcalloc(this->number_of_shots, sizeof(off_t)); this->current_shot = 0; - for (i = 0; i < this->number_of_shots; i++) - this->shot_offsets[i] = 0; /* skip the SOND chunk */ this->input->seek(this->input, 12, SEEK_CUR); /* load the palette chunks */ - this->palettes = xine_xmalloc(this->number_of_shots * PALETTE_SIZE * - sizeof(palette_entry_t)); + this->palettes = xine_xcalloc(this->number_of_shots, PALETTE_SIZE * + sizeof(palette_entry_t)); for (i = 0; i < this->number_of_shots; i++) { /* make sure there was a valid palette chunk preamble */ if (this->input->read(this->input, preamble, PREAMBLE_SIZE) != diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c index b8f0e1ed4..8c1efdde6 100644 --- a/src/demuxers/group_audio.c +++ b/src/demuxers/group_audio.c @@ -71,10 +71,6 @@ static const demuxer_info_t demux_info_mpc = { 0 /* priority */ }; -static const demuxer_info_t demux_info_nsf = { - 10 /* priority */ -}; - static const demuxer_info_t demux_info_realaudio = { 10 /* priority */ }; @@ -103,12 +99,6 @@ static const demuxer_info_t demux_info_wav = { 6 /* priority */ }; -#ifdef HAVE_MODPLUG -static const demuxer_info_t demux_info_mod = { - 10 /* priority */ -}; -#endif - const plugin_info_t xine_plugin_info[] EXPORTED = { /* type, API, "name", version, special_info, init_function */ { PLUGIN_DEMUX, 26, "aac", XINE_VERSION_CODE, &demux_info_aac, demux_aac_init_plugin }, @@ -120,7 +110,6 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 26, "flac", XINE_VERSION_CODE, &demux_info_flac, demux_flac_init_plugin }, { PLUGIN_DEMUX, 26, "mp3", XINE_VERSION_CODE, &demux_info_mpgaudio, demux_mpgaudio_init_class }, { PLUGIN_DEMUX, 26, "mpc", XINE_VERSION_CODE, &demux_info_mpc, demux_mpc_init_plugin }, - { PLUGIN_DEMUX, 26, "nsf", XINE_VERSION_CODE, &demux_info_nsf, demux_nsf_init_plugin }, { PLUGIN_DEMUX, 26, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin }, { PLUGIN_DEMUX, 26, "shn", XINE_VERSION_CODE, &demux_info_shn, demux_shn_init_plugin }, { PLUGIN_DEMUX, 26, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin }, @@ -128,8 +117,5 @@ const plugin_info_t xine_plugin_info[] EXPORTED = { { PLUGIN_DEMUX, 26, "voc", XINE_VERSION_CODE, &demux_info_voc, demux_voc_init_plugin }, { PLUGIN_DEMUX, 26, "vox", XINE_VERSION_CODE, &demux_info_vox, demux_vox_init_plugin }, { PLUGIN_DEMUX, 26, "wav", XINE_VERSION_CODE, &demux_info_wav, demux_wav_init_plugin }, -#ifdef HAVE_MODPLUG - { PLUGIN_DEMUX, 26, "mod", XINE_VERSION_CODE, &demux_info_mod, demux_mod_init_plugin }, -#endif { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h index 7f1fccc5e..984b7c88e 100644 --- a/src/demuxers/group_audio.h +++ b/src/demuxers/group_audio.h @@ -34,7 +34,6 @@ void *demux_dts_init_plugin (xine_t *xine, void *data); void *demux_flac_init_plugin (xine_t *xine, void *data); void *demux_mpgaudio_init_class (xine_t *xine, void *data); void *demux_mpc_init_plugin (xine_t *xine, void *data); -void *demux_nsf_init_plugin (xine_t *xine, void *data); void *demux_realaudio_init_plugin (xine_t *xine, void *data); void *demux_shn_init_plugin (xine_t *xine, void *data); void *demux_snd_init_plugin (xine_t *xine, void *data); @@ -43,8 +42,4 @@ void *demux_voc_init_plugin (xine_t *xine, void *data); void *demux_vox_init_plugin (xine_t *xine, void *data); void *demux_wav_init_plugin (xine_t *xine, void *data); -#ifdef HAVE_MODPLUG -void *demux_mod_init_plugin (xine_t *xine, void *data); -#endif - #endif |