fuliqi
2024-08-29 4163c93761115c7524ef74a557a1f5e01eafb429
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.ycl.api.YS.liveview.live;
 
import com.ycl.api.YS.NetDemo;
 
import javax.swing.*;
 
/**
 * 
 * @introduction Callback function to register live stream (decoded media stream data)
 * @description Support IPC/NVR/VMS
 */
public class PlayDecodeVideoCB {
    
    /**
     * 
     * @introduction Start callback function to register live stream (decoded media stream data)
     * @description  Calling the interface of NETDEV_SetPlayDecodeVideoCB to start callback function to register streams (original stream)
     *
     */
    public static void startCallBack() {
        if(null == NetDemo.lpUserID) {
            JOptionPane.showMessageDialog(null, "Please Login device first. error code"+NetDemo.netdevsdk.NETDEV_GetLastError());
            return;
            }
        if(null != NetDemo.lpPlayHandle){
            boolean bRet = NetDemo.netdevsdk.NETDEV_SetPlayDecodeVideoCB(NetDemo.lpPlayHandle, NetDemo.fPlayDecodeVideoCALLBACK, 1, null);
            if(bRet){
                NetDemo.jButtonStopDecodeData.setEnabled(true);
                NetDemo.jButtonStartDecodeData.setEnabled(false);
            }
            else{
                JOptionPane.showMessageDialog(null, "Set Play Decode Video failed.");
            }
        }else{
            JOptionPane.showMessageDialog(null, "Start live preview, please.");
        }
    }
   
    /**
     * 
     * @introduction stop callback function to register live stream (decoded media stream data)
     * @description  Calling the interface of NETDEV_SetPlayDecodeVideoCB to stop callback function to register streams (original stream)
     *
     */
    public static void stopCallBack() {
        if(null != NetDemo.lpPlayHandle){
            NetDemo.netdevsdk.NETDEV_SetPlayDecodeVideoCB(NetDemo.lpPlayHandle, null, 1, null);
            NetDemo.jButtonStartDecodeData.setEnabled(true);
            NetDemo.jButtonStopDecodeData.setEnabled(false);
        }
    
    }
}