[MPlayer-dev-eng] MPEG audio pass-through fake decoder

Nico Sabbi nicola_sabbi at fastwebnet.it
Sun Jul 23 00:23:25 CEST 2006


Siarhei Siamashka wrote:

>Hello All,
>
>I'm currently preparing MPlayer port for Nokia 770. Port page is here:
>https://garage.maemo.org/projects/mplayer/
>
>A discussion of this port in the forum is here:
>http://www.internettablettalk.com/forums/showthread.php?t=2405
>
>Now about the issue, Nokia 770 is a very hardware limited device, but has a
>dualcore CPU. One core is ARM and the other is DSP. Most programs including 
>MPlayer use only ARM core (programming for DSP core is not so easy as there is
>no gcc for it, in addition it is 16-bit CPU). Fortunately Nokia 770 already
>has MP3 audio decoder which is implemented in DSP. For programmers this 
>MP3 decoder (actually it is player only) is available via gstreamer API.
>
>So here is where pass-through comes in action. I implemented a gstreamer
>based output module and tried to make ad_hwmpa.c work with it. But 'hwmpa' 
>seems to have several problems:
>1. First it is quite buggy, can crash or hang, and contains some obviously
>broken code.
>  
>

I didn't understand that the output of decode_audio() had to be the
amount of _decoded_ bytes

>2. Second, its output is not very well suited for audio/video synchronization 
>(or I did not understand synchronization code from ao_mpegpes.c), 
>
tomorrow I will hopefully fix it

>in addition
>it seems to fail completely when playing audio only. 
>  
>
unrelated: atm ao_mpegpes.c is usable only in combination with vo_mpegpes.c

>I solved the second problem by padding output data stream so that its size
>matches the size of decoded data and it seems to work perfectly now.
>  
>
why padding? because of the inaccuracy of sh->pts while decoding?

>Unfortunately it introduces incompatibility with current AF_FORMAT_MPEG2 and
>requires a separate fake decoder derived from ad_hwmpeg.c (it can be found in
>ad_dspmp3.c in my Nokia 770 patch). And also I fixed some of the bugs I could
>find. Patch against MPlayer-1.0pre8 can be downloaded here:
>https://garage.maemo.org/frs/?group_id=54
>
>MPlayer patched for Nokia 770 still works on a normal desktop PC well (I tried
>not to break anything). So this gstreamer passthrough stuff can be tested even
>not having Nokia 770 device (you only need to have gstreamer-0.10 installed
>with libmad and alsa support).
>
>I would like ad_hwmpa.c maintainer to have a look at my ad_dspmp3.c file and
>take some fixes from it if he finds them useful (mostly mpa_sync() function). 
>  
>

the major difference in mpa_sync() is that you refill the buffer before 
returning
(but it may not be enough refilled), while I do it in decode_audio(), so
I didn't commit your change

>I know that there are some fixes committed to MPlayer SVN since 1.0pre8
>release, but from looking at the code, looks like some bugs are still there.
>Hopefully this could be of any use.
>  
>
the decode_audio() fix was very useful, but it seems there's a bug in 
your fix:
memcpy(&buf[cnt2], &(sh->a_in_buffer[start]), len);
+        cnt2 += chans * spf * 2;
while cnt2 must be obviously incremented by len alone

>Also I don't like the idea of having several MP3 pass-through modules, it
>seems a bit redundant to me. So I would like to either fix my ao_gst.c module
>to accept AF_FORMAT_MPEG2 (and find a way to solve audio/video synchronization
>and seeking issues) in the future. 
>
as above

>Another option is to change AF_FORMAT_MPEG2
>to a padded version (such as AF_FORMAT_PADDED_MPEG2 in my patch) and tweak
>ao_mpegpes.c and other output modules to use it. As I don't have any hardware
>that could work used with AF_FORMAT_MPEG2, I would like to hear your opinion
>if it is possible and if it has any use.
>
>Thanks.
>  
>
thanks,

    Nico



More information about the MPlayer-dev-eng mailing list