Program Listing for File metadata-index.h

Return to documentation for file (include\metadata\metadata-index.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once

#include "stream-metadata-types/metadata-types.h"
#include "stream-metadata-parser/stream-metadata-parser.h"

#include <cstdint>
#include <map>
#include <vector>
#include <memory>

namespace gpa {
namespace serialization {

class RandomAccessSerializer;

namespace metadata {

class Keyframe;

class MetadataIndex
{
public:
    MetadataIndex(RandomAccessSerializer* serializer);
    ~MetadataIndex();

    StreamInfoHeader const* GetStreamInfoHeader() const;
    char const* GetCapturedProcessName() const;
    Keyframe const* FindKeyframe(double pointOfInterest) const;
    Keyframe const* FindKeyframe(uint64_t timestamp) const;
    Keyframe const* GetKeyframe(uint64_t index) const;
    uint64_t StartTimestamp() const;
    uint64_t EndTimestamp() const;
    int64_t StartFrameNumber() const;
    uint64_t KeyframeCount() const;
    std::vector<QueueHeader> const& GetQueues() const;

    typedef void (*EnumerateKeyframesCallback)(Keyframe*, double /*parameter*/, void*);
    void EnumerateKeyframes(EnumerateKeyframesCallback callback, void* userData);
    serialization::metadata::StreamCaptureArgsInfo const* GetStreamCaptureArgsInfo(size_t index) const;
    size_t GetStreamCaptureArgsHistoryCount() const;
    DeviceFeatureInfo const* GetDeviceFeatureInfo() const;

private:
    void DumpKeyframeDebugInfo();
    void OnReadKeyframe(std::unique_ptr<Keyframe> keyframe);

    uint64_t mStartTimestamp;
    uint64_t mEndTimestamp;
    std::unique_ptr<StreamMetadataParser> mStreamMetadataParser;
    std::map<uint64_t /*timestamp*/, std::unique_ptr<Keyframe>> mKeyframes;
    std::vector<QueueHeader> mQueues;
    std::vector<StreamCaptureArgsInfo> mStreamCaptureArgs;
};

}  // namespace metadata
}  // namespace serialization
}  // namespace gpa