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