{ //close streams otherwise on windows we can't reopen the file in the //media player when we pass the url to directx as it'll already be open
css::uno::Reference< css::io::XInputStream > xInputStream =
aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_INPUTSTREAM,
css::uno::Reference< css::io::XInputStream >()); if (xInputStream.is()) xInputStream->closeInput();
}
// If player currently used for other dispatch() requests ... // cancel it by calling stop()!
m_aUpdateIdle.Stop(); if (m_xPlayer.is())
{ if (m_xPlayer->isPlaying())
m_xPlayer->stop();
m_xPlayer.clear();
}
// Try to initialize player.
m_xListener = xListener; try
{
m_bError = false;
m_xPlayer.set( avmedia::MediaWindow::createPlayer( aURL.Complete, aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER, OUString()) ), css::uno::UNO_SET_THROW ); // OK- we can start async playing ... // Count this request and initialize self-holder against dying by uno ref count ...
m_xSelfHold.set(getXWeak());
m_xPlayer->start();
m_aUpdateIdle.SetPriority( TaskPriority::HIGH_IDLE );
m_aUpdateIdle.Start();
} catch( css::uno::Exception& )
{
m_bError = true;
m_xPlayer.clear();
}
@onerrorWereturnnothing. @threadsafeyes
*//*-*************************************************************************************************************/
OUString SAL_CALL SoundHandler::detect( css::uno::Sequence< css::beans::PropertyValue >& lDescriptor )
{ // Our default is "nothing". So we can return it, if detection failed or file type is really unknown.
OUString sTypeName;
// Analyze given descriptor to find filename or input stream or ...
utl::MediaDescriptor aDescriptor(lDescriptor);
OUString sURL = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_URL, OUString());
OUString sReferer = aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_REFERRER, OUString());
if (
!sURL.isEmpty() &&
(avmedia::MediaWindow::isMediaURL(sURL, sReferer))
)
{ // If the file type is supported depends on the OS, so... // I think we can the following ones: // a) look for given extension of url to map our type decision HARD CODED!!! // b) return preferred type every time... it's easy :-)
sTypeName = u"wav_Wave_Audio_File"_ustr;
aDescriptor[utl::MediaDescriptor::PROP_TYPENAME] <<= sTypeName;
aDescriptor >> lDescriptor;
}
// We use m_xSelfHold to let us die ... but we must live till real finishing of this method too!!! // So we SHOULD use another "self-holder" temp. to provide that ...
css::uno::Reference< css::uno::XInterface > xOperationHold = m_xSelfHold;
m_xSelfHold.clear();
// notify might existing listener // And forget this listener! // Because the corresponding dispatch was finished. if (m_xListener.is())
{
css::frame::DispatchResultEvent aEvent; if (!m_bError)
aEvent.State = css::frame::DispatchResultState::SUCCESS; else
aEvent.State = css::frame::DispatchResultState::FAILURE;
m_xListener->dispatchFinished(aEvent);
m_xListener.clear();
}
// } SAFE //release aLock before end of method at which point xOperationHold goes out of scope and pThis dies
aLock.unlock();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.