summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers')
-rw-r--r--src/demuxers/demux_ts.c17
-rw-r--r--src/demuxers/demux_tta.c66
2 files changed, 60 insertions, 23 deletions
diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c
index 3e15b2907..9053db60d 100644
--- a/src/demuxers/demux_ts.c
+++ b/src/demuxers/demux_ts.c
@@ -807,6 +807,18 @@ static int demux_ts_parse_pes_header (xine_t *xine, demux_ts_media *m,
m->type |= BUF_AUDIO_DTS;
return 1;
+ } else if (m->descriptor_tag == HDMV_AUDIO_80_PCM) {
+
+ m->content = p + 4;
+ m->size = packet_len - 4;
+ m->type |= BUF_AUDIO_LPCM_BE;
+
+ m->buf->decoder_flags |= BUF_FLAG_SPECIAL;
+ m->buf->decoder_info[1] = BUF_SPECIAL_LPCM_CONFIG;
+ m->buf->decoder_info[2] = (p[3]<<24) | (p[2]<<16) | (p[1]<<8) | p[0];
+
+ return 1;
+
} else if (m->descriptor_tag == ISO_13818_PES_PRIVATE
&& p[0] == 0x20 && p[1] == 0x00) {
/* DVBSUB */
@@ -1525,7 +1537,10 @@ printf("Program Number is %i, looking for %i\n",program_number,this->program_num
demux_ts_get_reg_desc(this, &format_identifier,
stream + 5, stream_info_length);
/* If no format identifier, assume A52 */
- if ((format_identifier == 0x41432d33) || (format_identifier == 0)) {
+ if (( format_identifier == 0x41432d33) ||
+ ( format_identifier == 0) ||
+ ((format_identifier == 0x48444d56 || this->hdmv>0) && stream[0] == HDMV_AUDIO_80_PCM) /* BluRay PCM */) {
+
demux_ts_pes_new(this, this->media_num, pid, this->audio_fifo, stream[0]);
this->audio_tracks[this->audio_tracks_count].pid = pid;
this->audio_tracks[this->audio_tracks_count].media_index = this->media_num;
diff --git a/src/demuxers/demux_tta.c b/src/demuxers/demux_tta.c
index 8f8f954d5..ada6cab30 100644
--- a/src/demuxers/demux_tta.c
+++ b/src/demuxers/demux_tta.c
@@ -65,7 +65,7 @@ typedef struct {
uint16_t channels;
uint16_t bits_per_sample;
uint32_t samplerate;
- uint32_t data_length;
+ uint32_t data_length; /* Number of samples */
uint32_t crc32;
} XINE_PACKED tta;
uint8_t buffer[22]; /* This is the size of the header */
@@ -114,7 +114,7 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) {
demux_tta_t *this = (demux_tta_t *) this_gen;
uint32_t bytes_to_read;
- if ( this->currentframe > this->totalframes ) {
+ if ( this->currentframe >= this->totalframes ) {
this->status = DEMUX_FINISHED;
return this->status;
}
@@ -129,7 +129,7 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) {
buf = this->audio_fifo->buffer_pool_alloc(this->audio_fifo);
buf->type = BUF_AUDIO_TTA;
buf->pts = 0;
- buf->extra_info->total_time = this->totalframes;
+ buf->extra_info->total_time = (int)(le2me_32(this->header.tta.data_length) * 1000.0 / le2me_32(this->header.tta.samplerate)); /* milliseconds */
buf->decoder_flags = 0;
/* Set normalised position */
@@ -163,6 +163,12 @@ static int demux_tta_send_chunk(demux_plugin_t *this_gen) {
static void demux_tta_send_headers(demux_plugin_t *this_gen) {
demux_tta_t *this = (demux_tta_t *) this_gen;
buf_element_t *buf;
+ xine_waveformatex wave;
+ uint32_t total_size = sizeof(xine_waveformatex) + sizeof(this->header) +
+ sizeof(uint32_t)*this->totalframes;
+ unsigned char *header;
+
+ header = malloc(total_size);
this->audio_fifo = this->stream->audio_fifo;
@@ -180,27 +186,43 @@ static void demux_tta_send_headers(demux_plugin_t *this_gen) {
/* send start buffers */
_x_demux_control_start(this->stream);
- /* send init info to decoders */
- if (this->audio_fifo) {
- xine_waveformatex wave;
-
- buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
- buf->type = BUF_AUDIO_TTA;
- buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER|BUF_FLAG_FRAME_END;
- buf->decoder_info[0] = 0;
- buf->decoder_info[1] = le2me_32(this->header.tta.samplerate);
- buf->decoder_info[2] = le2me_16(this->header.tta.bits_per_sample);
- buf->decoder_info[3] = le2me_16(this->header.tta.channels);
+ /* create header */
+ wave.cbSize = total_size - sizeof(xine_waveformatex);
- buf->size = sizeof(xine_waveformatex) + sizeof(this->header) + sizeof(uint32_t)*this->totalframes;
- memcpy(buf->content+sizeof(xine_waveformatex), this->header.buffer, sizeof(this->header));
- memcpy(buf->content+sizeof(xine_waveformatex)+sizeof(this->header), this->seektable, sizeof(uint32_t)*this->totalframes);
+ memcpy(header, &wave, sizeof(wave));
+ memcpy(header+sizeof(xine_waveformatex), this->header.buffer, sizeof(this->header));
+ memcpy(header+sizeof(xine_waveformatex)+sizeof(this->header), this->seektable, sizeof(uint32_t)*this->totalframes);
- wave.cbSize = buf->size - sizeof(xine_waveformatex);
- memcpy(buf->content, &wave, sizeof(wave));
-
- this->audio_fifo->put (this->audio_fifo, buf);
+ /* send init info to decoders */
+ if (this->audio_fifo) {
+ uint32_t bytes_left = total_size;
+
+ /* We are sending the seektable as well, and this may be larger than
+ buf->max_size */
+ while (bytes_left) {
+ buf = this->audio_fifo->buffer_pool_alloc (this->audio_fifo);
+ buf->decoder_flags = BUF_FLAG_HEADER|BUF_FLAG_STDHEADER;
+ buf->type = BUF_AUDIO_TTA;
+
+ /* Copy min(bytes_left, max_size) bytes */
+ buf->size = bytes_left < buf->max_size ? bytes_left : buf->max_size;
+ memcpy(buf->content, header+(total_size-bytes_left), buf->size);
+
+ bytes_left -= buf->size;
+
+ /* The decoder information only needs the decoder information on the last
+ buffer element. */
+ if (!bytes_left) {
+ buf->decoder_flags |= BUF_FLAG_FRAME_END;
+ buf->decoder_info[0] = 0;
+ buf->decoder_info[1] = le2me_32(this->header.tta.samplerate);
+ buf->decoder_info[2] = le2me_16(this->header.tta.bits_per_sample);
+ buf->decoder_info[3] = le2me_16(this->header.tta.channels);
+ }
+ this->audio_fifo->put (this->audio_fifo, buf);
+ }
}
+ free(header);
}
static int demux_tta_seek (demux_plugin_t *this_gen,
@@ -258,7 +280,7 @@ static int demux_tta_get_status (demux_plugin_t *this_gen) {
static int demux_tta_get_stream_length (demux_plugin_t *this_gen) {
demux_tta_t *this = (demux_tta_t *) this_gen;
- return (int)(FRAME_TIME * this->totalframes * 1000);
+ return le2me_32(this->header.tta.data_length) * 1000.0 / le2me_32(this->header.tta.samplerate); /* milliseconds */
}
static uint32_t demux_tta_get_capabilities(demux_plugin_t *this_gen) {