MediaInfoLib: MediaInfoLib::MediaInfo Class Reference

MediaInfoLib 0.7

Public Member Functions | Static Public Member Functions | List of all members
MediaInfoLib::MediaInfo Class Reference

MediaInfo. More...

`#include <MediaInfo.h>`

## Public Member Functions
size_t | Open (const String &File_Name)
| Open a file. More...
size_t | Open (const ZenLib::int8u *Begin, size_t Begin_Size, const ZenLib::int8u *End=NULL, size_t End_Size=0, ZenLib::int64u File_Size=0)
| Open a buffer. More...
size_t | Open_Buffer_Init (ZenLib::int64u File_Size=(ZenLib::int64u) -1, ZenLib::int64u File_Offset=0)
| Open a stream (Init) More...
size_t | Open_Buffer_Continue (const ZenLib::int8u *Buffer, size_t Buffer_Size)
| Open a stream (Continue) More...
ZenLib::int64u | Open_Buffer_Continue_GoTo_Get ()
| Open a stream (Get the needed file Offset) More...
size_t | Open_Buffer_Finalize ()
| Open a stream (Finalize) More...
size_t | Open_NextPacket ()
| Read one packet (if "PerPacket" mode is set) More...
size_t | Save ()
| (NOT IMPLEMENTED YET) Save the file More...
void | Close ()
| Close a file. More...
String | Inform (size_t Reserved=0)
| Get all details about a file. More...
String | Get (stream_t StreamKind, size_t StreamNumber, size_t Parameter, info_t InfoKind=Info_Text)
| Get a piece of information about a file (parameter is an integer) More...
String | Get (stream_t StreamKind, size_t StreamNumber, const String &Parameter, info_t InfoKind=Info_Text, info_t SearchKind=Info_Name)
| Get a piece of information about a file (parameter is a string) More...
size_t | Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=String())
| (NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an int) More...
size_t | Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=String())
| (NOT IMPLEMENTED YET) Set information about a file (parameter is a string) More...
size_t | Output_Buffer_Get (const String &Value)
| Output the written size when "File_Duplicate" option is used. More...
size_t | Output_Buffer_Get (size_t Pos)
| Output the written size when "File_Duplicate" option is used. More...
String | Option (const String &Option, const String &Value=String())
size_t | State_Get ()
| (NOT IMPLEMENTED YET) Get the state of the library More...
size_t | Count_Get (stream_t StreamKind, size_t StreamNumber=(size_t) -1)
| Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream. More...

## Static Public Member Functions
static String | Option_Static (const String &Option, const String &Value=String())

## Detailed Description

MediaInfo.

Version
  0.7

Definition at line 50 of file MediaInfo.h.

## Member Function Documentation

## ◆ Close()

void MediaInfoLib::MediaInfo::Close | ( |  | ) |

Close a file.

Close a file opened before with Open() (without saving)

Warning
  without have saved before, modifications are lost

## ◆ Count_Get()

size_t MediaInfoLib::MediaInfo::Count_Get | ( | stream_t | StreamKind,
|  | size_t | StreamNumber = `(size_t) -1`
| ) |  |

Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream.

Parameters

  StreamKind | Kind of stream (general, video, audio...)
  StreamNumber | Stream number in this kind of stream (first, second...)

Returns
  The count of fields for this stream kind / stream number if stream number is provided, else the count of streams for this stream kind

## ◆ Get() [1/2]

String MediaInfoLib::MediaInfo::Get | ( | stream_t | StreamKind,
|  | size_t | StreamNumber,
|  | const String & | Parameter,
|  | info_t | InfoKind = `Info_Text`,
|  | info_t | SearchKind = `Info_Name`
| ) |  |

Get a piece of information about a file (parameter is a string)

Get a piece of information about a file (parameter is a string)

