2015-10-08 21:48:07 +00:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|
|
|
|
#define MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2015-10-14 23:12:10 +00:00
|
|
|
#include "packager/base/memory/scoped_ptr.h"
|
|
|
|
#include "packager/media/base/audio_stream_info.h"
|
2015-10-14 22:46:23 +00:00
|
|
|
#include "packager/media/formats/webm/webm_parser.h"
|
2015-10-08 21:48:07 +00:00
|
|
|
|
2015-10-14 22:46:23 +00:00
|
|
|
namespace edash_packager {
|
2015-10-08 21:48:07 +00:00
|
|
|
namespace media {
|
|
|
|
class AudioDecoderConfig;
|
|
|
|
|
2015-10-15 22:39:16 +00:00
|
|
|
/// Helper class used to parse an Audio element inside a TrackEntry element.
|
2015-10-08 21:48:07 +00:00
|
|
|
class WebMAudioClient : public WebMParserClient {
|
|
|
|
public:
|
2015-10-14 22:46:23 +00:00
|
|
|
WebMAudioClient();
|
2015-10-08 21:48:07 +00:00
|
|
|
~WebMAudioClient() override;
|
|
|
|
|
2015-10-15 22:39:16 +00:00
|
|
|
/// Reset this object's state so it can process a new audio track element.
|
2015-10-08 21:48:07 +00:00
|
|
|
void Reset();
|
|
|
|
|
2015-10-15 22:39:16 +00:00
|
|
|
/// Create an AudioStreamInfo with the data in |track_num|, |codec_id|,
|
|
|
|
/// |codec_private|, |is_encrypted| and the fields parsed from the last audio
|
|
|
|
/// track element this object was used to parse.
|
|
|
|
/// @return An AudioStreamInfo scoped_refptr if successful.
|
|
|
|
/// @return An empty scoped_refptr if there was unexpected values in the
|
|
|
|
/// provided parameters or audio track element fields.
|
2015-10-14 23:12:10 +00:00
|
|
|
scoped_refptr<AudioStreamInfo> GetAudioStreamInfo(
|
|
|
|
int64_t track_num,
|
|
|
|
const std::string& codec_id,
|
|
|
|
const std::vector<uint8_t>& codec_private,
|
|
|
|
const std::string& language,
|
|
|
|
bool is_encrypted);
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// WebMParserClient implementation.
|
2015-10-14 22:46:23 +00:00
|
|
|
bool OnUInt(int id, int64_t val) override;
|
2015-10-08 21:48:07 +00:00
|
|
|
bool OnFloat(int id, double val) override;
|
|
|
|
|
|
|
|
int channels_;
|
|
|
|
double samples_per_second_;
|
|
|
|
double output_samples_per_second_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WebMAudioClient);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
2015-10-14 22:46:23 +00:00
|
|
|
} // namespace edash_packager
|
2015-10-08 21:48:07 +00:00
|
|
|
|
|
|
|
#endif // MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|