File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -15,13 +15,12 @@ Frame::Frame( const size_t dataSize )
15
15
16
16
Frame::Frame (AVPacket& avPacket)
17
17
{
18
- #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 56, 0)
19
- av_copy_packet ( &_packet, &avPacket );
20
- #else
21
- // we just care about data, not side properties of AVPacket
22
- initAVPacket ();
23
- copyData ( avPacket.data , avPacket.size );
24
- #endif
18
+ copyAVPacket ( avPacket );
19
+ }
20
+
21
+ Frame::Frame ( const Frame& other )
22
+ {
23
+ copyAVPacket ( other.getAVPacket () );
25
24
}
26
25
27
26
Frame::~Frame ()
@@ -75,4 +74,17 @@ void Frame::initAVPacket()
75
74
_packet.size = 0 ;
76
75
}
77
76
77
+ void Frame::copyAVPacket ( const AVPacket& avPacket )
78
+ {
79
+ #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(55, 56, 108)
80
+ av_copy_packet ( &_packet, &avPacket );
81
+ #elif LIBAVCODEC_VERSION_INT > AV_VERSION_INT(54, 56, 0)
82
+ av_copy_packet ( &_packet, const_cast <AVPacket*>( &avPacket ) );
83
+ #else
84
+ // we just care about data, not side properties of AVPacket
85
+ initAVPacket ();
86
+ copyData ( avPacket.data , avPacket.size );
87
+ #endif
88
+ }
89
+
78
90
}
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ class AvExport Frame
22
22
// / Create a frame from the given AVPAcket (copy data of given packet)
23
23
Frame ( AVPacket& avPacket );
24
24
25
+ // / Override copy constructor in order to copy AVPacket data
26
+ Frame ( const Frame& other );
27
+
25
28
// / Free buffer of data
26
29
~Frame ();
27
30
@@ -57,6 +60,7 @@ class AvExport Frame
57
60
58
61
private:
59
62
void initAVPacket ();
63
+ void copyAVPacket ( const AVPacket& avPacket );
60
64
61
65
private:
62
66
AVPacket _packet;
You can’t perform that action at this time.
0 commit comments