summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/asfheader.c6
-rw-r--r--src/demuxers/demux_idcin.c22
-rw-r--r--src/demuxers/demux_vmd.c22
-rw-r--r--src/demuxers/demux_vqa.c27
-rw-r--r--src/input/input_dvb.c8
-rw-r--r--src/input/input_v4l2.c2
-rw-r--r--src/input/net_buf_ctrl.c14
7 files changed, 56 insertions, 45 deletions
diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c
index 54326c1d5..a78c84fd2 100644
--- a/src/demuxers/asfheader.c
+++ b/src/demuxers/asfheader.c
@@ -232,7 +232,7 @@ static int asf_header_get_stream_id(asf_header_t *header_pub, uint16_t stream_nu
static int asf_header_parse_file_properties(asf_header_t *header, uint8_t *buffer, int buffer_len) {
asf_reader_t reader;
asf_file_t *asf_file;
- uint32_t flags;
+ uint32_t flags = 0;
if (buffer_len < 80) {
lprintf("invalid asf file properties object\n");
@@ -284,7 +284,7 @@ static int asf_header_parse_file_properties(asf_header_t *header, uint8_t *buffe
static int asf_header_parse_stream_properties(asf_header_t *header, uint8_t *buffer, int buffer_len) {
asf_reader_t reader;
- uint16_t flags;
+ uint16_t flags = 0;
uint32_t junk;
GUID guid;
asf_stream_t *asf_stream = NULL;
@@ -353,7 +353,7 @@ exit_error:
static int asf_header_parse_stream_extended_properties(asf_header_t *header, uint8_t *buffer, int buffer_len) {
asf_reader_t reader;
- uint32_t flags;
+ uint32_t flags = 0;
uint16_t stream_number;
int i;
int stream_id;
diff --git a/src/demuxers/demux_idcin.c b/src/demuxers/demux_idcin.c
index 34dc1ee4d..954a2fc1a 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;
int size;
@@ -369,8 +368,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 {
@@ -385,7 +384,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);
diff --git a/src/demuxers/demux_vmd.c b/src/demuxers/demux_vmd.c
index bcea5e725..1bd052c10 100644
--- a/src/demuxers/demux_vmd.c
+++ b/src/demuxers/demux_vmd.c
@@ -76,7 +76,8 @@ typedef struct {
off_t data_start;
off_t data_size;
- unsigned char bih[sizeof(xine_bmiheader) + VMD_HEADER_SIZE];
+ xine_bmiheader bih;
+ unsigned char vmd_header[VMD_HEADER_SIZE];
xine_waveformatex wave;
unsigned int audio_frames;
@@ -89,7 +90,7 @@ typedef struct {
int64_t video_pts_inc;
int64_t total_pts;
-} demux_vmd_t ;
+} demux_vmd_t;
typedef struct {
demux_class_t demux_class;
@@ -98,8 +99,7 @@ typedef struct {
/* returns 1 if the VMD file was opened successfully, 0 otherwise */
static int open_vmd_file(demux_vmd_t *this) {
- xine_bmiheader *bih = (xine_bmiheader *)this->bih;
- unsigned char *vmd_header = this->bih + sizeof(xine_bmiheader);
+ unsigned char *vmd_header = this->vmd_header;
off_t toc_offset;
unsigned char *raw_frame_table;
unsigned int raw_frame_table_size;
@@ -122,9 +122,9 @@ static int open_vmd_file(demux_vmd_t *this) {
if ( !(this->data_size = this->input->get_length(this->input)) )
this->data_size = 1;
- bih->biSize = sizeof(xine_bmiheader) + VMD_HEADER_SIZE;
- bih->biWidth = _X_LE_16(&vmd_header[12]);
- bih->biHeight = _X_LE_16(&vmd_header[14]);
+ this->bih.biSize = sizeof(xine_bmiheader) + VMD_HEADER_SIZE;
+ this->bih.biWidth = _X_LE_16(&vmd_header[12]);
+ this->bih.biHeight = _X_LE_16(&vmd_header[14]);
this->wave.nSamplesPerSec = _X_LE_16(&vmd_header[804]);
this->wave.nChannels = (vmd_header[811] & 0x80) ? 2 : 1;
this->wave.nBlockAlign = _X_LE_16(&vmd_header[806]);
@@ -323,7 +323,6 @@ static int demux_vmd_send_chunk(demux_plugin_t *this_gen) {
static void demux_vmd_send_headers(demux_plugin_t *this_gen) {
demux_vmd_t *this = (demux_vmd_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;
@@ -335,9 +334,9 @@ static void demux_vmd_send_headers(demux_plugin_t *this_gen) {
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO,
(this->wave.nSamplesPerSec) ? 1 : 0);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- bih->biWidth);
+ this->bih.biWidth);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- bih->biHeight);
+ this->bih.biHeight);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS,
this->wave.nChannels);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE,
@@ -353,7 +352,8 @@ static void demux_vmd_send_headers(demux_plugin_t *this_gen) {
buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE|
BUF_FLAG_FRAME_END;
buf->decoder_info[0] = this->video_pts_inc; /* initial duration */
- memcpy(buf->content, this->bih, sizeof(xine_bmiheader) + VMD_HEADER_SIZE);
+ memcpy(buf->content, &this->bih, sizeof(xine_bmiheader));
+ memcpy(buf->content + sizeof(xine_bmiheader), this->vmd_header, VMD_HEADER_SIZE);
buf->size = sizeof(xine_bmiheader) + VMD_HEADER_SIZE;
buf->type = BUF_VIDEO_VMD;
this->video_fifo->put (this->video_fifo, buf);
diff --git a/src/demuxers/demux_vqa.c b/src/demuxers/demux_vqa.c
index 9e0f1cb65..6980c6e1a 100644
--- a/src/demuxers/demux_vqa.c
+++ b/src/demuxers/demux_vqa.c
@@ -73,13 +73,14 @@ typedef struct {
off_t data_start;
off_t filesize;
- unsigned char bih[sizeof(xine_bmiheader) + VQA_HEADER_SIZE];
+ xine_bmiheader bih;
+ unsigned char vqa_header[VQA_HEADER_SIZE];
xine_waveformatex wave;
int64_t video_pts;
unsigned int audio_frames;
unsigned int iteration;
-} demux_vqa_t ;
+} demux_vqa_t;
typedef struct {
demux_class_t demux_class;
@@ -89,8 +90,6 @@ 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 (_x_demux_read_header(this->input, scratch, 12) != 12)
return 0;
@@ -108,15 +107,15 @@ static int open_vqa_file(demux_vqa_t *this) {
this->filesize = 1;
/* load the VQA header */
- if (this->input->read(this->input, vqa_header, VQA_HEADER_SIZE) !=
+ if (this->input->read(this->input, this->vqa_header, VQA_HEADER_SIZE) !=
VQA_HEADER_SIZE)
return 0;
- bih->biSize = sizeof(xine_bmiheader) + VQA_HEADER_SIZE;
- bih->biWidth = _X_LE_16(&vqa_header[6]);
- bih->biHeight = _X_LE_16(&vqa_header[8]);
- this->wave.nSamplesPerSec = _X_LE_16(&vqa_header[24]);
- this->wave.nChannels = vqa_header[26];
+ this->bih.biSize = sizeof(xine_bmiheader) + VQA_HEADER_SIZE;
+ this->bih.biWidth = _X_LE_16(&this->vqa_header[6]);
+ this->bih.biHeight = _X_LE_16(&this->vqa_header[8]);
+ this->wave.nSamplesPerSec = _X_LE_16(&this->vqa_header[24]);
+ this->wave.nChannels = this->vqa_header[26];
this->wave.wBitsPerSample = 16;
/* skip the FINF chunk */
@@ -240,7 +239,6 @@ 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;
@@ -252,9 +250,9 @@ static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
_x_stream_info_set(this->stream, XINE_STREAM_INFO_HAS_AUDIO,
(this->wave.nChannels) ? 1 : 0);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- bih->biWidth);
+ this->bih.biWidth);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- bih->biHeight);
+ this->bih.biHeight);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_CHANNELS,
this->wave.nChannels);
_x_stream_info_set(this->stream, XINE_STREAM_INFO_AUDIO_SAMPLERATE,
@@ -270,7 +268,8 @@ static void demux_vqa_send_headers(demux_plugin_t *this_gen) {
buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAMERATE|
BUF_FLAG_FRAME_END;
buf->decoder_info[0] = VQA_PTS_INC; /* initial video_step */
- memcpy(buf->content, this->bih, sizeof(xine_bmiheader) + VQA_HEADER_SIZE);
+ memcpy(buf->content, &this->bih, sizeof(xine_bmiheader));
+ memcpy(buf->content + sizeof(xine_bmiheader), this->vqa_header, VQA_HEADER_SIZE);
buf->size = sizeof(xine_bmiheader) + VQA_HEADER_SIZE;
buf->type = BUF_VIDEO_VQA;
this->video_fifo->put (this->video_fifo, buf);
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index cb2c48e2c..b5833871f 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -2566,8 +2566,12 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen,
ts_rewrite_packets (this, buf,total);
- if ((this->record_fd)&&(!this->record_paused))
- write (this->record_fd, buf, total);
+ if ((this->record_fd > -1) && (!this->record_paused))
+ if (write (this->record_fd, buf, total) != total) {
+ do_record(this);
+ xprintf(this->class->xine, XINE_VERBOSITY_LOG,
+ "input_dvb: Recording failed\n");
+ }
pthread_mutex_unlock( &this->channel_change_mutex );
diff --git a/src/input/input_v4l2.c b/src/input/input_v4l2.c
index b2938d609..7f7da68ba 100644
--- a/src/input/input_v4l2.c
+++ b/src/input/input_v4l2.c
@@ -350,7 +350,7 @@ static uint32_t v4l2_input_get_capabilities(input_plugin_t* this_gen) {
}
static const char* v4l2_input_get_mrl(input_plugin_t* this_gen) {
- v4l2_input_plugin_t* this = (v4l2_input_plugin_t*)this_gen;
+ /*v4l2_input_plugin_t* this = (v4l2_input_plugin_t*)this_gen;*/
/* HACK HACK HACK HACK */
/* So far, the only way to get the yuv_frames demuxer to work with this */
return "v4l:/";
diff --git a/src/input/net_buf_ctrl.c b/src/input/net_buf_ctrl.c
index 81165afcf..d50a6a8c4 100644
--- a/src/input/net_buf_ctrl.c
+++ b/src/input/net_buf_ctrl.c
@@ -186,19 +186,20 @@ static void dvbspeed_put (nbc_t *this, fifo_buffer_t * fifo, buf_element_t *b) {
int used, mode;
const char *name;
/* select vars */
- if (fifo == this->video_fifo) {
+ mode = b->type & BUF_MAJOR_MASK;
+ if (mode == BUF_VIDEO_BASE) {
last = &this->dvbs_video_in;
fill = &this->dvbs_video_fill;
mode = 0x71;
name = "video";
- } else if (fifo == this->audio_fifo) {
+ } else if (mode == BUF_AUDIO_BASE) {
last = &this->dvbs_audio_in;
fill = &this->dvbs_audio_fill;
mode = 0x0f;
name = "audio";
} else return;
/* update fifo fill time */
- if (b->pts && (b->decoder_flags & BUF_FLAG_FRAME_START)) {
+ if (b->pts) {
if (*last) {
diff = b->pts - *last;
if ((diff > -220000) && (diff < 220000)) *fill += diff;
@@ -261,19 +262,20 @@ static void dvbspeed_get (nbc_t *this, fifo_buffer_t * fifo, buf_element_t *b) {
int used, mode;
const char *name;
/* select vars */
- if (fifo == this->video_fifo) {
+ mode = b->type & BUF_MAJOR_MASK;
+ if (mode == BUF_VIDEO_BASE) {
last = &this->dvbs_video_out;
fill = &this->dvbs_video_fill;
mode = 0x71;
name = "video";
- } else if (fifo == this->audio_fifo) {
+ } else if (mode == BUF_AUDIO_BASE) {
last = &this->dvbs_audio_out;
fill = &this->dvbs_audio_fill;
mode = 0x0f;
name = "audio";
} else return;
/* update fifo fill time */
- if (b->pts && (b->decoder_flags & BUF_FLAG_FRAME_START)) {
+ if (b->pts) {
if (*last) {
diff = b->pts - *last;
if ((diff > -220000) && (diff < 220000)) *fill -= diff;