summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
37b8bbb)
一緒にしてしまうと透明化処理なども同じで扱われてしまうため.
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import saccubus.conv.ConvertToVideoHook;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import saccubus.conv.ConvertToVideoHook;
+import saccubus.conv.NicoXMLReader.ProcessType;
import saccubus.util.FfmpegUtil;
import saccubus.worker.Worker;
import saccubus.worker.WorkerListener;
import saccubus.util.FfmpegUtil;
import saccubus.worker.Worker;
import saccubus.worker.WorkerListener;
final File outputFile = new File(outprof.getDir(), pattern.createFileName());
File transformedComment = null;
final File outputFile = new File(outprof.getDir(), pattern.createFileName());
File transformedComment = null;
+ File transformedOwner = null;
try {
if (profile.isCommentOverlay()) {
transformedComment = File.createTempFile("vhk", ".tmp", profile.getTempDir());
try {
if (profile.isCommentOverlay()) {
transformedComment = File.createTempFile("vhk", ".tmp", profile.getTempDir());
+ transformedOwner = File.createTempFile("vown", ".tmp", profile.getTempDir());
final HideCondition hide = profile.getNgSetting();
final HideCondition hide = profile.getNgSetting();
publish(new ConvertProgress(PROCESS, -1.0, "コメントの中間ファイルへの変換中"));
publish(new ConvertProgress(PROCESS, -1.0, "コメントの中間ファイルへの変換中"));
- ConvertToVideoHook.convert(commentFile, transformedComment, hide.getId(), hide.getWord());
+ ConvertToVideoHook.convert(EnumSet.of(ProcessType.NORMAL), commentFile, transformedComment, hide.getId(),
+ hide.getWord());
+
+ publish(new ConvertProgress(PROCESS, -1.0, "投稿者コメントの中間ファイルへの変換中"));
+ ConvertToVideoHook.convert(EnumSet.of(ProcessType.OWNER), commentFile, transformedOwner, hide.getId(),
+ hide.getWord());
}
checkStop();
publish(new ConvertProgress(PROCESS, -1.0, "動画の変換を開始"));
}
checkStop();
publish(new ConvertProgress(PROCESS, -1.0, "動画の変換を開始"));
- final int code = convert(transformedComment, outputFile);
+ final int code = convert(outputFile, transformedComment, transformedOwner);
if (code != 0) {
throw new IOException("ffmpeg実行失敗: " + outputFile.getPath());
}
if (code != 0) {
throw new IOException("ffmpeg実行失敗: " + outputFile.getPath());
}
if (transformedComment != null && transformedComment.exists()) {
transformedComment.delete();
}
if (transformedComment != null && transformedComment.exists()) {
transformedComment.delete();
}
+ if (transformedOwner != null && transformedOwner.exists()) {
+ transformedOwner.delete();
+ }
- private int convert(File transformedComment, File outputFile) throws InterruptedException, IOException {
+ private int convert(File outputFile, File commentNormal, File commentOwner) throws InterruptedException, IOException {
File fwsFile = null;
try {
final File tmpCws = File.createTempFile("cws", ".swf", profile.getTempDir());
File fwsFile = null;
try {
final File tmpCws = File.createTempFile("cws", ".swf", profile.getTempDir());
tmpCws.delete();
final File target = (fwsFile != null) ? fwsFile : videoFile;
tmpCws.delete();
final File target = (fwsFile != null) ? fwsFile : videoFile;
- final List<String> arguments = createArguments(target, transformedComment, outputFile);
+ final List<String> arguments = createArguments(target, outputFile, commentNormal, commentOwner);
final FfmpegUtil util = new FfmpegUtil(profile.getFfmpeg(), target);
int duration;
try {
final FfmpegUtil util = new FfmpegUtil(profile.getFfmpeg(), target);
int duration;
try {
- private List<String> createArguments(final File targetVideoFile, File transformedComment, File output)
+ private List<String> createArguments(final File targetVideoFile, File output, File comment, File commentOwner)
throws IOException, UnsupportedEncodingException {
final ConvertProfile prof = profile;
final FfmpegProfile ffop = prof.getFfmpegOption();
throws IOException, UnsupportedEncodingException {
final ConvertProfile prof = profile;
final FfmpegProfile ffop = prof.getFfmpegOption();
}
final List<String> avfilterArgs = createAvfilterOptions(ffop.getAvfilterOption());
if (!prof.isVhookDisabled()) {
}
final List<String> avfilterArgs = createAvfilterOptions(ffop.getAvfilterOption());
if (!prof.isVhookDisabled()) {
- final String vhookArg = getVhookArg(prof, transformedComment.getPath(), isHD);
+ final String vhookArg = getVhookArg(prof, comment.getPath(), commentOwner.getPath(), isHD);
if (isNotBlank(vhookArg)) {
avfilterArgs.add(vhookArg);
}
if (isNotBlank(vhookArg)) {
avfilterArgs.add(vhookArg);
}
logger.log(Level.INFO, argMsg.toString());
return cmdList;
}
logger.log(Level.INFO, argMsg.toString());
return cmdList;
}
private static final Pattern PATTERN_TIME = Pattern.compile("time=(\\d+)");
private int executeFfmpeg(final List<String> cmdList, int duration) throws InterruptedException, IOException {
private static final Pattern PATTERN_TIME = Pattern.compile("time=(\\d+)");
private int executeFfmpeg(final List<String> cmdList, int duration) throws InterruptedException, IOException {
- private static String getVhookArg(ConvertProfile prof, String commPath, boolean isHD) throws
+ private static String getVhookArg(ConvertProfile prof, String commPath, String commOwnerPath, boolean isHD) throws
UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
sb.append("vhext=");
UnsupportedEncodingException {
StringBuilder sb = new StringBuilder();
sb.append("vhext=");
sb.append("|");
sb.append("--data-user:");
sb.append(URLEncoder.encode(commPath.replace("\\", "/"), "Shift_JIS"));
sb.append("|");
sb.append("--data-user:");
sb.append(URLEncoder.encode(commPath.replace("\\", "/"), "Shift_JIS"));
+ sb.append("|");
+ sb.append("--data-owner:");
+ sb.append(URLEncoder.encode(commOwnerPath.replace("\\", "/"), "Shift_JIS"));
}
sb.append("|");
sb.append("--font:");
}
sb.append("|");
sb.append("--font:");