AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InputStream.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_STREAM_INPUT_STREAM_HPP_
2 #define _AV_TRANSCODER_STREAM_INPUT_STREAM_HPP_
3 
4 #include "IInputStream.hpp"
5 
6 #include <queue>
7 
8 struct AVStream;
9 
10 namespace avtranscoder
11 {
12 
13 class InputFile;
14 
15 class AvExport InputStream : public IInputStream
16 {
17 private:
18  InputStream(const InputStream& inputStream);
19  InputStream& operator=(const InputStream& inputStream);
20 
21 public:
22  InputStream(InputFile& inputFile, const size_t streamIndex);
23  ~InputStream();
24 
25  bool readNextPacket(CodedData& data);
26 
27  const StreamProperties& getProperties() const;
28  size_t getStreamIndex() const { return _streamIndex; }
29 
30  VideoCodec& getVideoCodec();
31  AudioCodec& getAudioCodec();
32  DataCodec& getDataCodec();
33 
34  void activate(const bool activate = true) { _isActivated = activate; };
35  bool isActivated() const { return _isActivated; };
36  void addPacket(const AVPacket& packet);
37  void clearBuffering();
38 
39 private:
40  InputFile* _inputFile; ///< Has link (no ownership)
41  ICodec* _codec; ///< Has ownership
42 
43  std::queue<CodedData> _streamCache; ///< Cache of packet data already read and corresponding to this stream
44 
45  size_t _streamIndex; ///< Index of the stream in the input file
46  bool _isActivated; ///< If the stream is activated, data read from it will be buffered
47 };
48 }
49 
50 #endif
size_t _streamIndex
Index of the stream in the input file.
Definition: InputStream.hpp:45
size_t getStreamIndex() const
Definition: InputStream.hpp:28
InputFile * _inputFile
Has link (no ownership)
Definition: InputStream.hpp:40
void activate(const bool activate=true)
Functions about buffering Activate the stream will buffered its data when read packets.
Definition: InputStream.hpp:34
Virtual based class of properties for all types of stream.
This class describes coded data.
Definition: CodedData.hpp:18
bool _isActivated
If the stream is activated, data read from it will be buffered.
Definition: InputStream.hpp:46
std::queue< CodedData > _streamCache
Cache of packet data already read and corresponding to this stream.
Definition: InputStream.hpp:43
ICodec * _codec
Has ownership.
Definition: InputStream.hpp:41