summaryrefslogtreecommitdiff
path: root/src/combined
diff options
context:
space:
mode:
Diffstat (limited to 'src/combined')
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c10
-rw-r--r--src/combined/ffmpeg/ffmpeg_decoder.h6
-rw-r--r--src/combined/flac_demuxer.c3
-rw-r--r--src/combined/wavpack_demuxer.c2
-rw-r--r--src/combined/xine_ogg_demuxer.c29
-rw-r--r--src/combined/xine_vorbis_decoder.c250
6 files changed, 179 insertions, 121 deletions
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index 8f6864ea1..7cb584593 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -44,7 +44,11 @@
#include "ffmpeg_decoder.h"
#include "ff_mpeg_parser.h"
-#include <postprocess.h>
+#ifdef HAVE_FFMPEG_AVCODEC_H
+# include <postprocess.h>
+#else
+# include <libpostproc/postprocess.h>
+#endif
#define VIDEOBUFSIZE (128*1024)
#define SLICE_BUFFER_SIZE (1194*1024)
@@ -310,6 +314,7 @@ static const ff_codec_t ff_video_lookup[] = {
{BUF_VIDEO_KMVC, CODEC_ID_KMVC, "Karl Morton's Video Codec (ffmpeg)"},
{BUF_VIDEO_FLASHSV, CODEC_ID_FLASHSV, "Flash Screen Video (ffmpeg)"},
{BUF_VIDEO_CAVS, CODEC_ID_CAVS, "Chinese AVS (ffmpeg)"},
+ {BUF_VIDEO_VMNC, CODEC_ID_VMNC, "VMware Screen Codec (ffmpeg)"},
{BUF_VIDEO_THEORA_RAW, CODEC_ID_THEORA, "Theora (ffmpeg)"},
};
@@ -1692,6 +1697,9 @@ static const uint32_t supported_video_types[] = {
BUF_VIDEO_KMVC,
BUF_VIDEO_FLASHSV,
BUF_VIDEO_CAVS,
+#endif
+#if defined(HAVE_FFMPEG) || CONFIG_VMNC_DECODER
+ BUF_VIDEO_VMNC,
BUF_VIDEO_THEORA_RAW,
0
};
diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h
index bfe71a6b1..adf0908dd 100644
--- a/src/combined/ffmpeg/ffmpeg_decoder.h
+++ b/src/combined/ffmpeg/ffmpeg_decoder.h
@@ -25,7 +25,11 @@
#include "config.h"
#endif
-#include <avcodec.h>
+#ifdef HAVE_FFMPEG_AVCODEC_H
+# include <avcodec.h>
+#else
+# include <libavcodec/avcodec.h>
+#endif
typedef struct ff_codec_s {
uint32_t type;
diff --git a/src/combined/flac_demuxer.c b/src/combined/flac_demuxer.c
index bab42876c..22ee2319b 100644
--- a/src/combined/flac_demuxer.c
+++ b/src/combined/flac_demuxer.c
@@ -713,7 +713,8 @@ demux_flac_init_class (xine_t *xine, void *data) {
this->demux_class.open_plugin = open_plugin;
this->demux_class.description = N_("FLAC demux plugin");
this->demux_class.identifier = "FLAC";
- this->demux_class.mimetypes = "application/x-flac: flac: FLAC Audio;";
+ this->demux_class.mimetypes = "application/x-flac: flac: FLAC Audio;"
+ "application/flac: flac: FLAC Audio;";
this->demux_class.extensions = "flac";
this->demux_class.dispose = default_demux_class_dispose;
diff --git a/src/combined/wavpack_demuxer.c b/src/combined/wavpack_demuxer.c
index 9c0831cfa..403d136d1 100644
--- a/src/combined/wavpack_demuxer.c
+++ b/src/combined/wavpack_demuxer.c
@@ -368,7 +368,7 @@ void *demux_wv_init_plugin (xine_t *const xine, void *const data) {
this->demux_class.open_plugin = open_plugin;
this->demux_class.description = N_("Wavpack demux plugin");
this->demux_class.identifier = "Wavpack";
- this->demux_class.mimetypes = NULL;
+ this->demux_class.mimetypes = "audio/x-wavpack";
this->demux_class.extensions = "wv";
this->demux_class.dispose = default_demux_class_dispose;
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c
index d6b5ea214..88fcea08a 100644
--- a/src/combined/xine_ogg_demuxer.c
+++ b/src/combined/xine_ogg_demuxer.c
@@ -892,7 +892,10 @@ static void decode_video_header (demux_ogg_t *this, const int stream_num, ogg_pa
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;
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, locsubtype);
+ }
this->si[stream_num]->buf_types |= channel;
this->si[stream_num]->headers = 0; /* header is sent below */
@@ -977,9 +980,8 @@ static void decode_audio_header (demux_ogg_t *this, const int stream_num, ogg_pa
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;
+ _x_report_audio_format_tag (this->stream->xine, LOG_MODULE, codec);
/*break;*/
}
@@ -1044,7 +1046,10 @@ static void decode_dshow_header (demux_ogg_t *this, const int stream_num, ogg_pa
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;
+ _x_report_video_fourcc (this->stream->xine, LOG_MODULE, fcc);
+ }
this->si[stream_num]->buf_types |= channel;
bih.biSize = sizeof(xine_bmiheader);
@@ -2079,7 +2084,13 @@ static void *anx_init_class (xine_t *xine, void *data) {
this->demux_class.open_plugin = anx_open_plugin;
this->demux_class.description = N_("Annodex demux plugin");
this->demux_class.identifier = "Annodex";
- this->demux_class.mimetypes = "application/x-annodex: ogg: Annodex media;";
+ this->demux_class.mimetypes =
+ "application/annodex: anx: Annodex media;"
+ "application/x-annodex: anx: Annodex media;"
+ "audio/annodex: axa: Annodex audio;"
+ "audio/x-annodex: axa: Annodex audio;"
+ "video/annodex: axv: Annodex video;"
+ "video/x-annodex: axv: Annodex video;";
this->demux_class.extensions = "anx axa axv";
this->demux_class.dispose = default_demux_class_dispose;
@@ -2098,11 +2109,13 @@ static void *ogg_init_class (xine_t *xine, void *data) {
this->demux_class.description = N_("OGG demux plugin");
this->demux_class.identifier = "OGG";
this->demux_class.mimetypes =
- "audio/x-ogg: ogg: OggVorbis Audio;"
- "audio/x-speex: ogg: Speex Audio;"
- "application/x-ogg: ogg: Ogg Stream;"
- "application/ogg: ogg: Ogg Stream;";
- this->demux_class.extensions = "ogg ogm spx";
+ "application/ogg: ogx: Ogg Stream;"
+ "application/x-ogg: ogx: Ogg Stream;"
+ "audio/ogg: oga: Ogg Audio;"
+ "audio/x-ogg: oga: Ogg Audio;"
+ "video/ogg: ogv: Ogg Video;";
+ "video/x-ogg: ogv: Ogg Video;";
+ this->demux_class.extensions = "ogx ogv oga ogg spx ogm";
this->demux_class.dispose = default_demux_class_dispose;
return this;
diff --git a/src/combined/xine_vorbis_decoder.c b/src/combined/xine_vorbis_decoder.c
index 6d651f153..ad3a07188 100644
--- a/src/combined/xine_vorbis_decoder.c
+++ b/src/combined/xine_vorbis_decoder.c
@@ -41,6 +41,7 @@
#include <vorbis/codec.h>
#define MAX_NUM_SAMPLES 4096
+#define INIT_BUFSIZE 8192
typedef struct {
audio_decoder_class_t decoder_class;
@@ -70,6 +71,11 @@ typedef struct vorbis_decoder_s {
xine_stream_t *stream;
+ /* data accumulation stuff */
+ unsigned char *buf;
+ int bufsize;
+ int size;
+
} vorbis_decoder_t;
@@ -78,6 +84,7 @@ static void vorbis_reset (audio_decoder_t *this_gen) {
vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
if( this->header_count ) return;
+ this->size = 0;
/* clear block first, as it might contain allocated data */
vorbis_block_clear(&this->vb);
@@ -136,126 +143,147 @@ static void get_metadata (vorbis_decoder_t *this) {
_x_meta_info_set_utf8(this->stream, XINE_META_INFO_AUDIOCODEC, "vorbis");
}
+static void vorbis_check_bufsize (vorbis_decoder_t *this, int size) {
+ if (size > this->bufsize) {
+ this->bufsize = size + size / 2;
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("vorbis: increasing buffer to %d to avoid overflow.\n"),
+ this->bufsize);
+ this->buf = realloc(this->buf, this->bufsize);
+ }
+}
+
static void vorbis_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
vorbis_decoder_t *this = (vorbis_decoder_t *) this_gen;
memset( &this->op, 0, sizeof(this->op) );
- this->op.packet = buf->content;
- this->op.bytes = buf->size;
-
- if ( (buf->decoder_flags & BUF_FLAG_HEADER) &&
- !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) {
- lprintf ("%d headers to go\n", this->header_count);
- if (this->header_count) {
- int res = 0;
+ /* data accumulation */
+ vorbis_check_bufsize(this, this->size + buf->size);
+ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
+ this->size += buf->size;
- if (this->header_count == 3)
- this->op.b_o_s = 1;
+ if (buf->decoder_flags & BUF_FLAG_FRAME_END) {
+ this->op.packet = this->buf;
+ this->op.bytes = this->size;
-
- if( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ){
- /* error case; not a vorbis header */
- xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res);
- xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
- return;
- }
-
- this->header_count--;
-
- if (!this->header_count) {
-
- int mode = AO_CAP_MODE_MONO;
-
- get_metadata (this);
-
- mode = _x_ao_channels2mode(this->vi.channels);
-
- this->convsize=MAX_NUM_SAMPLES/this->vi.channels;
-
- if (!this->output_open) {
- this->output_open = (this->stream->audio_out->open) (this->stream->audio_out,
- this->stream,
- 16,
- this->vi.rate,
- mode) ;
-
- _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE,
- this->vi.bitrate_nominal);
-
- }
-
- /* OK, got and parsed all three headers. Initialize the Vorbis
- * packet->PCM decoder. */
- lprintf("all three headers parsed. initializing decoder.\n");
- /* initialize central decode state */
- vorbis_synthesis_init(&this->vd,&this->vi);
- /* initialize local state for most of the decode so multiple
- * block decodes can proceed in parallel. We could init
- * multiple vorbis_block structures for vd here */
- vorbis_block_init(&this->vd,&this->vb);
+ /* reset accumultaion buffer */
+ this->size = 0;
+
+ if ( (buf->decoder_flags & BUF_FLAG_HEADER) &&
+ !(buf->decoder_flags & BUF_FLAG_STDHEADER) ) {
+
+ lprintf ("%d headers to go\n", this->header_count);
+
+ if (this->header_count) {
+ int res = 0;
+
+ if (this->header_count == 3)
+ this->op.b_o_s = 1;
+
+ if ( (res = vorbis_synthesis_headerin(&this->vi,&this->vc,&this->op)) < 0 ) {
+ /* error case; not a vorbis header */
+ xine_log(this->stream->xine, XINE_LOG_MSG, "libvorbis: this bitstream does not contain vorbis audio data. Following first 64 bytes (return: %d).\n", res);
+ xine_hexdump((char *)this->op.packet, this->op.bytes < 64 ? this->op.bytes : 64);
+ return;
+ }
+
+ this->header_count--;
+
+ if (!this->header_count) {
+
+ int mode = AO_CAP_MODE_MONO;
+
+ get_metadata (this);
+
+ mode = _x_ao_channels2mode(this->vi.channels);
+
+ this->convsize=MAX_NUM_SAMPLES/this->vi.channels;
+
+ if (!this->output_open) {
+ this->output_open = (this->stream->audio_out->open) (this->stream->audio_out,
+ this->stream,
+ 16,
+ this->vi.rate,
+ mode) ;
+
+ _x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_BITRATE,
+ this->vi.bitrate_nominal);
+
+ }
+
+ /* OK, got and parsed all three headers. Initialize the Vorbis
+ * packet->PCM decoder. */
+ lprintf("all three headers parsed. initializing decoder.\n");
+ /* initialize central decode state */
+ vorbis_synthesis_init(&this->vd,&this->vi);
+ /* initialize local state for most of the decode so multiple
+ * block decodes can proceed in parallel. We could init
+ * multiple vorbis_block structures for vd here */
+ vorbis_block_init(&this->vd,&this->vb);
+ }
}
- }
-
- } else if (this->output_open) {
-
- float **pcm;
- int samples;
-
- if(vorbis_synthesis(&this->vb,&this->op)==0)
- vorbis_synthesis_blockin(&this->vd,&this->vb);
-
- if (buf->pts!=0)
- this->pts=buf->pts;
-
- while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){
-
- /* **pcm is a multichannel float vector. In stereo, for
- * example, pcm[0][...] is left, and pcm[1][...] is right.
- * samples is the size of each channel. Convert the float
- * values (-1.<=range<=1.) to whatever PCM format and write
- * it out
- */
-
- int i,j;
- int bout=(samples<this->convsize?samples:this->convsize);
- audio_buffer_t *audio_buffer;
-
- audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
-
- /* convert floats to 16 bit signed ints (host order) and
- interleave */
- for(i=0;i<this->vi.channels;i++){
- ogg_int16_t *ptr=audio_buffer->mem+i;
- float *mono=pcm[i];
- for(j=0;j<bout;j++){
- int val=(mono[j] + 1.0f) * 32768.f;
- val -= 32768;
- /* might as well guard against clipping */
- if(val>32767){
- val=32767;
- } else if(val<-32768){
- val=-32768;
- }
- *ptr=val;
- ptr+=this->vi.channels;
- }
+
+ } else if (this->output_open) {
+
+ float **pcm;
+ int samples;
+
+ if(vorbis_synthesis(&this->vb,&this->op)==0)
+ vorbis_synthesis_blockin(&this->vd,&this->vb);
+
+ if (buf->pts!=0)
+ this->pts=buf->pts;
+
+ while ((samples=vorbis_synthesis_pcmout(&this->vd,&pcm))>0){
+
+ /* **pcm is a multichannel float vector. In stereo, for
+ * example, pcm[0][...] is left, and pcm[1][...] is right.
+ * samples is the size of each channel. Convert the float
+ * values (-1.<=range<=1.) to whatever PCM format and write
+ * it out
+ */
+
+ int i,j;
+ int bout=(samples<this->convsize?samples:this->convsize);
+ audio_buffer_t *audio_buffer;
+
+ audio_buffer = this->stream->audio_out->get_buffer (this->stream->audio_out);
+
+ /* convert floats to 16 bit signed ints (host order) and
+ interleave */
+ for(i=0;i<this->vi.channels;i++){
+ ogg_int16_t *ptr=audio_buffer->mem+i;
+ float *mono=pcm[i];
+ for(j=0;j<bout;j++){
+ int val=(mono[j] + 1.0f) * 32768.f;
+ val -= 32768;
+ /* might as well guard against clipping */
+ if(val>32767){
+ val=32767;
+ } else if(val<-32768){
+ val=-32768;
+ }
+ *ptr=val;
+ ptr+=this->vi.channels;
+ }
+ }
+
+ audio_buffer->vpts = this->pts;
+ this->pts=0;
+ audio_buffer->num_frames = bout;
+
+ this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream);
+
+ buf->pts=0;
+
+ /* tell libvorbis how many samples we actually consumed */
+ vorbis_synthesis_read(&this->vd,bout);
}
-
- audio_buffer->vpts = this->pts;
- this->pts=0;
- audio_buffer->num_frames = bout;
-
- this->stream->audio_out->put_buffer (this->stream->audio_out, audio_buffer, this->stream);
-
- buf->pts=0;
-
- /* tell libvorbis how many samples we actually consumed */
- vorbis_synthesis_read(&this->vd,bout);
+ } else {
+ lprintf("output not open\n");
}
- } else {
- lprintf("output not open\n");
}
}
@@ -299,6 +327,10 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen,
this->header_count = 3;
this->convsize = 0;
+ this->bufsize = INIT_BUFSIZE;
+ this->buf = xine_xmalloc(INIT_BUFSIZE);
+ this->size = 0;
+
vorbis_info_init(&this->vi);
vorbis_comment_init(&this->vc);