jacobbo / WebEye

WebEye is a collection of .NET controls.
190 stars 132 forks source link

lib's libavformat.a #21

Open lwalmeida opened 7 years ago

lwalmeida commented 7 years ago

Hello, I have been studying your project and to compile the project and c++ "StreamPlayer" gives an error in lib's libavformat.a, libavcodec.a and in the others. From where do you generate these lib's to compile the project?

Thanks Luis Wagner de Almeida

jacobbo commented 7 years ago

Hi Luis Wagner,

These files are the FFmpeg library and you need to build them first. You can find instructions on how to do it here: https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC

Regards, Alexander

On Tue, Jan 10, 2017 at 5:42 PM, Luis Wagner de Almeida < notifications@github.com> wrote:

Hello, I have been studying your project and to compile the project and c ++ "StreamPlayer" gives an error in lib's libavformat.a, libavcodec.a and in the others. From where do you generate these lib's to compile the project?

Thanks Luis Wagner de Almeida

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jacobbo/WebEye/issues/21, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvfwPzmc3XS986SrYukxbHXPQ5FL-obks5rQ8MRgaJpZM4Lfskg .

tasoss commented 6 years ago

Hello. I have managed to compile StreamPlayer using the latest ffmpeg version. The dll produced is StreamPlayer.dll. I added it as a resource to the project but LoadLibrary fails. My produced dll is 1.5MB but yours is 11MB. Could you please help me? BTW thanks for the great job!

jacobbo commented 6 years ago

Hi there, I used the following options to build FFmpeg:

// The FFmpeg framework built using the following configuration:
// x64: ./configure --toolchain=msvc --arch=amd64 --target-os=win64 --enable-version3 --enable-static --disable-shared --disable-programs --disable-doc
// x86: ./configure --toolchain=msvc --arch=i386 --enable-version3 --enable-static --disable-shared --disable-programs --disable-doc 
tasoss commented 6 years ago

Very quick reply :) Well my problem is not FFmpeg compilation. It's the dll that is produced by streamplayer (streamplayer.dll) which can't be loaded via LoadLibrary(called in StreamPlayerProxy.cs). Any ideas? :)

jacobbo commented 6 years ago

There are two dlls: streamplayerx86.dll & streamplayerx64.dll. They both are quite big because they link FFmpeg statically. The StreamPlayerControl then loads an appropriate version of the dll (x86 or x64) depending on platform it's running on.

You, probably, are trying to load a x86 dll into a x64 app.

tasoss commented 6 years ago

Ok will recompile everything again and let you know. Thanks again! ps:They(ffmpeg) have deprecated some methods that you are using. I will try to correct a few of them(as much as my c++ knowledge can help) and make a pull request.

jacobbo commented 6 years ago

You can suppress this deprecation stuff using compiler options, as far as I remember.

tasoss commented 6 years ago

Indeed but it would be nice to use their new stuff. BTW are you still working on the control?

jacobbo commented 6 years ago

Not really. My last idea was to use the sources from ffplay.exe (with minimal changes) to render video & audio & subtitles, but that was like a year ago :)

tasoss commented 6 years ago

That's a shame because it's working very very nicely! I would like to see if it's easy to add hardware support. But first things first.Let's try to create the correct dll :)

tasoss commented 6 years ago

I think the part that i'm missing is to statically add ffmpeg to streamplayer.dll. Any advice? :)

jacobbo commented 6 years ago

The procedure is the following:

  1. Build FFmpeg as a static library
  2. Reference it in the C++ project (StreamPlayer.vcxproj)
  3. Build the StreamPlayer.vcxproj project and get StreamPlayer.dll
  4. Add StreamPlayer.dll to the C# project (StreamPlayerControl.csproj) as a resource
  5. Repeat steps 1-4 both for x86 and x64 configs.

You can use the configs from my answer above to build FFmpeg statically both for x86 & x64 platforms.

tasoss commented 6 years ago

Thank you very much you are very kind!! I will try it and let you know. Thanks again!