Tuukka,

My knowledge of lossy formats such as mp3 and wma is limited, but it
seems as though these use differential compression: each "frame" of
compressed data is a difference against the last frame.  So if you have
a sine wave at 440Hz for 60 seconds, with 120 frames, the first frame
would describe the sine wave, and the next 119 frames would say "do
exactly what you did last frame".  This makes it difficult to do random
seeking: you must first establish what the prior frame sounded like, and
that might depend on the frame before.

For my m4a plugin, I found that decoding 4 frames prior was sufficient
for the files I tested.  The code I replaced used 2 frames prior, which
was good enough for a few of my test files.  Documentation on m4a that I
can understand is pretty sparse, though, so it may be necessary to
decode more than 4 frames.

Before I made my seek function decode prior to the seek position, the
plugin worked fine for playing forward, but rewinding made it sound sort
of like a scratched CD: it would play a few ms, then that same few ms
again, then skip forward to the correct position and repeat this.  This
was happening, I think, because I was decoding frames backwards, so when
a compressed frame said "play 20ms of the last frame at offset 15ms",
it was actually playing audio from frame n+1 instead of frame n-1.

My code is here, if you're interested.  It's pretty small and
(hopefully) straightforward:

   
http://bazaar.launchpad.net/~neale/mixxx/m4a/view/head:/mixxx/plugins/soundsourcem4a/soundsourcem4a.cpp


On 8/30/2012, "Tuukka Pasanen" <tuukka.pasa...@ilmi.fi> wrote:

>Hello,
>I've doing a little bit coding with mixxx and ffmpeg lately (works with
>newest ffmpeg). I get ffmpeg soundsource in shape (compiling and almost
>working sound) but because I don't really yet understand all the inner
>things in Mixxx I ask these guestions:
>
>I understand that soundsource I asked some amount of 16 bit PCM data but
>ffmpeg doesn't fit in. Decoded data
>doesn't go as smooth as Mixxx wants. If anybody know what should I do.
>Just drop fewer amount of data or do as
>in mp3 little bit hackery.. that I didn't quite get yet ;).
>
>Where to add more formats: like wma and aac that works with ffmpeg just
>fine? Documents say that method that is supposed
>to tell what format are supported is evil.
>
>Is this even wanted hacking? I've though it would be good to have ffmpeg
>in soundsource because of formats it supports.
>I can't yet see if all the seeking things are fixed. I've been also
>wondering if MLT or Gstreamer would be way to go
>in Soundsource because ffmpeg is kinda diffucult to make work but
>Gstreamer is easier (and support all the formats
>that ffmpeg with plugin) same goes to MLT.
>
>Sorry about not having patch but in the current state of code (because
>playing it's not working correct).. if someone wants it i'll send it..
>
>Thanks,
>Tuukka
>
>------------------------------------------------------------------------------
>Live Security Virtual Conference
>Exclusive live event will cover all the ways today's security and
>threat landscape has changed and how IT managers can respond. Discussions
>will include endpoint security, mobile security and the latest in malware
>threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>_______________________________________________
>Get Mixxx, the #1 Free MP3 DJ Mixing software Today
>http://mixxx.org
>
>
>Mixxx-devel mailing list
>Mixxx-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/mixxx-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Get Mixxx, the #1 Free MP3 DJ Mixing software Today
http://mixxx.org


Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to