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
21extern "C" {
22#include <libavcodec/avcodec.h>
23#include <libavformat/avformat.h>
24#include <libavutil/imgutils.h>
25#include <libswscale/swscale.h>
26}
27
28namespace apollo {
29namespace drivers {
30namespace video {
31
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
H265Decoder is a class to actually decode videos.
DecodingResult Process(const uint8_t *indata, const int32_t insize, std::vector< uint8_t > *outdata) const
AVCodecContext * GetCodecCtxH265() const
class register implement
Definition arena_queue.h:37