-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMediaInfo.java
More file actions
222 lines (199 loc) · 7.84 KB
/
Copy pathMediaInfo.java
File metadata and controls
222 lines (199 loc) · 7.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
package org.mediainfo.android;
/**
* Give information about a lot of media format.
*/
public class MediaInfo {
public static int isCanceled = 0;
// @remark Don't change it carelessly.
// This order is from MediaInfo_Const.h
public enum StreamKind {
GENERAL,
VIDEO,
AUDIO,
TEXT,
OTHER,
IMAGE,
MENU,
MAX
}
// @remark Don't change it carelessly.
// This order is from MediaInfo_Const.h
public enum InfoKind {
NAME, // Unique name of parameter
TEXT, // Value of parameter
MEASURE, // Unique name of measure unit of parameter
OPTIONS, // See InfoOptionKind
NAME_TEXT, // Translated name of parameter
MEASURE_TEXT, // Translated name of measure unit
INFO, // More information about the parameter
HOWTO, // How this parameter is supported, could be N(No), B(Beta),
// R(Read only), W(Read/Write)
DOMAIN, // Domain of this piece of information
MAX
}
public MediaInfo() {
//handle = create();
System.out.println("MediaInfo created");
}
public int getIsCanceled() {
return isCanceled;
}
/**
* Get a piece of information about a file. (parameter is an integer)
*
* @param streamKind
* Kind of Stream
* @param streamNum
* Stream number in Kind of stream
* @param parameter
* Parameter you are looking for in the stream (codec, width,
* bitrate, ..), in integer format
* @return a string about information you search, an empty string if there
* is a problem.
*/
public String get(String filename, StreamKind streamKind, int streamNum, int parameter) {
String result = getById(filename, streamKind.ordinal(), streamNum,
parameter); /* InfoKind.TEXT */
return result;
}
/**
* Get a piece of information about a file. (parameter is an integer)
*
* @param streamKind
* Kind of Stream
* @param streamNum
* Stream number in Kind of stream
* @param parameter
* Parameter you are looking for in the stream (codec, width,
* bitrate, ..), in integer format
* @param infoKind
* Kind of information you want about the parameter (the text,
* the measure, the help, ..)
* @return a string about information you search, an empty string if there
* is a problem.
*/
public String get(String filename, StreamKind streamKind, int streamNum, int parameter,
InfoKind infoKind) {
String result = getByIdDetail(filename, streamKind.ordinal(), streamNum,
parameter, infoKind.ordinal());
return result;
}
/**
* Get a piece of information about a file. (parameter is an string)
*
* @param streamKind
* Kind of Stream (general, video, audio, ..)
* @param streamNum
* Stream number in Kind of stream
* @param parameter
* Parameter you are looking for in the stream (codec, width,
* bitrate, ..), in string format ("Codec", "Width", ..)
* @return a string about information you search, an empty string if there
* is a problem
*/
public String get(String filename, StreamKind streamKind, int streamNum, String parameter) {
String result = getByName(filename, streamKind.ordinal(), streamNum,
parameter); /* InfoKind.TEXT, InfoKind.NAME */
return result;
}
/**
* Get a piece of information about a file. (parameter is an string)
*
* @param streamKind
* Kind of Stream (general, video, audio, ..)
* @param streamNum
* Stream number in Kind of stream
* @param parameter
* Parameter you are looking for in the stream (codec, width,
* bitrate, ..), in string format ("Codec", "Width", ..)
* @param infoKind
* Kind of information you want about the parameter (the text,
* the measure, the help, ..)
* @return a string about information you search, an empty string if there
* is a problem.
*/
public String get(String filename, StreamKind streamKind, int streamNum, String parameter,
InfoKind infoKind) {
String result = getByNameDetail(filename, streamKind.ordinal(),
streamNum, parameter, infoKind.ordinal(),
InfoKind.NAME.ordinal());
return result;
}
/**
* Get a piece of information about a file. (parameter is an string)
*
* @param streamKind
* Kind of Stream (general, video, audio, ..)
* @param streamNum
* Stream number in Kind of stream
* @param parameter
* Parameter you are looking for in the stream (codec, width,
* bitrate, ..), in string format ("Codec", "Width", ..)
* @param infoKind
* Kind of information you want about the parameter (the text,
* the measure, the help, ..)
* @param searchKind
* Where to look for the parameter
* @return a string about information you search, an empty string if there
* is a problem.
*/
public String get(String filename, StreamKind streamKind, int streamNum, String parameter,
InfoKind infoKind, InfoKind searchKind) {
String result = getByNameDetail(filename, streamKind.ordinal(),
streamNum, parameter, infoKind.ordinal(), searchKind.ordinal());
return result;
}
/**
* Count of streams of a stream kin (StreamNumber not filled), or count of
* piece of information in this stream.
*
* @param streamKind
* Kind of Stream (general, video, audio, ..)
* @return number of streams of the given stream kind
*/
public int countGet(String filename, StreamKind streamKind) {
int result = countGet(filename, streamKind.ordinal(), -1);
return result;
}
/**
* Count of streams of a stream kin (StreamNumber not filled), or count of
* piece of information in this stream.
*
* @param streamKind
* Kind of Stream (general, video, audio, ..)
* @param streamNumber
* Stream number in Kind of stream
* @return number of streams of the given stream kind
*/
public int countGet(String filename, StreamKind streamKind, int streamNumber) {
int result = countGet(filename, streamKind.ordinal(), streamNumber);
return result;
}
public String getMI(String filename) {
String result = getMediaInfo(filename);
return result;
}
public String getMIOption(String param) {
String result = getMediaInfoOption(param);
return result;
}
private native String getById(String filename, int streamKind, int streamNum,
int parameter);
private native String getByIdDetail(String filename, int streamKind, int streamNum,
int parameter, int kindOfInfo);
private native String getByName(String filename, int streamKind, int streamNum,
String parameter);
private native String getByNameDetail(String filename, int streamKind,
int streamNum, String parameter, int kindOfInfo, int kindOfSearch);
private native int countGet(String filename, int streamKind, int streamNum);
private native String getMediaInfo(String filename);
private native String getMediaInfoOption(String param);
static {
System.loadLibrary("mediainfo");
}
}