×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Python, module for streaming similar to gst

    I would like to make a streaming audio between two phones (Nokia n95). I found out GSTREAMER as module for streaming that, but I read it is not available on Symbian platform.
    Can you suggest me something?
    Can I use somehow rtp?
    Thanks

  2. #2
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    I would like to make a streaming audio between two phones (Nokia n95). I found out GSTREAMER as module for streaming that, but I read it is not available on Symbian platform.
    Can you suggest me something?
    Can I use somehow rtp?
    Thanks
    Hi!

    I think we do not have something similar in PyS60. Sometime ago I was thinking about an application for DJs where the phone could be used to send audio on its 3.5mm audio port and over BT/WiFi (using sockets), to another phone. And these two phones could be used as pickups. But I never wrote such program ...

    I think you can use sockets to create server/client apps on phones and implement this streaming.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by marcelobarrosalmeida View Post
    Hi!

    I think we do not have something similar in PyS60. Sometime ago I was thinking about an application for DJs where the phone could be used to send audio on its 3.5mm audio port and over BT/WiFi (using sockets), to another phone. And these two phones could be used as pickups. But I never wrote such program ...

    I think you can use sockets to create server/client apps on phones and implement this streaming.
    I ve already an application over UDP/IP/wifi that can send data, so just messages or whole file.. I would like something to manage the streaming..you think there isn't, dont u?
    thanks anyway

  4. #4
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    I ve already an application over UDP/IP/wifi that can send data, so just messages or whole file.. I would like something to manage the streaming..you think there isn't, dont u?
    thanks anyway
    No, unfortunately. You need to write it or port from some python code or C lib

  5. #5
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by marcelobarrosalmeida View Post
    No, unfortunately. You need to write it or port from some python code or C lib
    ok thanks a lot for the answer, even if it put me in a lot of trubbles

    just an another question, do you think that this link, written by u, I suppose, can be useful?

    http://wiki.forum.nokia.com/index.ph...rom_S60_phones

    thanks a lot marcelo

  6. #6
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    ok thanks a lot for the answer, even if it put me in a lot of trubbles

    just an another question, do you think that this link, written by u, I suppose, can be useful?

    http://wiki.forum.nokia.com/index.ph...rom_S60_phones
    I don´t think so, nicksca2002
    I used the S60 browser to receive the streaming from Qik site.
    But, if it is not difficult to create a stream using some standard protocol, it may be a escape.

  7. #7
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Nick, I couldn't answer your email, your account did not allowed it.

    I never implemented any extension in C for Python but I know that other guys in the dibo did it, so they can help you. I did already a simple binding for standard python and it is easy. Moreover, people like ctypes for browsing/loading external dll in python but I don't know if it works in pys60.

    You can use file like sockets in your streaming, like below:

    Code:
    from socket import *
    
    ip = '127.0.0.1'
    port = 54321
    
    f = open('filename.txt','rb')
    s = socket(AF_INET,SOCK_STREAM)
    s.connect((ip,port))
    mf = s.makefile()
    
    while True:
        data = f.read(1024)
        if not data:
            break
        mf.write(data)
        mf.flush()
        # any waiting/calc here to ensure the target data rate ?
    
    s.close()
    f.close()
    This article may help as well.

  8. #8
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by marcelobarrosalmeida View Post
    Nick, I couldn't answer your email, your account did not allowed it.

    I never implemented any extension in C for Python but I know that other guys in the dibo did it, so they can help you. I did already a simple binding for standard python and it is easy. Moreover, people like ctypes for browsing/loading external dll in python but I don't know if it works in pys60.

    You can use file like sockets in your streaming, like below:

    Code:
    from socket import *
    
    ip = '127.0.0.1'
    port = 54321
    
    f = open('filename.txt','rb')
    s = socket(AF_INET,SOCK_STREAM)
    s.connect((ip,port))
    mf = s.makefile()
    
    while True:
        data = f.read(1024)
        if not data:
            break
        mf.write(data)
        mf.flush()
        # any waiting/calc here to ensure the target data rate ?
    
    s.close()
    f.close()
    This article may help as well.

    thanks very much marcelo, i ve just saw your answer..i didnt notice before
    i m sorry if i ve just opened a thread similar to this one

    just a question: in your example the trasmission of the file is over tcp/ip..
    is it possible with the same method even with udp?
    Last edited by nicksca2002; 2010-02-16 at 16:57.

  9. #9
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    is it possible with the same method even with udp?
    Yes, although UDP is best effort only. Just change SOCK_STREAM to SOCK_DGRAM. And you can avoid the connect() in this case, if you want but it will be necessary to use sendto() and recvfrom().

  10. #10
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by marcelobarrosalmeida View Post
    Yes, although UDP is best effort only. Just change SOCK_STREAM to SOCK_DGRAM. And you can avoid the connect() in this case, if you want but it will be necessary to use sendto() and recvfrom().
    in the next code, u showed me, how to use those istructions?
    we are using mf.write() to send, aren't we?
    we should substitute this istruction with sendto()?
    Thanks


    from socket import *

    ip = '127.0.0.1'
    port = 54321

    f = open('filename.txt','rb')
    s = socket(AF_INET,SOCK_STREAM)
    s.connect((ip,port))
    mf = s.makefile()

    while True:
    data = f.read(1024)
    if not data:
    break
    mf.write(data)
    mf.flush()
    # any waiting/calc here to ensure the target data rate ?

    s.close()
    f.close()

  11. #11
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    in the next code, u showed me, how to use those istructions? we are using mf.write() to send, aren't we?
    we should substitute this istruction with sendto()?
    You dont need to use them, they are a facility (see this article, please).
    You can use standard UDP socket and its functions. In this case, use sendto() and recvfrom(), something like below (not tested):

    Code:
    from socket import *
    
    ip = '127.0.0.1'
    port = 54321
    
    f = open('filename.txt','rb')
    s = socket(AF_INET,SOCK_DGRAM)
    
    while True:
        data = f.read(1024)
        if not data:
            break
        # sendto return the number of bytes sent and this number may be smaller
        # than len(data), you need to check it
        n = 0
        while n < len(data):
            m = s.sendto(data[n:],(ip,port))
            n = n + m
        # any waiting/calc here to ensure the target data rate ?
    
    s.close()
    f.close()

  12. #12
    Registered User
    Join Date
    Oct 2009
    Posts
    18

    Re: Python, module for streaming similar to gst

    Hi Marcelo, I really want to thank u for all the advices u gave me!
    Now I can transfer audio chunk! and play it in some way, even if i have changed something from the code u suggested

    anyway, I want to ask u if there is a way to increase the rate of transmission of the packets! How can i see the throughput of the network I have built? I m not talking about the theorical, but really what i have!
    Is in nokia forum (wiki) some article to help me?

    there is some module in python similar to Wave to manage mp3?

    Thanks a lot

  13. #13
    Super Contributor
    Join Date
    Nov 2007
    Location
    Sertaozinho/Brazil
    Posts
    768

    Re: Python, module for streaming similar to gst

    Quote Originally Posted by nicksca2002 View Post
    Hi Marcelo, I really want to thank u for all the advices u gave me!
    Now I can transfer audio chunk! and play it in some way, even if i have changed something from the code u suggested
    You are welcome! And I will forward this "thank you" to the PyS60 community. Really great people here !

    anyway, I want to ask u if there is a way to increase the rate of transmission of the packets! How can i see the throughput of the network I have built? I m not talking about the theorical, but really what i have! Is in nokia forum (wiki) some article to help me?
    there is some module in python similar to Wave to manage mp3?
    Increase ? How is your transmission loop ? Sending all the time until file is transmitted ? If yes, I am afraid to say that the limit may be your phone spec or communication lines. Only avoid small UDP/TCP packages, anyway.

    About the second question: have you tried Energy Profiler ? I think it can plot WLAN speed.
    I tried to use logs module, like:
    Code:
    import logs
    d = logs.log_data("data")
    but it is returning an empty list.

Similar Threads

  1. Python for S60 1.9.2 released
    By tvijayan in forum Symbian
    Replies: 26
    Last Post: 2009-03-11, 09:28
  2. Python for S60 1.9.1 released
    By tvijayan in forum Symbian
    Replies: 30
    Last Post: 2009-02-26, 06:16
  3. threading module in Python 1.4.5
    By widetech1 in forum Symbian
    Replies: 1
    Last Post: 2009-02-04, 17:13
  4. need help of module Parser for python s60 1.4
    By shinestudio in forum Symbian
    Replies: 2
    Last Post: 2009-01-01, 12:07
  5. Replies: 1
    Last Post: 2005-08-20, 12:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×