DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs
opus_packet_builder.h
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef MEDIA_FORMATS_WEBM_OPUS_PACKET_BUILDER_H_
6 #define MEDIA_FORMATS_WEBM_OPUS_PACKET_BUILDER_H_
7 
8 #include <vector>
9 
10 #include "packager/base/memory/scoped_ptr.h"
11 #include "packager/base/memory/scoped_vector.h"
12 
13 namespace edash_packager {
14 namespace media {
15 
16 // From Opus RFC. See https://tools.ietf.org/html/rfc6716#page-14
17 enum OpusConstants {
18  kNumPossibleOpusConfigs = 32,
19  kMinOpusPacketFrameCount = 1,
20  kMaxOpusPacketFrameCount = 48
21 };
22 
23 class OpusPacket {
24  public:
25  OpusPacket(uint8_t config, uint8_t frame_count, bool is_VBR);
26  ~OpusPacket();
27 
28  const uint8_t* data() const;
29  int size() const;
30  double duration_ms() const;
31 
32  private:
33  std::vector<uint8_t> data_;
34  double duration_ms_;
35 
36  DISALLOW_COPY_AND_ASSIGN(OpusPacket);
37 };
38 
39 // Builds an exhaustive collection of Opus packet configurations.
40 ScopedVector<OpusPacket> BuildAllOpusPackets();
41 
42 } // namespace media
43 } // namespace edash_packager
44 
45 #endif // MEDIA_FORMATS_WEBM_OPUS_PACKET_BUILDER_H_