AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CodedData.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_FRAME_CODEDDATA_HPP_
2 #define _AV_TRANSCODER_FRAME_CODEDDATA_HPP_
3 
5 
6 extern "C" {
7 #include <libavcodec/avcodec.h>
8 }
9 
10 struct AVStream;
11 
12 namespace avtranscoder
13 {
14 
15 /**
16  * @brief This class describes coded data.
17  */
18 class AvExport CodedData
19 {
20 public:
21  /// Create an empty data buffer
22  CodedData();
23 
24  /// Create a data buffer with a the given size
25  CodedData(const size_t dataSize);
26 
27 #ifndef SWIG
28  /// Create a data buffer from the given AVPAcket (copy data of given packet)
29  CodedData(const AVPacket& avPacket);
30 #endif
31 
32  /// Override copy constructor in order to copy AVPacket data
33  CodedData(const CodedData& other);
34 
35  /// Override operator = in order to copy AVPacket data
36  CodedData& operator=(const CodedData& other);
37 
38  /// Free buffer of data
39  ~CodedData();
40 
41 #ifndef SWIG
42  void refAVStream(const AVStream& avStream) { _avStream = &avStream; }
43 #endif
44  /// Resize data buffer
45  void resize(const size_t newSize);
46 
47  ///@{
48  /// Ref to external data buffer
49  void refData(CodedData& frame);
50  void refData(unsigned char* buffer, const size_t size);
51  ///@}
52 
53  /// Copy external data buffer
54  void copyData(unsigned char* buffer, const size_t size);
55 
56  /**
57  * @brief Resize the buffer with the given size, and copy the given value
58  * @note Use this function to check if we can modify the buffer
59  */
60  void assign(const size_t size, const int value);
61 
62  /// Clear existing data and set size to 0
63  void clear();
64 
65  unsigned char* getData() { return _packet.data; }
66 #ifndef SWIG
67  const unsigned char* getData() const { return _packet.data; }
68 #endif
69 
70  size_t getSize() const { return _packet.size; }
71 
72 #ifndef SWIG
73  /**
74  * @return the AVStream which contains the packet
75  * @note may be NULL in case of generated packets
76  */
77  const AVStream* getAVStream() const { return _avStream; }
78  AVPacket& getAVPacket() { return _packet; }
79  const AVPacket& getAVPacket() const { return _packet; }
80 #endif
81 
82 private:
83  void initAVPacket();
84  void copyAVPacket(const AVPacket& avPacket);
85 
86 private:
87  AVPacket _packet;
88 
89  // Stream which contains the packet
90  const AVStream* _avStream; //< Has link (no ownership)
91 };
92 }
93 
94 #endif
unsigned char * getData()
Definition: CodedData.hpp:65
const unsigned char * getData() const
Definition: CodedData.hpp:67
const AVStream * getAVStream() const
Definition: CodedData.hpp:77
AVPacket & getAVPacket()
Definition: CodedData.hpp:78
void refAVStream(const AVStream &avStream)
Definition: CodedData.hpp:42
const AVPacket & getAVPacket() const
Definition: CodedData.hpp:79
const AVStream * _avStream
Definition: CodedData.hpp:90
size_t getSize() const
Definition: CodedData.hpp:70
This class describes coded data.
Definition: CodedData.hpp:18
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy