git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 13 Oct 2017 22:18:36 +0000 (22:18 +0000)
committerVásáry Dániel <daniel.vasary@userrendszerhaz.hu>
Fri, 13 Oct 2017 22:18:36 +0000 (22:18 +0000)
client/DxPlay/DxPlayer.cs
client/DxPlay/MediaDetector.cs
server/user.jobengine.executors/jobtemplates/fake-noparams.xml [new file with mode: 0644]
server/user.jobengine.executors/src/user/jobengine/server/steps/FakeNoParamsStep.java [new file with mode: 0644]
server/user.jobengine.executors/src/user/jobengine/server/steps/FakeStep.java
server/user.jobengine.osgi.commons/src/user/commons/nexio/api/MediabaseImpl.java
server/user.jobengine.osgi.commons/src/user/commons/nexio/server/protocol/NexioServerProtocol.java
server/user.jobengine.osgi.commons/src/user/commons/nexio/server/protocol/NexioServerProtocolImpl.java
server/user.jobengine.osgi.commons/test/user/common/nexio/test/NexioDataMinerTest.java
server/user.jobengine.osgi.server/src/user/jobengine/server/JobEngine.java
server/user.jobengine.osgi.server/src/user/jobengine/server/JobStepExecutor.java

index 11531e59c024d2f6c9ed5616785b17807e246713..ab20783a954257112e7aecdd3409fd4c47b7bf84 100644 (file)
@@ -236,10 +236,10 @@ namespace DxPlay {
                 //Type typeFromClsid = Type.GetTypeFromCLSID(new Guid("CCE7BD95-3BC4-4cfb-9664-0BF83201BE09"));\r
                 //splitter = (IBaseFilter)Activator.CreateInstance(typeFromClsid);\r
                 //m_FilterGraph.AddFilter(splitter, "MXF Splitter");\r
-                splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "Sony MXF Splitter");\r
+                //splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "Sony MXF Splitter");\r
 \r
 \r
-                //splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Splitter");\r
+                splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "LAV Splitter");\r
                 if (splitter == null)\r
                     throw new Exception("No splitter!");\r
 \r
@@ -296,74 +296,6 @@ namespace DxPlay {
 #endif\r
         }\r
 \r
