整理代码

This commit is contained in:
蒲爽 2026-09-28 21:33:04 +08:00
commit c7b4e178ec
364 changed files with 59691 additions and 0 deletions

View file

@ -0,0 +1,58 @@
/*
*******************************************************************************
* INCLUDE
*******************************************************************************
*/
#include "AudioOutput.h"
#include "Logger.h"
namespace Video
{
namespace Core
{
/*
*******************************************************************************
* CLASS DEFINE
*******************************************************************************
*/
void AudioOutput::start()
{
_task.run(
[this](std::atomic<bool>& isCancelled) -> void
{
while (!isCancelled)
{
try
{
Frame::Ptr pFrame = readFrame(1000);
writeFrame(pFrame);
}
catch (Poco::Exception& e)
{
logger().error("%s: %s", name(), e.displayText());
Poco::Thread::sleep(1000);
}
catch (std::exception& e)
{
logger().error("%s: %s", name(), std::string(e.what()));
Poco::Thread::sleep(1000);
}
}
});
}
void AudioOutput::stop()
{
_task.cancel();
}
void AudioOutput::onLink(Core::Component::Ptr pPrevious)
{
if (!frameQueues().empty() && frameQueues().firstComponent() != pPrevious)
throw Poco::LogicException(name() + ": Support only one previous component, conflict with: " +
pPrevious->name() + ", Current: " + frameQueues().firstComponent()->name());
frameQueues().add(pPrevious, name(), MediaType::AUDIO, 6);
}
}
}