[MPlayer-dev-eng] [patch] fix SPDIF output on Mac

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Sep 28 20:37:16 CEST 2011


On Wed, Sep 28, 2011 at 09:36:10AM -0700, Hermi Mercury wrote:
> 2011/9/28 Diego Biurrun <diego at biurrun.de>
> 
> > On Mon, Sep 12, 2011 at 11:45:56PM +0200, Diego Biurrun wrote:
> > > On Mon, Aug 22, 2011 at 03:49:47AM +0000, Zongyao Qu wrote:
> > > >
> > > > Recently, I made a fix for Mac users on Mac OS X 10.7.
> > > >
> > > > I didn't test it myself,
> > > > but my users told me that this fixed the SPDIF output problem.
> > > >
> > > > I think I should share it, so other Mac mplayer users will be
> > > > happy with it.
> > > >
> > > > I was told the line width is limited to 80 chars.
> > > > so please refer to the link below to review the patch.
> > > >
> > > > https://www.gitorious.org/mplayer-for-mplayerx/
> > > > mplayer/commit/b41d5d28fe2b2087e94e2facd035efb79dc0e93b
> > >
> > > Please eliminate the tabs and just send your patch here.
> > > git-send-email will do, as will attaching the patch to an email.
> > >
> > > I was told at videolan dev days that this indeed fix problems
> > > for some people, so the patch is desirable.  Would be great if
> > > somebody could test it.  Do you know if it keeps older systems
> > > in working order?
> >
> > I have attached the (whitespace-cleaned-up) patch here for reference.
> > If somebody with a Mac could test or at least compile it, that would
> > be much appreciated.  Otherwise I think I will apply it blind in a
> > few days...
> >
> 
> I have tested this patch (applied to an mplayer2 branch), and it does indeed
> work properly for both AC3 and DTS audio under OS X 10.7.1 and 10.6.7.
>  Though there is a crash bug present when muting the S/PDIF stream.  I have
> proposed a fix for the crash here: http://devel.mplayer2.org/ticket/112

That seems overcomplicated, why not just:
Index: ao_coreaudio.c
===================================================================
--- ao_coreaudio.c      (revision 34128)
+++ ao_coreaudio.c      (working copy)
@@ -133,7 +133,10 @@
 static int read_buffer(unsigned char* data,int len){
   int buffered = av_fifo_size(ao->buffer);
   if (len > buffered) len = buffered;
+  if (data)
   av_fifo_generic_read(ao->buffer, data, len, NULL);
+  else
+    av_fifo_drain(ao->buffer, len);
   return len;
 }
 



More information about the MPlayer-dev-eng mailing list