[vlc] Question on VLC as the server

Brook Lin gnu.fans at yahoo.com
Mon Feb 23 20:01:24 CET 2009


Hi All,

I am working on wireless communications. I have a USRP board to receive
video streaming. I tried to feed the received data to a socket as the
client. Then, I open a vlc as the server to open the network stream via UDP.
The code is shown below.

# the server
vlc udp://@:2002

# the client, which is part of my receiver code written in Python

def main():
    ......
    def rx_callback(ok, payload):
        ......
        print "ok = %5s  pktno = %4d  n_rcvd = %4d  n_right = %4d" % (ok,
pktno, n_rcvd, n_right)

        rxdata.append(payload[2:])    #rxdata is my received data, then I
feed these data to a socket client
        clientHost = 'localhost'           # servername is localhost'
        clientPort = 2002                   # use arbitrary port > 1024     
        dgramSock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )    #
create a UDP socket
                                                                   
        dgramSock.connect((clientHost,clientPort)) # connect to server on
the port
        for ndx_data in rxdata:
            dgramSock.sendto( ndx_data, (clientHost, clientPort) )             
# send the data
            data = dgramSock.recv(4096)                 # receive up to 4096
bytes
            #print data
        dgramSock.close()

    .......

My questions are:
1, I don't think the client and the server(VLC) are connected via UDP
2, Is it correct that I write the received data to a client UDP socket?
3, If I change the server to the following(don't use VLC as the server), I
can play serverfile.mpeg using VLC. However, I don't want vlc to open from
file.
serverHost = ''
serverPort = 2002
dgramSock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
dgramSock.bind( (serverHost, serverPort) )
msggot=[]
while 1:
  msg, (addr, port) = dgramSock.recvfrom(4096)
  print 'Server connected by', addr,port
  #print 'Server got ',msg
  dgramSock.sendto( msg, (addr, port) )
 
  fd = open('serverfile.mpeg','a')
  fd.write(msg)
  fd.close
dgramSock.close()

Overall, I want to play the realtime video that I received. Can
anyone help me with these questions? I really appreciate.

Thanks,
Brook
-- 
View this message in context: http://www.nabble.com/Question-on-VLC-as-the-server-tp22167345p22167345.html
Sent from the VLC (VideoLAN) mailing list archive at Nabble.com.




More information about the vlc mailing list