Mailing List archive

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

[vdr] Re: dvd-0.3.3-jau-p2 (audio-id patch)



On Thu, Oct 02, 2003 at 01:58:29PM +0200, Andreas Schultz wrote:
> On Thursday 02 October 2003 3:45 am, Sven Goethel wrote:
> 
> [...]
> 
> > i just did not know, that
> >               ((dvdnav_audio_stream_change_event_t *)cache_ptr)->physical
> > and
> > 	      dvdnav_get_active_audio_stream(nav)
> >
> > are the same - are they ? ;-)
> 
> they are. there is also the logical stream, which could be used to find more 
> information about the current stream (like language and audio format). 
> However, libdvdnav is not exporting an interface to access those information.
> 
> > and is it enough to do it "just" for the DVDNAV_AUDIO_STREAM_CHANGE ?
> > i guess it must being detected at least for DVDNAV_VTS_CHANGE, as well.
> 

One patch more which avoids trouble with some DVD, the dvd plugin, and
bitstreamout plugin reported to me.  It seems that some DVD include
a padding stream and during channel switch the bitstreamout plugin
get decoded AC3 streams via PlayAudio().

I suppose a patch like in the attachment (this one is untested) ;^)

        Werner
--- player-dvd.c
+++ player-dvd.c	2003-10-02 17:51:50.000000000 +0200
@@ -283,8 +283,11 @@
       if (blk_size > 0) {
 	  int res = PlayVideo(write_blk + blk_offs, blk_size);
 	  if (res < 0) {
-	      esyslog("ERROR: PlayVideo, %s (workaround activ)\n", strerror(errno));
-	      DeviceClear();
+	      if (errno != EAGAIN && errno != EINTR) {
+		  esyslog("ERROR: PlayVideo, %s (workaround activ)\n", strerror(errno));
+		  DeviceClear();
+	      }
+	      continue;
 	  }
 	  if (res > 0) {
 	      blk_size -= res;
@@ -681,8 +684,28 @@
 		      lapts = pktpts;
 		  }
 		  if (audio_stream == (*data & 7)) {
-		      if ( !(playMULTICHANNEL) )
-			  PlayAudio(sector, r);                      // push it to the audio plugins
+		      if ( !(playMULTICHANNEL) ) {
+			  uchar *b = sector;
+			  for (int i = 0; i < r - 6; i++) {
+			       if (b[i] == 0 && b[i+1] == 0 && b[i+2] == 1) {
+				   int len = (((int)b[4]<<8)|b[5])+6;
+				   switch (b[i+3]) {
+				   case 0xBD:		     // push it to the audio plugins
+					if ((data[0] & 0xF8) == aLPCM && data[2] == 0 && data[3] == 0)
+					    break;	     // Skip decoded audio stream
+					PlayAudio(b, len);
+					break;
+				   case 0xBE:		     // Skip padding stream
+					break;
+				   default:
+					len = 0;
+					break;
+				   }
+				   if (len)
+				       i += len -1;
+			       }
+			  }
+		      }
 		      if ((*data & 0xF8) == aLPCM || playMULTICHANNEL) {
 			      write_blk = cache_buf;
 			      blk_offs = sector - cache_buf;
@@ -691,13 +714,14 @@
 			      cache_buf = 0;
 			      if (pktpts)
 				  seenPTS(pktpts);
-		      } else
-			  if ((*data & 0xF8) == aAC3) {
+
+		      } else if ((*data & 0xF8) == aAC3) {
+
 			      data += 4;
 			      // header: 3 (mandatory) + 6 (PS) + 4 (AC3)
 			      datalen -= 13;
 			      a52dec.decode(data, datalen, pktpts);
-			  }
+		      }
 		  }
 		  break;
 	     case 0x20:

Home | Main Index | Thread Index