@@ -6,72 +6,73 @@ namespace avtranscoder
6
6
{
7
7
8
8
FileProperties::FileProperties ( const FormatContext& formatContext )
9
- : _formatContext( &formatContext.getAVFormatContext() )
9
+ : _formatContext( &formatContext )
10
+ , _avFormatContext( &formatContext.getAVFormatContext() )
10
11
, _videoStreams()
11
12
, _audioStreams()
12
13
, _dataStreams()
13
14
, _subtitleStreams()
14
15
, _attachementStreams()
15
16
, _unknownStreams()
16
17
{
17
- if ( _formatContext )
18
- detail::fillMetadataDictionnary ( _formatContext ->metadata , _metadatas );
18
+ if ( _avFormatContext )
19
+ detail::fillMetadataDictionnary ( _avFormatContext ->metadata , _metadatas );
19
20
}
20
21
21
22
std::string FileProperties::getFilename () const
22
23
{
23
- if ( ! _formatContext || ! _formatContext ->filename )
24
+ if ( ! _avFormatContext || ! _avFormatContext ->filename )
24
25
throw std::runtime_error ( " unknown file name" );
25
- return _formatContext ->filename ;
26
+ return _avFormatContext ->filename ;
26
27
}
27
28
28
29
std::string FileProperties::getFormatName () const
29
30
{
30
- if ( ! _formatContext || ! _formatContext ->iformat || ! _formatContext ->iformat ->name )
31
+ if ( ! _avFormatContext || ! _avFormatContext ->iformat || ! _avFormatContext ->iformat ->name )
31
32
throw std::runtime_error ( " unknown format name" );
32
- return _formatContext ->iformat ->name ;
33
+ return _avFormatContext ->iformat ->name ;
33
34
}
34
35
35
36
std::string FileProperties::getFormatLongName () const
36
37
{
37
- if ( ! _formatContext || ! _formatContext ->iformat || ! _formatContext ->iformat ->long_name )
38
+ if ( ! _avFormatContext || ! _avFormatContext ->iformat || ! _avFormatContext ->iformat ->long_name )
38
39
throw std::runtime_error ( " unknown format long name" );
39
- return _formatContext ->iformat ->long_name ;
40
+ return _avFormatContext ->iformat ->long_name ;
40
41
}
41
42
42
43
size_t FileProperties::getProgramsCount () const
43
44
{
44
- if ( ! _formatContext )
45
+ if ( ! _avFormatContext )
45
46
throw std::runtime_error ( " unknown format context" );
46
- return _formatContext ->nb_programs ;
47
+ return _avFormatContext ->nb_programs ;
47
48
}
48
49
49
50
double FileProperties::getStartTime () const
50
51
{
51
- if ( ! _formatContext )
52
+ if ( ! _avFormatContext )
52
53
throw std::runtime_error ( " unknown format context" );
53
- return 1.0 * (unsigned int )_formatContext ->start_time / AV_TIME_BASE;
54
+ return 1.0 * (unsigned int )_avFormatContext ->start_time / AV_TIME_BASE;
54
55
}
55
56
56
57
double FileProperties::getDuration () const
57
58
{
58
- if ( ! _formatContext )
59
+ if ( ! _avFormatContext )
59
60
throw std::runtime_error ( " unknown format context" );
60
- return 1.0 * _formatContext ->duration / AV_TIME_BASE;
61
+ return 1.0 * _avFormatContext ->duration / AV_TIME_BASE;
61
62
}
62
63
63
64
size_t FileProperties::getBitRate () const
64
65
{
65
- if ( ! _formatContext )
66
+ if ( ! _avFormatContext )
66
67
throw std::runtime_error ( " unknown format context" );
67
- return _formatContext ->bit_rate ;
68
+ return _avFormatContext ->bit_rate ;
68
69
}
69
70
70
71
size_t FileProperties::getPacketSize () const
71
72
{
72
- if ( ! _formatContext )
73
+ if ( ! _avFormatContext )
73
74
throw std::runtime_error ( " unknown format context" );
74
- return _formatContext ->packet_size ;
75
+ return _avFormatContext ->packet_size ;
75
76
}
76
77
77
78
VideoProperties& FileProperties::getVideoPropertiesWithStreamIndex ( const size_t streamIndex )
@@ -124,9 +125,9 @@ const avtranscoder::AudioProperties& FileProperties::getAudioPropertiesWithStrea
124
125
125
126
size_t FileProperties::getNbStreams () const
126
127
{
127
- if ( ! _formatContext )
128
+ if ( ! _avFormatContext )
128
129
throw std::runtime_error ( " unknown format context" );
129
- return _formatContext ->nb_streams ;
130
+ return _avFormatContext ->nb_streams ;
130
131
}
131
132
132
133
PropertyVector FileProperties::getPropertiesAsVector () const
0 commit comments