summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-10-23 05:18:59 +0000
committerMike Melanson <mike@multimedia.cx>2003-10-23 05:18:59 +0000
commit558b00644651500abb40a7f4d73854312b571343 (patch)
tree8046e4095450bd1d81cb379dfe9bbca5b6bdd5ec /src
parent51616b96cd2793085ae314fecde90ac9a0735a04 (diff)
downloadxine-lib-558b00644651500abb40a7f4d73854312b571343.tar.gz
xine-lib-558b00644651500abb40a7f4d73854312b571343.tar.bz2
make the demuxers conform to the bitmapinfo structure
CVS patchset: 5575 CVS date: 2003/10/23 05:18:59
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_vqa.c61
-rw-r--r--src/demuxers/demux_wc3movie.c28
2 files changed, 42 insertions, 47 deletions
diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c
index d7a40c144..6f7d5f0ec 100644
--- a/src/demuxers/demux_vqa.c
+++ b/src/demuxers/demux_vqa.c
@@ -29,7 +29,7 @@
* block needs information from the previous audio block in order to be
* decoded, thus making random seeking difficult.
*
- * $Id: demux_vqa.c,v 1.32 2003/08/25 21:51:39 f1rmb Exp $
+ * $Id: demux_vqa.c,v 1.33 2003/10/23 05:18:59 tmmm Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -80,11 +80,8 @@ typedef struct {
off_t data_start;
off_t filesize;
- unsigned char header[VQA_HEADER_SIZE];
-
- unsigned int audio_sample_rate;
- unsigned int audio_bits;
- unsigned int audio_channels;
+ unsigned char bih[sizeof(xine_bmiheader) + VQA_HEADER_SIZE];
+ xine_waveformatex wave;
int64_t video_pts;
unsigned int audio_frames;
@@ -99,6 +96,8 @@ typedef struct {
static int open_vqa_file(demux_vqa_t *this) {
unsigned char scratch[12];
unsigned int chunk_size;
+ xine_bmiheader *bih = (xine_bmiheader *)this->bih;
+ unsigned char *vqa_header = this->bih + sizeof(xine_bmiheader);
if (xine_demux_read_header(this->input, scratch, 12) != 12)
return 0;
@@ -116,22 +115,23 @@ static int open_vqa_file(demux_vqa_t *this) {
this->filesize = 1;
/* load the VQA header */
- if (this->input->read(this->input, this->header, VQA_HEADER_SIZE)
- != VQA_HEADER_SIZE)
+ if (this->input->read(this->input, vqa_header, VQA_HEADER_SIZE) !=
+ VQA_HEADER_SIZE)
return 0;
- this->audio_sample_rate = LE_16(&this->header[24]);
- this->audio_channels = this->header[26];
+ bih->biSize = sizeof(xine_bmiheader) + VQA_HEADER_SIZE;
+ bih->biWidth = LE_16(&vqa_header[6]);
+ bih->biHeight = LE_16(&vqa_header[8]);
+ this->wave.nSamplesPerSec = LE_16(&vqa_header[24]);
+ this->wave.nChannels = vqa_header[26];
+ this->wave.wBitsPerSample = 16;
/* skip the FINF chunk */
if (this->input->read(this->input, scratch, VQA_PREAMBLE_SIZE) !=
VQA_PREAMBLE_SIZE)
return 0;
chunk_size = BE_32(&scratch[4]);
- printf ("current pos @ %llX + ", this->input->get_current_pos(this->input));
- printf ("%X bytes seek forward = new pos @ %llX)\n",
- chunk_size,
- this->input->seek(this->input, chunk_size, SEEK_CUR));
+ this->input->seek(this->input, chunk_size, SEEK_CUR);
this->video_pts = this->audio_frames = 0;
this->iteration = 0;
@@ -161,8 +161,8 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) {
skip_byte = chunk_size & 0x1;
audio_pts = this->audio_frames;
audio_pts *= 90000;
- audio_pts /= this->audio_sample_rate;
- this->audio_frames += (chunk_size * 2 / this->audio_channels);
+ audio_pts /= this->wave.nSamplesPerSec;
+ this->audio_frames += (chunk_size * 2 / this->wave.nChannels);
while (chunk_size) {
if(this->audio_fifo) {
@@ -247,6 +247,7 @@ static int demux_vqa_send_chunk(demux_plugin_t *this_gen) {
static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
demux_vqa_t *this = (demux_vqa_t *) this_gen;
buf_element_t *buf;
+ xine_bmiheader *bih = (xine_bmiheader *)this->bih;
this->video_fifo = this->stream->video_fifo;
this->audio_fifo = this->stream->audio_fifo;
@@ -256,17 +257,15 @@ static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
/* load stream information */
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = 1;
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] =
- (this->audio_channels) ? 1 : 0;
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] =
- LE_16(&this->header[6]);
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] =
- LE_16(&this->header[8]);
+ (this->wave.nChannels) ? 1 : 0;
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = bih->biWidth;
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = bih->biHeight;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
- this->audio_channels;
+ this->wave.nChannels;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] =
- this->audio_sample_rate;
+ this->wave.nSamplesPerSec;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_BITS] =
- this->audio_bits;
+ this->wave.wBitsPerSample;
/* send start buffers */
xine_demux_control_start(this->stream);
@@ -276,21 +275,23 @@ static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
buf->decoder_flags = BUF_FLAG_HEADER;
buf->decoder_info[0] = 0;
buf->decoder_info[1] = VQA_PTS_INC; /* initial video_step */
- /* send the VQA header in place of the bitmapinfo header that many
- * demuxers send; the VQA video decoder will understand what this means */
- memcpy(buf->content, this->header, VQA_HEADER_SIZE);
- buf->size = VQA_HEADER_SIZE;
+ memcpy(buf->content, this->bih, sizeof(xine_bmiheader) + VQA_HEADER_SIZE);
+ buf->size = sizeof(xine_bmiheader) + VQA_HEADER_SIZE;
buf->type = BUF_VIDEO_VQA;
this->video_fifo->put (this->video_fifo, buf);
- if (this->audio_fifo && this->audio_channels) {
+ if (this->audio_fifo && this->wave.nChannels) {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
buf->type = BUF_AUDIO_VQA_IMA;
buf->decoder_flags = BUF_FLAG_HEADER;
buf->decoder_info[0] = 0;
- buf->decoder_info[1] = this->audio_sample_rate;
+ buf->decoder_info[1] = this->wave.nSamplesPerSec;
buf->decoder_info[2] = 16; /* bits/samples */
buf->decoder_info[3] = 1; /* channels */
+ this->wave.nBlockAlign = (this->wave.wBitsPerSample / 8) * this->wave.nChannels;
+ this->wave.nAvgBytesPerSec = this->wave.nBlockAlign * this->wave.nSamplesPerSec;
+ memcpy(buf->content, &this->wave, sizeof(this->wave));
+ buf->size = sizeof(this->wave);
this->audio_fifo->put (this->audio_fifo, buf);
}
}
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index 643f99ff5..7d316b911 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.c
@@ -24,7 +24,7 @@
* For more information on the MVE file format, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: demux_wc3movie.c,v 1.40 2003/08/25 21:51:39 f1rmb Exp $
+ * $Id: demux_wc3movie.c,v 1.41 2003/10/23 05:18:59 tmmm Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -87,9 +87,7 @@ typedef struct {
input_plugin_t *input;
int status;
- unsigned int video_width;
- unsigned int video_height;
-
+ xine_bmiheader bih;
xine_waveformatex wave;
palette_entry_t *palettes;
@@ -301,8 +299,8 @@ static void demux_mve_send_headers(demux_plugin_t *this_gen) {
/* this is not strictly correct-- some WC3 MVE files do not contain
* audio, but I'm too lazy to check if that is the case */
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = 1;
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->video_width;
- this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->video_height;
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_WIDTH] = this->bih.biWidth;
+ this->stream->stream_info[XINE_STREAM_INFO_VIDEO_HEIGHT] = this->bih.biHeight;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_CHANNELS] =
this->wave.nChannels;
this->stream->stream_info[XINE_STREAM_INFO_AUDIO_SAMPLERATE] =
@@ -318,13 +316,8 @@ static void demux_mve_send_headers(demux_plugin_t *this_gen) {
buf->decoder_flags = BUF_FLAG_HEADER;
buf->decoder_info[0] = 0;
buf->decoder_info[1] = WC3_PTS_INC; /* initial video_step */
- /* really be a rebel: No structure at all, just put the video width
- * and height straight into the buffer, BE_16 format */
- buf->content[0] = (this->video_width >> 8) & 0xFF;
- buf->content[1] = (this->video_width >> 0) & 0xFF;
- buf->content[2] = (this->video_height >> 8) & 0xFF;
- buf->content[3] = (this->video_height >> 0) & 0xFF;
- buf->size = 4;
+ buf->content = (void *)&this->bih;
+ buf->size = sizeof(this->bih);
buf->type = BUF_VIDEO_WC3;
this->video_fifo->put (this->video_fifo, buf);
@@ -372,9 +365,10 @@ static int open_mve_file(demux_mve_t *this) {
/* file is qualified */
+ this->bih.biSize = sizeof(xine_bmiheader);
/* these are the frame dimensions unless others are found */
- this->video_width = WC3_USUAL_WIDTH;
- this->video_height = WC3_USUAL_HEIGHT;
+ this->bih.biWidth = WC3_USUAL_WIDTH;
+ this->bih.biHeight = WC3_USUAL_HEIGHT;
/* load the number of palettes, the only interesting piece of information
* in the _PC_ chunk; take it for granted that it will always appear at
@@ -486,8 +480,8 @@ static int open_mve_file(demux_mve_t *this) {
free (this->shot_offsets);
return 0;
}
- this->video_width = BE_32(&preamble[0]);
- this->video_height = BE_32(&preamble[4]);
+ this->bih.biWidth = BE_32(&preamble[0]);
+ this->bih.biHeight = BE_32(&preamble[4]);
break;
case INDX_TAG: