31 #include <libmediaprocsutils/log.h> 32 #include <libmediaprocsutils/stat_codes.h> 33 #include <libmediaprocsutils/check_utils.h> 34 #include <libmediaprocsutils/mem_utils.h> 55 register int i, data_size, end_code= STAT_ERROR;
60 CHECK_DO(proc_frame_ctx_arg!= NULL,
return NULL);
63 CHECK_DO(proc_frame_ctx!= NULL,
goto end);
69 for(i= 0, data_size= 0; i< PROC_FRAME_NUM_DATA_POINTERS; i++) {
70 register int lsize_src, lsize_dst, width, height;
71 const uint8_t *p_data_src= proc_frame_ctx_arg->
p_data[i];
75 lsize_src= proc_frame_ctx_arg->
linesize[i];
77 width= proc_frame_ctx_arg->
width[i];
78 height= proc_frame_ctx_arg->
height[i];
82 CHECK_DO(lsize_src>= width && lsize_dst>= lsize_src,
goto end);
83 data_size+= lsize_dst* height;
84 proc_frame_ctx->
linesize[i]= lsize_dst;
85 proc_frame_ctx->
width[i]= width;
86 proc_frame_ctx->
height[i]= height;
92 for(i= 0, data_size= 0; i< PROC_FRAME_NUM_DATA_POINTERS; i++) {
93 register int l, lsize_src, lsize, width, height;
94 const uint8_t *p_data_dst;
95 const uint8_t *p_data_src= proc_frame_ctx_arg->
p_data[i];
99 lsize_src= proc_frame_ctx_arg->
linesize[i];
101 width= proc_frame_ctx->
width[i];
102 height= proc_frame_ctx->
height[i];
103 proc_frame_ctx->
p_data[i]= p_data_dst= proc_frame_ctx->
data+ data_size;
104 data_size+= lsize* height;
106 for(l= 0; l< height; l++)
107 memcpy((
void*)&p_data_dst[l* lsize], &p_data_src[l* lsize_src],
114 proc_frame_ctx->
pts= proc_frame_ctx_arg->
pts;
115 proc_frame_ctx->
dts= proc_frame_ctx_arg->
dts;
116 proc_frame_ctx->
es_id= proc_frame_ctx_arg->
es_id;
118 end_code= STAT_SUCCESS;
120 if(end_code!= STAT_SUCCESS)
122 return proc_frame_ctx;
129 if(ref_proc_frame_ctx== NULL ||
130 (proc_frame_ctx= *ref_proc_frame_ctx)== NULL)
133 if(proc_frame_ctx->
data!= NULL) {
134 free(proc_frame_ctx->
data);
135 proc_frame_ctx->
data= NULL;
138 free(proc_frame_ctx);
139 *ref_proc_frame_ctx= NULL;
149 int end_code= STAT_ERROR;
154 CHECK_DO(proc_if_arg!= NULL,
return NULL);
164 memcpy(proc_if, proc_if_arg,
sizeof(
proc_if_t));
180 end_code= STAT_SUCCESS;
182 if(end_code!= STAT_SUCCESS)
193 CHECK_DO(proc_if1!= NULL,
return 1);
194 CHECK_DO(proc_if2!= NULL,
return 1);
213 if(proc_if1->
opt!= proc_if2->
opt)
236 if(ref_proc_if== NULL)
239 if((proc_if= *ref_proc_if)!= NULL) {
size_t width[PROC_FRAME_NUM_DATA_POINTERS]
void(* iput_fifo_elem_opaque_release)(void **ref_t)
void proc_frame_ctx_release(proc_frame_ctx_t **ref_proc_frame_ctx)
#define EXTEND_SIZE_TO_MULTIPLE(SIZE, MULTIPLE)
int linesize[PROC_FRAME_NUM_DATA_POINTERS]
proc_ctx_t *(* open)(const proc_if_t *proc_if, const char *settings_str, log_ctx_t *log_ctx, va_list arg)
void proc_if_release(proc_if_t **ref_proc_if)
int(* process_frame)(proc_ctx_t *proc_ctx, fifo_ctx_t *fifo_ctx_iput, fifo_ctx_t *fifo_ctx_oput)
int(* opt)(proc_ctx_t *proc_ctx, const char *tag, va_list arg)
proc_if_t * proc_if_dup(const proc_if_t *proc_if_arg)
#define CHECK_DO(COND, ACTION)
Planar YUV 4:2:0 with 12bpp (video)
proc_frame_ctx_t * proc_frame_ctx_allocate()
const proc_sample_fmt_lut_t proc_sample_fmt_lut[]
void(* close)(proc_ctx_t **ref_proc_ctx)
#define PROC_FRAME_MAX_HEIGHT
#define PROC_FRAME_MAX_WIDTH
int proc_if_cmp(const proc_if_t *proc_if1, const proc_if_t *proc_if2)
proc_if_t * proc_if_allocate()
Planar signed 16 bits (typically audio)
proc_frame_ctx_t * proc_frame_ctx_dup(const proc_frame_ctx_t *proc_frame_ctx_arg)
void *(* iput_fifo_elem_opaque_dup)(const proc_frame_ctx_t *proc_frame_ctx)
size_t height[PROC_FRAME_NUM_DATA_POINTERS]
Interleaved signed 16 bits (typically audio)
PROC interface prototype related definitions and functions.
const uint8_t * p_data[PROC_FRAME_NUM_DATA_POINTERS]
int(* rest_get)(proc_ctx_t *proc_ctx, const proc_if_rest_fmt_t rest_fmt, void **ref_reponse)
proc_frame_ctx_t *(* oput_fifo_elem_opaque_dup)(const void *t)
int(* rest_put)(proc_ctx_t *proc_ctx, const char *str)