Skip to content

Commit 3fed180

Browse files
author
Yoichi Kawasaki
committed
added Azure Media OCR + Media Encoder Standard
1 parent 13356c9 commit 3fed180

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/main/java/azuremediaprocessor/App.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ public void start( String[] args )
3333
Options opts = new Options();
3434
opts.addOption("c", "config", true, "(Required) App config file. ex) app.config");
3535
opts.addOption("t", "type", true, "(Required) Media Processor type (Integer):\n"
36+
+ "1 -> Media Encoder Standard\n"
3637
+ "10 -> Azure Media Indexer\n"
3738
+ "11 -> Azure Media Indexer 2 Preview\n"
3839
+ "12 -> Azure Media Hyperlapse\n"
3940
+ "13 -> Azure Media Face Detector\n"
4041
+ "14 -> Azure Media Motion Detector\n"
4142
+ "15 -> Azure Media Stabilizer\n"
4243
+ "16 -> Azure Media Video Thumbnails\n"
44+
+ "17 -> Azure Media OCR\n"
4345
);
4446
opts.addOption("f", "file", true, "(Optional) Uploading file. By specifing this, you start from uploading file");
4547
opts.addOption("a", "assetname", true, "(Required) Asset Name to process media indexing");

src/main/java/azuremediaprocessor/Constants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ public class Constants {
1111
public static final Map<String, String> MediaProcessorType_MAP;
1212
static {
1313
HashMap<String,String> m = new HashMap<String,String>();
14+
m.put("1", "Media Encoder Standard");
1415
m.put("10", "Azure Media Indexer");
1516
m.put("11", "Azure Media Indexer 2 Preview");
1617
m.put("12", "Azure Media Hyperlapse");
1718
m.put("13", "Azure Media Face Detector");
1819
m.put("14", "Azure Media Motion Detector");
1920
m.put("15", "Azure Media Stabilizer");
2021
m.put("16", "Azure Media Video Thumbnails");
22+
m.put("17", "Azure Media OCR");
2123
MediaProcessorType_MAP = Collections.unmodifiableMap(m);
2224
}
2325
public Constants() { }

src/main/java/azuremediaprocessor/MediaProcessRunner.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void run() {
115115
}
116116
checkJobStatus(jobId);
117117

118-
downloadIndexedAssetFilesFromJob(jobInfo);
118+
downloadProcessedAssetFilesFromJob(jobInfo);
119119
} catch (Exception e) {
120120
System.err.println("Exception occured while running media processing job: "
121121
+ e.getMessage());
@@ -170,12 +170,12 @@ private synchronized void checkJobStatus(String jobId)
170170
}
171171
}
172172

173-
private synchronized void downloadIndexedAssetFilesFromJob(JobInfo jobInfo)
173+
private synchronized void downloadProcessedAssetFilesFromJob(JobInfo jobInfo)
174174
throws ServiceException, URISyntaxException, FileNotFoundException, StorageException, IOException {
175175

176176
final ListResult<AssetInfo> outputAssets;
177177
outputAssets = service.list(Asset.list(jobInfo.getOutputAssetsLink()));
178-
AssetInfo indexedAsset = outputAssets.get(0);
178+
AssetInfo processedAsset = outputAssets.get(0);
179179
final AccessPolicyInfo downloadAccessPolicy;
180180
final LocatorInfo downloadLocator;
181181

@@ -189,17 +189,17 @@ private synchronized void downloadIndexedAssetFilesFromJob(JobInfo jobInfo)
189189
downloadLocator = service.create(
190190
Locator.create(
191191
downloadAccessPolicy.getId(),
192-
indexedAsset.getId(),
192+
processedAsset.getId(),
193193
LocatorType.SAS
194194
)
195195
);
196196

197-
for (AssetFileInfo assetFile : service.list(AssetFile.list(indexedAsset.getAssetFilesLink()))) {
197+
for (AssetFileInfo assetFile : service.list(AssetFile.list(processedAsset.getAssetFilesLink()))) {
198198
String fileName = assetFile.getName();
199199
String outFileName=fileName;
200200
// Rename JobResult file not to overwrite it in the directory where all job output files are to be stored
201201
if (fileName.equals("JobResult.txt")) {
202-
outFileName = "JobResult_" + indexedAsset.getName();
202+
outFileName = "JobResult_" + processedAsset.getName();
203203
}
204204
String locatorPath = downloadLocator.getPath();
205205
int startOfSas = locatorPath.indexOf("?");

0 commit comments

Comments
 (0)