| 1 |
/* |
| 2 |
* Copyright (c) 2010-2023 Belledonne Communications SARL. |
| 3 |
* |
| 4 |
* This file is part of mediastreamer2 |
| 5 |
* (see https://gitlab.linphone.org/BC/public/mediastreamer2). |
| 6 |
* |
| 7 |
* This program is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU Affero General Public License as |
| 9 |
* published by the Free Software Foundation, either version 3 of the |
| 10 |
* License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU Affero General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU Affero General Public License |
| 18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <memory> |
| 24 |
|
| 25 |
#include "../obu/obu-packer.h" |
| 26 |
#include "av1-encoder.h" |
| 27 |
#include "filter-interface/encoder-filter.h" |
| 28 |
|
| 29 |
namespace mediastreamer { |
| 30 |
|
| 31 |
class Av1EncoderFilter : public EncoderFilter { |
| 32 |
public: |
| 33 |
Av1EncoderFilter(MSFilter *f, Av1Encoder *encoder, const MSVideoConfiguration *vconfList); |
| 34 |
|
| 35 |
void preprocess() override; |
| 36 |
void process() override; |
| 37 |
void postprocess() override; |
| 38 |
|
| 39 |
const MSVideoConfiguration *getVideoConfigurations() const override; |
| 40 |
const MSVideoConfiguration &getVideoConfiguration() const override { |
| 41 |
return mVconf; |
| 42 |
} |
| 43 |
void setVideoConfiguration(MSVideoConfiguration vconf) override; |
| 44 |
|
| 45 |
void enableAvpf(bool enable) override; |
| 46 |
|
| 47 |
void requestVfu() override; |
| 48 |
void notifyPli() override; |
| 49 |
void notifyFir() override; |
| 50 |
void notifySli() override; |
| 51 |
|
| 52 |
protected: |
| 53 |
MSVideoConfiguration mVconf; |
| 54 |
bool mAvpfEnabled = false; |
| 55 |
bool mFirstFrameEncoded = false; |
| 56 |
|
| 57 |
MSVideoStarter mStarter; |
| 58 |
MSIFrameRequestsLimiterCtx mIframeLimiter; |
| 59 |
|
| 60 |
std::unique_ptr<Av1Encoder> mEncoder; |
| 61 |
ObuPacker mPacker; |
| 62 |
|
| 63 |
const MSVideoConfiguration *mVconfList = nullptr; |
| 64 |
}; |
| 65 |
|
| 66 |
} // namespace mediastreamer |