summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers')
-rw-r--r--src/demuxers/Makefile.am79
-rw-r--r--src/demuxers/asfheader.c43
-rw-r--r--src/demuxers/demux.h212
-rw-r--r--src/demuxers/demux_4xm.c60
-rw-r--r--src/demuxers/demux_aac.c81
-rw-r--r--src/demuxers/demux_ac3.c62
-rw-r--r--src/demuxers/demux_aiff.c67
-rw-r--r--src/demuxers/demux_asf.c105
-rw-r--r--src/demuxers/demux_aud.c63
-rw-r--r--src/demuxers/demux_avi.c71
-rw-r--r--src/demuxers/demux_cdda.c58
-rw-r--r--src/demuxers/demux_dts.c62
-rw-r--r--src/demuxers/demux_eawve.c56
-rw-r--r--src/demuxers/demux_elem.c59
-rw-r--r--src/demuxers/demux_film.c68
-rw-r--r--src/demuxers/demux_flac.c76
-rw-r--r--src/demuxers/demux_fli.c63
-rw-r--r--src/demuxers/demux_flv.c51
-rw-r--r--src/demuxers/demux_idcin.c67
-rw-r--r--src/demuxers/demux_iff.c178
-rw-r--r--src/demuxers/demux_image.c64
-rw-r--r--src/demuxers/demux_ipmovie.c56
-rw-r--r--src/demuxers/demux_matroska-chapters.c6
-rw-r--r--src/demuxers/demux_matroska.c146
-rw-r--r--src/demuxers/demux_matroska.h6
-rw-r--r--src/demuxers/demux_mng.c57
-rw-r--r--src/demuxers/demux_mod.c77
-rw-r--r--src/demuxers/demux_mpc.c67
-rw-r--r--src/demuxers/demux_mpeg.c70
-rw-r--r--src/demuxers/demux_mpeg_block.c79
-rw-r--r--src/demuxers/demux_mpeg_pes.c87
-rw-r--r--src/demuxers/demux_mpgaudio.c117
-rw-r--r--src/demuxers/demux_nsf.c386
-rw-r--r--src/demuxers/demux_nsv.c73
-rw-r--r--src/demuxers/demux_ogg.c2312
-rw-r--r--src/demuxers/demux_playlist.c722
-rw-r--r--src/demuxers/demux_pva.c63
-rw-r--r--src/demuxers/demux_qt.c678
-rw-r--r--src/demuxers/demux_rawdv.c64
-rw-r--r--src/demuxers/demux_real.c84
-rw-r--r--src/demuxers/demux_realaudio.c61
-rw-r--r--src/demuxers/demux_roq.c61
-rw-r--r--src/demuxers/demux_shn.c62
-rw-r--r--src/demuxers/demux_slave.c53
-rw-r--r--src/demuxers/demux_smjpeg.c66
-rw-r--r--src/demuxers/demux_snd.c68
-rw-r--r--src/demuxers/demux_str.c61
-rw-r--r--src/demuxers/demux_ts.c151
-rw-r--r--src/demuxers/demux_tta.c66
-rw-r--r--src/demuxers/demux_vc1es.c406
-rw-r--r--src/demuxers/demux_vmd.c62
-rw-r--r--src/demuxers/demux_voc.c62
-rw-r--r--src/demuxers/demux_vox.c62
-rw-r--r--src/demuxers/demux_vqa.c62
-rw-r--r--src/demuxers/demux_wav.c61
-rw-r--r--src/demuxers/demux_wc3movie.c60
-rw-r--r--src/demuxers/demux_yuv4mpeg2.c62
-rw-r--r--src/demuxers/demux_yuv_frames.c51
-rw-r--r--src/demuxers/ebml.c59
-rw-r--r--src/demuxers/ebml.h8
-rw-r--r--src/demuxers/group_audio.c56
-rw-r--r--src/demuxers/group_audio.h10
-rw-r--r--src/demuxers/group_games.c26
-rw-r--r--src/demuxers/group_games.h2
-rw-r--r--src/demuxers/id3.c139
-rw-r--r--src/demuxers/id3.h24
-rw-r--r--src/demuxers/iff.h2
-rw-r--r--src/demuxers/matroska.h6
68 files changed, 2429 insertions, 6235 deletions
diff --git a/src/demuxers/Makefile.am b/src/demuxers/Makefile.am
index 01ec2a93e..32b5616f7 100644
--- a/src/demuxers/Makefile.am
+++ b/src/demuxers/Makefile.am
@@ -1,35 +1,38 @@
+include $(top_srcdir)/misc/Makefile.quiet
include $(top_builddir)/misc/Makefile.plugins
include $(top_srcdir)/misc/Makefile.common
-AM_CFLAGS = $(VISIBILITY_FLAG)
+AM_CFLAGS = $(DEFAULT_OCFLAGS) $(VISIBILITY_FLAG)
AM_LDFLAGS = $(xineplug_ldflags)
-if HAVE_VORBIS
-ogg_module = xineplug_dmx_ogg.la
-endif
+##
+# IMPORTANT:
+# ---------
+# All of xine demuxer plugins should be named like the scheme "xineplug_dmx_"
+
+noinst_HEADERS = asfheader.h qtpalette.h group_games.h group_audio.h id3.h ebml.h matroska.h demux_matroska.h iff.h flacutils.h real_common.h
-if BUILD_ASF
+if ENABLE_ASF
asf_module = xineplug_dmx_asf.la
endif
-if BUILD_NOSEFART
-nsf_demuxer = demux_nsf.c
+if ENABLE_MNG
+mng_module = xineplug_dmx_mng.la
endif
-if HAVE_LIBMNG
-mng_module = xineplug_dmx_mng.la
+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 = \
+ $(asf_module) \
+ $(mng_module) \
+ $(image_module) \
+ $(modplug_module) \
xineplug_dmx_games.la \
xineplug_dmx_audio.la \
xineplug_dmx_mpeg_ts.la \
@@ -49,17 +52,16 @@ xineplug_LTLIBRARIES = $(ogg_module) $(asf_module) $(mng_module) $(image_module)
xineplug_dmx_nsv.la \
xineplug_dmx_matroska.la \
xineplug_dmx_iff.la \
- xineplug_dmx_flv.la
-
-xineplug_dmx_ogg_la_SOURCES = demux_ogg.c
-xineplug_dmx_ogg_la_LIBADD = $(XINE_LIB) $(VORBIS_LIBS) $(SPEEX_LIBS) $(THEORA_LIBS) $(OGG_LIBS) $(LTLIBINTL)
-xineplug_dmx_ogg_la_CFLAGS = $(AM_CFLAGS) $(VORBIS_CFLAGS) $(SPEEX_CFLAGS) $(THEORA_CFLAGS) $(OGG_CFLAGS)
+ xineplug_dmx_flv.la \
+ xineplug_dmx_playlist.la \
+ xineplug_dmx_vc1_es.la
xineplug_dmx_avi_la_SOURCES = demux_avi.c
xineplug_dmx_avi_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_dmx_mpeg_block_la_SOURCES = demux_mpeg_block.c
-xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
+xineplug_dmx_mpeg_block_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS)
+xineplug_dmx_mpeg_block_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS)
xineplug_dmx_mpeg_la_SOURCES = demux_mpeg.c
xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
@@ -67,15 +69,20 @@ xineplug_dmx_mpeg_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_dmx_mpeg_elem_la_SOURCES = demux_elem.c
xineplug_dmx_mpeg_elem_la_LIBADD = $(XINE_LIB)
+xineplug_dmx_vc1_es_la_SOURCES = demux_vc1es.c
+xineplug_dmx_vc1_es_la_LIBADD = $(XINE_LIB)
+
xineplug_dmx_mpeg_pes_la_SOURCES = demux_mpeg_pes.c
-xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
+xineplug_dmx_mpeg_pes_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS)
+xineplug_dmx_mpeg_pes_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS)
xineplug_dmx_mpeg_ts_la_SOURCES = demux_ts.c
-xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
+xineplug_dmx_mpeg_ts_la_CFLAGS = $(AM_CFLAGS) $(AVUTIL_CFLAGS)
+xineplug_dmx_mpeg_ts_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(AVUTIL_LIBS)
xineplug_dmx_qt_la_SOURCES = demux_qt.c
-xineplug_dmx_qt_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) $(LTLIBINTL)
-xineplug_dmx_qt_la_CPPFLAGS = $(ZLIB_CPPFLAGS)
+xineplug_dmx_qt_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(ZLIB_LIBS)
+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) $(LTLIBINTL) $(LTLIBICONV)
@@ -95,7 +102,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)
@@ -105,17 +112,21 @@ xineplug_dmx_games_la_SOURCES = group_games.c demux_eawve.c \
demux_vqa.c demux_wc3movie.c demux_str.c \
demux_film.c demux_smjpeg.c demux_4xm.c \
demux_vmd.c
+xineplug_dmx_games_la_CFLAGS = $(AM_CFLAGS) -fno-strict-aliasing
xineplug_dmx_games_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_dmx_audio_la_SOURCES = group_audio.c demux_aud.c demux_aiff.c \
- demux_cdda.c demux_mpgaudio.c $(nsf_demuxer) \
+ 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) $(LTLIBINTL) $(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 = $(AM_CFLAGS) $(LIBMODPLUG_CFLAGS)
xineplug_dmx_yuv_frames_la_SOURCES = demux_yuv_frames.c
xineplug_dmx_yuv_frames_la_LIBADD = $(XINE_LIB)
@@ -130,9 +141,9 @@ xineplug_dmx_nsv_la_SOURCES = demux_nsv.c
xineplug_dmx_nsv_la_LIBADD = $(XINE_LIB)
xineplug_dmx_matroska_la_SOURCES = demux_matroska.c demux_matroska-chapters.c ebml.c
-xineplug_dmx_matroska_la_LIBADD = $(XINE_LIB) $(ZLIB_LIBS) $(LTLIBINTL)
-xineplug_dmx_matroska_la_CPPFLAGS = $(ZLIB_CPPFLAGS)
+xineplug_dmx_matroska_la_LIBADD = $(XINE_LIB) $(LTLIBINTL) $(ZLIB_LIBS)
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) $(LTLIBINTL)
@@ -140,5 +151,5 @@ xineplug_dmx_iff_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
xineplug_dmx_flv_la_SOURCES = demux_flv.c
xineplug_dmx_flv_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
-xineinclude_HEADERS = demux.h
-noinst_HEADERS = asfheader.h qtpalette.h group_games.h group_audio.h id3.h ebml.h matroska.h demux_matroska.h iff.h flacutils.h real_common.h
+xineplug_dmx_playlist_la_SOURCES = demux_playlist.c
+xineplug_dmx_playlist_la_LIBADD = $(XINE_LIB) $(LTLIBINTL)
diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c
index 5b309b76b..9810aead9 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;
@@ -152,7 +150,7 @@ static char *asf_reader_get_string(asf_reader_t *reader, size_t size, iconv_t cd
outbuf = scratch;
outbytesleft = sizeof(scratch);
reader->pos += size;
- if (iconv (cd, (ICONV_CONST char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft) != -1) {
+ if (iconv (cd, (ICONV_CONST char **)&inbuf, &inbytesleft, &outbuf, &outbytesleft) != (size_t)-1) {
return strdup(scratch);
} else {
lprintf("iconv error\n");
@@ -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_stream->private_data = NULL;
@@ -366,8 +362,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);
@@ -637,6 +632,7 @@ 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;
@@ -645,6 +641,9 @@ static int asf_header_parse_content_description(asf_header_t *header_pub, uint8_
if (!content)
return 0;
+ if ( (iconv_cd = iconv_open("UTF-8", "UCS-2LE")) == (iconv_t)-1 )
+ return 0;
+
asf_reader_init(&reader, buffer, buffer_len);
asf_reader_get_16(&reader, &title_length);
asf_reader_get_16(&reader, &author_length);
@@ -652,11 +651,11 @@ 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);
@@ -665,6 +664,8 @@ static int asf_header_parse_content_description(asf_header_t *header_pub, uint8_
lprintf("rating: %d chars: \"%s\"\n", rating_length, content->rating);
header->pub.content = content;
+
+ iconv_close(iconv_cd);
return 1;
}
@@ -683,16 +684,11 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) {
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);
@@ -829,9 +825,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 a824730ea..000000000
--- a/src/demuxers/demux.h
+++ /dev/null
@@ -1,212 +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 26
-
-#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_EXTENSION 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);
-
- /*
- * return human readable (verbose = 1 line) description for this plugin
- */
- const char* (*get_description) (demux_class_t *this);
-
- /*
- * return human readable identifier for this plugin
- */
-
- const char* (*get_identifier) (demux_class_t *this);
-
- /*
- * return MIME types supported for this plugin
- */
-
- const char* (*get_mimetypes) (demux_class_t *this);
-
- /*
- * return ' ' seperated list of file extensions this
- * demuxer is likely to handle
- * (will be used to filter media files in
- * file selection dialogs)
- */
-
- const char* (*get_extensions) (demux_class_t *this);
-
- /*
- * close down, free all resources
- */
- void (*dispose) (demux_class_t *this);
-};
-
-
-/*
- * 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 */
-
-} ;
-
-/*
- * 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 a58cf0f22..5f941e570 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"
@@ -432,12 +432,6 @@ static int demux_fourxm_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_fourxm_dispose (demux_plugin_t *this_gen) {
- demux_fourxm_t *this = (demux_fourxm_t *) this_gen;
-
- free(this->tracks);
-}
-
static int demux_fourxm_get_status (demux_plugin_t *this_gen) {
demux_fourxm_t *this = (demux_fourxm_t *) this_gen;
@@ -472,7 +466,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_fourxm_send_headers;
this->demux_plugin.send_chunk = demux_fourxm_send_chunk;
this->demux_plugin.seek = demux_fourxm_seek;
- this->demux_plugin.dispose = demux_fourxm_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_fourxm_get_status;
this->demux_plugin.get_stream_length = demux_fourxm_get_stream_length;
this->demux_plugin.get_capabilities = demux_fourxm_get_capabilities;
@@ -483,17 +477,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const 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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -512,39 +496,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "4X Technologies (4xm) demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "4X Technologies";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "4xm";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_fourxm_class_t *this = (demux_fourxm_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_fourxm_init_plugin (xine_t *xine, void *data) {
demux_fourxm_class_t *this;
this = calloc(1, sizeof(demux_fourxm_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;
+ this->demux_class.description = N_("4X Technologies (4xm) demux plugin");
+ this->demux_class.identifier = "4X Technologies";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "4xm";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_aac.c b/src/demuxers/demux_aac.c
index 0ac645b78..bc2e72f73 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"
@@ -70,28 +70,24 @@ typedef struct {
static int open_aac_file(demux_aac_t *this) {
int i;
uint8_t peak[MAX_PREVIEW_SIZE];
+ uint32_t signature;
uint16_t syncword = 0;
uint32_t id3size = 0;
off_t data_start = 0;
_x_assert(MAX_PREVIEW_SIZE > 10);
- /* Get enough data to be able to check the size of ID3 tag */
- if (_x_demux_read_header(this->input, peak, 10) != 10)
+ if (_x_demux_read_header(this->input, &signature, 4) != 4)
return 0;
/* Check if there's an ID3v2 tag at the start */
- if ( id3v2_istag(peak) ) {
- id3size = _X_BE_32_synchsafe(&peak[6]);
-
+ if ( id3v2_istag(signature) ) {
this->input->seek(this->input, 4, SEEK_SET);
- id3v2_parse_tag(this->input, this->stream, peak);
-
- lprintf("ID3v2 tag encountered, skipping %u bytes.\n", id3size);
+ id3v2_parse_tag(this->input, this->stream, signature);
}
- if ( this->input->read(this->input, peak, 4) != 4 )
+ if ( this->input->read(this->input, &signature, 4) != 4 )
return 0;
/* Check for an ADIF header - should be at the start of the file */
@@ -101,10 +97,9 @@ static int open_aac_file(demux_aac_t *this) {
}
/* Look for an ADTS header - might not be at the start of the file */
- if ( id3size != 0 && this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE ) {
- lprintf("Getting a buffer of size %u starting from %u\n", MAX_PREVIEW_SIZE, id3size);
+ if ( this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE ) {
+ lprintf("Getting a buffer of size %u\n", MAX_PREVIEW_SIZE);
- this->input->seek(this->input, id3size, SEEK_SET);
if ( this->input->read(this->input, peak, MAX_PREVIEW_SIZE) != MAX_PREVIEW_SIZE )
return 0;
this->input->seek(this->input, 0, SEEK_SET);
@@ -231,12 +226,6 @@ static int demux_aac_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_aac_dispose (demux_plugin_t *this_gen) {
- demux_aac_t *this = (demux_aac_t *) this_gen;
-
- free(this);
-}
-
static int demux_aac_get_status (demux_plugin_t *this_gen) {
demux_aac_t *this = (demux_aac_t *) this_gen;
@@ -270,7 +259,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_aac_send_headers;
this->demux_plugin.send_chunk = demux_aac_send_chunk;
this->demux_plugin.seek = demux_aac_seek;
- this->demux_plugin.dispose = demux_aac_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_aac_get_status;
this->demux_plugin.get_stream_length = demux_aac_get_stream_length;
this->demux_plugin.get_capabilities = demux_aac_get_capabilities;
@@ -280,19 +269,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
if (!open_aac_file(this)) {
@@ -309,39 +286,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "ADIF/ADTS AAC demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "AAC";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "aac";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_aac_class_t *this = (demux_aac_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_aac_init_plugin (xine_t *xine, void *data) {
demux_aac_class_t *this;
this = calloc(1, sizeof(demux_aac_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;
+ this->demux_class.description = N_("ADIF/ADTS AAC demux plugin");
+ this->demux_class.identifier = "AAC";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "aac";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c
index 05be00ae9..d42396f90 100644
--- a/src/demuxers/demux_ac3.c
+++ b/src/demuxers/demux_ac3.c
@@ -47,10 +47,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"
@@ -381,12 +381,6 @@ static int demux_ac3_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_ac3_dispose (demux_plugin_t *this_gen) {
- demux_ac3_t *this = (demux_ac3_t *) this_gen;
-
- free(this);
-}
-
static int demux_ac3_get_status (demux_plugin_t *this_gen) {
demux_ac3_t *this = (demux_ac3_t *) this_gen;
@@ -421,7 +415,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_ac3_send_headers;
this->demux_plugin.send_chunk = demux_ac3_send_chunk;
this->demux_plugin.seek = demux_ac3_seek;
- this->demux_plugin.dispose = demux_ac3_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_ac3_get_status;
this->demux_plugin.get_stream_length = demux_ac3_get_stream_length;
this->demux_plugin.get_capabilities = demux_ac3_get_capabilities;
@@ -432,19 +426,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -463,39 +445,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Raw AC3 demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "AC3";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "ac3";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/ac3: ac3: Dolby Digital audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_ac3_class_t *this = (demux_ac3_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_ac3_init_plugin (xine_t *xine, void *data) {
demux_ac3_class_t *this;
this = calloc(1, sizeof(demux_ac3_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;
+ this->demux_class.description = N_("Raw AC3 demux plugin");
+ this->demux_class.identifier = "AC3";
+ this->demux_class.mimetypes = "audio/ac3: ac3: Dolby Digital audio;";
+ this->demux_class.extensions = "ac3";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c
index 0b4f5c513..8ddb7b6a4 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"
@@ -336,12 +336,6 @@ static int demux_aiff_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_aiff_dispose (demux_plugin_t *this_gen) {
- demux_aiff_t *this = (demux_aiff_t *) this_gen;
-
- free(this);
-}
-
static int demux_aiff_get_status (demux_plugin_t *this_gen) {
demux_aiff_t *this = (demux_aiff_t *) this_gen;
@@ -376,7 +370,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_aiff_send_headers;
this->demux_plugin.send_chunk = demux_aiff_send_chunk;
this->demux_plugin.seek = demux_aiff_seek;
- this->demux_plugin.dispose = demux_aiff_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_aiff_get_status;
this->demux_plugin.get_stream_length = demux_aiff_get_stream_length;
this->demux_plugin.get_capabilities = demux_aiff_get_capabilities;
@@ -387,19 +381,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -418,41 +400,20 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "AIFF file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "AIFF";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "aif aiff";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-aiff: aif, aiff: AIFF audio;"
- "audio/aiff: aif, aiff: AIFF audio;"
- "audio/x-pn-aiff: aif, aiff: AIFF audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_aiff_class_t *this = (demux_aiff_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_aiff_init_plugin (xine_t *xine, void *data) {
demux_aiff_class_t *this;
this = calloc(1, sizeof(demux_aiff_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;
+ this->demux_class.description = N_("AIFF file demux plugin");
+ this->demux_class.identifier = "AIFF";
+ this->demux_class.mimetypes =
+ "audio/x-aiff: aif, aiff: AIFF audio;"
+ "audio/aiff: aif, aiff: AIFF audio;"
+ "audio/x-pn-aiff: aif, aiff: AIFF audio;";
+ this->demux_class.extensions = "aif aiff";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index 4689abeee..71fc2b22a 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
@@ -385,7 +385,7 @@ static void asf_send_video_header (demux_asf_t *this, int stream) {
static int asf_read_header (demux_asf_t *this) {
int i;
uint64_t asf_header_len;
- char *asf_header_buffer = NULL;
+ uint8_t *asf_header_buffer = NULL;
asf_header_len = get_le64(this);
if (asf_header_len > 4 * 1024 * 1024)
@@ -484,10 +484,9 @@ static int asf_read_header (demux_asf_t *this) {
demux_stream->buf_type = _x_formattag_to_buf_audio
( ((xine_waveformatex *)asf_stream->private_data)->wFormatTag );
if ( !demux_stream->buf_type ) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_asf: unknown audio type 0x%x\n",
- ((xine_waveformatex *)asf_stream->private_data)->wFormatTag);
demux_stream->buf_type = BUF_AUDIO_UNKNOWN;
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE,
+ ((xine_waveformatex *)asf_stream->private_data)->wFormatTag);
}
_x_meta_info_set(this->stream, XINE_META_INFO_AUDIOCODEC, _x_buf_audio_name(demux_stream->buf_type));
@@ -530,10 +529,8 @@ static int asf_read_header (demux_asf_t *this) {
demux_stream->buf_type = _x_fourcc_to_buf_video(bmiheader->biCompression);
if( !demux_stream->buf_type ) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_asf: unknown video format %.4s\n", (char*)&(bmiheader->biCompression));
-
demux_stream->buf_type = BUF_VIDEO_UNKNOWN;
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, bmiheader->biCompression);
}
_x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, _x_buf_video_name(demux_stream->buf_type));
@@ -647,14 +644,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;
}
@@ -662,7 +659,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.
@@ -1720,7 +1716,7 @@ static int demux_asf_send_chunk (demux_plugin_t *this_gen) {
default:
{
- int header_size = 0;
+ uint32_t header_size = 0;
if (asf_parse_packet_align(this)) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_asf: asf_parse_packet_align failed\n");
@@ -1906,7 +1902,7 @@ static int demux_asf_seek (demux_plugin_t *this_gen,
start_pos -= (start_pos - this->first_packet_pos) % this->packet_size;
while ((start_pos >= this->first_packet_pos) && (state != 5)) {
- int header_size;
+ uint32_t header_size;
/* seek to the beginning of the previous packet */
lprintf ("demux_asf_seek: seek back\n");
@@ -2080,10 +2076,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
!strstr(buf,"ASX") &&
strncmp(buf,"[Reference]", 11) &&
strncmp(buf,"ASF ", 4) &&
- ((buf[0] != 0x30)
- || (buf[1] != 0x26)
- || (buf[2] != 0xb2)
- || (buf[3] != 0x75)))
+ memcmp(buf, "\x30\x26\xB2\x75", 4)
+ )
return NULL;
}
@@ -2091,23 +2085,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const ending = strrchr (mrl, '.');
-
- if (!ending)
- return NULL;
-
- if (strncasecmp(ending, ".asf", 4) &&
- strncasecmp(ending, ".wmv", 4) &&
- strncasecmp(ending, ".wma", 4) ) {
- return NULL;
- }
-
- lprintf ("extension accepted.\n");
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -2156,38 +2134,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "ASF demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "ASF";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- /* asx, wvx, wax are metafile or playlist */
- return "asf wmv wma asx wvx wax";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
-
- return "video/x-ms-asf: asf: ASF stream;"
- "video/x-ms-wmv: wmv: Windows Media Video;"
- "audio/x-ms-wma: wma: Windows Media Audio;"
- "application/vnd.ms-asf: asf: ASF stream;"
- "application/x-mplayer2: asf,asx,asp: mplayer2;"
- "video/x-ms-asf-plugin: asf,asx,asp: mms animation;"
- "video/x-ms-wvx: wvx: wmv metafile;"
- "video/x-ms-wax: wva: wma metafile;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_asf_class_t *this = (demux_asf_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_asf_class_t *this;
@@ -2197,11 +2143,20 @@ static void *init_class (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("ASF demux plugin");
+ this->demux_class.identifier = "ASF";
+ this->demux_class.mimetypes =
+ "video/x-ms-asf: asf: ASF stream;"
+ "video/x-ms-wmv: wmv: Windows Media Video;"
+ "audio/x-ms-wma: wma: Windows Media Audio;"
+ "application/vnd.ms-asf: asf: ASF stream;"
+ "application/x-mplayer2: asf,asx,asp: mplayer2;"
+ "video/x-ms-asf-plugin: asf,asx,asp: mms animation;"
+ "video/x-ms-wvx: wvx: wmv metafile;"
+ "video/x-ms-wax: wva: wma metafile;";
+ /* asx, wvx, wax are metafile or playlist */
+ this->demux_class.extensions = "asf wmv wma asx wvx wax";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -2216,6 +2171,6 @@ static const demuxer_info_t demux_info_asf = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "asf", XINE_VERSION_CODE, &demux_info_asf, init_class },
+ { PLUGIN_DEMUX, 27, "asf", XINE_VERSION_CODE, &demux_info_asf, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_aud.c b/src/demuxers/demux_aud.c
index caaa4e91a..258494ffd 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"
@@ -131,7 +131,7 @@ static int demux_aud_send_chunk(demux_plugin_t *this_gen) {
demux_aud_t *this = (demux_aud_t *) this_gen;
unsigned char chunk_preamble[AUD_CHUNK_PREAMBLE_SIZE];
- unsigned int chunk_size;
+ int chunk_size;
off_t current_file_pos;
int64_t audio_pts;
buf_element_t *buf;
@@ -241,11 +241,6 @@ static int demux_aud_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_aud_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_aud_get_status (demux_plugin_t *this_gen) {
demux_aud_t *this = (demux_aud_t *) this_gen;
@@ -277,7 +272,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_aud_send_headers;
this->demux_plugin.send_chunk = demux_aud_send_chunk;
this->demux_plugin.seek = demux_aud_seek;
- this->demux_plugin.dispose = demux_aud_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_aud_get_status;
this->demux_plugin.get_stream_length = demux_aud_get_stream_length;
this->demux_plugin.get_capabilities = demux_aud_get_capabilities;
@@ -289,19 +284,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
case METHOD_BY_CONTENT: /* no reliable detection */
- 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_MRL:
case METHOD_EXPLICIT:
if (!open_aud_file(this)) {
@@ -318,39 +301,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Westwood Studios AUD file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Westwood Studios AUD";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "aud";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_aud_class_t *this = (demux_aud_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_aud_init_plugin (xine_t *xine, void *data) {
demux_aud_class_t *this;
this = calloc(1, sizeof(demux_aud_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;
+ this->demux_class.description = N_("Westwood Studios AUD file demux plugin");
+ this->demux_class.identifier = "Westwood Studios AUD";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "aud";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 79bfc9f12..ae97b576e 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"
/*
@@ -1881,7 +1881,12 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) {
if (!this->avi->bih->biCompression)
this->avi->video_type = BUF_VIDEO_RGB;
else
+ {
this->avi->video_type = _x_fourcc_to_buf_video(this->avi->bih->biCompression);
+ if (!this->avi->video_type)
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE,
+ this->avi->bih->biCompression);
+ }
for(i=0; i < this->avi->n_audio; i++) {
this->avi->audio[i]->audio_type = _x_formattag_to_buf_audio (this->avi->audio[i]->wavex->wFormatTag);
@@ -1894,10 +1899,10 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) {
}
if( !this->avi->audio[i]->audio_type ) {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "unknown audio type 0x%x\n",
- this->avi->audio[i]->wavex->wFormatTag);
this->no_audio = 1;
this->avi->audio[i]->audio_type = BUF_AUDIO_UNKNOWN;
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE,
+ this->avi->audio[i]->wavex->wFormatTag);
} else
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_avi: audio type %s (wFormatTag 0x%x)\n",
_x_buf_audio_name(this->avi->audio[i]->audio_type),
@@ -1909,8 +1914,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;
}
@@ -1959,6 +1964,8 @@ static void demux_avi_send_headers (demux_plugin_t *this_gen) {
this->avi->compressor = this->avi->bih->biCompression;
} else {
this->avi->video_type = _x_fourcc_to_buf_video(this->avi->compressor);
+ if (!this->avi->video_type)
+ _x_fourcc_to_buf_video(this->avi->bih->biCompression);
}
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC,
@@ -2263,17 +2270,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- 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))
- return NULL;
- }
- /* we want to fall through here */
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -2320,41 +2317,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
/*
* demux avi class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "AVI/RIFF demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "AVI";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "avi";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/msvideo: avi: AVI video;"
- "video/x-msvideo: avi: AVI video;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_avi_class_t *this = (demux_avi_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_avi_class_t *this;
this = calloc(1, sizeof(demux_avi_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;
+ this->demux_class.description = N_("AVI/RIFF demux plugin");
+ this->demux_class.identifier = "AVI";
+ this->demux_class.mimetypes =
+ "video/msvideo: avi: AVI video;"
+ "video/x-msvideo: avi: AVI video;";
+ this->demux_class.extensions = "avi";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -2368,6 +2343,6 @@ static const demuxer_info_t demux_info_avi = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "avi", XINE_VERSION_CODE, &demux_info_avi, init_class },
+ { PLUGIN_DEMUX, 27, "avi", XINE_VERSION_CODE, &demux_info_avi, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_cdda.c b/src/demuxers/demux_cdda.c
index 6aee5042e..f936ff4f2 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"
@@ -159,12 +159,6 @@ static int demux_cdda_seek (demux_plugin_t *this_gen, off_t start_pos, int start
return this->status;
}
-static void demux_cdda_dispose (demux_plugin_t *this_gen) {
- demux_cdda_t *this = (demux_cdda_t *) this_gen;
-
- free(this);
-}
-
static int demux_cdda_get_status (demux_plugin_t *this_gen) {
demux_cdda_t *this = (demux_cdda_t *) this_gen;
@@ -200,7 +194,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_cdda_send_headers;
this->demux_plugin.send_chunk = demux_cdda_send_chunk;
this->demux_plugin.seek = demux_cdda_seek;
- this->demux_plugin.dispose = demux_cdda_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_cdda_get_status;
this->demux_plugin.get_stream_length = demux_cdda_get_stream_length;
this->demux_plugin.get_capabilities = demux_cdda_get_capabilities;
@@ -212,14 +206,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
case METHOD_BY_CONTENT:
- case METHOD_BY_EXTENSION:
- if (strncasecmp (input->get_mrl (input), "cdda:", 5)) {
- free (this);
- return NULL;
- }
-
- break;
-
+ return NULL;
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -231,39 +219,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "CD Digital Audio demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "CDDA";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return NULL;
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_cdda_class_t *this = (demux_cdda_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_cdda_init_plugin (xine_t *xine, void *data) {
demux_cdda_class_t *this;
this = calloc(1, sizeof(demux_cdda_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;
+ this->demux_class.description = N_("CD Digital Audio demux plugin");
+ this->demux_class.identifier = "CDDA";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "cdda:/";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_dts.c b/src/demuxers/demux_dts.c
index 0c73877e9..3c624a8c9 100644
--- a/src/demuxers/demux_dts.c
+++ b/src/demuxers/demux_dts.c
@@ -43,10 +43,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"
@@ -375,12 +375,6 @@ static int demux_dts_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_dts_dispose (demux_plugin_t *this_gen) {
- demux_dts_t *this = (demux_dts_t *) this_gen;
-
- free(this);
-}
-
static int demux_dts_get_status (demux_plugin_t *this_gen) {
demux_dts_t *this = (demux_dts_t *) this_gen;
@@ -408,7 +402,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_dts_send_headers;
this->demux_plugin.send_chunk = demux_dts_send_chunk;
this->demux_plugin.seek = demux_dts_seek;
- this->demux_plugin.dispose = demux_dts_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_dts_get_status;
this->demux_plugin.get_stream_length = demux_dts_get_stream_length;
this->demux_plugin.get_capabilities = demux_dts_get_capabilities;
@@ -419,19 +413,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
if (!open_dts_file(this)) {
@@ -448,39 +430,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Raw DTS demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "DTS";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "dts";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_dts_class_t *this = (demux_dts_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_dts_init_plugin (xine_t *xine, void *data) {
demux_dts_class_t *this;
this = calloc(1, sizeof(demux_dts_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;
+ this->demux_class.description = N_("Raw DTS demux plugin");
+ this->demux_class.identifier = "DTS";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "dts";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_eawve.c b/src/demuxers/demux_eawve.c
index 2e393847c..735735548 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
@@ -314,10 +314,6 @@ static int demux_eawve_seek(demux_eawve_t *this, off_t start_pos, int start_time
return this->status;
}
-static void demux_eawve_dispose(demux_eawve_t *this){
- free(this);
-}
-
static int demux_eawve_get_status(demux_eawve_t *this){
return this->status;
}
@@ -348,7 +344,7 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
this->demux_plugin.send_headers = (void*)demux_eawve_send_headers;
this->demux_plugin.send_chunk = (void*)demux_eawve_send_chunk;
this->demux_plugin.seek = (void*)demux_eawve_seek;
- this->demux_plugin.dispose = (void*)demux_eawve_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = (void*)demux_eawve_get_status;
this->demux_plugin.get_stream_length = (void*)demux_eawve_get_stream_length;
this->demux_plugin.get_capabilities = demux_eawve_get_capabilities;
@@ -359,19 +355,7 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -390,37 +374,17 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
return &this->demux_plugin;
}
-static const char *get_description(demux_class_t *this_gen){
- return "Electronics Arts WVE format demux plugin";
-}
-
-static const char *get_identifier(demux_class_t *this_gen){
- return "EA WVE";
-}
-
-static const char *get_extensions(demux_class_t *this_gen){
- return "wve";
-}
-
-static const char *get_mimetypes(demux_class_t *this_gen){
- return NULL;
-}
-
-static void class_dispose(demux_class_t *this){
- free(this);
-}
-
void *demux_eawve_init_plugin(xine_t *xine, void *data) {
demux_eawve_class_t *this;
this = calloc(1, sizeof(demux_eawve_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;
+ this->demux_class.description = N_("Electronics Arts WVE format demux plugin");
+ this->demux_class.identifier = "EA WVE";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "wve";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_elem.c b/src/demuxers/demux_elem.c
index d38fe3c62..ddd067eb0 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
@@ -169,11 +169,6 @@ static int demux_mpeg_elem_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_mpeg_elem_dispose (demux_plugin_t *this) {
-
- free (this);
-}
-
static int demux_mpeg_elem_get_stream_length(demux_plugin_t *this_gen) {
return 0 ; /*FIXME: implement */
}
@@ -222,15 +217,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- 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))
- return NULL;
- }
+ case METHOD_BY_MRL:
break;
case METHOD_EXPLICIT:
@@ -247,7 +234,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_mpeg_elem_send_headers;
this->demux_plugin.send_chunk = demux_mpeg_elem_send_chunk;
this->demux_plugin.seek = demux_mpeg_elem_seek;
- this->demux_plugin.dispose = demux_mpeg_elem_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_mpeg_elem_get_status;
this->demux_plugin.get_stream_length = demux_mpeg_elem_get_stream_length;
this->demux_plugin.get_capabilities = demux_mpeg_elem_get_capabilities;
@@ -259,39 +246,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Elementary MPEG stream demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG_ELEM";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mpv";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_mpeg_elem_class_t *this = (demux_mpeg_elem_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_elem_class_t *this;
this = calloc(1, sizeof(demux_mpeg_elem_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;
+ this->demux_class.description = N_("Elementary MPEG stream demux plugin");
+ this->demux_class.identifier = "MPEG_ELEM";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "mpv";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -305,6 +270,6 @@ static const demuxer_info_t demux_info_elem = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "elem", XINE_VERSION_CODE, &demux_info_elem, init_plugin },
+ { PLUGIN_DEMUX, 27, "elem", XINE_VERSION_CODE, &demux_info_elem, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index a8bd0b288..c2cd271ea 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"
@@ -154,7 +154,7 @@ static int open_film_file(demux_film_t *film) {
film_header = malloc(film_header_size);
if (!film_header)
return 0;
- strncpy(film->version, &scratch[8], 4);
+ memcpy(film->version, &scratch[8], 4);
llprintf(DEBUG_FILM_LOAD, "0x%X header bytes, version %c%c%c%c\n",
film_header_size,
film->version[0],
@@ -201,7 +201,11 @@ static int open_film_file(demux_film_t *film) {
film->video_type = _x_fourcc_to_buf_video(*(uint32_t *)&film_header[i + 8]);
if( !film->video_type )
+ {
film->video_type = BUF_VIDEO_UNKNOWN;
+ _x_report_video_fourcc (film->stream->xine, LOG_MODULE,
+ *(uint32_t *)&film_header[i + 8]);
+ }
/* fetch the audio information if the chunk size checks out */
if (chunk_size == 32) {
@@ -251,12 +255,11 @@ static int open_film_file(demux_film_t *film) {
llprintf(DEBUG_FILM_LOAD, "parsing STAB chunk\n");
/* load the sample table */
- if (film->sample_table)
- free(film->sample_table);
+ free(film->sample_table);
film->frequency = _X_BE_32(&film_header[i + 8]);
film->sample_count = _X_BE_32(&film_header[i + 12]);
film->sample_table =
- calloc(film->sample_count, sizeof(film_sample_t));
+ xine_xcalloc(film->sample_count, sizeof(film_sample_t));
if (!film->sample_table)
goto film_abort;
for (j = 0; j < film->sample_count; j++) {
@@ -824,8 +827,7 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start
static void demux_film_dispose (demux_plugin_t *this_gen) {
demux_film_t *this = (demux_film_t *) this_gen;
- if (this->sample_table)
- free(this->sample_table);
+ free(this->sample_table);
free(this->interleave_buffer);
free(this);
}
@@ -874,19 +876,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -905,39 +895,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "FILM (CPK) demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "FILM (CPK)";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "cpk cak film";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_film_class_t *this = (demux_film_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_film_init_plugin (xine_t *xine, void *data) {
demux_film_class_t *this;
this = calloc(1, sizeof(demux_film_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;
+ this->demux_class.description = N_("FILM (CPK) demux plugin");
+ this->demux_class.identifier = "FILM (CPK)";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "cpk cak film";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c
index 672eafdbb..2135f8d60 100644
--- a/src/demuxers/demux_flac.c
+++ b/src/demuxers/demux_flac.c
@@ -43,10 +43,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"
@@ -83,6 +83,7 @@ typedef struct {
* It returns 1 if flac file was opened successfully. */
static int open_flac_file(demux_flac_t *flac) {
+ uint32_t signature;
unsigned char preamble[10];
unsigned int block_length;
unsigned char buffer[FLAC_SEEKPOINT_SIZE];
@@ -93,7 +94,7 @@ static int open_flac_file(demux_flac_t *flac) {
/* fetch the file signature, 4 bytes will read both the fLaC
* signature and the */
- if (_x_demux_read_header(flac->input, preamble, 4) != 4)
+ if (_x_demux_read_header(flac->input, &signature, 4) != 4)
return 0;
flac->input->seek(flac->input, 4, SEEK_SET);
@@ -103,16 +104,15 @@ static int open_flac_file(demux_flac_t *flac) {
* users use them and want them working, so check and skip the ID3
* tag if present.
*/
- if ( id3v2_istag(preamble) ) {
- id3v2_parse_tag(flac->input, flac->stream, preamble);
+ if ( id3v2_istag(signature) ) {
+ id3v2_parse_tag(flac->input, flac->stream, signature);
- if ( flac->input->read(flac->input, preamble, 4) != 4 )
+ if ( flac->input->read(flac->input, &signature, 4) != 4 )
return 0;
}
/* validate signature */
- if ((preamble[0] != 'f') || (preamble[1] != 'L') ||
- (preamble[2] != 'a') || (preamble[3] != 'C'))
+ if ( signature != ME_FOURCC('f', 'L', 'a', 'C') )
return 0;
/* loop through the metadata blocks; use a do-while construct since there
@@ -167,8 +167,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 = calloc(flac->seekpoint_count,
- sizeof(flac_seekpoint_t));
+ flac->seekpoints = xine_xcalloc(flac->seekpoint_count,
+ sizeof(flac_seekpoint_t));
if (flac->seekpoint_count && !flac->seekpoints)
return 0;
for (i = 0; i < flac->seekpoint_count; i++) {
@@ -196,8 +196,7 @@ static int open_flac_file(demux_flac_t *flac) {
{
char comments[block_length + 1]; /* last byte for NUL termination */
char *ptr = comments;
- uint32_t length, user_comment_list_length;
- int cn;
+ uint32_t length, user_comment_list_length, cn;
char *comment;
char c;
@@ -532,19 +531,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -563,40 +550,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Free Lossless Audio Codec (flac) demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "FLAC";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "flac";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-flac: flac: FLAC Audio;"
- "audio/flac: flac: FLAC Audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_flac_class_t *this = (demux_flac_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_flac_init_plugin (xine_t *xine, void *data) {
demux_flac_class_t *this;
this = calloc(1, sizeof(demux_flac_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;
+ this->demux_class.description = N_("Free Lossless Audio Codec (flac) demux plugin");
+ this->demux_class.identifier = "FLAC";
+ 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;
return this;
}
diff --git a/src/demuxers/demux_fli.c b/src/demuxers/demux_fli.c
index 7735671b9..498f7f0db 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
@@ -266,11 +266,6 @@ static int demux_fli_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
return this->status;
}
-static void demux_fli_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_fli_get_status (demux_plugin_t *this_gen) {
demux_fli_t *this = (demux_fli_t *) this_gen;
@@ -310,7 +305,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_fli_send_headers;
this->demux_plugin.send_chunk = demux_fli_send_chunk;
this->demux_plugin.seek = demux_fli_seek;
- this->demux_plugin.dispose = demux_fli_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_fli_get_status;
this->demux_plugin.get_stream_length = demux_fli_get_stream_length;
this->demux_plugin.get_capabilities = demux_fli_get_capabilities;
@@ -321,19 +316,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -352,39 +335,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Autodesk Animator FLI/FLC demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "FLI/FLC";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "fli flc";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/x-flic: fli,flc: Autodesk FLIC files;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_fli_class_t *this = (demux_fli_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_fli_class_t *this;
this = calloc(1, sizeof(demux_fli_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;
+ this->demux_class.description = N_("Autodesk Animator FLI/FLC demux plugin");
+ this->demux_class.identifier = "FLI/FLC";
+ this->demux_class.mimetypes = "video/x-flic: fli,flc: Autodesk FLIC files;";
+ this->demux_class.extensions = "fli flc";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -398,6 +359,6 @@ static const demuxer_info_t demux_info_fli = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "fli", XINE_VERSION_CODE, &demux_info_fli, init_plugin },
+ { PLUGIN_DEMUX, 27, "fli", XINE_VERSION_CODE, &demux_info_fli, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c
index c421e6053..090fe1097 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"
@@ -799,8 +799,7 @@ static void seek_flv_file(demux_flv_t *this, off_t seek_pos, int seek_pts) {
return;
}
/* check StreamID and CodecID */
- if (buf[0] == 0 && buf[1] == 0 && buf[2] == 0 &&
- buf[3] == (this->videocodec | 0x10)) {
+ if ( _X_ME_32(buf) == ME_FOURCC(0, 0, 0, (this->videocodec | 0x10)) ) {
this->input->seek(this->input, -16, SEEK_CUR);
lprintf(" ...resynced after %d bytes\n", i);
return;
@@ -975,7 +974,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->status = DEMUX_FINISHED;
switch (stream->content_detection_method) {
- case METHOD_BY_EXTENSION:
+ case METHOD_BY_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
if (!open_flv_file(this)) {
@@ -992,41 +991,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Flash Video file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "FLV";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "flv";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/x-flv: flv: Flash video;"
- "video/flv: flv: Flash video;"
- "application/x-flash-video: flv: Flash video;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_flv_class_t *this = (demux_flv_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_flv_class_t *this;
this = calloc(1, sizeof(demux_flv_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;
+ 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;"
+ "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;
return this;
}
@@ -1040,6 +1017,6 @@ static const demuxer_info_t demux_info_flv = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "flashvideo", XINE_VERSION_CODE, &demux_info_flv, init_plugin },
+ { PLUGIN_DEMUX, 27, "flashvideo", XINE_VERSION_CODE, &demux_info_flv, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 7fbc89ca5..954a2fc1a 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"
@@ -129,7 +129,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) {
unsigned char disk_palette[PALETTE_SIZE * 3];
palette_entry_t palette[PALETTE_SIZE];
int i;
- unsigned int remaining_sample_bytes;
+ int remaining_sample_bytes;
int scale_bits;
/* figure out what the next data is */
@@ -356,7 +356,8 @@ static int open_idcin_file(demux_idcin_t *this) {
static void demux_idcin_send_headers(demux_plugin_t *this_gen) {
demux_idcin_t *this = (demux_idcin_t *) this_gen;
buf_element_t *buf;
- uint32_t i, size;
+ uint32_t i;
+ int size;
this->video_fifo = this->stream->video_fifo;
this->audio_fifo = this->stream->audio_fifo;
@@ -449,11 +450,6 @@ static int demux_idcin_seek (demux_plugin_t *this_gen, off_t start_pos, int star
return this->status;
}
-static void demux_idcin_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_idcin_get_status (demux_plugin_t *this_gen) {
demux_idcin_t *this = (demux_idcin_t *) this_gen;
@@ -485,7 +481,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_idcin_send_headers;
this->demux_plugin.send_chunk = demux_idcin_send_chunk;
this->demux_plugin.seek = demux_idcin_seek;
- this->demux_plugin.dispose = demux_idcin_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_idcin_get_status;
this->demux_plugin.get_stream_length = demux_idcin_get_stream_length;
this->demux_plugin.get_capabilities = demux_idcin_get_capabilities;
@@ -496,19 +492,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -527,40 +511,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-
-static const char *get_description (demux_class_t *this_gen) {
- return "Id Quake II Cinematic file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Id CIN";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "cin";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_idcin_class_t *this = (demux_idcin_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_idcin_init_plugin (xine_t *xine, void *data) {
demux_idcin_class_t *this;
this = calloc(1, sizeof(demux_idcin_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;
+ this->demux_class.description = N_("Id Quake II Cinematic file demux plugin");
+ this->demux_class.identifier = "Id CIN";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "cin";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c
index fb7d1c748..f199723e1 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"
@@ -1122,92 +1122,29 @@ static int demux_iff_seek (demux_plugin_t *this_gen,
static void demux_iff_dispose (demux_plugin_t *this_gen) {
demux_iff_t *this = (demux_iff_t *) this_gen;
- if( this->bmhd ) {
- free(this->bmhd);
- this->bmhd = NULL;
- }
- if( this->cmap ) {
- free( this->cmap );
- this->cmap = NULL;
- }
- if( this->grab ) {
- free(this->grab);
- this->grab = NULL;
- }
- if( this->dest ) {
- free(this->dest);
- this->dest = NULL;
- }
- if( this->camg ) {
- free(this->camg);
- this->camg = NULL;
- }
- if( this->ccrt ) {
- free(this->ccrt);
- this->ccrt = NULL;
- }
- if( this->dpi ) {
- free(this->dpi);
- this->dpi = NULL;
- }
-
- if( this->vhdr ) {
- free(this->vhdr);
- this->vhdr = NULL;
- }
- if( this->atak )
- {
- free( this->atak );
- this->atak = NULL;
- }
- if( this->rlse ) {
- free( this->rlse );
- this->rlse = NULL;
- }
-
- if( this->anhd ) {
- free( this->anhd );
- this->anhd = NULL;
- }
+ free(this->bmhd);
+ free(this->cmap);
+ free(this->grab);
+ free(this->dest);
+ free(this->camg);
+ free(this->ccrt);
+ free(this->dpi);
+ free(this->vhdr);
+ free(this->atak);
+ free(this->rlse);
+ free(this->anhd);
+ free(this->dpan);
+
+ free(this->title);
+ free(this->copyright);
+ free(this->author);
+ free(this->annotations);
+ free(this->version);
+ free(this->text);
+
+ free (this->audio_interleave_buffer);
+ free (this->audio_read_buffer);
- if( this->dpan ) {
- free( this->dpan );
- this->dpan = NULL;
- }
-
- if( this->title ) {
- free (this->title);
- this->title = NULL;
- }
- if( this->copyright ) {
- free (this->copyright);
- this->copyright = NULL;
- }
- if( this->author ) {
- free (this->author);
- this->author = NULL;
- }
- if( this->annotations ) {
- free (this->annotations);
- this->annotations = NULL;
- }
- if( this->version ) {
- free (this->version);
- this->version = NULL;
- }
- if( this->text ) {
- free (this->text);
- this->text = NULL;
- }
-
- if( this->audio_interleave_buffer ) {
- free (this->audio_interleave_buffer);
- this->audio_interleave_buffer = NULL;
- }
- if( this->audio_read_buffer ) {
- free (this->audio_read_buffer);
- this->audio_read_buffer = NULL;
- }
this->audio_buffer_filled = 0;
free(this);
@@ -1258,19 +1195,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -1289,46 +1214,25 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "IFF demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "IFF";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "iff svx 8svx 16sv ilbm ham ham6 ham8 anim anim3 anim5 anim7 anim8";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-8svx: 8svx: IFF-8SVX Audio;"
- "audio/8svx: 8svx: IFF-8SVX Audio;"
- "audio/x-16sv: 16sv: IFF-16SV Audio;"
- "audio/168sv: 16sv: IFF-16SV Audio;"
- "image/x-ilbm: ilbm: IFF-ILBM Picture;"
- "image/ilbm: ilbm: IFF-ILBM Picture;"
- "video/x-anim: anim: IFF-ANIM Video;"
- "video/anim: anim: IFF-ANIM Video;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_iff_class_t *this = (demux_iff_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_iff_class_t *this;
this = calloc(1, sizeof(demux_iff_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;
+ this->demux_class.description = N_("IFF demux plugin");
+ this->demux_class.identifier = "IFF";
+ this->demux_class.mimetypes =
+ "audio/x-8svx: 8svx: IFF-8SVX Audio;"
+ "audio/8svx: 8svx: IFF-8SVX Audio;"
+ "audio/x-16sv: 16sv: IFF-16SV Audio;"
+ "audio/168sv: 16sv: IFF-16SV Audio;"
+ "image/x-ilbm: ilbm: IFF-ILBM Picture;"
+ "image/ilbm: ilbm: IFF-ILBM Picture;"
+ "video/x-anim: anim: IFF-ANIM Video;"
+ "video/anim: anim: IFF-ANIM Video;";
+ this->demux_class.extensions = "iff svx 8svx 16sv ilbm ham ham6 ham8 anim anim3 anim5 anim7 anim8";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -1342,7 +1246,7 @@ static const demuxer_info_t demux_info_iff = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "iff", XINE_VERSION_CODE, &demux_info_iff, init_plugin },
+ { PLUGIN_DEMUX, 27, "iff", XINE_VERSION_CODE, &demux_info_iff, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_image.c b/src/demuxers/demux_image.c
index 08136edba..af3983ea6 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
@@ -143,13 +143,6 @@ static int demux_image_get_optional_data(demux_plugin_t *this_gen,
return DEMUX_OPTIONAL_UNSUPPORTED;
}
-static void demux_image_dispose (demux_plugin_t *this_gen) {
- demux_image_t *this = (demux_image_t *) this_gen;
-
- lprintf("closed\n");
- free (this);
-}
-
static demux_plugin_t *open_plugin (demux_class_t *class_gen,
xine_stream_t *stream,
input_plugin_t *input) {
@@ -174,18 +167,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
}
break;
- 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)) {
- return NULL;
- }
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -205,7 +187,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this->demux_plugin.send_headers = demux_image_send_headers;
this->demux_plugin.send_chunk = demux_image_send_chunk;
this->demux_plugin.seek = demux_image_seek;
- this->demux_plugin.dispose = demux_image_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_image_get_status;
this->demux_plugin.get_stream_length = demux_image_get_stream_length;
this->demux_plugin.get_capabilities = demux_image_get_capabilities;
@@ -222,41 +204,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
/*
* image demuxer class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "image demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "imagedmx";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "png gif jpg jpeg";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_image_class_t *this = (demux_image_class_t *) this_gen;
-
- lprintf("class closed\n");
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_image_class_t *this;
this = calloc(1, sizeof(demux_image_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;
+ this->demux_class.description = N_("image demux plugin");
+ this->demux_class.identifier = "imagedmx";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "png gif jpg jpeg";
+ this->demux_class.dispose = default_demux_class_dispose;
lprintf("class opened\n");
return this;
@@ -271,6 +229,6 @@ static const demuxer_info_t demux_info_image = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "image", XINE_VERSION_CODE, &demux_info_image, init_class },
+ { PLUGIN_DEMUX, 27, "image", XINE_VERSION_CODE, &demux_info_image, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_ipmovie.c b/src/demuxers/demux_ipmovie.c
index 5b4e12ef8..a8930b8fa 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"
@@ -532,7 +532,7 @@ static int open_ipmovie_file(demux_ipmovie_t *this) {
IPMOVIE_SIGNATURE_SIZE)
return 0;
- if (strncmp(signature, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0)
+ if (memcmp(signature, IPMOVIE_SIGNATURE, IPMOVIE_SIGNATURE_SIZE) != 0)
return 0;
/* file is qualified; skip over the signature bytes (+ 6 unknown) in the stream */
@@ -691,19 +691,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -722,39 +710,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Interplay MVE Movie demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Interplay MVE";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mve mv8";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_ipmovie_class_t *this = (demux_ipmovie_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_ipmovie_init_plugin (xine_t *xine, void *data) {
demux_ipmovie_class_t *this;
this = calloc(1, sizeof(demux_ipmovie_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;
+ this->demux_class.description = N_("Interplay MVE Movie demux plugin");
+ this->demux_class.identifier = "Interplay MVE";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "mve mv8";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_matroska-chapters.c b/src/demuxers/demux_matroska-chapters.c
index 4bfafe0da..93e6d4cd6 100644
--- a/src/demuxers/demux_matroska-chapters.c
+++ b/src/demuxers/demux_matroska-chapters.c
@@ -36,9 +36,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>
#include "ebml.h"
#include "matroska.h"
diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c
index 242293502..32feacf28 100644
--- a/src/demuxers/demux_matroska.c
+++ b/src/demuxers/demux_matroska.c
@@ -43,10 +43,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"
@@ -1135,7 +1135,7 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
case MATROSKA_ID_TR_CODECPRIVATE:
{
- char *codec_private;
+ uint8_t *codec_private;
if (elem.len >= 0x80000000)
return 0;
codec_private = malloc (elem.len);
@@ -1251,10 +1251,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
}
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
- "demux_matroska: Track %d, %s %s\n",
- track->track_num,
- (track->codec_id ? track->codec_id : ""),
- (track->language ? track->language : ""));
+ "demux_matroska: Track %d, %s %s\n",
+ track->track_num,
+ (track->codec_id ? track->codec_id : ""),
+ (track->language ? track->language : ""));
if (track->codec_id) {
void (*init_codec)(demux_matroska_t *, matroska_track_t *) = NULL;
@@ -1267,13 +1267,15 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
_x_bmiheader_le2me(bih);
track->buf_type = _x_fourcc_to_buf_video(bih->biCompression);
+ if (!track->buf_type)
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, bih->biCompression);
init_codec = init_codec_video;
}
} else if (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_UNCOMPRESSED)) {
} else if ((!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MPEG4_SP)) ||
- (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MPEG4_ASP)) ||
- (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MPEG4_AP))) {
+ (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MPEG4_ASP)) ||
+ (!strcmp(track->codec_id, MATROSKA_CODEC_ID_V_MPEG4_AP))) {
xine_bmiheader *bih;
lprintf("MATROSKA_CODEC_ID_V_MPEG4_*\n");
@@ -1374,8 +1376,8 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
track->buf_type = BUF_VIDEO_THEORA_RAW;
init_codec = init_codec_xiph;
} else if ((!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L1)) ||
- (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L2)) ||
- (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L3))) {
+ (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L2)) ||
+ (!strcmp(track->codec_id, MATROSKA_CODEC_ID_A_MPEG1_L3))) {
lprintf("MATROSKA_CODEC_ID_A_MPEG1\n");
track->buf_type = BUF_AUDIO_MPEG;
init_codec = init_codec_audio;
@@ -1413,10 +1415,12 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
_x_waveformatex_le2me(wfh);
track->buf_type = _x_formattag_to_buf_audio(wfh->wFormatTag);
+ if (!track->buf_type)
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, wfh->wFormatTag);
init_codec = init_codec_audio;
}
} else if (!strncmp(track->codec_id, MATROSKA_CODEC_ID_A_AAC,
- sizeof(MATROSKA_CODEC_ID_A_AAC) - 1)) {
+ sizeof(MATROSKA_CODEC_ID_A_AAC) - 1)) {
lprintf("MATROSKA_CODEC_ID_A_AAC\n");
track->buf_type = BUF_AUDIO_AAC;
init_codec = init_codec_aac;
@@ -1500,10 +1504,10 @@ static int parse_track_entry(demux_matroska_t *this, matroska_track_t *track) {
}
if (init_codec) {
- if (! track->fifo) {
- xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
- "demux_matroska: Error: fifo not set up for track of type type %" PRIu32 "\n", track->track_type);
- return 0;
+ if (! track->fifo) {
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ "demux_matroska: Error: fifo not set up for track of type type %" PRIu32 "\n", track->track_type);
+ return 0;
}
init_codec(this, track);
}
@@ -1653,10 +1657,10 @@ static int parse_cue_point(demux_matroska_t *this) {
this->num_indexes++;
}
if ((index->num_entries % 1024) == 0) {
- index->pos = (off_t *)realloc(index->pos, sizeof(off_t) *
- (index->num_entries + 1024));
- index->timecode = (off_t *)realloc(index->timecode, sizeof(uint64_t) *
- (index->num_entries + 1024));
+ index->pos = realloc(index->pos, sizeof(off_t) *
+ (index->num_entries + 1024));
+ index->timecode = realloc(index->timecode, sizeof(uint64_t) *
+ (index->num_entries + 1024));
}
index->pos[index->num_entries] = pos;
index->timecode[index->num_entries] = timecode;
@@ -1742,10 +1746,7 @@ static int parse_tags(demux_matroska_t *this) {
static void alloc_block_data (demux_matroska_t *this, size_t 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;
}
}
@@ -2849,37 +2850,26 @@ static void demux_matroska_dispose (demux_plugin_t *this_gen) {
/* free tracks */
for (i = 0; i < this->num_tracks; i++) {
- matroska_track_t *track;
-
- track = this->tracks[i];
- if (track->language)
- free (track->language);
- if (track->codec_id)
- free (track->codec_id);
- if (track->codec_private)
- free (track->codec_private);
- if (track->video_track)
- free (track->video_track);
- if (track->audio_track)
- free (track->audio_track);
- if (track->sub_track)
- free (track->sub_track);
+ matroska_track_t *const track = this->tracks[i];
+
+ free (track->language);
+ free (track->codec_id);
+ free (track->codec_private);
+ free (track->video_track);
+ free (track->audio_track);
+ free (track->sub_track);
free (track);
}
/* Free the cues. */
for (i = 0; i < this->num_indexes; i++) {
- if (this->indexes[i].pos)
- free(this->indexes[i].pos);
- if (this->indexes[i].timecode)
- free(this->indexes[i].timecode);
+ free(this->indexes[i].pos);
+ free(this->indexes[i].timecode);
}
- if (this->indexes)
- free(this->indexes);
+ free(this->indexes);
/* Free the top_level elem list */
- if (this->top_level_list)
- free(this->top_level_list);
+ free(this->top_level_list);
free(this->title);
@@ -2987,18 +2977,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl(input);
- const char *const extensions = class_gen->get_extensions (class_gen);;
-
- lprintf ("stage by extension %s\n", mrl);
-
- if (!_x_demux_check_extension (mrl, extensions))
- return NULL;
-
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -3057,36 +3036,6 @@ error:
/*
* demux matroska class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "matroska & webm demux plugin";
-}
-
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "matroska";
-}
-
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mkv wbm webm";
-}
-
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/mkv: mkv: matroska;"
- "video/x-matroska: mkv: matroska;"
- "video/webm: wbm,webm: WebM;";
-}
-
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_matroska_class_t *this = (demux_matroska_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_matroska_class_t *this;
@@ -3095,11 +3044,14 @@ static void *init_class (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("matroska & webm demux plugin");
+ this->demux_class.identifier = "matroska";
+ this->demux_class.mimetypes = "video/mkv: mkv: matroska;"
+ "video/x-matroska: mkv: matroska;"
+ "video/webm: wbm,webm: WebM;";
+
+ this->demux_class.extensions = "mkv wbm webm";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -3113,6 +3065,6 @@ static const demuxer_info_t demux_info_matroska = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "matroska", XINE_VERSION_CODE, &demux_info_matroska, init_class },
+ { PLUGIN_DEMUX, 27, "matroska", XINE_VERSION_CODE, &demux_info_matroska, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_matroska.h b/src/demuxers/demux_matroska.h
index 841847ec1..670827598 100644
--- a/src/demuxers/demux_matroska.h
+++ b/src/demuxers/demux_matroska.h
@@ -35,9 +35,9 @@
#include <stdlib.h>
#include <zlib.h>
-#include "xine_internal.h"
-#include "demux.h"
-#include "buffer.h"
+#include <xine/xine_internal.h>
+#include <xine/demux.h>
+#include <xine/buffer.h>
#include "bswap.h"
#include "ebml.h"
diff --git a/src/demuxers/demux_mng.c b/src/demuxers/demux_mng.c
index bf4dfec4e..b2bb819d8 100644
--- a/src/demuxers/demux_mng.c
+++ b/src/demuxers/demux_mng.c
@@ -44,9 +44,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>
#include <libmng.h>
@@ -295,17 +295,7 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
}
break;
- 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;
- }
- }
+ case METHOD_BY_MRL:
break;
default:
@@ -344,40 +334,21 @@ static demux_plugin_t* open_plugin(demux_class_t *class_gen, xine_stream_t *stre
return &this->demux_plugin;
}
-static const char *get_description(demux_class_t *this_gen){
- return "Multiple-image Network Graphics demux plugin";
-}
-
-static const char *get_identifier(demux_class_t *this_gen){
- return "MNG";
-}
-
-static const char *get_extensions(demux_class_t *this_gen){
- return "png mng";
-}
-
-static const char *get_mimetypes(demux_class_t *this_gen){
- return "image/png: png: PNG image;"
- "image/x-png: png: PNG image;"
- "video/mng: mng: MNG animation;"
- "video/x-mng: mng: MNG animation;";
-}
-
-static void class_dispose(demux_class_t *this){
- free (this);
-}
-
static void *init_plugin(xine_t *xine, void *data){
demux_mng_class_t *this;
this = calloc(1, sizeof(demux_mng_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;
+ this->demux_class.description = N_("Multiple-image Network Graphics demux plugin");
+ this->demux_class.identifier = "MNG";
+ this->demux_class.mimetypes =
+ "image/png: png: PNG image;"
+ "image/x-png: png: PNG image;"
+ "video/mng: mng: MNG animation;"
+ "video/x-mng: mng: MNG animation;";
+ this->demux_class.extensions = "png mng";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -387,6 +358,6 @@ static const demuxer_info_t demux_info_mng = {
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- { PLUGIN_DEMUX, 26, "mng", XINE_VERSION_CODE, &demux_info_mng, (void*)init_plugin},
+ { PLUGIN_DEMUX, 27, "mng", XINE_VERSION_CODE, &demux_info_mng, (void*)init_plugin},
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_mod.c b/src/demuxers/demux_mod.c
index 2749eb048..4de5ca7d8 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>
@@ -44,11 +42,10 @@
/* #define LOG_VERBOSE */
/* #define LOG */
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "compat.h"
-#include "demux.h"
-#include "group_audio.h"
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/demux.h>
#include "modplug.h"
#include "bswap.h"
@@ -347,21 +344,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
case METHOD_EXPLICIT:
- 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;
- }
- if (!open_mod_file(this)) {
- free (this);
- return NULL;
- }
- }
+ case METHOD_BY_MRL:
break;
case METHOD_BY_CONTENT:
@@ -376,20 +359,16 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "ModPlug Amiga MOD Music file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "mod";
-}
+static void *demux_mod_init_plugin (xine_t *xine, void *data) {
+ demux_mod_class_t *this;
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mod it stm s3m 669 amf med mdl xm";
-}
+ this = calloc(1, sizeof(demux_mod_class_t));
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-mod: mod: SoundTracker/NoiseTracker/ProTracker Module;"
+ this->demux_class.open_plugin = open_plugin;
+ this->demux_class.description = N_("ModPlug Amiga MOD Music file demux plugin");
+ this->demux_class.identifier = "mod";
+ this->demux_class.mimetypes =
+ "audio/x-mod: mod: SoundTracker/NoiseTracker/ProTracker Module;"
"audio/mod: mod: SoundTracker/NoiseTracker/ProTracker Module;"
"audio/it: it: ImpulseTracker Module;"
"audio/x-it: it: ImpulseTracker Module;"
@@ -402,27 +381,17 @@ static const char *get_mimetypes (demux_class_t *this_gen) {
"audio/x-amf: amf: ADRIFT Module File;"
"audio/x-xm: xm: FastTracker II Audio;"
"audio/xm: xm: FastTracker II Audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_mod_class_t *this = (demux_mod_class_t *) this_gen;
-
- free (this);
-}
-
-void *demux_mod_init_plugin (xine_t *xine, void *data) {
- demux_mod_class_t *this;
-
- this = calloc(1, sizeof(demux_mod_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;
+ this->demux_class.extensions = "mod it stm s3m 669 amf med mdl xm";
+ this->demux_class.dispose = default_demux_class_dispose;
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, 27, "modplug", XINE_VERSION_CODE, &demux_info_mod, demux_mod_init_plugin },
+ { PLUGIN_NONE, 0, "", 0, NULL, NULL }
+};
diff --git a/src/demuxers/demux_mpc.c b/src/demuxers/demux_mpc.c
index 04b25eeb5..6658e82bc 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"
#include "id3.h"
@@ -90,7 +90,7 @@ static int open_mpc_file(demux_mpc_t *this) {
/* TODO: non-seeking version */
if (INPUT_IS_SEEKABLE(this->input)) {
/* Check for id3v2 tag */
- if (id3v2_istag(this->header)) {
+ if (id3v2_istag(_X_BE_32(this->header))) {
lprintf("found id3v2 header\n");
@@ -287,12 +287,6 @@ static int demux_mpc_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_mpc_dispose (demux_plugin_t *this_gen) {
- demux_mpc_t *this = (demux_mpc_t *) this_gen;
-
- free(this);
-}
-
static int demux_mpc_get_status (demux_plugin_t *this_gen) {
demux_mpc_t *this = (demux_mpc_t *) this_gen;
@@ -326,7 +320,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_mpc_send_headers;
this->demux_plugin.send_chunk = demux_mpc_send_chunk;
this->demux_plugin.seek = demux_mpc_seek;
- this->demux_plugin.dispose = demux_mpc_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_mpc_get_status;
this->demux_plugin.get_stream_length = demux_mpc_get_stream_length;
this->demux_plugin.get_capabilities = demux_mpc_get_capabilities;
@@ -336,19 +330,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -367,40 +349,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Musepack demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Musepack";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mpc mp+ mpp";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/musepack: mpc, mp+, mpp: Musepack audio;"
- "audio/x-musepack: mpc, mp+, mpp: Musepack audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_mpc_class_t *this = (demux_mpc_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_mpc_init_plugin (xine_t *xine, void *data) {
demux_mpc_class_t *this;
this = calloc(1, sizeof(demux_mpc_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;
+ this->demux_class.description = N_("Musepack demux plugin");
+ this->demux_class.identifier = "Musepack";
+ this->demux_class.mimetypes =
+ "audio/musepack: mpc, mp+, mpp: Musepack audio;"
+ "audio/x-musepack: mpc, mp+, mpp: Musepack audio;";
+ this->demux_class.extensions = "mpc mp+ mpp";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index dbaae108d..a0d813db6 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
@@ -246,6 +246,8 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
len = read_bytes(this, 2);
+ //printf( "parse_mpeg2_packet: stream_id=%X\n", stream_id);
+
if (stream_id==0xbd) {
int track;
@@ -483,7 +485,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
}
- } else if ((stream_id >= 0xbc) && ((stream_id & 0xf0) == 0xe0)) {
+ } else if ( ((stream_id >= 0xbc) && ((stream_id & 0xf0) == 0xe0)) || stream_id==0xfd ) {
w = read_bytes(this, 1);
flags = read_bytes(this, 1);
@@ -532,7 +534,7 @@ static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
return;
}
- buf->type = BUF_VIDEO_MPEG;
+ buf->type = (stream_id==0xfd) ? BUF_VIDEO_VC1 : BUF_VIDEO_MPEG;
buf->pts = pts;
buf->decoder_info[0] = pts - dts;
check_newpts( this, pts, PTS_VIDEO );
@@ -1054,11 +1056,6 @@ static int demux_mpeg_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_mpeg_dispose (demux_plugin_t *this_gen) {
-
- free (this_gen);
-}
-
static int demux_mpeg_get_stream_length (demux_plugin_t *this_gen) {
demux_mpeg_t *this = (demux_mpeg_t *) this_gen;
@@ -1090,7 +1087,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_mpeg_send_headers;
this->demux_plugin.send_chunk = demux_mpeg_send_chunk;
this->demux_plugin.seek = demux_mpeg_seek;
- this->demux_plugin.dispose = demux_mpeg_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_mpeg_get_status;
this->demux_plugin.get_stream_length = demux_mpeg_get_stream_length;
this->demux_plugin.get_capabilities = demux_mpeg_get_capabilities;
@@ -1212,19 +1209,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return NULL;
}
- 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;
- }
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -1236,40 +1221,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "MPEG program stream demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mpg mpeg";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/mpeg: mpeg, mpg, mpe: MPEG animation;"
- "video/x-mpeg: mpeg, mpg, mpe: MPEG animation;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_mpeg_class_t *this = (demux_mpeg_class_t *) this_gen;
-
- free (this);
- }
-
static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_class_t *this;
this = calloc(1, sizeof(demux_mpeg_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;
+ this->demux_class.description = N_("MPEG program stream demux plugin");
+ this->demux_class.identifier = "MPEG";
+ this->demux_class.mimetypes =
+ "video/mpeg: mpeg, mpg, mpe: MPEG animation;"
+ "video/x-mpeg: mpeg, mpg, mpe: MPEG animation;";
+ this->demux_class.extensions = "mpg mpeg";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -1283,6 +1247,6 @@ static const demuxer_info_t demux_info_mpeg = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "mpeg", XINE_VERSION_CODE, &demux_info_mpeg, init_plugin },
+ { PLUGIN_DEMUX, 27, "mpeg", XINE_VERSION_CODE, &demux_info_mpeg, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 08655ada9..cad841456 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.c
@@ -31,15 +31,21 @@
#include <unistd.h>
#include <string.h>
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <mem.h>
+#else
+# include <libavutil/mem.h>
+#endif
+
#define LOG_MODULE "demux_mpeg_block"
#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>
#define NUM_PREVIEW_BUFFERS 250
#define DISC_TRESHOLD 90000
@@ -1449,37 +1455,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- case METHOD_BY_EXTENSION: {
- 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);
- 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);
- return NULL;
- }
- }
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT: {
this->blocksize = input->get_blocksize(input);
@@ -1506,29 +1482,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "DVD/VOB demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG_BLOCK";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "vob";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_mpeg_block_class_t *this = (demux_mpeg_block_class_t *) this_gen;
-
- free (this);
- }
-
static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_block_class_t *this;
@@ -1538,11 +1491,11 @@ static void *init_plugin (xine_t *xine, void *data) {
this->xine = xine;
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;
+ 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 vcd:/ dvd:/ pvr:/";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -1556,6 +1509,6 @@ static const demuxer_info_t demux_info_mpeg_block = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "mpeg_block", XINE_VERSION_CODE, &demux_info_mpeg_block, init_plugin },
+ { PLUGIN_DEMUX, 27, "mpeg_block", XINE_VERSION_CODE, &demux_info_mpeg_block, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c
index 305069b3c..4d53b6d34 100644
--- a/src/demuxers/demux_mpeg_pes.c
+++ b/src/demuxers/demux_mpeg_pes.c
@@ -35,15 +35,21 @@
#include <unistd.h>
#include <string.h>
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <mem.h>
+#else
+# include <libavutil/mem.h>
+#endif
+
#define LOG_MODULE "demux_mpeg_pes"
#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>
#define NUM_PREVIEW_BUFFERS 250
#define DISC_TRESHOLD 90000
@@ -73,7 +79,6 @@ typedef struct demux_mpeg_pes_s {
char cur_mrl[256];
uint8_t *scratch;
- void *scratch_base;
int64_t nav_last_end_pts;
int64_t nav_last_start_pts;
@@ -1470,7 +1475,7 @@ static void demux_mpeg_pes_dispose (demux_plugin_t *this_gen) {
demux_mpeg_pes_t *this = (demux_mpeg_pes_t *) this_gen;
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
}
@@ -1656,7 +1661,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.get_optional_data = demux_mpeg_pes_get_optional_data;
this->demux_plugin.demux_class = class_gen;
- this->scratch = xine_xmalloc_aligned (512, 4096, &this->scratch_base);
+ this->scratch = av_mallocz(4096);
this->status = DEMUX_FINISHED;
/* Don't start demuxing stream until we see a program_stream_pack_header */
/* We need to system header in order to identify is the stream is mpeg1 or mpeg2. */
@@ -1675,7 +1680,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
/* use demux_mpeg_block for block devices */
if ((input->get_capabilities(input) & INPUT_CAP_BLOCK)) {
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
@@ -1691,7 +1696,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
|| (this->preview_data[2] != 0x01) ) {
lprintf("open_plugin:preview_data failed\n");
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
@@ -1702,7 +1707,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
case 0xbd ... 0xbe:
break;
default:
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
@@ -1724,7 +1729,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
|| (this->scratch[2] != 0x01) ) {
lprintf("open_plugin:scratch failed\n");
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
@@ -1735,7 +1740,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
case 0xbd ... 0xbe:
break;
default:
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
@@ -1749,31 +1754,14 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
}
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this->scratch_base);
- free (this);
- return NULL;
- }
-
- if (strncasecmp(ending, ".MPEG", 5)
- && strncasecmp (ending, ".vdr", 4)
- && strncasecmp (ending, ".mpg", 4)) {
- free (this->scratch_base);
- free (this);
- return NULL;
- }
- }
- break;
+ case METHOD_BY_MRL:
+ break;
case METHOD_EXPLICIT: {
@@ -1782,36 +1770,13 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
break;
default:
- free (this->scratch_base);
+ av_free (this->scratch);
free (this);
return NULL;
}
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "mpeg pes demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG_PES";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "pes";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/mp2p: m2p: MPEG2 program stream;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_mpeg_pes_class_t *this = (demux_mpeg_pes_class_t *) this_gen;
-
- free (this);
- }
-
static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_pes_class_t *this;
@@ -1820,11 +1785,11 @@ static void *init_plugin (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("mpeg pes demux plugin");
+ this->demux_class.identifier = "MPEG_PES";
+ this->demux_class.mimetypes = "video/mp2p: m2p: MPEG2 program stream;";
+ this->demux_class.extensions = "pes vdr:/ netvdr:/";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -1838,6 +1803,6 @@ static const demuxer_info_t demux_info_mpeg_pes = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "mpeg_pes", XINE_VERSION_CODE, &demux_info_mpeg_pes, init_plugin },
+ { PLUGIN_DEMUX, 27, "mpeg_pes", XINE_VERSION_CODE, &demux_info_mpeg_pes, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_mpgaudio.c b/src/demuxers/demux_mpgaudio.c
index 6205f9a08..8bcb7b760 100644
--- a/src/demuxers/demux_mpgaudio.c
+++ b/src/demuxers/demux_mpgaudio.c
@@ -38,10 +38,10 @@
/*
#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"
@@ -59,7 +59,7 @@
#define RIFF_TAG FOURCC_TAG('R', 'I', 'F', 'F')
#define AVI_TAG FOURCC_TAG('A', 'V', 'I', ' ')
#define CDXA_TAG FOURCC_TAG('C', 'D', 'X', 'A')
-#define MPEG_MARKER FOURCC_TAG( 0x00, 0x00, 0x01, 0xBA )
+#define MPEG_MARKER ME_FOURCC( 0x00, 0x00, 0x01, 0xBA )
/* Xing header stuff */
@@ -478,7 +478,7 @@ static vbri_header_t *XINE_MALLOC 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 = calloc (vbri->toc_entries + 1, sizeof (int));
+ vbri->toc = xine_xcalloc ((vbri->toc_entries + 1), sizeof(int));
if (!vbri->toc) {
free (vbri);
return NULL;
@@ -758,8 +758,8 @@ static int demux_mpgaudio_next (demux_mpgaudio_t *this, int decoder_flags, int s
/* 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)) {
+ if ( id3v2_istag(_X_ME_32(header)) ) {
+ if (!id3v2_parse_tag(this->input, this->stream, _X_ME_32(header))) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
LOG_MODULE ": ID3V2 tag parsing error\n");
bytes = 1; /* resync */
@@ -861,19 +861,16 @@ static int detect_mpgaudio_file(input_plugin_t *input,
if (preview_len < 4)
return 0;
- lprintf("got preview %02x %02x %02x %02x\n",
- buf[0], buf[1], buf[2], buf[3]);
+ head = _X_ME_32(buf);
- head = _X_BE_32(buf);
+ lprintf("got preview %08x\n", head);
- if ((head == ID3V22_TAG) ||
- (head == ID3V23_TAG) ||
- (head == ID3V24_TAG)) {
+ if (id3v2_istag(head)) {
/* check if a mp3 frame follows the tag
* id3v2 are not specific to mp3 files,
* flac files can contain id3v2 tags
*/
- uint32_t tag_size = _X_BE_32_synchsafe(&buf[6]);
+ int tag_size = _X_BE_32_synchsafe(&buf[6]);
lprintf("try to skip id3v2 tag (%d bytes)\n", tag_size);
if ((10 + tag_size) >= preview_len) {
lprintf("cannot skip id3v2 tag\n");
@@ -988,7 +985,7 @@ 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,
@@ -1131,11 +1128,6 @@ static int demux_mpgaudio_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_mpgaudio_dispose (demux_plugin_t *this) {
-
- free (this);
-}
-
static int demux_mpgaudio_get_stream_length (demux_plugin_t *this_gen) {
demux_mpgaudio_t *this = (demux_mpgaudio_t *) this_gen;
@@ -1171,18 +1163,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl(input);
- const char *const extensions = class_gen->get_extensions (class_gen);
-
- lprintf ("stage by extension %s\n", mrl);
-
- if (!_x_demux_check_extension (mrl, extensions))
- return NULL;
-
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -1195,7 +1176,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_mpgaudio_send_headers;
this->demux_plugin.send_chunk = demux_mpgaudio_send_chunk;
this->demux_plugin.seek = demux_mpgaudio_seek;
- this->demux_plugin.dispose = demux_mpgaudio_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_mpgaudio_get_status;
this->demux_plugin.get_stream_length = demux_mpgaudio_get_stream_length;
this->demux_plugin.get_capabilities = demux_mpgaudio_get_capabilities;
@@ -1218,49 +1199,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
/*
* demux mpegaudio class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "MPEG audio demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEGAUDIO";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen;
-
- if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) )
- return "mp3 mp2 mpa mpega";
- else
- return "";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen;
-
- if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) )
- return "audio/mpeg2: mp2: MPEG audio;"
- "audio/x-mpeg2: mp2: MPEG audio;"
- "audio/mpeg3: mp3: MPEG audio;"
- "audio/x-mpeg3: mp3: MPEG audio;"
- "audio/mpeg: mpa,abs,mpega: MPEG audio;"
- "audio/x-mpeg: mpa,abs,mpega: MPEG audio;"
- "audio/x-mpegurl: mp3: MPEG audio;"
- "audio/mpegurl: mp3: MPEG audio;"
- "audio/mp3: mp3: MPEG audio;"
- "audio/x-mp3: mp3: MPEG audio;";
- else
- return "";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_mpgaudio_class_t *this = (demux_mpgaudio_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_mpgaudio_init_class (xine_t *xine, void *data) {
demux_mpgaudio_class_t *this;
@@ -1269,11 +1207,26 @@ void *demux_mpgaudio_init_class (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("MPEG audio demux plugin");
+ this->demux_class.identifier = "MPEGAUDIO";
+ if( _x_decoder_available(this->xine, BUF_AUDIO_MPEG) ) {
+ this->demux_class.mimetypes =
+ "audio/mpeg2: mp2: MPEG audio;"
+ "audio/x-mpeg2: mp2: MPEG audio;"
+ "audio/mpeg3: mp3: MPEG audio;"
+ "audio/x-mpeg3: mp3: MPEG audio;"
+ "audio/mpeg: mpa,abs,mpega: MPEG audio;"
+ "audio/x-mpeg: mpa,abs,mpega: MPEG audio;"
+ "audio/x-mpegurl: mp3: MPEG audio;"
+ "audio/mpegurl: mp3: MPEG audio;"
+ "audio/mp3: mp3: MPEG audio;"
+ "audio/x-mp3: mp3: MPEG audio;";
+ this->demux_class.extensions = "mp3 mp2 mpa mpega";
+ } else {
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = NULL;
+ }
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_nsf.c b/src/demuxers/demux_nsf.c
deleted file mode 100644
index 40aeae9da..000000000
--- a/src/demuxers/demux_nsf.c
+++ /dev/null
@@ -1,386 +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
- */
-
-/*
- * 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
- */
-
-#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 (memcmp(header, "NESM\x1A", 5) != 0)
- return 0;
-
- this->total_songs = header[6];
- this->current_song = header[7];
- this->title = strndup((char*)&header[0x0E], 0x20);
- this->artist = strndup((char*)&header[0x2E], 0x20);
- this->copyright = strndup((char*)&header[0x4E], 0x20);
-
- 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 = calloc(1, 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 = calloc(1, 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_nsv.c b/src/demuxers/demux_nsv.c
index 8017d3d3f..89b6de6d6 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')
@@ -298,13 +298,21 @@ static int open_nsv_file(demux_nsv_t *this) {
if (_x_is_fourcc(&preview[4], "NONE"))
this->video_type = 0;
else
+ {
this->video_type = _x_fourcc_to_buf_video(this->video_fourcc);
+ if (!this->video_type)
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, this->video_fourcc);
+ }
this->audio_fourcc = _X_ME_32(&preview[8]);
if (_x_is_fourcc(&preview[8], "NONE"))
this->audio_type = 0;
else
+ {
this->audio_type = _x_formattag_to_buf_audio(this->audio_fourcc);
+ if (!this->audio_type)
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, this->audio_fourcc);
+ }
this->bih.biSize = sizeof(this->bih);
this->bih.biWidth = _X_LE_16(&preview[12]);
@@ -558,11 +566,6 @@ static int demux_nsv_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_nsv_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_nsv_get_status (demux_plugin_t *this_gen) {
demux_nsv_t *this = (demux_nsv_t *) this_gen;
@@ -594,7 +597,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_nsv_send_headers;
this->demux_plugin.send_chunk = demux_nsv_send_chunk;
this->demux_plugin.seek = demux_nsv_seek;
- this->demux_plugin.dispose = demux_nsv_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_nsv_get_status;
this->demux_plugin.get_stream_length = demux_nsv_get_stream_length;
this->demux_plugin.get_capabilities = demux_nsv_get_capabilities;
@@ -605,19 +608,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -636,39 +627,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Nullsoft Video demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Nullsoft NSV";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "nsv";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_nsv_class_t *this = (demux_nsv_class_t *) this_gen;
-
- free (this);
-}
-
static void *demux_nsv_init_plugin (xine_t *xine, void *data) {
demux_nsv_class_t *this;
this = calloc(1, sizeof(demux_nsv_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;
+ this->demux_class.description = N_("Nullsoft Video demux plugin");
+ this->demux_class.identifier = "Nullsoft NSV";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "nsv";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -682,6 +651,6 @@ static const demuxer_info_t demux_info_nsv = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "nsv", XINE_VERSION_CODE, &demux_info_nsv, demux_nsv_init_plugin },
+ { PLUGIN_DEMUX, 27, "nsv", XINE_VERSION_CODE, &demux_info_nsv, demux_nsv_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
deleted file mode 100644
index 8849e445e..000000000
--- a/src/demuxers/demux_ogg.c
+++ /dev/null
@@ -1,2312 +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
- */
-
-/*
- * demultiplexer for ogg streams
- */
-/* 2003.02.09 (dilb) update of the handling for audio/video infos for strongarm cpus. */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include <ogg/ogg.h>
-#include <vorbis/codec.h>
-
-#ifdef HAVE_SPEEX
-#include <speex/speex.h>
-#include <speex/speex_header.h>
-#include <speex/speex_stereo.h>
-#include <speex/speex_callbacks.h>
-#endif
-
-#ifdef HAVE_THEORA
-#include <theora/theora.h>
-#endif
-
-#define LOG_MODULE "demux_ogg"
-#define LOG_VERBOSE
-
-/*
-#define LOG
-*/
-
-#define DEBUG_PACKETS 0
-#define DEBUG_PREVIEWS 0
-#define DEBUG_PTS 0
-#define DEBUG_VIDEO_PACKETS 0
-
-#include "xine_internal.h"
-#include "xineutils.h"
-#include "demux.h"
-#include "bswap.h"
-#include "flacutils.h"
-
-#define CHUNKSIZE 8500
-#define PACKET_TYPE_HEADER 0x01
-#define PACKET_TYPE_COMMENT 0x03
-#define PACKET_TYPE_CODEBOOK 0x05
-#define PACKET_TYPE_BITS 0x07
-#define PACKET_LEN_BITS01 0xc0
-#define PACKET_LEN_BITS2 0x02
-#define PACKET_IS_SYNCPOINT 0x08
-
-#define MAX_STREAMS 32
-
-#define PTS_AUDIO 0
-#define PTS_VIDEO 1
-
-#define WRAP_THRESHOLD 900000
-
-#define SUB_BUFSIZE 1024
-
-typedef struct chapter_entry_s {
- int64_t start_pts;
- char *name;
-} chapter_entry_t;
-
-typedef struct chapter_info_s {
- int current_chapter;
- int max_chapter;
- chapter_entry_t *entries;
-} chapter_info_t;
-
-typedef struct stream_info_s {
- ogg_stream_state oss;
- uint32_t buf_types;
- int headers;
- int64_t header_granulepos;
- int64_t factor;
- int64_t quotient;
- int resync;
- char *language;
- /* CMML, Ogg Skeleton stream information */
- int granuleshift;
- /* Annodex v2 stream information */
- int hide_first_header;
- int delivered_bos;
- int delivered_eos;
-} stream_info_t;
-
-typedef struct demux_ogg_s {
- demux_plugin_t demux_plugin;
-
- xine_stream_t *stream;
- fifo_buffer_t *audio_fifo;
- fifo_buffer_t *video_fifo;
- input_plugin_t *input;
- int status;
-
- int frame_duration;
-
-#ifdef HAVE_THEORA
- theora_info t_info;
- theora_comment t_comment;
-#endif
-
- ogg_sync_state oy;
- ogg_page og;
-
- int64_t start_pts;
- int64_t last_pts[2];
-
- int time_length;
-
- int num_streams;
- stream_info_t *si[MAX_STREAMS]; /* stream info */
-
- int num_audio_streams;
- int num_video_streams;
- int unhandled_video_streams;
- int num_spu_streams;
-
- off_t avg_bitrate;
-
- char *meta[XINE_STREAM_INFO_MAX];
- chapter_info_t *chapter_info;
- xine_event_queue_t *event_queue;
-
- uint8_t send_newpts:1;
- uint8_t buf_flag_seek:1;
- uint8_t keyframe_needed:1;
- uint8_t ignore_keyframes:1;
-} demux_ogg_t ;
-
-typedef struct {
- demux_class_t demux_class;
-} demux_ogg_class_t;
-
-typedef struct {
- demux_class_t demux_class;
-} demux_anx_class_t;
-
-
-#ifdef HAVE_THEORA
-static int intlog(int num) {
- int ret=0;
-
- while(num>0){
- num=num/2;
- ret=ret+1;
- }
- return(ret);
-}
-#endif
-
-static int get_stream (demux_ogg_t *this, int serno) {
- /*finds the stream_num, which belongs to a ogg serno*/
- int i;
-
- for (i = 0; i<this->num_streams; i++) {
- if (this->si[i]->oss.serialno == serno) {
- return i;
- }
- }
- return -1;
-}
-
-static int new_stream_info (demux_ogg_t *this, const int cur_serno) {
- int stream_num;
-
- this->si[this->num_streams] = (stream_info_t *)calloc(1, sizeof(stream_info_t));
- ogg_stream_init(&this->si[this->num_streams]->oss, cur_serno);
- stream_num = this->num_streams;
- this->si[stream_num]->buf_types = 0;
- this->si[stream_num]->header_granulepos = -1;
- this->si[stream_num]->headers = 0;
- this->num_streams++;
-
- return stream_num;
-}
-
-static int64_t get_pts (demux_ogg_t *this, int stream_num , int64_t granulepos ) {
- /*calculates an pts from an granulepos*/
- if (granulepos<0) {
- if ( this->si[stream_num]->header_granulepos>=0 ) {
- /*return the smallest valid pts*/
- return 1;
- } else
- return 0;
- } else if (this->si[stream_num]->buf_types == BUF_VIDEO_THEORA ||
- (this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_SPU_CMML) {
- int64_t iframe, pframe;
- int granuleshift;
- granuleshift = this->si[stream_num]->granuleshift;
- iframe = granulepos >> granuleshift;
- pframe = granulepos - (iframe << granuleshift);
- if (this->si[stream_num]->quotient)
- return 1+((iframe+pframe) * this->si[stream_num]->factor / this->si[stream_num]->quotient);
- else
- return 0;
- } else if (this->si[stream_num]->quotient)
- return 1+(granulepos * this->si[stream_num]->factor / this->si[stream_num]->quotient);
- else
- return 0;
-}
-
-static int read_ogg_packet (demux_ogg_t *this) {
- char *buffer;
- long bytes;
- long total = 0;
- while (ogg_sync_pageout(&this->oy,&this->og)!=1) {
- buffer = ogg_sync_buffer(&this->oy, CHUNKSIZE);
- bytes = this->input->read(this->input, buffer, CHUNKSIZE);
- if (bytes <= 0) {
- if (total == 0) {
- lprintf("read_ogg_packet read nothing\n");
- return 0;
- }
- break;
- }
- ogg_sync_wrote(&this->oy, bytes);
- total += bytes;
- }
- return 1;
-}
-
-static void get_stream_length (demux_ogg_t *this) {
- /*determine the streamlenght and set this->time_length accordingly.
- ATTENTION:current_pos and oggbuffers will be destroyed by this function,
- there will be no way to continue playback uninterrupted.
-
- You have to seek afterwards, because after get_stream_length, the
- current_position is at the end of the file */
-
- off_t filelength;
- int done=0;
- int stream_num;
-
- this->time_length=-1;
-
- if (this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) {
- filelength=this->input->get_length(this->input);
-
- if (filelength!=-1) {
- if (filelength>70000) {
- this->demux_plugin.seek(&this->demux_plugin,
- (off_t) ( (double)(filelength-65536)/filelength*65535), 0, 0);
- }
- done=0;
- while (!done) {
- if (!read_ogg_packet (this)) {
- if (this->time_length) {
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_BITRATE,
- ((int64_t) 8000*filelength)/this->time_length);
- /*this is a fine place to compute avg_bitrate*/
- this->avg_bitrate= 8000*filelength/this->time_length;
- }
- return;
- }
- stream_num=get_stream(this, ogg_page_serialno (&this->og) );
- if (stream_num!=-1) {
- if (this->time_length < (get_pts(this, stream_num, ogg_page_granulepos(&this->og) / 90)))
- this->time_length = get_pts(this, stream_num, ogg_page_granulepos(&this->og)) / 90;
- }
- }
- }
- }
-}
-
-#ifdef HAVE_THEORA
-static void send_ogg_packet (demux_ogg_t *this,
- fifo_buffer_t *fifo,
- ogg_packet *op,
- int64_t pts,
- uint32_t decoder_flags,
- int stream_num) {
-
- buf_element_t *buf;
-
- int done=0,todo=op->bytes;
- const size_t op_size = sizeof(ogg_packet);
-
- while (done<todo) {
- size_t offset=0;
- buf = fifo->buffer_pool_alloc (fifo);
- buf->decoder_flags = decoder_flags;
- if (done==0) {
- memcpy (buf->content, op, op_size);
- offset=op_size;
- buf->decoder_flags = buf->decoder_flags | BUF_FLAG_FRAME_START;
- }
-
- if (done+buf->max_size-offset < todo) {
- memcpy (buf->content+offset, op->packet+done, buf->max_size-offset);
- buf->size = buf->max_size;
- done=done+buf->max_size-offset;
- } else {
- memcpy (buf->content+offset , op->packet+done, todo-done);
- buf->size = todo-done+offset;
- done=todo;
- buf->decoder_flags = buf->decoder_flags | BUF_FLAG_FRAME_END;
- }
-
- buf->pts = pts;
- if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
- buf->extra_info->input_time = buf->pts / 90 ;
- buf->type = this->si[stream_num]->buf_types;
-
- fifo->put (fifo, buf);
- }
-}
-#endif
-
-/* redefine abs as macro to handle 64-bit diffs.
- i guess llabs may not be available everywhere */
-#define abs(x) ( ((x)<0) ? -(x) : (x) )
-
-static void check_newpts (demux_ogg_t *this, int64_t pts, int video, int preview) {
- int64_t diff;
-
- llprintf(DEBUG_PTS, "new pts %" PRId64 " found in stream\n",pts);
-
- diff = pts - this->last_pts[video];
-
- if (!preview && (pts>=0) &&
- (this->send_newpts || (this->last_pts[video] && abs(diff)>WRAP_THRESHOLD) ) ) {
-
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "diff=%" PRId64 " (pts=%" PRId64 ", last_pts=%" PRId64 ")\n", diff, pts, this->last_pts[video]);
-
- if (this->buf_flag_seek) {
- _x_demux_control_newpts(this->stream, pts, BUF_FLAG_SEEK);
- this->buf_flag_seek = 0;
- } else {
- _x_demux_control_newpts(this->stream, pts, 0);
- }
- this->send_newpts = 0;
- this->last_pts[1-video] = 0;
- }
-
- if (!preview && (pts>=0) )
- this->last_pts[video] = pts;
-
- /* use pts for bitrate measurement */
-
- /*compute avg_bitrate if time_length isn't set*/
- if ((pts>180000) && !(this->time_length)) {
- this->avg_bitrate = this->input->get_current_pos (this->input) * 8 * 90000/ pts;
-
- if (this->avg_bitrate<1)
- this->avg_bitrate = 1;
-
- }
-}
-
-static void ogg_handle_event (demux_ogg_t *this) {
- xine_event_t *event;
-
- while ((event = xine_event_get(this->event_queue))) {
- switch(event->type) {
- case XINE_EVENT_INPUT_NEXT:
- {
- if (this->chapter_info) {
- int c_chap = this->chapter_info->current_chapter;
- if (c_chap+1 < this->chapter_info->max_chapter) {
- int start_time = this->chapter_info->entries[c_chap+1].start_pts / 90;
- this->demux_plugin.seek((demux_plugin_t *)this, 0, start_time, 1);
- }
- }
- }
- break;
- case XINE_EVENT_INPUT_PREVIOUS:
- {
- if (this->chapter_info) {
- int c_chap = this->chapter_info->current_chapter;
- if (c_chap >= 1) {
- int start_time = this->chapter_info->entries[c_chap-1].start_pts / 90;
- this->demux_plugin.seek((demux_plugin_t *)this, 0, start_time, 1);
- }
- }
- }
- break;
- }
- xine_event_free(event);
- }
- return;
-}
-
-
-#define OGG_META(TAG,APPEND) { #TAG"=", XINE_META_INFO_##TAG, APPEND }
-#define OGG_META_L(TAG,APPEND,META) { #TAG"=", XINE_META_INFO_##META, APPEND }
-static const struct ogg_meta {
- char tag[16];
- int meta;
- int append;
-} metadata[] = {
- OGG_META (ALBUM, 0),
- OGG_META (ARTIST, 0),
- OGG_META (PUBLISHER, 0),
- OGG_META (COPYRIGHT, 0),
- OGG_META (DISCNUMBER, 0),
- OGG_META (LICENSE, 0),
- OGG_META (TITLE, 0),
- OGG_META_L (TRACKNUMBER, 0, TRACK_NUMBER),
- OGG_META (COMPOSER, 1),
- OGG_META (ARRANGER, 1),
- OGG_META (LYRICIST, 1),
- OGG_META (AUTHOR, 1),
- OGG_META (CONDUCTOR, 1),
- OGG_META (PERFORMER, 1),
- OGG_META (ENSEMBLE, 1),
- OGG_META (OPUS, 0),
- OGG_META (PART, 0),
- OGG_META (PARTNUMBER, 0),
- OGG_META (GENRE, 1),
- OGG_META_L (DATE, 1, YEAR), /* hmm... */
- OGG_META (LOCATION, 0),
- OGG_META (COMMENT, 0),
-};
-
-#if 0
-/* ensure that those marked "append" are cleared */
-/* FIXME: is this useful? Should they be cleared on first write? */
-static void prepare_read_comments (demux_ogg_t *this)
-{
- int i;
-
- for (i = 0; i < sizeof (metadata) / sizeof (struct ogg_meta); ++i)
- if (metadata[i].append) {
- free (this->meta[metadata[i].meta]);
- this->meta[metadata[i].meta] = NULL;
- }
-}
-#endif
-
-static int read_comments (demux_ogg_t *this, const char *comment)
-{
- int i;
-
- for (i = 0; i < sizeof (metadata) / sizeof (struct ogg_meta); ++i) {
- size_t ml = strlen (metadata[i].tag);
- if (!strncasecmp (metadata[i].tag, comment, ml) && comment[ml]) {
- if (metadata[i].append && this->meta[metadata[i].meta]) {
- char *newstr;
- if (asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml) >= 0) {
- free (this->meta[metadata[i].meta]);
- this->meta[metadata[i].meta] = newstr;
- }
- }
- else {
- free (this->meta[metadata[i].meta]);
- this->meta[metadata[i].meta] = strdup (comment + ml);
- }
- _x_meta_info_set_utf8(this->stream, metadata[i].meta, this->meta[metadata[i].meta]);
- return 1;
- }
- }
- return 0;
-}
-
-/*
- * utility function to read a LANGUAGE= line from the user_comments,
- * to label audio and spu streams
- * utility function to read CHAPTER*=, TITLE= etc. from the user_comments,
- * to name (parts of) the stream
- */
-static void read_language_comment (demux_ogg_t *this, ogg_packet *op, int stream_num) {
- char **ptr;
- char *comment;
- vorbis_comment vc;
- vorbis_info vi;
-
- vorbis_comment_init(&vc);
- vorbis_info_init(&vi);
-
- /* this is necessary to make libvorbis accept this vorbis_info*/
- vi.rate=1;
-
- if ( vorbis_synthesis_headerin(&vi, &vc, op) >= 0) {
- ptr=vc.user_comments;
- while(*ptr) {
- comment=*ptr++;
- if ( !strncasecmp ("LANGUAGE=", comment, 9) ) {
- this->si[stream_num]->language = strdup (comment + strlen ("LANGUAGE=") );
- }
- else
- read_comments (this, comment);
- }
- }
- vorbis_comment_clear(&vc);
- vorbis_info_clear(&vi);
-}
-
-/*
- * utility function to read CHAPTER*= from the user_comments,
- * to name parts of the stream
- */
-static void read_chapter_comment (demux_ogg_t *this, ogg_packet *op) {
- char **ptr;
- char *comment;
- vorbis_comment vc;
- vorbis_info vi;
-
- vorbis_comment_init(&vc);
- vorbis_info_init(&vi);
-
- /* this is necessary to make libvorbis accept this vorbis_info*/
- vi.rate=1;
-
- if ( vorbis_synthesis_headerin(&vi, &vc, op) >= 0) {
- char *chapter_time = 0;
- char *chapter_name = 0;
- int chapter_no = 0;
-
- ptr=vc.user_comments;
-
- while(*ptr) {
- comment=*ptr++;
- if (read_comments (this, comment))
- continue;
-
- if ( !chapter_time && strlen(comment) == 22 &&
- !strncasecmp ("CHAPTER" , comment, 7) &&
- isdigit(*(comment+7)) && isdigit(*(comment+8)) &&
- (*(comment+9) == '=')) {
-
- chapter_time = strdup(comment+10);
- chapter_no = strtol(comment+7, NULL, 10);
- }
- if ( !chapter_name && !strncasecmp("CHAPTER", comment, 7) &&
- isdigit(*(comment+7)) && isdigit(*(comment+8)) &&
- !strncasecmp ("NAME=", comment+9, 5)) {
-
- if (strtol(comment+7,NULL,10) == chapter_no) {
- chapter_name = strdup(comment+14);
- }
- }
- if (chapter_time && chapter_name && chapter_no){
- int hour, min, sec, msec;
-
- lprintf("create chapter entry: no=%d name=%s time=%s\n", chapter_no, chapter_name, chapter_time);
- hour= strtol(chapter_time, NULL, 10);
- min = strtol(chapter_time+3, NULL, 10);
- sec = strtol(chapter_time+6, NULL, 10);
- msec = strtol(chapter_time+9, NULL, 10);
- lprintf("time: %d %d %d %d\n", hour, min,sec,msec);
-
- if (!this->chapter_info) {
- this->chapter_info = (chapter_info_t *)calloc(1, sizeof(chapter_info_t));
- this->chapter_info->current_chapter = -1;
- }
- this->chapter_info->max_chapter = chapter_no;
- this->chapter_info->entries = realloc( this->chapter_info->entries, chapter_no*sizeof(chapter_entry_t));
- this->chapter_info->entries[chapter_no-1].name = chapter_name;
- this->chapter_info->entries[chapter_no-1].start_pts = (msec + (1000.0 * sec) + (60000.0 * min) + (3600000.0 * hour))*90;
-
- free (chapter_time);
- chapter_no = 0;
- chapter_time = chapter_name = 0;
- }
- }
- }
- vorbis_comment_clear(&vc);
- vorbis_info_clear(&vi);
-}
-
-/*
- * update the display of the title, if needed
- */
-static void update_chapter_display (demux_ogg_t *this, int stream_num, ogg_packet *op) {
- int chapter = 0;
- int64_t pts = get_pts(this, stream_num, op->granulepos );
-
- while (chapter < this->chapter_info->max_chapter &&
- this->chapter_info->entries[chapter].start_pts < pts) {
- chapter++;
- }
- chapter--;
-
- if (chapter != this->chapter_info->current_chapter){
- xine_ui_data_t data = {
- .str = { 0, },
- .str_len = 0
- };
- xine_event_t uevent = {
- .type = XINE_EVENT_UI_SET_TITLE,
- .stream = this->stream,
- .data = &data,
- .data_length = sizeof(data)
- };
-
- this->chapter_info->current_chapter = chapter;
-
- if (chapter >= 0) {
- if (this->meta[XINE_META_INFO_TITLE]) {
- data.str_len = snprintf(data.str, sizeof(data.str), "%s / %s", this->meta[XINE_META_INFO_TITLE], this->chapter_info->entries[chapter].name);
- } else {
- strncpy(data.str, this->chapter_info->entries[chapter].name, sizeof(data.str)-1);
- }
- } else {
- strncpy(data.str, this->meta[XINE_META_INFO_TITLE], sizeof(data.str));
- }
- if ( data.str_len == 0 )
- data.str_len = strlen(data.str);
-
- _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, data.str);
- lprintf("new TITLE: %s\n", data.str);
-
- xine_event_send(this->stream, &uevent);
- }
-}
-
-/*
- * utility function to pack one ogg_packet into a xine
- * buffer, fill out all needed fields
- * and send it to the right fifo
- */
-
-static void send_ogg_buf (demux_ogg_t *this,
- ogg_packet *op,
- int stream_num,
- uint32_t decoder_flags) {
-
- int hdrlen;
- int normpos = 0;
-
- if( this->input->get_length (this->input) )
- normpos = (int)( (double) this->input->get_current_pos (this->input) *
- 65535 / this->input->get_length (this->input) );
-
-
- hdrlen = (*op->packet & PACKET_LEN_BITS01) >> 6;
- hdrlen |= (*op->packet & PACKET_LEN_BITS2) << 1;
-
- /* for Annodex files: the first packet after the AnxData info packet needs
- * to have its BOS flag set: we set it here */
- if (!this->si[stream_num]->delivered_bos) {
- op->b_o_s = 1;
- this->si[stream_num]->delivered_bos = 1;
- }
-
- if ( this->audio_fifo
- && (this->si[stream_num]->buf_types & 0xFF000000) == BUF_AUDIO_BASE) {
- uint8_t *data;
- int size;
- int64_t pts;
-
- if (op->packet[0] == PACKET_TYPE_COMMENT ) {
- read_language_comment(this, op, stream_num);
- }
-
- if ((this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_AUDIO_SPEEX ||
- (this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_AUDIO_FLAC ||
- (this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_AUDIO_VORBIS) {
- data = op->packet;
- size = op->bytes;
- } else {
- data = op->packet+1+hdrlen;
- size = op->bytes-1-hdrlen;
- }
- llprintf(DEBUG_PACKETS, "audio data size %d\n", size);
-
- if ((op->granulepos != -1) || (this->si[stream_num]->header_granulepos != -1)) {
- pts = get_pts(this, stream_num, op->granulepos );
- check_newpts( this, pts, PTS_AUDIO, decoder_flags );
- } else
- pts = 0;
-
- llprintf(DEBUG_PACKETS,
- "audiostream %d op-gpos %" PRId64 " hdr-gpos %" PRId64 " pts %" PRId64 " \n",
- stream_num,
- op->granulepos,
- this->si[stream_num]->header_granulepos,
- pts);
-
- _x_demux_send_data(this->audio_fifo, data, size,
- pts, this->si[stream_num]->buf_types, decoder_flags,
- normpos,
- pts / 90, this->time_length, 0);
-
-#ifdef HAVE_THEORA
- } else if ((this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_VIDEO_THEORA) {
-
- int64_t pts;
- theora_info t_info;
- theora_comment t_comment;
-
- theora_info_init (&t_info);
- theora_comment_init (&t_comment);
-
- /*Lets see if this is an Header*/
- if ((theora_decode_header(&t_info, &t_comment, op))>=0) {
- decoder_flags=decoder_flags|BUF_FLAG_HEADER;
- lprintf ("found an header\n");
- }
-
- if ((op->granulepos != -1) || (this->si[stream_num]->header_granulepos != -1)) {
- pts = get_pts(this, stream_num, op->granulepos );
- check_newpts( this, pts, PTS_VIDEO, decoder_flags );
- } else
- pts = 0;
-
- llprintf(DEBUG_PACKETS,
- "theorastream %d op-gpos %" PRId64 " hdr-gpos %" PRId64 " pts %" PRId64 " \n",
- stream_num,
- op->granulepos,
- this->si[stream_num]->header_granulepos,
- pts);
-
- send_ogg_packet (this, this->video_fifo, op, pts, decoder_flags, stream_num);
-
- theora_comment_clear (&t_comment);
- theora_info_clear (&t_info);
-#endif
-
- } else if ((this->si[stream_num]->buf_types & 0xFF000000) == BUF_VIDEO_BASE) {
-
- uint8_t *data;
- int size;
- int64_t pts;
-
- llprintf(DEBUG_VIDEO_PACKETS,
- "video buffer, type=%08x\n", this->si[stream_num]->buf_types);
-
- if (op->packet[0] == PACKET_TYPE_COMMENT ) {
- read_chapter_comment(this, op);
- }else{
- data = op->packet+1+hdrlen;
- size = op->bytes-1-hdrlen;
-
- if ((op->granulepos != -1) || (this->si[stream_num]->header_granulepos != -1)) {
- pts = get_pts(this, stream_num, op->granulepos );
- check_newpts( this, pts, PTS_VIDEO, decoder_flags );
- } else
- pts = 0;
-
- llprintf(DEBUG_VIDEO_PACKETS,
- "videostream %d op-gpos %" PRId64 " hdr-gpos %" PRId64 " pts %" PRId64 " \n",
- stream_num,
- op->granulepos,
- this->si[stream_num]->header_granulepos,
- pts);
-
- _x_demux_send_data(this->video_fifo, data, size,
- pts, this->si[stream_num]->buf_types, decoder_flags,
- normpos,
- pts / 90, this->time_length, 0);
-
- if (this->chapter_info && op->granulepos != -1) {
- update_chapter_display(this, stream_num, op);
- }
- }
- } else if ((this->si[stream_num]->buf_types & 0xFFFF0000) == BUF_SPU_CMML) {
- buf_element_t *buf;
- uint32_t *val;
- char *str;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
-
- buf->type = this->si[stream_num]->buf_types;
-
- buf->pts = get_pts (this, stream_num, op->granulepos);
-
- val = (uint32_t * )buf->content;
- str = (char *)val;
-
- memcpy(str, op->packet, op->bytes);
- str[op->bytes] = '\0';
-
- buf->size = 12 + op->bytes + 1;
-
- lprintf ("CMML stream %d (bytes=%ld): PTS %"PRId64": %s\n",
- stream_num, op->bytes, buf->pts, str);
-
- this->video_fifo->put (this->video_fifo, buf);
- } else if ((this->si[stream_num]->buf_types & 0xFF000000) == BUF_SPU_BASE) {
-
- buf_element_t *buf;
- int i;
- char *subtitle,*str;
- int lenbytes;
- int start,end;
- uint32_t *val;
-
- for (i = 0, lenbytes = 0; i < hdrlen; i++) {
- lenbytes = lenbytes << 8;
- lenbytes += *((unsigned char *) op->packet + hdrlen - i);
- }
-
- if (op->packet[0] == PACKET_TYPE_HEADER ) {
- lprintf ("Textstream-header-packet\n");
- } else if (op->packet[0] == PACKET_TYPE_COMMENT ) {
- lprintf ("Textstream-comment-packet\n");
- read_language_comment(this, op, stream_num);
- } else {
- subtitle = (char *)&op->packet[hdrlen + 1];
-
- if ((strlen(subtitle) > 1) || (*subtitle != ' ')) {
- start = op->granulepos;
- end = start+lenbytes;
- lprintf ("subtitlestream %d: %d -> %d :%s\n",stream_num,start,end,subtitle);
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
-
- buf->type = this->si[stream_num]->buf_types;
- buf->pts = 0;
-
- val = (uint32_t * )buf->content;
- *val++ = start;
- *val++ = end;
- str = (char *)val;
-
- memcpy (str, subtitle, 1+strlen(subtitle));
-
- this->video_fifo->put (this->video_fifo, buf);
- }
- }
- } else {
- lprintf("unknown stream type %x\n", this->si[stream_num]->buf_types);
- }
-}
-
-static void decode_vorbis_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- vorbis_info vi;
- vorbis_comment vc;
-
- this->si[stream_num]->buf_types = BUF_AUDIO_VORBIS
- +this->num_audio_streams++;
-
- this->si[stream_num]->headers = 3;
-
- vorbis_info_init(&vi);
- vorbis_comment_init(&vc);
- if (vorbis_synthesis_headerin(&vi, &vc, op) >= 0) {
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, vi.bitrate_nominal);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, vi.rate);
-
- this->si[stream_num]->factor = 90000;
- this->si[stream_num]->quotient = vi.rate;
-
- if (vi.bitrate_nominal<1)
- this->avg_bitrate += 100000; /* assume 100 kbit */
- else
- this->avg_bitrate += vi.bitrate_nominal;
-
- } else {
- this->si[stream_num]->factor = 900;
- this->si[stream_num]->quotient = 441;
-
- this->si[stream_num]->headers = 0;
- xine_log (this->stream->xine, XINE_LOG_MSG,
- _("ogg: vorbis audio track indicated but no vorbis stream header found.\n"));
- }
- vorbis_comment_clear(&vc);
- vorbis_info_clear(&vi);
-}
-
-static void decode_speex_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
-#ifdef HAVE_SPEEX
- void *st;
- SpeexMode *mode;
- SpeexHeader *header;
-
- this->si[stream_num]->buf_types = BUF_AUDIO_SPEEX
- +this->num_audio_streams++;
-
- this->si[stream_num]->headers = 1;
-
- header = speex_packet_to_header (op->packet, op->bytes);
-
- if (header) {
- int bitrate;
- mode = (SpeexMode *) speex_mode_list[header->mode];
-
- st = speex_decoder_init (mode);
-
- speex_decoder_ctl (st, SPEEX_GET_BITRATE, &bitrate);
-
- if (bitrate <= 1)
- bitrate = 16000; /* assume 16 kbit */
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, bitrate);
-
- this->si[stream_num]->factor = 90000;
- this->si[stream_num]->quotient = header->rate;
-
- this->avg_bitrate += bitrate;
-
- lprintf ("detected Speex stream,\trate %d\tbitrate %d\n", header->rate, bitrate);
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, header->rate);
- this->si[stream_num]->headers += header->extra_headers;
- }
-#else
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "Speex stream detected, unable to play\n");
-
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
-#endif
-}
-
-static void decode_video_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- buf_element_t *buf;
- xine_bmiheader bih;
- int channel;
-
-#ifdef LOG
- int16_t locbits_per_sample;
- int32_t locsize, locdefault_len, locbuffersize;
- int64_t locsamples_per_unit;
-#endif
- uint32_t locsubtype;
- int32_t locwidth, locheight;
- int64_t loctime_unit;
-
- /* read fourcc with machine endianness */
- locsubtype = *((uint32_t *)&op->packet[9]);
-
- /* everything else little endian */
- loctime_unit = _X_LE_64(&op->packet[17]);
-#ifdef LOG
- locsize = _X_LE_32(&op->packet[13]);
- locsamples_per_unit = _X_LE_64(&op->packet[25]);
- locdefault_len = _X_LE_32(&op->packet[33]);
- locbuffersize = _X_LE_32(&op->packet[37]);
- locbits_per_sample = _X_LE_16(&op->packet[41]);
-#endif
- locwidth = _X_LE_32(&op->packet[45]);
- locheight = _X_LE_32(&op->packet[49]);
-
- lprintf ("direct show filter created stream detected, hexdump:\n");
-#ifdef LOG
- xine_hexdump (op->packet, op->bytes);
-#endif
-
- channel = this->num_video_streams++;
-
- this->si[stream_num]->buf_types = _x_fourcc_to_buf_video (locsubtype);
- if( !this->si[stream_num]->buf_types )
- this->si[stream_num]->buf_types = BUF_VIDEO_UNKNOWN;
- this->si[stream_num]->buf_types |= channel;
- this->si[stream_num]->headers = 0; /* header is sent below */
-
- lprintf ("subtype %.4s\n", (char*)&locsubtype);
- lprintf ("time_unit %" PRId64 "\n", loctime_unit);
- lprintf ("samples_per_unit %" PRId64 "\n", locsamples_per_unit);
- lprintf ("default_len %d\n", locdefault_len);
- lprintf ("buffersize %d\n", locbuffersize);
- lprintf ("bits_per_sample %d\n", locbits_per_sample);
- lprintf ("width %d\n", locwidth);
- lprintf ("height %d\n", locheight);
- lprintf ("buf_type %08x\n",this->si[stream_num]->buf_types);
-
- bih.biSize=sizeof(xine_bmiheader);
- bih.biWidth = locwidth;
- bih.biHeight= locheight;
- bih.biPlanes= 0;
- memcpy(&bih.biCompression, &locsubtype, 4);
- bih.biBitCount= 0;
- bih.biSizeImage=locwidth*locheight;
- bih.biXPelsPerMeter=1;
- bih.biYPelsPerMeter=1;
- bih.biClrUsed=0;
- bih.biClrImportant=0;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE|
- BUF_FLAG_FRAME_END;
- this->frame_duration = loctime_unit * 9 / 1000;
- this->si[stream_num]->factor = loctime_unit * 9;
- this->si[stream_num]->quotient = 1000;
- buf->decoder_info[0] = this->frame_duration;
- memcpy (buf->content, &bih, sizeof (xine_bmiheader));
- buf->size = sizeof (xine_bmiheader);
- buf->type = this->si[stream_num]->buf_types;
-
- /* video metadata */
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_FOURCC, locsubtype);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, locwidth);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, locheight);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->frame_duration);
-
- this->avg_bitrate += 500000; /* FIXME */
-
- this->video_fifo->put (this->video_fifo, buf);
-}
-
-static void decode_audio_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
-
- if (this->audio_fifo) {
- buf_element_t *buf;
- int codec;
- char str[5];
- int channel;
-
-#ifdef LOG
- int16_t locblockalign;
- int32_t locsize, locdefault_len, locbuffersize;
- int64_t loctime_unit;
-#endif
- int16_t locbits_per_sample, locchannels;
- int32_t locavgbytespersec;
- int64_t locsamples_per_unit;
-
-#ifdef LOG
- locsize = _X_LE_32(&op->packet[13]);
- loctime_unit = _X_LE_64(&op->packet[17]);
- locbuffersize = _X_LE_32(&op->packet[37]);
- locdefault_len = _X_LE_32(&op->packet[33]);
- locblockalign = _X_LE_16(&op->packet[47]);
-#endif
- locsamples_per_unit = _X_LE_64(&op->packet[25]);
- locbits_per_sample = _X_LE_16(&op->packet[41]);
- locchannels = _X_LE_16(&op->packet[45]);
- locavgbytespersec= _X_LE_32(&op->packet[49]);
-
- lprintf ("direct show filter created audio stream detected, hexdump:\n");
-#ifdef LOG
- xine_hexdump (op->packet, op->bytes);
-#endif
-
- memcpy(str, &op->packet[9], 4);
- str[4] = 0;
- codec = strtoul(str, NULL, 16);
-
- channel= this->num_audio_streams++;
-
- this->si[stream_num]->buf_types = _x_formattag_to_buf_audio(codec);
- if( this->si[stream_num]->buf_types ) {
- this->si[stream_num]->buf_types |= channel;
- } else {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_ogg: unknown audio codec type 0x%x\n", codec);
- this->si[stream_num]->buf_types = BUF_AUDIO_UNKNOWN;
- /*break;*/
- }
-
- lprintf ("subtype 0x%x\n", codec);
- lprintf ("time_unit %" PRId64 "\n", loctime_unit);
- lprintf ("samples_per_unit %" PRId64 "\n", locsamples_per_unit);
- lprintf ("default_len %d\n", locdefault_len);
- lprintf ("buffersize %d\n", locbuffersize);
- lprintf ("bits_per_sample %d\n", locbits_per_sample);
- lprintf ("channels %d\n", locchannels);
- lprintf ("blockalign %d\n", locblockalign);
- lprintf ("avgbytespersec %d\n", locavgbytespersec);
- lprintf ("buf_type %08x\n",this->si[stream_num]->buf_types);
-
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = this->si[stream_num]->buf_types;
- buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
- buf->decoder_info[0] = 0;
- buf->decoder_info[1] = locsamples_per_unit;
- buf->decoder_info[2] = locbits_per_sample;
- buf->decoder_info[3] = locchannels;
- this->audio_fifo->put (this->audio_fifo, buf);
-
- this->si[stream_num]->headers = 0; /* header already sent */
- this->si[stream_num]->factor = 90000;
- this->si[stream_num]->quotient = locsamples_per_unit;
-
- this->avg_bitrate += locavgbytespersec*8;
-
- /* audio metadata */
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC, codec);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS, locchannels);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITS, locbits_per_sample);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE, locsamples_per_unit);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE, locavgbytespersec * 8);
-
- } else /* no audio_fifo there */
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
-}
-
-static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
-
- lprintf ("older Direct Show filter-generated stream header detected. Hexdump:\n");
-#ifdef LOG
- xine_hexdump (op->packet, op->bytes);
-#endif
-
- this->si[stream_num]->headers = 0; /* header is sent below */
-
- if ( _x_is_fourcc(&op->packet[96], "\x05\x58\x9f\x80") && (op->bytes >= 184)) {
-
- buf_element_t *buf;
- xine_bmiheader bih;
- int channel;
- uint32_t fcc;
-
- lprintf ("seems to be a video stream.\n");
-
- channel = this->num_video_streams++;
- fcc = *(uint32_t*)(op->packet+68);
- lprintf ("fourcc %08x\n", fcc);
-
- this->si[stream_num]->buf_types = _x_fourcc_to_buf_video (fcc);
- if( !this->si[stream_num]->buf_types )
- this->si[stream_num]->buf_types = BUF_VIDEO_UNKNOWN;
- this->si[stream_num]->buf_types |= channel;
-
- bih.biSize = sizeof(xine_bmiheader);
- bih.biWidth = _X_LE_32(&op->packet[176]);
- bih.biHeight = _X_LE_32(&op->packet[180]);
- bih.biPlanes = 0;
- memcpy (&bih.biCompression, op->packet+68, 4);
- bih.biBitCount = _X_LE_16(&op->packet[182]);
- if (!bih.biBitCount)
- bih.biBitCount = 24; /* FIXME ? */
- bih.biSizeImage = (bih.biBitCount>>3)*bih.biWidth*bih.biHeight;
- bih.biXPelsPerMeter = 1;
- bih.biYPelsPerMeter = 1;
- bih.biClrUsed = 0;
- bih.biClrImportant = 0;
-
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE|
- BUF_FLAG_FRAME_END;
- this->frame_duration = (*(int64_t*)(op->packet+164)) * 9 / 1000;
- this->si[stream_num]->factor = (*(int64_t*)(op->packet+164)) * 9;
- this->si[stream_num]->quotient = 1000;
-
- buf->decoder_info[0] = this->frame_duration;
- memcpy (buf->content, &bih, sizeof (xine_bmiheader));
- buf->size = sizeof (xine_bmiheader);
- buf->type = this->si[stream_num]->buf_types;
- this->video_fifo->put (this->video_fifo, buf);
-
- lprintf ("subtype %.4s\n", (char*)&fcc);
- lprintf ("buf_type %08x\n", this->si[stream_num]->buf_types);
- lprintf ("video size %d x %d\n", bih.biWidth, bih.biHeight);
- lprintf ("frame duration %d\n", this->frame_duration);
-
- /* video metadata */
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, bih.biWidth);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, bih.biHeight);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->frame_duration);
-
- this->avg_bitrate += 500000; /* FIXME */
-
- this->ignore_keyframes = 1;
-
- } else if (_x_is_fourcc(&op->packet[96], "\x05\x58\x9f\x81")) {
-
-#if 0
- /* FIXME: no test streams */
-
- buf_element_t *buf;
- int codec;
- char str[5];
- int channel;
- int extra_size;
-
- extra_size = *(int16_t*)(op->packet+140);
- format = *(int16_t*)(op->packet+124);
- channels = *(int16_t*)(op->packet+126);
- samplerate = *(int32_t*)(op->packet+128);
- nAvgBytesPerSec = *(int32_t*)(op->packet+132);
- nBlockAlign = *(int16_t*)(op->packet+136);
- wBitsPerSample = *(int16_t*)(op->packet+138);
- samplesize = (sh_a->wf->wBitsPerSample+7)/8;
- cbSize = extra_size;
- if(extra_size > 0)
- memcpy(wf+sizeof(WAVEFORMATEX),op->packet+142,extra_size);
-#endif
-
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG, "FIXME, old audio format not handled\n");
-
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
-
- } else {
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "old header detected but stream type is unknown\n");
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
- }
-}
-
-static void decode_text_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- int channel=0;
- uint32_t *val;
- buf_element_t *buf;
-
- lprintf ("textstream detected.\n");
- this->si[stream_num]->headers = 2;
- channel = this->num_spu_streams++;
- this->si[stream_num]->buf_types = BUF_SPU_OGM | channel;
-
- /*send an empty spu to inform the video_decoder, that there is a stream*/
- buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
- buf->type = this->si[stream_num]->buf_types;
- buf->pts = 0;
- val = (uint32_t * )buf->content;
- *val++=0;
- *val++=0;
- *val++=0;
- this->video_fifo->put (this->video_fifo, buf);
-}
-
-static void decode_theora_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
-
-#ifdef HAVE_THEORA
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_ogg: Theorastreamsupport is highly alpha at the moment\n");
-
- if (theora_decode_header(&this->t_info, &this->t_comment, op) >= 0) {
-
- this->num_video_streams++;
-
- this->si[stream_num]->factor = (int64_t) 90000 * (int64_t) this->t_info.fps_denominator;
-
- if (!this->t_info.fps_numerator) {
- this->t_info.fps_numerator = 1; /* FIXME: default value ? */
- }
- this->si[stream_num]->quotient = this->t_info.fps_numerator;
-
- this->frame_duration = ((int64_t) 90000*this->t_info.fps_denominator);
- this->frame_duration /= this->t_info.fps_numerator;
-
- this->si[stream_num]->granuleshift = intlog(this->t_info.keyframe_frequency_force-1);
-
- this->si[stream_num]->headers=3;
- this->si[stream_num]->buf_types = BUF_VIDEO_THEORA;
-
- _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, "theora");
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->t_info.frame_width);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->t_info.frame_height);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->frame_duration);
-
- /*currently aspect_nominator and -denumerator are 0?*/
- if (this->t_info.aspect_denominator) {
- int64_t ratio = ((int64_t) this->t_info.aspect_numerator * 10000);
-
- ratio /= this->t_info.aspect_denominator;
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, ratio);
- }
-
- lprintf ("decoded theora header \n");
- lprintf ("frameduration %d\n",this->frame_duration);
- lprintf ("w:%d h:%d \n",this->t_info.frame_width,this->t_info.frame_height);
- lprintf ("an:%d ad:%d \n",this->t_info.aspect_numerator,this->t_info.aspect_denominator);
- } else {
- /*Rejected stream*/
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "A theora header was rejected by libtheora\n");
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
- this->si[stream_num]->headers = 0; /* FIXME: don't know */
- }
-#else
- this->si[stream_num]->buf_types = BUF_VIDEO_THEORA;
- this->num_video_streams++;
- this->unhandled_video_streams++;
- _x_meta_info_set(this->stream, XINE_META_INFO_VIDEOCODEC, "theora");
-#endif
-}
-
-static void decode_flac_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- xine_flac_metadata_header header;
- xine_flac_streaminfo_block streaminfo = {};
- buf_element_t *buf;
- xine_waveformatex wave;
-
- static const uint8_t flac_signature_1[] =
- {
- /* Packet type */
- 0x7F,
- /* OggFLAC signature */
- 'F', 'L', 'A', 'C',
- /* Version: only 1.0 supported */
- 1, 0
- };
- static const uint8_t flac_signature_2[] = "fLaC";
-
- _x_assert(memcmp(&op->packet[0], flac_signature_1, sizeof(flac_signature_1)) == 0);
- _x_assert(memcmp(&op->packet[9], flac_signature_2, sizeof(flac_signature_2)) == 0);
-
- /* Header count */
- this->si[stream_num]->headers = 0/*_X_BE_16(&op->packet[7]) +1*/;
-
- _x_parse_flac_metadata_header(&op->packet[13], &header);
-
- switch ( header.blocktype ) {
- 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++;
-
- this->si[stream_num]->factor = 90000;
-
- buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
-
- buf->type = BUF_AUDIO_FLAC;
- buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
-
- buf->decoder_info[0] = 0;
- buf->decoder_info[1] = streaminfo.samplerate;
- buf->decoder_info[2] = streaminfo.bits_per_sample;
- buf->decoder_info[3] = streaminfo.channels;
- buf->size = sizeof(xine_waveformatex) + FLAC_STREAMINFO_SIZE;
- memcpy(buf->content+sizeof(xine_waveformatex), &op->packet[17], FLAC_STREAMINFO_SIZE);
- xine_hexdump(&op->packet[17], FLAC_STREAMINFO_SIZE);
- wave.cbSize = FLAC_STREAMINFO_SIZE;
- memcpy(buf->content, &wave, sizeof(xine_waveformatex));
-
- this->audio_fifo->put(this->audio_fifo, buf);
-
- /* Skip the Ogg framing info */
- op->bytes -= 9;
- op->packet += 9;
-}
-
-static void decode_annodex_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- lprintf ("Annodex stream detected\n");
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
- this->si[stream_num]->headers = 1;
- this->si[stream_num]->header_granulepos = op->granulepos;
- _x_meta_info_set(this->stream, XINE_META_INFO_SYSTEMLAYER, "Annodex");
-}
-
-static void decode_anxdata_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- int64_t granule_rate_n, granule_rate_d;
- uint32_t secondary_headers;
- const char *content_type = "";
- size_t content_type_length = 0;
-
- lprintf("AnxData stream detected\n");
-
- /* read granule rate */
- granule_rate_n = _X_LE_64(&op->packet[8]);
- granule_rate_d = _X_LE_64(&op->packet[16]);
- secondary_headers = _X_LE_32(&op->packet[24]);
-
- lprintf("granule_rate %" PRId64 "/%" PRId64 ", %d secondary headers\n",
- granule_rate_n, granule_rate_d, secondary_headers);
-
- /* read "Content-Type" MIME header */
- const char *startline = &op->packet[28];
- const char *endline;
- if ( strcmp(&op->packet[28], "Content-Type: ") == 0 &&
- (endline = strstr(startline, "\r\n")) ) {
- content_type = startline + sizeof("Content-Type: ");
- content_type_length = startline - endline;
- }
-
- lprintf("Content-Type: %s (length:%td)\n", content_type, content_type_length);
-
- /* how many header packets in the AnxData stream? */
- this->si[stream_num]->headers = secondary_headers + 1;
- this->si[stream_num]->hide_first_header = 1;
-
- /* set factor and quotient */
- this->si[stream_num]->factor = (int64_t) 90000 * granule_rate_d;
- this->si[stream_num]->quotient = granule_rate_n;
-
- lprintf("factor: %" PRId64 ", quotient: %" PRId64 "\n",
- this->si[stream_num]->factor, this->si[stream_num]->quotient);
-
- /* what type of stream are we dealing with? */
- if (!strncmp(content_type, "audio/x-vorbis", content_type_length)) {
- this->si[stream_num]->buf_types = BUF_AUDIO_VORBIS;
- this->num_audio_streams++;
- } else if (!strncmp(content_type, "audio/x-speex", content_type_length)) {
- this->num_audio_streams++;
-#ifdef HAVE_SPEEX
- this->si[stream_num]->buf_types = BUF_AUDIO_SPEEX;
-#else
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
-#endif
- } else if (!strncmp(content_type, "video/x-theora", content_type_length)) {
- this->num_video_streams++;
-#ifdef HAVE_THEORA
- this->si[stream_num]->buf_types = BUF_VIDEO_THEORA;
-#else
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
-#endif
- } else if (!strncmp(content_type, "text/x-cmml", content_type_length)) {
- unsigned int channel = this->num_spu_streams++;
- this->si[stream_num]->headers = 0;
- this->si[stream_num]->buf_types = BUF_SPU_CMML | channel;
- this->si[stream_num]->granuleshift = 0;
- } else {
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
- }
-
-}
-
-static void decode_cmml_header (demux_ogg_t *this, const int stream_num, ogg_packet *op) {
- unsigned int channel = this->num_spu_streams++;
- this->si[stream_num]->headers = 0;
- this->si[stream_num]->buf_types = BUF_SPU_CMML | channel;
-
- this->si[stream_num]->factor = 90000 * _X_LE_64(&op->packet[20]);
- this->si[stream_num]->quotient = _X_LE_64(&op->packet[12]);
- this->si[stream_num]->granuleshift = (int)op->packet[28];
-}
-
-/*
- * interpret stream start packages, send headers
- */
-static void send_header (demux_ogg_t *this) {
-
- int stream_num = -1;
- int cur_serno;
- int done = 0;
- ogg_packet op;
- xine_event_t ui_event;
-
- lprintf ("detecting stream types...\n");
-
- this->ignore_keyframes = 0;
-
- while (!done) {
- if (!read_ogg_packet(this) || !this->og.header || !this->og.body) {
- return;
- }
- /* now we've got at least one new page */
-
- cur_serno = ogg_page_serialno (&this->og);
-
- if (ogg_page_bos(&this->og)) {
- lprintf ("beginning of stream\n");
- lprintf ("serial number %d\n", cur_serno);
-
- if( this->num_streams == MAX_STREAMS ) {
- xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "demux_ogg: MAX_STREAMS exceeded, aborting.\n");
- this->status = DEMUX_FINISHED;
- return;
- }
- stream_num = new_stream_info(this, cur_serno);
-
- } else {
- stream_num = get_stream(this, cur_serno);
- if (stream_num == -1) {
- xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "demux_ogg: stream with no beginning!\n");
- this->status = DEMUX_FINISHED;
- return;
- }
- }
-
- ogg_stream_pagein(&this->si[stream_num]->oss, &this->og);
-
- while (ogg_stream_packetout(&this->si[stream_num]->oss, &op) == 1) {
-
- if (!this->si[stream_num]->buf_types) {
-
- /* detect buftype */
- if (!strncmp (&op.packet[1], "vorbis", 6)) {
- decode_vorbis_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[0], "Speex", 5)) {
- decode_speex_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[1], "video", 5)) {
- decode_video_header(this, stream_num, &op);
- } else if (!strncmp (&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) ) {
- decode_dshow_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[1], "text", 4)) {
- decode_text_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[1], "theora", 6)) {
- decode_theora_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[1], "FLAC", 4)) {
- decode_flac_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[0], "Annodex", 7)) {
- decode_annodex_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[0], "AnxData", 7)) {
- decode_anxdata_header(this, stream_num, &op);
- } else if (!strncmp (&op.packet[0], "CMML", 4)) {
- decode_cmml_header(this, stream_num, &op);
- } else {
- xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG,
- "demux_ogg: unknown stream type (signature >%.8s<). hex dump of bos packet follows:\n",
- op.packet);
- if(this->stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
- xine_hexdump (op.packet, op.bytes);
-
- this->si[stream_num]->buf_types = BUF_CONTROL_NOP;
- }
- }
-
- /* send preview buffer */
- if (this->si[stream_num]->headers > 0 ||
- op.packet[0] == PACKET_TYPE_COMMENT) {
- if (this->si[stream_num]->hide_first_header)
- this->si[stream_num]->hide_first_header = 0;
- else {
- lprintf ("sending preview buffer of stream type %08x\n",
- this->si[stream_num]->buf_types);
-
- send_ogg_buf (this, &op, stream_num, BUF_FLAG_HEADER);
- this->si[stream_num]->headers --;
- }
- }
-
- /* are we finished ? */
- if (!ogg_page_bos(&this->og)) {
- int i;
- done = 1;
-
- for (i=0; i<this->num_streams; i++) {
- if (this->si[i]->headers > 0)
- done = 0;
-
- llprintf(DEBUG_PREVIEWS,
- "%d preview buffers left to send from stream %d\n",
- this->si[i]->headers, i);
- }
- }
- }
- }
-
- ui_event.type = XINE_EVENT_UI_CHANNELS_CHANGED;
- ui_event.data_length = 0;
- xine_event_send(this->stream, &ui_event);
-
- /*get the streamlength*/
- get_stream_length (this);
-
-}
-
-static int demux_ogg_send_chunk (demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
-
- int stream_num;
- int cur_serno;
-
- ogg_packet op;
-
- ogg_handle_event(this);
-
- llprintf(DEBUG_PACKETS, "send package...\n");
-
- if (!read_ogg_packet(this)) {
- this->status = DEMUX_FINISHED;
- lprintf ("EOF\n");
- return this->status;
- }
-
- if (!this->og.header || !this->og.body) {
- this->status = DEMUX_FINISHED;
- lprintf ("EOF\n");
- return this->status;
- }
-
- /* now we've got one new page */
-
- cur_serno = ogg_page_serialno (&this->og);
- stream_num = get_stream(this, cur_serno);
- if (stream_num < 0) {
- lprintf ("error: unknown stream, serialnumber %d\n", cur_serno);
-
- if (!ogg_page_bos(&this->og)) {
- lprintf ("help, stream with no beginning!\n");
- }
- lprintf ("adding late stream with serial number %d (all content will be discarded)\n", cur_serno);
-
- if( this->num_streams == MAX_STREAMS ) {
- xprintf (this->stream->xine, XINE_VERBOSITY_LOG, "demux_ogg: MAX_STREAMS exceeded, aborting.\n");
- this->status = DEMUX_FINISHED;
- return this->status;
- }
- stream_num = new_stream_info(this, cur_serno);
- }
-
- ogg_stream_pagein(&this->si[stream_num]->oss, &this->og);
-
- if (ogg_page_bos(&this->og)) {
- lprintf ("beginning of stream: serial number %d - discard\n",
- ogg_page_serialno (&this->og));
- while (ogg_stream_packetout(&this->si[stream_num]->oss, &op) == 1) ;
- return this->status;
- }
-
- /*while keyframeseeking only process videostream*/
- if (!this->ignore_keyframes && this->keyframe_needed
- && ((this->si[stream_num]->buf_types & 0xFF000000) != BUF_VIDEO_BASE))
- return this->status;
-
- while (ogg_stream_packetout(&this->si[stream_num]->oss, &op) == 1) {
- /* printf("demux_ogg: packet: %.8s\n", op.packet); */
- /* printf("demux_ogg: got a packet\n"); */
-
- if ((*op.packet & PACKET_TYPE_HEADER) &&
- (this->si[stream_num]->buf_types!=BUF_VIDEO_THEORA) && (this->si[stream_num]->buf_types!=BUF_AUDIO_SPEEX) && (this->si[stream_num]->buf_types!=BUF_AUDIO_FLAC)) {
- if (op.granulepos != -1) {
- this->si[stream_num]->header_granulepos = op.granulepos;
- lprintf ("header with granulepos, remembering granulepos\n");
- } else {
- lprintf ("header => discard\n");
- }
- continue;
- }
-
- /*discard granulepos-less packets and to early audiopackets*/
- if (this->si[stream_num]->resync) {
- if ((this->si[stream_num]->buf_types & 0xFF000000) == BUF_SPU_BASE) {
- /*never drop subtitles*/
- this->si[stream_num]->resync=0;
- } else if ((op.granulepos == -1) && (this->si[stream_num]->header_granulepos == -1)) {
- continue;
- } else {
-
- /*dump too early packets*/
- if ((get_pts(this,stream_num,op.granulepos)-this->start_pts) > -90000)
- this->si[stream_num]->resync=0;
- else
- continue;
- }
- }
-
- if (!this->ignore_keyframes && this->keyframe_needed) {
- lprintf ("keyframe needed... buf_type=%08x\n", this->si[stream_num]->buf_types);
- if (this->si[stream_num]->buf_types == BUF_VIDEO_THEORA) {
-#ifdef HAVE_THEORA
-
- int keyframe_granule_shift;
- int64_t pframe=-1,iframe=-1;
-
- keyframe_granule_shift = this->si[stream_num]->granuleshift;
-
- if(op.granulepos>=0){
- iframe=op.granulepos>>keyframe_granule_shift;
- pframe=op.granulepos-(iframe<<keyframe_granule_shift);
- xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
- "seeking keyframe i %" PRId64 " p %" PRId64 "\n", iframe, pframe);
- if (pframe!=0)
- continue;
- } else
- continue;
- this->keyframe_needed = 0;
- this->start_pts=get_pts(this,stream_num,op.granulepos);
-#endif
- } else if ((this->si[stream_num]->buf_types & 0xFF000000) == BUF_VIDEO_BASE) {
-
- /*calculate the current pts*/
- if (op.granulepos!=-1) {
- this->start_pts=get_pts(this, stream_num, op.granulepos);
- } else if (this->start_pts!=-1)
- this->start_pts=this->start_pts+this->frame_duration;
-
- /*seek the keyframe*/
- if ((*op.packet == PACKET_IS_SYNCPOINT) && (this->start_pts!=-1))
- this->keyframe_needed = 0;
- else
- continue;
-
- } else if ((this->si[stream_num]->buf_types & 0xFF000000) == BUF_VIDEO_BASE) continue;
- }
- send_ogg_buf (this, &op, stream_num, 0);
-
- /*delete used header_granulepos*/
- if (op.granulepos == -1)
- this->si[stream_num]->header_granulepos = -1;
-
- }
- if (ogg_page_eos(&this->og)) {
- int i;
- int finished_streams = 0;
-
- lprintf("end of stream, serialnumber %d\n", cur_serno);
- this->si[stream_num]->delivered_eos = 1;
-
- /* check if all logical streams are finished */
- for (i = 0; i < this->num_streams; i++) {
- finished_streams += this->si[i]->delivered_eos;
- }
-
- /* if all streams are finished, perhaps a chained stream follows */
- if (finished_streams == this->num_streams) {
- /* delete current logical streams */
- for (i = 0; i < this->num_streams; i++) {
- ogg_stream_clear(&this->si[i]->oss);
- if (this->si[i]->language) {
- free (this->si[i]->language);
- }
- free (this->si[i]);
- }
- this->num_streams = 0;
- this->num_audio_streams = 0;
- this->num_video_streams = 0;
- this->unhandled_video_streams = 0;
- this->num_spu_streams = 0;
- this->avg_bitrate = 1;
-
- /* try to read a chained stream */
- this->send_newpts = 1;
- this->last_pts[0] = 0;
- this->last_pts[1] = 0;
-
- /* send control buffer to avoid buffer leak */
- _x_demux_control_end(this->stream, 0);
- _x_demux_control_start(this->stream);
- send_header(this);
- }
- }
-
- return this->status;
-}
-
-static void demux_ogg_dispose (demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
- int i;
-
- for (i=0; i<this->num_streams; i++) {
- ogg_stream_clear(&this->si[i]->oss);
-
- if (this->si[i]->language) {
- free (this->si[i]->language);
- }
- free(this->si[i]);
- }
-
- ogg_sync_clear(&this->oy);
-
-#ifdef HAVE_THEORA
- theora_comment_clear (&this->t_comment);
- theora_info_clear (&this->t_info);
-#endif
-
- if (this->chapter_info){
- free (this->chapter_info->entries);
- free (this->chapter_info);
- }
- for (i = 0; i < XINE_STREAM_INFO_MAX; ++i)
- free (this->meta[i]);
-
- if (this->event_queue)
- xine_event_dispose_queue (this->event_queue);
-
- free (this);
-}
-
-static int demux_ogg_get_status (demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
-
- return this->status;
-}
-
-static void demux_ogg_send_headers (demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
-
- this->video_fifo = this->stream->video_fifo;
- this->audio_fifo = this->stream->audio_fifo;
-
- this->status = DEMUX_OK;
-
- /*
- * send start buffers
- */
-
- this->last_pts[0] = 0;
- this->last_pts[1] = 0;
-
- /*
- * initialize ogg engine
- */
- ogg_sync_init(&this->oy);
-
- this->num_streams = 0;
- this->num_audio_streams = 0;
- this->num_video_streams = 0;
- this->num_spu_streams = 0;
- this->avg_bitrate = 1;
-
- this->input->seek (this->input, 0, SEEK_SET);
-
- if (this->status == DEMUX_OK) {
- _x_demux_control_start(this->stream);
- send_header (this);
- lprintf ("headers sent, avg bitrate is %" PRId64 "\n", this->avg_bitrate);
- }
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO,
- this->num_video_streams > 0);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED,
- this->num_video_streams > this->unhandled_video_streams);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO,
- this->num_audio_streams > 0);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_MAX_SPU_CHANNEL,
- this->num_spu_streams);
-}
-
-static int demux_ogg_seek (demux_plugin_t *this_gen,
- off_t start_pos, int start_time, int playing) {
-
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
- int i;
- start_time /= 1000;
- start_pos = (off_t) ( (double) start_pos / 65535 *
- this->input->get_length (this->input) );
- /*
- * seek to start position
- */
-
- if (INPUT_IS_SEEKABLE(this->input)) {
-
- this->keyframe_needed = (this->num_video_streams>0);
-
- if ( (!start_pos) && (start_time)) {
- if (this->time_length != -1) {
- /*do the seek via time*/
- int current_time=-1;
- off_t current_pos;
- current_pos=this->input->get_current_pos(this->input);
-
- /*try to find out the current time*/
- if (this->last_pts[PTS_VIDEO]) {
- current_time=this->last_pts[PTS_VIDEO]/90000;
- } else if (this->last_pts[PTS_AUDIO]) {
- current_time=this->last_pts[PTS_AUDIO]/90000;
- }
-
- /*fixme, the file could grow, do something
- about this->time_length using get_lenght to verify, that the stream
- hasn` changed its length, otherwise no seek to "new" data is possible*/
-
- lprintf ("seek to time %d called\n",start_time);
- lprintf ("current time is %d\n",current_time);
-
- if (current_time > start_time) {
- /*seek between beginning and current_pos*/
-
- /*fixme - sometimes we seek backwards and during
- keyframeseeking, we undo the seek*/
-
- start_pos = start_time * current_pos
- / current_time ;
- } else {
- /*seek between current_pos and end*/
- start_pos = current_pos +
- ((start_time - current_time) *
- ( this->input->get_length(this->input) - current_pos ) /
- ( (this->time_length / 1000) - current_time)
- );
- }
-
- lprintf ("current_pos is %" PRId64 "\n",current_pos);
- lprintf ("new_pos is %" PRId64 "\n",start_pos);
-
- } else {
- /*seek using avg_bitrate*/
- start_pos = start_time * this->avg_bitrate/8;
- }
-
- lprintf ("seeking to %d seconds => %" PRId64 " bytes\n",
- start_time, start_pos);
-
- }
-
- ogg_sync_reset(&this->oy);
-
- for (i=0; i<this->num_streams; i++) {
- this->si[i]->header_granulepos = -1;
- ogg_stream_reset(&this->si[i]->oss);
- }
-
- /*some strange streams have no syncpoint flag set at the beginning*/
- if (start_pos == 0)
- this->keyframe_needed = 0;
-
- lprintf ("seek to %" PRId64 " called\n",start_pos);
-
- this->input->seek (this->input, start_pos, SEEK_SET);
-
- }
-
- /* fixme - this would be a nice position to do the following tasks
- 1. adjust an ogg videostream to a keyframe
- 2. compare the keyframe_pts with start_time. if the difference is to
- high (e.g. larger than max keyframe_intervall, do a new seek or
- continue reading
- 3. adjust the audiostreams in such a way, that the
- difference is not to high.
-
- In short words, do all the cleanups necessary to continue playback
- without further actions
- */
-
- this->send_newpts = 1;
- this->status = DEMUX_OK;
-
- if( !playing ) {
-
- this->buf_flag_seek = 0;
-
- } else {
- if (start_pos!=0) {
- this->buf_flag_seek = 1;
- /*each stream has to continue with a packet that has an
- granulepos*/
- for (i=0; i<this->num_streams; i++) {
- this->si[i]->resync = 1;
- }
-
- this->start_pts=-1;
- }
-
- _x_demux_flush_engine(this->stream);
- }
-
- return this->status;
-}
-
-static int demux_ogg_get_stream_length (demux_plugin_t *this_gen) {
-
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
-
- if (this->time_length==-1){
- if (this->avg_bitrate) {
- return (int)((int64_t)1000 * this->input->get_length (this->input) * 8 /
- this->avg_bitrate);
- } else {
- return 0;
- }
- } else {
- return this->time_length;
- }
-}
-
-static uint32_t demux_ogg_get_capabilities(demux_plugin_t *this_gen) {
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
- int cap_chapter = 0;
-
- if (this->chapter_info)
- cap_chapter = DEMUX_CAP_CHAPTERS;
-
- return DEMUX_CAP_SPULANG | DEMUX_CAP_AUDIOLANG | cap_chapter;
-}
-
-static int format_lang_string (demux_ogg_t * this, uint32_t buf_mask, uint32_t buf_type, int channel, char *str) {
- int stream_num;
-
- for (stream_num=0; stream_num<this->num_streams; stream_num++) {
- if ((this->si[stream_num]->buf_types & buf_mask) == buf_type) {
- if (this->si[stream_num]->language) {
- if (snprintf (str, XINE_LANG_MAX, "%s", this->si[stream_num]->language) >= XINE_LANG_MAX)
- /* the string got truncated */
- str[XINE_LANG_MAX - 2] = str[XINE_LANG_MAX - 3] = str[XINE_LANG_MAX - 4] = '.';
- /* TODO: provide long version in XINE_META_INFO_FULL_LANG */
- } else {
- snprintf(str, XINE_LANG_MAX, "channel %d",channel);
- }
- return DEMUX_OPTIONAL_SUCCESS;
- }
- }
- return DEMUX_OPTIONAL_UNSUPPORTED;
-}
-
-static int demux_ogg_get_optional_data(demux_plugin_t *this_gen,
- void *data, int data_type) {
-
- demux_ogg_t *this = (demux_ogg_t *) this_gen;
-
- char *str=(char *) data;
- int channel = *((int *)data);
-
- switch (data_type) {
- case DEMUX_OPTIONAL_DATA_SPULANG:
- lprintf ("DEMUX_OPTIONAL_DATA_SPULANG channel = %d\n",channel);
- if (channel==-1) {
- strcpy( str, "none");
- return DEMUX_OPTIONAL_SUCCESS;
- } else if ((channel>=0) && (channel<this->num_streams)) {
- return format_lang_string (this, 0xFFFFFFFF, BUF_SPU_OGM+channel, channel, str);
- }
- return DEMUX_OPTIONAL_UNSUPPORTED;
- case DEMUX_OPTIONAL_DATA_AUDIOLANG:
- lprintf ("DEMUX_OPTIONAL_DATA_AUDIOLANG channel = %d\n",channel);
- if (channel==-1) {
- return format_lang_string (this, 0xFF00001F, BUF_AUDIO_BASE, channel, str);
- } else if ((channel>=0) && (channel<this->num_streams)) {
- return format_lang_string (this, 0xFF00001F, BUF_AUDIO_BASE+channel, channel, str);
- }
- return DEMUX_OPTIONAL_UNSUPPORTED;
- default:
- return DEMUX_OPTIONAL_UNSUPPORTED;
- }
-}
-
-static int detect_ogg_content (int detection_method, demux_class_t *class_gen,
- input_plugin_t *input) {
-
- switch (detection_method) {
-
- case METHOD_BY_CONTENT: {
- uint8_t buf[4];
-
- if (_x_demux_read_header(input, buf, 4) != 4)
- return 0;
-
- return _x_is_fourcc(buf, "OggS");
- }
-
- 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))
- return 1;
- else
- return 0;
- }
-
- case METHOD_EXPLICIT:
- return 1;
-
- default:
- return 0;
- }
-}
-
-static int detect_anx_content (int detection_method, demux_class_t *class_gen,
- input_plugin_t *input) {
-
- if (detect_ogg_content(detection_method, class_gen, input) == 0)
- return 0;
-
- switch (detection_method) {
-
-#define ANNODEX_SIGNATURE_SEARCH 128
-
- 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;
- }
-
-#undef ANNODEX_SIGNATURE_SEARCH
-
- 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))
- return 1;
- else
- return 0;
- }
-
- case METHOD_EXPLICIT:
- return 1;
-
- default:
- return 0;
- }
-}
-
-static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen,
- xine_stream_t *stream,
- input_plugin_t *input) {
-
- demux_ogg_t *this;
- int i;
-
- if (detect_anx_content(stream->content_detection_method, class_gen, input) == 0)
- return NULL;
-
- /*
- * if we reach this point, the input has been accepted.
- */
-
- this = calloc(1, sizeof(demux_ogg_t));
- this->stream = stream;
- this->input = input;
-
- /* the Annodex demuxer currently calls into exactly the same functions as
- * the Ogg demuxer, which seems to make this function a bit redundant, but
- * this design leaves us a bit more room to change an Annodex demuxer's
- * behaviour in the future if necessary */
- this->demux_plugin.send_headers = demux_ogg_send_headers;
- this->demux_plugin.send_chunk = demux_ogg_send_chunk;
- this->demux_plugin.seek = demux_ogg_seek;
- this->demux_plugin.dispose = demux_ogg_dispose;
- this->demux_plugin.get_status = demux_ogg_get_status;
- this->demux_plugin.get_stream_length = demux_ogg_get_stream_length;
- this->demux_plugin.get_capabilities = demux_ogg_get_capabilities;
- this->demux_plugin.get_optional_data = demux_ogg_get_optional_data;
- this->demux_plugin.demux_class = class_gen;
-
- this->status = DEMUX_FINISHED;
-
-#ifdef HAVE_THEORA
- theora_info_init (&this->t_info);
- theora_comment_init (&this->t_comment);
-#endif
-
- for (i = 0; i < XINE_STREAM_INFO_MAX; ++i)
- this->meta[i] = NULL;
- this->chapter_info = 0;
- this->event_queue = xine_event_new_queue (this->stream);
-
- return &this->demux_plugin;
-}
-
-static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen,
- xine_stream_t *stream,
- input_plugin_t *input) {
-
- demux_ogg_t *this;
- int i;
-
- if (detect_ogg_content(stream->content_detection_method, class_gen, input) == 0)
- return NULL;
-
- /*
- * if we reach this point, the input has been accepted.
- */
-
- this = calloc(1, sizeof(demux_ogg_t));
- this->stream = stream;
- this->input = input;
-
- this->demux_plugin.send_headers = demux_ogg_send_headers;
- this->demux_plugin.send_chunk = demux_ogg_send_chunk;
- this->demux_plugin.seek = demux_ogg_seek;
- this->demux_plugin.dispose = demux_ogg_dispose;
- this->demux_plugin.get_status = demux_ogg_get_status;
- this->demux_plugin.get_stream_length = demux_ogg_get_stream_length;
- this->demux_plugin.get_capabilities = demux_ogg_get_capabilities;
- this->demux_plugin.get_optional_data = demux_ogg_get_optional_data;
- this->demux_plugin.demux_class = class_gen;
-
- this->status = DEMUX_FINISHED;
-
-#ifdef HAVE_THEORA
- theora_info_init (&this->t_info);
- theora_comment_init (&this->t_comment);
-#endif
-
- this->chapter_info = 0;
- for (i = 0; i < XINE_STREAM_INFO_MAX; ++i)
- this->meta[i] = NULL;
- this->event_queue = xine_event_new_queue (this->stream);
-
- return &this->demux_plugin;
-}
-
-/*
- * Annodex demuxer class
- */
-
-static const char *anx_get_description (demux_class_t *this_gen) {
- return "Annodex demux plugin";
-}
-
-static const char *anx_get_identifier (demux_class_t *this_gen) {
- return "Annodex";
-}
-
-static const char *anx_get_extensions (demux_class_t *this_gen) {
- return "anx axa axv";
-}
-
-static const char *anx_get_mimetypes (demux_class_t *this_gen) {
- return "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;";
-}
-
-static void anx_class_dispose (demux_class_t *this_gen) {
- demux_anx_class_t *this = (demux_anx_class_t *) this_gen;
-
- free (this);
-}
-
-static void *anx_init_class (xine_t *xine, void *data) {
- demux_anx_class_t *this;
-
- this = calloc(1, sizeof(demux_anx_class_t));
-
- this->demux_class.open_plugin = anx_open_plugin;
- this->demux_class.get_description = anx_get_description;
- this->demux_class.get_identifier = anx_get_identifier;
- this->demux_class.get_mimetypes = anx_get_mimetypes;
- this->demux_class.get_extensions = anx_get_extensions;
- this->demux_class.dispose = anx_class_dispose;
-
- return this;
-}
-
-/*
- * ogg demuxer class
- */
-
-static const char *ogg_get_description (demux_class_t *this_gen) {
- return "OGG demux plugin";
-}
-
-static const char *ogg_get_identifier (demux_class_t *this_gen) {
- return "OGG";
-}
-
-static const char *ogg_get_extensions (demux_class_t *this_gen) {
- return "ogx ogv oga ogg spx ogm";
-}
-
-static const char *ogg_get_mimetypes (demux_class_t *this_gen) {
- return "application/ogg: ogx: Ogg Stream;"
- "application/x-ogg: ogx: Ogg Stream;"
- "application/x-ogm: ogx: Ogg Stream;"
- "application/x-ogm-audio: oga: Ogg Audio;"
- "application/x-ogm-video: ogv: Ogg Video;"
- "audio/ogg: oga: Ogg Audio;"
- "audio/x-ogg: oga: Ogg Audio;"
- "video/ogg: ogv: Ogg Video;"
- "video/x-ogg: ogv: Ogg Video;";
-}
-
-static void ogg_class_dispose (demux_class_t *this_gen) {
- demux_ogg_class_t *this = (demux_ogg_class_t *) this_gen;
-
- free (this);
-}
-
-static void *ogg_init_class (xine_t *xine, void *data) {
- demux_ogg_class_t *this;
-
- this = calloc(1, sizeof(demux_ogg_class_t));
-
- this->demux_class.open_plugin = ogg_open_plugin;
- this->demux_class.get_description = ogg_get_description;
- this->demux_class.get_identifier = ogg_get_identifier;
- this->demux_class.get_mimetypes = ogg_get_mimetypes;
- this->demux_class.get_extensions = ogg_get_extensions;
- this->demux_class.dispose = ogg_class_dispose;
-
- return this;
-}
-
-/*
- * exported plugin catalog entry
- */
-static const demuxer_info_t demux_info_anx = {
- 20 /* priority */
-};
-
-static const demuxer_info_t demux_info_ogg = {
- 10 /* priority */
-};
-
-const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "ogg", XINE_VERSION_CODE, &demux_info_ogg, ogg_init_class },
- { PLUGIN_DEMUX, 26, "anx", XINE_VERSION_CODE, &demux_info_anx, anx_init_class },
- { PLUGIN_NONE, 0, "", 0, NULL, NULL }
-};
diff --git a/src/demuxers/demux_playlist.c b/src/demuxers/demux_playlist.c
new file mode 100644
index 000000000..5fa62b606
--- /dev/null
+++ b/src/demuxers/demux_playlist.c
@@ -0,0 +1,722 @@
+/*
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ *
+ * Playlist parser/demuxer by
+ * Claudio Ciccani (klan@users.sourceforge.net)
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
+#define LOG_MODULE "demux_playlist"
+#define LOG_VERBOSE
+/*
+#define LOG
+*/
+
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include "bswap.h"
+#include <xine/demux.h>
+
+typedef enum {
+ XINE_PLT_NONE = 0,
+ XINE_PLT_REF = ME_FOURCC('R','E','F',0),
+ XINE_PLT_M3U = ME_FOURCC('M','3','U',0),
+ XINE_PLT_RAM = ME_FOURCC('R','A','M',0),
+ XINE_PLT_PLS = ME_FOURCC('P','L','S',0),
+ XINE_PLT_ASX = ME_FOURCC('A','S','X',0),
+ XINE_PLT_SMI = ME_FOURCC('S','M','I',0),
+ XINE_PLT_QTL = ME_FOURCC('Q','T','L',0),
+ XINE_PLT_XSPF = ME_FOURCC('X','S','P',0),
+ XINE_PLT_RSS = ME_FOURCC('R','S','S',0)
+} playlist_t;
+
+typedef struct {
+ demux_plugin_t demux_plugin;
+
+ xine_t *xine;
+ xine_stream_t *stream;
+ input_plugin_t *input;
+
+ playlist_t playlist;
+
+ int status;
+} demux_playlist_t;
+
+typedef struct {
+ demux_class_t demux_class;
+} demux_playlist_class_t;
+
+
+static playlist_t detect_by_extension (input_plugin_t *input) {
+ char *ext;
+
+ ext = strrchr (input->get_mrl (input), '.');
+ if (!ext)
+ return XINE_PLT_NONE;
+
+ if (!strcasecmp (ext, ".m3u"))
+ return XINE_PLT_M3U;
+ if (!strcasecmp (ext, ".ram"))
+ return XINE_PLT_RAM;
+ if (!strcasecmp (ext, ".pls"))
+ return XINE_PLT_PLS;
+ if (!strcasecmp (ext, ".wax") ||
+ !strcasecmp (ext, ".wvx") ||
+ !strcasecmp (ext, ".asx"))
+ return XINE_PLT_ASX;
+ if (!strcasecmp (ext, ".smi") ||
+ !strcasecmp (ext, ".smil"))
+ return XINE_PLT_SMI;
+ if (!strcasecmp (ext, ".qtl"))
+ return XINE_PLT_QTL;
+ if (!strcasecmp (ext, ".xspf"))
+ return XINE_PLT_XSPF;
+ if (!strcasecmp (ext, ".rss"))
+ return XINE_PLT_RSS;
+
+ return XINE_PLT_NONE;
+}
+
+static playlist_t detect_by_content (input_plugin_t *input) {
+ char buf[256], *tmp;
+ int len;
+
+ len = _x_demux_read_header (input, buf, sizeof(buf)-1);
+ if (len <= 0)
+ return XINE_PLT_NONE;
+ buf[len] = '\0';
+
+ tmp = buf;
+ while (*tmp && isspace(*tmp))
+ tmp++;
+
+ if (!strncmp (tmp, "[Reference]", 11) ||
+ !strncmp (tmp, "Ref1=", 5))
+ return XINE_PLT_REF;
+ if (!strncmp (tmp, "#EXTM3U", 7))
+ return XINE_PLT_M3U;
+ if (!strncmp (tmp, "file://", 7) ||
+ !strncmp (tmp, "http://", 7) ||
+ !strncmp (tmp, "rtsp://", 7) ||
+ !strncmp (tmp, "pnm://", 6))
+ return XINE_PLT_RAM;
+ if (!strncmp (tmp, "[Playlist]", 10 ))
+ return XINE_PLT_PLS;
+ if (!strncasecmp (tmp, "<ASX", 4))
+ return XINE_PLT_ASX;
+ if (!strncmp (tmp, "<smil", 5))
+ return XINE_PLT_SMI;
+ if (!strncmp (tmp, "<?quicktime", 11))
+ return XINE_PLT_QTL;
+ if (!strncmp (tmp, "<playlist", 9))
+ return XINE_PLT_XSPF;
+ if (!strncmp (tmp, "<rss", 4))
+ return XINE_PLT_RSS;
+
+ if (!strncmp (tmp, "<?xml", 5)) {
+ tmp += 5;
+ while ((tmp = strchr (tmp, '<'))) {
+ if (!strncasecmp (tmp, "<ASX", 4))
+ return XINE_PLT_ASX;
+ if (!strncmp (tmp, "<smil", 5))
+ return XINE_PLT_SMI;
+ if (!strncmp (tmp, "<?quicktime", 11))
+ return XINE_PLT_QTL;
+ if (!strncmp (tmp, "<playlist", 9))
+ return XINE_PLT_XSPF;
+ if (!strncmp (tmp, "<rss", 4))
+ return XINE_PLT_RSS;
+ tmp++;
+ }
+ }
+
+ return XINE_PLT_NONE;
+}
+
+static char* trim (char *s) {
+ char *e;
+
+ while (*s && isspace(*s))
+ s++;
+
+ e = s + strlen(s) - 1;
+ while (e > s && isspace(*e))
+ *e-- = '\0';
+
+ return s;
+}
+
+static int parse_time (const char *s) {
+ int t = 0;
+ int i;
+
+ if (!s)
+ return 0;
+
+ if (!strncmp (s, "npt=", 4))
+ s += 4;
+ else if (!strncmp (s, "smpte=", 6))
+ s += 6;
+
+ for (i = 0; i < 3; i++) {
+ t *= 60;
+ t += atoi(s);
+ s = strchr (s, ':');
+ if (!s)
+ break;
+ s++;
+ }
+
+ return t*1000;
+}
+
+static void parse_ref (demux_playlist_t *this, char *data, int length) {
+ char *src = data;
+ char *end;
+ int alt = 0;
+
+ while (src && *src) {
+ end = strchr (src, '\n');
+ if (end)
+ *end = '\0';
+
+ src = trim (src);
+ if (!strncmp (src, "Ref", 3)) {
+ src = strchr (src, '=');
+ if (src && *(src+1)) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, alt++, src+1, NULL, 0, 0);
+ }
+ }
+
+ src = end;
+ if (src)
+ src++;
+ }
+}
+
+static void parse_m3u (demux_playlist_t *this, char *data, int length) {
+ char *src = data;
+ char *end;
+ char *title = NULL;
+
+ while (src && *src) {
+ end = strchr (src, '\n');
+ if (end)
+ *end = '\0';
+
+ src = trim (src);
+ if (*src == '#') {
+ if (!strncmp (src+1, "EXTINF:", 7)) {
+ title = strchr (src+8, ',');
+ if (title)
+ title++;
+ }
+ }
+ else if (*src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title, 0, 0);
+ }
+
+ src = end;
+ if (src)
+ src++;
+ }
+}
+
+static void parse_ram (demux_playlist_t *this, char *data, int length) {
+ char *src = data;
+ char *end;
+
+ while (src && *src) {
+ end = strchr (src, '\n');
+ if (end)
+ *end = '\0';
+
+ src = trim (src);
+ if (!strcmp (src, "--stop--"))
+ break;
+
+ if (*src && *src != '#') {
+ char *title = NULL;
+
+ if (!strncmp (src, "rtsp://", 7) || !strncmp (src, "pnm://", 7)) {
+ char *tmp = strrchr (src, '?');
+ if (tmp) {
+ *tmp = '\0';
+ title = strstr (tmp+1, "title=");
+ if (title) {
+ title += 6;
+ tmp = strchr (title, '&');
+ if (tmp)
+ *tmp = '\0';
+ }
+ }
+ }
+
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title, 0, 0);
+ }
+
+ src = end;
+ if (src)
+ src++;
+ }
+}
+
+static void parse_pls (demux_playlist_t *this, char *data, int length) {
+ char *src = data;
+ char *end;
+
+ while (src && *src) {
+ end = strchr (src, '\n');
+ if (end)
+ *end = '\0';
+
+ src = trim (src);
+ if (!strncmp (src, "File", 4)) {
+ src = strchr (src+4, '=');
+ if (src && *(src+1)) {
+ lprintf ("mrl:'%s'\n", src+1);
+ _x_demux_send_mrl_reference (this->stream, 0, src+1, NULL, 0, 0);
+ }
+ }
+
+ src = end;
+ if (src)
+ src++;
+ }
+}
+
+static void parse_asx (demux_playlist_t *this, char *data, int length) {
+ xml_node_t *root, *node, *tmp;
+ int is_asx = 0;
+
+ xml_parser_init (data, length, XML_PARSER_CASE_INSENSITIVE);
+
+ if (xml_parser_build_tree (&root) >= 0) {
+ if (!strcasecmp (root->name, "asx")) {
+ is_asx = 1;
+
+ for (node = root->child; node; node = node->next) {
+ if (!strcasecmp (node->name, "entry")) {
+ const char *title = NULL;
+ const char *src = NULL;
+ const char *start = NULL;
+ const char *duration = NULL;
+
+ for (tmp = node->child; tmp; tmp = tmp->next) {
+ if (!strcasecmp (tmp->name, "title")) {
+ title = tmp->data;
+ }
+ else if (!strcasecmp (tmp->name, "ref")) {
+ src = xml_parser_get_property (tmp, "href");
+ }
+ else if (!strcasecmp (tmp->name, "starttime")) {
+ start = xml_parser_get_property (tmp, "value");
+ }
+ else if (!strcasecmp (tmp->name, "duration")) {
+ duration = xml_parser_get_property (tmp, "value");
+ }
+ }
+
+ if (src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title,
+ parse_time(start), parse_time(duration));
+ }
+ }
+ }
+ }
+
+ xml_parser_free_tree (root);
+ }
+
+ if (!is_asx) {
+ /* No tags found? Might be a references list. */
+ parse_ref (this, data, length);
+ }
+}
+
+static void parse_smi (demux_playlist_t *this, char *data, int length) {
+ xml_node_t *root, *node, *tmp;
+ int is_smi = 0;
+
+ xml_parser_init (data, length, XML_PARSER_CASE_SENSITIVE);
+
+ if (xml_parser_build_tree (&root) >= 0) {
+ for (node = root; node; node = node->next) {
+ if (!strcmp (node->name, "smil"))
+ break;
+ }
+
+ if (node) {
+ is_smi = 1;
+
+ for (node = node->child; node; node = node->next) {
+ if (!strcmp (node->name, "body")) {
+ for (tmp = node->child; tmp; tmp = tmp->next) {
+ if (!strcmp (tmp->name, "audio") || !strcmp (tmp->name, "video")) {
+ const char *src, *title;
+ int start, end;
+
+ src = xml_parser_get_property (tmp, "src");
+ title = xml_parser_get_property (tmp, "title");
+ start = parse_time (xml_parser_get_property (tmp, "clipBegin") ? :
+ xml_parser_get_property (tmp, "clip-begin"));
+ end = parse_time (xml_parser_get_property (tmp, "clipEnd") ? :
+ xml_parser_get_property (tmp, "clip-end"));
+
+ if (src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title,
+ start, end ? (end-start) : 0);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ xml_parser_free_tree (root);
+ }
+
+ if (!is_smi) {
+ /* No tags found? Might be a RAM playlist. */
+ parse_ram (this, data, length);
+ }
+}
+
+static void parse_qtl (demux_playlist_t *this, char *data, int length) {
+ xml_node_t *root, *node;
+
+ xml_parser_init (data, length, XML_PARSER_CASE_SENSITIVE);
+
+ if (xml_parser_build_tree (&root) >= 0) {
+ for (node = root; node; node = node->next) {
+ if (!strcmp (node->name, "embed")) {
+ const char *src;
+
+ src = xml_parser_get_property (node, "src");
+ if (src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, NULL, 0, 0);
+ }
+ }
+ }
+
+ xml_parser_free_tree (root);
+ }
+}
+
+static void parse_xspf (demux_playlist_t *this, char *data, int length) {
+ xml_node_t *root, *node, *tmp;
+
+ xml_parser_init (data, length, XML_PARSER_CASE_SENSITIVE);
+
+ if (xml_parser_build_tree (&root) >= 0) {
+ for (node = root; node; node = node->next) {
+ if (!strcmp (node->name, "playlist"))
+ break;
+ }
+ if (node) {
+ for (node = node->child; node; node = node->next) {
+ if (!strcmp (node->name, "trackList"))
+ break;
+ }
+ }
+ if (node) {
+ for (node = node->child; node; node = node->next) {
+ if (!strcmp (node->name, "track")) {
+ char *src = NULL;
+ char *title = NULL;
+
+ for (tmp = node->child; tmp; tmp = tmp->next) {
+ if (!strcmp (tmp->name, "location")) {
+ src = trim((char*)tmp->data);
+ }
+ else if (!strcmp (tmp->name, "title")) {
+ title = trim((char*)tmp->data);
+ }
+ }
+
+ if (src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title, 0, 0);
+ }
+ }
+ }
+ }
+
+ xml_parser_free_tree (root);
+ }
+}
+
+static void parse_rss (demux_playlist_t *this, char *data, int length) {
+ xml_node_t *root, *node, *item, *tmp;
+
+ xml_parser_init (data, length, XML_PARSER_CASE_SENSITIVE);
+
+ if (xml_parser_build_tree (&root) >= 0) {
+ for (node = root; node; node = node->next) {
+ if (!strcmp (node->name, "rss"))
+ break;
+ }
+
+ if (node) {
+ for (node = node->child; node; node = node->next) {
+ if (strcmp (node->name, "channel"))
+ continue;
+
+ for (item = node->child; item; item = item->next) {
+ if (!strcmp (item->name, "item")) {
+ const char *title = NULL;
+ const char *src = NULL;
+
+ for (tmp = item->child; tmp; tmp = tmp->next) {
+ if (!strcmp (tmp->name, "title")) {
+ title = tmp->data;
+ }
+ else if (!strcmp (tmp->name, "enclosure")) {
+ src = xml_parser_get_property (tmp, "url");
+ }
+ }
+
+ if (src) {
+ lprintf ("mrl:'%s'\n", src);
+ _x_demux_send_mrl_reference (this->stream, 0, src, title, 0, 0);
+ }
+ }
+ }
+ }
+ }
+
+ xml_parser_free_tree (root);
+ }
+}
+
+
+static void demux_playlist_send_headers (demux_plugin_t *this_gen) {
+ demux_playlist_t *this = (demux_playlist_t *) this_gen;
+
+ this->status = DEMUX_OK;
+
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0);
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0);
+
+ _x_demux_control_start (this->stream);
+
+ this->input->seek (this->input, 0, SEEK_SET);
+}
+
+
+static int demux_playlist_send_chunk (demux_plugin_t *this_gen) {
+ demux_playlist_t *this = (demux_playlist_t *) this_gen;
+ char *data = NULL;
+ int length;
+
+ length = this->input->get_length (this->input);
+ if (length > 0) {
+ data = xine_xmalloc (length+1);
+ if (data)
+ this->input->read (this->input, data, length);
+ }
+ else {
+ char buf[1024];
+ int len;
+
+ length = 0;
+ while ((len = this->input->read (this->input, buf, sizeof(buf))) > 0) {
+ data = realloc (data, length+len+1);
+ if (!data)
+ break;
+
+ memcpy (data+length, buf, len);
+ length += len;
+ data[length] = '\0';
+ }
+ }
+
+ lprintf ("data:%p length:%d\n", data, length);
+
+ if (data) {
+ switch (this->playlist) {
+ case XINE_PLT_REF:
+ parse_ref (this, data, length);
+ break;
+ case XINE_PLT_M3U:
+ parse_m3u (this, data, length);
+ break;
+ case XINE_PLT_RAM:
+ parse_ram (this, data, length);
+ break;
+ case XINE_PLT_PLS:
+ parse_pls (this, data, length);
+ break;
+ case XINE_PLT_ASX:
+ parse_asx (this, data, length);
+ break;
+ case XINE_PLT_SMI:
+ parse_smi (this, data, length);
+ break;
+ case XINE_PLT_QTL:
+ parse_qtl (this, data, length);
+ break;
+ case XINE_PLT_XSPF:
+ parse_xspf (this, data, length);
+ break;
+ case XINE_PLT_RSS:
+ parse_rss (this, data, length);
+ break;
+ default:
+ lprintf ("unexpected playlist type 0x%08x\n", this->playlist);
+ break;
+ }
+
+ free (data);
+ }
+
+ this->status = DEMUX_FINISHED;
+
+ return DEMUX_FINISHED;
+}
+
+static int demux_playlist_seek (demux_plugin_t *this_gen,
+ off_t start_pos, int start_time, int playing) {
+ return DEMUX_OK;
+}
+
+static int demux_playlist_get_status (demux_plugin_t *this_gen) {
+ demux_playlist_t *this = (demux_playlist_t *) this_gen;
+
+ return this->status;
+}
+
+static int demux_playlist_get_stream_length (demux_plugin_t *this_gen) {
+ return 0;
+}
+
+static uint32_t demux_playlist_get_capabilities (demux_plugin_t *this_gen) {
+ return DEMUX_CAP_NOCAP;
+}
+
+static int demux_playlist_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_playlist_t *this;
+
+ this = xine_xmalloc (sizeof (demux_playlist_t));
+ this->xine = stream->xine;
+ this->stream = stream;
+ this->input = input;
+
+ this->demux_plugin.send_headers = demux_playlist_send_headers;
+ this->demux_plugin.send_chunk = demux_playlist_send_chunk;
+ this->demux_plugin.seek = demux_playlist_seek;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
+ this->demux_plugin.get_status = demux_playlist_get_status;
+ this->demux_plugin.get_stream_length = demux_playlist_get_stream_length;
+ this->demux_plugin.get_capabilities = demux_playlist_get_capabilities;
+ this->demux_plugin.get_optional_data = demux_playlist_get_optional_data;
+ this->demux_plugin.demux_class = class_gen;
+
+ switch (stream->content_detection_method) {
+ case METHOD_BY_MRL:
+ lprintf ("detect by extension\n");
+ this->playlist = detect_by_extension (input);
+ if (!this->playlist) {
+ free (this);
+ return NULL;
+ }
+ break;
+
+ case METHOD_BY_CONTENT:
+ case METHOD_EXPLICIT:
+ lprintf ("detect by content\n");
+ this->playlist = detect_by_content (input);
+ if (!this->playlist) {
+ free (this);
+ return NULL;
+ }
+ break;
+
+ default:
+ free (this);
+ return NULL;
+ }
+
+ lprintf ("playlist:0x%08x (%s)\n", this->playlist, (char*)&this->playlist);
+
+ return &this->demux_plugin;
+}
+
+static void *init_plugin (xine_t *xine, void *data) {
+ demux_playlist_class_t *this;
+
+ this = xine_xmalloc (sizeof(demux_playlist_class_t));
+
+ this->demux_class.open_plugin = open_plugin;
+ this->demux_class.description = N_("Playlist demux plugin");
+ this->demux_class.identifier = "playlist";
+ this->demux_class.mimetypes =
+ "audio/mpegurl: m3u: M3U playlist;"
+ "audio/x-mpegurl: m3u: M3U playlist;"
+ //"audio/x-pn-realaudio: ram: RAM playlist;"
+ //"audio/vnd.rn-realaudio: ram: RAM playlist;"
+ "audio/x-scpls: pls: Winamp playlist;"
+ "audio/x-ms-wax: wax, asx: WAX playlist;"
+ "audio/x-ms-wvx: wvx, asx: WVX playlist;"
+ "application/smil: smi, smil: SMIL playlist;"
+ "application/x-quicktimeplayer: qtl: Quicktime playlist;"
+ "application/xspf+xml: xspf: XSPF playlist;";
+ this->demux_class.extensions = "m3u ram pls asx wax wvx smi smil qtl xspf rss";
+ this->demux_class.dispose = default_demux_class_dispose;
+
+ return this;
+}
+
+/*
+ * exported plugin catalog entry
+ */
+static const demuxer_info_t demux_info_flv = {
+ 10 /* priority */
+};
+
+const plugin_info_t xine_plugin_info[] EXPORTED = {
+ /* type, API, "name", version, special_info, init_function */
+ { PLUGIN_DEMUX, 27, "playlist", XINE_VERSION_CODE, &demux_info_flv, init_plugin },
+ { PLUGIN_NONE, 0, "", 0, NULL, NULL }
+};
diff --git a/src/demuxers/demux_pva.c b/src/demuxers/demux_pva.c
index e2b61dcf0..532a11fdc 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
@@ -396,11 +396,6 @@ static int demux_pva_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_pva_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_pva_get_status (demux_plugin_t *this_gen) {
demux_pva_t *this = (demux_pva_t *) this_gen;
@@ -437,7 +432,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_pva_send_headers;
this->demux_plugin.send_chunk = demux_pva_send_chunk;
this->demux_plugin.seek = demux_pva_seek;
- this->demux_plugin.dispose = demux_pva_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_pva_get_status;
this->demux_plugin.get_stream_length = demux_pva_get_stream_length;
this->demux_plugin.get_capabilities = demux_pva_get_capabilities;
@@ -448,19 +443,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -478,39 +461,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "TechnoTrend PVA demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "TechnoTrend PVA";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "pva";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_pva_class_t *this = (demux_pva_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_pva_class_t *this;
this = calloc(1, sizeof(demux_pva_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;
+ this->demux_class.description = N_("TechnoTrend PVA demux plugin");
+ this->demux_class.identifier = "TechnoTrend PVA";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "pva";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -524,6 +485,6 @@ static const demuxer_info_t demux_info_pva = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "pva", XINE_VERSION_CODE, &demux_info_pva, init_plugin },
+ { PLUGIN_DEMUX, 27, "pva", XINE_VERSION_CODE, &demux_info_pva, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index d0fa3fd77..85f802a53 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"
@@ -110,6 +110,8 @@ typedef unsigned int qt_atom;
#define UDTA_ATOM QT_ATOM('u', 'd', 't', 'a')
#define META_ATOM QT_ATOM('m', 'e', 't', 'a')
+#define HDLR_ATOM QT_ATOM('h', 'd', 'l', 'r')
+#define ILST_ATOM QT_ATOM('i', 'l', 's', 't')
#define NAM_ATOM QT_ATOM(0xA9, 'n', 'a', 'm')
#define CPY_ATOM QT_ATOM(0xA9, 'c', 'p', 'y')
#define DES_ATOM QT_ATOM(0xA9, 'd', 'e', 's')
@@ -136,7 +138,9 @@ typedef unsigned int qt_atom;
#define MAX_PTS_DIFF 100000
-/* network bandwidth, cribbed from src/input/input_mms.c */
+/**
+ * @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};
@@ -187,7 +191,7 @@ typedef struct {
} time_to_sample_table_t;
typedef struct {
- unsigned char *url;
+ char *url;
int64_t data_rate;
int qtim_version;
} reference_t;
@@ -404,6 +408,10 @@ typedef struct {
* demuxer is sending off to the audio decoder */
#define DEBUG_AUDIO_DEMUX 0
+/* define DEBUG_META_LOAD as 1 to see details about the metadata chunks the
+ * demuxer is reading from the file */
+#define DEBUG_META_LOAD 0
+
/* Define DEBUG_DUMP_MOOV as 1 to dump the raw moov atom to disk. This is
* particularly useful in debugging a file with a compressed moov (cmov)
* atom. The atom will be dumped to the filename specified as
@@ -411,10 +419,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
@@ -445,6 +449,12 @@ static inline void XINE_FORMAT_PRINTF(1, 2) debug_video_demux(const char *format
static inline void XINE_FORMAT_PRINTF(1, 2) debug_audio_demux(const char *format, ...) {}
#endif
+#if DEBUG_META_LOAD
+#define debug_meta_load printf
+#else
+static inline void XINE_FORMAT_PRINTF(1, 2) debug_meta_load(const char *format, ...) {}
+#endif
+
static inline void dump_moov_atom(unsigned char *moov_atom, int moov_atom_size) {
#if DEBUG_DUMP_MOOV
@@ -644,8 +654,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);
}
@@ -673,151 +682,42 @@ static void free_qt_info(qt_info *info) {
}
}
-static char *qtl_file_url (input_plugin_t *input, const unsigned char *preview, int len)
-{
- char *url = NULL;
-
- if (len < 64)
- return NULL;
-
- /* skip BOM, if present */
- if (preview[0] == 0xEF && preview[1] == 0xBB && preview[2] == 0xBF)
- {
- preview += 3;
- len -= 3;
- }
-
- xml_node_t *tree = NULL;
- xml_parser_t *xml = xml_parser_init_r (preview, len, XML_PARSER_CASE_INSENSITIVE);
- if (xml_parser_build_tree_r (xml, &tree) < 0)
- return NULL;
-
- xml_node_t *node = tree;
- while (node && strcasecmp (node->name, "embed"))
- node = node->next;
-
- if (!node)
- goto not_qtl;
-
- url = (char *) xml_parser_get_property (node, "src");
- if (url) {
- char *slash = strchr (url, '/');
- char *proto = strstr (url, "://");
- if (proto + 1 == slash)
- /* absolute */
- url = strdup (url);
- else
- { /* relative */
- const char *dir = input->get_mrl (input);
- slash = strrchr (dir, '/');
- if (asprintf (&url, "%.*s/%s",
- slash ? (int)(slash - dir) : 1,
- slash ? dir : ".", url) < 0) {
- url = NULL;
- }
- }
- }
-
-not_qtl:
- xml_parser_free_tree (tree);
- xml_parser_finalize_r (xml);
- return url;
-}
+/* returns 1 if the file is determined to be a QT file, 0 otherwise */
+static int is_qt_file(input_plugin_t *qt_file) {
-/* Simple approach for parsing qtl files. */
-static int demux_qt_parse_references (demux_qt_t *this, int send)
-{
- char *buf = NULL;
- int buf_size = 0;
- int buf_used = 0;
- int len = 0;
-
- off_t pos = this->input->get_current_pos (this->input);
- this->input->seek (this->input, 0, SEEK_SET);
-
- /* Read in a chunk from the file.
- * Hopefully fine since the reference file is small...
- */
- do {
- buf_size += 1024;
- buf = realloc(buf, buf_size+1);
-
- len = this->input->read (this->input, &buf[buf_used], buf_size - buf_used);
-
- if (len > 0)
- buf_used += len;
-
- /* 50K of reference file? Something must be wrong */
- if (buf_used > 50*1024)
- break;
- } while (len > 0);
-
- this->input->seek (this->input, pos, SEEK_SET);
-
- char *url = qtl_file_url (this->input, buf, buf_used);
- if (url && send)
- _x_demux_send_mrl_reference (this->stream, 0, url, NULL, 0, 0);
- free (url);
- free (buf);
-
- return !!url;
-}
-
-/* returns 1 if the file is determined to be a QT file,
- * 2 if it is a QTL file,
- * 0 otherwise
- */
-static int id_qt_file(demux_qt_t *this) {
-
- input_plugin_t *const qt_file = this->input;
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);
-
- char *url = qtl_file_url (qt_file, preview, len);
- if (url) {
- free (url);
- return 2;
- }
-
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;
}
}
- if (demux_qt_parse_references (this, 0))
- return 2;
-
find_moov_atom(qt_file, &moov_atom_offset, &moov_atom_size);
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 */
@@ -833,80 +733,124 @@ static int id_qt_file(demux_qt_t *this) {
}
}
+static char *parse_data_atom(const uint8_t *data_atom, uint32_t max_size) {
+ uint32_t data_atom_size = _X_BE_32(&data_atom[0]);
+
+ static const int data_atom_max_version = 0;
+ const int data_atom_version = data_atom[8];
+
+ if (data_atom_size > max_size)
+ data_atom_size = max_size;
+
+ if (data_atom_size < 8)
+ return NULL; /* too small */
+
+ const size_t alloc_size = data_atom_size - 8 + 1;
+ char *alloc_str = NULL;
+
+ if ( data_atom_version > data_atom_max_version ) {
+ debug_meta_load("demux_qt: version %d for data atom is higher than the highest supported version (%d)\n",
+ data_atom_version, data_atom_max_version);
+ return NULL;
+ }
+
+ alloc_str = xine_xmalloc(alloc_size);
+ if (alloc_str) {
+ xine_fast_memcpy(alloc_str, &data_atom[16], alloc_size-1);
+ alloc_str[alloc_size-1] = '\0';
+ }
+
+ debug_meta_load("demux_qt: got a string of size %zd (%s)\n", alloc_size, alloc_str);
+
+ return alloc_str;
+}
+
/* parse out a meta data atom */
static void parse_meta_atom(qt_info *info, unsigned char *meta_atom) {
- int i;
- unsigned int meta_atom_size = _X_BE_32(&meta_atom[0]);
- qt_atom current_atom;
- int string_size;
-
- for (i = 0; i < meta_atom_size - 4; i++) {
- current_atom = _X_BE_32(&meta_atom[i]);
-
- if (current_atom == ART_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->artist = xine_xmalloc(string_size);
- if (info->artist) {
- strncpy(info->artist, &meta_atom[i + 20], string_size - 1);
- info->artist[string_size - 1] = 0;
- }
- } else if (current_atom == NAM_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->name = xine_xmalloc(string_size);
- if (info->name) {
- strncpy(info->name, &meta_atom[i + 20], string_size - 1);
- info->name[string_size - 1] = 0;
- }
- } else if (current_atom == ALB_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->album = xine_xmalloc(string_size);
- if (info->album) {
- strncpy(info->album, &meta_atom[i + 20], string_size - 1);
- info->album[string_size - 1] = 0;
- }
- } else if (current_atom == GEN_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->genre = xine_xmalloc(string_size);
- if (info->genre) {
- strncpy(info->genre, &meta_atom[i + 20], string_size - 1);
- info->genre[string_size - 1] = 0;
- }
- } else if (current_atom == TOO_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->comment = xine_xmalloc(string_size);
- if (info->comment) {
- strncpy(info->comment, &meta_atom[i + 20], string_size - 1);
- info->comment[string_size - 1] = 0;
- }
- } else if (current_atom == WRT_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->composer = xine_xmalloc(string_size);
- if (info->composer) {
- strncpy(info->composer, &meta_atom[i + 20], string_size - 1);
- info->composer[string_size - 1] = 0;
+ static const uint32_t meta_atom_preamble_size = 12;
+
+ const uint32_t meta_atom_size = _X_BE_32(&meta_atom[0]);
+
+ static const int meta_atom_max_version = 0;
+ const int meta_atom_version = meta_atom[8];
+ /* const uint32_t flags = _X_BE_24(&meta_atom[9]); */
+
+ uint32_t i = meta_atom_preamble_size;
+
+ if ( meta_atom_version > meta_atom_max_version ) {
+ debug_meta_load("demux_qt: version %d for meta atom is higher than the highest supported version (%d)\n",
+ meta_atom_version, meta_atom_max_version);
+ return;
+ }
+
+ while ( i < meta_atom_size ) {
+ const uint8_t *const current_atom = &meta_atom[i];
+ const qt_atom current_atom_code = _X_BE_32(&current_atom[4]);
+ const uint32_t current_atom_size = _X_BE_32(&current_atom[0]);
+ uint32_t handler_type = 0;
+
+ switch (current_atom_code) {
+ case HDLR_ATOM: {
+ static const int hdlr_atom_max_version = 0;
+ const int hdlr_atom_version = current_atom[8];
+
+ /* const uint32_t hdlr_atom_flags = _X_BE_24(&current_atom[9]); */
+
+ if ( hdlr_atom_version > hdlr_atom_max_version ) {
+ debug_meta_load("demux_qt: version %d for hdlr atom is higher than the highest supported version (%d)\n",
+ hdlr_atom_version, hdlr_atom_max_version);
+ return;
}
- } else if (current_atom == DAY_ATOM) {
- string_size = _X_BE_32(&meta_atom[i + 4]) - 16 + 1;
- if (string_size <= 0)
- continue;
- info->year = xine_xmalloc(string_size);
- if (info->year) {
- strncpy(info->year, &meta_atom[i + 20], string_size - 1);
- info->year[string_size - 1] = 0;
+
+ handler_type = _X_BE_32(&current_atom[12]);
+ }
+ break;
+
+ case ILST_ATOM: {
+ uint32_t j = i + 8;
+ while ( j < current_atom_size ) {
+ 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], current_atom_size - j);
+
+ switch(sub_atom_code) {
+ case ART_ATOM:
+ info->artist = data_atom;
+ break;
+ case NAM_ATOM:
+ info->name = data_atom;
+ break;
+ case ALB_ATOM:
+ info->album = data_atom;
+ break;
+ case GEN_ATOM:
+ info->genre = data_atom;
+ break;
+ case CMT_ATOM:
+ info->comment = data_atom;
+ break;
+ case WRT_ATOM:
+ info->composer = data_atom;
+ break;
+ case DAY_ATOM:
+ 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;
}
}
+ break;
+
+ default:
+ debug_meta_load("unknown atom %08x in meta\n", current_atom_code);
+ }
+
+ i += current_atom_size;
}
}
@@ -948,25 +892,11 @@ static qt_error parse_trak_atom (qt_trak *trak,
unsigned char *trak_atom) {
int i, j, k;
- unsigned int trak_atom_size = _X_BE_32(&trak_atom[0]);
- qt_atom current_atom;
- unsigned int current_atom_size;
+ const unsigned int trak_atom_size = _X_BE_32(&trak_atom[0]);
unsigned int atom_pos;
unsigned int properties_offset;
- unsigned int current_stsd_atom_size;
qt_error last_error = QT_OK;
- /* 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;
-
/* initialize trak structure */
trak->edit_list_count = 0;
trak->edit_list_table = NULL;
@@ -997,12 +927,13 @@ static qt_error parse_trak_atom (qt_trak *trak,
/* search for media type atoms */
for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) {
- current_atom = _X_BE_32(&trak_atom[i]);
+ const qt_atom current_atom = _X_BE_32(&trak_atom[i]);
- if (current_atom == VMHD_ATOM) {
+ switch (current_atom) {
+ case VMHD_ATOM:
trak->type = MEDIA_VIDEO;
break;
- } else if (current_atom == SMHD_ATOM) {
+ case SMHD_ATOM:
trak->type = MEDIA_AUDIO;
break;
}
@@ -1014,13 +945,15 @@ static qt_error parse_trak_atom (qt_trak *trak,
/* search for the useful atoms */
for (i = ATOM_PREAMBLE_SIZE; i < trak_atom_size - 4; i++) {
- current_atom_size = _X_BE_32(&trak_atom[i - 4]);
- current_atom = _X_BE_32(&trak_atom[i]);
+ const uint32_t current_atom_size = _X_BE_32(&trak_atom[i - 4]);
+ const qt_atom current_atom = _X_BE_32(&trak_atom[i]);
- if (current_atom == TKHD_ATOM) {
+ switch(current_atom) {
+ case TKHD_ATOM:
trak->flags = _X_BE_16(&trak_atom[i + 6]);
- } else if (current_atom == ELST_ATOM) {
+ break;
+ case ELST_ATOM:
/* there should only be one edit list table */
if (trak->edit_list_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1050,17 +983,19 @@ static qt_error parse_trak_atom (qt_trak *trak,
trak->edit_list_table[j].track_duration,
trak->edit_list_table[j].media_time);
}
+ break;
- } else if (current_atom == MDHD_ATOM) {
- int version;
+ case MDHD_ATOM:
debug_atom_load ("demux_qt: mdhd atom\n");
+ {
+ const int version = trak_atom[i+4];
+ if ( version > 1 ) continue; /* unsupported, undocumented */
- version = trak_atom[i+4];
- if ( version > 1 ) continue; /* unsupported, undocumented */
-
- trak->timescale = _X_BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]);
- } else if (current_atom == STSD_ATOM) {
+ trak->timescale = _X_BE_32(&trak_atom[i + (version == 0 ? 0x10 : 0x18) ]);
+ }
+ break;
+ case STSD_ATOM:
debug_atom_load ("demux_qt: stsd atom\n");
#if DEBUG_ATOM_LOAD
xine_hexdump (&trak_atom[i], current_atom_size);
@@ -1082,13 +1017,23 @@ static qt_error parse_trak_atom (qt_trak *trak,
properties_offset = 0x0C;
for (k = 0; k < trak->stsd_atoms_count; k++) {
- current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]);
+ const uint32_t current_stsd_atom_size = _X_BE_32(&trak_atom[atom_pos - 4]);
if (current_stsd_atom_size < 4) {
last_error = QT_HEADER_TROUBLE;
goto free_trak;
}
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;
@@ -1389,7 +1334,7 @@ static qt_error parse_trak_atom (qt_trak *trak,
(_X_BE_32(&trak_atom[atom_pos + 0x34]) == WAVE_ATOM) &&
(_X_BE_32(&trak_atom[atom_pos + 0x3C]) == FRMA_ATOM) &&
(_X_ME_32(&trak_atom[atom_pos + 0x48]) == trak->stsd_atoms[k].audio.codec_fourcc)) {
- int wave_size = _X_BE_32(&trak_atom[atom_pos + 0x44]) - 8;
+ const int wave_size = _X_BE_32(&trak_atom[atom_pos + 0x44]) - 8;
if ((wave_size >= sizeof(xine_waveformatex)) &&
(current_atom_size >= (0x4C + wave_size))) {
@@ -1443,15 +1388,15 @@ static qt_error parse_trak_atom (qt_trak *trak,
atom_pos += current_stsd_atom_size;
properties_offset += current_stsd_atom_size;
}
+ break;
- } else if (current_atom == ESDS_ATOM) {
-
- uint32_t len;
+ case ESDS_ATOM:
debug_atom_load(" qt/mpeg-4 esds atom\n");
if ((trak->type == MEDIA_VIDEO) ||
(trak->type == MEDIA_AUDIO)) {
+ uint32_t len;
j = i + 8;
if( trak_atom[j++] == 0x03 ) {
@@ -1482,17 +1427,17 @@ static qt_error parse_trak_atom (qt_trak *trak,
}
}
}
+ break;
- } else if (current_atom == AVCC_ATOM) {
-
+ case AVCC_ATOM:
debug_atom_load(" avcC atom\n");
trak->decoder_config_len = current_atom_size - 8;
trak->decoder_config = realloc(trak->decoder_config, trak->decoder_config_len);
memcpy(trak->decoder_config, &trak_atom[i + 4], trak->decoder_config_len);
+ break;
- } else if (current_atom == STSZ_ATOM) {
-
+ case STSZ_ATOM:
/* there should only be one of these atoms */
if (trak->sample_size_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1524,9 +1469,9 @@ static qt_error parse_trak_atom (qt_trak *trak,
/* set the pointer to non-NULL to indicate that the atom type has
* already been seen for this trak atom */
trak->sample_size_table = (void *)-1;
+ break;
- } else if (current_atom == STSS_ATOM) {
-
+ case STSS_ATOM:
/* there should only be one of these atoms */
if (trak->sync_sample_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1553,9 +1498,9 @@ static qt_error parse_trak_atom (qt_trak *trak,
j, trak->sync_sample_table[j],
trak->sync_sample_table[j] - 1);
}
+ break;
- } else if (current_atom == STCO_ATOM) {
-
+ case STCO_ATOM:
/* there should only be one of either stco or co64 */
if (trak->chunk_offset_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1567,8 +1512,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 *)calloc(
- 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;
@@ -1581,9 +1525,9 @@ static qt_error parse_trak_atom (qt_trak *trak,
debug_atom_load(" chunk %d @ 0x%"PRIX64"\n",
j, trak->chunk_offset_table[j]);
}
+ break;
- } else if (current_atom == CO64_ATOM) {
-
+ case CO64_ATOM:
/* there should only be one of either stco or co64 */
if (trak->chunk_offset_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1595,8 +1539,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 *)calloc(
- 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;
@@ -1612,9 +1555,9 @@ static qt_error parse_trak_atom (qt_trak *trak,
debug_atom_load(" chunk %d @ 0x%"PRIX64"\n",
j, trak->chunk_offset_table[j]);
}
+ break;
- } else if (current_atom == STSC_ATOM) {
-
+ case STSC_ATOM:
/* there should only be one of these atoms */
if (trak->sample_to_chunk_table) {
last_error = QT_HEADER_TROUBLE;
@@ -1626,8 +1569,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 *)calloc(
- 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;
@@ -1647,9 +1589,9 @@ static qt_error parse_trak_atom (qt_trak *trak,
trak->sample_to_chunk_table[j].first_chunk - 1,
trak->sample_to_chunk_table[j].media_id);
}
+ break;
- } else if (current_atom == STTS_ATOM) {
-
+ case STTS_ATOM:
/* there should only be one of these atoms */
if (trak->time_to_sample_table
|| current_atom_size < 12 || current_atom_size >= UINT_MAX) {
@@ -1667,8 +1609,7 @@ static qt_error parse_trak_atom (qt_trak *trak,
goto free_trak;
}
- trak->time_to_sample_table = (time_to_sample_table_t *)calloc(
- 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;
@@ -1715,9 +1656,7 @@ static qt_error parse_reference_atom (reference_t *ref,
char *base_mrl) {
int i, j;
- unsigned int ref_atom_size = _X_BE_32(&ref_atom[0]);
- qt_atom current_atom;
- unsigned int current_atom_size;
+ const unsigned int ref_atom_size = _X_BE_32(&ref_atom[0]);
if (ref_atom_size >= 0x80000000)
return QT_NOT_A_VALID_FILE;
@@ -1728,17 +1667,17 @@ static qt_error parse_reference_atom (reference_t *ref,
ref->qtim_version = 0;
/* traverse through the atom looking for the key atoms */
- for (i = ATOM_PREAMBLE_SIZE; i + 4 < ref_atom_size; i++) {
-
- current_atom_size = _X_BE_32(&ref_atom[i - 4]);
- current_atom = _X_BE_32(&ref_atom[i]);
+ for (i = ATOM_PREAMBLE_SIZE; i < ref_atom_size - 4; i++) {
+ const uint32_t current_atom_size = _X_BE_32(&ref_atom[i - 4]);
+ const qt_atom current_atom = _X_BE_32(&ref_atom[i]);
- if (current_atom == RDRF_ATOM) {
+ switch (current_atom) {
+ case RDRF_ATOM: {
size_t string_size = _X_BE_32(&ref_atom[i + 12]);
size_t url_offset = 0;
int http = 0;
- if (string_size >= current_atom_size || string_size >= ref_atom_size - i)
+ if (string_size >= current_atom_size || i + string_size >= ref_atom_size)
return QT_NOT_A_VALID_FILE;
/* if the URL starts with "http://", copy it */
@@ -1764,19 +1703,20 @@ static qt_error parse_reference_atom (reference_t *ref,
memcpy(ref->url + url_offset, &ref_atom[i + 16], _X_BE_32(&ref_atom[i + 12]));
ref->url[string_size] = '\0';
+ }
debug_atom_load(" qt rdrf URL reference:\n %s\n", ref->url);
+ break;
- } else if (current_atom == RMDR_ATOM) {
-
+ case RMDR_ATOM:
/* load the data rate */
ref->data_rate = _X_BE_32(&ref_atom[i + 8]);
ref->data_rate *= 10;
debug_atom_load(" qt rmdr data rate = %"PRId64"\n", ref->data_rate);
+ break;
- } else if (current_atom == RMVC_ATOM) {
-
+ case RMVC_ATOM:
debug_atom_load(" qt rmvc atom\n");
/* search the rmvc atom for 'qtim'; 2 bytes will follow the qtim
@@ -1799,7 +1739,7 @@ static qt_error parse_reference_atom (reference_t *ref,
* building a frame table. */
#define MAX_DURATION 0x7FFFFFFFFFFFFFFFLL
static void get_next_edit_list_entry(qt_trak *trak,
- int *edit_list_index,
+ unsigned int *edit_list_index,
unsigned int *edit_list_media_time,
int64_t *edit_list_duration,
unsigned int global_timescale) {
@@ -1876,7 +1816,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 *)calloc(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;
@@ -1888,7 +1828,7 @@ static qt_error build_frame_table(qt_trak *trak,
pts_index_countdown =
trak->time_to_sample_table[pts_index].count;
- media_id_counts = calloc(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;
@@ -2025,7 +1965,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 *)calloc(trak->frame_count, sizeof(qt_frame));
+ trak->frames = calloc(trak->frame_count, sizeof(qt_frame));
if (!trak->frames)
return QT_NO_MEMORY;
@@ -2102,7 +2042,6 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom,
int64_t bandwidth) {
int i, j;
unsigned int moov_atom_size = _X_BE_32(&moov_atom[0]);
- qt_atom current_atom;
int string_size, error;
unsigned int max_video_frames = 0;
unsigned int max_audio_frames = 0;
@@ -2117,15 +2056,17 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom,
/* prowl through the moov atom looking for very specific targets */
for (i = ATOM_PREAMBLE_SIZE + 4; i < moov_atom_size - 4; i += _X_BE_32(&moov_atom[i - 4])) {
- current_atom = _X_BE_32(&moov_atom[i]);
+ const qt_atom current_atom = _X_BE_32(&moov_atom[i]);
- if (current_atom == MVHD_ATOM) {
+ switch (current_atom) {
+ case MVHD_ATOM:
parse_mvhd_atom(info, &moov_atom[i - 4]);
if (info->last_error != QT_OK)
return;
- } else if (current_atom == TRAK_ATOM) {
+ break;
+ case TRAK_ATOM:
/* create a new trak structure */
info->trak_count++;
info->traks = (qt_trak *)realloc(info->traks,
@@ -2137,44 +2078,50 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom,
info->trak_count--;
return;
}
+ break;
- } else if (current_atom == META_ATOM) {
+ case UDTA_ATOM:
+ parse_meta_atom(info, &moov_atom[i + 4]);
+ if (info->last_error != QT_OK)
+ return;
+ break;
+ case META_ATOM:
parse_meta_atom(info, &moov_atom[i - 4]);
if (info->last_error != QT_OK)
return;
+ break;
- } else if (current_atom == NAM_ATOM) {
-
- string_size = _X_BE_16(&moov_atom[i + 4]) + 1;
- info->name = realloc (info->name, string_size);
- strncpy(info->name, &moov_atom[i + 8], string_size - 1);
- info->name[string_size - 1] = 0;
-
- } else if (current_atom == CPY_ATOM) {
-
- string_size = _X_BE_16(&moov_atom[i + 4]) + 1;
- info->copyright = realloc (info->copyright, string_size);
- strncpy(info->copyright, &moov_atom[i + 8], string_size - 1);
- info->copyright[string_size - 1] = 0;
-
- } else if (current_atom == DES_ATOM) {
-
- string_size = _X_BE_16(&moov_atom[i + 4]) + 1;
- info->description = realloc (info->description, string_size);
- strncpy(info->description, &moov_atom[i + 8], string_size - 1);
- info->description[string_size - 1] = 0;
+ case NAM_ATOM:
+ string_size = _X_BE_16(&moov_atom[i + 4]);
+ info->name = realloc (info->name, string_size + 1);
+ memcpy(info->name, &moov_atom[i + 8], string_size);
+ info->name[string_size] = 0;
+ break;
- } else if (current_atom == CMT_ATOM) {
+ case CPY_ATOM:
+ string_size = _X_BE_16(&moov_atom[i + 4]);
+ info->copyright = realloc (info->copyright, string_size + 1);
+ memcpy(info->copyright, &moov_atom[i + 8], string_size);
+ info->copyright[string_size] = 0;
+ break;
- string_size = _X_BE_16(&moov_atom[i + 4]) + 1;
- info->comment = realloc (info->comment, string_size);
- strncpy(info->comment, &moov_atom[i + 8], string_size - 1);
- info->comment[string_size - 1] = 0;
+ case DES_ATOM:
+ string_size = _X_BE_16(&moov_atom[i + 4]);
+ info->description = realloc (info->description, string_size + 1);
+ memcpy(info->description, &moov_atom[i + 8], string_size);
+ info->description[string_size] = 0;
+ break;
- } else if (current_atom == RMDA_ATOM ||
- current_atom == RMRA_ATOM) {
+ case CMT_ATOM:
+ string_size = _X_BE_16(&moov_atom[i + 4]);
+ info->comment = realloc (info->comment, string_size + 1);
+ memcpy(info->comment, &moov_atom[i + 8], string_size);
+ info->comment[string_size] = 0;
+ break;
+ case RMDA_ATOM:
+ case RMRA_ATOM:
/* create a new reference structure */
info->reference_count++;
info->references = (reference_t *)realloc(info->references,
@@ -2186,8 +2133,9 @@ static void parse_moov_atom(qt_info *info, unsigned char *moov_atom,
info->last_error = error;
return;
}
+ break;
- } else {
+ default:
debug_atom_load(" qt: unknown atom into the moov atom (0x%08X)\n", current_atom);
}
}
@@ -2263,7 +2211,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;
@@ -2286,7 +2233,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 */
@@ -2423,13 +2370,6 @@ static int demux_qt_send_chunk(demux_plugin_t *this_gen) {
int dispatch_audio; /* boolean for deciding which trak to dispatch */
int64_t pts_diff;
- /* handle QTL here */
- if (!this->qt) {
- demux_qt_parse_references (this, 1);
- this->status = DEMUX_FINISHED;
- return this->status;
- }
-
/* if this is DRM-protected content, finish playback before it even
* tries to start */
if (this->qt->last_error == QT_DRM_NOT_SUPPORTED) {
@@ -2728,12 +2668,6 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) {
this->status = DEMUX_OK;
- if (!this->qt) {
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 0);
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0);
- return;
- }
-
/* figure out where the data begins and ends */
if (this->qt->video_trak != -1) {
video_trak = &this->qt->traks[this->qt->video_trak];
@@ -2778,7 +2712,11 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) {
if( !video_trak->properties->video.codec_buftype &&
video_trak->properties->video.codec_fourcc )
+ {
video_trak->properties->video.codec_buftype = BUF_VIDEO_UNKNOWN;
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE,
+ video_trak->properties->video.codec_fourcc);
+ }
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
@@ -2820,7 +2758,11 @@ static void demux_qt_send_headers(demux_plugin_t *this_gen) {
if( !audio_trak->properties->audio.codec_buftype &&
audio_trak->properties->audio.codec_fourcc )
+ {
audio_trak->properties->audio.codec_buftype = BUF_AUDIO_UNKNOWN;
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE,
+ audio_trak->properties->audio.codec_fourcc);
+ }
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 1);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS,
@@ -3051,10 +2993,6 @@ static int demux_qt_seek (demux_plugin_t *this_gen,
start_pos = (off_t) ( (double) start_pos / 65535 *
this->data_size );
- /* we could be handling QTL */
- if (!this->qt)
- return this->status = DEMUX_OK;
-
/* short-circuit any attempts to seek in a non-seekable stream, including
* seeking in the forward direction; this may change later */
if ((this->input->get_capabilities(this->input) & INPUT_CAP_SEEKABLE) == 0) {
@@ -3154,7 +3092,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_qt_t *this;
xine_cfg_entry_t entry;
qt_error last_error;
- int type;
if ((input->get_capabilities(input) & INPUT_CAP_BLOCK)) {
return NULL;
@@ -3188,14 +3125,10 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
case METHOD_BY_CONTENT:
- type = id_qt_file(this);
- if (type < 1) {
+ if (!is_qt_file(this->input)) {
free (this);
return NULL;
}
- if (type != 1)
- break;
-
if ((this->qt = create_qt_info()) == NULL) {
free (this);
return NULL;
@@ -3217,35 +3150,13 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const ending = strrchr(mrl, '.');
-
- if (!ending) {
- free (this);
- return NULL;
- }
-
- if (strncasecmp (ending, ".mov", 4) &&
- strncasecmp (ending, ".qt", 3) &&
- strncasecmp (ending, ".qtl", 4) &&
- strncasecmp (ending, ".mp4", 4)) {
- free (this);
- return NULL;
- }
- }
-
- /* we want to fall through here */
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT: {
- type = id_qt_file(this);
- if (type < 1) {
+ if (!is_qt_file(this->input)) {
free (this);
return NULL;
}
- if (type != 1)
- break;
-
if ((this->qt = create_qt_info()) == NULL) {
free (this);
return NULL;
@@ -3268,34 +3179,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Apple Quicktime (MOV) and MPEG-4 demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MOV/MPEG-4";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mov qt qtl mp4 m4a m4b f4a f4v";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/quicktime: mov,qt: Quicktime animation;"
- "video/x-quicktime: mov,qt: Quicktime animation;"
- "audio/x-m4a: m4a,m4b: MPEG-4 audio;"
- "application/x-quicktimeplayer: qtl: Quicktime list;"
- "video/mp4: f4v,mp4,mpg4: MPEG-4 video;"
- "audio/mp4: f4a,mp4,mpg4: MPEG-4 audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_qt_class_t *this = (demux_qt_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_qt_class_t *this;
@@ -3305,11 +3188,16 @@ static void *init_plugin (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("Apple Quicktime (MOV) and MPEG-4 demux plugin");
+ this->demux_class.identifier = "MOV/MPEG-4";
+ this->demux_class.mimetypes =
+ "video/quicktime: mov,qt: Quicktime animation;"
+ "video/x-quicktime: mov,qt: Quicktime animation;"
+ "audio/x-m4a: m4a,m4b: MPEG-4 audio;"
+ "video/mp4: f4v,mp4,mpg4: MPEG-4 video;"
+ "audio/mp4: f4a,mp4,mpg4: MPEG-4 audio;";
+ this->demux_class.extensions = "mov qt mp4 m4a m4b f4a f4v";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -3323,6 +3211,6 @@ static const demuxer_info_t demux_info_qt = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "quicktime", XINE_VERSION_CODE, &demux_info_qt, init_plugin },
+ { PLUGIN_DEMUX, 27, "quicktime", XINE_VERSION_CODE, &demux_info_qt, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_rawdv.c b/src/demuxers/demux_rawdv.c
index 968542057..199100a89 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
@@ -321,12 +321,6 @@ static int demux_raw_dv_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_raw_dv_dispose (demux_plugin_t *this_gen) {
- demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen;
-
- free (this);
-}
-
static int demux_raw_dv_get_stream_length(demux_plugin_t *this_gen) {
demux_raw_dv_t *this = (demux_raw_dv_t *) this_gen;
@@ -355,7 +349,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_raw_dv_send_headers;
this->demux_plugin.send_chunk = demux_raw_dv_send_chunk;
this->demux_plugin.seek = demux_raw_dv_seek;
- this->demux_plugin.dispose = demux_raw_dv_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_raw_dv_get_status;
this->demux_plugin.get_stream_length = demux_raw_dv_get_stream_length;
this->demux_plugin.get_capabilities = demux_raw_dv_get_capabilities;
@@ -382,19 +376,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
}
break;
- 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;
- }
- }
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -411,39 +393,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Raw DV Video stream";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "raw_dv";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "dv dif";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_raw_dv_class_t *this = (demux_raw_dv_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_raw_dv_class_t *this;
this = calloc(1, sizeof(demux_raw_dv_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;
+ this->demux_class.description = N_("Raw DV Video stream");
+ this->demux_class.identifier = "raw_dv";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "dv dif";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -457,6 +417,6 @@ static const demuxer_info_t demux_info_raw_dv = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "rawdv", XINE_VERSION_CODE, &demux_info_raw_dv, init_plugin },
+ { PLUGIN_DEMUX, 27, "rawdv", XINE_VERSION_CODE, &demux_info_raw_dv, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index 9ecf6b622..47d18018e 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -52,10 +52,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 "real_common.h"
@@ -287,29 +287,23 @@ static mdpr_t *real_parse_mdpr(const char *data, const unsigned int size)
mdpr->stream_name_size=data[32];
if (size < 38 + mdpr->stream_name_size)
goto fail;
- mdpr->stream_name=malloc(mdpr->stream_name_size+1);
+ mdpr->stream_name=xine_memdup0(&data[33], mdpr->stream_name_size);
if (!mdpr->stream_name)
goto fail;
- memcpy(mdpr->stream_name, &data[33], mdpr->stream_name_size);
- mdpr->stream_name[(int)mdpr->stream_name_size]=0;
mdpr->mime_type_size=data[33+mdpr->stream_name_size];
if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size)
goto fail;
- mdpr->mime_type=malloc(mdpr->mime_type_size+1);
+ mdpr->mime_type=xine_memdup0(&data[34+mdpr->stream_name_size], mdpr->mime_type_size);
if (!mdpr->mime_type)
goto fail;
- memcpy(mdpr->mime_type, &data[34+mdpr->stream_name_size], mdpr->mime_type_size);
- mdpr->mime_type[(int)mdpr->mime_type_size]=0;
mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]);
if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_len)
goto fail;
- mdpr->type_specific_data=malloc(mdpr->type_specific_len);
+ mdpr->type_specific_data=xine_memdup(&data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
if (!mdpr->type_specific_data)
goto fail;
- memcpy(mdpr->type_specific_data,
- &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);
@@ -579,6 +573,9 @@ static void real_parse_headers (demux_real_t *this) {
this->audio_streams[this->num_audio_streams].index = NULL;
this->audio_streams[this->num_audio_streams].mdpr = mdpr;
+ if (!this->audio_streams[this->num_audio_streams].buf_type)
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, fourcc);
+
real_parse_audio_specific_data (this,
&this->audio_streams[this->num_audio_streams]);
this->num_audio_streams++;
@@ -602,7 +599,10 @@ static void real_parse_headers (demux_real_t *this) {
this->video_streams[this->num_video_streams].index = NULL;
this->video_streams[this->num_video_streams].mdpr = mdpr;
- this->num_video_streams++;
+ this->num_video_streams++;
+
+ if (!this->video_streams[this->num_video_streams].buf_type)
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, fourcc);
} else {
lprintf("unrecognised type specific data\n");
@@ -1734,20 +1734,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
lprintf ("by content accepted.\n");
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const extensions = class_gen->get_extensions (class_gen);
-
- lprintf ("by extension '%s'\n", mrl);
-
- if (!_x_demux_check_extension (mrl, extensions)) {
- return NULL;
- }
- lprintf ("by extension accepted.\n");
- }
-
- break;
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -1780,40 +1767,19 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "RealMedia file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Real";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "rm rmvb ram";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-pn-realaudio: ra, rm, ram: Real Media file;"
- "audio/x-pn-realaudio-plugin: rpm: Real Media plugin file;"
- "audio/x-real-audio: ra, rm, ram: Real Media file;"
- "application/vnd.rn-realmedia: ra, rm, ram: Real Media file;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_real_class_t *this = (demux_real_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_real_class_t *const this = calloc(1, sizeof(demux_real_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;
+ this->demux_class.description = N_("RealMedia file demux plugin");
+ this->demux_class.identifier = "Real";
+ this->demux_class.mimetypes =
+ "audio/x-pn-realaudio: ra, rm, ram: Real Media file;"
+ "audio/x-pn-realaudio-plugin: rpm: Real Media plugin file;"
+ "audio/x-real-audio: ra, rm, ram: Real Media file;"
+ "application/vnd.rn-realmedia: ra, rm, ram: Real Media file;";
+ this->demux_class.extensions = "rm rmvb ram";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -1827,6 +1793,6 @@ static const demuxer_info_t demux_info_real = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "real", XINE_VERSION_CODE, &demux_info_real, init_class },
+ { PLUGIN_DEMUX, 27, "real", XINE_VERSION_CODE, &demux_info_real, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c
index 3c18f7ec3..6f29e46d6 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"
@@ -365,11 +365,8 @@ static int demux_ra_seek (demux_plugin_t *this_gen,
static void demux_ra_dispose (demux_plugin_t *this_gen) {
demux_ra_t *this = (demux_ra_t *) this_gen;
- if(this->header)
- free(this->header);
- if (this->frame_buffer)
- free(this->frame_buffer);
-
+ free(this->header);
+ free(this->frame_buffer);
free(this);
}
@@ -417,19 +414,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -448,39 +433,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "RealAudio file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "RA";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "ra";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-realaudio: ra: RealAudio File;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_ra_class_t *this = (demux_ra_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_realaudio_init_plugin (xine_t *xine, void *data) {
demux_ra_class_t *this;
this = calloc(1, sizeof(demux_ra_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;
+ this->demux_class.description = N_("RealAudio file demux plugin");
+ this->demux_class.identifier = "RA";
+ this->demux_class.mimetypes = "audio/x-realaudio: ra: RealAudio File;";
+ this->demux_class.extensions = "ra";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_roq.c b/src/demuxers/demux_roq.c
index 346d487aa..9bc0f4e99 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"
@@ -377,11 +377,6 @@ static int demux_roq_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_roq_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_roq_get_status (demux_plugin_t *this_gen) {
demux_roq_t *this = (demux_roq_t *) this_gen;
@@ -418,7 +413,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_roq_send_headers;
this->demux_plugin.send_chunk = demux_roq_send_chunk;
this->demux_plugin.seek = demux_roq_seek;
- this->demux_plugin.dispose = demux_roq_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_roq_get_status;
this->demux_plugin.get_stream_length = demux_roq_get_stream_length;
this->demux_plugin.get_capabilities = demux_roq_get_capabilities;
@@ -429,19 +424,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -460,39 +443,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Id RoQ file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "RoQ";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "roq";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_roq_class_t *this = (demux_roq_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_roq_init_plugin (xine_t *xine, void *data) {
demux_roq_class_t *this;
this = calloc(1, sizeof(demux_roq_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;
+ this->demux_class.description = N_("Id RoQ file demux plugin");
+ this->demux_class.identifier = "RoQ";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "roq";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_shn.c b/src/demuxers/demux_shn.c
index b4f7c764b..7e25a7048 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"
@@ -150,12 +150,6 @@ static int demux_shn_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_shn_dispose (demux_plugin_t *this_gen) {
- demux_shn_t *this = (demux_shn_t *) this_gen;
-
- free(this);
-}
-
static int demux_shn_get_status (demux_plugin_t *this_gen) {
demux_shn_t *this = (demux_shn_t *) this_gen;
@@ -189,7 +183,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_shn_send_headers;
this->demux_plugin.send_chunk = demux_shn_send_chunk;
this->demux_plugin.seek = demux_shn_seek;
- this->demux_plugin.dispose = demux_shn_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_shn_get_status;
this->demux_plugin.get_stream_length = demux_shn_get_stream_length;
this->demux_plugin.get_capabilities = demux_shn_get_capabilities;
@@ -199,19 +193,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
if (!open_shn_file(this)) {
@@ -228,39 +210,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Shorten demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "Shorten";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "shn";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_shn_class_t *this = (demux_shn_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_shn_init_plugin (xine_t *xine, void *data) {
demux_shn_class_t *this;
this = calloc(1, sizeof(demux_shn_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;
+ this->demux_class.description = N_("Shorten demux plugin");
+ this->demux_class.identifier = "Shorten";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "shn";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c
index de530f224..553089206 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
@@ -334,16 +334,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
-
- if(!strncmp(mrl, "slave://", 8))
- break;
-
- free (this);
- return NULL;
- }
-
case METHOD_BY_CONTENT: {
if (_x_demux_read_header(input, this->scratch, SCRATCH_SIZE) > 0) {
@@ -355,6 +345,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return NULL;
}
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -388,39 +379,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "slave";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_slave_class_t *this = (demux_slave_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_slave_class_t *this;
this = calloc(1, sizeof(demux_slave_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;
+ this->demux_class.description = "";
+ this->demux_class.identifier = "slave";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "slave://";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -434,6 +403,6 @@ static const demuxer_info_t demux_info_slave = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin },
+ { PLUGIN_DEMUX, 27, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_smjpeg.c b/src/demuxers/demux_smjpeg.c
index 04a46fa78..6f0cb3832 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"
@@ -141,6 +141,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
this->bih.biHeight = _X_BE_16(&header_chunk[10]);
this->bih.biCompression = *(uint32_t *)&header_chunk[12];
this->video_type = _x_fourcc_to_buf_video(this->bih.biCompression);
+ if (!this->video_type)
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, this->bih.biCompression);
break;
case _SND_TAG:
@@ -160,6 +162,8 @@ static int open_smjpeg_file(demux_smjpeg_t *this) {
} else {
audio_codec = *(uint32_t *)&header_chunk[8];
this->audio_type = _x_formattag_to_buf_audio(audio_codec);
+ if (!this->audio_type)
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, audio_codec);
}
break;
@@ -356,12 +360,6 @@ static int demux_smjpeg_seek (demux_plugin_t *this_gen, off_t start_pos, int sta
}
-static void demux_smjpeg_dispose (demux_plugin_t *this_gen) {
- demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen;
-
- free(this);
-}
-
static int demux_smjpeg_get_status (demux_plugin_t *this_gen) {
demux_smjpeg_t *this = (demux_smjpeg_t *) this_gen;
@@ -401,7 +399,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_smjpeg_send_headers;
this->demux_plugin.send_chunk = demux_smjpeg_send_chunk;
this->demux_plugin.seek = demux_smjpeg_seek;
- this->demux_plugin.dispose = demux_smjpeg_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_smjpeg_get_status;
this->demux_plugin.get_stream_length = demux_smjpeg_get_stream_length;
this->demux_plugin.get_capabilities = demux_smjpeg_get_capabilities;
@@ -412,19 +410,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -443,39 +429,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "SMJPEG file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "SMJPEG";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mjpg";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_smjpeg_class_t *this = (demux_smjpeg_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_smjpeg_init_plugin (xine_t *xine, void *data) {
demux_smjpeg_class_t *this;
this = calloc(1, sizeof(demux_smjpeg_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;
+ this->demux_class.description = N_("SMJPEG file demux plugin");
+ this->demux_class.identifier = "SMJPEG";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "mjpg";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_snd.c b/src/demuxers/demux_snd.c
index 66e2bd543..1b6b7803a 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"
@@ -283,12 +283,6 @@ static int demux_snd_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
return this->status;
}
-static void demux_snd_dispose (demux_plugin_t *this_gen) {
- demux_snd_t *this = (demux_snd_t *) this_gen;
-
- free(this);
-}
-
static int demux_snd_get_status (demux_plugin_t *this_gen) {
demux_snd_t *this = (demux_snd_t *) this_gen;
@@ -323,7 +317,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_snd_send_headers;
this->demux_plugin.send_chunk = demux_snd_send_chunk;
this->demux_plugin.seek = demux_snd_seek;
- this->demux_plugin.dispose = demux_snd_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_snd_get_status;
this->demux_plugin.get_stream_length = demux_snd_get_stream_length;
this->demux_plugin.get_capabilities = demux_snd_get_capabilities;
@@ -334,19 +328,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -365,42 +347,20 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "SND/AU file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "SND/AU";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "snd au";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/basic: snd,au: ULAW (Sun) audio;"
- "audio/x-basic: snd,au: ULAW (Sun) audio;"
- "audio/x-pn-au: snd,au: ULAW (Sun) audio;";
-
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_snd_class_t *this = (demux_snd_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_snd_init_plugin (xine_t *xine, void *data) {
demux_snd_class_t *this;
this = calloc(1, sizeof(demux_snd_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;
+ this->demux_class.description = N_("SND/AU file demux plugin");
+ this->demux_class.identifier = "SND/AU";
+ this->demux_class.mimetypes =
+ "audio/basic: snd,au: ULAW (Sun) audio;"
+ "audio/x-basic: snd,au: ULAW (Sun) audio;"
+ "audio/x-pn-au: snd,au: ULAW (Sun) audio;";
+ this->demux_class.extensions = "snd au";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c
index d88432817..e4c439f2f 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"
@@ -515,11 +515,6 @@ static int demux_str_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
return this->status;
}
-static void demux_str_dispose (demux_plugin_t *this) {
-
- free(this);
-}
-
static int demux_str_get_status (demux_plugin_t *this_gen) {
demux_str_t *this = (demux_str_t *) this_gen;
@@ -559,7 +554,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_str_send_headers;
this->demux_plugin.send_chunk = demux_str_send_chunk;
this->demux_plugin.seek = demux_str_seek;
- this->demux_plugin.dispose = demux_str_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_str_get_status;
this->demux_plugin.get_stream_length = demux_str_get_stream_length;
this->demux_plugin.get_capabilities = demux_str_get_capabilities;
@@ -570,19 +565,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -600,39 +583,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Sony Playstation STR file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "PSX STR";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- /* also .mov, but we don't want to hijack that extension */
- return "str iki ik2 dps dat xa xa1 xa2 xas xap";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_str_class_t *this = (demux_str_class_t *) this_gen;
- free (this);
-}
-
void *demux_str_init_plugin (xine_t *xine, void *data) {
demux_str_class_t *this;
this = calloc(1, sizeof(demux_str_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;
+ this->demux_class.description = N_("Sony Playstation STR file demux plugin");
+ this->demux_class.identifier = "PSX STR";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "str iki ik2 dps dat xa xa1 xa2 xas xap";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 88ccf49f4..86563fbac 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -146,6 +146,13 @@
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
+#include <arpa/inet.h>
+
+#ifdef HAVE_FFMPEG_AVUTIL_H
+# include <crc.h>
+#else
+# include <libavutil/crc.h>
+#endif
#define LOG_MODULE "demux_ts"
#define LOG_VERBOSE
@@ -153,9 +160,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
@@ -319,6 +326,18 @@ typedef struct {
} demux_ts_audio_track;
typedef struct {
+
+ demux_class_t demux_class;
+
+ /* class-wide, global variables here */
+
+ xine_t *xine;
+ config_values_t *config;
+
+ const AVCRC *av_crc;
+} demux_ts_class_t;
+
+typedef struct {
/*
* The first field must be the "base class" for the plugin!
*/
@@ -334,12 +353,15 @@ typedef struct {
input_plugin_t *input;
unsigned int read_retries;
+ demux_ts_class_t *class;
+
int status;
int hdmv; /* -1 = unknown, 0 = mpeg-ts, 1 = hdmv/m2ts */
int pkt_size; /* TS packet size */
int pkt_offset; /* TS packet offset */
+ int blockSize;
int rate;
unsigned int media_num;
demux_ts_media media[MAX_PIDS];
@@ -352,7 +374,6 @@ typedef struct {
uint32_t pmt_pid[MAX_PMTS];
uint8_t *pmt[MAX_PMTS];
uint8_t *pmt_write_ptr[MAX_PMTS];
- uint32_t crc32_table[256];
uint32_t last_pmt_crc;
/*
* Stuff to do with the transport header. As well as the video
@@ -402,15 +423,6 @@ typedef struct {
} demux_ts_t;
-typedef struct {
-
- demux_class_t demux_class;
-
- /* class-wide, global variables here */
-
- xine_t *xine;
- config_values_t *config;
-} demux_ts_class_t;
static void reset_track_map(fifo_buffer_t *fifo)
{
@@ -611,28 +623,6 @@ static void demux_ts_tbre_update (demux_ts_t *this, unsigned int mode, int64_t n
this->tbre_lasttime = now;
}
-static void demux_ts_build_crc32_table(demux_ts_t*this) {
- uint32_t i, j, k;
-
- for( i = 0 ; i < 256 ; i++ ) {
- k = 0;
- for (j = (i << 24) | 0x800000 ; j != 0x80000000 ; j <<= 1) {
- k = (k << 1) ^ (((k ^ j) & 0x80000000) ? 0x04c11db7 : 0);
- }
- this->crc32_table[i] = k;
- }
-}
-
-static uint32_t demux_ts_compute_crc32(demux_ts_t*this, uint8_t *data,
- int32_t length, uint32_t crc32) {
- int32_t i;
-
- for(i = 0; i < length; i++) {
- crc32 = (crc32 << 8) ^ this->crc32_table[(crc32 >> 24) ^ data[i]];
- }
- return crc32;
-}
-
/* redefine abs as macro to handle 64-bit diffs.
i guess llabs may not be available everywhere */
#define abs(x) ( ((x)<0) ? -(x) : (x) )
@@ -899,8 +889,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
}
/* Check CRC. */
- calc_crc32 = demux_ts_compute_crc32 (this, pkt+5, section_length+3-4,
- 0xffffffff);
+ calc_crc32 = htonl(av_crc(this->class->av_crc, 0xffffffff, pkt+5, section_length+3-4));
if (crc32 != calc_crc32) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: demux error! PAT with invalid CRC32: packet_crc32: %.8x calc_crc32: %.8x\n",
@@ -1434,7 +1423,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;
int mi;
@@ -1555,9 +1544,9 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
crc32 |= (uint32_t) this->pmt[program_count][section_length+3-1] ;
/* Check CRC. */
- calc_crc32 = demux_ts_compute_crc32 (this,
- this->pmt[program_count],
- section_length+3-4, 0xffffffff);
+ calc_crc32 = htonl(av_crc(this->class->av_crc, 0xffffffff,
+ this->pmt[program_count], section_length+3-4));
+
if (crc32 != calc_crc32) {
xprintf (this->stream->xine, XINE_VERBOSITY_DEBUG,
"demux_ts: demux error! PMT with invalid CRC32: packet_crc32: %#.8x calc_crc32: %#.8x\n",
@@ -2421,8 +2410,6 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
this->send_newpts = 1;
- demux_ts_build_crc32_table (this);
-
this->status = DEMUX_OK ;
this->scrambled_npids = 0;
@@ -2613,39 +2600,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
}
break;
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
-
- if (_x_demux_check_extension (mrl, "m2ts mts"))
- hdmv = 1;
- else
- hdmv = 0;
-
- /* check extension */
- const char *const extensions = class_gen->get_extensions (class_gen);
-
- if (_x_demux_check_extension (mrl, extensions))
- break;
-
- /* accept dvb streams */
- /*
- * Also handle the special dvbs,dvbt and dvbc mrl formats:
- * the content is exactly the same but the input plugin
- * uses a different tuning algorithm [Pragma]
- */
-
- if (!strncasecmp (mrl, "dvb://", 6))
- break;
- if (!strncasecmp (mrl, "dvbs://", 7))
- break;
- if (!strncasecmp (mrl, "dvbc://", 7))
- break;
- if (!strncasecmp (mrl, "dvbt://", 7))
- break;
-
- return NULL;
- }
-
+ case METHOD_BY_MRL:
case METHOD_EXPLICIT:
break;
@@ -2660,6 +2615,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this = calloc(1, sizeof(*this));
this->stream = stream;
this->input = input;
+ this->class = (demux_ts_class_t*)class_gen;
this->demux_plugin.send_headers = demux_ts_send_headers;
this->demux_plugin.send_chunk = demux_ts_send_chunk;
@@ -2720,30 +2676,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
/*
* ts demuxer class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "MPEG Transport Stream demuxer";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "MPEG_TS";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "ts m2t trp m2ts mts";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "video/mp2t: m2t: MPEG2 transport stream;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
-
- demux_ts_class_t *this = (demux_ts_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_ts_class_t *this;
@@ -2753,11 +2685,18 @@ static void *init_class (xine_t *xine, void *data) {
this->xine = xine;
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;
+ this->demux_class.description = N_("MPEG Transport Stream demuxer");
+ this->demux_class.identifier = "MPEG_TS";
+ this->demux_class.mimetypes = "video/mp2t: m2t: MPEG2 transport stream;";
+
+ /* accept dvb streams; also handle the special dvbs,dvbt and dvbc
+ * mrl formats: the content is exactly the same but the input plugin
+ * uses a different tuning algorithm [Pragma]
+ */
+ this->demux_class.extensions = "ts m2t trp m2ts mts dvb:// dvbs:// dvbc:// dvbt://";
+ this->demux_class.dispose = default_demux_class_dispose;
+
+ this->av_crc = av_crc_get_table(AV_CRC_32_IEEE);
return this;
}
@@ -2772,7 +2711,7 @@ static const demuxer_info_t demux_info_ts = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class },
+ { PLUGIN_DEMUX, 27, "mpeg-ts", XINE_VERSION_CODE, &demux_info_ts, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index cf3745211..1a2f5ca27 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -34,12 +34,13 @@
// http://www.true-audio.com/TTA_Lossless_Audio_Codec_-_Format_Description
#define FRAME_TIME 1.04489795918367346939
-#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 <xine/attributes.h>
typedef struct {
demux_plugin_t demux_plugin;
@@ -75,16 +76,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 ( !_x_is_fourcc(peek, "TTA1") )
+ if ( !_x_is_fourcc(&peek, "TTA1") )
return 0;
if ( this->input->read(this->input, this->header.buffer, sizeof(this->header)) != sizeof(this->header) )
@@ -99,7 +98,7 @@ static int open_tta_file(demux_tta_t *this) {
return 0;
}
- this->seektable = calloc(this->totalframes, sizeof(uint32_t));
+ this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t));
this->input->read(this->input, (uint8_t*)this->seektable, sizeof(uint32_t)*this->totalframes);
/* Skip the CRC32 */
@@ -301,19 +300,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
if (!open_tta_file(this)) {
@@ -330,40 +317,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "True Audio demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "True Audio";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "tta";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-tta: tta: True Audio;"
- "audio/tta: tta: True Audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_tta_class_t *this = (demux_tta_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_tta_init_plugin (xine_t *xine, void *data) {
demux_tta_class_t *this;
this = calloc(1, sizeof(demux_tta_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;
+ this->demux_class.description = N_("True Audio demux plugin");
+ this->demux_class.identifier = "True Audio";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "tta";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_vc1es.c b/src/demuxers/demux_vc1es.c
new file mode 100644
index 000000000..8896ea906
--- /dev/null
+++ b/src/demuxers/demux_vc1es.c
@@ -0,0 +1,406 @@
+/*
+ * Copyright (C) 2008 the xine project
+ * Copyright (C) 2008 Christophe Thommeret <hftom@free.fr>
+ *
+ * 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
+ */
+
+/*
+ * demultiplexer for wmv9/vc1 elementary streams
+ *
+ *
+ * SMP (.rcv) format:
+ *
+ * ** header ***
+ * le24 number of frames
+ * C5 04 00 00 00
+ * 4 bytes sequence header
+ * le32 height
+ * le32 width
+ * 0C 00 00 00
+ * 8 bytes unknown
+ * le32 fps
+ * ************
+ * le24 frame_size
+ * 80
+ * le32 pts (ms)
+ * frame_size bytes of picture data
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+/* #define LOG */
+#define LOG_MODULE "demux_vc1es"
+#define LOG_VERBOSE
+
+#include <xine/xine_internal.h>
+#include <xine/xineutils.h>
+#include <xine/compat.h>
+#include <xine/demux.h>
+#include "bswap.h"
+
+#define SCRATCH_SIZE 36
+#define PRIVATE_SIZE 44
+
+#define MODE_SMP 1
+#define MODE_AP 2
+
+
+
+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 mode;
+ int first_chunk;
+ uint8_t private[PRIVATE_SIZE];
+ uint32_t video_step;
+
+ uint32_t blocksize;
+} demux_vc1_es_t ;
+
+
+
+typedef struct {
+ demux_class_t demux_class;
+} demux_vc1_es_class_t;
+
+
+
+static int demux_vc1_es_next_smp( demux_vc1_es_t *this )
+{
+ buf_element_t *buf;
+ uint32_t pts=0, frame_size=0;
+ off_t done;
+ uint8_t head[SCRATCH_SIZE];
+ int start_flag = 1;
+
+ if ( this->first_chunk ) {
+ this->input->read( this->input, head, SCRATCH_SIZE );
+ this->first_chunk = 0;
+ }
+
+ done = this->input->read( this->input, head, 8 );
+ frame_size = _X_LE_24( head );
+ pts = _X_LE_32( head+4 );
+
+ done = 0;
+ while ( frame_size>0 ) {
+ buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
+ off_t read = (frame_size>buf->max_size) ? buf->max_size : frame_size;
+ done = this->input->read( this->input, buf->mem, read );
+ if ( done<=0 ) {
+ buf->free_buffer( buf );
+ this->status = DEMUX_FINISHED;
+ return 0;
+ }
+ buf->size = done;
+ buf->content = buf->mem;
+ buf->type = BUF_VIDEO_WMV9;
+ buf->pts = pts*90;
+ frame_size -= done;
+ if ( start_flag ) {
+ buf->decoder_flags = BUF_FLAG_FRAME_START;
+ start_flag = 0;
+ }
+ if ( !(frame_size>0) )
+ buf->decoder_flags = BUF_FLAG_FRAME_END;
+ this->video_fifo->put(this->video_fifo, buf);
+ }
+
+ return 1;
+}
+
+
+
+static int demux_vc1_es_next_ap( demux_vc1_es_t *this )
+{
+ buf_element_t *buf;
+ uint32_t blocksize;
+ off_t done;
+
+ buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
+ blocksize = (this->blocksize ? this->blocksize : buf->max_size);
+ done = this->input->read(this->input, buf->mem, blocksize);
+
+ if (done <= 0) {
+ buf->free_buffer (buf);
+ this->status = DEMUX_FINISHED;
+ return 0;
+ }
+
+ buf->size = done;
+ buf->content = buf->mem;
+ buf->pts = 0;
+ buf->type = BUF_VIDEO_VC1;
+
+ if( this->input->get_length (this->input) )
+ buf->extra_info->input_normpos = (int)( (double)this->input->get_current_pos( this->input )*65535/this->input->get_length( this->input ) );
+
+ this->video_fifo->put(this->video_fifo, buf);
+
+ return 1;
+}
+
+
+
+static int demux_vc1_es_send_chunk( demux_plugin_t *this_gen )
+{
+ demux_vc1_es_t *this = (demux_vc1_es_t *) this_gen;
+
+ if ( this->mode==MODE_SMP ) {
+ if (!demux_vc1_es_next_smp(this))
+ this->status = DEMUX_FINISHED;
+ return this->status;
+ }
+
+ if (!demux_vc1_es_next_ap(this))
+ this->status = DEMUX_FINISHED;
+ return this->status;
+}
+
+
+
+static int demux_vc1_es_get_status( demux_plugin_t *this_gen )
+{
+ demux_vc1_es_t *this = (demux_vc1_es_t *) this_gen;
+
+ return this->status;
+}
+
+
+
+static void demux_vc1_es_send_headers( demux_plugin_t *this_gen )
+{
+ demux_vc1_es_t *this = (demux_vc1_es_t *) this_gen;
+
+ this->video_fifo = this->stream->video_fifo;
+ this->audio_fifo = this->stream->audio_fifo;
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_VIDEO, 1);
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO, 0);
+ _x_demux_control_start(this->stream);
+ this->blocksize = this->input->get_blocksize(this->input);
+ this->status = DEMUX_OK;
+
+ if ( this->mode==MODE_SMP ) {
+ buf_element_t *buf;
+ buf = this->video_fifo->buffer_pool_alloc(this->video_fifo);
+ xine_fast_memcpy( buf->mem, this->private, PRIVATE_SIZE );
+ buf->size = PRIVATE_SIZE;
+ buf->content = buf->mem;
+ buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
+ if ( this->video_step ) {
+ buf->decoder_flags |= BUF_FLAG_FRAMERATE;
+ buf->decoder_info[0] = 90000/this->video_step;
+ }
+ buf->type = BUF_VIDEO_WMV9;
+ this->video_fifo->put(this->video_fifo, buf);
+ }
+}
+
+
+
+static int demux_vc1_es_seek( demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing )
+{
+ demux_vc1_es_t *this = (demux_vc1_es_t *) this_gen;
+
+ if ( this->mode==MODE_SMP ) {
+ this->status = DEMUX_OK;
+ return this->status;
+ }
+
+ start_pos = (off_t) ( (double) start_pos / 65535 *
+ this->input->get_length (this->input) );
+
+ this->status = DEMUX_OK;
+
+ if (playing)
+ _x_demux_flush_engine(this->stream);
+
+ if (INPUT_IS_SEEKABLE(this->input)) {
+
+ /* FIXME: implement time seek */
+
+ if (start_pos != this->input->seek (this->input, start_pos, SEEK_SET)) {
+ this->status = DEMUX_FINISHED;
+ return this->status;
+ }
+ lprintf ("seeking to %"PRId64"\n", start_pos);
+ }
+
+ /*
+ * now start demuxing
+ */
+ this->status = DEMUX_OK;
+
+ return this->status;
+}
+
+
+
+static void demux_vc1_es_dispose( demux_plugin_t *this )
+{
+ free (this);
+}
+
+
+
+static int demux_vc1_es_get_stream_length( demux_plugin_t *this_gen )
+{
+ return 0 ; /*FIXME: implement */
+}
+
+
+
+static uint32_t demux_vc1_es_get_capabilities( demux_plugin_t *this_gen )
+{
+ return DEMUX_CAP_NOCAP;
+}
+
+
+
+static int demux_vc1_es_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_vc1_es_t *this;
+ uint8_t scratch[SCRATCH_SIZE];
+ int i, read, found=0;
+
+ switch (stream->content_detection_method) {
+
+ case METHOD_BY_CONTENT: {
+ read = _x_demux_read_header(input, scratch, SCRATCH_SIZE);
+ if (!read)
+ return NULL;
+ lprintf("read size =%d\n",read);
+
+ /* simple and main profiles */
+ if ( read>=SCRATCH_SIZE ) {
+ lprintf("searching for rcv format..\n");
+ if ( scratch[3]==0xc5 && scratch[4]==4 && scratch[5]==0 && scratch[6]==0 && scratch[7]==0 && scratch[20]==0x0c && scratch[21]==0 && scratch[22]==0 && scratch[23]==0 ) {
+ lprintf("rcv format found\n");
+ found = MODE_SMP;
+ }
+ }
+
+ if ( found==0 ) {
+ /* advanced profile */
+ for (i = 0; i < read-4; i++) {
+ lprintf ("%02x %02x %02x %02x\n", scratch[i], scratch[i+1], scratch[i+2], scratch[i+3]);
+ if ((scratch[i] == 0x00) && (scratch[i+1] == 0x00) && (scratch[i+2] == 0x01)) {
+ if (scratch[i+3] == 0x0f) {
+ found = MODE_AP;
+ lprintf ("found header at offset 0x%x\n", i);
+ break;
+ }
+ }
+ }
+ }
+
+ if (found == 0)
+ return NULL;
+ lprintf ("input accepted.\n");
+ }
+ break;
+
+ case METHOD_BY_MRL:
+ case METHOD_EXPLICIT:
+ break;
+
+ default:
+ return NULL;
+ }
+
+ this = calloc(1, sizeof(demux_vc1_es_t));
+ this->mode = found;
+ this->first_chunk = 1;
+ if ( found==MODE_SMP ) {
+ xine_fast_memcpy( this->private+8, scratch+12, 4 ); /* height */
+ xine_fast_memcpy( this->private+4, scratch+16, 4 ); /* width */
+ xine_fast_memcpy( this->private+40, scratch+8, 4 ); /* sequence header */
+ this->video_step = _X_LE_32( scratch+32 );
+ }
+ this->stream = stream;
+ this->input = input;
+
+ this->demux_plugin.send_headers = demux_vc1_es_send_headers;
+ this->demux_plugin.send_chunk = demux_vc1_es_send_chunk;
+ this->demux_plugin.seek = demux_vc1_es_seek;
+ this->demux_plugin.dispose = demux_vc1_es_dispose;
+ this->demux_plugin.get_status = demux_vc1_es_get_status;
+ this->demux_plugin.get_stream_length = demux_vc1_es_get_stream_length;
+ this->demux_plugin.get_capabilities = demux_vc1_es_get_capabilities;
+ this->demux_plugin.get_optional_data = demux_vc1_es_get_optional_data;
+ this->demux_plugin.demux_class = class_gen;
+
+ this->status = DEMUX_FINISHED;
+
+ return &this->demux_plugin;
+}
+
+
+
+static void *init_plugin( xine_t *xine, void *data )
+{
+ demux_vc1_es_class_t *this;
+
+ this = calloc(1, sizeof(demux_vc1_es_class_t));
+
+ this->demux_class.open_plugin = open_plugin;
+ this->demux_class.description = N_("VC1 elementary stream demux plugin");
+ this->demux_class.identifier = "VC1_ES";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "";
+ this->demux_class.dispose = default_demux_class_dispose;
+
+ return this;
+}
+
+
+/*
+ * exported plugin catalog entry
+ */
+static const demuxer_info_t demux_info_vc1es = {
+ 0 /* priority */
+};
+
+
+
+const plugin_info_t xine_plugin_info[] EXPORTED = {
+ /* type, API, "name", version, special_info, init_function */
+ { PLUGIN_DEMUX, 27, "vc1es", XINE_VERSION_CODE, &demux_info_vc1es, init_plugin },
+ { PLUGIN_NONE, 0, "", 0, NULL, NULL }
+};
diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c
index b3d7c95b8..1bd052c10 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"
@@ -389,12 +389,6 @@ static int demux_vmd_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_vmd_dispose (demux_plugin_t *this_gen) {
- demux_vmd_t *this = (demux_vmd_t *) this_gen;
-
- free(this);
-}
-
static int demux_vmd_get_status (demux_plugin_t *this_gen) {
demux_vmd_t *this = (demux_vmd_t *) this_gen;
@@ -428,7 +422,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_vmd_send_headers;
this->demux_plugin.send_chunk = demux_vmd_send_chunk;
this->demux_plugin.seek = demux_vmd_seek;
- this->demux_plugin.dispose = demux_vmd_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_vmd_get_status;
this->demux_plugin.get_stream_length = demux_vmd_get_stream_length;
this->demux_plugin.get_capabilities = demux_vmd_get_capabilities;
@@ -439,19 +433,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -470,39 +452,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Sierra VMD file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "VMD";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "vmd";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_vmd_class_t *this = (demux_vmd_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_vmd_init_plugin (xine_t *xine, void *data) {
demux_vmd_class_t *this;
this = calloc(1, sizeof(demux_vmd_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;
+ this->demux_class.description = N_("Sierra VMD file demux plugin");
+ this->demux_class.identifier = "VMD";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "vmd";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_voc.c b/src/demuxers/demux_voc.c
index 1ddbc1727..0e4b736be 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"
@@ -263,12 +263,6 @@ static int demux_voc_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
return this->status;
}
-static void demux_voc_dispose (demux_plugin_t *this_gen) {
- demux_voc_t *this = (demux_voc_t *) this_gen;
-
- free(this);
-}
-
static int demux_voc_get_status (demux_plugin_t *this_gen) {
demux_voc_t *this = (demux_voc_t *) this_gen;
@@ -303,7 +297,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_voc_send_headers;
this->demux_plugin.send_chunk = demux_voc_send_chunk;
this->demux_plugin.seek = demux_voc_seek;
- this->demux_plugin.dispose = demux_voc_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_voc_get_status;
this->demux_plugin.get_stream_length = demux_voc_get_stream_length;
this->demux_plugin.get_capabilities = demux_voc_get_capabilities;
@@ -314,19 +308,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -345,39 +327,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "VOC file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "VOC";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "voc";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_voc_class_t *this = (demux_voc_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_voc_init_plugin (xine_t *xine, void *data) {
demux_voc_class_t *this;
this = calloc(1, sizeof(demux_voc_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;
+ this->demux_class.description = N_("VOC file demux plugin");
+ this->demux_class.identifier = "VOC";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "voc";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_vox.c b/src/demuxers/demux_vox.c
index ccf9bf877..2d33952b4 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"
@@ -150,12 +150,6 @@ static int demux_vox_seek (demux_plugin_t *this_gen, off_t start_pos, int start_
return this->status;
}
-static void demux_vox_dispose (demux_plugin_t *this_gen) {
- demux_vox_t *this = (demux_vox_t *) this_gen;
-
- free(this);
-}
-
static int demux_vox_get_status (demux_plugin_t *this_gen) {
demux_vox_t *this = (demux_vox_t *) this_gen;
@@ -187,17 +181,11 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
case METHOD_BY_CONTENT:
- case METHOD_EXPLICIT:
- case METHOD_BY_EXTENSION: {
- const char *extensions, *mrl;
-
- mrl = input->get_mrl (input);
- extensions = class_gen->get_extensions (class_gen);
+ return NULL;
- if (!_x_demux_check_extension (mrl, extensions))
- return NULL;
- }
- break;
+ case METHOD_EXPLICIT:
+ case METHOD_BY_MRL:
+ break;
default:
return NULL;
@@ -210,7 +198,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_vox_send_headers;
this->demux_plugin.send_chunk = demux_vox_send_chunk;
this->demux_plugin.seek = demux_vox_seek;
- this->demux_plugin.dispose = demux_vox_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_vox_get_status;
this->demux_plugin.get_stream_length = demux_vox_get_stream_length;
this->demux_plugin.get_capabilities = demux_vox_get_capabilities;
@@ -222,39 +210,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Dialogic VOX file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "VOX";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "vox";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_vox_class_t *this = (demux_vox_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_vox_init_plugin (xine_t *xine, void *data) {
demux_vox_class_t *this;
this = calloc(1, sizeof(demux_vox_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;
+ this->demux_class.description = N_("Dialogic VOX file demux plugin");
+ this->demux_class.identifier = "VOX";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "vox";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c
index 7582eea0e..6980c6e1a 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"
@@ -303,12 +303,6 @@ static int demux_vqa_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_vqa_dispose (demux_plugin_t *this_gen) {
- demux_vqa_t *this = (demux_vqa_t *) this_gen;
-
- free(this);
-}
-
static int demux_vqa_get_status (demux_plugin_t *this_gen) {
demux_vqa_t *this = (demux_vqa_t *) this_gen;
@@ -340,7 +334,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_vqa_send_headers;
this->demux_plugin.send_chunk = demux_vqa_send_chunk;
this->demux_plugin.seek = demux_vqa_seek;
- this->demux_plugin.dispose = demux_vqa_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_vqa_get_status;
this->demux_plugin.get_stream_length = demux_vqa_get_stream_length;
this->demux_plugin.get_capabilities = demux_vqa_get_capabilities;
@@ -351,19 +345,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -382,39 +364,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Westwood Studios VQA file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "VQA";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "vqa";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_vqa_class_t *this = (demux_vqa_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_vqa_init_plugin (xine_t *xine, void *data) {
demux_vqa_class_t *this;
this = calloc(1, sizeof(demux_vqa_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;
+ this->demux_class.description = N_("Westwood Studios VQA file demux plugin");
+ this->demux_class.identifier = "VQA";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "vqa";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_wav.c b/src/demuxers/demux_wav.c
index 99c50ad67..39e96be26 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"
@@ -386,19 +386,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -426,42 +414,21 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "WAV file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "WAV";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "wav";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return "audio/x-wav: wav: WAV audio;"
- "audio/wav: wav: WAV audio;"
- "audio/x-pn-wav: wav: WAV audio;"
- "audio/x-pn-windows-acm: wav: WAV audio;";
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_wav_class_t *this = (demux_wav_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_wav_init_plugin (xine_t *xine, void *data) {
demux_wav_class_t *this;
this = calloc(1, sizeof(demux_wav_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;
+ this->demux_class.description = N_("WAV file demux plugin");
+ this->demux_class.identifier = "WAV";
+ this->demux_class.mimetypes =
+ "audio/x-wav: wav: WAV audio;"
+ "audio/wav: wav: WAV audio;"
+ "audio/x-pn-wav: wav: WAV audio;"
+ "audio/x-pn-windows-acm: wav: WAV audio;";
+ this->demux_class.extensions = "wav";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index 3b310e90c..db115fe07 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"
@@ -377,15 +377,15 @@ static int open_mve_file(demux_mve_t *this) {
this->number_of_shots = _X_LE_32(&preamble[0]);
/* allocate space for the shot offset index and set offsets to 0 */
- this->shot_offsets = calloc(this->number_of_shots, sizeof(off_t));
+ this->shot_offsets = xine_xcalloc(this->number_of_shots, sizeof(off_t));
this->current_shot = 0;
/* skip the SOND chunk */
this->input->seek(this->input, 12, SEEK_CUR);
/* load the palette chunks */
- this->palettes = calloc(this->number_of_shots, PALETTE_SIZE *
- sizeof(palette_entry_t));
+ this->palettes = xine_xcalloc(this->number_of_shots, PALETTE_SIZE *
+ sizeof(palette_entry_t));
if (!this->shot_offsets || !this->palettes) {
free (this->shot_offsets);
@@ -689,19 +689,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -720,39 +708,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "Wing Commander III Movie (MVE) demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "WC3 Movie";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "mve";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_mve_class_t *this = (demux_mve_class_t *) this_gen;
-
- free (this);
-}
-
void *demux_wc3movie_init_plugin (xine_t *xine, void *data) {
demux_mve_class_t *this;
this = calloc(1, sizeof(demux_mve_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;
+ this->demux_class.description = N_("Wing Commander III Movie (MVE) demux plugin");
+ this->demux_class.identifier = "WC3 Movie";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "mve";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
diff --git a/src/demuxers/demux_yuv4mpeg2.c b/src/demuxers/demux_yuv4mpeg2.c
index aa1a4dff6..e8877057c 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
@@ -355,12 +355,6 @@ static int demux_yuv4mpeg2_seek (demux_plugin_t *this_gen,
return this->status;
}
-static void demux_yuv4mpeg2_dispose (demux_plugin_t *this_gen) {
- demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
-
- free(this);
-}
-
static int demux_yuv4mpeg2_get_status (demux_plugin_t *this_gen) {
demux_yuv4mpeg2_t *this = (demux_yuv4mpeg2_t *) this_gen;
@@ -392,7 +386,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
this->demux_plugin.send_headers = demux_yuv4mpeg2_send_headers;
this->demux_plugin.send_chunk = demux_yuv4mpeg2_send_chunk;
this->demux_plugin.seek = demux_yuv4mpeg2_seek;
- this->demux_plugin.dispose = demux_yuv4mpeg2_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_yuv4mpeg2_get_status;
this->demux_plugin.get_stream_length = demux_yuv4mpeg2_get_stream_length;
this->demux_plugin.get_capabilities = demux_yuv4mpeg2_get_capabilities;
@@ -403,17 +397,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
switch (stream->content_detection_method) {
- case METHOD_BY_EXTENSION: {
- const char *const mrl = input->get_mrl (input);
- const char *const 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_MRL:
case METHOD_BY_CONTENT:
case METHOD_EXPLICIT:
@@ -432,39 +416,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return &this->demux_plugin;
}
-static const char *get_description (demux_class_t *this_gen) {
- return "YUV4MPEG2 file demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "YUV4MPEG2";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return "y4m";
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_yuv4mpeg2_class_t *this = (demux_yuv4mpeg2_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_plugin (xine_t *xine, void *data) {
demux_yuv4mpeg2_class_t *this;
this = calloc(1, sizeof(demux_yuv4mpeg2_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;
+ this->demux_class.description = N_("YUV4MPEG2 file demux plugin");
+ this->demux_class.identifier = "YUV4MPEG2";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = "y4m";
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -478,6 +440,6 @@ static const demuxer_info_t demux_info_yuv4mpeg2 = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "yuv4mpeg2", XINE_VERSION_CODE, &demux_info_yuv4mpeg2, init_plugin },
+ { PLUGIN_DEMUX, 27, "yuv4mpeg2", XINE_VERSION_CODE, &demux_info_yuv4mpeg2, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/demux_yuv_frames.c b/src/demuxers/demux_yuv_frames.c
index 81dd2b03a..e8e893874 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
@@ -167,12 +167,6 @@ static int demux_yuv_frames_get_optional_data(demux_plugin_t *this_gen,
return DEMUX_OPTIONAL_UNSUPPORTED;
}
-static void demux_yuv_frames_dispose (demux_plugin_t *this_gen) {
- demux_yuv_frames_t *this = (demux_yuv_frames_t *) this_gen;
-
- free (this);
-}
-
static demux_plugin_t *open_plugin (demux_class_t *class_gen,
xine_stream_t *stream,
input_plugin_t *input) {
@@ -185,7 +179,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
return NULL;
break;
- case METHOD_BY_EXTENSION: {
+ case METHOD_BY_MRL: {
const char *const mrl = input->get_mrl (input);
if (strncmp (mrl, "v4l:/", 5))
@@ -213,7 +207,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this->demux_plugin.send_headers = demux_yuv_frames_send_headers;
this->demux_plugin.send_chunk = demux_yuv_frames_send_chunk;
this->demux_plugin.seek = demux_yuv_frames_seek;
- this->demux_plugin.dispose = demux_yuv_frames_dispose;
+ this->demux_plugin.dispose = default_demux_plugin_dispose;
this->demux_plugin.get_status = demux_yuv_frames_get_status;
this->demux_plugin.get_stream_length = demux_yuv_frames_get_stream_length;
this->demux_plugin.get_capabilities = demux_yuv_frames_get_capabilities;
@@ -230,40 +224,17 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
/*
* demuxer class
*/
-
-static const char *get_description (demux_class_t *this_gen) {
- return "YUV frames dummy demux plugin";
-}
-
-static const char *get_identifier (demux_class_t *this_gen) {
- return "YUV_FRAMES";
-}
-
-static const char *get_extensions (demux_class_t *this_gen) {
- return NULL;
-}
-
-static const char *get_mimetypes (demux_class_t *this_gen) {
- return NULL;
-}
-
-static void class_dispose (demux_class_t *this_gen) {
- demux_yuv_frames_class_t *this = (demux_yuv_frames_class_t *) this_gen;
-
- free (this);
-}
-
static void *init_class (xine_t *xine, void *data) {
demux_yuv_frames_class_t *this;
this = calloc(1, sizeof(demux_yuv_frames_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;
+ this->demux_class.description = N_("YUV frames dummy demux plugin");
+ this->demux_class.identifier = "YUV_FRAMES";
+ this->demux_class.mimetypes = NULL;
+ this->demux_class.extensions = NULL;
+ this->demux_class.dispose = default_demux_class_dispose;
return this;
}
@@ -277,7 +248,7 @@ static const demuxer_info_t demux_info_yuv_frames = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "yuv_frames", XINE_VERSION_CODE, &demux_info_yuv_frames, init_class },
+ { PLUGIN_DEMUX, 27, "yuv_frames", XINE_VERSION_CODE, &demux_info_yuv_frames, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/ebml.c b/src/demuxers/ebml.c
index ce53e6c8a..c979d290d 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;
}
@@ -185,7 +175,7 @@ static int ebml_read_elem_len(ebml_parser_t *ebml, uint64_t *len) {
}
-static int ebml_read_elem_data(ebml_parser_t *ebml, int8_t *buf, int64_t len) {
+static int ebml_read_elem_data(ebml_parser_t *ebml, void *buf, int64_t len) {
if (ebml->input->read(ebml->input, buf, len) != len) {
off_t pos = ebml->input->get_current_pos(ebml->input);
@@ -243,6 +233,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;
@@ -269,6 +260,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) {
@@ -313,9 +305,11 @@ 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);
}
+#endif
char *ebml_alloc_read_ascii (ebml_parser_t *ebml, ebml_elem_t *elem)
{
@@ -333,41 +327,40 @@ char *ebml_alloc_read_ascii (ebml_parser_t *ebml, ebml_elem_t *elem)
return NULL;
}
+#if 0
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, uint8_t *binary) {
- if (!ebml_read_elem_data(ebml, binary, elem->len))
- return 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;
}
+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 6d750a98c..65db6c229 100644
--- a/src/demuxers/ebml.h
+++ b/src/demuxers/ebml.h
@@ -83,20 +83,26 @@ 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);
+#endif
char *ebml_alloc_read_ascii(ebml_parser_t *ebml, ebml_elem_t *elem);
+#if 0
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);
-int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, uint8_t *binary);
+int ebml_read_binary(ebml_parser_t *ebml, ebml_elem_t *elem, void *binary);
#endif /* EBML_H */
diff --git a/src/demuxers/group_audio.c b/src/demuxers/group_audio.c
index f405d0292..fe03b6418 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 = {
@@ -69,12 +69,6 @@ static const demuxer_info_t demux_info_mpc = {
1 /* priority */
};
-#ifdef HAVE_NOSEFART
-static const demuxer_info_t demux_info_nsf = {
- 10 /* priority */
-};
-#endif
-
static const demuxer_info_t demux_info_realaudio = {
10 /* priority */
};
@@ -103,35 +97,23 @@ 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 },
- { PLUGIN_DEMUX, 26, "ac3", XINE_VERSION_CODE, &demux_info_ac3, demux_ac3_init_plugin },
- { PLUGIN_DEMUX, 26, "aud", XINE_VERSION_CODE, &demux_info_aud, demux_aud_init_plugin },
- { PLUGIN_DEMUX, 26, "aiff", XINE_VERSION_CODE, &demux_info_aiff, demux_aiff_init_plugin },
- { PLUGIN_DEMUX, 26, "cdda", XINE_VERSION_CODE, &demux_info_cdda, demux_cdda_init_plugin },
- { PLUGIN_DEMUX, 26, "dts", XINE_VERSION_CODE, &demux_info_dts, demux_dts_init_plugin },
- { 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 },
-#ifdef HAVE_NOSEFART
- { PLUGIN_DEMUX, 26, "nsf", XINE_VERSION_CODE, &demux_info_nsf, demux_nsf_init_plugin },
-#endif
- { 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 },
- { PLUGIN_DEMUX, 26, "tta", XINE_VERSION_CODE, &demux_info_tta, demux_tta_init_plugin },
- { 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_DEMUX, 27, "aac", XINE_VERSION_CODE, &demux_info_aac, demux_aac_init_plugin },
+ { PLUGIN_DEMUX, 27, "ac3", XINE_VERSION_CODE, &demux_info_ac3, demux_ac3_init_plugin },
+ { PLUGIN_DEMUX, 27, "aud", XINE_VERSION_CODE, &demux_info_aud, demux_aud_init_plugin },
+ { PLUGIN_DEMUX, 27, "aiff", XINE_VERSION_CODE, &demux_info_aiff, demux_aiff_init_plugin },
+ { PLUGIN_DEMUX, 27, "cdda", XINE_VERSION_CODE, &demux_info_cdda, demux_cdda_init_plugin },
+ { PLUGIN_DEMUX, 27, "dts", XINE_VERSION_CODE, &demux_info_dts, demux_dts_init_plugin },
+ { PLUGIN_DEMUX, 27, "flac", XINE_VERSION_CODE, &demux_info_flac, demux_flac_init_plugin },
+ { PLUGIN_DEMUX, 27, "mp3", XINE_VERSION_CODE, &demux_info_mpgaudio, demux_mpgaudio_init_class },
+ { PLUGIN_DEMUX, 27, "mpc", XINE_VERSION_CODE, &demux_info_mpc, demux_mpc_init_plugin },
+ { PLUGIN_DEMUX, 27, "realaudio", XINE_VERSION_CODE, &demux_info_realaudio, demux_realaudio_init_plugin },
+ { PLUGIN_DEMUX, 27, "shn", XINE_VERSION_CODE, &demux_info_shn, demux_shn_init_plugin },
+ { PLUGIN_DEMUX, 27, "snd", XINE_VERSION_CODE, &demux_info_snd, demux_snd_init_plugin },
+ { PLUGIN_DEMUX, 27, "tta", XINE_VERSION_CODE, &demux_info_tta, demux_tta_init_plugin },
+ { PLUGIN_DEMUX, 27, "voc", XINE_VERSION_CODE, &demux_info_voc, demux_voc_init_plugin },
+ { PLUGIN_DEMUX, 27, "vox", XINE_VERSION_CODE, &demux_info_vox, demux_vox_init_plugin },
+ { PLUGIN_DEMUX, 27, "wav", XINE_VERSION_CODE, &demux_info_wav, demux_wav_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/group_audio.h b/src/demuxers/group_audio.h
index d2cd91875..6b48a5400 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);
@@ -40,12 +40,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_NOSEFART
-void *demux_nsf_init_plugin (xine_t *xine, void *data);
-#endif
-
-#ifdef HAVE_MODPLUG
-void *demux_mod_init_plugin (xine_t *xine, void *data);
-#endif
-
#endif
diff --git a/src/demuxers/group_games.c b/src/demuxers/group_games.c
index f08e8477d..5eacbfd8f 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"
@@ -79,16 +79,16 @@ static const demuxer_info_t demux_info_vmd = {
const plugin_info_t xine_plugin_info[] EXPORTED = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_DEMUX, 26, "wve", XINE_VERSION_CODE, &demux_info_eawve, demux_eawve_init_plugin},
- { PLUGIN_DEMUX, 26, "idcin", XINE_VERSION_CODE, &demux_info_idcin, demux_idcin_init_plugin },
- { PLUGIN_DEMUX, 26, "ipmovie", XINE_VERSION_CODE, &demux_info_ipmovie, demux_ipmovie_init_plugin },
- { PLUGIN_DEMUX, 26, "vqa", XINE_VERSION_CODE, &demux_info_vqa, demux_vqa_init_plugin },
- { PLUGIN_DEMUX, 26, "wc3movie", XINE_VERSION_CODE, &demux_info_wc3movie, demux_wc3movie_init_plugin },
- { PLUGIN_DEMUX, 26, "roq", XINE_VERSION_CODE, &demux_info_roq, demux_roq_init_plugin },
- { PLUGIN_DEMUX, 26, "str", XINE_VERSION_CODE, &demux_info_str, demux_str_init_plugin },
- { PLUGIN_DEMUX, 26, "film", XINE_VERSION_CODE, &demux_info_film, demux_film_init_plugin },
- { PLUGIN_DEMUX, 26, "smjpeg", XINE_VERSION_CODE, &demux_info_smjpeg, demux_smjpeg_init_plugin },
- { PLUGIN_DEMUX, 26, "fourxm", XINE_VERSION_CODE, &demux_info_fourxm, demux_fourxm_init_plugin },
- { PLUGIN_DEMUX, 26, "vmd", XINE_VERSION_CODE, &demux_info_vmd, demux_vmd_init_plugin },
+ { PLUGIN_DEMUX, 27, "wve", XINE_VERSION_CODE, &demux_info_eawve, demux_eawve_init_plugin},
+ { PLUGIN_DEMUX, 27, "idcin", XINE_VERSION_CODE, &demux_info_idcin, demux_idcin_init_plugin },
+ { PLUGIN_DEMUX, 27, "ipmovie", XINE_VERSION_CODE, &demux_info_ipmovie, demux_ipmovie_init_plugin },
+ { PLUGIN_DEMUX, 27, "vqa", XINE_VERSION_CODE, &demux_info_vqa, demux_vqa_init_plugin },
+ { PLUGIN_DEMUX, 27, "wc3movie", XINE_VERSION_CODE, &demux_info_wc3movie, demux_wc3movie_init_plugin },
+ { PLUGIN_DEMUX, 27, "roq", XINE_VERSION_CODE, &demux_info_roq, demux_roq_init_plugin },
+ { PLUGIN_DEMUX, 27, "str", XINE_VERSION_CODE, &demux_info_str, demux_str_init_plugin },
+ { PLUGIN_DEMUX, 27, "film", XINE_VERSION_CODE, &demux_info_film, demux_film_init_plugin },
+ { PLUGIN_DEMUX, 27, "smjpeg", XINE_VERSION_CODE, &demux_info_smjpeg, demux_smjpeg_init_plugin },
+ { PLUGIN_DEMUX, 27, "fourxm", XINE_VERSION_CODE, &demux_info_fourxm, demux_fourxm_init_plugin },
+ { PLUGIN_DEMUX, 27, "vmd", XINE_VERSION_CODE, &demux_info_vmd, demux_vmd_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/demuxers/group_games.h b/src/demuxers/group_games.h
index ea6b00e75..34cb6e208 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 f11e80e8d..2b433f515 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"
@@ -229,17 +229,17 @@ static int id3v2_parse_genre(char* dest, char *src, int len) {
return 1;
}
-static int id3v2_parse_header(input_plugin_t *input, uint8_t *mp3_frame_header,
+static int id3v2_parse_header(input_plugin_t *input, uint32_t id3_signature,
id3v2_header_t *tag_header) {
uint8_t buf[6];
- tag_header->id = _X_BE_32(mp3_frame_header);
+ tag_header->id = be2me_32(id3_signature);
if (input->read (input, buf, 6) == 6) {
tag_header->revision = buf[0];
tag_header->flags = buf[1];
tag_header->size = _X_BE_32_synchsafe(&buf[2]);
- lprintf("tag: ID3 v2.%d.%d\n", mp3_frame_header[3], tag_header->revision);
+ lprintf("tag: ID3 v2.%d.%d\n", tag_header->id & 0xFF, tag_header->revision);
lprintf("flags: %d\n", tag_header->flags);
lprintf("size: %zu\n", tag_header->size);
return 1;
@@ -273,17 +273,11 @@ 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;
- int enc;
const size_t bufsize = frame_header->size + 2;
if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */
return 0;
-
- buf = malloc(bufsize);
- if (buf == NULL) {
- lprintf("malloc error");
- return 0;
- }
+ char buf[bufsize];
+ int enc;
if (input->read (input, buf, frame_header->size) == frame_header->size) {
buf[frame_header->size] = 0;
@@ -293,7 +287,7 @@ static int id3v22_interp_frame(input_plugin_t *input,
enc = 0;
switch (frame_header->id) {
- case ( FOURCC_TAG(0, 'T', 'C', 'O') ):
+ case ( BE_FOURCC(0, 'T', 'C', 'O') ):
{
char tmp[1024];
@@ -303,27 +297,27 @@ static int id3v22_interp_frame(input_plugin_t *input,
}
break;
- case ( FOURCC_TAG(0, 'T', 'T', '2') ):
+ case ( BE_FOURCC(0, 'T', 'T', '2') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG(0, 'T', 'P', '1') ):
+ case ( BE_FOURCC(0, 'T', 'P', '1') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG(0, 'T', 'A', 'L') ):
+ case ( BE_FOURCC(0, 'T', 'A', 'L') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG(0, 'T', 'Y', 'E') ):
+ case ( BE_FOURCC(0, 'T', 'Y', 'E') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG(0, 'C', 'O', 'M') ):
+ case ( BE_FOURCC(0, 'C', 'O', 'M') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]);
break;
- case ( FOURCC_TAG(0, 'T', 'R', 'K') ):
+ case ( BE_FOURCC(0, 'T', 'R', 'K') ):
_x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1);
break;
@@ -331,24 +325,22 @@ 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;
}
}
static int id3v22_parse_tag(input_plugin_t *input,
- xine_stream_t *stream,
- int8_t *mp3_frame_header) {
+ xine_stream_t *stream,
+ uint32_t id3_signature) {
id3v2_header_t tag_header;
id3v22_frame_header_t tag_frame_header;
int pos = 0;
- if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) {
+ if (id3v2_parse_header(input, id3_signature, &tag_header)) {
if (tag_header.flags & ID3V22_ZERO_FLAG) {
/* invalid flags */
@@ -471,17 +463,11 @@ 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;
- int enc;
const size_t bufsize = frame_header->size + 2;
if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */
return 0;
-
- buf = malloc(bufsize);
- if (buf == NULL) {
- lprintf("malloc error");
- return 0;
- }
+ char buf[bufsize];
+ int enc;
if (input->read (input, buf, frame_header->size) == frame_header->size) {
buf[frame_header->size] = 0;
@@ -491,7 +477,7 @@ static int id3v23_interp_frame(input_plugin_t *input,
enc = 0;
switch (frame_header->id) {
- case ( FOURCC_TAG('T', 'C', 'O', 'N') ):
+ case ( BE_FOURCC('T', 'C', 'O', 'N') ):
{
char tmp[1024];
@@ -501,31 +487,31 @@ static int id3v23_interp_frame(input_plugin_t *input,
}
break;
- case ( FOURCC_TAG('T', 'I', 'T', '2') ):
+ case ( BE_FOURCC('T', 'I', 'T', '2') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'P', 'E', '1') ):
+ case ( BE_FOURCC('T', 'P', 'E', '1') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'A', 'L', 'B') ):
+ case ( BE_FOURCC('T', 'A', 'L', 'B') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'Y', 'E', 'R') ):
+ case ( BE_FOURCC('T', 'Y', 'E', 'R') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('C', 'O', 'M', 'M') ):
+ case ( BE_FOURCC('C', 'O', 'M', 'M') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'R', 'C', 'K') ):
+ case ( BE_FOURCC('T', 'R', 'C', 'K') ):
_x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1);
break;
- case FOURCC_TAG('T', 'P', 'O', 'S'):
+ case BE_FOURCC('T', 'P', 'O', 'S'):
_x_meta_info_set(stream, XINE_META_INFO_DISCNUMBER, buf + 1);
break;
@@ -533,24 +519,22 @@ 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;
}
}
static int id3v23_parse_tag(input_plugin_t *input,
- xine_stream_t *stream,
- int8_t *mp3_frame_header) {
+ xine_stream_t *stream,
+ uint32_t id3_signature) {
id3v2_header_t tag_header;
id3v23_frame_header_t tag_frame_header;
id3v23_frame_ext_header_t tag_frame_ext_header;
int pos = 0;
- if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) {
+ if (id3v2_parse_header(input, id3_signature, &tag_header)) {
if (tag_header.flags & ID3V23_ZERO_FLAG) {
/* invalid flags */
@@ -730,17 +714,11 @@ 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;
- int enc;
const size_t bufsize = frame_header->size + 2;
if ( bufsize < 3 ) /* frames has to be _at least_ 1 byte */
return 0;
-
- buf = malloc(bufsize);
- if (buf == NULL) {
- lprintf("malloc error");
- return 0;
- }
+ char buf[bufsize];
+ int enc;
if (input->read (input, buf, frame_header->size) == frame_header->size) {
buf[frame_header->size] = 0;
@@ -752,7 +730,7 @@ static int id3v24_interp_frame(input_plugin_t *input,
lprintf("data: %s\n", buf+1);
switch (frame_header->id) {
- case ( FOURCC_TAG('T', 'C', 'O', 'N') ):
+ case ( BE_FOURCC('T', 'C', 'O', 'N') ):
{
char tmp[1024];
@@ -762,32 +740,32 @@ static int id3v24_interp_frame(input_plugin_t *input,
}
break;
- case ( FOURCC_TAG('T', 'I', 'T', '2') ):
+ case ( BE_FOURCC('T', 'I', 'T', '2') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_TITLE, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'P', 'E', '1') ):
+ case ( BE_FOURCC('T', 'P', 'E', '1') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ARTIST, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'A', 'L', 'B') ):
+ case ( BE_FOURCC('T', 'A', 'L', 'B') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_ALBUM, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'Y', 'E', 'R') ):
- case ( FOURCC_TAG('T', 'D', 'R', 'C') ):
+ case ( BE_FOURCC('T', 'Y', 'E', 'R') ):
+ case ( BE_FOURCC('T', 'D', 'R', 'C') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_YEAR, buf + 1, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('C', 'O', 'M', 'M') ):
+ case ( BE_FOURCC('C', 'O', 'M', 'M') ):
_x_meta_info_set_generic(stream, XINE_META_INFO_COMMENT, buf + 1 + 3, id3_encoding[enc]);
break;
- case ( FOURCC_TAG('T', 'R', 'C', 'K') ):
+ case ( BE_FOURCC('T', 'R', 'C', 'K') ):
_x_meta_info_set(stream, XINE_META_INFO_TRACK_NUMBER, buf + 1);
break;
- case FOURCC_TAG('T', 'P', 'O', 'S'):
+ case BE_FOURCC('T', 'P', 'O', 'S'):
_x_meta_info_set(stream, XINE_META_INFO_DISCNUMBER, buf + 1);
break;
@@ -795,24 +773,22 @@ 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;
}
}
static int id3v24_parse_tag(input_plugin_t *input,
- xine_stream_t *stream,
- int8_t *mp3_frame_header) {
+ xine_stream_t *stream,
+ uint32_t id3_signature) {
id3v2_header_t tag_header;
id3v24_frame_header_t tag_frame_header;
id3v24_frame_ext_header_t tag_frame_ext_header;
int pos = 0;
- if (id3v2_parse_header(input, mp3_frame_header, &tag_header)) {
+ if (id3v2_parse_header(input, id3_signature, &tag_header)) {
if (tag_header.flags & ID3V24_ZERO_FLAG) {
/* invalid flags */
@@ -875,30 +851,25 @@ static int id3v24_parse_tag(input_plugin_t *input,
int id3v2_parse_tag(input_plugin_t *input,
xine_stream_t *stream,
- int8_t *mp3_frame_header) {
- _x_assert(mp3_frame_header[0] == 'I' && mp3_frame_header[1] == 'D' && mp3_frame_header[2] == '3');
-
- int result = 0;
+ uint32_t id3_signature) {
+ _x_assert((id3_signature & ID3V2X_MASK) == ID3V2X_TAG);
- switch(mp3_frame_header[3]) {
- case 2:
+ switch(id3_signature) {
+ case ID3V22_TAG:
xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.2 tag\n");
- result = id3v22_parse_tag(input, stream, mp3_frame_header);
- break;
+ return id3v22_parse_tag(input, stream, id3_signature);
- case 3:
+ case ID3V23_TAG:
xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.3 tag\n");
- result = id3v23_parse_tag(input, stream, mp3_frame_header);
- break;
+ return id3v23_parse_tag(input, stream, id3_signature);
- case 4:
+ case ID3V24_TAG:
xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": ID3V2.4 tag\n");
- result = id3v24_parse_tag(input, stream, mp3_frame_header);
- break;
+ return id3v24_parse_tag(input, stream, id3_signature);
default:
- xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": Unknown ID3v2 version: 0x%02x.\n", mp3_frame_header[3]);
+ xprintf(stream->xine, XINE_VERBOSITY_LOG, LOG_MODULE ": Unknown ID3v2 signature: 0x%08x.\n", be2me_32(id3_signature));
}
- return result;
+ return 0;
}
diff --git a/src/demuxers/id3.h b/src/demuxers/id3.h
index 41babe2b4..d69642f4a 100644
--- a/src/demuxers/id3.h
+++ b/src/demuxers/id3.h
@@ -25,17 +25,18 @@
#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 */
-#define FOURCC_TAG BE_FOURCC
-#define ID3V22_TAG FOURCC_TAG('I', 'D', '3', 2) /* id3 v2.2 header tag */
-#define ID3V23_TAG FOURCC_TAG('I', 'D', '3', 3) /* id3 v2.3 header tag */
-#define ID3V24_TAG FOURCC_TAG('I', 'D', '3', 4) /* id3 v2.4 header tag */
-#define ID3V24_FOOTER_TAG FOURCC_TAG('3', 'D', 'I', 0) /* id3 v2.4 footer tag */
+#define ID3V22_TAG ME_FOURCC('I', 'D', '3', 2) /* id3 v2.2 header tag */
+#define ID3V23_TAG ME_FOURCC('I', 'D', '3', 3) /* id3 v2.3 header tag */
+#define ID3V24_TAG ME_FOURCC('I', 'D', '3', 4) /* id3 v2.4 header tag */
+#define ID3V24_FOOTER_TAG ME_FOURCC('3', 'D', 'I', 0) /* id3 v2.4 footer tag */
+#define ID3V2X_TAG ME_FOURCC('I', 'D', '3', 0) /* id3 v2.x header tag */
+#define ID3V2X_MASK ~ME_FOURCC( 0 , 0 , 0 , 0xFF) /* id3 v2.x header mask */
/*
* ID3 v2.2
@@ -163,17 +164,14 @@ int id3v1_parse_tag (input_plugin_t *input, xine_stream_t *stream);
*/
int id3v2_parse_tag(input_plugin_t *input,
xine_stream_t *stream,
- int8_t *mp3_frame_header);
+ uint32_t id3_signature);
/**
* @brief Checks if the given buffer is an ID3 tag preamble
* @param ptr Pointer to the first 10 bytes of the ID3 tag
*/
-static inline int id3v2_istag(uint8_t *ptr) {
- return
- (ptr[0] == 'I') &&
- (ptr[1] == 'D') &&
- (ptr[2] == '3');
+static inline int id3v2_istag(uint32_t id3_signature) {
+ return (id3_signature & ID3V2X_MASK) == ID3V2X_TAG;
}
#if 0
diff --git a/src/demuxers/iff.h b/src/demuxers/iff.h
index 8ac24a697..921963c08 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 7af9ef121..41b27fa3f 100644
--- a/src/demuxers/matroska.h
+++ b/src/demuxers/matroska.h
@@ -22,9 +22,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"