Parameters

  StreamKind | Kind of stream (general, video, audio...)
  StreamNumber | Stream number in Kind of stream (first, second...)
  Parameter | Parameter you are looking for in the stream (Codec, width, bitrate...), in string format ("Codec", "Width"...) See MediaInfo::Option("Info_Parameters") to have the full list
  InfoKind | Kind of information you want about the parameter (the text, the measure, the help...)
  SearchKind | Where to look for the parameter

Returns
  a string about information you search
  an empty string if there is a problem

## ◆ Get() [2/2]

String MediaInfoLib::MediaInfo::Get | ( | stream_t | StreamKind,
|  | size_t | StreamNumber,
|  | size_t | Parameter,
|  | info_t | InfoKind = `Info_Text`
| ) |  |

Get a piece of information about a file (parameter is an integer)

Get a piece of information about a file (parameter is an integer)

Parameters

  StreamKind | Kind of stream (general, video, audio...)
  StreamNumber | Stream number in Kind of stream (first, second...)
  Parameter | Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...) This integer is arbitarily assigned by the library, so its consistency should not be relied on, but is useful when looping through all the parameters
  InfoKind | Kind of information you want about the parameter (the text, the measure, the help...)

Returns
  a string about information you search
  an empty string if there is a problem

## ◆ Inform()

String MediaInfoLib::MediaInfo::Inform | ( | size_t | Reserved = `0` | ) |

Get all details about a file.

Get all details about a file in one string

Parameters

  Reserved | Reserved, do not use

Precondition
  You can change default presentation with Inform_Set()

Returns
  Text with information about the file

## ◆ Open() [1/2]

size_t MediaInfoLib::MediaInfo::Open | ( | const String & | File_Name | ) |

Open a file.

Open a file and collect information about it (technical information and tags)

Parameters

  File_Name | Full name of file to open

Return values

  0 | File not opened
  1 | File opened

## ◆ Open() [2/2]

size_t MediaInfoLib::MediaInfo::Open | ( | const ZenLib::int8u * | Begin,
|  | size_t | Begin_Size,
|  | const ZenLib::int8u * | End = `NULL`,
|  | size_t | End_Size = `0`,
|  | ZenLib::int64u | File_Size = `0`
| ) |  |

Open a buffer.

Open a Buffer (Begin and end of the stream) and collect information about it (technical information and tags)

Parameters

  Begin | First bytes of the buffer
  Begin_Size | Size of Begin
  End | Last bytes of the buffer
  End_Size | Size of End
  File_Size | Total size of the file

Return values

  0 | File not opened
  1 | File opened

## ◆ Open_Buffer_Continue()

size_t MediaInfoLib::MediaInfo::Open_Buffer_Continue | ( | const ZenLib::int8u * | Buffer,
|  | size_t | Buffer_Size
| ) |  |

Open a stream (Continue)

Open a stream and collect information about it (technical information and tags)

Parameters

  Buffer | pointer to the stream
  Buffer_Size | Count of bytes to read

Returns
  a bitfield
  bit 0: Is Accepted (format is known) bit 1: Is Filled (main data is collected) bit 2: Is Updated (some data have beed updated, example: duration for a real time MPEG-TS stream) bit 3: Is Finalized (No more data is needed, will not use further data) bit 4-15: Reserved bit 16-31: User defined

## ◆ Open_Buffer_Continue_GoTo_Get()

ZenLib::int64u MediaInfoLib::MediaInfo::Open_Buffer_Continue_GoTo_Get | ( |  | ) |

Open a stream (Get the needed file Offset)

Open a stream and collect information about it (technical information and tags)

Returns
  the needed offset of the file
  File size if no more bytes are needed

## ◆ Open_Buffer_Finalize()

size_t MediaInfoLib::MediaInfo::Open_Buffer_Finalize | ( |  | ) |

Open a stream (Finalize)

Open a stream and collect information about it (technical information and tags)

Return values

  0 | failed
  1 | succeed

## ◆ Open_Buffer_Init()

size_t MediaInfoLib::MediaInfo::Open_Buffer_Init | ( | ZenLib::int64u | File_Size = `(ZenLib::int64u) -1`,
|  | ZenLib::int64u | File_Offset = `0`
| ) |  |

