Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7339f50

Browse files
author
Clement Champetier
committed
stat: add AudioStat class
1 parenta16929b commit7339f50

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

‎src/AvTranscoder/stat/AudioStat.hpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef _AV_TRANSCODER_AUDIOSTAT_HPP
2+
#define_AV_TRANSCODER_AUDIOSTAT_HPP
3+
4+
#include<AvTranscoder/common.hpp>
5+
6+
namespaceavtranscoder
7+
{
8+
9+
/**
10+
* @brief Statistics related to an audio stream.
11+
*/
12+
classAvExport AudioStat
13+
{
14+
public:
15+
AudioStat(constdouble duration,constsize_t nbPackets )
16+
: _duration( duration )
17+
, _nbPackets( nbPackets )
18+
{}
19+
20+
public:
21+
double _duration;
22+
size_t _nbPackets;
23+
};
24+
25+
}
26+
27+
#endif

‎src/AvTranscoder/stat/ProcessStat.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ void ProcessStat::addVideoStat( const size_t streamIndex, const VideoStat& video
1010
_videoStats.insert(std::make_pair( streamIndex, videoStat ) );
1111
}
1212

13+
voidProcessStat::addAudioStat(constsize_t streamIndex,const AudioStat& audioStat )
14+
{
15+
_audioStats.insert(std::make_pair( streamIndex, audioStat ) );
16+
}
17+
1318
}

‎src/AvTranscoder/stat/ProcessStat.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include<AvTranscoder/common.hpp>
55
#include<AvTranscoder/stat/VideoStat.hpp>
6+
#include<AvTranscoder/stat/AudioStat.hpp>
67

78
#include<map>
89

@@ -21,11 +22,14 @@ class AvExport ProcessStat
2122
{}
2223

2324
voidaddVideoStat(constsize_t streamIndex,const VideoStat& videoStat );
25+
voidaddAudioStat(constsize_t streamIndex,const AudioStat& audioStat );
2426

2527
VideoStat&getVideoStat(constsize_t streamIndex ) {return _videoStats.at(streamIndex); }
28+
AudioStat&getAudioStat(constsize_t streamIndex ) {return _audioStats.at(streamIndex); }
2629

2730
private:
2831
std::map<size_t, VideoStat> _videoStats;///< Key: streamIndex, Value: statistic video results
32+
std::map<size_t, AudioStat> _audioStats;///< Key: streamIndex, Value: statistic audio results
2933
};
3034

3135
}

‎src/AvTranscoder/stream/OutputStream.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class AvExport OutputStream : public IOutputStream
1515

1616
size_tgetStreamIndex()const {return _streamIndex; }
1717
doublegetStreamDuration()const;
18-
size_tgetNbFrames()const;
18+
size_tgetNbFrames()const;///< If audio stream, returns number of packets
1919

2020
IOutputStream::EWrappingStatuswrap(const CodedData& data );
2121

‎src/AvTranscoder/transcoder/Transcoder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,12 @@ void Transcoder::fillProcessStat( ProcessStat& processStat )
537537
processStat.addVideoStat( streamIndex, videoStat );
538538
break;
539539
}
540+
case AVMEDIA_TYPE_AUDIO:
541+
{
542+
AudioStataudioStat( stream.getStreamDuration(), stream.getNbFrames() );
543+
processStat.addAudioStat( streamIndex, audioStat );
544+
break;
545+
}
540546
default:
541547
break;
542548
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp