package com.yfd.monitor.media.service;



import com.yfd.monitor.common.CommonCallback;
import com.yfd.monitor.common.StreamInfo;
import com.yfd.monitor.gdw2019.bean.SendRtpItem;
import com.yfd.monitor.media.bean.MediaInfo;
import com.yfd.monitor.media.zlm.dto.MediaServerItem;
import com.yfd.monitor.vmanager.bean.WVPResult;

import java.io.IOException;
import java.util.List;
import java.util.Map;

public interface IMediaNodeServerService {
    int createRTPServer(MediaServerItem mediaServer, String streamId, long ssrc, Integer port, Boolean onlyAuto,
                        Boolean disableAudio, Boolean reUsePort, Integer tcpMode);

    void closeRtpServer(MediaServerItem mediaServer, String streamId);

    void closeRtpServer(MediaServerItem mediaServer, String streamId, CommonCallback<Boolean> callback);

    void closeStreams(MediaServerItem mediaServer, String app, String stream);

    Boolean updateRtpServerSSRC(MediaServerItem mediaServer, String stream, String ssrc);

    boolean checkNodeId(MediaServerItem mediaServer);

    void online(MediaServerItem mediaServer);

    MediaServerItem checkMediaServer(String ip, int port, String secret);

    boolean stopSendRtp(MediaServerItem mediaInfo, String app, String stream, String ssrc);

    boolean initStopSendRtp(MediaServerItem mediaInfo, String app, String stream, String ssrc);

    boolean deleteRecordDirectory(MediaServerItem mediaServer, String app, String stream, String date, String fileName);

    List<StreamInfo> getMediaList(MediaServerItem mediaServer, String app, String stream, String callId);

    Boolean connectRtpServer(MediaServerItem mediaServer, String address, int port, String stream);

    void getSnap(MediaServerItem mediaServer, String streamUrl, int timeoutSec, int expireSec, String path, String fileName) throws IOException;

    MediaInfo getMediaInfo(MediaServerItem mediaServer, String app, String stream);

    Boolean pauseRtpCheck(MediaServerItem mediaServer, String streamKey);

    Boolean resumeRtpCheck(MediaServerItem mediaServer, String streamKey);

    String getFfmpegCmd(MediaServerItem mediaServer, String cmdKey);

    WVPResult<String> addFFmpegSource(MediaServerItem mediaServer, String srcUrl, String dstUrl, int timeoutMs,
                                      boolean enableAudio, boolean enableMp4, String ffmpegCmdKey);

    WVPResult<String> addStreamProxy(MediaServerItem mediaServer, String app, String stream, String url, boolean enableAudio, boolean enableMp4, String rtpType);

    Boolean delFFmpegSource(MediaServerItem mediaServer, String streamKey);

    Boolean delStreamProxy(MediaServerItem mediaServer, String streamKey);

    Map<String, String> getFFmpegCMDs(MediaServerItem mediaServer);

    void startSendRtpPassive(MediaServerItem mediaServer, SendRtpItem sendRtpItem, Integer timeout);

    void startSendRtpStream(MediaServerItem mediaServer, SendRtpItem sendRtpItem);
}
