コード例 #1
0
void SoundPlay::inputFile(char* input_name) {

	libvlc_instance_t *inst;
	libvlc_media_player_t *mp;
	libvlc_media_t *m;

	// load the vlc engine
	inst = libvlc_new(0, NULL);

	// create a new item
	m = libvlc_media_new_path(inst, input_name);

	// create a media play playing environment
	mp = libvlc_media_player_new_from_media(m);

	// no need to keep the media now
	libvlc_media_release(m);

	// play the media_player
	libvlc_media_player_play(mp);

	sleep(2);

	// stop playing
	libvlc_media_player_stop(mp);

	// free the media_player
	libvlc_media_player_release(mp);

	libvlc_release(inst);
}
コード例 #2
0
ファイル: VLC.cpp プロジェクト: artcom/y60vlc
    void
    VLC::load(const std::string & theFilename) {

        AC_DEBUG << "VLC::load('" << theFilename << "')";

        _EOF = false;
        _playTime = 0;
        
        std::vector<std::string> elements = asl::splitString(theFilename, "#");
        if (elements.size() == 2) {
            _playTime = as<asl::Unsigned64>(elements[1]);
            AC_DEBUG << "parsed playback position at " << _playTime << " milliseconds.";
        }
        
        _mediaURL = elements[0];
        libvlc_media_t *media = libvlc_media_new_location(_libvlc, _mediaURL.c_str());
        libvlc_media_player_set_media(_mediaPlayer, media);
        libvlc_media_release(media);

        libvlc_video_set_callbacks(_mediaPlayer, VLC::lock, VLC::unlock, VLC::display, this);
        _rasterEncoding = BGR;
        setPixelFormat(_rasterEncoding);
        libvlc_video_set_format_callbacks(_mediaPlayer, VLC::setup_video, VLC::cleanup_video);

        libvlc_media_player_play(_mediaPlayer);
        if (_playTime > 0) {
            libvlc_media_player_set_time(_mediaPlayer, _playTime);
        }
    }
