Files
fmviewer3/project/fm_viewer/fav/AudioOutputNull.cpp
2026-02-21 17:11:31 +09:00

53 lines
2.1 KiB
C++

/******************************************************************************
QtAV: Multimedia framework based on Qt and FFmpeg
Copyright (C) 2012-2016 Wang Bin <wbsecg1@gmail.com>
* This file is part of QtAV (from 2015)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
******************************************************************************/
#include "AudioOutputBackend.h"
#include "mkid.h"
#include "factory.h"
namespace FAV {
//TODO: block internally
static const char kName[] = "null";
class AudioOutputNull : public AudioOutputBackend
{
public:
AudioOutputNull(QObject *parent = 0);
QString name() const Q_DECL_OVERRIDE { return QLatin1String(kName);}
QString status() const Q_DECL_OVERRIDE {return "";};
bool open() Q_DECL_OVERRIDE { return true;}
bool close() Q_DECL_OVERRIDE { return true;}
// TODO: check channel layout. Null supports channels>2
BufferControl bufferControl() const Q_DECL_OVERRIDE { return Blocking;}
bool write(const QByteArray&) Q_DECL_OVERRIDE { return true;}
bool play() Q_DECL_OVERRIDE { return true;}
};
typedef AudioOutputNull AudioOutputBackendNull;
static const AudioOutputBackendId AudioOutputBackendId_Null = mkid::id32base36_4<'n', 'u', 'l', 'l'>::value;
FACTORY_REGISTER(AudioOutputBackend, Null, kName)
AudioOutputNull::AudioOutputNull(QObject *parent)
: AudioOutputBackend(AudioOutput::DeviceFeatures(), parent)
{}
} //namespace FAV