Audacity 3.2.0
AVFormatContextWrapper.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AVFormatContextWrapper.h
6
7 Dmitry Vedenko
8
9**********************************************************************/
10
11#pragma once
12
13#include <cstdint>
14#include <vector>
15#include <memory>
16
17#include "FFmpegTypes.h"
18#include "AVIOContextWrapper.h"
19#include "AVPacketWrapper.h"
20
21
22struct FFmpegFunctions;
24
26class AVStreamWrapper;
29class AVCodecWrapper;
30
31class FFMPEG_SUPPORT_API AVFormatContextWrapper
32{
33public:
34 using StreamsList = std::vector<std::unique_ptr<AVStreamWrapper>>;
35
38
41
43 const FFmpegFunctions& ffmpeg) noexcept;
44
46 AVFormatContext* GetWrappedValue() noexcept;
48 const AVFormatContext* GetWrappedValue() const noexcept;
49
50 virtual ~AVFormatContextWrapper();
51
52 AVIOContextWrapper::OpenResult OpenInputContext(const wxString& path, const AVInputFormatWrapper* inputFormat, AVDictionaryWrapper options);
53
54 AVIOContextWrapper::OpenResult OpenOutputContext(const wxString& path);
55
57 std::unique_ptr<AVPacketWrapper> ReadNextPacket();
58
59 std::unique_ptr<AVStreamWrapper> CreateStream();
60
61 const AVInputFormatWrapper* GetInputFormat() const noexcept;
62 const AVOutputFormatWrapper* GetOutputFormat() const noexcept;
63
64 virtual void SetOutputFormat(std::unique_ptr<AVOutputFormatWrapper> oformat) noexcept = 0;
65
66 virtual AVIOContextWrapper* GetAVIOContext() const noexcept = 0;
67 virtual void SetAVIOContext(std::unique_ptr<AVIOContextWrapper> pb) noexcept = 0;
68
69 virtual int GetCtxFlags() const noexcept = 0;
70
71 virtual unsigned int GetStreamsCount() const noexcept = 0;
72
73 virtual const StreamsList& GetStreams() const noexcept = 0;
74 virtual const AVStreamWrapper* GetStream(int index) const noexcept;
75
76 virtual const char* GetFilename() const noexcept = 0;
77 virtual void SetFilename(const char* filename) noexcept = 0;
78
79 virtual int64_t GetStartTime() const noexcept = 0;
80
81 virtual int64_t GetDuration() const noexcept = 0;
82
83 virtual int GetBitRate() const noexcept = 0;
84 virtual void SetBitRate(int bit_rate) noexcept = 0;
85
86 virtual unsigned int GetPacketSize() const noexcept = 0;
87 virtual void SetPacketSize(unsigned int packet_size) noexcept = 0;
88
89 virtual int GetMaxDelay() const noexcept = 0;
90 virtual void SetMaxDelay(int max_delay) noexcept = 0;
91
92 virtual int GetFlags() const noexcept = 0;
93 virtual void SetFlags(int flags) noexcept = 0;
94
95 virtual unsigned int GetProbeSize() const noexcept = 0;
96 virtual void SetProbeSize(unsigned int probesize) noexcept = 0;
97
98 virtual int GetMaxAnalyzeDuration() const noexcept = 0;
99 virtual void SetMaxAnalyzeDuration(int max_analyze_duration) noexcept = 0;
100
101 virtual AVCodecIDFwd GetAudioCodecId() const noexcept = 0;
102 virtual void SetAudioCodecId(AVCodecIDFwd audio_codec_id) noexcept = 0;
103
104 virtual unsigned int GetMaxIndexSize() const noexcept = 0;
105 virtual void SetMaxIndexSize(unsigned int max_index_size) noexcept = 0;
106
107 virtual AVDictionaryWrapper GetMetadata() const noexcept = 0;
108 virtual void SetMetadata(AVDictionaryWrapper metadata) noexcept = 0;
109
110 virtual int64_t GetStartTimeRealtime() const noexcept = 0;
111 virtual void SetStartTimeRealtime(int64_t start_time_realtime) noexcept = 0;
112
113 virtual int GetFpsProbeSize() const noexcept = 0;
114 virtual void SetFpsProbeSize(int fps_probe_size) noexcept = 0;
115
116 virtual int GetErrorRecognition() const noexcept = 0;
117 virtual void SetErrorRecognition(int error_recognition) noexcept = 0;
118
119 virtual int64_t GetMaxInterleaveDelta() const noexcept = 0;
120 virtual void SetMaxInterleaveDelta(int64_t max_interleave_delta) noexcept = 0;
121
122 virtual int GetStrictStdCompliance() const noexcept = 0;
123 virtual void SetStrictStdCompliance(int strict_std_compliance) noexcept = 0;
124
125 virtual int GetAudioPreload() const noexcept = 0;
126 virtual void SetAudioPreload(int audio_preload) noexcept = 0;
127
128 virtual int GetMaxChunkDuration() const noexcept = 0;
129 virtual void SetMaxChunkDuration(int max_chunk_duration) noexcept = 0;
130
131 virtual int GetMaxChunkSize() const noexcept = 0;
132 virtual void SetMaxChunkSize(int max_chunk_size) noexcept = 0;
133
134 virtual int GetUseWallclockAsTimestamps() const noexcept = 0;
135 virtual void SetUseWallclockAsTimestamps(int use_wallclock_as_timestamps) noexcept = 0;
136
137 virtual int GetAvoidNegativeTs() const noexcept = 0;
138 virtual void SetAvoidNegativeTs(int avoid_negative_ts) noexcept = 0;
139
140 virtual int GetAvioFlags() const noexcept = 0;
141 virtual void SetAvioFlags(int avio_flags) noexcept = 0;
142
143 virtual int64_t GetSkipInitialBytes() const noexcept = 0;
144 virtual void SetSkipInitialBytes(int64_t skip_initial_bytes) noexcept = 0;
145
146 virtual unsigned int GetCorrectTsOverflow() const noexcept = 0;
147 virtual void SetCorrectTsOverflow(unsigned int correct_ts_overflow) noexcept = 0;
148
149 virtual int GetSeek2any() const noexcept = 0;
150 virtual void SetSeek2any(int seek2any) noexcept = 0;
151
152 virtual int GetFlushPackets() const noexcept = 0;
153 virtual void SetFlushPackets(int flush_packets) noexcept = 0;
154
155 virtual int GetProbeScore() const noexcept = 0;
156
157 virtual int GetFormatProbeSize() const noexcept = 0;
158 virtual void SetFormatProbeSize(int format_probesize) noexcept = 0;
159
160 virtual AVCodecWrapper* GetAudioCodec() const noexcept = 0;
161 virtual void SetAudioCodec(
162 std::unique_ptr<AVCodecWrapper> audio_codec) noexcept = 0;
163
164 virtual void* GetOpaque() const noexcept = 0;
165 virtual void SetOpaque(void* opaque) noexcept = 0;
166
167 virtual int64_t GetOutputTsOffset() const noexcept = 0;
168 virtual void SetOutputTsOffset(int64_t output_ts_offset) noexcept = 0;
169protected:
170 virtual AVInputFormat* GetIFormat() const noexcept = 0;
171 virtual AVOutputFormat* GetOFormat() const noexcept = 0;
172
173 virtual void UpdateStreamList() noexcept = 0;
174
175 const FFmpegFunctions& mFFmpeg;
176 AVFormatContext* mAVFormatContext { nullptr };
177
178 std::unique_ptr<AVIOContextWrapper> mAVIOContext;
179
181 std::unique_ptr<AVInputFormatWrapper> mInputFormat;
182 std::unique_ptr<AVOutputFormatWrapper> mOutputFormat;
183
184 std::unique_ptr<AVCodecWrapper> mForcedAudioCodec;
185};
int AVCodecIDFwd
Definition: AVCodecID.h:407
std::unique_ptr< AVOutputFormatWrapper > mOutputFormat
AVFormatContextWrapper(const AVFormatContextWrapper &)=delete
std::vector< std::unique_ptr< AVStreamWrapper > > StreamsList
std::unique_ptr< AVCodecWrapper > mForcedAudioCodec
std::unique_ptr< AVIOContextWrapper > mAVIOContext
AVFormatContextWrapper & operator=(AVFormatContextWrapper &)=delete
AVFormatContextWrapper(AVFormatContextWrapper &&)=delete
std::unique_ptr< AVInputFormatWrapper > mInputFormat
AVFormatContextWrapper & operator=(AVFormatContextWrapper &&)=delete
STL namespace.