Apollo
11.0
自动驾驶开放平台
h265_decoder.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2019 The Apollo Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*****************************************************************************/
16
17
#pragma once
18
19
#include <vector>
20
21
extern
"C"
{
22
#include <libavcodec/avcodec.h>
23
#include <libavformat/avformat.h>
24
#include <libavutil/imgutils.h>
25
#include <libswscale/swscale.h>
26
}
27
28
namespace
apollo
{
29
namespace
drivers {
30
namespace
video {
31
36
class
H265Decoder
{
37
public
:
38
enum class
DecodingResult
{
39
SUCCESS
,
40
FATAL
,
41
WARN
,
42
};
43
44
public
:
45
H265Decoder
() =
default
;
46
47
// Init decoder by acquiring resources
48
bool
Init
();
49
50
// Process frames according to input data, and output converted data
51
DecodingResult
Process
(
const
uint8_t* indata,
const
int32_t insize,
52
std::vector<uint8_t>* outdata)
const
;
53
54
// Destructor, releasing the resources
55
~H265Decoder
() { Release(); }
56
57
// Getter of codec_ctx_h265_
58
AVCodecContext*
GetCodecCtxH265
()
const
{
return
codec_ctx_h265_; }
59
60
private
:
61
void
Release();
62
63
AVCodecContext* codec_ctx_h265_ =
nullptr
;
64
AVCodecContext* codec_ctx_jpeg_ =
nullptr
;
65
AVFrame* yuv_frame_ =
nullptr
;
66
};
67
68
}
// namespace video
69
}
// namespace drivers
70
}
// namespace apollo
apollo::drivers::video::H265Decoder
H265Decoder is a class to actually decode videos.
Definition
h265_decoder.h:36
apollo::drivers::video::H265Decoder::Process
DecodingResult Process(const uint8_t *indata, const int32_t insize, std::vector< uint8_t > *outdata) const
Definition
h265_decoder.cc:91
apollo::drivers::video::H265Decoder::H265Decoder
H265Decoder()=default
apollo::drivers::video::H265Decoder::Init
bool Init()
Definition
h265_decoder.cc:30
apollo::drivers::video::H265Decoder::~H265Decoder
~H265Decoder()
Definition
h265_decoder.h:55
apollo::drivers::video::H265Decoder::DecodingResult
DecodingResult
Definition
h265_decoder.h:38
apollo::drivers::video::H265Decoder::DecodingResult::FATAL
@ FATAL
apollo::drivers::video::H265Decoder::DecodingResult::WARN
@ WARN
apollo::drivers::video::H265Decoder::DecodingResult::SUCCESS
@ SUCCESS
apollo::drivers::video::H265Decoder::GetCodecCtxH265
AVCodecContext * GetCodecCtxH265() const
Definition
h265_decoder.h:58
apollo
class register implement
Definition
arena_queue.h:37
modules
drivers
video
tools
decode_video
h265_decoder.h