1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/**********************************************************************
Audacity: A Digital Audio Editor
AVFrameWrapper.h
Dmitry Vedenko
**********************************************************************/
#pragma once
#include <cstdint>
#include <memory>
#include "FFmpegTypes.h"
class AVChannelLayoutWrapper;
struct FFmpegFunctions;
class AVDictionaryWrapper;
typedef struct AVFrame AVFrame;
#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
#define FF_DECODE_ERROR_MISSING_REFERENCE 2
class FFMPEG_SUPPORT_API AVFrameWrapper
{
public:
AVFrameWrapper(const AVFrameWrapper&) = delete;
AVFrameWrapper& operator=(AVFrameWrapper&) = delete;
AVFrameWrapper(AVFrameWrapper&&) = delete;
AVFrameWrapper& operator=(AVFrameWrapper&&) = delete;
explicit AVFrameWrapper(const FFmpegFunctions& ffmpeg) noexcept;
AVFrame* GetWrappedValue() noexcept;
const AVFrame* GetWrappedValue() const noexcept;
virtual ~AVFrameWrapper();
virtual int GetNumDataPointers() const noexcept = 0;
virtual uint8_t* GetData(int index) const noexcept = 0;
virtual int GetLineSize(int index) const noexcept = 0;
virtual uint8_t* GetExtendedData(int index) const noexcept = 0;
virtual int GetWidth() const noexcept = 0;
virtual int GetHeight() const noexcept = 0;
virtual int GetSamplesCount() const noexcept = 0;
virtual void SetSamplesCount(int count) noexcept = 0;
virtual AVSampleFormatFwd GetFormat() const noexcept = 0;
virtual void SetFormat(AVSampleFormatFwd format) noexcept = 0;
virtual int GetKeyFrame() const noexcept = 0;
virtual AudacityAVRational GetSampleAspectRatio() const noexcept = 0;
virtual int64_t GetPresentationTimestamp() const noexcept = 0;
virtual int64_t GetPacketPresentationTimestamp() const noexcept = 0;
virtual int64_t GetPacketDecompressionTimestamp() const noexcept = 0;
virtual int GetQuality() const noexcept = 0;
virtual void* GetOpaque() const noexcept = 0;
virtual void SetOpaque(void *opaque) noexcept = 0;
virtual int GetRepeatPict() const noexcept = 0;
virtual int GetInterlacedFrame() const noexcept = 0;
virtual int GetTopFieldFirst() const noexcept = 0;
virtual int GetPaletteHasChanged() const noexcept = 0;
virtual int GetSampleRate() const noexcept = 0;
virtual const AVChannelLayoutWrapper* GetChannelLayout() const noexcept = 0;
virtual void SetChannelLayout(const AVChannelLayoutWrapper* layout) noexcept = 0;
virtual int GetSideDataCount() const noexcept = 0;
virtual int GetFlags() const noexcept = 0;
virtual int64_t GetBestEffortTimestamp() const noexcept = 0;
virtual AVDictionaryWrapper GetMetadata() const noexcept = 0;
virtual int GetDecodeErrorFlags() const noexcept = 0;
virtual int GetChannels() const noexcept = 0;
virtual int GetPacketSize() const noexcept = 0;
protected:
const FFmpegFunctions& mFFmpeg;
AVFrame* mAVFrame { nullptr };
std::unique_ptr<AVChannelLayoutWrapper> mChannelLayoutWrapper;
};
|