Commit 32901399 authored by Carsten Schlote's avatar Carsten Schlote

Fix problem with alias function declarations

parent 2a9c7c21
......@@ -10,6 +10,7 @@ module mediainfo;
import std.string;
import std.conv;
import std.typecons;
import mediainfodll;
//public alias MediaInfo_stream_t Stream;
......@@ -39,7 +40,7 @@ public struct MediaInfo
{
if(_payload)
{
MediaInfo_Delete(_payload);
MediaInfoA_Delete(_payload);
_payload = null;
}
}
......@@ -62,7 +63,8 @@ public struct MediaInfo
static MediaInfo opCall()
{
MediaInfo info;
void* h = MediaInfo_New();
auto h = MediaInfoA_New();
info._data.refCountedStore.ensureInitialized();
info._data._payload = h;
return info;
}
......@@ -76,7 +78,7 @@ public struct MediaInfo
*/
void open(string fileName)
{
if(!MediaInfo_Open(handle, toStringz(fileName)))
if(!MediaInfoA_Open(handle, toStringz(fileName)))
{
throw new MediaInfoException("Couldn't open file: " ~ fileName);
}
......@@ -110,7 +112,7 @@ public struct MediaInfo
*/
size_t openBufferInit(long fileSize = -1, long fileOffset = 0)
{
return MediaInfo_Open_Buffer_Init(handle, fileSize, fileOffset);
return MediaInfoA_Open_Buffer_Init(handle, fileSize, fileOffset);
}
/**
* Open a stream (Continue).
......@@ -123,7 +125,7 @@ public struct MediaInfo
*/
size_t openBufferContinue(ubyte* buffer, size_t size)
{
return MediaInfo_Open_Buffer_Continue(handle, buffer, size);
return MediaInfoA_Open_Buffer_Continue(handle, buffer, size);
}
/**
* Open a stream (Get the needed file Offset).
......@@ -136,7 +138,7 @@ public struct MediaInfo
*/
long openBufferContinueGoToGet()
{
return MediaInfo_Open_Buffer_Continue_GoTo_Get(handle);
return MediaInfoA_Open_Buffer_Continue_GoTo_Get(handle);
}
/**
* Open a stream (Finalize).
......@@ -145,7 +147,7 @@ public struct MediaInfo
*/
size_t openBufferFinalize()
{
return MediaInfo_Open_Buffer_Finalize(handle);
return MediaInfoA_Open_Buffer_Finalize(handle);
}
/+ /**
* (NOT IMPLEMENTED YET) Save the file
......@@ -170,7 +172,7 @@ public struct MediaInfo
*/
void close()
{
MediaInfo_Close(handle);
MediaInfoA_Close(handle);
}
/**
* String MediaInfoLib::MediaInfo::Inform ( size_t Reserved = 0 )
......@@ -183,7 +185,7 @@ public struct MediaInfo
*/
string inform(size_t reserved = 0)
{
return to!string(MediaInfo_Inform(handle, reserved));
return to!string(MediaInfoA_Inform(handle, reserved));
}
/**
* Get a piece of information about a file (parameter is an integer).
......@@ -202,7 +204,7 @@ public struct MediaInfo
string get(MediaInfo_stream_t streamKind, size_t streamNumber, size_t parameter,
MediaInfo_info_t infoKind = MediaInfo_info_t.MediaInfo_Info_Text)
{
return to!string(MediaInfo_GetI(handle, streamKind, streamNumber,
return to!string(MediaInfoA_GetI(handle, streamKind, streamNumber,
parameter, infoKind));
}
/**
......@@ -225,7 +227,7 @@ public struct MediaInfo
const(string) parameter, MediaInfo_info_t infoKind = MediaInfo_info_t.MediaInfo_Info_Text,
MediaInfo_info_t searchKind = MediaInfo_info_t.MediaInfo_Info_Name)
{
return to!string(MediaInfo_Get(handle, streamKind, streamNumber, toStringz(parameter),
return to!string(MediaInfoA_Get(handle, streamKind, streamNumber, toStringz(parameter),
infoKind, searchKind));
}
/+ /**
......@@ -293,7 +295,7 @@ public struct MediaInfo
*/
size_t outputBufferGet(const(string) value)
{
return MediaInfo_Output_Buffer_Get(handle, toStringz(value));
return MediaInfoA_Output_Buffer_Get(handle, toStringz(value));
}
/**
* Output the written size when "File_Duplicate" option is used.
......@@ -307,7 +309,7 @@ public struct MediaInfo
*/
size_t outputBufferGet(size_t pos)
{
return MediaInfo_Output_Buffer_GetI(handle, pos);
return MediaInfoA_Output_Buffer_GetI(handle, pos);
}
/**
* Configure or get information about MediaInfoLib
......@@ -320,7 +322,7 @@ public struct MediaInfo
*/
string option(const(string) option, const(string) value = "")
{
return to!string(MediaInfo_Option(handle, toStringz(option), toStringz(value)));
return to!string(MediaInfoA_Option(handle, toStringz(option), toStringz(value)));
}
/*
......@@ -341,7 +343,7 @@ public struct MediaInfo
*/
size_t getState()
{
return MediaInfo_State_Get(handle);
return MediaInfoA_State_Get(handle);
}
/**
* Count of streams of a stream kind (StreamNumber not filled), or count of piece of information in this stream.
......@@ -352,6 +354,6 @@ public struct MediaInfo
*/
size_t getCount(MediaInfo_stream_t streamKind, size_t streamNumber = -1)
{
return MediaInfo_Count_Get(handle, streamKind, streamNumber);
return MediaInfoA_Count_Get(handle, streamKind, streamNumber);
}
}
......@@ -15,35 +15,16 @@
extern (C):
import core.stdc.config;
//***************************************************************************
// Platforms (from libzen)
//***************************************************************************
enum __UNIX__ = 1;
enum MEDIAINFODLL_NAME = "libmediainfo.so.0";
/*-------------------------------------------------------------------------*/
/*Char types */
alias MediaInfo_Char = char;
enum MEDIAINFO_Ansi = "A";
/*-------------------------------------------------------------------------*/
/*8-bit int */
alias MediaInfo_int8u = ubyte;
/*-------------------------------------------------------------------------*/
/*64-bit int */
enum MAXTYPE_INT = 64;
alias MediaInfo_int64u = ulong;
/*-------------------------------------------------------------------------*/
/*NULL */
enum NULL = 0;
/*-------------------------------------------------------------------------*/
/** @brief Kinds of Stream */
......@@ -59,8 +40,6 @@ enum MediaInfo_stream_t
MediaInfo_Stream_Max = 7
}
alias MediaInfo_stream_C = MediaInfo_stream_t;
/** @brief Kinds of Info */
enum MediaInfo_info_t
{
......@@ -87,8 +66,6 @@ enum MediaInfo_infooptions_t
MediaInfo_InfoOption_Max = 4
}
alias MediaInfo_infooptions_C = MediaInfo_infooptions_t;
/** @brief File opening options */
enum MediaInfo_fileoptions_t
{
......@@ -98,165 +75,66 @@ enum MediaInfo_fileoptions_t
MediaInfo_FileOption_Max = 0x04
}
alias MediaInfo_fileoptions_C = MediaInfo_fileoptions_t;
/* __cplusplus */
extern __gshared void* MediaInfo_Module;
extern __gshared size_t Module_Count;
alias MEDIAINFO_New = void* function ();
extern __gshared MEDIAINFO_New MediaInfo_New;
alias MEDIAINFOLIST_New = void* function ();
extern __gshared MEDIAINFOLIST_New MediaInfoList_New;
alias MEDIAINFO_Delete = void function (void*);
extern __gshared MEDIAINFO_Delete MediaInfo_Delete;
alias MEDIAINFOLIST_Delete = void function (void*);
extern __gshared MEDIAINFOLIST_Delete MediaInfoList_Delete;
alias MEDIAINFO_Open = c_ulong function (void*, const(MediaInfo_Char)*);
extern __gshared MEDIAINFO_Open MediaInfo_Open;
alias MEDIAINFOLIST_Open = c_ulong function (void*, const(MediaInfo_Char)*, const MediaInfo_fileoptions_C);
extern __gshared MEDIAINFOLIST_Open MediaInfoList_Open;
alias MEDIAINFO_Open_Buffer_Init = c_ulong function (void*, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset);
extern __gshared MEDIAINFO_Open_Buffer_Init MediaInfo_Open_Buffer_Init;
alias MEDIAINFO_Open_Buffer_Continue = c_ulong function (void*, MediaInfo_int8u* Buffer, size_t Buffer_Size);
extern __gshared MEDIAINFO_Open_Buffer_Continue MediaInfo_Open_Buffer_Continue;
alias MEDIAINFO_Open_Buffer_Continue_GoTo_Get = ulong function (void*);
extern __gshared MEDIAINFO_Open_Buffer_Continue_GoTo_Get MediaInfo_Open_Buffer_Continue_GoTo_Get;
alias MEDIAINFO_Open_Buffer_Finalize = c_ulong function (void*);
extern __gshared MEDIAINFO_Open_Buffer_Finalize MediaInfo_Open_Buffer_Finalize;
alias MEDIAINFO_Open_NextPacket = c_ulong function (void*);
extern __gshared MEDIAINFO_Open_NextPacket MediaInfo_Open_NextPacket;
alias MEDIAINFO_Close = void function (void*);
extern __gshared MEDIAINFO_Close MediaInfo_Close;
alias MEDIAINFOLIST_Close = void function (void*, size_t);
extern __gshared MEDIAINFOLIST_Close MediaInfoList_Close;
alias MEDIAINFO_Inform = const(char)* function (void*, size_t Reserved);
extern __gshared MEDIAINFO_Inform MediaInfo_Inform;
alias MEDIAINFOLIST_Inform = const(char)* function (void*, size_t, size_t Reserved);
extern __gshared MEDIAINFOLIST_Inform MediaInfoList_Inform;
alias MEDIAINFO_GetI = const(char)* function (void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared MEDIAINFO_GetI MediaInfo_GetI;
alias MEDIAINFOLIST_GetI = const(char)* function (void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared MEDIAINFOLIST_GetI MediaInfoList_GetI;
alias MEDIAINFO_Get = const(char)* function (void*, MediaInfo_stream_C StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared MEDIAINFO_Get MediaInfo_Get;
alias MEDIAINFOLIST_Get = const(char)* function (void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared MEDIAINFOLIST_Get MediaInfoList_Get;
alias MEDIAINFO_Output_Buffer_Get = c_ulong function (void*, const(MediaInfo_Char)* Parameter);
extern __gshared MEDIAINFO_Output_Buffer_Get MediaInfo_Output_Buffer_Get;
alias MEDIAINFO_Output_Buffer_GetI = c_ulong function (void*, size_t Pos);
extern __gshared MEDIAINFO_Output_Buffer_GetI MediaInfo_Output_Buffer_GetI;
alias MEDIAINFO_Option = const(char)* function (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared MEDIAINFO_Option MediaInfo_Option;
alias MEDIAINFOLIST_Option = const(char)* function (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared MEDIAINFOLIST_Option MediaInfoList_Option;
alias MEDIAINFO_State_Get = c_ulong function (void*);
extern __gshared MEDIAINFO_State_Get MediaInfo_State_Get;
alias MEDIAINFOLIST_State_Get = c_ulong function (void*);
extern __gshared MEDIAINFOLIST_State_Get MediaInfoList_State_Get;
alias MEDIAINFO_Count_Get = c_ulong function (void*, MediaInfo_stream_C StreamKind, size_t StreamNumber);
extern __gshared MEDIAINFO_Count_Get MediaInfo_Count_Get;
alias MEDIAINFOLIST_Count_Get = c_ulong function (void*, size_t, MediaInfo_stream_C StreamKind, size_t StreamNumber);
extern __gshared MEDIAINFOLIST_Count_Get MediaInfoList_Count_Get;
alias MEDIAINFO_Count_Get_Files = c_ulong function (void*);
extern __gshared MEDIAINFO_Count_Get_Files MediaInfo_Count_Get_Files;
alias MEDIAINFOLIST_Count_Get_Files = c_ulong function (void*);
extern __gshared MEDIAINFOLIST_Count_Get_Files MediaInfoList_Count_Get_Files;
/* Load library */
// get full app path and delete app name
/* MACOSX*/
/* Load methods */
// Unload DLL with errors
size_t MediaInfoDLL_Load ();
size_t MediaInfoDLL_IsLoaded ();
void MediaInfoDLL_UnLoad ();
/*__cplusplus*/
/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
//DLL C++ wrapper for C functions
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//MediaInfo_Char types
// Legacy
//Legacy
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/// @brief Kinds of Stream
///< StreamKind = General
///< StreamKind = Video
///< StreamKind = Audio
///< StreamKind = Text
///< StreamKind = Other
///< StreamKind = Image
///< StreamKind = Menu
/// @brief Kind of information
///< InfoKind = Unique name of parameter
///< InfoKind = Value of parameter
///< InfoKind = Unique name of measure unit of parameter
///< InfoKind = See infooptions_t
///< InfoKind = Translated name of parameter
///< InfoKind = Translated name of measure unit
///< InfoKind = More information about the parameter
///< InfoKind = Information : how data is found
/// Get(...)[infooptions_t] return a string like "YNYN..." \n
/// Use this enum to know at what correspond the Y (Yes) or N (No)
/// If Get(...)[0]==Y, then :
/// @brief Option if InfoKind = Info_Options
///< Show this parameter in Inform()
///<
///< Internal use only (info : Must be showed in Info_Capacities() )
///< Value return by a standard Get() can be : T (Text), I (Integer, warning up to 64 bits), F (Float), D (Date), B (Binary datas coded Base64) (Numbers are in Base 10)
/// @brief File opening options
///< Do not browse folders recursively
///< Close all files before open
//---------------------------------------------------------------------------
//File
//size_t Save () {MEDIAINFO_TEST_INT; return MediaInfo_Save(Handle);};
//General information
//size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfo_SetI (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());};
//size_t Set (const String &ToSet, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfo_Set (Handle, ToSet.c_str(), (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());};
//File
//size_t Save (size_t FilePos) {MEDIAINFO_TEST_INT; return MediaInfoList_Save(Handle, FilePos);};
//General information
//size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, size_t Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfoList_SetI (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter, OldValue.c_str());};
//size_t Set (const String &ToSet, size_t FilePos, stream_t StreamKind, size_t StreamNumber, const String &Parameter, const String &OldValue=__T("")) {MEDIAINFO_TEST_INT; return MediaInfoList_Set (Handle, ToSet.c_str(), FilePos, (MediaInfo_stream_C)StreamKind, StreamNumber, Parameter.c_str(), OldValue.c_str());};
version(MediaInfo_utf16) {
extern __gshared void* MediaInfo_New();
extern __gshared void* MediaInfoList_New();
extern __gshared void MediaInfo_Delete (void*);
extern __gshared void MediaInfoList_Delete (void*);
extern __gshared c_ulong MediaInfo_Open (void*, const(MediaInfo_Char)*);
extern __gshared c_ulong MediaInfoList_Open (void*, const(MediaInfo_Char)*, const MediaInfo_fileoptions_t);
extern __gshared c_ulong MediaInfo_Open_Buffer_Init (void*, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset);
extern __gshared c_ulong MediaInfo_Open_Buffer_Continue (void*, MediaInfo_int8u* Buffer, size_t Buffer_Size);
extern __gshared ulong MediaInfo_Open_Buffer_Continue_GoTo_Get (void*);
extern __gshared c_ulong MediaInfo_Open_Buffer_Finalize (void*);
extern __gshared c_ulong MediaInfo_Open_NextPacket (void*);
extern __gshared void MediaInfo_Close (void*);
extern __gshared void MediaInfoList_Close (void*, size_t);
extern __gshared const(char)* MediaInfo_Inform (void*, size_t Reserved);
extern __gshared const(char)* MediaInfoList_Inform (void*, size_t, size_t Reserved);
extern __gshared const(char)* MediaInfo_GetI (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared const(char)* MediaInfoList_GetI (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared const(char)* MediaInfo_Get (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared const(char)* MediaInfoList_Get (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared c_ulong MediaInfo_Output_Buffer_Get (void*, const(MediaInfo_Char)* Parameter);
extern __gshared c_ulong MediaInfo_Output_Buffer_GetI (void*, size_t Pos);
extern __gshared const(char)* MediaInfo_Option (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared const(char)* MediaInfoList_Option (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared c_ulong MediaInfo_State_Get (void*);
extern __gshared c_ulong MediaInfoList_State_Get (void*);
extern __gshared c_ulong MediaInfo_Count_Get (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber);
extern __gshared c_ulong MediaInfoList_Count_Get (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber);
extern __gshared c_ulong MediaInfo_Count_Get_Files (void*);
extern __gshared c_ulong MediaInfoList_Count_Get_Files (void*);
}
//NameSpace
/*__cplusplus*/
/* ASCII und UTF-8 Functions */
extern __gshared void* MediaInfoA_New();
extern __gshared void* MediaInfoListA_New();
extern __gshared void MediaInfoA_Delete (void*);
extern __gshared void MediaInfoListA_Delete (void*);
extern __gshared c_ulong MediaInfoA_Open (void*, const(MediaInfo_Char)*);
extern __gshared c_ulong MediaInfoListA_Open (void*, const(MediaInfo_Char)*, const MediaInfo_fileoptions_t);
extern __gshared c_ulong MediaInfoA_Open_Buffer_Init (void*, MediaInfo_int64u File_Size, MediaInfo_int64u File_Offset);
extern __gshared c_ulong MediaInfoA_Open_Buffer_Continue (void*, MediaInfo_int8u* Buffer, size_t Buffer_Size);
extern __gshared ulong MediaInfoA_Open_Buffer_Continue_GoTo_Get (void*);
extern __gshared c_ulong MediaInfoA_Open_Buffer_Finalize (void*);
extern __gshared c_ulong MediaInfoA_Open_NextPacket (void*);
extern __gshared void MediaInfoA_Close (void*);
extern __gshared void MediaInfoListA_Close (void*, size_t);
extern __gshared const(char)* MediaInfoA_Inform (void*, size_t Reserved);
extern __gshared const(char)* MediaInfoListA_Inform (void*, size_t, size_t Reserved);
extern __gshared const(char)* MediaInfoA_GetI (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared const(char)* MediaInfoListA_GetI (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber, size_t Parameter, MediaInfo_info_C KindOfInfo);
extern __gshared const(char)* MediaInfoA_Get (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared const(char)* MediaInfoListA_Get (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber, const(MediaInfo_Char)* Parameter, MediaInfo_info_C KindOfInfo, MediaInfo_info_C KindOfSearch);
extern __gshared c_ulong MediaInfoA_Output_Buffer_Get (void*, const(MediaInfo_Char)* Parameter);
extern __gshared c_ulong MediaInfoA_Output_Buffer_GetI (void*, size_t Pos);
extern __gshared const(char)* MediaInfoA_Option (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared const(char)* MediaInfoListA_Option (void*, const(MediaInfo_Char)* Parameter, const(MediaInfo_Char)* Value);
extern __gshared c_ulong MediaInfoA_State_Get (void*);
extern __gshared c_ulong MediaInfoListA_State_Get (void*);
extern __gshared c_ulong MediaInfoA_Count_Get (void*, MediaInfo_stream_t StreamKind, size_t StreamNumber);
extern __gshared c_ulong MediaInfoListA_Count_Get (void*, size_t, MediaInfo_stream_t StreamKind, size_t StreamNumber);
extern __gshared c_ulong MediaInfoA_Count_Get_Files (void*);
extern __gshared c_ulong MediaInfoListA_Count_Get_Files (void*);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment