summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_ac3.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_ac3.c')
-rw-r--r--src/demuxers/demux_ac3.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/demuxers/demux_ac3.c b/src/demuxers/demux_ac3.c
index c0fae275b..f13144254 100644
--- a/src/demuxers/demux_ac3.c
+++ b/src/demuxers/demux_ac3.c
@@ -37,6 +37,9 @@
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
#define LOG_MODULE "demux_ac3"
#define LOG_VERBOSE
@@ -304,17 +307,11 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) {
}
} else {
buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->size = this->input->read(this->input, buf->content,
+ buf->size = this->input->read(this->input, buf->content,
this->frame_size);
}
- if (buf->size == 0) {
- buf->free_buffer(buf);
- this->status = DEMUX_FINISHED;
- return this->status;
- }
-
- if (buf->size == 0) {
+ if (buf->size <= 0) {
buf->free_buffer(buf);
this->status = DEMUX_FINISHED;
return this->status;
@@ -322,7 +319,7 @@ static int demux_ac3_send_chunk (demux_plugin_t *this_gen) {
buf->type = this->buf_type;
if( this->input->get_length (this->input) )
- buf->extra_info->input_normpos = (int)( (double) current_stream_pos *
+ buf->extra_info->input_normpos = (int)( (double) current_stream_pos *
65535 / this->input->get_length (this->input) );
buf->extra_info->input_time = audio_pts / 90;
buf->pts = audio_pts;
@@ -417,7 +414,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_ac3_t *this;
- this = xine_xmalloc (sizeof (demux_ac3_t));
+ this = calloc(1, sizeof(demux_ac3_t));
this->stream = stream;
this->input = input;
@@ -491,7 +488,7 @@ static void class_dispose (demux_class_t *this_gen) {
void *demux_ac3_init_plugin (xine_t *xine, void *data) {
demux_ac3_class_t *this;
- this = xine_xmalloc (sizeof (demux_ac3_class_t));
+ this = calloc(1, sizeof(demux_ac3_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;