AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OutputStream.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_STREAM_OUTPUT_STREAM_HPP_
2 #define _AV_TRANSCODER_STREAM_OUTPUT_STREAM_HPP_
3 
4 #include "IOutputStream.hpp"
5 
6 struct AVStream;
7 
8 namespace avtranscoder
9 {
10 
11 class OutputFile;
12 
13 class AvExport OutputStream : public IOutputStream
14 {
15 public:
16  OutputStream(OutputFile& outputFile, const size_t streamIndex);
17 
18  size_t getStreamIndex() const { return _streamIndex; }
19  float getStreamDuration() const;
20  size_t getNbFrames() const; ///< If audio stream, returns number of packets
21  int getStreamPTS() const; ///< Get current AVStream PTS
22 
23  bool isPTSGenerated() const { return _isPTSGenerated; }
24  IOutputStream::EWrappingStatus wrap(const CodedData& data);
25 
26 private:
27  OutputFile& _outputFile; ///< Has link (no ownership)
28  const AVStream& _outputAVStream; ///< Has link (no ownership)
29 
30  size_t _streamIndex; ///< Index of the stream in the output file
31 
32  //@{
33  // @brief These attributes will help us to get the stream duration.
34  // @see ffmpeg hack: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/mux.c#L585
35  // @see getStreamDuration
36  size_t _wrappedPacketsDuration; //< the addition of the duration of all packets wrapped by this stream.
37  int _lastWrappedPacketDuration; //< The duration of the last packet wrapped by this stream.
38  bool _isPTSGenerated; //< Is the PTS generated by ffmpeg/libav (in case of generator for example)
39  //@}
40 };
41 }
42 
43 #endif
size_t _streamIndex
Index of the stream in the output file.
OutputFile & _outputFile
Has link (no ownership)
Outputfile is the default implentation of wrapper which uses LibAV/FFMpeg.
Definition: OutputFile.hpp:17
EWrappingStatus
define wrapping result status
const AVStream & _outputAVStream
Has link (no ownership)
size_t getStreamIndex() const
This class describes coded data.
Definition: CodedData.hpp:18