Re: vdr xine-lib eac3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El Domingo, 13 de Junio de 2010, Luca Olivetti escribió:
> Al 25/03/10 16:08, En/na Jose Alberto Reguero ha escrit:
> > Patch for xine-lib that don't need to patch remux.c to work.
> 
> Today I applied this patch (strange it isn't in xine-lib-1.2 yet) but
> there's still no sound on tvehd (vdr 1.7.15, vdr-xine and playing the ts
> directly through xine).
> Do I need some special options to configure xine-lib for this patch to
> take effect?
> 
> Bye

With this two patches vdr-xine work with eac3. I can't test if it still work 
with normal ac3. One patch is for the plugin, and the other is for xine-lib 
1.2.

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-20 23:49:10.199000014 +0200
@@ -1703,8 +1703,17 @@
 
   const uchar *Payload = Data + PesPayloadOffset;
   const int PayloadCount = Count - PesPayloadOffset;
+  bool ac3;
+  int framesize;
 
-  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
+     framesize = (Payload[7] + 1) << 1;
+  if (Data[3] == 0xBD && ((Payload[0] & 0xF0) == 0x80) && Payload[4] == 0x0B && Payload[5] == 0x77 && framesize > 0) {
      if (TrackIndex)
         *TrackIndex = Payload[0] - 0x80;
 
@@ -1906,7 +1915,10 @@
                state++;
                continue;
           case get_length:
-               ac3todo = 2 * frameSizes[*data];
+               if (((*(data + 1) >> 3) & 0x1f) <= 10)
+                  ac3todo = 2 * frameSizes[*data];
+               else
+                  ac3todo = (*(data - 1) + 1) << 1;
                // frameSizeCode was invalid => restart searching
                if (ac3todo <= 0) {
                   // reset PES header instead of using a wrong one
@@ -1971,6 +1983,9 @@
 
 int cDolbyRepacker::BreakAt(const uchar *Data, int Count)
 {
+  bool ac3;
+  int framesize;
+
   if (initiallySyncing)
      return -1; // fill the packet buffer completely until we have synced once
   // enough data for test?
@@ -1984,12 +1999,18 @@
   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
+     framesize = (data[3] + 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;
_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux