Audacity 3.2.0
AVPacketWrapper.h
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 AVPacketWrapper.h
6
7 Dmitry Vedenko
8
9**********************************************************************/
10
11#pragma once
12
13#include "FFmpegTypes.h"
14
15#include <memory>
16
17struct FFmpegFunctions;
18typedef struct AVPacket AVPacket;
19
20class FFMPEG_SUPPORT_API AVPacketWrapper
21{
22public:
25
28
29 explicit AVPacketWrapper(const FFmpegFunctions& ffmpeg) noexcept;
30
31 AVPacket* GetWrappedValue() noexcept;
32 const AVPacket* GetWrappedValue() const noexcept;
33
34 virtual ~AVPacketWrapper();
35
36 virtual AudacityAVBufferRef* GetBuf() const noexcept = 0;
37
38 virtual int64_t GetPresentationTimestamp() const noexcept = 0;
39 virtual int64_t GetDecompressionTimestamp() const noexcept = 0;
40
41 virtual int GetDuration() const noexcept = 0;
42
43 virtual void RescalePresentationTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
44 virtual void RescaleDecompressionTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
45 virtual void RescaleDuration(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
46
47 virtual uint8_t* GetData() const noexcept = 0;
48 virtual int GetSize() const noexcept = 0;
49
50 virtual bool OffsetPacket(size_t offset) noexcept = 0;
51 virtual void ResetData() noexcept = 0;
52 virtual void ResetTimestamps() noexcept = 0;
53
54 virtual int GetStreamIndex() const noexcept = 0;
55 virtual void SetStreamIndex(int index) noexcept = 0;
56
57 virtual int GetFlags() const noexcept = 0;
58 virtual int64_t GetPos() const noexcept = 0;
59 virtual int64_t GetConvergenceDuration() const noexcept = 0;
60
62 virtual std::unique_ptr<AVPacketWrapper> Clone() const noexcept = 0;
63
64protected:
65 const FFmpegFunctions& mFFmpeg;
66 AVPacket* mAVPacket { nullptr };
67
68 bool mUseAVFree { true };
69};
AVPacketWrapper & operator=(AVPacketWrapper &)=delete
AVPacketWrapper & operator=(AVPacketWrapper &&)=delete
AVPacketWrapper(AVPacketWrapper &&)=delete
AVPacketWrapper(const AVPacketWrapper &)=delete
STL namespace.