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
#ifndef __RKVPU_ENC_API_H__
#define __RKVPU_ENC_API_H__
 
#include "vpu_api.h"
 
#define BUFFERFLAG_EOS 0x00000001
 
class RKHWEncApi
{
  public:
    RKHWEncApi();
    ~RKHWEncApi();
 
    typedef struct EncCfgInfo {
        int32_t width;
        int32_t height;
        int32_t format; /* input yuv format */
        int32_t IDRInterval;
        int32_t rc_mode;   /* 0 - VBR mode; 1 - CBR mode; 2 - FIXQP mode */
        int32_t bitRate;   /* target bitrate */
        int32_t framerate; /* target framerate */
        int32_t qp;        /* coding quality, from 1~51 */
    } EncCfgInfo_t;
 
    bool init(EncCfgInfo* cfg);
 
    // send video frame to encoder only, async interface
    bool sendFrame(char* data, int32_t size, int64_t pts, int32_t flag);
    bool sendFrame(int32_t fd, int32_t size, int64_t pts, int32_t flag);
    // get encoded video packet from encoder only, async interface
    bool getOutStream(EncoderOut_t* encOut);
 
  private:
    VpuCodecContext* mVpuCtx;
    unsigned char* mOutputBuf;
    unsigned char* mSpsPpsBuf;
    int32_t mSpsPpsLen;
 
    int32_t mFrameCount;
};
 
#endif // __RKVPU_ENC_API_H__