Audacity  3.0.3
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 
17 struct FFmpegFunctions;
18 typedef struct AVPacket AVPacket;
19 
20 class FFMPEG_SUPPORT_API AVPacketWrapper
21 {
22 public:
23  AVPacketWrapper(const AVPacketWrapper&) = delete;
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  virtual int GetDuration() const noexcept = 0;
41 
42  virtual void RescalePresentationTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
43  virtual void RescaleDecompressionTimestamp(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
44  virtual void RescaleDuration(AudacityAVRational bq, AudacityAVRational cq) noexcept = 0;
45 
46  virtual uint8_t* GetData() const noexcept = 0;
47  virtual int GetSize() const noexcept = 0;
48 
49  virtual bool OffsetPacket(size_t offset) noexcept = 0;
50  virtual void ResetData() noexcept = 0;
51  virtual void ResetTimestamps() noexcept = 0;
52 
53  virtual int GetStreamIndex() const noexcept = 0;
54  virtual void SetStreamIndex(int index) noexcept = 0;
55 
56  virtual int GetFlags() const noexcept = 0;
57  virtual int64_t GetPos() const noexcept = 0;
58  virtual int64_t GetConvergenceDuration() const noexcept = 0;
59 
61  virtual std::unique_ptr<AVPacketWrapper> Clone() const noexcept = 0;
62 
63 protected:
64  const FFmpegFunctions& mFFmpeg;
65  AVPacket* mAVPacket { nullptr };
66 
67  bool mUseAVFree { true };
68 };
AudacityAVRational
Definition: FFmpegTypes.h:132
AVPacketWrapper
Definition: AVPacketWrapper.h:21
AVPacketWrapper::AVPacketWrapper
AVPacketWrapper(AVPacketWrapper &&)=delete
AudacityAVBufferRef
Definition: FFmpegTypes.h:177
AVPacketWrapper::operator=
AVPacketWrapper & operator=(AVPacketWrapper &)=delete
FFmpegFunctions
Definition: FFmpegFunctions.h:85
AVPacket
Definition: ffmpeg-2.3.6-single-header.h:2801
AVPacketWrapper::operator=
AVPacketWrapper & operator=(AVPacketWrapper &&)=delete
FFmpegTypes.h
AVPacketWrapper::AVPacketWrapper
AVPacketWrapper(const AVPacketWrapper &)=delete