
This header is a C++ header (it contains keywords such as 'class' and 'public'). It is not necessary to test defined(__cplusplus). That test is appropriate in a C header that may be included by C++ code. R=henrik.lundin@webrtc.org, jan.skoglund@webrtc.org, sprang@webrtc.org BUG=none Review URL: https://webrtc-codereview.appspot.com/38899004 Cr-Commit-Position: refs/heads/master@{#8256} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8256 4adac7df-926f-26a2-2b94-8c16560cd09d
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_
|
|
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_
|
|
|
|
extern "C" {
|
|
#include "celt.h"
|
|
#include "analysis.h"
|
|
#include "opus_private.h"
|
|
}
|
|
|
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
|
#include "webrtc/typedefs.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// This class provides a speech/music classification and is a wrapper over the
|
|
// Opus classifier. It currently only supports 48 kHz mono or stereo with a
|
|
// frame size of 20 ms.
|
|
|
|
class AudioClassifier {
|
|
public:
|
|
AudioClassifier();
|
|
virtual ~AudioClassifier();
|
|
|
|
// Classifies one frame of audio data in input,
|
|
// input_length : must be channels * 960;
|
|
// channels : must be 1 (mono) or 2 (stereo).
|
|
bool Analysis(const int16_t* input, int input_length, int channels);
|
|
|
|
// Gets the current classification : true = music, false = speech.
|
|
virtual bool is_music() const { return is_music_; }
|
|
|
|
// Gets the current music probability.
|
|
float music_probability() const { return music_probability_; }
|
|
|
|
private:
|
|
AnalysisInfo analysis_info_;
|
|
bool is_music_;
|
|
float music_probability_;
|
|
const CELTMode* celt_mode_;
|
|
TonalityAnalysisState analysis_state_;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_CLASSIFIER_H_
|