MediaInfoLib icon indicating copy to clipboard operation
MediaInfoLib copied to clipboard

Adds .NET Core 3.1 Console App project

Open NickDrouin opened this issue 5 years ago • 9 comments

Adds .NET Core 3.1 Console App project with examples for local .Open and .Open_Buffer_Init, as well as a .Open_Buffer_Init example for Azure Storage Blobs.

Uses the MediaInfoDll.cs from #1192

NickDrouin avatar Dec 06 '19 03:12 NickDrouin

Thank you for your PR! Some initial thoughts before I review the PR by testing it:

  • Wondering the reason you create a new project instead of expanding the current MSCS one. Something blocking the usage of the same project?
  • I was stupidly not aware about .gitignore from GitHub, I think I would like to have it in /Project so I handle all VisualStudio subdir, maybe I'll request to remove this file from the PR.

I'll test the PR when I finish urgent tasks I have for the moment.

JeromeMartinez avatar Dec 10 '19 12:12 JeromeMartinez

  • Wondering the reason you create a new project instead of expanding the current MSCS one.

I like the idea of supporting a number of examples using 'dotnet new '.

In fact, I'd much prefer refactoring for a class library, and including the lib in any number of .net project types. A lib would also solve the problem of many instances of MediaInfoDll.cs copied in all the project folders (which do not match each other).

NickDrouin avatar Dec 12 '19 20:12 NickDrouin

  • I was stupidly not aware about .gitignore from GitHub, I think I would like to have it in /Project so I handle all VisualStudio subdir, maybe I'll request to remove this file from the PR.

No problem. Use 'dotnet new gitignore' to get the latest.

NickDrouin avatar Dec 12 '19 20:12 NickDrouin

Hi, I'm trying to interface with MIL also using .NET Core 3.1 in Linux (Debian) and I stumbled on this PR. Sadly the official example nor the one in this PR is working for me when I try to pass a file path with non-ASCII characters to MediaInfo_Open. A path with only ASCII characters works fine.

I've attached an example with which this issue is reproducible: MediaInfoLib.zip

DvdKhl avatar Feb 14 '20 19:02 DvdKhl

@DvdKhl What is the output of your program?

Here (Fedora 31) It's work after changing all DllImport("MediaInfo") to DllImport("mediainfo")

Handle=37284112 UseUTF32Encoding=True
Opening file '/home/maxime/MediaArea/Temp/CS/😢.txt'
File Open Result was 1

g-maxime avatar Feb 14 '20 20:02 g-maxime

I'm getting (even after changing it to "mediainfo"): Handle=19751616 UseUTF32Encoding=True Opening file '/data/Media/AVDump3/Newfolder/😢.txt' File Open Result was 0

DvdKhl avatar Feb 14 '20 20:02 DvdKhl

Not sure if it is important but I build MediaInfo from https://mediaarea.net/download/binary/libmediainfo0/19.09/MediaInfo_DLL_19.09_GNU_FromSource.tar.xz then took the File at "...\MediaInfo_DLL_GNU_FromSource\MediaInfoLib\Project\GNU\Library.libs\libmediainfo.so" and placed it next to the C# dll. This works fine as long as there are only ASCII chars in the filepath argument.

DvdKhl avatar Feb 14 '20 20:02 DvdKhl

I got it to work with some help. After I issued "export LANG=C.UTF-8; export LC_ALL=C.UTF-8" it works.

DvdKhl avatar Feb 14 '20 21:02 DvdKhl

Hey, quick update on this. So the partial parsing is at least two problems. First and easiest, some (new storage SDK) behavior has changed and I needed to pump the stream with a stream-reader -- easy fix, I'll get that up soon. Second, however, seems to be a genuine bug with the lib implementation: If I use a buffer that is as large as the file (or larger), it will only read some of the meta. That is, unless I loop through at least a second time, I will not get the same results analyzing the same file as with the mediainfo.exe / json.

NickDrouin avatar Feb 16 '20 04:02 NickDrouin