File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -6,28 +6,33 @@ namespace avtranscoder
6
6
{
7
7
8
8
Frame::Frame ()
9
+ : _avStream( NULL )
9
10
{
10
11
initAVPacket ();
11
12
}
12
13
13
14
Frame::Frame ( const size_t dataSize )
15
+ : _avStream( NULL )
14
16
{
15
17
av_new_packet ( &_packet, dataSize );
16
18
}
17
19
18
20
Frame::Frame ( const AVPacket& avPacket )
21
+ : _avStream( NULL )
19
22
{
20
23
copyAVPacket ( avPacket );
21
24
}
22
25
23
26
Frame::Frame ( const Frame& other )
24
27
{
25
28
copyAVPacket ( other.getAVPacket () );
29
+ _avStream = &other.getAVStream ();
26
30
}
27
31
28
32
Frame& Frame::operator =( const Frame& other )
29
33
{
30
34
copyAVPacket ( other.getAVPacket () );
35
+ _avStream = &other.getAVStream ();
31
36
return *this ;
32
37
}
33
38
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ extern "C" {
7
7
#include < libavcodec/avcodec.h>
8
8
}
9
9
10
+ struct AVStream ;
11
+
10
12
namespace avtranscoder
11
13
{
12
14
@@ -33,6 +35,7 @@ class AvExport Frame
33
35
// / Free buffer of data
34
36
~Frame ();
35
37
38
+ void refAVStream ( const AVStream& avStream ) { _avStream = &avStream; }
36
39
// / Resize data buffer
37
40
void resize ( const size_t newSize );
38
41
@@ -58,6 +61,7 @@ class AvExport Frame
58
61
size_t getSize () const { return _packet.size ; }
59
62
60
63
#ifndef SWIG
64
+ const AVStream& getAVStream () const { return *_avStream; }
61
65
AVPacket& getAVPacket () { return _packet; }
62
66
const AVPacket& getAVPacket () const { return _packet; }
63
67
const unsigned char * getData () const { return _packet.data ; }
@@ -69,6 +73,9 @@ class AvExport Frame
69
73
70
74
private:
71
75
AVPacket _packet;
76
+
77
+ // Stream which contains the packet
78
+ const AVStream* _avStream; // < Has link (no ownership)
72
79
};
73
80
74
81
// Typedef to represent buffer of coded data.
You can’t perform that action at this time.
0 commit comments