diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index d19c4b06dc..dd1b10677c 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -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) diff --git a/arch/sim/src/sim/sim_decoder.c b/arch/sim/src/sim/sim_decoder.c index c9f4f7592a..f5d61b3651 100644 --- a/arch/sim/src/sim/sim_decoder.c +++ b/arch/sim/src/sim/sim_decoder.c @@ -28,7 +28,7 @@ #include #include -#include "sim_hostdecoder.h" +#include "sim_openh264dec.h" #include "sim_internal.h" /**************************************************************************** @@ -43,13 +43,13 @@ struct sim_decoder_s { - struct host_decoder_s *decoder; - struct v4l2_format output_fmt; - struct v4l2_format capture_fmt; - struct work_s work; - void *cookie; - bool capture_on; - bool flushing; + struct openh264_decoder_s *decoder; + struct v4l2_format output_fmt; + struct v4l2_format capture_fmt; + struct work_s work; + void *cookie; + bool capture_on; + bool flushing; }; typedef struct sim_decoder_s sim_decoder_t; @@ -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,8 +407,8 @@ static int sim_decoder_process(sim_decoder_t *sim_decoder, src_buf->timestamp.tv_usec; } - ret = host_decoder_enqueue(sim_decoder->decoder, - src_data, src_pts, src_size); + ret = openh264_decoder_enqueue(sim_decoder->decoder, + src_data, src_pts, src_size); if (ret >= 0 && src_buf != NULL) { codec_output_put_buf(sim_decoder->cookie, src_buf); @@ -419,10 +419,10 @@ static int sim_decoder_process(sim_decoder_t *sim_decoder, return ret; } - ret = host_decoder_dequeue(sim_decoder->decoder, - (uint8_t *)dst_buf->m.userptr, - &dst_pts, - &dst_buf->bytesused); + ret = openh264_decoder_dequeue(sim_decoder->decoder, + (uint8_t *)dst_buf->m.userptr, + &dst_pts, + &dst_buf->bytesused); if (ret == 0 && src_buf == NULL) { sim_decoder->flushing = false; diff --git a/arch/sim/src/sim/sim_hostdecoder.c b/arch/sim/src/sim/sim_openh264dec.c similarity index 88% rename from arch/sim/src/sim/sim_hostdecoder.c rename to arch/sim/src/sim/sim_openh264dec.c index 5d2c2fcec4..ec6d96c82c 100644 --- a/arch/sim/src/sim/sim_hostdecoder.c +++ b/arch/sim/src/sim/sim_openh264dec.c @@ -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 #include -#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,8 +111,8 @@ int host_decoder_streamoff(struct host_decoder_s *decoder) return 0; } -int host_decoder_enqueue(struct host_decoder_s *decoder, - void *data, int64_t pts, int size) +int openh264_decoder_enqueue(struct openh264_decoder_s *decoder, + void *data, int64_t pts, int size) { DECODING_STATE state; @@ -166,8 +166,8 @@ int host_decoder_enqueue(struct host_decoder_s *decoder, return decoder->bufinfo.iBufferStatus; } -int host_decoder_dequeue(struct host_decoder_s *decoder, - void *data, int64_t *pts, uint32_t *size) +int openh264_decoder_dequeue(struct openh264_decoder_s *decoder, + void *data, int64_t *pts, uint32_t *size) { uint8_t *dst_addr = data; int plane; @@ -203,3 +203,4 @@ int host_decoder_dequeue(struct host_decoder_s *decoder, return decoder->remaining_frames; } + diff --git a/arch/sim/src/sim/sim_hostdecoder.h b/arch/sim/src/sim/sim_openh264dec.h similarity index 67% rename from arch/sim/src/sim/sim_hostdecoder.h rename to arch/sim/src/sim/sim_openh264dec.h index a15412ad84..adfef293c1 100644 --- a/arch/sim/src/sim/sim_hostdecoder.h +++ b/arch/sim/src/sim/sim_openh264dec.h @@ -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, - void *data, int64_t pts, int size); -int host_decoder_dequeue(struct host_decoder_s *decoder, - void *data, int64_t *pts, uint32_t *size); +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 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 */