On Tue, 07 Jul 2009 05:28:34 -0400, tbartdev <[email protected]>
wrote:
As for hacking the necessary functionality from libaf into your code,
it all depends on the functions and arguments you need. It should be
doable. Figure out which functions do what you need, take a look at the
arguments and how the functions are called in mplayer/mencoder and
affect your data buffers in your code such that they're in the correct
format then do any other initialisation stuff, hook it up and hope for
the best. Or something like that.
he ;->
I am a noob. But I will try. Should I really copy'n'paste the code or is
there some sort of shared library thing that I could do? I saw some
old forum posts about "make"ing just libaf, but as there's no Makefile
in the libaf directory anymore I guess this could be difficult.
I don't need anything special... I just want any multichannel input to
be cut down in some way to two channels. Just to here *something*.
Man.. that's gonna be a dirty hack. Keep your fingers crossed for me!
Each audio sample is one 16-bit integer for each channel. So 4 channel
audio is 8 bytes per sample.
If you want to throw away 2 channels, make a copy of the data buffer and
copy the samples from the channels you want.
i.e.
int16_t *newBuf= malloc(samples * 4); // 4 = 2 channels * 2 bytes each
int16_t *newPos= newBuf, *oldPos= oldBuf;
for (int i=0; i<samples; i++) {
newPos[0]= oldPos[0];
newPos[1]= oldPos[2];
newPos+= 2;
oldPos+= 4;
}
(yes, lots of ways to optimize; code is for explanation ;-)
--
Michael Conrad
IntelliTree Solutions llc.
513-552-6362
[email protected]
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user