File tree Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Expand file tree Collapse file tree 4 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ void optionChecker( const std::string& inputfilename )
73
73
displayOptions ( formatOptions );
74
74
75
75
// codec options
76
- avtranscoder::CodecContext codecContext ( AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM );
76
+ AVCodecContext* avCodecContext = avcodec_alloc_context3 ( NULL );
77
+ avtranscoder::CodecContext codecContext ( *avCodecContext, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM );
77
78
std::vector<avtranscoder::Option> codecOptions = codecContext.getOptions ();
78
79
displayOptions ( codecOptions );
79
80
Original file line number Diff line number Diff line change 1
1
#include " CodecContext.hpp"
2
2
3
- extern " C" {
4
- #include < libavcodec/avcodec.h>
5
- #include < libavutil/mem.h>
6
- }
7
-
8
3
namespace avtranscoder
9
4
{
10
5
11
- CodecContext::CodecContext ( int req_flags )
12
- : _avCodecContext( NULL )
13
- {
14
- _avCodecContext = avcodec_alloc_context3 ( NULL );
15
- loadOptions ( _avCodecContext, req_flags );
16
- }
17
-
18
- CodecContext::~CodecContext ()
19
- {
20
- avcodec_close ( _avCodecContext );
21
- av_free ( _avCodecContext );
22
- }
6
+ CodecContext::CodecContext ( AVCodecContext& avCodecContext, int req_flags )
7
+ : Context( &avCodecContext, req_flags )
8
+ {}
23
9
24
10
}
Original file line number Diff line number Diff line change 3
3
4
4
#include " Context.hpp"
5
5
6
- struct AVCodecContext ;
6
+ extern " C" {
7
+ #include < libavcodec/avcodec.h>
8
+ }
7
9
8
10
namespace avtranscoder
9
11
{
10
12
11
13
/* *
12
14
* @brief Wrapper of an AVCodecContext.
13
- * @note The AVCodecContext is allocated and free by the class. It is not the case of the base class.
14
15
*/
15
16
class AvExport CodecContext : public Context
16
17
{
17
18
public:
18
- CodecContext ( int req_flags = 0 );
19
- ~CodecContext ();
20
-
21
- private:
22
- AVCodecContext* _avCodecContext;
19
+ CodecContext ( AVCodecContext& avCodecContext, int req_flags = 0 );
20
+
21
+ # ifndef SWIG
22
+ AVCodecContext& getAVCodecContext () const { return * static_cast <AVCodecContext*>( _avContext ); }
23
+ # endif
23
24
};
24
25
25
26
}
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class AvExport Context
48
48
protected:
49
49
void loadOptions ( void * av_class, int req_flags );
50
50
51
- private :
51
+ protected :
52
52
OptionMap _options;
53
53
void * _avContext; // /< Has link (no ownership)
54
54
};
You can’t perform that action at this time.
0 commit comments