How to begin quickly with MediaInfo

Example

What you should do

A quick example, explained line per line in the next chapters (note : with the DLL, and you must adapt it to your language) :

Too long? Try this!

This should be use only if you don't expect all error messages (there will be only one error message for all possible errors) and want to open only one file :
void* Hande=MediaInfo_OpenQuick("**FILENAME**", "**VERSION**;**APP_NAME**;**APP_VERSION**")
MediaInfo_Get (Handle, your options...)
...
MediaInfo_Close(Handle)

Unicode?

As for every modern library, MediaInfo(Lib) support Unicode. With this, you don't mind of the location of your program, to show text. This is Internationalization (I18N), and you can show to the user multiple alphabets (Greek, russian, french...) without coding problems!
You should use the Unicode enabled library and make your program Unicode ready if you start a new program.
Exception : Microsoft Windows command line does not support Unicode, so if you use command line, let use MediaInfo without Unicode.

For the DLL, because only one version of it is released, you have :

Init the library

Internet connection

MediaInfo tries to connect to an Internet server for Update availability of newer DLL, anonymous statistics and retrieving information about a file (Later... To be done)
If for some reasons you don't want this connection, deactivate it.
MediaInfo::Options("Internet", "No")

The version of the library

First, you need to know the version of the DLL.
Because if you have a newer version, you can have crash or unwanted behaviour...
MediaInfo::Options("Info_Version", "**VERSION**;**APP_NAME**;**APP_VERSION**")
**VERSION** is the version of MediaInfo you have tested. Must be like this : "A.B.C.D" (example : "0.7.0.0")
**APP_NAME** is the unique name of your application. Examples : "MediaInfoGUI", "MediaInfoCmd".
**APP_VERSION** is the version of your application. Example : "0.7.0.0", "1.2", "1.26beta1".
Note : if during beta tests, you detect incompatibilities between the library and an old application, contact the MediaInfo developper, he will put the application version in a black list.
The returned string is :

Set the language of the library

The library is by default set in English.
You can change the language with a language string.
MediaInfo::Options("Language", "**LANGUAGE_STRING**")
**LANGUAGE_STRING** is CSV like string :
"Internal name1;translation1
Internal name2;translation2"
Note : when developping, you can have internal names with :
MediaInfo::Options("Language_Get")

Create a new Handle

A Handle must be created before using MediaInfoLib :
"C++" : MediaInfo Handle;
"C" (DLL...) : void* Handle=MediaInfo_New();

Open one or multiple files

Before retrieving information about one or multiples files, you must open them :
MediaInfo::Open("**FILENAME**")
or
MediaInfoList::Open("**FILENAMES**")

Get information

Get a pre-formated text

Standart output

If you want a text output :
MediaInfo::Inform(InformOption_Nothing)

If you want a HTML output :
MediaInfo::Inform(InformOption_HTML)

Customize it

Default is a list of most used pieces of information. But you can customize it :
MediaInfo::Option("Inform", "**YOUR_TEXT**")
MediaInfo::Inform(InformOption_Custom)

**YOUR_TEXT** is a list of items. More information here

Get a piece of information

You can access directly to one wanted piece of information :
MediaInfo::Get (**StreamKind**, **StreamNumber**, **Parameter**, **InfoKind**)
**StreamKind** can be : Stream_General, Stream_Video, Stream_Audio, Stream_Text, Stream_Chapters
**StreamNumber** is the position of the stream you want. example for Audio : 0 if you want the first Audio, 1 if you want the second Audio.
**Parameter** is the name of the piece of information you want. example : "BitRate", "Width"...
**InfoKind** should be set to MediaInfo_Info_Text, except if you want a more advanced interface

Note : when developping, you can have parameters list with :
MediaInfo::Options("Info_Parameters")

Release memory

To release memory, you must delete the handle :
"C++" : Nothing to do, will be deleted at the end of the method
"C" (DLL...) : MediaInfo_Delete(Handle);

Note : You can re-use the Handle for another MediaInfo::Open(Handle, "**FILENAME**") call without deleting something.