Commit c6a4cb11 authored by Damien Fouilleul's avatar Damien Fouilleul

- addendum to [17024], backport of [16946]

parent 312523f7
/*****************************************************************************
* supporterrorinfo.cpp: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2005 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "plugin.h"
#include "supporterrorinfo.h"
#include "utils.h"
#include "axvlc_idl.h"
using namespace std;
STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
{
if( (riid == IID_IVLCAudio)
|| (riid == IID_IVLCInput)
|| (riid == IID_IVLCPlaylist)
|| (riid == IID_IVLCVideo)
|| (riid == IID_IVLCControl2) )
{
return S_OK;
}
return S_FALSE;
};
void VLCSupportErrorInfo::setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description)
{
BSTR bstrDescription = BSTRFromCStr(CP_UTF8, description);
if( NULL != bstrDescription )
{
ICreateErrorInfo* pcerrinfo;
HRESULT hr = CreateErrorInfo(&pcerrinfo);
if( SUCCEEDED(hr) )
{
IErrorInfo* perrinfo;
pcerrinfo->SetSource((LPOLESTR)progid);
pcerrinfo->SetGUID(riid);
pcerrinfo->SetDescription((LPOLESTR)bstrDescription);
hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID*) &perrinfo);
if( SUCCEEDED(hr) )
{
::SetErrorInfo(0, perrinfo);
perrinfo->Release();
}
pcerrinfo->Release();
}
SysFreeString(bstrDescription);
}
};
/*****************************************************************************
* supporterrorinfo.h: ActiveX control for VLC
*****************************************************************************
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef __SUPPORTERRORINFO_H__
#define __SUPPORTERRORINFO_H__
#include <oaidl.h>
class VLCSupportErrorInfo : public ISupportErrorInfo
{
public:
VLCSupportErrorInfo(VLCPlugin *p_instance) :
_p_instance(p_instance)
{};
virtual ~VLCSupportErrorInfo()
{};
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
if( NULL == ppv )
return E_POINTER;
if( (IID_IUnknown == riid)
|| (IID_ISupportErrorInfo == riid) )
{
AddRef();
*ppv = reinterpret_cast<LPVOID>(this);
return NOERROR;
}
return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
};
STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
// ISupportErrorInfo methods
STDMETHODIMP InterfaceSupportsErrorInfo(REFIID riid);
// VLCSupportErrorInfo methods
void setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description);
private:
VLCPlugin *_p_instance;
};
#endif
......@@ -614,10 +614,11 @@ STDMETHODIMP CapturePin::QueryAccept( const AM_MEDIA_TYPE *pmt )
}
msg_Dbg( p_input, "CapturePin::QueryAccept [OK] "
"(width=%ld, height=%ld, chroma=%4.4s)",
"(width=%ld, height=%ld, chroma=%4.4s, fps=%f)",
((VIDEOINFOHEADER *)pmt->pbFormat)->bmiHeader.biWidth,
((VIDEOINFOHEADER *)pmt->pbFormat)->bmiHeader.biHeight,
(char *)&i_fourcc );
(char *)&i_fourcc,
10000000.0f/((float)((VIDEOINFOHEADER *)pmt->pbFormat)->AvgTimePerFrame) );
}
else if( pmt->majortype == MEDIATYPE_Audio )
{
......
......@@ -79,7 +79,7 @@ int libvlc_audio_get_volume( libvlc_instance_t *p_instance,
aout_VolumeGet( p_instance->p_vlc, &i_volume );
return i_volume*200/AOUT_VOLUME_MAX;
return (i_volume*200+AOUT_VOLUME_MAX/2)/AOUT_VOLUME_MAX;
}
......@@ -91,7 +91,7 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
{
if( i_volume >= 0 && i_volume <= 200 )
{
i_volume = i_volume * AOUT_VOLUME_MAX / 200;
i_volume = (i_volume * AOUT_VOLUME_MAX + 100) / 200;
aout_VolumeSet( p_instance->p_vlc, i_volume );
}
else
......
......@@ -68,7 +68,7 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
var_Get( p_input_thread, "length", &val );
vlc_object_release( p_input_thread );
return val.i_time / 1000LL;
return (val.i_time+500LL)/1000LL;
}
vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
......@@ -82,7 +82,7 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
var_Get( p_input_thread , "time", &val );
vlc_object_release( p_input_thread );
return val.i_time / 1000LL;
return (val.i_time+500LL)/1000LL;
}
void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment