File tree Expand file tree Collapse file tree 2 files changed +18
-20
lines changed Expand file tree Collapse file tree 2 files changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,15 @@ AudioDecoder::AudioDecoder( InputStream& inputStream )
21
21
: _inputStream ( &inputStream )
22
22
, _frame ( NULL )
23
23
{
24
+ #if LIBAVCODEC_VERSION_MAJOR > 54
25
+ _frame = av_frame_alloc ();
26
+ #else
27
+ _frame = avcodec_alloc_frame ();
28
+ #endif
29
+ if ( _frame == NULL )
30
+ {
31
+ throw std::runtime_error ( " unable to setup frame buffer" );
32
+ }
24
33
}
25
34
26
35
AudioDecoder::~AudioDecoder ()
@@ -44,16 +53,6 @@ AudioDecoder::~AudioDecoder()
44
53
void AudioDecoder::setup ()
45
54
{
46
55
_inputStream->getAudioCodec ().open ();
47
-
48
- #if LIBAVCODEC_VERSION_MAJOR > 54
49
- _frame = av_frame_alloc ();
50
- #else
51
- _frame = avcodec_alloc_frame ();
52
- #endif
53
- if ( _frame == NULL )
54
- {
55
- throw std::runtime_error ( " unable to setup frame buffer" );
56
- }
57
56
}
58
57
59
58
bool AudioDecoder::decodeNextFrame ( Frame& frameBuffer )
Original file line number Diff line number Diff line change @@ -20,6 +20,15 @@ VideoDecoder::VideoDecoder( InputStream& inputStream )
20
20
: _inputStream ( &inputStream )
21
21
, _frame ( NULL )
22
22
{
23
+ #if LIBAVCODEC_VERSION_MAJOR > 54
24
+ _frame = av_frame_alloc ();
25
+ #else
26
+ _frame = avcodec_alloc_frame ();
27
+ #endif
28
+ if ( _frame == NULL )
29
+ {
30
+ throw std::runtime_error ( " unable to setup frame buffer" );
31
+ }
23
32
}
24
33
25
34
VideoDecoder::~VideoDecoder ()
@@ -42,16 +51,6 @@ VideoDecoder::~VideoDecoder()
42
51
void VideoDecoder::setup ()
43
52
{
44
53
_inputStream->getVideoCodec ().open ();
45
-
46
- #if LIBAVCODEC_VERSION_MAJOR > 54
47
- _frame = av_frame_alloc ();
48
- #else
49
- _frame = avcodec_alloc_frame ();
50
- #endif
51
- if ( _frame == NULL )
52
- {
53
- throw std::runtime_error ( " unable to setup frame buffer" );
54
- }
55
54
}
56
55
57
56
bool VideoDecoder::decodeNextFrame ( Frame& frameBuffer )
You can’t perform that action at this time.
0 commit comments