1/*
2 *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
12#define WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
13
14#include "webrtc/typedefs.h"
15
16namespace webrtc
17{
18
19struct VCMTimestampDataTuple
20{
21    uint32_t    timestamp;
22    void*             data;
23};
24
25class VCMTimestampMap
26{
27public:
28    // Constructor. Optional parameter specifies maximum number of
29    // timestamps in map.
30    VCMTimestampMap(const int32_t length = 10);
31
32    // Destructor.
33    ~VCMTimestampMap();
34
35    // Empty the map
36    void Reset();
37
38    int32_t Add(uint32_t timestamp, void*  data);
39    void* Pop(uint32_t timestamp);
40
41private:
42    bool IsEmpty() const;
43
44    VCMTimestampDataTuple* _map;
45    int32_t                   _nextAddIx;
46    int32_t                   _nextPopIx;
47    int32_t                   _length;
48};
49
50}  // namespace webrtc
51
52#endif // WEBRTC_MODULES_VIDEO_CODING_TIMESTAMP_MAP_H_
53