Пример #1
0
 def __init__(self, ip, port, version=4):
     '''
     ip:接收端的IP地址
     port:接收的端口号
     version:协议版本号
     level:视频流抽帧频率
     '''
     self.aclient = Audio_Client(ip, port, version)
     self.stop_aclient = self.aclient.stop_aclient
     self.aclient.start()
Пример #2
0
 def __vchat(self):
     print(self.toip, self.toport, self.seport)
     VERSION = 4
     SHOWME = 1
     LEVEL = 1
     vclient = Video_Client(self.toip, self.toport + 1, SHOWME, LEVEL,
                            VERSION)
     aclient = Audio_Client(self.toip, self.toport + 2, VERSION)
     vclient.start()
     aclient.start()
Пример #3
0
    def __init__(self, ip, port, label, version=4, level=1):
        '''
        ip:接收端的IP地址
        port:接收的端口号
        version:协议版本号
        level:视频流抽帧频率
        '''
        self.vclient = Video_Client(ip, port, label, version, level)
        self.stop_vclient = self.vclient.stop_vclient
        self.aclient = Audio_Client(ip, port + 1, version)
        self.stop_aclient = self.aclient.stop_aclient

        self.vclient.start()
        self.aclient.start()
Пример #4
0
class AudioClient():
    def __init__(self, ip, port, version=4):
        '''
        ip:接收端的IP地址
        port:接收的端口号
        version:协议版本号
        level:视频流抽帧频率
        '''
        self.aclient = Audio_Client(ip, port, version)
        self.stop_aclient = self.aclient.stop_aclient
        self.aclient.start()

    def __del__(self):
        print('media的del函数触发')
        self.stop_aclient.append('True')
Пример #5
0
def func():
    vclient = Video_Client(IP, PORT, SHOWME, LEVEL, VERSION)
    vserver = Video_Server(PORT, VERSION)
    aclient = Audio_Client(IP, PORT + 1, VERSION)
    aserver = Audio_Server(PORT + 1, VERSION)
    vclient.start()
    vserver.start()
    aclient.start()
    aserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            #sys.exit(0)
        if not aserver.isAlive() or not aclient.isAlive():
            print("Audio connection lost...")
Пример #6
0
class VideoClient():
    def __init__(self, ip, port, label, version=4, level=1):
        '''
        ip:接收端的IP地址
        port:接收的端口号
        version:协议版本号
        level:视频流抽帧频率
        '''
        self.vclient = Video_Client(ip, port, label, version, level)
        self.stop_vclient = self.vclient.stop_vclient
        self.aclient = Audio_Client(ip, port + 1, version)
        self.stop_aclient = self.aclient.stop_aclient

        self.vclient.start()
        self.aclient.start()

    def __del__(self):
        print('media的del函数触发')
        self.stop_vclient.append('True')
        self.stop_aclient.append('True')
Пример #7
0
class openav():
    """选择目标机器开启av"""
    def __init__(self, ip):
        PORT = 11111
        self.vclient = Video_Client(ip, PORT, 1, 4)
        self.vserver = Video_Server(PORT - 1, 4)
        self.aclient = Audio_Client(ip, PORT + 1, 4)
        self.aserver = Audio_Server(PORT + 2, 4)

    def start(self):
        self.vclient.start()
        self.aclient.start()
        time.sleep(1)
        self.vserver.start()
        self.aserver.start()
        while True:
            time.sleep(1)
            if not self.vserver.isAlive() or not self.vclient.isAlive():
                print("Video connection lost...")
                sys.exit(0)
            if not self.aserver.isAlive() or not self.aclient.isAlive():
                print("Audio connection lost...")
                sys.exit(0)
Пример #8
0
parser.add_argument('--host', type=str, default='127.0.0.1')
parser.add_argument('--port', type=int, default='8888')
parser.add_argument('--level', type=int, default=1)
parser.add_argument('-v', '--version', type=int, default=4)

args = parser.parse_args()

IP = args.host
PORT = args.port
VERSION = args.version
LEVEL = args.level

if __name__ == '__main__':
    vclient = Video_Client(IP, PORT, LEVEL, VERSION)
    vserver = Video_Server(PORT, VERSION)
    aclient = Audio_Client(IP, PORT + 1, VERSION)
    aserver = Audio_Server(PORT + 1, VERSION)
    vclient.start()
    aclient.start()
    time.sleep(1)
    vserver.start()
    aserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            sys.exit(0)
        if not aserver.isAlive() or not aclient.isAlive():
            print("Audio connection lost...")
            sys.exit(0)
Пример #9
0
 def __init__(self, ip):
     PORT = 11111
     self.vclient = Video_Client(ip, PORT, 1, 4)
     self.vserver = Video_Server(PORT - 1, 4)
     self.aclient = Audio_Client(ip, PORT + 1, 4)
     self.aserver = Audio_Server(PORT + 2, 4)
Пример #10
0
parser.add_argument('--noself', type=bool, default=False)
parser.add_argument('--level', type=int, default=1)

args = parser.parse_args()

sIP = args.shost
sPORT = args.sport
sVERSION = args.sversion
# rIP = args.rhost
# rPORT = args.rport
# rVERSION = args.rversion
SHOWME = not args.noself
LEVEL = args.level

if __name__ == '__main__':
    vclient = Video_Client(sIP, sPORT, sVERSION, SHOWME, LEVEL)
    vserver = Video_Server(sIP, sPORT + 1, sVERSION)
    aclient = Audio_Client(sIP, sPORT + 2, sVERSION)
    aserver = Audio_Server(sIP, sPORT + 3, sVERSION)
    vclient.start()
    vserver.start()
    aclient.start()
    aserver.start()
    while True:
        time.sleep(1)
        if not vserver.isAlive() or not vclient.isAlive():
            print("Video connection lost...")
            sys.exit(0)
        if not aserver.isAlive() or not aclient.isAlive():
            print("Audio connection lost...")
            sys.exit(0)