From 28bc108921f6b97997b6e2e744ee246cad60923c Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Wed, 17 Feb 2021 22:43:33 +0100 Subject: [PATCH] Some cleanup in triggers page --- hal-core/resource/resource/web/trigger.tmpl | 21 ++-- .../se/hal/plugin/nvr/RecorderFFmpeg4J.java | 96 ------------------- 2 files changed, 11 insertions(+), 106 deletions(-) delete mode 100644 plugins/hal-nvr/test/se/hal/plugin/nvr/RecorderFFmpeg4J.java diff --git a/hal-core/resource/resource/web/trigger.tmpl b/hal-core/resource/resource/web/trigger.tmpl index a2e3e3c9..21ed860e 100644 --- a/hal-core/resource/resource/web/trigger.tmpl +++ b/hal-core/resource/resource/web/trigger.tmpl @@ -12,8 +12,8 @@ {{#flows}}
-
- {{.getName()}} +
+ {{.getName()}}
@@ -84,6 +84,7 @@ +

@@ -93,8 +94,8 @@ {{#.getActions()}}
-
- {{.getObjectClass()}} +
+ {{.getObjectClass()}}
@@ -107,10 +108,10 @@ {{#.getObjectConfigurator().getConfiguration()}} data-{{.getName()}}="{{.getString()}}" {{/.getObjectConfigurator().getConfiguration()}} > - +
diff --git a/plugins/hal-nvr/test/se/hal/plugin/nvr/RecorderFFmpeg4J.java b/plugins/hal-nvr/test/se/hal/plugin/nvr/RecorderFFmpeg4J.java deleted file mode 100644 index c3f6b50b..00000000 --- a/plugins/hal-nvr/test/se/hal/plugin/nvr/RecorderFFmpeg4J.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2021 Ziver Koc - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package se.hal.plugin.nvr; - - -import com.github.manevolent.ffmpeg4j.FFmpeg; -import com.github.manevolent.ffmpeg4j.FFmpegException; -import com.github.manevolent.ffmpeg4j.FFmpegIO; -import com.github.manevolent.ffmpeg4j.FFmpegInput; -import com.github.manevolent.ffmpeg4j.filter.audio.AudioFilter; -import com.github.manevolent.ffmpeg4j.filter.audio.FFmpegAudioResampleFilter; -import com.github.manevolent.ffmpeg4j.filter.video.FFmpegVideoRescaleFilter; -import com.github.manevolent.ffmpeg4j.filter.video.VideoFilter; -import com.github.manevolent.ffmpeg4j.source.AudioSourceSubstream; -import com.github.manevolent.ffmpeg4j.source.VideoSourceSubstream; -import com.github.manevolent.ffmpeg4j.stream.output.FFmpegTargetStream; -import com.github.manevolent.ffmpeg4j.stream.source.FFmpegSourceStream; -import com.github.manevolent.ffmpeg4j.transcoder.Transcoder; -import zutil.log.CompactLogFormatter; -import zutil.log.LogUtil; - -import java.io.FileOutputStream; -import java.util.logging.Level; - - -public class RecorderFFmpeg4J { - - public static void main(String[] args) throws Exception { - LogUtil.setGlobalLevel(Level.ALL); - LogUtil.setGlobalFormatter(new CompactLogFormatter()); - - FFmpegIO input = FFmpegIO.openNativeUrlInput("rtsp://admin:TCZRTY@192.168.10.223:554/H.264"); - FFmpegIO output = FFmpegIO.openOutputStream(new FileOutputStream("./video.mp4"), FFmpegIO.DEFAULT_BUFFER_SIZE); - - // Open input - FFmpegSourceStream sourceStream = new FFmpegInput(input).open(FFmpeg.getInputFormatByName("h264")); - sourceStream.registerStreams(); // Read the file header, and register substreams in FFmpeg4j - - FFmpegTargetStream targetStream = new FFmpegTargetStream( - "h264", // Output format - output, - new FFmpegTargetStream.FFmpegNativeOutput() - ); - - // Audio - AudioSourceSubstream inoutAudioSubstream = - (AudioSourceSubstream) - sourceStream.getSubstreams().stream().filter(x -> x instanceof AudioSourceSubstream) - .findFirst().orElse(null); - - AudioFilter audioFilter = new FFmpegAudioResampleFilter( - inoutAudioSubstream.getFormat(), - null, - FFmpegAudioResampleFilter.DEFAULT_BUFFER_SIZE - ); - - // Video - VideoSourceSubstream inputVideoSubstream = - (VideoSourceSubstream) - sourceStream.getSubstreams().stream().filter(x -> x instanceof VideoSourceSubstream) - .findFirst().orElse(null); - - VideoFilter videoFilter = new FFmpegVideoRescaleFilter( - inputVideoSubstream.getFormat(), - null, - sourceStream.getPixelFormat() - ); - - if (targetStream.getSubstreams().size() <= 0) - throw new FFmpegException("No substreams to record"); - - Transcoder.convert(sourceStream, targetStream, audioFilter, videoFilter, 2D); - } -} \ No newline at end of file