Example #1
0
void Audio::setPlayerVolume(libvlc_media_player_t * const player)
{
    if(vlcInstance==NULL)
        return;
    libvlc_audio_set_volume(player,volume);
    libvlc_audio_set_mute(player,0);
}
Example #2
0
void VlcAudio::setMute(bool mute) const
{
    if (_vlcMediaPlayer && mute != getMute()) {
        libvlc_audio_set_mute(_vlcMediaPlayer, mute);
        VlcError::showErrmsg();
    }
}
Example #3
0
STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute)
{
    libvlc_media_player_t *p_md;
    HRESULT hr = getMD(&p_md);
    if( SUCCEEDED(hr) )
        libvlc_audio_set_mute(p_md, VARIANT_FALSE != mute);
    return hr;
};
Example #4
0
void Audio::addPlayer(libvlc_media_player_t * const player)
{
    if(vlcInstance==NULL)
        return;
    if(playerList.contains(player))
        return;
    playerList << player;
    libvlc_audio_set_volume(player,volume);
    libvlc_audio_set_mute(player,0);
}
Example #5
0
RuntimeNPObject::InvokeResult
LibvlcAudioNPObject::setProperty(int index, const NPVariant &value)
{
    /* is plugin still running */
    if( isPluginRunning() )
    {
        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
        libvlc_exception_t ex;
        libvlc_exception_init(&ex);

        switch( index )
        {
            case ID_audio_mute:
                if( NPVARIANT_IS_BOOLEAN(value) )
                {
                    libvlc_audio_set_mute(p_plugin->getVLC(),
                                          NPVARIANT_TO_BOOLEAN(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_volume:
                if( isNumberValue(value) )
                {
                    libvlc_audio_set_volume(p_plugin->getVLC(),
                                            numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_track:
                if( isNumberValue(value) )
                {
                    libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    libvlc_audio_set_track(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            case ID_audio_channel:
                if( isNumberValue(value) )
                {
                    libvlc_audio_set_channel(p_plugin->getVLC(),
                                             numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);
                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            default:
                ;
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
Example #6
0
static void
_mute_set(struct _App *app)
{
   int mute;

   if (!app->mp)
     return;

   _em_read_safe(app->em_read, &mute, sizeof(mute));

   libvlc_audio_set_mute(app->mp, mute);
}
Example #7
0
void Audio::setVolume(const int &volume)
{
    if(vlcInstance==NULL)
        return;
    qDebug() << "Audio volume set to: " << volume;
    int index=0;
    while(index<playerList.size())
    {
        libvlc_audio_set_volume(playerList.at(index),volume);
        libvlc_audio_set_mute(playerList.at(index),0);
        index++;
    }
    this->volume=volume;
}
Example #8
0
static void
_file_set_done(struct _App *app)
{
   int r;

   app->opening = 0;

   r = emotion_generic_shm_get(app->shmname, &app->vs, &app->vf);
   if (!r)
     {
	free(app->filename);
        libvlc_media_release(app->m);
        libvlc_media_player_release(app->mp);
	app->filename = NULL;
	app->m = NULL;
	app->mp = NULL;
	_send_cmd_start(app, EM_RESULT_FILE_SET_DONE);
	SEND_CMD_PARAM(app, r);
	_send_cmd_finish(app);
     }
   app->w = app->vs->width;
   app->h = app->vs->height;
   libvlc_video_set_format(app->mp, "RV32", app->w, app->h, app->w * 4);
   libvlc_video_set_callbacks(app->mp, _lock, _unlock, _display, app);


   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPlaying,
		       _event_cb, app);
   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerTimeChanged,
		       _event_cb, app);
   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerLengthChanged,
		       _event_cb, app);
   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerSeekableChanged,
		       _event_cb, app);

   libvlc_audio_set_mute(app->mp, 0);

   _send_cmd_start(app, EM_RESULT_FILE_SET_DONE);
   SEND_CMD_PARAM(app, r);
   _send_cmd_finish(app);
}
Example #9
0
static void
_file_set(struct _App *app)
{
   if (app->opening)
     {
	libvlc_media_release(app->m);
	libvlc_media_player_release(app->mp);
	free(app->filename);
     }

   _em_str_read(app->em_read, &app->filename);

   app->m = libvlc_media_new_path(app->libvlc, app->filename);
   if (!app->m)
     {
	fprintf(stderr, "could not open path: \"%s\"\n", app->filename);
	return;
     }
   app->mp = libvlc_media_player_new_from_media(app->m);

   if (!app->mp)
     {
	fprintf(stderr, "could not create new player from media.\n");
	return;
     }

   app->opening = 1;
   libvlc_video_set_format(app->mp, "RV32", DEFAULTWIDTH, DEFAULTHEIGHT, DEFAULTWIDTH * 4);
   libvlc_video_set_callbacks(app->mp, _tmp_lock, _tmp_unlock, _tmp_display, app);
   app->event_mgr = libvlc_media_player_event_manager(app->mp);
   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerPositionChanged,
		       _event_cb, app);
   libvlc_event_attach(app->event_mgr, libvlc_MediaPlayerStopped,
		       _event_cb, app);

   app->mevent_mgr = libvlc_media_event_manager(app->m);

   app->tmpbuffer = malloc(sizeof(char) * DEFAULTWIDTH * DEFAULTHEIGHT * 4);
   libvlc_audio_set_mute(app->mp, 1);
   libvlc_media_player_play(app->mp);
}
Example #10
0
void VlcMediaWidget::setMuted(bool muted)
{
	libvlc_audio_set_mute(vlcMediaPlayer, muted);
}
Example #11
0
void LiveWidget::muteAudio(bool mute)
{
    libvlc_audio_set_mute(this->vlcMediaPlayer, mute);
}
Example #12
0
void VlcVideoPlayer::unMute()
{
    libvlc_audio_set_mute(vlcPlayer, false);
}
Example #13
0
void VlcVideoPlayer::mute()
{
    libvlc_audio_set_mute(vlcPlayer, true);
}
Example #14
0
File: audio.c Project: 0xheart0/vlc
void libvlc_audio_toggle_mute( libvlc_media_player_t *mp )
{
    int mute = libvlc_audio_get_mute( mp );
    if( mute != -1 )
        libvlc_audio_set_mute( mp, !mute );
}
Example #15
0
void VLCVideoWrapper::setMute(bool Mute)
{
    libvlc_audio_set_mute(_MediaPlayer, (Mute ? 1 : 0));
    checkVLCError("muting volume");
}
Example #16
0
void VLCWrapperImpl::Mute( bool mute /*= true*/ )
{
    libvlc_audio_set_mute(pMediaPlayer_, mute);
}
Example #17
0
void VLCWrapperImpl::Mute(bool bMute)
{
    libvlc_audio_set_mute(m_pVLCInstance, bMute, &m_VLCex);
    ProcessVLCException(&m_VLCex, m_EH);
}
bool VLCVideoTextureObjChunk::createVLCInstance(libvlc_time_t start_time, 
                                                bool          play      )
{
    libvlc_media_t *m;
    
    char const *vlc_argv[] =
    {       
        "-I", "dumy",      // No special interface
        "--ignore-config", // Don't use VLC's config        
        "--quiet",         // deactivates VLCs console outputs
        "--no-xlib",       // tell VLC to not use Xlib                   
        "--no-video-title-show", // no titles
    };
        
    int vlc_argc        = sizeof(vlc_argv       ) / sizeof(*vlc_argv       );
         
    // Initialize libVLC   
    if (libvlc==NULL) 
    {        
        libvlc = libvlc_new(vlc_argc, vlc_argv);        
    } 
    else 
    {
        if (vlcmediaplayer!=NULL) 
        {
            ctx.idstr = NULL;
            libvlc_media_player_stop(vlcmediaplayer);    
            libvlc_media_player_release(vlcmediaplayer);
            vlcmediaplayer = NULL;
            if (ctx.videothread!=NULL) {
                ctx.videothread->runFunction(NULL,NULL); // reset thread structure: isInititialized=false
            }
            ctx.videothread = NULL;            
        }
    }
    m = libvlc_media_new_path(libvlc, getUrl().c_str());
   
    vlcmediaplayer = libvlc_media_player_new_from_media(m);
   
    libvlc_media_release(m);

    ctx.idstr = strdup((std::string("video")+getVideoID()).c_str());
    ctx.videothread = NULL;            
    ctx.img = Image::create();
    ctx.img->set(OSG::Image::OSG_BGR_PF,getWidth(), getHeight());
    ctx.lock = Lock::create();
    
    this->setImage(ctx.img);
    this->setTarget(GL_TEXTURE_2D);
    ctx.self = this;


    vlceventmgr = libvlc_media_player_event_manager( vlcmediaplayer );
    // attach event to defined event handler callback
    libvlc_event_attach( vlceventmgr, libvlc_MediaPlayerEndReached, vlc_event, &ctx);

    libvlc_video_set_callbacks(vlcmediaplayer, vlc_lock, vlc_unlock, vlc_display, &ctx);
    libvlc_video_set_format(vlcmediaplayer, "RV24", getWidth(), getHeight(), getWidth()*3);
    if (getIsMaster()==false) libvlc_audio_set_mute(vlcmediaplayer, 1);
    
#if 0
    {
        SLOG << "available filters:" << std::endl;
        libvlc_module_description_t *list = libvlc_video_filter_list_get(libvlc);
        libvlc_module_description_t *iter = list;
        while(iter!=NULL) {
            SLOG << iter->psz_name << std::endl;
            iter = iter->p_next;
        }                
        libvlc_module_description_list_release(list);
    }
#endif
        

    libvlc_media_player_play(vlcmediaplayer);
    libvlc_media_player_set_time(vlcmediaplayer, start_time);
    if (!play) libvlc_media_player_pause(vlcmediaplayer); //not working?
    
    // add to static list
    //allVideoTextures.push_back(&ctx);

    lastSync=OSG::getTimeStamp();

    return true;
}
Example #19
0
LRESULT CALLBACK VLCFullScreenWnd::FSControlsWndWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    VLCFullScreenWnd* fs_data = reinterpret_cast<VLCFullScreenWnd *>(GetWindowLongPtr(hWnd, GWLP_USERDATA));

    switch( uMsg )
    {
        case WM_CREATE:{
            CREATESTRUCT* CreateStruct = (CREATESTRUCT*)(lParam);
            fs_data = (VLCFullScreenWnd*)CreateStruct->lpCreateParams;
            HMODULE hDllModule = fs_data->_WindowsManager->getHModule();

            SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(fs_data));

            fs_data->hNewMessageBitmap = (HICON)
                LoadImage(hDllModule, MAKEINTRESOURCE(8),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);

            const int ControlsHeigth = 21+2;
            const int ButtonsWidth = ControlsHeigth;
            const int ControlsSpace = 5;
            const int ScrollVOffset = (ControlsHeigth-GetSystemMetrics(SM_CXHSCROLL))/2;

            int HorizontalOffset = ControlsSpace;
            int ControlWidth = ButtonsWidth;
            fs_data->hFSButton =
                CreateWindow(TEXT("BUTTON"), TEXT("End Full Screen"), WS_CHILD|WS_VISIBLE|BS_BITMAP|BS_FLAT,
                             HorizontalOffset, ControlsSpace, ControlWidth, ControlsHeigth, hWnd, (HMENU)ID_FS_SWITCH_FS, 0, 0);
            fs_data->hFSButtonBitmap =
                LoadImage(hDllModule, MAKEINTRESOURCE(3),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
            SendMessage(fs_data->hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hFSButtonBitmap);
            //SendMessage(fs_data->hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hNewMessageBitmap);
            HorizontalOffset+=ControlWidth+ControlsSpace;

            ControlWidth = ButtonsWidth;
            fs_data->hPlayPauseButton =
                CreateWindow(TEXT("BUTTON"), TEXT("Play/Pause"), WS_CHILD|WS_VISIBLE|BS_BITMAP|BS_FLAT,
                             HorizontalOffset, ControlsSpace, ControlWidth, ControlsHeigth, hWnd, (HMENU)ID_FS_PLAY_PAUSE, 0, 0);
            fs_data->hPlayBitmap =
                LoadImage(hDllModule, MAKEINTRESOURCE(4),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
            fs_data->hPauseBitmap =
                LoadImage(hDllModule, MAKEINTRESOURCE(5),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS);
            SendMessage(fs_data->hPlayPauseButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hPauseBitmap);
            HorizontalOffset+=ControlWidth+ControlsSpace;

            ControlWidth = 200;
            int VideoPosControlHeight = 12;
            fs_data->hVideoPosScroll =
                CreateWindow(PROGRESS_CLASS, TEXT("Video Position"), WS_CHILD|WS_DISABLED|WS_VISIBLE|SBS_HORZ|SBS_TOPALIGN|PBS_SMOOTH,
                             HorizontalOffset, ControlsSpace+(ControlsHeigth-VideoPosControlHeight)/2, ControlWidth, VideoPosControlHeight, hWnd, (HMENU)ID_FS_VIDEO_POS_SCROLL, 0, 0);
            HMODULE hThModule = LoadLibrary(TEXT("UxTheme.dll"));
            if(hThModule){
                FARPROC proc = GetProcAddress(hThModule, "SetWindowTheme");
                typedef HRESULT (WINAPI* SetWindowThemeProc)(HWND, LPCWSTR, LPCWSTR);
                if(proc){
                    //SetWindowTheme(fs_data->hVideoPosScroll, L"", L"");
                    ((SetWindowThemeProc)proc)(fs_data->hVideoPosScroll, L"", L"");
                }
                FreeLibrary(hThModule);
            }
            HorizontalOffset+=ControlWidth+ControlsSpace;

            ControlWidth = ButtonsWidth;
            fs_data->hMuteButton =
                CreateWindow(TEXT("BUTTON"), TEXT("Mute"), WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_BITMAP, //BS_FLAT
                             HorizontalOffset, ControlsSpace, ControlWidth, ControlsHeigth, hWnd, (HMENU)ID_FS_MUTE, 0, 0);
            fs_data->hVolumeBitmap =
                LoadImage(hDllModule, MAKEINTRESOURCE(6),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_SHARED);
            fs_data->hVolumeMutedBitmap =
                LoadImage(hDllModule, MAKEINTRESOURCE(7),
                          IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS|LR_SHARED);
            SendMessage(fs_data->hMuteButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hVolumeBitmap);
            HorizontalOffset+=ControlWidth+ControlsSpace;

            ControlWidth = 100;
            fs_data->hVolumeSlider =
                CreateWindow(TRACKBAR_CLASS, TEXT("Volume"), WS_CHILD|WS_VISIBLE|TBS_HORZ|TBS_BOTTOM|TBS_AUTOTICKS,
                             HorizontalOffset, ControlsSpace, ControlWidth, 21, hWnd, (HMENU)ID_FS_VOLUME, 0, 0);
            HorizontalOffset+=ControlWidth+ControlsSpace;
            SendMessage(fs_data->hVolumeSlider, TBM_SETRANGE, FALSE, (LPARAM) MAKELONG (0, 100));
            SendMessage(fs_data->hVolumeSlider, TBM_SETTICFREQ, (WPARAM) 10, 0);
            SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);

            int ControlWndWidth = HorizontalOffset;
            int ControlWndHeigth = ControlsSpace+ControlsHeigth+ControlsSpace;
            SetWindowPos(hWnd, HWND_TOPMOST, (GetSystemMetrics(SM_CXSCREEN)-ControlWndWidth)/2, 0,
                         ControlWndWidth, ControlWndHeigth, SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE);

            //new message blinking timer
            SetTimer(hWnd, 2, 500, NULL);

            fs_data->CreateToolTip();

            break;
        }
        case WM_LBUTTONUP:{
            POINT BtnUpPoint = {LOWORD(lParam), HIWORD(lParam)};
            RECT VideoPosRect;
            GetWindowRect(fs_data->hVideoPosScroll, &VideoPosRect);
            ClientToScreen(hWnd, &BtnUpPoint);
            if(PtInRect(&VideoPosRect, BtnUpPoint)){
                fs_data->SetVideoPos(float(BtnUpPoint.x-VideoPosRect.left)/(VideoPosRect.right-VideoPosRect.left));
            }
            break;
        }
        case WM_TIMER:{
            switch(wParam){
                case 1:{
                    POINT MousePoint;
                    GetCursorPos(&MousePoint);
                    RECT ControlWndRect;
                    GetWindowRect(fs_data->hControlsWnd, &ControlWndRect);
                    if(PtInRect(&ControlWndRect, MousePoint)||GetCapture()==fs_data->hVolumeSlider){
                        fs_data->NeedShowControls();//not allow close control window while mouse within
                    }
                    else{
                        fs_data->NeedHideControls();
                    }
                    break;
                }
                case 2:{
                    LRESULT lResult = SendMessage(fs_data->hFSButton, BM_GETIMAGE, (WPARAM)IMAGE_BITMAP, 0);
                    if((HANDLE)lResult == fs_data->hFSButtonBitmap){
                        if(fs_data->_WindowsManager->getNewMessageFlag()){
                            SendMessage(fs_data->hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hNewMessageBitmap);
                            fs_data->NeedShowControls();//not allow close controll window while new message exist
                        }
                    }
                    else{
                        SendMessage(fs_data->hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)fs_data->hFSButtonBitmap);
                    }

                    break;
                }
            }
            break;
        }
        case WM_SETCURSOR:{
            RECT VideoPosRect;
            GetWindowRect(fs_data->hVideoPosScroll, &VideoPosRect);
            DWORD dwMsgPos = GetMessagePos();
            POINT MsgPosPoint = {LOWORD(dwMsgPos), HIWORD(dwMsgPos)};
            if(PtInRect(&VideoPosRect, MsgPosPoint)){
                SetCursor(LoadCursor(NULL, IDC_HAND));
                return TRUE;
            }
            else{
                return DefWindowProc(hWnd, uMsg, wParam, lParam);
            }
            break;
        }
        case WM_NCDESTROY:
            break;
        case WM_COMMAND:{
            WORD NCode = HIWORD(wParam);
            WORD Control = LOWORD(wParam);
            switch(NCode){
                case BN_CLICKED:{
                    switch(Control){
                        case ID_FS_SWITCH_FS:
                            fs_data->_WindowsManager->ToggleFullScreen();
                            break;
                        case ID_FS_PLAY_PAUSE:{
                            libvlc_media_player_t* p_md = fs_data->getMD();
                            if( p_md ){
                                if(fs_data->IsPlaying()) libvlc_media_player_pause(p_md);
                                else libvlc_media_player_play(p_md);
                            }
                            break;
                        }
                        case ID_FS_MUTE:{
                            libvlc_media_player_t* p_md = fs_data->getMD();
                            if( p_md ){
                                libvlc_audio_set_mute(p_md, IsDlgButtonChecked(hWnd, ID_FS_MUTE));
                                fs_data->SyncVolumeSliderWithVLCVolume();
                            }
                            break;
                        }
                    }
                    break;
                }
            }
            break;
        }
        case WM_HSCROLL:
        case WM_VSCROLL: {
            libvlc_media_player_t* p_md = fs_data->getMD();
            if( p_md ){
                if(fs_data->hVolumeSlider==(HWND)lParam){
                    LRESULT SliderPos = SendMessage(fs_data->hVolumeSlider, (UINT) TBM_GETPOS, 0, 0);
                    fs_data->SetVLCVolumeBySliderPos(SliderPos);
                }
            }
            break;
        }
        default:
            return DefWindowProc(hWnd, uMsg, wParam, lParam);
    }
    return 0L;
};
Example #20
0
//	Volume
void MediaPlayer::mute( bool needMute ) {
	LDEBUG( "vlc", "Mute: param=%d", needMute );	
	assert(_mp);	
	libvlc_audio_set_mute( _mp, needMute ? 1 : 0 );
}