summaryrefslogtreecommitdiff
path: root/src/combined
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-09 18:28:49 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-04-09 18:28:49 +0100
commit39939c95eff90545285a9a8f761d9fa6e9349358 (patch)
treeb8ea1fa3f2ddf1627eeecbd889f47226b01a45d8 /src/combined
parent19357940a57c565ebe319729bd08d6e4800aff5d (diff)
parent628c4cbd9d023e74a7c6805d7ec0f163f2c172d1 (diff)
downloadxine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.gz
xine-lib-39939c95eff90545285a9a8f761d9fa6e9349358.tar.bz2
Merge from 1.2 main.
Diffstat (limited to 'src/combined')
-rw-r--r--src/combined/ffmpeg/ff_audio_decoder.c81
-rw-r--r--src/combined/ffmpeg/ff_video_decoder.c26
-rw-r--r--src/combined/ffmpeg/ffmpeg_decoder.h6
-rw-r--r--src/combined/wavpack_combined.c2
-rw-r--r--src/combined/wavpack_demuxer.c4
-rw-r--r--src/combined/xine_ogg_demuxer.c5
6 files changed, 98 insertions, 26 deletions
diff --git a/src/combined/ffmpeg/ff_audio_decoder.c b/src/combined/ffmpeg/ff_audio_decoder.c
index b7f966325..27fe18d9c 100644
--- a/src/combined/ffmpeg/ff_audio_decoder.c
+++ b/src/combined/ffmpeg/ff_audio_decoder.c
@@ -78,6 +78,7 @@ static const ff_codec_t ff_audio_lookup[] = {
{BUF_AUDIO_14_4, CODEC_ID_RA_144, "Real 14.4 (ffmpeg)"},
{BUF_AUDIO_28_8, CODEC_ID_RA_288, "Real 28.8 (ffmpeg)"},
{BUF_AUDIO_MPEG, CODEC_ID_MP3, "MP3 (ffmpeg)"},
+ {BUF_AUDIO_MP3ADU, CODEC_ID_MP3ADU, "MPEG-3 adu (ffmpeg)"},
{BUF_AUDIO_MSADPCM, CODEC_ID_ADPCM_MS, "MS ADPCM (ffmpeg)"},
{BUF_AUDIO_QTIMAADPCM, CODEC_ID_ADPCM_IMA_QT, "QT IMA ADPCM (ffmpeg)"},
{BUF_AUDIO_MSIMAADPCM, CODEC_ID_ADPCM_IMA_WAV, "MS IMA ADPCM (ffmpeg)"},
@@ -198,8 +199,8 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->audio_channels = this->buf[0x37];
/* this->audio_bits = buf->content[0x35] */
- this->context->block_align = _X_BE_16(&this->buf[0x2A]);
-
+ this->context->block_align = _X_BE_32(&this->buf[0x18]);
+
this->context->extradata_size = 5*sizeof(short);
this->context->extradata = xine_xmalloc(this->context->extradata_size);
@@ -210,7 +211,49 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
ptr[2] = _X_BE_16(&this->buf[0x16]); /* subpacket flavour */
ptr[3] = _X_BE_32(&this->buf[0x18]); /* coded frame size */
ptr[4] = 0; /* codec's data length */
+
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ "ffmpeg_audio_dec: 28_8 audio channels %d bits %d sample rate %d block align %d\n",
+ this->audio_channels, this->audio_bits, this->audio_sample_rate,
+ this->context->block_align);
break;
+ case BUF_AUDIO_COOK:
+ {
+ int version;
+ int data_len;
+ int extradata;
+
+ version = _X_BE_16 (this->buf+4);
+ if (version == 4) {
+ this->audio_sample_rate = _X_BE_16 (this->buf+48);
+ this->audio_bits = _X_BE_16 (this->buf+52);
+ this->audio_channels = _X_BE_16 (this->buf+54);
+ data_len = _X_BE_32 (this->buf+67);
+ extradata = 71;
+ } else {
+ this->audio_sample_rate = _X_BE_16 (this->buf+54);
+ this->audio_bits = _X_BE_16 (this->buf+58);
+ this->audio_channels = _X_BE_16 (this->buf+60);
+ data_len = _X_BE_32 (this->buf+74);
+ extradata = 78;
+ }
+ this->context->block_align = _X_BE_16 (this->buf+44);
+
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ "ffmpeg_audio_dec: cook audio channels %d bits %d sample rate %d block align %d\n",
+ this->audio_channels, this->audio_bits, this->audio_sample_rate,
+ this->context->block_align);
+
+ if (extradata + data_len > this->size)
+ break; /* abort early - extradata length is bad */
+
+ this->context->extradata_size = data_len;
+ this->context->extradata = xine_xmalloc(this->context->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ xine_fast_memcpy (this->context->extradata, this->buf + extradata,
+ this->context->extradata_size);
+ break;
+ }
default:
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
"ffmpeg_audio_dec: unknown header with buf type 0x%X\n", codec_type);
@@ -227,6 +270,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->context->sample_rate = this->audio_sample_rate;
this->context->channels = this->audio_channels;
this->context->codec_id = this->codec->id;
+ this->context->codec_type = this->codec->type;
this->context->codec_tag = _x_stream_info_get(this->stream, XINE_STREAM_INFO_AUDIO_FOURCC);
this->size = 0;
@@ -266,7 +310,26 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
this->decoder_ok = 1;
}
+ if( buf->decoder_flags & BUF_FLAG_PREVIEW )
+ return;
+
+ ff_audio_ensure_buffer_size(this, this->size + buf->size);
+ xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
+ this->size += buf->size;
+
if (!this->output_open) {
+ if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels) {
+ avcodec_decode_audio (this->context,
+ (int16_t *)this->decode_buffer,
+ &decode_buffer_size,
+ &this->buf[0],
+ this->size);
+ this->audio_bits = this->context->bits_per_sample;
+ this->audio_sample_rate = this->context->sample_rate;
+ this->audio_channels = this->context->channels;
+ if (!this->audio_bits || !this->audio_sample_rate || !this->audio_channels)
+ return;
+ }
this->output_open = (this->stream->audio_out->open) (this->stream->audio_out,
this->stream, this->audio_bits, this->audio_sample_rate,
_x_ao_channels2mode(this->audio_channels));
@@ -276,13 +339,6 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
if (!this->output_open)
return;
- if( buf->decoder_flags & BUF_FLAG_PREVIEW )
- return;
-
- ff_audio_ensure_buffer_size(this, this->size + buf->size);
- xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size);
- this->size += buf->size;
-
if (buf->decoder_flags & BUF_FLAG_FRAME_END) { /* time to decode a frame */
offset = 0;
@@ -323,7 +379,7 @@ static void ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
/* fill up this buffer */
xine_fast_memcpy(audio_buffer->mem, &this->decode_buffer[out],
- bytes_to_send);
+ bytes_to_send);
/* byte count / 2 (bytes / sample) / channels */
audio_buffer->num_frames = bytes_to_send / 2 / this->audio_channels;
@@ -354,7 +410,8 @@ static void ff_audio_reset (audio_decoder_t *this_gen) {
if( this->context && this->decoder_ok ) {
pthread_mutex_lock (&ffmpeg_lock);
avcodec_close (this->context);
- avcodec_open (this->context, this->codec);
+ if (avcodec_open (this->context, this->codec) < 0)
+ this->decoder_ok = 0;
pthread_mutex_unlock (&ffmpeg_lock);
}
}
@@ -468,5 +525,5 @@ static const uint32_t supported_audio_types[] = {
decoder_info_t dec_info_ffmpeg_audio = {
supported_audio_types, /* supported types */
- 6 /* priority */
+ 7 /* priority */
};
diff --git a/src/combined/ffmpeg/ff_video_decoder.c b/src/combined/ffmpeg/ff_video_decoder.c
index fcc6b9283..951e12deb 100644
--- a/src/combined/ffmpeg/ff_video_decoder.c
+++ b/src/combined/ffmpeg/ff_video_decoder.c
@@ -44,11 +44,7 @@
#include "ffmpeg_decoder.h"
#include "ff_mpeg_parser.h"
-#ifdef HAVE_FFMPEG_AVCODEC_H
-# include <postprocess.h>
-#else
-# include <libpostproc/postprocess.h>
-#endif
+#include <postprocess.h>
#define VIDEOBUFSIZE (128*1024)
#define SLICE_BUFFER_SIZE (1194*1024)
@@ -943,6 +939,26 @@ static void ff_handle_header_buffer (ff_video_decoder_t *this, buf_element_t *bu
this->context->slice_offset = xine_xmalloc(sizeof(int)*SLICE_OFFSET_SIZE);
this->slice_offset_size = SLICE_OFFSET_SIZE;
+ this->context->extradata_size = this->size - 26;
+ if (this->context->extradata_size < 8) {
+ this->context->extradata_size= 8;
+ this->context->extradata = malloc(this->context->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ ((uint32_t *)this->context->extradata)[0] = 0;
+ if (codec_type == BUF_VIDEO_RV10)
+ ((uint32_t *)this->context->extradata)[1] = 0x10000000;
+ else
+ ((uint32_t *)this->context->extradata)[1] = 0x10003001;
+ } else {
+ this->context->extradata = malloc(this->context->extradata_size +
+ FF_INPUT_BUFFER_PADDING_SIZE);
+ memcpy(this->context->extradata, this->buf + 26,
+ this->context->extradata_size);
+ }
+
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ "ffmpeg_video_dec: buf size %d\n", this->size);
+
lprintf("w=%d, h=%d\n", this->bih.biWidth, this->bih.biHeight);
break;
diff --git a/src/combined/ffmpeg/ffmpeg_decoder.h b/src/combined/ffmpeg/ffmpeg_decoder.h
index adf0908dd..bfe71a6b1 100644
--- a/src/combined/ffmpeg/ffmpeg_decoder.h
+++ b/src/combined/ffmpeg/ffmpeg_decoder.h
@@ -25,11 +25,7 @@
#include "config.h"
#endif
-#ifdef HAVE_FFMPEG_AVCODEC_H
-# include <avcodec.h>
-#else
-# include <libavcodec/avcodec.h>
-#endif
+#include <avcodec.h>
typedef struct ff_codec_s {
uint32_t type;
diff --git a/src/combined/wavpack_combined.c b/src/combined/wavpack_combined.c
index 8a4b488ae..ca54635e7 100644
--- a/src/combined/wavpack_combined.c
+++ b/src/combined/wavpack_combined.c
@@ -33,7 +33,7 @@ static const uint32_t audio_types[] = {
static const decoder_info_t decoder_info_wv = {
audio_types, /* supported types */
- 7 /* priority */
+ 8 /* priority */
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
diff --git a/src/combined/wavpack_demuxer.c b/src/combined/wavpack_demuxer.c
index 403d136d1..e32c17e4e 100644
--- a/src/combined/wavpack_demuxer.c
+++ b/src/combined/wavpack_demuxer.c
@@ -368,8 +368,8 @@ 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 = "audio/x-wavpack";
- this->demux_class.extensions = "wv";
+ this->demux_class.mimetypes = "audio/x-wavpack: wv,wvp: WavPack audio;";
+ this->demux_class.extensions = "wv wvp";
this->demux_class.dispose = default_demux_class_dispose;
return this;
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c
index 88fcea08a..52788612f 100644
--- a/src/combined/xine_ogg_demuxer.c
+++ b/src/combined/xine_ogg_demuxer.c
@@ -1208,7 +1208,7 @@ static void decode_theora_header (demux_ogg_t *this, const int stream_num, ogg_p
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;
+ xine_flac_streaminfo_block streaminfo = {};
buf_element_t *buf;
xine_waveformatex wave;
@@ -2110,6 +2110,9 @@ static void *ogg_init_class (xine_t *xine, void *data) {
this->demux_class.identifier = "OGG";
this->demux_class.mimetypes =
"application/ogg: ogx: Ogg Stream;"
+ "application/x-ogm: ogx: Ogg Stream;"
+ "application/x-ogm-audio: oga: Ogg Audio;"
+ "application/x-ogm-video: ogv: Ogg Video;"
"application/x-ogg: ogx: Ogg Stream;"
"audio/ogg: oga: Ogg Audio;"
"audio/x-ogg: oga: Ogg Audio;"