summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_slave.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_slave.c')
-rw-r--r--src/demuxers/demux_slave.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c
index 436d37579..de530f224 100644
--- a/src/demuxers/demux_slave.c
+++ b/src/demuxers/demux_slave.c
@@ -2,19 +2,19 @@
* Copyright (C) 2000-2003 the xine project
* May 2003 - Miguel Freitas
* This plugin was sponsored by 1Control
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -51,7 +51,7 @@
#define CHECK_VPTS_INTERVAL 2*90000
#define NETWORK_PREBUFFER 90000
-typedef struct {
+typedef struct {
demux_plugin_t demux_plugin;
xine_stream_t *stream;
@@ -86,14 +86,15 @@ static int demux_slave_next (demux_slave_t *this) {
char fifo_name[11];
uint8_t *p, *s;
int64_t curvpts;
-
+
/* fill the scratch buffer */
n = this->input->read(this->input, &this->scratch[this->scratch_used],
SCRATCH_SIZE - this->scratch_used);
- this->scratch_used += n;
+ if (n > 0)
+ this->scratch_used += n;
this->scratch[this->scratch_used] = '\0';
- if( !n ) {
+ if (n <= 0) {
lprintf("connection closed\n");
this->status = DEMUX_FINISHED;
return 0;
@@ -186,10 +187,8 @@ static int demux_slave_next (demux_slave_t *this) {
buf->decoder_flags = decoder_flags;
/* set decoder info */
- for( i = 0; i < BUF_NUM_DEC_INFO; i++ ) {
- buf->decoder_info[i] = this->decoder_info[i];
- buf->decoder_info_ptr[i] = this->decoder_info_ptr[i];
- }
+ memcpy(buf->decoder_info, this->decoder_info, sizeof(this->decoder_info));
+ memcpy(buf->decoder_info_ptr, this->decoder_info_ptr, sizeof(this->decoder_info));
memset(this->decoder_info, 0, sizeof(this->decoder_info));
memset(this->decoder_info_ptr, 0, sizeof(this->decoder_info_ptr));
@@ -331,7 +330,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_slave_t *this;
static char slave_id_str[] = "master xine v1\n";
- this = xine_xmalloc (sizeof (demux_slave_t));
+ this = calloc(1, sizeof(demux_slave_t));
switch (stream->content_detection_method) {
@@ -414,7 +413,7 @@ static void class_dispose (demux_class_t *this_gen) {
static void *init_plugin (xine_t *xine, void *data) {
demux_slave_class_t *this;
- this = xine_xmalloc (sizeof (demux_slave_class_t));
+ this = calloc(1, sizeof(demux_slave_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;
@@ -434,7 +433,7 @@ static const demuxer_info_t demux_info_slave = {
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_DEMUX, 26, "slave", XINE_VERSION_CODE, &demux_info_slave, init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};