Program Listing for File stream-data.h

Return to documentation for file (include\playback\stream-data.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 "playback/callable.h"
#include "playback/stream-data-bookmark.h"

#include <cstddef>
#include <vector>
#include <string>

namespace gpa {

namespace serialization {
namespace metadata {
class MetadataIndex;
class Keyframe;
struct StreamInfoHeader;
struct QueueHeader;
struct StreamCaptureArgsInfo;
struct DeviceFeatureInfo;
}  // namespace metadata

class Stream;
class RandomAccessSerializer;

}  // namespace serialization

namespace memory {
class Allocator;
}

namespace playback {

class StoragePacketReader;
class StoragePacketDeserializer;

class StreamData
{
public:
    StreamData(serialization::Stream* stream, memory::Allocator* allocator = nullptr);
    ~StreamData();

    Callable Current() const;
    bool MoveNext();
    Callable MoveTo(uint64_t threadId, uint64_t offset) const;
    Callable Next();
    Callable Next(uint64_t threadId);
    Callable At(uint64_t threadId, uint64_t offset) const;
    void Reset();

    uint64_t StartTimestamp() const;
    uint64_t EndTimestamp() const;
    int64_t StartFrameNumber() const;
    double GetNormalizedCoordinate(uint64_t timestamp) const;

    StreamDataBookmark CreateBookmark() const;
    void ApplyBookmark(StreamDataBookmark const& bookmark);
    serialization::Stream* GetStream() const;
    serialization::metadata::Keyframe const* FindKeyframeForNormalizedOffset(double offset) const;
    serialization::metadata::Keyframe const* FindDeferredCaptureKeyframe() const;
    serialization::metadata::Keyframe const* FindMandatoryInitialKeyframe() const;
    serialization::metadata::Keyframe const* GetKeyframe(uint64_t index) const;
    serialization::metadata::StreamInfoHeader* GetStreamInfoHeader() const;
    uint64_t GetKeyframeCount(bool includeDeferred) const;
    std::vector<serialization::metadata::QueueHeader> const& GetQueuesMetadata() const;
    char const* GetCapturedProcessName() const;
    serialization::metadata::StreamCaptureArgsInfo const* GetStreamCaptureArgInfo(size_t index) const;
    size_t GetStreamCaptureHistoryCount() const;
    serialization::metadata::DeviceFeatureInfo* GetDeviceFeatureInfo() const;

private:
    gpa::serialization::Stream* mStream;
    memory::Allocator* mAllocator;
    std::vector<StoragePacketReader*> mPacketReaders;
    StoragePacketDeserializer* mPacketDeserializer;
    serialization::RandomAccessSerializer* mMetadataSerializer;
    serialization::metadata::MetadataIndex* mMetadataIndex;

    StreamData(StreamData const&) = delete;
    StreamData& operator=(StreamData const&) = delete;
};

}  // namespace playback
}  // namespace gpa