File tree Expand file tree Collapse file tree 4 files changed +16
-25
lines changed Expand file tree Collapse file tree 4 files changed +16
-25
lines changed Original file line number Diff line number Diff line change 1
1
#include < AvTranscoder/util.hpp>
2
2
#include < AvTranscoder/option/Context.hpp>
3
+ #include " AvTranscoder/option/FormatContext.hpp"
3
4
#include < AvTranscoder/option/CodecContext.hpp>
4
5
#include < AvTranscoder/option/Option.hpp>
5
6
#include < AvTranscoder/file/InputFile.hpp>
@@ -68,7 +69,8 @@ void optionChecker( const std::string& inputfilename )
68
69
avtranscoder::InputFile file ( inputfilename );
69
70
70
71
// format options
71
- avtranscoder::Context formatContext ( &file.getAVFormatContext () );
72
+ AVFormatContext* avFormatContext = avformat_alloc_context ();
73
+ avtranscoder::FormatContext formatContext ( *avFormatContext );
72
74
std::vector<avtranscoder::Option> formatOptions = formatContext.getOptions ();
73
75
displayOptions ( formatOptions );
74
76
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ namespace avtranscoder
12
12
{
13
13
14
14
typedef std::vector<Option> OptionArray;
15
- typedef std::map<std::string, Option> OptionMap;
15
+ typedef std::map<std::string, Option> OptionMap; // /< Key: option name / value: option
16
16
17
17
/* *
18
18
* @brief Wrapper of AVContext.
@@ -40,8 +40,8 @@ class AvExport Context
40
40
loadOptions ( avContext, req_flags );
41
41
}
42
42
43
- OptionArray getOptions ();
44
- OptionMap& getOptionsMap () { return _options; }
43
+ OptionArray getOptions (); // /< Get options as array
44
+ OptionMap& getOptionsMap () { return _options; } // /< Get options as map
45
45
46
46
Option& getOption ( const std::string& optionName ) { return _options.at (optionName); }
47
47
Original file line number Diff line number Diff line change 1
1
#include " FormatContext.hpp"
2
2
3
- extern " C" {
4
- #include < libavformat/avformat.h>
5
- }
6
-
7
3
namespace avtranscoder
8
4
{
9
5
10
- FormatContext::FormatContext ( int req_flags )
11
- : _avFormatContext( NULL )
12
- {
13
- _avFormatContext = avformat_alloc_context ();
14
- loadOptions ( _avFormatContext, req_flags );
15
- }
16
-
17
- FormatContext::~FormatContext ()
18
- {
19
- avformat_free_context ( _avFormatContext );
20
- }
6
+ FormatContext::FormatContext ( AVFormatContext& avFormatContext, int req_flags )
7
+ : Context( &avFormatContext, req_flags )
8
+ {}
21
9
22
10
}
Original file line number Diff line number Diff line change 3
3
4
4
#include " Context.hpp"
5
5
6
- struct AVFormatContext ;
6
+ extern " C" {
7
+ #include < libavformat/avformat.h>
8
+ }
7
9
8
10
namespace avtranscoder
9
11
{
10
12
11
13
/* *
12
14
* @brief Wrapper of an AVFormatContext.
13
- * @note The AVFormatContext is allocated and free by the class. It is not the case of the base class.
14
15
*/
15
16
class FormatContext : public Context
16
17
{
17
18
public:
18
- FormatContext ( int req_flags = 0 );
19
- ~FormatContext ();
19
+ FormatContext ( AVFormatContext& avFormatContext, int req_flags = 0 );
20
20
21
- private:
22
- AVFormatContext* _avFormatContext;
21
+ #ifndef SWIG
22
+ AVFormatContext& getAVFormatContext () const { return *static_cast <AVFormatContext*>( _avContext ); }
23
+ #endif
23
24
};
24
25
25
26
}
You can’t perform that action at this time.
0 commit comments