Open a stream (Init)

Open a stream and collect information about it (technical information and tags)

Parameters

  File_Size | Estimated file size
  File_Offset | Offset of the file (if we don't have the beginning of the file)

Return values

  0 | File not opened
  1 | File opened

## ◆ Open_NextPacket()

size_t MediaInfoLib::MediaInfo::Open_NextPacket | ( |  | ) |

Read one packet (if "PerPacket" mode is set)

If Open() is used in "PerPacket" mode, parse only one packet and return

Returns
  a bitfield
  bit 0: A packet was read

## ◆ Option()

String MediaInfoLib::MediaInfo::Option | ( | const String & | Option,
|  | const String & | Value = `String()`
| ) |  |

Configure or get information about MediaInfoLib

Parameters

  Option | The name of option
  Value | The value of option

Returns
  Depend of the option: by default "" (nothing) means No, other means Yes

Postcondition
  Known options are:
  - (NOT IMPLEMENTED YET) "BlockMethod": Configure when Open Method must return (default or not command not understood: "1")
    "0": Immediatly
    "1": After geting local information
    "2": When user interaction is needed, or whan Internet information is get
  - "Complete": For debug, configure if MediaInfoLib::Inform() show all information (doesn't care of InfoOption_NoShow tag): shows all information if true, shows only useful for user information if false (No by default)
  - "Complete_Get": return the state of "Complete"
  - "Language": Configure language (default language, and this object); Value is Description of language (format: "Column1;Colum2\n...) \n Column 1: Unique name ("Bytes", "Title") \n Column 2: translation ("Octets", "Titre") \n * "Language_Get": Get the language file in memory * "Language_Update": Configure language of this object only (for optimisation); Value is Description of language (format: "Column1;Colum2
    ...)
    Column 1: Unique name ("Bytes", "Title")
    Column 2: translation ("Octets", "Titre")
  - "Inform": Configure custom text, See MediaInfoLib::Inform() function; Description of views (format: "Column1;Colum2...) \n Column 1: code (11 lines: "General", "Video", "Audio", "Text", "Other", "Begin", "End", "Page_Begin", "Page_Middle", "Page_End") \n Column 2: The text to show (exemple: "Audio: FileName% is at BitRate/String%") \n * "ParseUnknownExtensions": Configure if MediaInfo parse files with unknown extension\n * "ParseUnknownExtensions_Get": Get if MediaInfo parse files with unknown extension\n * "ShowFiles": Configure if MediaInfo keep in memory files with specific kind of streams (or no streams); Value is Description of components (format: "Column1;Colum2
    ...)
    Column 1: code (available: "Nothing" for unknown format, "VideoAudio" for at least 1 video and 1 audio, "VideoOnly" for video streams only, "AudioOnly", "TextOnly")
    Column 2: "" (nothing) not keeping, other for keeping
  - (NOT IMPLEMENTED YET) "TagSeparator": Configure the separator if there are multiple same tags (" | " by default)
  - (NOT IMPLEMENTED YET) "TagSeparator_Get": return the state of "TagSeparator"
  - (NOT IMPLEMENTED YET) "Internet": Authorize Internet connection (Yes by default)
  - (NOT IMPLEMENTED YET) "Internet_Title_Get": When State=5000, give all possible titles for this file (one per line)
    Form: Author TagSeparator Title TagSeparator Year
    ...
  - (NOT IMPLEMENTED YET) "Internet_Title_Set": Set the Good title (same as given by Internet_Title_Get)
    Form: Author TagSeparator Title TagSeparator Year
  - "Info_Parameters": Information about what are known unique names for parameters
  - "Info_Parameters_CSV": Information about what are known unique names for parameters, in CSV format
  - "Info_Codecs": Information about which codec is known
  - "Info_Version": Information about the version of MediaInfoLib
  - "Info_Url": Information about where to find the last version

## ◆ Option_Static()

static String MediaInfoLib::MediaInfo::Option_Static | ( | const String & | Option,
|  | const String & | Value = `String()`
| ) |  |
| static

Configure or get information about MediaInfoLib

Parameters

  Option | The name of option
  Value | The value of option

Returns
  Depend of the option: by default "" (nothing) means No, other means Yes

Postcondition
  Known options are: See MediaInfo::Option()

## ◆ Output_Buffer_Get() [1/2]

size_t MediaInfoLib::MediaInfo::Output_Buffer_Get | ( | const String & | Value | ) |

Output the written size when "File_Duplicate" option is used.

Output the written size when "File_Duplicate" option is used.

Parameters

  Value | The unique name of the duplicated stream (begin with "memory://")

Returns
  The size of the used buffer

## ◆ Output_Buffer_Get() [2/2]

size_t MediaInfoLib::MediaInfo::Output_Buffer_Get | ( | size_t | Pos | ) |

Output the written size when "File_Duplicate" option is used.

Output the written size when "File_Duplicate" option is used.

Parameters

  Pos | The order of calling

Returns
  The size of the used buffer

## ◆ Save()

size_t MediaInfoLib::MediaInfo::Save | ( |  | ) |

(NOT IMPLEMENTED YET) Save the file

(NOT IMPLEMENTED YET) Save the file opened before with Open() (modifications of tags)

Return values

  0 | failed
  1 | suceed

## ◆ Set() [1/2]

size_t MediaInfoLib::MediaInfo::Set | ( | const String & | ToSet,
|  | stream_t | StreamKind,
|  | size_t | StreamNumber,
|  | const String & | Parameter,
|  | const String & | OldValue = `String()`
| ) |  |

(NOT IMPLEMENTED YET) Set information about a file (parameter is a string)

(NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is a string)

Warning
  Not yet implemented, do not use it

Parameters

  ToSet | Piece of information
  StreamKind | Kind of stream (general, video, audio...)
  StreamNumber | Stream number in Kind of stream (first, second...)
  Parameter | Parameter you are looking for in the stream (Codec, width, bitrate...), in string format
  OldValue | The old value of the parameter if OldValue is empty and ToSet is filled: tag is added if OldValue is filled and ToSet is filled: tag is replaced if OldValue is filled and ToSet is empty: tag is deleted

Return values

  >0 | succeed
  0 | failed

## ◆ Set() [2/2]

size_t MediaInfoLib::MediaInfo::Set | ( | const String & | ToSet,
|  | stream_t | StreamKind,
|  | size_t | StreamNumber,
|  | size_t | Parameter,
|  | const String & | OldValue = `String()`
| ) |  |

(NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an int)

(NOT IMPLEMENTED YET) Set a piece of information about a file (parameter is an integer)

Warning
  Not yet implemented, do not use it

Parameters

  ToSet | Piece of information
  StreamKind | Kind of stream (general, video, audio...)
  StreamNumber | Stream number in Kind of stream (first, second...)
  Parameter | Parameter you are looking for in the stream (Codec, width, bitrate...), in integer format (first parameter, second parameter...)
  OldValue | The old value of the parameter if OldValue is empty and ToSet is filled: tag is added if OldValue is filled and ToSet is filled: tag is replaced if OldValue is filled and ToSet is empty: tag is deleted

Return values

  >0 | succeed
  0 | failed

## ◆ State_Get()

size_t MediaInfoLib::MediaInfo::State_Get | ( |  | ) |

(NOT IMPLEMENTED YET) Get the state of the library

Return values

  <1000 | No information is available for the file yet
  >=1000_<5000 | Only local (into the file) information is available, getting Internet information (titles only) is no finished yet
  5000 | (only if Internet connection is accepted) User interaction is needed (use Option() with "Internet_Title_Get") Warning: even there is only one possible, user interaction (or the software) is needed
  >5000<=10000 | Only local (into the file) information is available, getting Internet information (all) is no finished yet
  <10000 | Done

The documentation for this class was generated from the following file:

- MediaInfo.h