Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion mediainfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const (
)

func init() {
C.setlocale(C.LC_CTYPE, C.CString(""))
str := C.CString("")
defer C.free(unsafe.Pointer(str))
C.setlocale(C.LC_CTYPE, str)
C.MediaInfoDLL_Load()
}

Expand All @@ -69,6 +71,10 @@ func (file *File) Get(streamKind StreamKind, streamNumber int, parameter string,
return C.GoString(C.Get(file.handle, C.MediaInfo_stream_C(streamKind), C.size_t(streamNumber), cParameter, C.MediaInfo_info_C(infoKind), C.MediaInfo_info_C(0)))
}

func (file *File) GetI(streamKind StreamKind, streamNumber int, parameter int, infoKind InfoKind) string {
return C.GoString(C.GetI(file.handle, C.MediaInfo_stream_C(streamKind), C.size_t(streamNumber), C.size_t(parameter), C.MediaInfo_info_C(infoKind)))
}

func (file *File) Parameter(streamKind StreamKind, streamNumber int, parameter string) string {
return file.Get(streamKind, streamNumber, parameter, InfoText)
}
Expand Down
5 changes: 5 additions & 0 deletions mediainfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ const char *Get(void *handle, MediaInfo_stream_C streamKind, size_t StreamNumber
return toChar(MediaInfo_Get(handle, streamKind, StreamNumber, toWchar(Parameter), KindOfInfo, KindOfSearch));
}

const char *GetI(void *handle, MediaInfo_stream_C streamKind, size_t StreamNumber, unsigned long Parameter, MediaInfo_info_C KindOfInfo)
{
return toChar(MediaInfo_GetI(handle, streamKind, StreamNumber, Parameter, KindOfInfo));
}

const char *Option(void *handle, char *Parameter, char *Value)
{
return toChar(MediaInfo_Option(handle, toWchar(Parameter), toWchar(Value)));
Expand Down
8 changes: 8 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
packages = with pkgs; [
go
mediainfo
libmediainfo
];
}