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.
|
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#ifndef PACKAGER_MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|
|
|
|
#define PACKAGER_MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|
2015-10-08 21:48:07 +00:00
|
|
|
|
2016-08-17 17:41:40 +00:00
|
|
|
#include <memory>
|
2015-10-08 21:48:07 +00:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
#include <packager/macros/classes.h>
|
|
|
|
#include <packager/media/base/audio_stream_info.h>
|
|
|
|
#include <packager/media/formats/webm/webm_parser.h>
|
2015-10-08 21:48:07 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
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();
|
|
|
|
|
2016-05-05 22:26:48 +00:00
|
|
|
/// Create an AudioStreamInfo with the parameters specified.
|
|
|
|
/// @param track_num indicates the track number.
|
|
|
|
/// @param codec_id is the codec identifier.
|
|
|
|
/// @param codec_private contains codec specific data.
|
|
|
|
/// @param seek_preroll indicates seek preroll in nanoseconds. A negative
|
|
|
|
/// value means that the value is not set; in this case, a default
|
|
|
|
/// value of 0 is used.
|
|
|
|
/// @param codec delay indicates codec delay in nanoseconds. A negative
|
|
|
|
/// value means that the value is not set; in this case, a default
|
|
|
|
/// value of 0 is used.
|
|
|
|
/// @param language indicates the language for the track.
|
|
|
|
/// @param is_encrypted indicates whether the stream is encrypted.
|
2017-01-24 00:55:02 +00:00
|
|
|
/// @return An AudioStreamInfo if successful.
|
|
|
|
/// @return An empty pointer if there was unexpected values in the
|
2015-10-15 22:39:16 +00:00
|
|
|
/// provided parameters or audio track element fields.
|
2017-01-24 00:55:02 +00:00
|
|
|
std::shared_ptr<AudioStreamInfo> GetAudioStreamInfo(
|
2015-10-14 23:12:10 +00:00
|
|
|
int64_t track_num,
|
|
|
|
const std::string& codec_id,
|
|
|
|
const std::vector<uint8_t>& codec_private,
|
2016-05-05 22:26:48 +00:00
|
|
|
int64_t seek_preroll,
|
|
|
|
int64_t codec_delay,
|
2015-10-14 23:12:10 +00:00
|
|
|
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
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-10-08 21:48:07 +00:00
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#endif // PACKAGER_MEDIA_FORMATS_WEBM_WEBM_AUDIO_CLIENT_H_
|