v4l2m2m/sim decoder: rename hostdecoder to openh264dec

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
This commit is contained in:
shizhenghui 2024-07-02 20:41:39 +08:00 committed by Alan Carvalho de Assis
parent 622babc6c9
commit 3675cfe585
4 changed files with 47 additions and 47 deletions

View File

@ -251,9 +251,8 @@ ifeq ($(CONFIG_SIM_CAMERA_V4L2),y)
endif
ifeq ($(CONFIG_SIM_VIDEO_DECODER),y)
HOSTSRCS += sim_hostdecoder.c
CSRCS += sim_decoder.c
STDLIBS += -lopenh264
CSRCS += sim_openh264dec.c
endif
ifeq ($(CONFIG_SIM_VIDEO_ENCODER),y)

View File

@ -28,7 +28,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/video/v4l2_m2m.h>
#include "sim_hostdecoder.h"
#include "sim_openh264dec.h"
#include "sim_internal.h"
/****************************************************************************
@ -43,7 +43,7 @@
struct sim_decoder_s
{
struct host_decoder_s *decoder;
struct openh264_decoder_s *decoder;
struct v4l2_format output_fmt;
struct v4l2_format capture_fmt;
struct work_s work;
@ -133,7 +133,7 @@ static struct codec_s g_sim_codec_decoder =
static int sim_decoder_open(void *cookie, void **priv)
{
sim_decoder_t *sim_decoder;
struct host_decoder_s *decoder;
struct openh264_decoder_s *decoder;
sim_decoder = kmm_zalloc(sizeof(sim_decoder_t));
if (sim_decoder == NULL)
@ -141,7 +141,7 @@ static int sim_decoder_open(void *cookie, void **priv)
return -ENOMEM;
}
decoder = host_decoder_open();
decoder = openh264_decoder_open();
if (decoder == NULL)
{
kmm_free(sim_decoder);
@ -159,7 +159,7 @@ static int sim_decoder_close(void *priv)
{
sim_decoder_t *sim_decoder = priv;
host_decoder_close(sim_decoder->decoder);
openh264_decoder_close(sim_decoder->decoder);
kmm_free(sim_decoder);
return 0;
@ -180,7 +180,7 @@ static int sim_decoder_output_streamon(void *priv)
{
sim_decoder_t *sim_decoder = priv;
return host_decoder_streamon(sim_decoder->decoder);
return openh264_decoder_streamon(sim_decoder->decoder);
}
static int sim_decoder_capture_streamoff(void *priv)
@ -188,7 +188,7 @@ static int sim_decoder_capture_streamoff(void *priv)
sim_decoder_t *sim_decoder = priv;
sim_decoder->capture_on = false;
return host_decoder_streamoff(sim_decoder->decoder);
return openh264_decoder_streamoff(sim_decoder->decoder);
}
static int sim_decoder_output_streamoff(void *priv)
@ -407,7 +407,7 @@ static int sim_decoder_process(sim_decoder_t *sim_decoder,
src_buf->timestamp.tv_usec;
}
ret = host_decoder_enqueue(sim_decoder->decoder,
ret = openh264_decoder_enqueue(sim_decoder->decoder,
src_data, src_pts, src_size);
if (ret >= 0 && src_buf != NULL)
{
@ -419,7 +419,7 @@ static int sim_decoder_process(sim_decoder_t *sim_decoder,
return ret;
}
ret = host_decoder_dequeue(sim_decoder->decoder,
ret = openh264_decoder_dequeue(sim_decoder->decoder,
(uint8_t *)dst_buf->m.userptr,
&dst_pts,
&dst_buf->bytesused);

View File

@ -1,5 +1,5 @@
/****************************************************************************
* arch/sim/src/sim/sim_hostdecoder.c
* arch/sim/src/sim/sim_openh264dec.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -30,13 +30,13 @@
#include <wels/codec_api.h>
#include <wels/codec_app_def.h>
#include "sim_hostdecoder.h"
#include "sim_openh264dec.h"
/****************************************************************************
* Private Types
****************************************************************************/
struct host_decoder_s
struct openh264_decoder_s
{
ISVCDecoder *dec;
SBufferInfo bufinfo;
@ -52,11 +52,11 @@ struct host_decoder_s
* Public Functions
****************************************************************************/
struct host_decoder_s *host_decoder_open(void)
struct openh264_decoder_s *openh264_decoder_open(void)
{
struct host_decoder_s *decoder;
struct openh264_decoder_s *decoder;
decoder = calloc(1, sizeof(struct host_decoder_s));
decoder = calloc(1, sizeof(struct openh264_decoder_s));
if (decoder == NULL)
{
syslog(LOG_ERR, "Init host decoder failed\n");
@ -65,13 +65,13 @@ struct host_decoder_s *host_decoder_open(void)
return decoder;
}
int host_decoder_close(struct host_decoder_s *decoder)
int openh264_decoder_close(struct openh264_decoder_s *decoder)
{
free(decoder);
return 0;
}
int host_decoder_streamon(struct host_decoder_s *decoder)
int openh264_decoder_streamon(struct openh264_decoder_s *decoder)
{
SDecodingParam param;
int level = WELS_LOG_RESV;
@ -102,7 +102,7 @@ int host_decoder_streamon(struct host_decoder_s *decoder)
return ret;
}
int host_decoder_streamoff(struct host_decoder_s *decoder)
int openh264_decoder_streamoff(struct openh264_decoder_s *decoder)
{
(*decoder->dec)->Uninitialize(decoder->dec);
WelsDestroyDecoder(decoder->dec);
@ -111,7 +111,7 @@ int host_decoder_streamoff(struct host_decoder_s *decoder)
return 0;
}
int host_decoder_enqueue(struct host_decoder_s *decoder,
int openh264_decoder_enqueue(struct openh264_decoder_s *decoder,
void *data, int64_t pts, int size)
{
DECODING_STATE state;
@ -166,7 +166,7 @@ int host_decoder_enqueue(struct host_decoder_s *decoder,
return decoder->bufinfo.iBufferStatus;
}
int host_decoder_dequeue(struct host_decoder_s *decoder,
int openh264_decoder_dequeue(struct openh264_decoder_s *decoder,
void *data, int64_t *pts, uint32_t *size)
{
uint8_t *dst_addr = data;
@ -203,3 +203,4 @@ int host_decoder_dequeue(struct host_decoder_s *decoder,
return decoder->remaining_frames;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* arch/sim/src/sim/sim_hostdecoder.h
* arch/sim/src/sim/sim_openh264dec.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -18,8 +18,8 @@
*
****************************************************************************/
#ifndef __ARCH_SIM_SRC_SIM_SIM_HOSTDECODER_H
#define __ARCH_SIM_SRC_SIM_SIM_HOSTDECODER_H
#ifndef __ARCH_SIM_SRC_SIM_SIM_OPENH264DEC_H
#define __ARCH_SIM_SRC_SIM_SIM_OPENH264DEC_H
/****************************************************************************
* Included Files
@ -31,20 +31,20 @@
* Public Types
****************************************************************************/
struct host_decoder_s;
struct openh264_decoder_s;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
struct host_decoder_s *host_decoder_open(void);
int host_decoder_close(struct host_decoder_s *decoder);
int host_decoder_streamon(struct host_decoder_s *decoder);
int host_decoder_streamoff(struct host_decoder_s *decoder);
int host_decoder_enqueue(struct host_decoder_s *decoder,
struct openh264_decoder_s *openh264_decoder_open(void);
int openh264_decoder_close(struct openh264_decoder_s *decoder);
int openh264_decoder_streamon(struct openh264_decoder_s *decoder);
int openh264_decoder_streamoff(struct openh264_decoder_s *decoder);
int openh264_decoder_enqueue(struct openh264_decoder_s *decoder,
void *data, int64_t pts, int size);
int host_decoder_dequeue(struct host_decoder_s *decoder,
int openh264_decoder_dequeue(struct openh264_decoder_s *decoder,
void *data, int64_t *pts, uint32_t *size);
#endif /* __ARCH_SIM_SRC_SIM_SIM_HOSTDECODER_H */
#endif /* __ARCH_SIM_SRC_SIM_SIM_OPENH264DEC_H */