コード例 #3
0
ファイル: xmrplayer.c プロジェクト: dereky7/xmradio
gboolean
xmr_player_play(XmrPlayer *player)
{
	g_return_val_if_fail(player != NULL, FALSE);
	
	return libvlc_media_player_play(player->priv->player) == 0;
}
コード例 #4
0
void Player::playFile(QString file)
{
    //the file has to be in one of the following formats /perhaps a little bit outdated)
    /*
    [file://]filename              Plain media file
    http://ip:port/file            HTTP URL
    ftp://ip:port/file             FTP URL
    mms://ip:port/file             MMS URL
    screen://                      Screen capture
    [dvd://][device][@raw_device]  DVD device
    [vcd://][device]               VCD device
    [cdda://][device]              Audio CD device
    udp:[[<source address>]@[<bind address>][:<bind port>]]
    */

    /* Create a new LibVLC media descriptor */
    _m = libvlc_media_new_path(_vlcinstance, file.toAscii());
    //_m = libvlc_media_new (_vlcinstance, file.toAscii(), &_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.
    //raise(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.

    libvlc_media_player_set_media (_mp, _m);
    //libvlc_media_player_set_media (_mp, _m, &_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.
    //raise(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.

    // /!\ Please note /!\
    //
    // passing the widget to the lib shows vlc at which position it should show up
    // vlc automatically resizes the video to the given size of the widget
    // and it even resizes it, if the size changes at the playing

    /* Get our media instance to use our window */
    #if defined(Q_OS_WIN)
        libvlc_media_player_set_drawable(_mp, reinterpret_cast<unsigned int>(_videoWidget->winId()));
        //libvlc_media_player_set_drawable(_mp, reinterpret_cast<unsigned int>(_videoWidget->winId()), &_vlcexcep ); // [20101215 JG] Used for versions prior to VLC 1.2.0.
        //libvlc_media_player_set_hwnd(_mp, _videoWidget->winId(), &_vlcexcep ); // for vlc 1.0
    #elif defined(Q_OS_MAC)
        libvlc_media_player_set_drawable(_mp, _videoWidget->winId());
        //libvlc_media_player_set_drawable(_mp, _videoWidget->winId(), &_vlcexcep ); // [20101215 JG] Used for versions prior to VLC 1.2.0.
        //libvlc_media_player_set_agl (_mp, _videoWidget->winId(), &_vlcexcep); // for vlc 1.0
    #else //Linux
        //[20101201 Ondrej Spilka] obsolete call on libVLC >=1.1.5
        //libvlc_media_player_set_drawable(_mp, _videoWidget->winId(), &_vlcexcep );
        //libvlc_media_player_set_xwindow(_mp, _videoWidget->winId(), &_vlcexcep ); // for vlc 1.0

     /* again note X11 handle on Linux is needed
        winID() returns X11 handle when QX11EmbedContainer us used */

        int windid = _videoWidget->winId();
        libvlc_media_player_set_xwindow (_mp, windid );

    #endif
    //raise(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.

    /* Play */
    libvlc_media_player_play (_mp);
    //libvlc_media_player_play (_mp, &_vlcexcep ); // [20101215 JG] Used for versions prior to VLC 1.2.0.
    //raise(&_vlcexcep); // [20101215 JG] Used for versions prior to VLC 1.2.0.

    _isPlaying=true;
}
コード例 #5
0
ファイル: wx_player.cpp プロジェクト: 371816210/vlc_vlc
void MainWindow::play() {
    libvlc_media_player_play(media_player);
    playpause_button->SetLabel(wxT("Pause"));
    playpause_button->Enable(true);
    stop_button->Enable(true);
    timeline->Enable(true);
}
コード例 #6
0
ファイル: mediacontrol.c プロジェクト: bryantirop/bryanplay
static bool media_play()
{
	int64_t ms_media_length;
	int s_length;
	
	
	libvlc_media_parse(media_handle);
    s_length = (int)(ceil(libvlc_media_get_duration(media_handle)/1000));
	
	current_media_duration = s_length;
	
	if(s_length == -1)
		return false;
	
	libvlc_media_player_set_hwnd(mediaplay,(void *)hwnd_handle);
	
	libvlc_media_player_play(mediaplay);
		
	
	sleep(s_length);
	
	libvlc_media_player_stop(mediaplay);
	libvlc_media_release(media_handle);
	
	return true;
}
コード例 #7
0
/* TODO: NOT IN VLC API */
void
Java_org_videolan_libvlc_MediaPlayer_nativePlayMRL(JNIEnv *env, jobject thiz,
                                                   jstring mrl,
                                                   jobjectArray mediaOptions)
{
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return;

    /* New Media */
    const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, 0);
    libvlc_media_t* p_md = libvlc_media_new_location(p_obj->p_libvlc, p_mrl);

    /* media options */
    if (mediaOptions != NULL)
        add_media_options(p_md, env, mediaOptions);

    (*env)->ReleaseStringUTFChars(env, mrl, p_mrl);

    /* Connect the media event manager. */
    /* TODO use VlcObject events */
    libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);
    static const libvlc_event_type_t mp_media_events[] = {
        libvlc_MediaParsedChanged,
        libvlc_MediaMetaChanged,
    };
    for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)
        libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, NULL);

    libvlc_media_player_set_media(p_obj->u.p_mp, p_md);
    libvlc_media_release(p_md);

    libvlc_media_player_play(p_obj->u.p_mp);
}
コード例 #8
0
ファイル: qtvlcwidget.cpp プロジェクト: mstorsjo/vlc
bool QtVLCWidget::playMedia(const char* url)
{
    m_media = libvlc_media_new_location (m_vlc, url);
    if (m_media == nullptr) {
        fprintf(stderr, "unable to create media %s", url);
        return false;
    }
    m_mp = libvlc_media_player_new_from_media (m_media);
    if (m_mp == nullptr) {
        fprintf(stderr, "unable to create media player");
        libvlc_media_release(m_media);
        return false;
    }

    // Define the opengl rendering callbacks
    libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
        VLCVideo::setup, VLCVideo::cleanup, VLCVideo::resizeRenderTextures, VLCVideo::swap,
        VLCVideo::make_current, VLCVideo::get_proc_address,
        mVLC);

    // Play the video
    libvlc_media_player_play (m_mp);

    return true;
}
コード例 #9
0
ファイル: vlcaudioplayer.cpp プロジェクト: Toyunda/toyunda
void	VLCAudioPlayer::play()
{
	libvlc_media_player_play(mediaPlayer, &vlc_ex);
	QTimer *timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), this, SLOT(checkFrame()));
	timer->start(50);
}
コード例 #10
0
ファイル: play.c プロジェクト: dantefff/8p
void
play_next(struct info *data)
{
	char errormsg[] = "Next mix not found.";
	int errn;
	struct track *t;
	libvlc_media_t *media;

	/* Check if we are already on the last track.
	 * If so request a similar mix and continue playing.
	 */
	if (data->m->track_count > 0) {
		if (data->m->track[data->m->track_count-1]->last == TRUE) {
			errn = search_nextmix(data);
			if (errn == ERROR) {
				draw_error(errormsg);
				data->state = START;
				return;
			}
		}
	}

	t = mix_nexttrack(data);
	if (t == NULL)
		return;

	media = libvlc_media_new_location(data->vlc_inst, t->url);
	if (media == NULL)
		return;
	libvlc_media_player_set_media(data->vlc_mp, media);
	(void)libvlc_media_player_play(data->vlc_mp);
	libvlc_media_release(media);
}
コード例 #11
0
void VlcVideoWidget::Play() 
{
    if (!vlcPlayer_)
        return;
    if (!libvlc_media_player_is_playing(vlcPlayer_))
        libvlc_media_player_play(vlcPlayer_);
}
コード例 #12
0
void VLCMainwindow::openFile() {
    /* Just the basic file-select box */
    QString fileOpen = QFileDialog::getOpenFileName(this,tr("Load a file"), "~");
    fileOpen.replace("/", "\\");
    /* Stop if something is playing */
    if( vlcPlayer && libvlc_media_player_is_playing(vlcPlayer) )
        stop();

    /* New Media */
    libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcObject,qtu(fileOpen));
    if( !vlcMedia )
        return;
    vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);
    libvlc_media_release(vlcMedia);

    /* Integrate the video in the interface */
