On Lunes, 17 de Enero de 2011 21:37:06 Reinhard Nissl escribió: > Hi, > > it looks like I can find more time this week to work on vdr-xine. > > I've seen some patches for vdr-xine-0.9.3 (and xine-lib) in the > mailing list which address so far unsupported audio formats if I > recall correctly, as vdr-xine still uses PES and my c*Repackers. > > I'd like to invite you to send them again to me (privately). A > sample recording would be appreciated too. > > Bye. Attached are two patches to play dolby digital plus audio with vdr-xine. One for vdr-xine and another for xine-lib. There is an aditional patch to play dolby digital plus audio with xine-lib and a ts file. Jose Alberto
diff -ur xine-0.9.3/vdr172remux.c xine-0.9.3.new/vdr172remux.c --- xine-0.9.3/vdr172remux.c 2009-04-12 13:52:32.000000000 +0200 +++ xine-0.9.3.new/vdr172remux.c 2010-09-29 01:58:34.798000003 +0200 @@ -1703,8 +1703,20 @@ const uchar *Payload = Data + PesPayloadOffset; const int PayloadCount = Count - PesPayloadOffset; + bool ac3; + int framesize; + unsigned short size; - if (Data[3] == 0xBD && PayloadCount >= 9 && ((Payload[0] & 0xF0) == 0x80) && Payload[4] == 0x0B && Payload[5] == 0x77 && frameSizes[Payload[8]] > 0) { + if (PayloadCount < 10) + return -1; + ac3 = ((Payload[9] >> 3) & 0x1f) <= 10; + if ( ac3) + framesize = frameSizes[Payload[8]]; + else { + size = Payload[7] + Payload[6] * 256; + framesize = ((size & 0x07FF) + 1) << 1; + } + if (Data[3] == 0xBD && ((Payload[0] & 0xF0) == 0x80) && Payload[4] == 0x0B && Payload[5] == 0x77 && framesize > 0) { if (TrackIndex) *TrackIndex = Payload[0] - 0x80; @@ -1860,6 +1872,7 @@ int done = 6 + 3 + Data[8]; int todo = Count - done; const uchar *data = Data + done; + unsigned short size; // look for 0x0B 0x77 <chk1> <chk2> <frameSize> while (todo > 0) { @@ -1906,7 +1919,12 @@ state++; continue; case get_length: - ac3todo = 2 * frameSizes[*data]; + if (((*(data + 1) >> 3) & 0x1f) <= 10) + ac3todo = 2 * frameSizes[*data]; + else { + size = chk2 + chk1 * 256; + ac3todo = ((size & 0x07FF) + 1) << 1; + } // frameSizeCode was invalid => restart searching if (ac3todo <= 0) { // reset PES header instead of using a wrong one @@ -1971,6 +1989,10 @@ int cDolbyRepacker::BreakAt(const uchar *Data, int Count) { + bool ac3; + int framesize; + unsigned short size; + if (initiallySyncing) return -1; // fill the packet buffer completely until we have synced once // enough data for test? @@ -1984,12 +2006,20 @@ if (ac3todo > 0) return headerLen + ac3todo; // enough data for test? - if (Count < headerLen + 5) + if (Count < headerLen + 6) return -1; const uchar *data = Data + headerLen; // break after ac3 frame? - if (data[0] == 0x0B && data[1] == 0x77 && frameSizes[data[4]] > 0) - return headerLen + 2 * frameSizes[data[4]]; + ac3 = ((data[5] >> 3) & 0x1f) <= 10; + if ( ac3) + framesize = 2 * frameSizes[data[4]]; + else { + size = data[3] + data[2] * 256; + framesize = ((size & 0x07FF) + 1) << 1; + } + if (data[0] == 0x0B && data[1] == 0x77 && framesize > 0) + return headerLen + framesize; + return -1; }
diff -r 9679028a161b src/demuxers/demux_mpeg_pes.c --- a/src/demuxers/demux_mpeg_pes.c Wed Jul 21 15:52:00 2010 +0000 +++ b/src/demuxers/demux_mpeg_pes.c Tue Sep 21 00:54:22 2010 +0200 @@ -103,6 +103,7 @@ uint8_t preview_data[ MAX_PREVIEW_SIZE ]; off_t preview_size, preview_done; + uint8_t preview_eac3; } demux_mpeg_pes_t ; typedef struct { @@ -931,10 +932,21 @@ buf->content = p+4; buf->size = this->packet_len-4; - if (track & 0x8) { - buf->type = BUF_AUDIO_DTS + (track & 0x07); /* DVDs only have 8 tracks */ + if (((p[9] >> 3) & 0x1f) <= 10) { + if (track & 0x8) { + buf->type = BUF_AUDIO_DTS + (track & 0x07); /* DVDs only have 8 tracks */ + } else { + buf->type = BUF_AUDIO_A52 + track; + } } else { - buf->type = BUF_AUDIO_A52 + track; + buf->type = BUF_AUDIO_EAC3; + if (this->preview_eac3 < 2) + this->preview_eac3++; + if (this->preview_eac3 == 1) + buf->decoder_flags = BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; + else { + buf->decoder_flags |= BUF_FLAG_FRAME_END; + } } buf->pts = this->pts; if( !this->preview_mode ) @@ -1548,6 +1560,7 @@ */ this->last_cell_time = 0; this->send_newpts = 1; + this->preview_eac3 = 0; if( !playing ) { this->buf_flag_seek = 0;
diff -r 03d01d484189 src/demuxers/demux_ts.c --- a/src/demuxers/demux_ts.c Thu Sep 23 18:19:29 2010 +0100 +++ b/src/demuxers/demux_ts.c Sun Oct 03 23:47:39 2010 +0200 @@ -847,7 +847,6 @@ m->type = BUF_SPU_DVD + spu_id; return 1; } else if ((p[0] & 0xF0) == 0x80) { - m->content = p+4; m->size = packet_len - 4; m->type |= BUF_AUDIO_A52; @@ -969,13 +968,16 @@ m->buf->decoder_info[2] = SPU_DVD_SUBTYPE_PACKAGE; } else { - if (this->numPreview<5) - ++this->numPreview; - if ( this->numPreview==1 ) - m->buf->decoder_flags=BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; - else if ( this->numPreview<5 ) - m->buf->decoder_flags=BUF_FLAG_PREVIEW; - else + if ( (m->buf->type & BUF_AUDIO_BASE) == BUF_AUDIO_BASE) { + if (this->numPreview<5) + ++this->numPreview; + if ( this->numPreview==1 ) + m->buf->decoder_flags=BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; + else if ( this->numPreview<5 ) + m->buf->decoder_flags=BUF_FLAG_PREVIEW; + else + m->buf->decoder_flags |= BUF_FLAG_FRAME_END; + } else m->buf->decoder_flags |= BUF_FLAG_FRAME_END; } m->buf->pts = m->pts; @@ -1033,7 +1035,19 @@ m->buf->extra_info->input_time = (int)((int64_t)this->input->get_current_pos (this->input) * 1000 / (this->rate * 50)); - m->fifo->put(m->fifo, m->buf); + if (this->numPreview > 0) { + if ( (m->buf->type & BUF_AUDIO_BASE) == BUF_AUDIO_BASE) { + if (this->numPreview<5) + ++this->numPreview; + if ( this->numPreview==1 ) + m->buf->decoder_flags=BUF_FLAG_HEADER | BUF_FLAG_FRAME_END; + else if ( this->numPreview<5 ) + m->buf->decoder_flags=BUF_FLAG_PREVIEW; + } + m->fifo->put(m->fifo, m->buf); + } else { + m->buf->free_buffer(m->buf); + } m->buffered_bytes = 0; m->buf = m->fifo->buffer_pool_alloc(m->fifo);
_______________________________________________ vdr mailing list vdr@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr