Programming with libvlc_vlm

*nix specific usage questions
darkweaver87
Blank Cone
Blank Cone
Posts: 12
Joined: 06 Jun 2008 11:13

Programming with libvlc_vlm

Postby darkweaver87 » 16 Jul 2008 10:20

Hi everyone,

I want to do is this :
- the server (the application I had to develop) is listening
- the client send it a sip message with its features (such as its resolution)
- the server starts the streaming of the video (in RTP) with the destination the IP address of the client
- during the video is playing the client realize that the there is a lot of traffic and the fluidity is decreasing. So it send an other SIP message containing the command "decrease the bitrate" (for instance).

So the server must be able to adapt these parameters on the video. And, I chose VLC because it is for me the project the most successfully completed.

I am writting my application in C and I use libvlc.

Here is my code :

Code: Select all

... pthread_create(&vlc, NULL, streamerVLC, buff); ... void *streamerVLC(void *arg) { printf("%s : %s\n", __FUNCTION__, (char *)arg); libvlc_exception_t vlcExcep; libvlc_instance_t *vlcInstance; float position; char *vlcOptions[] = {""}; libvlc_exception_init (&vlcExcep); /*char *vlcOptions[] = {"", "sout=#transcode{vcodec=h264,vb=1024,scale=1}:duplicate{dst=std{access=rtp,mux=ts,dst=192.168.1.34:1234}}"};*/ if((vlcInstance = libvlc_new(1, vlcOptions, &vlcExcep)) == NULL || libvlc_exception_raised(&vlcExcep)) { perror("libvlc_new"); return NULL; } libvlc_vlm_add_broadcast(vlcInstance, "test", "file:///home/partage/Videos/superman_originale.avi", "#transcode{vcodec=mp4v,vb=1024,scale=1}:duplicate{dst=rtp{mux=ts,dst=192.168.1.34,port=1234}}", 0, vlcOptions, 1, 0, &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_add_broadcast"); return NULL; } libvlc_vlm_play_media(vlcInstance, "test", &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_play_media"); return NULL; } sleep(5); libvlc_vlm_pause_media(vlcInstance, "test", &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_pause_media"); return NULL; } position = libvlc_vlm_get_media_instance_position(vlcInstance, "test", 0, &vlcExcep); libvlc_vlm_stop_media(vlcInstance, "test", &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_get_media_instance_position"); return NULL; } printf("show : %s\n", libvlc_vlm_show_media(vlcInstance, "test", &vlcExcep)); if(libvlc_exception_raised(&vlcExcep)) { perror("l libvlc_vlm_show_media"); return NULL; } libvlc_vlm_del_media(vlcInstance, "test", &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_del_media"); return NULL; } libvlc_vlm_add_broadcast(vlcInstance, "test", "file:///home/partage/Videos/superman_originale.avi", "#transcode{vcodec=mp4v,vb=1024,scale=2}:duplicate{dst=rtp{mux=ts,dst=192.168.1.34,port=1234}}", 0, vlcOptions, 1, 0, &vlcExcep); libvlc_vlm_seek_media(vlcInstance, "test", position, &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_seek_media"); return NULL; } libvlc_vlm_play_media(vlcInstance, "test", &vlcExcep); if(libvlc_exception_raised(&vlcExcep)) { perror("libvlc_vlm_play_media"); return NULL; } return NULL; }
Here is the outpout console :
[00000001] main libvlc debug: translation test: code is "C"
[00000412] main demux error: object is not attached
[00000410] main access error: object is not attached
[00000414] main packetizer error: object is not attached
[00000432] main packetizer error: object is not attached
show : (null)
l libvlc_vlm_show_media: Connection refused
Thanks in advance. All ideas are welcomed !

Return to “VLC media player for Linux and friends Troubleshooting”

Who is online

Users browsing this forum: No registered users and 18 guests