summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2011-10-05 00:04:37 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2011-10-05 00:04:37 +0100
commit6a2b53c22febcbc2041d760dccd795f388bc10c4 (patch)
treede97a08e2986472c6ce9a93fe92ca61d715edf2c /src
parent5be586e3025e72c1a1cef2a3ada6238486f7ed43 (diff)
parent10d79495d21c47a6c890d501d461b62cb46081e1 (diff)
downloadxine-lib-6a2b53c22febcbc2041d760dccd795f388bc10c4.tar.gz
xine-lib-6a2b53c22febcbc2041d760dccd795f388bc10c4.tar.bz2
Merge from 1.1.
--HG-- rename : src/xine-engine/xine_internal.h => include/xine/xine_internal.h rename : src/demuxers/demux_ogg.c => src/combined/xine_ogg_demuxer.c
Diffstat (limited to 'src')
-rw-r--r--src/combined/xine_ogg_demuxer.c9
-rw-r--r--src/demuxers/demux_aiff.c2
-rw-r--r--src/demuxers/demux_qt.c5
-rw-r--r--src/demuxers/demux_real.c2
-rw-r--r--src/demuxers/demux_ts.c76
-rw-r--r--src/demuxers/demux_tta.c2
-rw-r--r--src/xine-engine/broadcaster.c1
-rw-r--r--src/xine-utils/utils.c1
8 files changed, 36 insertions, 62 deletions
diff --git a/src/combined/xine_ogg_demuxer.c b/src/combined/xine_ogg_demuxer.c
index fa6fd10eb..e297339df 100644
--- a/src/combined/xine_ogg_demuxer.c
+++ b/src/combined/xine_ogg_demuxer.c
@@ -449,6 +449,7 @@ static const struct ogg_meta {
OGG_META (COMMENT, 0),
};
+#if 0
/* ensure that those marked "append" are cleared */
/* FIXME: is this useful? Should they be cleared on first write? */
static void prepare_read_comments (demux_ogg_t *this)
@@ -461,6 +462,7 @@ static void prepare_read_comments (demux_ogg_t *this)
this->meta[metadata[i].meta] = NULL;
}
}
+#endif
static int read_comments (demux_ogg_t *this, const char *comment)
{
@@ -471,9 +473,10 @@ static int read_comments (demux_ogg_t *this, const char *comment)
if (!strncasecmp (metadata[i].tag, comment, ml) && comment[ml]) {
if (metadata[i].append && this->meta[metadata[i].meta]) {
char *newstr;
- asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml);
- free (this->meta[metadata[i].meta]);
- this->meta[metadata[i].meta] = newstr;
+ if (asprintf (&newstr, "%s\n%s", this->meta[metadata[i].meta], comment + ml) >= 0) {
+ free (this->meta[metadata[i].meta]);
+ this->meta[metadata[i].meta] = newstr;
+ }
}
else {
free (this->meta[metadata[i].meta]);
diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c
index 5f7d5cec5..8ddb7b6a4 100644
--- a/src/demuxers/demux_aiff.c
+++ b/src/demuxers/demux_aiff.c
@@ -94,7 +94,7 @@ static int extended_to_int(const unsigned char p[10])
m = (m<<8) + p[2+i];;
e = (((int)p[0]&0x7f)<<8) | p[1];
if (e == 0x7fff && m)
- return 0.0/0.0;
+ return (int)(0.0/0.0);
e -= 16383 + 63;
if (p[0]&0x80)
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index 075eebd9f..85f802a53 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.c
@@ -1744,11 +1744,12 @@ static void get_next_edit_list_entry(qt_trak *trak,
int64_t *edit_list_duration,
unsigned int global_timescale) {
+ *edit_list_media_time = 0;
+ *edit_list_duration = MAX_DURATION;
+
/* if there is no edit list, set to max duration and get out */
if (!trak->edit_list_table) {
- *edit_list_media_time = 0;
- *edit_list_duration = MAX_DURATION;
debug_edit_list(" qt: no edit list table, initial = %d, %"PRId64"\n", *edit_list_media_time, *edit_list_duration);
return;
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index d645215b0..64422b9ad 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -299,7 +299,7 @@ static mdpr_t *real_parse_mdpr(const char *data, const unsigned int size)
goto fail;
mdpr->type_specific_len=_X_BE_32(&data[34+mdpr->stream_name_size+mdpr->mime_type_size]);
- if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_data)
+ if (size < 38 + mdpr->stream_name_size + mdpr->mime_type_size + mdpr->type_specific_len)
goto fail;
mdpr->type_specific_data=xine_memdup(&data[38+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
if (!mdpr->type_specific_data)
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index ff75c3282..af933aeff 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -277,7 +277,6 @@ typedef struct {
int64_t pts;
buf_element_t *buf;
unsigned int counter;
- unsigned int numPreview;
uint16_t descriptor_tag; /* +0x100 for PES stream IDs (no available TS descriptor tag?) */
int corrupted_pes;
uint32_t buffered_bytes;
@@ -351,6 +350,7 @@ typedef struct {
* and audio PIDs, we keep the index of the corresponding entry
* inthe media[] array.
*/
+ unsigned int pcr_pid;
unsigned int videoPid;
unsigned int videoMedia;
@@ -654,6 +654,7 @@ static void demux_ts_parse_pat (demux_ts_t*this, unsigned char *original_pkt,
this->last_pmt_crc = 0;
this->videoPid = INVALID_PID;
this->spu_pid = INVALID_PID;
+ this->pcr_pid = INVALID_PID;
if (this->pmt[program_count] != NULL) {
free(this->pmt[program_count]);
@@ -790,9 +791,8 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type |= BUF_AUDIO_EAC3;
return 1;
- } else if((m->descriptor_tag == STREAM_AUDIO_AC3) || /* ac3 - raw */
- (packet_len > 1 && p[0] == 0x0B && p[1] == 0x77)) { /* ac3 - syncword */
- m->content = p;
+ } else if(m->descriptor_tag == STREAM_AUDIO_AC3) { /* ac3 - raw */
+ m->content = p;
m->size = packet_len;
m->type |= BUF_AUDIO_A52;
return 1;
@@ -840,6 +840,13 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type |= BUF_SPU_DVB;
m->buf->decoder_info[2] = payload_len;
return 1;
+
+ } else if (p[0] == 0x0B && p[1] == 0x77) { /* ac3 - syncword */
+ m->content = p;
+ m->size = packet_len;
+ m->type |= BUF_AUDIO_A52;
+ return 1;
+
} else if ((p[0] & 0xE0) == 0x20) {
spu_id = (p[0] & 0x1f);
@@ -858,9 +865,11 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type |= BUF_AUDIO_A52;
return 1;
+#if 0
+ /* commented out: does not set PCM type. Decoder can't handle raw PCM stream without configuration. */
} else if ((p[0]&0xf0) == 0xa0) {
- int pcm_offset;
+ unsigned int pcm_offset;
for (pcm_offset=0; ++pcm_offset < packet_len-1 ; ){
if (p[pcm_offset] == 0x01 && p[pcm_offset+1] == 0x80 ) { /* START */
@@ -877,6 +886,7 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->size = packet_len-pcm_offset;
m->type |= BUF_AUDIO_LPCM_BE;
return 1;
+#endif
}
} else if ((stream_id & 0xf0) == 0xe0) {
@@ -939,15 +949,6 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
return 0 ;
}
-
-/*
- * Track how many of these types of packets we have seen in this stream.
- */
-static inline unsigned get_preview_frame_number(unsigned *numPreview, unsigned limit) {
- unsigned preview = *numPreview;
- return (preview < limit) ? ++(*numPreview) : preview;
-}
-
/*
* buffer arriving pes data
*/
@@ -979,44 +980,11 @@ static void demux_ts_buffer_pes(demux_ts_t*this, unsigned char *ts,
if (pus) { /* new PES packet */
if (m->buffered_bytes) {
- unsigned previewLimit = 0;
m->buf->content = m->buf->mem;
m->buf->size = m->buffered_bytes;
m->buf->type = m->type;
-
- switch (m->type & BUF_MAJOR_MASK) {
- case BUF_SPU_BASE:
- if( (m->buf->type & (BUF_MAJOR_MASK | BUF_DECODER_MASK)) == BUF_SPU_DVB ) {
- /* TODO: DVBSUB handling needed? */
- }
- break;
-
- case BUF_VIDEO_BASE:
- previewLimit = 5;
- break;
-
- case BUF_AUDIO_BASE:
- previewLimit = 2;
- break;
-
- default:
- break;
- }
-
- if (previewLimit != 0) {
- unsigned numPreview;
-
- numPreview = get_preview_frame_number(&m->numPreview, previewLimit);
-
- if (numPreview == 1)
- m->buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_END;
- else if (numPreview < previewLimit)
- m->buf->decoder_flags = BUF_FLAG_PREVIEW;
- else
- m->buf->decoder_flags |= BUF_FLAG_FRAME_END;
- }
-
+ m->buf->decoder_flags |= BUF_FLAG_FRAME_END;
m->buf->pts = m->pts;
m->buf->decoder_info[0] = 1;
@@ -1097,7 +1065,6 @@ static void demux_ts_pes_new(demux_ts_t*this,
if (m->buf != NULL) m->buf->free_buffer(m->buf);
m->buf = NULL;
m->counter = INVALID_CC;
- m->numPreview = 0;
m->descriptor_tag = descriptor;
m->corrupted_pes = 1;
m->buffered_bytes = 0;
@@ -1612,23 +1579,21 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
section_length -= coded_length;
}
-#if 0
/*
* Get the current PCR PID.
*/
pid = ((this->pmt[program_count][8] << 8)
| this->pmt[program_count][9]) & 0x1fff;
- if (this->pcrPid != pid) {
+ if (this->pcr_pid != pid) {
#ifdef TS_PMT_LOG
- if (this->pcrPid == INVALID_PID) {
+ if (this->pcr_pid == INVALID_PID) {
printf ("demux_ts: PMT pcr pid 0x%.4x\n", pid);
} else {
printf ("demux_ts: PMT pcr pid changed 0x%.4x\n", pid);
}
#endif
- this->pcrPid = pid;
+ this->pcr_pid = pid;
}
-#endif
if ( this->stream->spu_channel>=0 && this->spu_langs_count>0 )
demux_ts_update_spu_channel( this );
@@ -2076,6 +2041,7 @@ static void demux_ts_event_handler (demux_ts_t *this) {
case XINE_EVENT_PIDS_CHANGE:
this->videoPid = INVALID_PID;
+ this->pcr_pid = INVALID_PID;
this->audio_tracks_count = 0;
this->media_num = 0;
this->send_newpts = 1;
@@ -2156,6 +2122,7 @@ static void demux_ts_send_headers (demux_plugin_t *this_gen) {
*/
this->videoPid = INVALID_PID;
+ this->pcr_pid = INVALID_PID;
this->audio_tracks_count = 0;
this->media_num= 0;
this->last_pmt_crc = 0;
@@ -2383,6 +2350,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen,
this->scrambled_npids = 0;
this->videoPid = INVALID_PID;
+ this->pcr_pid = INVALID_PID;
this->audio_tracks_count = 0;
this->last_pmt_crc = 0;
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index 1cd9d55de..1a2f5ca27 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -99,7 +99,7 @@ static int open_tta_file(demux_tta_t *this) {
}
this->seektable = xine_xcalloc(this->totalframes, sizeof(uint32_t));
- this->input->read(this->input, this->seektable, sizeof(uint32_t)*this->totalframes);
+ this->input->read(this->input, (uint8_t*)this->seektable, sizeof(uint32_t)*this->totalframes);
/* Skip the CRC32 */
this->input->seek(this->input, 4, SEEK_CUR);
diff --git a/src/xine-engine/broadcaster.c b/src/xine-engine/broadcaster.c
index 00b38beb3..0c2f2d4b2 100644
--- a/src/xine-engine/broadcaster.c
+++ b/src/xine-engine/broadcaster.c
@@ -64,6 +64,7 @@
#include <xine/xine_internal.h>
#include <xine/buffer.h>
#include <xine/xineutils.h>
+#include "xine_private.h"
#define QLEN 5 /* maximum connection queue length */
#define _BUFSIZ 512
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 27c52c70d..ac89aec14 100644
--- a/src/xine-utils/utils.c
+++ b/src/xine-utils/utils.c
@@ -32,6 +32,7 @@
#ifdef _MSC_VER
#include <xine/xine_internal.h>
#endif
+#include "xine_private.h"
#include <errno.h>
#include <pwd.h>