I started messing with ffmpeg last night. I found some src for the goal i think in c++.
Mainly just was trying to add audio to the video player you made to see how good it would work.
I am stuck on one line of the c++ that I can't seem to find the correct cast for one of the variables.
I don't know if the lines below this will work till I get this line functional.
code i'm referencing.
https://github.com/gavv/snippets/blob/master/decode_play/ffmpeg_decode.cppline i'm having trouble with.
// convert input frame to output buffer
int got_samples = swr_convert(
swr_ctx,
&buffer, out_samples,
(const uint8_t **)frame->data, frame->nb_samples);
frame->data is the issue. it's throwing an error cannot cast byte_ptrArray8 to byte **.
I'm using ffmpeg.autogen from the NuGet. And the newest ffmpeg 32bit dlls.
Gonna take a break and watch some anime.
--- edit
#define AV_NUM_DATA_POINTERS 8
uint8_t * data [AV_NUM_DATA_POINTERS]// pointer to the picture/channel planes.
https://www.ffmpeg.org/doxygen/2.6/structAVFrame.htmlhttps://www.ffmpeg.org/doxygen/3.0/frame_8h.htmlif i were to make it in c#, i think it would look like
byte*[] data = new byte*[8];
so I did make one of those and copied that data one byte at a time to it. But then I couldn't make byte*[] into byte**;
*shugs*
------
I might of got past this part.. there is a extended_data variable. Which I think is the same thing but it's a byte** instead of the other.
So now it's just getting all this data into a form i can play it back.
----
PROGRESS!!

sound at last!
Sound is playing but it's not in the correct format so it's sounding like garbage

. So I just need to get the code working that converts the sound to 16bit pcm.
i might be celebrating too early after converting and it still sound bad i'll know

====
well I think I was just getting random garbage to play.
swr_convert is returing a -22 didn't notice it at first. I found the errorcode function and turns out that is invalid argument. So I don't think it likes extended data.
I sware i tried using fixed before... It still isn't working but i am sending data.
byte*[] a = frame->data;
int frame_count=0;
fixed (byte** b = a)
{
frame_count = ffmpeg.swr_convert(swr, (byte**)&buffer, frame->nb_samples, b, frame->nb_samples);
if (frame_count < 0)
throw new Exception($"{frame_count} - {averror(frame_count)}");
}
------
I got rid of that error finally. I guess I had a issue with my swr context. Or the channel_layout was 0. I changed both.
