AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AudioProperties.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_MEDIA_PROPERTY_AUDIO_PROPERTIES_HPP
2 #define _AV_TRANSCODER_MEDIA_PROPERTY_AUDIO_PROPERTIES_HPP
3 
5 
6 #include <string>
7 
8 namespace avtranscoder
9 {
10 
11 class AvExport AudioProperties : public StreamProperties
12 {
13 public:
14  AudioProperties(const FormatContext& formatContext, const size_t index);
15 
16  std::string getSampleFormatName() const;
17  std::string getSampleFormatLongName() const;
18  std::string getChannelLayout() const;
19  std::string getChannelName() const;
20  std::string getChannelDescription() const;
21 
22  size_t getSampleRate() const;
23  size_t getNbChannels() const;
24  size_t getBitRate() const; ///< 0 if unknown
25  size_t getNbSamples() const;
26 
27  size_t getTicksPerFrame() const;
28 
29 #ifndef SWIG
30  AVCodecContext& getAVCodecContext() { return *_codecContext; }
31 #endif
32 
33  PropertyVector& fillVector(PropertyVector& data) const;
34 
35 private:
36 #ifndef SWIG
37  template <typename T>
38  void addProperty(PropertyVector& data, const std::string& key, T (AudioProperties::*getter)(void) const) const
39  {
40  try
41  {
42  detail::add(data, key, (this->*getter)());
43  }
44  catch(const std::exception& e)
45  {
47  }
48  }
49 #endif
50 };
51 
52 #ifndef SWIG
53 AvExport std::ostream& operator<<(std::ostream& flux, const AudioProperties& audioProperties);
54 #endif
55 }
56 
57 #endif
std::vector< std::pair< std::string, std::string > > PropertyVector
PropertyVector is a vector of pair, because the order of properties matters to us.
Definition: util.hpp:23
void add(PropertyVector &propertyVector, const std::string &key, const size_t &value)
Definition: util.cpp:16
void addProperty(PropertyVector &data, const std::string &key, T(AudioProperties::*getter)(void) const) const
AVCodecContext & getAVCodecContext()
Wrapper of an AVFormatContext.
Virtual based class of properties for all types of stream.
std::ostream & operator<<(std::ostream &flux, const InputFile &input)
Definition: InputFile.cpp:171
std::string getSampleFormatName(const AVSampleFormat sampleFormat)
Definition: util.cpp:106
const std::string propertyValueIfError
Definition: util.hpp:38