[Ffmpeg-devel] WMA encoding and Windows Media Player for Mac OS X

Michael Niedermayer michaelni
Thu Mar 8 11:51:47 CET 2007


Hi

On Wed, Mar 07, 2007 at 10:33:22PM -0600, Tyler Loch wrote:
> >changing
> >            int64_t left=  st2->time_base.num * (int64_t)st - 
> >>time_base.den;
> >            int64_t right= st ->time_base.num * (int64_t)st2- 
> >>time_base.den;
> >            if((*next_point)->pkt.dts * left > pkt->dts * right) // 
> >FIXME this can overflow
> >to something like
> >            int64_t left=  st2->time_base.num * (int64_t)st - 
> >>time_base.den;
> >            int64_t right= st ->time_base.num * (int64_t)st2- 
> >>time_base.den;
> >            int64_t leftdts= (*next_point)->pkt.dts;
> >if(st2->codec.codec_type == CODEC_TYPE_AUDIO)
> >    leftts +-= some constant;
> >            if(leftdts * left > pkt->dts * right) //FIXME this can  
> >overflow
> 
> Well, how 'bout that...
> I had some trouble with st2->codec->codec_type detection doing much,  
> but this code works FLAWLESSLY on every WMV player I have access to  
> right now:
> 
>             int64_t left=  st2->time_base.num * (int64_t)st - 
> >time_base.den;
>             int64_t right= st ->time_base.num * (int64_t)st2- 
> >time_base.den;
>             int64_t leftdts = 0;
>             if(leftdts * left > pkt->dts * right) //FIXME this can  
> overflow

well this disables sorting of the packets, or in other words they stay
in exactly the order they where on the input side, and the input can
be ordered arbitrary so while this is a big step forward, it seems
that purely ordering packets differently helps it doesnt give me
any hint on how to order the packets ...

maybe the patch below with some other (positive or negative) value 
for 500 will work?

Index: utils.c
===================================================================
--- utils.c	(revision 8273)
+++ utils.c	(working copy)
@@ -2222,7 +2222,14 @@
             AVStream *st2= s->streams[ (*next_point)->pkt.stream_index];
             int64_t left=  st2->time_base.num * (int64_t)st ->time_base.den;
             int64_t right= st ->time_base.num * (int64_t)st2->time_base.den;
-            if((*next_point)->pkt.dts * left > pkt->dts * right) //FIXME this can overflow
+            int64_t left_dts = (*next_point)->pkt.dts;
+            int64_t right_dts= pkt->dts;
+int delay= 500;
+if(st2->codec->codec_type == CODEC_TYPE_AUDIO)
+    left_dts  -= delay / av_q2d(st2->time_base) / 1000;
+if(st ->codec->codec_type == CODEC_TYPE_AUDIO)
+    right_dts -= delay / av_q2d(st ->time_base) / 1000;
+            if(left_dts * left > right_dts * right) //FIXME this can overflow
                 break;
             next_point= &(*next_point)->next;
         }


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070308/5c7db5af/attachment.pgp>



More information about the ffmpeg-devel mailing list