Commit 754ac705 authored by yanzg's avatar yanzg

打印模板处理

parent 712b38e2
......@@ -53,17 +53,17 @@ public class TestMediaHelper {
}
private void testConvert(String item, float size, float quote) throws EncoderException {
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
String name = String.format("%s.size_%d.quot_%d.%s.mp4",
targetFile, (int) (size * 100), (int) (quote * 100), item);
MediaHelper.zipVideo(file, name, "mp4", item, size, (int) (MediaHelper.DEFAULT_BIT_RATE * quote));
}
private String getFile() {
private String getFile(String file) {
// 注意,路径应为文件在工程中的相对路径
File f = new File("src/test/java/helper/100M.mp4");
File f = new File("src/test/java/helper/" + file);
if (!f.exists()) {
System.out.println(f.getAbsoluteFile());
throw new RuntimeException("视频文件不存在");
......@@ -72,9 +72,9 @@ public class TestMediaHelper {
}
private String getTargetFile() {
private String getTargetFile(String file) {
// 注意,路径应为文件在工程中的相对路径
File f = new File("target/100M.mp4");
File f = new File(file);
return f.getAbsolutePath();
}
......@@ -83,8 +83,20 @@ public class TestMediaHelper {
if (isFirstImage) {
return;
}
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
MediaHelper.getVideoFirstImage(file, targetFile + ".jpg");
isFirstImage = true;
}
@Test
public void testVideoFirstImage1() throws IOException {
if (isFirstImage) {
return;
}
String file = getFile("xuziming.mp4");
String targetFile = getTargetFile("target/xuziming.mp4");
MediaHelper.getVideoFirstImage(file, targetFile + ".jpg");
isFirstImage = true;
}
......@@ -116,8 +128,8 @@ public class TestMediaHelper {
}
private void testImageZip(float size, float quote) throws IOException {
String file = getTargetFile() + ".jpg";
String targetFile = getTargetFile();
String file = getTargetFile("target/100M.mp4") + ".jpg";
String targetFile = getTargetFile("target/100M.mp4");
String toName = String.format("%s.size_%d.quot_%d.jpg",
targetFile, (int) (size * 100), (int) (quote * 100));
String toNameSystem = String.format("%s.size_%d.quot_%d.system.jpg",
......@@ -151,8 +163,8 @@ public class TestMediaHelper {
}
private void testVideoZipFlv(float size, float quote) throws EncoderException {
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
String name = String.format("%s.size_%d.quot_%d.flv",
targetFile, (int) (size * 100), (int) (quote * 100));
MediaHelper.zipVideoFlv(file, name, size, (int) (MediaHelper.DEFAULT_BIT_RATE * quote));
......@@ -188,8 +200,8 @@ public class TestMediaHelper {
}
private void testVideoZipMpeg(float size, float quote) throws EncoderException {
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
String name = String.format("%s.size_%d.quot_%d.mpeg.mp4",
targetFile, (int) (size * 100), (int) (quote * 100));
MediaHelper.zipVideoMpeg(file, name, size, (int) (MediaHelper.DEFAULT_BIT_RATE * quote));
......@@ -218,8 +230,8 @@ public class TestMediaHelper {
}
private void testVideoZip3pg(float size, float quote) throws EncoderException {
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
String name = String.format("%s.size_%d.quot_%d.3pg",
targetFile, (int) (size * 100), (int) (quote * 100));
MediaHelper.zipVideo3pg(file, name, size, (int) (MediaHelper.DEFAULT_BIT_RATE * quote));
......@@ -255,8 +267,8 @@ public class TestMediaHelper {
}
private void testVideoZip(float size, float quote) throws EncoderException {
String file = getFile();
String targetFile = getTargetFile();
String file = getFile("100M.mp4");
String targetFile = getTargetFile("target/100M.mp4");
String name = String.format("%s.size_%d.quot_%d.mp4",
targetFile, (int) (size * 100), (int) (quote * 100));
MediaHelper.zipVideo(file, name, size, (int) (MediaHelper.DEFAULT_BIT_RATE * quote));
......
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