File tree Expand file tree Collapse file tree 3 files changed +39
-31
lines changed
src/AvTranscoder/codedStream Expand file tree Collapse file tree 3 files changed +39
-31
lines changed Original file line number Diff line number Diff line change @@ -89,17 +89,6 @@ bool AvInputStream::readNextPacket( CodedData& data )
89
89
return true ;
90
90
}
91
91
92
- void AvInputStream::addPacket ( AVPacket& packet )
93
- {
94
- // Do not cache data if the stream is declared as unused in process
95
- if ( ! _isActivated )
96
- return ;
97
-
98
- CodedData data;
99
- _streamCache.push ( data );
100
- _streamCache.back ().copyData ( packet.data , packet.size );
101
- }
102
-
103
92
VideoCodec& AvInputStream::getVideoCodec ()
104
93
{
105
94
assert ( _streamIndex <= _inputFile->getAVFormatContext ().nb_streams );
@@ -146,6 +135,17 @@ double AvInputStream::getDuration() const
146
135
return 1.0 * _inputFile->getAVFormatContext ().duration / AV_TIME_BASE;
147
136
}
148
137
138
+ void AvInputStream::addPacket ( AVPacket& packet )
139
+ {
140
+ // Do not cache data if the stream is declared as unused in process
141
+ if ( ! _isActivated )
142
+ return ;
143
+
144
+ CodedData data;
145
+ _streamCache.push ( data );
146
+ _streamCache.back ().copyData ( packet.data , packet.size );
147
+ }
148
+
149
149
void AvInputStream::clearBuffering ()
150
150
{
151
151
_streamCache = std::queue<CodedData>();
Original file line number Diff line number Diff line change @@ -17,28 +17,27 @@ class AvExport AvInputStream : public IInputStream
17
17
public:
18
18
AvInputStream ( InputFile& inputFile, const size_t streamIndex );
19
19
AvInputStream ( const AvInputStream& inputStream );
20
-
21
20
~AvInputStream ( );
22
21
23
- size_t getStreamIndex () const { return _streamIndex; }
24
-
25
22
bool readNextPacket ( CodedData& data );
26
23
27
- // Stream properties
24
+ size_t getStreamIndex () const { return _streamIndex; }
25
+ double getDuration () const ;
26
+ AVMediaType getStreamType () const ;
27
+
28
28
VideoCodec& getVideoCodec ();
29
29
AudioCodec& getAudioCodec ();
30
30
DataCodec& getDataCodec ();
31
31
32
- AVMediaType getStreamType () const ;
33
-
34
- double getDuration () const ;
35
-
36
- void addPacket ( AVPacket& packet );
37
-
32
+ // @{
33
+ /* *
34
+ * @brief Functions about buffering
35
+ */
38
36
void activate ( const bool activate = true ){ _isActivated = activate; };
39
37
bool isActivated () const { return _isActivated; };
40
-
38
+ void addPacket ( AVPacket& packet );
41
39
void clearBuffering ();
40
+ // @}
42
41
43
42
private:
44
43
AVStream* getAVStream () const ;
Original file line number Diff line number Diff line change @@ -14,24 +14,33 @@ class IInputStream
14
14
public:
15
15
virtual ~IInputStream () {};
16
16
17
- virtual size_t getStreamIndex () const = 0;
18
-
17
+ /* *
18
+ * @brief Read the next packet of the stream
19
+ * @param data: data of next packet read
20
+ * @return if next packet was read succefully
21
+ **/
19
22
virtual bool readNextPacket ( CodedData& data ) = 0;
20
23
21
- // Stream properties
24
+ virtual size_t getStreamIndex () const = 0;
25
+ virtual double getDuration () const = 0;
26
+ virtual AVMediaType getStreamType () const = 0;
27
+
28
+ // @{
29
+ /* *
30
+ * Return the codec informations of the stream
31
+ * @exception Raise a runtime error if the stream is not of the corresponding type
32
+ */
22
33
virtual VideoCodec& getVideoCodec () = 0;
23
34
virtual AudioCodec& getAudioCodec () = 0;
24
35
virtual DataCodec& getDataCodec () = 0;
25
-
26
- virtual AVMediaType getStreamType () const = 0;
27
-
28
- virtual double getDuration () const = 0;
36
+ // @}
29
37
38
+ /* *
39
+ * @brief Activate the stream will buffered its data when read packets.
40
+ **/
30
41
virtual void activate ( const bool activate = true ) = 0;
31
42
virtual bool isActivated () const = 0;
32
-
33
43
virtual void clearBuffering () = 0;
34
-
35
44
};
36
45
37
46
}
You can’t perform that action at this time.
0 commit comments