diff options
Diffstat (limited to 'src/demuxers/demux_idcin.c')
-rw-r--r-- | src/demuxers/demux_idcin.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c index 46d4c284b..7fbc89ca5 100644 --- a/src/demuxers/demux_idcin.c +++ b/src/demuxers/demux_idcin.c @@ -105,7 +105,8 @@ typedef struct { int status; off_t filesize; - unsigned char bih[sizeof(xine_bmiheader) + HUFFMAN_TABLE_SIZE]; + xine_bmiheader bih; + unsigned char huffman_table[HUFFMAN_TABLE_SIZE]; xine_waveformatex wave; int audio_chunk_size1; @@ -273,8 +274,7 @@ static int demux_idcin_send_chunk(demux_plugin_t *this_gen) { /* returns 1 if the CIN file was opened successfully, 0 otherwise */ static int open_idcin_file(demux_idcin_t *this) { unsigned char header[IDCIN_HEADER_SIZE]; - xine_bmiheader *bih = (xine_bmiheader *)this->bih; - unsigned char *huffman_table = this->bih + sizeof(xine_bmiheader); + xine_bmiheader *bih = &this->bih; if (_x_demux_read_header(this->input, header, IDCIN_HEADER_SIZE) != IDCIN_HEADER_SIZE) return 0; @@ -328,7 +328,7 @@ static int open_idcin_file(demux_idcin_t *this) { this->input->seek(this->input, IDCIN_HEADER_SIZE, SEEK_SET); /* read the Huffman table */ - if (this->input->read(this->input, huffman_table, HUFFMAN_TABLE_SIZE) != + if (this->input->read(this->input, this->huffman_table, HUFFMAN_TABLE_SIZE) != HUFFMAN_TABLE_SIZE) return 0; @@ -356,7 +356,6 @@ 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; - xine_bmiheader *bih = (xine_bmiheader *)this->bih; uint32_t i, size; this->video_fifo = this->stream->video_fifo; @@ -368,8 +367,8 @@ static void demux_idcin_send_headers(demux_plugin_t *this_gen) { _x_demux_control_start(this->stream); /* send init info to decoders */ - bih->biSize = sizeof(xine_bmiheader) + HUFFMAN_TABLE_SIZE; - size = bih->biSize; + this->bih.biSize = sizeof(xine_bmiheader) + HUFFMAN_TABLE_SIZE; + size = this->bih.biSize; i = 0; do { @@ -384,7 +383,14 @@ static void demux_idcin_send_headers(demux_plugin_t *this_gen) { buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER| BUF_FLAG_FRAMERATE|BUF_FLAG_FRAME_END; } - memcpy(buf->content, this->bih + i, buf->size); + + if (i == 0) { + memcpy(buf->content, &this->bih, sizeof(xine_bmiheader)); + memcpy(buf->content + sizeof(xine_bmiheader), this->huffman_table, buf->size - sizeof(xine_bmiheader)); + } else { + memcpy(buf->content, this->huffman_table + i - sizeof(xine_bmiheader), buf->size); + } + buf->type = BUF_VIDEO_IDCIN; this->video_fifo->put (this->video_fifo, buf); |