#if defined(Q_OS_MAC)
    libvlc_media_player_set_nsobject(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_UNIX)
    libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_WIN)
    libvlc_media_player_set_hwnd(vlcPlayer, videoWidget->winId());
#endif

    //int windid = videoWidget->winId();
    //libvlc_media_player_set_xwindow (vlcPlayer, windid );

    /* And play */
    libvlc_media_player_play (vlcPlayer);

    //Set vars and text correctly
    playBut->setText("Pause");
}
コード例 #13
0
void CAVPlayer::Play()
{
    if (m_pVLC_Player)
    {
        libvlc_media_player_play(m_pVLC_Player);
    }
}
コード例 #14
0
ファイル: VPlayer.cpp プロジェクト: sealist/BiliLocal
void VPlayer::play()
{
	if(mp){
		if(state==Stop){
			libvlc_media_track_info_t *info;
			libvlc_media_parse(m);
			int i=libvlc_media_get_tracks_info(m,&info);
			for(--i;i>=0;--i){
				if(info[i].i_type==libvlc_track_video){
					srcSize.setWidth (info[i].u.video.i_width);
					srcSize.setHeight(info[i].u.video.i_height);
				}
			}
			free(info);
			dstSize=srcSize;
			avpicture_alloc(&srcFrame,PIX_FMT_RGB32,srcSize.width(),srcSize.height());
			avpicture_alloc(&dstFrame,PIX_FMT_RGB32,dstSize.width(),dstSize.height());
			valid=true;
			libvlc_video_set_format(mp,"RV32",srcSize.width(),srcSize.height(),srcSize.width()*4);
			libvlc_video_set_callbacks(mp,lock,NULL,display,this);
			Utils::delayExec(50,[this](){libvlc_media_player_play(mp);});
		}
		else{
			libvlc_media_player_pause(mp);
			if(state==Play){
				state=Pause;
				emit paused();
			}
			else{
				state=Play;
			}
		}
	}
}
コード例 #15
0
ファイル: player.cpp プロジェクト: ruks/VLC-subtitle-editor
void player::play() {
    if (!mp) { //if player is not load with media
        dataObject ob;
        ob.object = "player";
        ob.msg = "media_explorer_media";
        Notify(ob);
        return;
    }

    if (libvlc_media_player_is_playing(mp)) { //if current playing
        /* Pause */
//        libvlc_media_player_pause(mp);
        dataObject ob;
        ob.object = "player";
        ob.msg = "play";
//        Notify(ob);
    } else { //if not playing
        /* Play again */
        dataObject ob;
        ob.object = "player";
        ob.msg = "pause";
//        Notify(ob);
        libvlc_media_player_play(mp);
    }
}
コード例 #16
0
ファイル: player.cpp プロジェクト: KDelli/Projet_Litchi
void Player::playFile(QString ofile)
{
    /*the file has to be in one of the following formats /perhaps a little bit outdated)

    [file://]filename              Plain media file
    http://ip:port/file            HTTP URL
    ftp://ip:port/file             FTP URL
    mms://ip:port/file             MMS URL
    screen://                      Screen capture
    [dvd://][device][@raw_device]  DVD device
    [vcd://][device]               VCD device
    [cdda://][device]              Audio CD device
    udp:[[<source address>]@[<bind address>][:<bind port>]]
    */        

    /*Prevent path problems*/
    QString file = ofile.replace('/','\\');

    /* Create a new LibVLC media descriptor */
    media = libvlc_media_new_path(vlcInstance, file.toLatin1());

    libvlc_media_player_set_media (mediaPlayer, media);

    libvlc_media_player_set_xwindow (mediaPlayer, reinterpret_cast<unsigned int>(videoWidget->winId()));

    /* Play */
    libvlc_media_player_play (mediaPlayer);
    isPlaying=true;
}
コード例 #17
0
ファイル: MediaPlayer.cpp プロジェクト: etch04/vlc-qt
void VlcMediaPlayer::play()
{
    if (!_vlcMediaPlayer)
        return;

    if (_videoWidget) {
        _currentWId = _videoWidget->request();
    } else {
        _currentWId = 0;
    }

    /* Get our media instance to use our window */
    if (_currentWId) {
#if defined(Q_OS_WIN32)
        libvlc_media_player_set_hwnd(_vlcMediaPlayer, _currentWId);
#elif defined(Q_OS_MAC)
        libvlc_media_player_set_nsobject(_vlcMediaPlayer, (void *)_currentWId);
#elif defined(Q_OS_UNIX)
        libvlc_media_player_set_xwindow(_vlcMediaPlayer, _currentWId);
#endif
    }

    libvlc_media_player_play(_vlcMediaPlayer);

    VlcError::errmsg();
}
コード例 #18
0
ファイル: mediaplayer.cpp プロジェクト: malcom2073/revfe
void MediaPlayer::play()
{
	if (vlcMediaPlayer)
	{
		libvlc_media_player_play(vlcMediaPlayer);
	}
}
コード例 #19
0
void VLCVideoTextureObjChunk::playAgain(void)
{
    if ((libvlc == NULL) || (vlcmediaplayer == NULL)) return;      
    libvlc_media_player_stop(vlcmediaplayer);    
    libvlc_media_player_play(vlcmediaplayer);
    needsRestart = false;
}
コード例 #20
0
ファイル: player.cpp プロジェクト: RodrigoNieves/vlc
void Mwindow::openFile() {

    /* The basic file-select box */
    QString fileOpen = QFileDialog::getOpenFileName(this, tr("Load a file"), "~");

    /* Stop if something is playing */
    if (vlcPlayer && libvlc_media_player_is_playing(vlcPlayer))
        stop();

    /* Create a new Media */
    libvlc_media_t *vlcMedia = libvlc_media_new_path(vlcInstance, qtu(fileOpen));
    if (!vlcMedia)
        return;

    /* Create a new libvlc player */
    vlcPlayer = libvlc_media_player_new_from_media (vlcMedia);

    /* Release the media */
    libvlc_media_release(vlcMedia);

    /* Integrate the video in the interface */
#if defined(Q_OS_MAC)
    libvlc_media_player_set_nsobject(vlcPlayer, (void *)videoWidget->winId());
#elif defined(Q_OS_UNIX)
    libvlc_media_player_set_xwindow(vlcPlayer, videoWidget->winId());
#elif defined(Q_OS_WIN)
    libvlc_media_player_set_hwnd(vlcPlayer, videoWidget->winId());
#endif

    /* And start playback */
    libvlc_media_player_play (vlcPlayer);

    /* Update playback button */
    playBut->setText("Pause");
}
コード例 #21
0
static void
clutter_vlc_set_playing(ClutterVlcVideoTexture* video_texture,
			gboolean playing)
{
  ClutterVlcVideoTexturePrivate* priv;

  priv = video_texture->priv;

  if (priv->vlc_instance == NULL)
    return;

  if (priv->uri == NULL)
    return;

  if (priv->vlc_media_player == NULL)
    return;

  if (playing == FALSE)
    {
      libvlc_media_player_pause(priv->vlc_media_player,
				&priv->vlc_exception);
    }
  else
    {
      libvlc_media_player_play(priv->vlc_media_player,
			       &priv->vlc_exception);
    }
  clutter_vlc_catch(&priv->vlc_exception);

  g_object_notify(G_OBJECT(video_texture), "playing");
  g_object_notify(G_OBJECT(video_texture), "progress");
}
コード例 #22
0
// retorna true si es un video, false en caso contrario
// Si es un video ademas rellena los parametros Tiempo, nAncho y nAlto
const bool InformacionArchivoEx::_AnalisisVLC(const TCHAR *Path, UINT64 &Tiempo, UINT &nAncho, UINT &nAlto, libvlc_instance_t *Instancia) {
	char	Destino[2049];
	size_t  TamnTexto = wcslen(Path);
	int		TamRes = WideCharToMultiByte(CP_UTF8, NULL, Path, TamnTexto, Destino, 2048, NULL, NULL);
	Destino[TamRes] = 0;

	libvlc_media_t			*Media			= NULL;
	libvlc_media_player_t	*nMediaPlayer	= NULL;
	Media = libvlc_media_new_path(Instancia, Destino);

	libvlc_media_parse(Media);
	libvlc_media_add_option(Media, "sout=#description:dummy");

	nMediaPlayer = libvlc_media_player_new_from_media(Media);

	libvlc_state_t Estado = libvlc_Opening;
	libvlc_media_player_play(nMediaPlayer);

    //posible deadlock
	// Esperamos hasta que empieze el play
	while (Estado != libvlc_Playing && Estado != libvlc_Ended) { 
		Estado = libvlc_media_player_get_state(nMediaPlayer);
        Sleep(100);
		if (Estado == libvlc_Error) { // Hay un error en la libvlc, salimos
			Sleep(300); // Nos aseguramos de que el log se escriba
			libvlc_media_player_stop(nMediaPlayer);
			libvlc_media_release(Media);
			libvlc_media_player_release(nMediaPlayer);
			Tiempo = 0;
			nAncho = 0;
			nAlto = 0;
			return false;
		}
	}
	
	// Miramos los streams disponibles y buscamos el de video
	libvlc_media_track_info_t *TI = NULL;
	int z = libvlc_media_get_tracks_info(Media, &TI);
	for (int n = 0; n < z; n++) {
		if (TI->i_type == libvlc_track_video) {
			libvlc_media_player_stop(nMediaPlayer);
			Tiempo = 0; //libvlc_media_player_get_length(nMediaPlayer); // NO DA BIEN EL TIEMPO..............
			nAncho = TI->u.video.i_width;
			nAlto = TI->u.video.i_height;
			libvlc_media_release(Media);
			libvlc_media_player_release(nMediaPlayer);		
			return true;
		}
		TI ++;
	}
	libvlc_media_release(Media);
	libvlc_media_player_release(nMediaPlayer);		

	// No hay streams de video retornamos false
	Tiempo	= 0;
	nAncho	= 0;
	nAlto	= 0;
	return false;
}
コード例 #23
0
void CAVPlayer::Play()
{
    if (m_pVLC_Player)
    {
        libvlc_media_player_play(m_pVLC_Player);
		m_bStatus = em_play;
    }
}
コード例 #24
0
ファイル: play.c プロジェクト: columbia-irt/manhattan
int main(int argc, char* argv[])
{
    const char * const vlc_args[] = {
              "-I", "dummy", /* Don't use any interface */
              "--ignore-config", /* Don't use VLC's config */
              "--plugin-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx" };
    libvlc_exception_t ex;
    libvlc_instance_t * inst;
    libvlc_media_player_t *mp;
    libvlc_media_t *m;
    
    libvlc_exception_init (&ex);
    /* init vlc modules, should be done only once */
    inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);
    raise (&ex);
 
    /* Create a new item */
    m = libvlc_media_new (inst, "http://mycool.movie.com/test.mov", &ex);
    raise (&ex);
   
    /* XXX: demo art and meta information fetching */
   
    /* Create a media player playing environement */
    mp = libvlc_media_player_new_from_media (m, &ex);
    raise (&ex);
    
    /* No need to keep the media now */
    libvlc_media_release (m);

