summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_mpeg_pes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_mpeg_pes.c')
-rw-r--r--src/demuxers/demux_mpeg_pes.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c
index 423da5e24..b7c0e7e6d 100644
--- a/src/demuxers/demux_mpeg_pes.c
+++ b/src/demuxers/demux_mpeg_pes.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2006 the xine project
+ * Copyright (C) 2000-2008 the xine project
*
* This file is part of xine, a free video player.
*
@@ -257,7 +257,6 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode)
uint8_t *p;
int32_t result;
off_t i;
- int32_t n;
uint8_t buf6[ 6 ];
this->scr = 0;
@@ -274,7 +273,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode)
while ((p[2] != 1) || p[0] || p[1]) {
/* resync code */
- for(n=0;n<5;n++) p[n]=p[n+1];
+ memmove(p, p+1, 5);
i = read_data(this, p+5, (off_t) 1);
if (i != 1) {
this->status = DEMUX_FINISHED;
@@ -306,8 +305,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode)
p = buf->mem;
/* copy local buffer to fifo element. */
- for (n = 0; n < sizeof (buf6); n++)
- p[ n ] = buf6[ n ];
+ memcpy(p, buf6, sizeof(buf6));
if (preview_mode)
buf->decoder_flags = BUF_FLAG_PREVIEW;
@@ -1613,7 +1611,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
input_plugin_t *input = (input_plugin_t *) input_gen;
demux_mpeg_pes_t *this;
- this = xine_xmalloc (sizeof (demux_mpeg_pes_t));
+ this = calloc(1, sizeof(demux_mpeg_pes_t));
this->stream = stream;
this->input = input;
@@ -1688,7 +1686,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
if (((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) != 0) ) {
input->seek(input, 0, SEEK_SET);
- if (input->read(input, (char *)this->scratch, 6)) {
+ if (input->read(input, (char *)this->scratch, 6) == 6) {
lprintf("open_plugin:read worked\n");
if (this->scratch[0] || this->scratch[1]
@@ -1786,7 +1784,7 @@ static void class_dispose (demux_class_t *this_gen) {
static void *init_plugin (xine_t *xine, void *data) {
demux_mpeg_pes_class_t *this;
- this = xine_xmalloc (sizeof (demux_mpeg_pes_class_t));
+ this = calloc(1, sizeof(demux_mpeg_pes_class_t));
this->config = xine->config;
this->xine = xine;