Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Dlang
mediainfo-d
Commits
6764744d
Commit
6764744d
authored
Jan 06, 2019
by
Carsten Schlote
Browse files
Added a single file example
parent
32901399
Changes
4
Hide whitespace changes
Inline
Side-by-side
docs/mediainfo-demo/.gitignore
0 → 100644
View file @
6764744d
.dub
docs.json
__dummy.html
docs/
mediainfo-demo.so
mediainfo-demo.dylib
mediainfo-demo.dll
mediainfo-demo.a
mediainfo-demo.lib
mediainfo-demo-test-*
dub.selections.json
mediainfo-demo
*.exe
*.o
*.obj
*.lst
*.mdb
docs/mediainfo-demo/ReadMe.md
0 → 100644
View file @
6764744d
This is a demo program for the MediaInfo D language binding.
docs/mediainfo-demo/dub.json
0 → 100644
View file @
6764744d
{
"description"
:
"Some example code for the lmdb binding."
,
"license"
:
"Public Domain"
,
"authors"
:
[
"Carsten Schlote"
],
"copyright"
:
"Created © 2018, Carsten Schlote"
,
"dependencies"
:
{
"mediainfo-d"
:
">=0.0.0"
},
"name"
:
"mediainfo-demo"
}
\ No newline at end of file
docs/mediainfo-demo/source/main.d
0 → 100644
View file @
6764744d
module
main
;
import
std
.
conv
;
import
std
.
stdio
;
import
mediainfodll
;
import
mediainfo
;
int
main
(
string
[]
args
)
{
if
(
args
.
length
<
2
)
return
1
;
auto
info
=
MediaInfo
();
string
vstring
=
info
.
option
(
"Info_Version"
,
"0.7.38.0;DTest;0.1"
);
writefln
(
"Found version %s"
,
vstring
);
if
(
vstring
==
""
)
throw
new
Exception
(
"Incompatible mediainfo version"
);
info
.
option
(
"Internet"
,
"No"
);
info
.
open
(
args
[
1
]);
scope
(
exit
)
{
info
.
close
();
}
ulong
nVideo
=
info
.
getCount
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
);
ulong
nAudio
=
info
.
getCount
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
);
ulong
nText
=
info
.
getCount
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
);
if
(
nText
==
0
&&
nVideo
==
0
&&
nAudio
==
0
)
return
0
;
writefln
(
"---%s---"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_General
,
0
,
"FileName"
));
for
(
uint
i
=
0
;
i
<
nVideo
;
i
++)
{
writefln
(
"Video track %s:"
,
i
);
writefln
(
" Resolution: %s x %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"Width"
),
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"Height"
));
writefln
(
" FPS: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"FrameRate"
));
writefln
(
" Duration: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"Duration/String"
));
string
brate
=
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"BitRate"
);
if
(
brate
!=
""
)
writefln
(
" Bitrate: %s kbps"
,
to
!
long
(
brate
)
/
1024
);
writefln
(
" Format: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Video
,
i
,
"Format"
));
}
for
(
uint
i
=
0
;
i
<
nAudio
;
i
++)
{
writefln
(
"Audio track %s:"
,
i
);
std
.
stdio
.
writef
(
" Channels: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"Channel(s)"
));
string
cpos
=
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"ChannelPositions"
);
if
(
cpos
!=
""
)
writefln
(
" (%s)"
,
cpos
);
else
writeln
();
writefln
(
" Duration: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"Duration/String"
));
string
brate
=
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"BitRate"
);
if
(
brate
!=
""
)
{
writefln
(
" Bitrate: %s kbps (%s)"
,
to
!
long
(
brate
)
/
1024
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"BitRate_Mode"
));
}
writefln
(
" Format: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Audio
,
i
,
"Format"
));
}
for
(
uint
i
=
0
;
i
<
nText
;
i
++)
{
writefln
(
"Text track %s:"
,
i
);
writefln
(
" Language: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
,
i
,
"Language"
));
writefln
(
" FPS: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
,
i
,
"FrameRate"
));
writefln
(
" Duration: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
,
i
,
"Duration/String"
));
string
brate
=
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
,
i
,
"BitRate"
);
if
(
brate
!=
""
)
writefln
(
" Bitrate: %s kbps"
,
to
!
long
(
brate
)
/
1024
);
writefln
(
" Format: %s"
,
info
.
get
(
MediaInfo_stream_t
.
MediaInfo_Stream_Text
,
i
,
"Format"
));
}
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment