FFmpeg and deprecated img_convert

Hi All,
With an upgrade to F8, the FFmpeg wrapper no longer works due to a deprecated img_convert function no longer being built into the RPM's.

I've added a preliminary set of functions to move to the newer sws_scale methodology, with limited results so far:


[DllImport(AVCODEC_NATIVE_LIBRARY, CallingConvention = CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern void sws_freeContext(IntPtr SwsContext);

[DllImport(AVCODEC_NATIVE_LIBRARY, CallingConvention = CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern IntPtr sws_getContext(int source_width, int source_height,
int source_pix_fmt, int dest_width, int dest_height, int dest_pix_fmt, int flags,
IntPtr srcFilter, IntPtr destFilter, IntPtr Param);

[DllImport(AVCODEC_NATIVE_LIBRARY, CallingConvention = CALLING_CONVENTION), SuppressUnmanagedCodeSecurity]
public static extern int sws_scale(IntPtr SwsContext,
IntPtr src,
int[] srcStride,
int srcSliceY, int srcSliceH,
IntPtr dst,
int[] dstStride);

These function calls "work" in the sense of not crashing, but don't yet produce the right set of results in the stream processor:

sws_Context = FFmpeg.sws_getContext(codecContext.width,
codecContext.height,
(int)codecContext.pix_fmt,
codecContext.width,
codecContext.height,
(int)pixFmt,
(int)FFmpeg.SWS_BICUBIC,
IntPtr.Zero,IntPtr.Zero,IntPtr.Zero);

int res = FFmpeg.sws_scale(sws_Context,pFrame, Frame.linesize,0,
codecContext.height, pFrameRGB, FrameRGB.linesize);

The output video from this is scaled vertically as if it was one line high, so the general approach is right, but there's an error here in the function definition somewhere that's causing the output to be messed up.

Here are the original C definitions of the function from FFmpeg:

SwsContext *sws_getContext(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat, int flags,
SwsFilter *srcFilter, SwsFilter *dstFilter, double *param);

int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
int srcSliceH, uint8_t* dst[], int dstStride[]);

Any help in correctly creating the C# wrappers for this would be greatly appreciated.

Thanks,

Euan.

Kinda off-topic, but I

Kinda off-topic, but I finally managed to get MSYS/MinGW running today, so I can build my own, latest FFmpeg binaries. Doing so, I immediatly found out that the api for libavformat has changed recently, so my nice new binaries didn't work Frown. So I picked up TortoiseMerge and compared the last working version with the current SVN and ported the changes to TAO.FFmpeg. You can find the patches and (standard+ogg/vorbis&theora) ffmpeg binaries here.

Do you have SVN access? I

Do you have SVN access? I can add you and you can add the patches. I have one concern about FFmpeg however. since Tao is now finally being put into distros (debian, Suse) the ever-changing API of ffmpeg may become a problem. We may have to link Tao to a certain build of ffmpeg for remember to add conditional compilation tags.

You should be able to find

You should be able to find me as SeaEagle1 on sourceforge. You have a good point about the api changes. I'm going to put the api breaking changes in conditionals to keep backwards compatible. Additions shouldn't be a problem, so those can just be included to prevent too many #ifs.

You have been added a dev.

You have been added a dev. Thanks!

Theme by La Boite a site | Powered by Drupal