how to view stream sent by me libvlc C/C++ -
im on ubuntu 14.04 , i'm trying write programme stream desktop, using reply this: libvlc stream part of screen example. however, don't have computer readily aviable see stream going along well, how can view stream on computer?
libvlc_vlm_add_broadcast(inst, "mybroad", "screen://", "#transcode{vcodec=h264,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ts,dst=:8080/stream}", 5, params, 1, 0)
my programme throws no errors, , writes this
[0x7f0118000e18] x264 encoder: using cpu capabilities: mmx2 sse2fast ssse3 sse4.2 avx [0x7f0118000e18] x264 encoder: profile high, level 3.0 [0x7f0118000e18] x264 encoder: final ratefactor: 25.54 [0x7f0118000e18] x264 encoder: using sar=1/1 [0x7f0118000e18] x264 encoder: using cpu capabilities: mmx2 sse2fast ssse3 sse4.2 avx [0x7f0118000e18] x264 encoder: profile high, level 2.2
so me, seems ok. however, don't know how view stream computer- if open vlc , seek open network stream, using http:// @:7777 (space on purpose, website not allow post such links) invalid host error in log. silly error or error on part, help appreciated!
if needs it, entire code (i'm using qt 4.8.6):
#include <qcoreapplication> #include <iostream> #include <vlc/vlc.h> #include <x11/xlib.h> // #include <qdebug> using namespace std; bool ended; void playerended(const libvlc_event_t* event, void *ptr); libvlc_media_list_t * subitems; libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *media; libvlc_media_t * stream; int main(int argc, char *argv[]) { xinitthreads(); qcoreapplication::setattribute(qt::aa_x11initthreads); ended = false; qcoreapplication a(argc, argv); // array parameters const char* params[] = {"screen-top=0", "screen-left=0", "screen-width=640", "screen-height=480", "screen-fps=10"}; // load vlc engine */ inst = libvlc_new (0, null); if(!inst) std::cout << "can't load video player plugins" << std::endl; cout<< "add broacast: " << libvlc_vlm_add_broadcast(inst, "mybroad", "screen://", "#transcode{vcodec=h264,vb=800,scale=1,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=ts,dst=:8080/stream}", 5, params, // <= 5 == sizeof(params) == count of parameters 1, 0)<< '\n'; cout<< "poczatek broacastu: " <<libvlc_vlm_play_media(inst, "mybroad")<< '\n'; media = libvlc_media_new_location(inst,http://@:8080/stream"); // create media player playing environment mp = libvlc_media_player_new (inst); libvlc_media_player_play (mp); cout<<"szatan!!!"<<endl; int e; cin>>e; /* stop playing */ libvlc_media_player_stop (mp); /* free media_player */ libvlc_media_player_release (mp); libvlc_release (inst); homecoming a.exec(); }
so, have found answer- stack overflow wont allow me post reply because i'm new here, in comments! should have used ip address when creating media: media = libvlc_media_new_location(inst, "http: //192.168.1.56:8080");(space on purpose forum not hide link) works great! –
c++ c http stream libvlc
No comments:
Post a Comment