I would like to use MediaInfo in my application. I have used it in my older Python program (I contributed the first Python wrapper version which was written by a friend of mine). Now I have learned some C++ basics and I would like to use the library.
I work on a player written using QtCreator in QML/C++ which currently uses TagLib. But I would like to use MediaInfo too. So this is what I did:
1) I downloaded the MediaInfo source, opened the Qt project a compiled the library. I got a static .a library.
2) I downloaded the win32 release and put the .h file to ../mediainfo/include, the .dll to ../mediainfo/bin and finally put the .a and .dll to ../mediainfo/lib
3) I added the library to my project using the wizard in QtCreator
4) I added the line #include <MediaInfoDLL.h> to my header file
Up to here everything went fine. But as soon as I trid to initialize the library using MediaInfo MI; I got this error:
C:\QtProjects\Muzika\3rdparty\mediainfo\include\MediaInfoDLL.h:342: Error: cannot convert 'const char*' to 'LPCWSTR {aka const wchar_t*}' for argument '1' to 'HINSTANCE__* LoadLibraryW(LPCWSTR)'
MediaInfo_Module = LoadLibrary(MEDIAINFODLL_NAME);
^
I understand it has something to do with Unicode support. But from the error I understood it is complaining about the MEDIAINFODLL_NAME type which is defined within the header. Since I don't have much C++ experience I'm not able to figure what is worng and how should I fix it.
I also don't know if the steps I did were correct or not. Could you help me, please?
I should also mention that my primary development platform is Windows but I also use Linux. The target platforms are Windows, desktop Linux and Android. I read it should be possible to compile the library for Android too.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1) I downloaded the MediaInfo source, opened the Qt project a compiled the library. I got a static .a library.
the static version is not usable with MediaInfoDLL/MediaInfoDLL.h, prefer MediaInfoDLL/MediaInfo.h or compile an .so (I don't know with tht Qt project, I use automake for it).
But as soon as I trid to initialize the library using MediaInfo MI; I got this error:
Very weird, as it looks like _UNICODE definition is not set but Windows API is in Unicode. I need to find a way for detecting Unicode API better.
In the meanwhile, I think that adding :
#define _UNICODE
before your #include should fix the issue.
I read it should be possible to compile the library for Android too.
I heard that some people already did that, but this is currently not officially supported (there are plans for that in the future but is not a priority right now).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks a lot regarding the solution with adding #define _UNICODE. That solved the issue.
I had some further issues with converting from/to QString but I was able to sort these problems and now everything works.
The next challenge will be the Android version. I already did it successfully with the TagLib library but it was a lot of work. Furthermore I have no experience with automake.
I was able to compile the statical library for Android using QtCreator. But I don't know how to switch it to compile a shared (.so) library. Furthermore as Android doesn't support library versions it can't have any. Do you have any idea how to do that? Or should I better ask at Qt forum?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have very little experience in Qt and no experience in Android, so you are on you own.
But if you do the work, we are interested in an "how to" and/or code! (could be also sponsored)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found two projects with MediaInfo Android port. The first one is here and the second here. The second project even has already compiled Android library so I just used it.
Now during execution and library loading I get this error: E/linker ( 3296): "libmediainfo.so": ignoring 2-entry DT_PREINIT_ARRAY in shared library!
But I think the problem why it doesn't work is even somewhere else. I was always getting the answer "Unable to load libmediainfo.so" whenever I called the library. I ended with my debugging in these lines:
Unfortunately because of my limitted C/C++ knowledge I don't understand what these lines do. Anyway the result is that the Errors couter is incremented (it ends on 28). Do you have any idea what could be the problem?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The library is found. So far it is working. But the association of functions fails. And it is apparently because the fucntions like (New, Open, Inform etc.) are simply not there. This is what I got using objdump:
Hi,
I would like to use MediaInfo in my application. I have used it in my older Python program (I contributed the first Python wrapper version which was written by a friend of mine). Now I have learned some C++ basics and I would like to use the library.
I work on a player written using QtCreator in QML/C++ which currently uses TagLib. But I would like to use MediaInfo too. So this is what I did:
1) I downloaded the MediaInfo source, opened the Qt project a compiled the library. I got a static .a library.
2) I downloaded the win32 release and put the .h file to ../mediainfo/include, the .dll to ../mediainfo/bin and finally put the .a and .dll to ../mediainfo/lib
3) I added the library to my project using the wizard in QtCreator
4) I added the line #include <MediaInfoDLL.h> to my header file
Up to here everything went fine. But as soon as I trid to initialize the library using MediaInfo MI; I got this error:
I understand it has something to do with Unicode support. But from the error I understood it is complaining about the MEDIAINFODLL_NAME type which is defined within the header. Since I don't have much C++ experience I'm not able to figure what is worng and how should I fix it.
I also don't know if the steps I did were correct or not. Could you help me, please?
I should also mention that my primary development platform is Windows but I also use Linux. The target platforms are Windows, desktop Linux and Android. I read it should be possible to compile the library for Android too.
the static version is not usable with MediaInfoDLL/MediaInfoDLL.h, prefer MediaInfoDLL/MediaInfo.h or compile an .so (I don't know with tht Qt project, I use automake for it).
Very weird, as it looks like _UNICODE definition is not set but Windows API is in Unicode. I need to find a way for detecting Unicode API better.
In the meanwhile, I think that adding :
#define _UNICODE
before your #include should fix the issue.
I heard that some people already did that, but this is currently not officially supported (there are plans for that in the future but is not a priority right now).
Thanks a lot regarding the solution with adding #define _UNICODE. That solved the issue.
I had some further issues with converting from/to QString but I was able to sort these problems and now everything works.
The next challenge will be the Android version. I already did it successfully with the TagLib library but it was a lot of work. Furthermore I have no experience with automake.
I was able to compile the statical library for Android using QtCreator. But I don't know how to switch it to compile a shared (.so) library. Furthermore as Android doesn't support library versions it can't have any. Do you have any idea how to do that? Or should I better ask at Qt forum?
We have very little experience in Qt and no experience in Android, so you are on you own.
But if you do the work, we are interested in an "how to" and/or code! (could be also sponsored)
I found two projects with MediaInfo Android port. The first one is here and the second here. The second project even has already compiled Android library so I just used it.
Now during execution and library loading I get this error:
E/linker ( 3296): "libmediainfo.so": ignoring 2-entry DT_PREINIT_ARRAY in shared library!
But I think the problem why it doesn't work is even somewhere else. I was always getting the answer "Unable to load libmediainfo.so" whenever I called the library. I ended with my debugging in these lines:
Unfortunately because of my limitted C/C++ knowledge I don't understand what these lines do. Anyway the result is that the Errors couter is incremented (it ends on 28). Do you have any idea what could be the problem?
the dlsym() just says that it does not find the mediainfo library (=the .so is not in the library paths).
You are on your own here.
The library is found. So far it is working. But the association of functions fails. And it is apparently because the fucntions like (New, Open, Inform etc.) are simply not there. This is what I got using objdump:
Is this familiar to you?