hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2019 Fuzhou Rockchip Electronics Co., Ltd. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
#ifndef EASYMEDIA_MPP_DECODER_H
#define EASYMEDIA_MPP_DECODER_H
 
#include "decoder.h"
#include "mpp_inc.h"
 
namespace easymedia
{
 
    // A hw video decoder which call the mpp interface directly.
    class MPPDecoder : public VideoDecoder
    {
      public:
        MPPDecoder(const char* param);
        virtual ~MPPDecoder() = default;
        static const char* GetCodecName()
        {
            return "rkmpp";
        }
 
        virtual bool Init() override;
        virtual int Process(const std::shared_ptr<MediaBuffer>& input, std::shared_ptr<MediaBuffer>& output,
                            std::shared_ptr<MediaBuffer> extra_output) override;
        virtual int SendInput(const std::shared_ptr<MediaBuffer>& input) override;
        virtual std::shared_ptr<MediaBuffer> FetchOutput() override;
 
      private:
        PixelFormat output_format;
        RK_S32 fg_limit_num;
        RK_U32 need_split;
        MppPollType timeout;
        MppCodingType coding_type;
        std::shared_ptr<MPPContext> mpp_ctx;
        bool support_sync;
        bool support_async;
        static const RK_S32 kFRAMEGROUP_MAX_FRAMES = 16;
    };
 
} // namespace easymedia
 
#endif // EASYMEDIA_MPP_DECODER_H