Files
rocm-systems/src/parser/parser_buffer.h
T
Lakshmi Kumar 4ca0d02bb0 HEVC Parser (#9)
* basic parser create

* adding data_stream

* buildable parser

* query output and required fucntions

* latest changes

* alloc buffer and other functions

* parses first frame

* parser finds all frames

* parser dump size correct - dump file included

* clean up

* merge conflicts and file restructure

* uses updated video demuxer

* undoing changes to sample app

* cleaning code

* cleaning code

* removing dwarf flag from compile

* formatting changes

* change variable names as per google standard

* struct naming convention

* struct name

* remove parser data class and combine into parser buffer

* remove context class and clean up

* remove log file and use commons

* move class to .h file

* removing unused functions

* removes platform.h

* removing datastream class

* formatting

* remove byte_array, rename enums

* clean up

* spacing

* rearrange to fit master

* removes bit_strea_parser class, combines common stuff to roc_video_parser file
2023-10-05 11:20:07 -04:00

69 lines
2.3 KiB
C++

/*
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef PARSERBUFFER_H
#define PARSERBUFFER_H
#pragma once
#include <cstdint>
#include <cstring>
#include <memory>
#include <ctime>
#include <chrono>
#include "roc_video_parser.h"
typedef enum ParserMemoryType {
PARSER_MEMORY_UNKNOWN = 0,
PARSER_MEMORY_HOST = 1,
PARSER_MEMORY_HIP = 2,
} ParserMemoryType;
class ParserBuffer {
public:
ParserBuffer();
virtual ~ParserBuffer();
virtual ParserResult SetSize(size_t new_size);
virtual size_t GetSize();
virtual void* GetNative();
virtual void SetNative(size_t size);
//parser data functions
virtual bool IsReusable();
virtual void SetPts(int64_t pts);
virtual int64_t GetPts() const;
virtual void SetDuration(int64_t duration);
virtual int64_t GetDuration() const;
static ParserResult AllocBuffer(ParserMemoryType type, size_t size, ParserBuffer** pp_buffer);
private:
int64_t m_current_timestamp_;
int64_t m_duration_;
size_t m_packet_size_;
uint8_t* m_buffer_;
};
// smart pointer
typedef std::shared_ptr<ParserBuffer> ParserBufferPtr;
#endif // PARSERBUFFER_H