-        private void SetupGraphSONY(Control hWin) {\r
-            int hr;\r
-\r
-            m_videoWidth = MediaDescription.Resolution.Width;\r
-            m_videoHeight = MediaDescription.Resolution.Height;\r
-\r
-            try {\r
-                m_FilterGraph = new FilterGraph() as IFilterGraph2;\r
-\r
-                IGraphBuilder graphBuilder = m_FilterGraph as IGraphBuilder;\r
-                m_mediaSeek = m_FilterGraph as IMediaSeeking;\r
-                m_mediaPosition = m_FilterGraph as IMediaPosition;\r
-                m_mediaEvent = m_FilterGraph as IMediaEvent;\r
-                m_mediaCtrl = m_FilterGraph as IMediaControl;\r
-                m_videoWindow = m_FilterGraph as IVideoWindow;\r
-\r
-                IBaseFilter sourceFilter = null;\r
-                hr = m_FilterGraph.AddSourceFilter(MediaDescription.FileName, MediaDescription.FileName, out sourceFilter);\r
-                DsError.ThrowExceptionForHR(hr);\r
-\r
-                Type typeFromClsid = Type.GetTypeFromCLSID(new Guid("CCE7BD95-3BC4-4cfb-9664-0BF83201BE09"));\r
-                //IBaseFilter splitter = (IBaseFilter)Activator.CreateInstance(typeFromClsid);\r
-\r
-                IBaseFilter splitter = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "Sony MXF Splitter");\r
-                if (splitter == null)\r
-                    throw new Exception("No splitter!");\r
-\r
-                FilterGraphTools.ConnectFilters(graphBuilder, sourceFilter, "Output", splitter, "Input", true);\r
-\r
-                IBaseFilter videoDecoder = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "Sony MPEG Video Decoder Pro");\r
-                if (videoDecoder == null)\r
-                    throw new Exception("No video decoder!");\r
-\r
-                FilterGraphTools.ConnectFilters(graphBuilder, splitter, "Video", videoDecoder, "Input", true);\r
-\r
-                IBaseFilter sampGrabber = (IBaseFilter)new SampleGrabber();\r
-                ConfigureSampleGrabber((ISampleGrabber)sampGrabber);\r
-                hr = m_FilterGraph.AddFilter(sampGrabber, "Sample Grabber");\r
-                DsError.ThrowExceptionForHR(hr);\r
-\r
-                FilterGraphTools.ConnectFilters(graphBuilder, videoDecoder, "Output", sampGrabber, "Input", true);\r
-\r
-                m_videoRenderer = (IBaseFilter)new VideoMixingRenderer9();\r
-                hr = m_FilterGraph.AddFilter(m_videoRenderer, "Video Mixing Renderer 9");\r
-                DsError.ThrowExceptionForHR(hr);\r
-\r
-                FilterGraphTools.ConnectFilters(graphBuilder, sampGrabber, "Output", m_videoRenderer, "VMR Input0", true);\r
-\r
-                ConfigureVideoWindow(hWin);\r
-\r
-                if (DsFindPin.ByName(splitter, "Audio") != null) {\r
-                    IBaseFilter audioDecoder = FilterGraphTools.AddFilterByName(graphBuilder, FilterCategory.LegacyAmFilterCategory, "SONY Audio Mixer");\r
-                    if (audioDecoder == null)\r
-                        throw new Exception("No audio decoder!");\r
-\r
-                    FilterGraphTools.ConnectFilters(graphBuilder, splitter, "Audio", audioDecoder, "Input", true);\r
-                    FilterGraphTools.RenderPin(graphBuilder, audioDecoder, "Output");\r
-                }\r
-\r
-                SaveSizeInfo(sampGrabber as ISampleGrabber);\r
-\r
-            }\r
-            catch (Exception e) {\r
-                Debug.WriteLine(e.Message);\r
-            }\r
-            finally {\r
-            }\r
-        }\r
 \r
         // Configure the video window\r
         private void ConfigureVideoWindow(Control hWin) {\r
index 96b09e564ab2d997112be0c5a463b0e41c2473b5..d5837a3d5ded946f25b547b0ef7d4335c868aad8 100644 (file)
@@ -23,7 +23,7 @@ namespace DxPlay {
         public static MediaDescription GetDescription(string fileName) {\r
             MediaDescription mediaDesc = new MediaDescription();\r
             mediaDesc.fileName = fileName;\r
-            return mediaDesc;\r
+            //return mediaDesc;\r
             logger.Debug("Start MediaInfo");\r
             MediaInfo MI = new MediaInfo();\r
             MI.Open(fileName);\r
diff --git a/server/user.jobengine.executors/jobtemplates/fake-noparams.xml b/server/user.jobengine.executors/jobtemplates/fake-noparams.xml
new file mode 100644 (file)
index 0000000..aaab8a3
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<jobtemplate multiInstance="true">\r
+<commands>\r
+       <calljobstep type="user.jobengine.server.steps.FakeNoParamsStep" weight="1" />\r
+</commands>\r
+</jobtemplate>
\ No newline at end of file
diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeNoParamsStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/FakeNoParamsStep.java
new file mode 100644 (file)
index 0000000..915a19a
--- /dev/null
@@ -0,0 +1,27 @@
+package user.jobengine.server.steps;\r
+\r
+import org.apache.logging.log4j.LogManager;\r
+import org.apache.logging.log4j.Logger;\r
+\r
+import user.jobengine.server.IJobEngine;\r
+import user.jobengine.server.IJobRuntime;\r
+\r
+public class FakeNoParamsStep extends JobStep {\r
+       private static final Logger logger = LogManager.getLogger();\r
+       int count = 10;\r
+\r
+       @StepEntry\r
+       public Object[] execute(IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
+               try {\r
+                       logger.warn("| + | FakeNoParams step");\r
+                       jobRuntime.incrementProgress(50);\r
+                       Thread.sleep(15000);\r
+                       jobRuntime.incrementProgress(100);\r
+                       logger.warn("| - | FakeNoParams step");\r
+               } catch (Exception e) {\r
+                       logger.error(e.getMessage());\r
+               }\r
+               return null;\r
+       }\r
+\r
+}\r
index 94a7408efc3c611c6b8b1e3aaf71e2a5be4becfe..1b10a1745d2f3599f6b7afbb35f83e00da56e314 100644 (file)
@@ -16,14 +16,14 @@ public class FakeStep extends JobStep {
        @StepEntry\r
        public Object[] execute(long itemID, IJobEngine jobEngine, IJobRuntime jobRuntime) {\r
                try {\r
-                       logger.warn(getMarker(), "Starting Fake step");\r
+                       logger.warn("Starting Fake step");\r
                        String json = "{ houseID: '111222' }";\r
                        BasicDBObject o = (BasicDBObject) JSONUtil.jsonToDbObject(json);\r
                        for (int i = 0; i < count; i++) {\r
                                if (!canContinue())\r
                                        break;\r
-                               Thread.sleep(1000);\r
                                jobRuntime.incrementProgress((i + 1) * count);\r
+                               Thread.sleep(10000);\r
                                //                              logger.info("Progress {}", jobRuntime.getProgress());\r
                        }\r
                } catch (Exception e) {\r
index 801e12a7abb33b52b5e8fa2ce18d9b18ce307d7b..12369a82ab9b85f9b1ba645af68110dbff939a7f 100644 (file)
@@ -1,18 +1,64 @@
 package user.commons.nexio.api;
 
-import user.commons.nexio.server.protocol.*;
-
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.List;
+
+import user.commons.nexio.server.protocol.Id;
+import user.commons.nexio.server.protocol.NexioServerProtocol;
+import user.commons.nexio.server.protocol.ProtocolException;
+import user.commons.nexio.server.protocol.Xid;
 
 class MediabaseImpl implements Mediabase {
 
+       private class Itr implements Iterator<Clip> {
+
+               private Clip next;
+
+               public Itr() throws IOException, ProtocolException {
+                       Id id = protocol.executeListFirstIDHandle();
+                       next = id != null ? new ClipImpl(protocol, id) : null;
+               }
+
+               @Override
+               public boolean hasNext() {
+                       return next != null;
+               }
+
+               @Override
+               public Clip next() {
+                       if (next == null) {
+                               return null;
+                       }
+                       final Clip c = next;
+                       try {
+                               Id id = protocol.executeListNextIDHandle();
+
+                               //next = id != null ? new ClipImpl(protocol, id) : null;
+                               if (id != null) {
+                                       next = new ClipImpl(protocol, id);
+                               } else {
+                                       next = null;
+                               }
+                       } catch (IOException e) {
+                               throw new RuntimeException(e);
+                       } catch (ProtocolException e) {
+                               throw new RuntimeException(e);
+                       }
+
+                       return c;
+               }
+
+               @Override
+               public void remove() {
+               }
+
+       }
+
        private static final String ID = "id";
        private final NexioServerProtocol protocol;
-       private MediaListener mediaListener = null; 
-       
+
+       private MediaListener mediaListener = null;
+
        //KONSTRUKTOR
        public MediabaseImpl(NexioServerProtocol protocol) {
                this.protocol = protocol;
@@ -20,17 +66,11 @@ class MediabaseImpl implements Mediabase {
 
        public MediabaseImpl(NexioServerProtocol protocol, boolean startMediaListener) {
                this.protocol = protocol;
-               if(startMediaListener){
-                       this.mediaListener = new MediaListener(this, protocol.getConnection().getHost(), protocol.getConnection().getPort());   
-               }
-       }
-
-       public void startMediaListener(){
-               if(this.mediaListener == null){
+               if (startMediaListener) {
                        this.mediaListener = new MediaListener(this, protocol.getConnection().getHost(), protocol.getConnection().getPort());
                }
        }
-       
+
        @Override
        public Clip getClip(Id id) throws IOException, ProtocolException {
                if (id == null) {
@@ -61,55 +101,17 @@ class MediabaseImpl implements Mediabase {
        public MediaListener getMediaListener() {
                return this.mediaListener;
        }
-       
+
        @Override
        public NexioServerProtocol getProtocol() {
                return this.protocol;
        }
-       private class Itr implements Iterator<Clip> {
-
-               private Clip next;
 
-               public Itr() throws IOException, ProtocolException {
-                       Id id = protocol.executeListFirstIDHandle();
-                       next = id != null ? new ClipImpl(protocol, id) : null;
-               }
-
-               @Override
-               public boolean hasNext() {
-                       return next != null;
-               }
-
-               @Override
-               public Clip next() {
-                       if (next == null) {
-                               return null;
-                       }
-                       final Clip c = next;
-                       try {
-                               Id id = protocol.executeListNextIDHandle();
-                               
-                               //next = id != null ? new ClipImpl(protocol, id) : null;
-                               if(id != null){
-                                       next = new ClipImpl(protocol, id);
-                               }else{
-                                       next = null;
-                               }
-                       } catch (IOException e) {
-                               throw new RuntimeException(e);
-                       } catch (ProtocolException e) {
-                               throw new RuntimeException(e);
-                       }
-
-                       return c;
-               }
-
-               @Override
-               public void remove() {
+       @Override
+       public void startMediaListener() {
+               if (this.mediaListener == null) {
+                       this.mediaListener = new MediaListener(this, protocol.getConnection().getHost(), protocol.getConnection().getPort());
                }
-
        }
 
-       
-       
 }
index 565618551a54334b7364adf29ffed1a7b8ea3061..49450e41f3a05fe62e972daf45f220ab5766c2a2 100644 (file)
@@ -27,4 +27,6 @@ public interface NexioServerProtocol {
 
        public Connection getConnection();
 
+       void setDescription(String id, String description) throws IOException;
+
 }
index 884621c7cb127bff31112b3eeafb15248c086a49..72345194313ceefa4d6ec6345ffd54a7d938627b 100644 (file)
@@ -84,8 +84,17 @@ public class NexioServerProtocolImpl implements NexioServerProtocol {
 
        @Override
        public Connection getConnection() {
-               ;
                return this.connection;
        }
 
+       @Override
+       public void setDescription(String id, String description) throws IOException {
+               byte[] SET_DESCRIPTION = ("...." + id + description).getBytes();
+               SET_DESCRIPTION[0] = (byte) 0xCF;
+               SET_DESCRIPTION[1] = (byte) 0xCC;
+               SET_DESCRIPTION[2] = (byte) 0xBC;
+               SET_DESCRIPTION[3] = (byte) 0x12;
+               connection.write(SET_DESCRIPTION);
+               connection.flush();
+       }
 }
index 7d01d23fa9edde0b338c59489b22274449774770..16474a188a74f86b0c4a979014f6aa4647a9f0f2 100644 (file)
@@ -9,10 +9,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;\r
 \r
 import user.commons.nexio.NexioDataMiner;\r
+import user.commons.nexio.api.Controller;\r
 \r
 public class NexioDataMinerTest {\r
-       private NexioDataMiner sut;\r
-\r
        @BeforeClass\r
        public static void initialize() throws Exception {\r
                //Naplozas\r
@@ -31,6 +30,14 @@ public class NexioDataMinerTest {
                System.getProperties().putAll(properties);\r
        }\r
 \r
+       private NexioDataMiner sut;\r
+\r
+       @Test\r
+       public void reset() {\r
+               sut = new NexioDataMiner();\r
+               sut.reset();\r
+       }\r
+\r
        @Test\r
        public void run() {\r
                sut = new NexioDataMiner();\r
@@ -38,8 +45,9 @@ public class NexioDataMinerTest {
        }\r
 \r
        @Test\r
-       public void reset() {\r
-               sut = new NexioDataMiner();\r
-               sut.reset();\r
+       public void setDesc() throws Exception {\r
+               Controller c = new Controller("10.10.1.56");\r
+               c.connect();\r
+               c.getMediabase().getProtocol().setDescription("%0000205", "VALAMI");\r
        }\r
 }\r
index 283a227e888ededb740e6edd220c60db8d0907a4..5bd09beda64457794a6da93ea11ff080a97da274 100644 (file)
@@ -245,6 +245,10 @@ public class JobEngine implements IJobEngine {
                }
        }
 
+       private void bootstrap() throws JobEngineException {
+               submit("fake-noparams.xml", "Bootstrap", null);
+       }
+
        protected Map<Long, IJobRuntime> createJobs() {
                return new ConcurrentHashMap<Long, IJobRuntime>();
        }
@@ -736,11 +740,13 @@ public class JobEngine implements IJobEngine {
 
                        schedulerService = new SchedulerService(this);
                        schedulerService.statrtup();
+                       bootstrap();
                } catch (Exception e) {
                        logger.error(e);
                }
 
                logger.info("JobEngine started");
+
        }
 
        private void submit(IJobRuntime runtime) {
index 5144c111a712d2061c3d2e7681b91ef1a010456c..b9544737d86f65b4b8c61a3ee9d05738c9521c7b 100644 (file)
@@ -69,6 +69,7 @@ public class JobStepExecutor implements IJobStepExecutor {
                        try {
                                this.join();
                        } catch (InterruptedException e) {
+                               logger.catching(e);
                        }
                }
        }