#if 0
    /* This is a non working code that show how to hooks into a window,
     * if we have a window around */
     libvlc_drawable_t drawable = xdrawable;
    /* or on windows */
     libvlc_drawable_t drawable = hwnd;

     libvlc_media_player_set_drawable (mp, drawable, &ex);
     raise (&ex);
#endif

    /* play the media_player */
    libvlc_media_player_play (mp, &ex);
    raise (&ex);
   
    sleep (10); /* Let it play a bit */
   
    /* Stop playing */
#warning There is known deadlock bug here. Please update to LibVLC 1.1!
    libvlc_media_player_stop (mp, &ex);

    /* Free the media_player */
    libvlc_media_player_release (mp);

    libvlc_release (inst);
    raise (&ex);

    return 0;
}
コード例 #25
0
int LibvlcCamera::PrimeCapture() {
  Info("Priming capture from %s", mPath.c_str());

  StringVector opVect = split(Options(), ",");

  // Set transport method as specified by method field, rtpUni is default
  if ( Method() == "rtpMulti" )
    opVect.push_back("--rtsp-mcast");
  else if ( Method() == "rtpRtsp" )
    opVect.push_back("--rtsp-tcp");
  else if ( Method() == "rtpRtspHttp" )
    opVect.push_back("--rtsp-http");

  opVect.push_back("--no-audio");

  if ( opVect.size() > 0 ) {
    mOptArgV = new char*[opVect.size()];
    Debug(2, "Number of Options: %d",opVect.size());
    for (size_t i=0; i< opVect.size(); i++) {
      opVect[i] = trimSpaces(opVect[i]);
      mOptArgV[i] = (char *)opVect[i].c_str();
      Debug(2, "set option %d to '%s'", i,  opVect[i].c_str());
    }
  }

  mLibvlcInstance = libvlc_new(opVect.size(), (const char* const*)mOptArgV);
  if ( mLibvlcInstance == NULL ) {
    Error("Unable to create libvlc instance due to: %s", libvlc_errmsg());
    return -1;
  }

  mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
  if ( mLibvlcMedia == NULL ) {
    Error("Unable to open input %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  mLibvlcMediaPlayer = libvlc_media_player_new_from_media(mLibvlcMedia);
  if ( mLibvlcMediaPlayer == NULL ) {
    Error("Unable to create player for %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  libvlc_video_set_format(mLibvlcMediaPlayer, mTargetChroma.c_str(), width, height, width * mBpp);
  libvlc_video_set_callbacks(mLibvlcMediaPlayer, &LibvlcLockBuffer, &LibvlcUnlockBuffer, NULL, &mLibvlcData);

  mLibvlcData.bufferSize = width * height * mBpp;
  // Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
  mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  
  mLibvlcData.newImage.setValueImmediate(false);

  libvlc_media_player_play(mLibvlcMediaPlayer);

  return 0;
}
コード例 #26
0
ファイル: MediaPlayer.cpp プロジェクト: Skiminok/vlc-qt
void VlcMediaPlayer::play()
{
    if (!_vlcMediaPlayer)
        return;

    libvlc_media_player_play(_vlcMediaPlayer);

    VlcError::errmsg();
}
コード例 #27
0
ファイル: vlccontrol.cpp プロジェクト: Etersoft/vargus-viewer
void VlcControl::start()
{
    setlog("start " + QString().sprintf("%08p", this));
    libvlc_media_player_play(vlcPlayer);
#ifndef TESTCALLBACKPAINT
    setPrintType(VIDEO);
#endif
    setCallbacks(this->width(), this->height());
    startCheckScreen();
}
コード例 #28
0
ファイル: VlcVideoPlayer.cpp プロジェクト: Errr797/Orchestra
void VlcVideoPlayer::playPause()
{
    if (firstPlay_)
    {
        libvlc_media_player_play(vlcPlayer);
        firstPlay_ = !firstPlay_;
    }

    libvlc_media_player_set_pause(vlcPlayer, libvlc_media_player_is_playing(vlcPlayer));
}
コード例 #29
-1
ファイル: VideoStream.cpp プロジェクト: wose/FloatingEye
VideoStream::VideoStream(const std::string& uri, irr::video::IVideoDriver* const videoDriver,
                         IrrIMGUI::IIMGUIHandle* const gui) :
    gui_{gui}
{
    videoTexture_ = videoDriver->createImage(irr::video::ECF_A8R8G8B8, irr::core::dimension2du(1280, 720));
    guiVideoTexture_ = gui_->createTexture(videoTexture_);

    char const *vlc_argv[] =
    {
        //        "-I", "dummy", // Don't use any interface
        //"--ignore-config", // Don't use VLC's config
        "--no-audio", /* skip any audio track */
        "--no-xlib", /* tell VLC to not use Xlib */
        "--network-caching=4000",
    };
    int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv);

    vlcInstance_ = libvlc_new(vlc_argc, vlc_argv);
    auto vlcMedia = libvlc_media_new_location(vlcInstance_,
        "http://iphone-streaming.ustream.tv/uhls/17074538/streams/live/iphone/playlist.m3u8");
    vlcMediaPlayer_ = libvlc_media_player_new_from_media(vlcMedia);
    libvlc_media_release(vlcMedia);

    libvlc_video_set_callbacks(vlcMediaPlayer_,
                               VideoStream::preRenderCallback,
                               VideoStream::postRenderCallback,
                               VideoStream::displayCallback,
                               this);

    libvlc_video_set_format(vlcMediaPlayer_, "RV32", 1280, 720, videoTexture_->getPitch());
    libvlc_media_player_play(vlcMediaPlayer_);
}
コード例 #30
-1
int LibvlcCamera::PrimeCapture()
{
    Info("Priming capture from %s", mPath.c_str());
	 
    mLibvlcInstance = libvlc_new (0, NULL);
    if(mLibvlcInstance == NULL)
        Fatal("Unable to create libvlc instance due to: %s", libvlc_errmsg());
     
    mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
    if(mLibvlcMedia == NULL)
        Fatal("Unable to open input %s due to: %s", mPath.c_str(), libvlc_errmsg());
	
    mLibvlcMediaPlayer = libvlc_media_player_new_from_media(mLibvlcMedia);
    if(mLibvlcMediaPlayer == NULL)
        Fatal("Unable to create player for %s due to: %s", mPath.c_str(), libvlc_errmsg());

	libvlc_video_set_format(mLibvlcMediaPlayer, mTargetChroma.c_str(), width, height, width * mBpp);
    libvlc_video_set_callbacks(mLibvlcMediaPlayer, &LibvlcLockBuffer, &LibvlcUnlockBuffer, NULL, &mLibvlcData);

    mLibvlcData.bufferSize = width * height * mBpp;
    // Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
    mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
    mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(32, mLibvlcData.bufferSize);
    
    mLibvlcData.newImage.setValueImmediate(false);

    libvlc_media_player_play(mLibvlcMediaPlayer);
    
    return(0);
}