From 01d9022b47e5e20f39ca1115d334c43774378dfc Mon Sep 17 00:00:00 2001 From: zhangmeng <zhangmeng@aiiot.com> Date: 星期三, 25 三月 2020 13:56:16 +0800 Subject: [PATCH] add log for local video --- libcffmpeg.c | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libcffmpeg.c b/libcffmpeg.c index cbdc727..87ac547 100644 --- a/libcffmpeg.c +++ b/libcffmpeg.c @@ -122,18 +122,18 @@ fn_rec_duration(h, min, max); } -void wrap_fn_fire_recorder(void *lib, const cffmpeg h, const char* sid, const int64_t id){ +int wrap_fn_fire_recorder(void *lib, const cffmpeg h, const char* sid, const int64_t id){ if (!fn_fire_recorder){ fn_fire_recorder = (lib_cffmpeg_fire_recorder)dlsym(lib, "c_ffmpeg_fire_recorder"); - if (!fn_fire_recorder) return; + if (!fn_fire_recorder) return -1; } - fn_fire_recorder(h, sid, id); + return fn_fire_recorder(h, sid, id); } -void wrap_fn_info_recorder(void *lib, const cffmpeg h, int* index, char** recid, int* recidLen, char** fpath, int* pathLen){ +int wrap_fn_info_recorder(void *lib, const cffmpeg h, int* index, char** recid, int* recidLen, char** fpath, int* pathLen){ if (!fn_info_recorder){ fn_info_recorder = (lib_cffmpeg_info_recorder)dlsym(lib, "c_ffmpeg_get_info_recorder"); - if (!fn_info_recorder) return; + if (!fn_info_recorder) return -1; } return fn_info_recorder(h, index, recid, recidLen, fpath, pathLen); } @@ -146,12 +146,12 @@ fn_decoder(h); } -void* wrap_fn_decoder_pic(void *lib, const cffmpeg h, int *wid, int *hei, int *format, int *length, int64_t *id){ +int wrap_fn_decoder_pic(void *lib, const cffmpeg h, unsigned char** data, int *wid, int *hei, int *format, int *length, int64_t *id){ if (!fn_decoder_pic){ fn_decoder_pic = (lib_cffmpeg_pic)dlsym(lib, "c_ffmpeg_get_pic_decoder"); - release_if_err(fn_decoder_pic, lib); + if (!fn_decoder_pic) return -1; } - return fn_decoder_pic(h, wid, hei, format, length, id); + return fn_decoder_pic(h, data, wid, hei, format, length, id); } void wrap_fn_close_stream(void *lib, const cffmpeg h){ @@ -170,6 +170,13 @@ return fn_get_avpacket(h, size, key); } +int wrap_fn_get_avpacket2(void *lib, const cffmpeg h, unsigned char **data, int* size, int* key){ + if(!fn_get_avpacket2){ + fn_get_avpacket2 = (lib_cffmpeg_avpacket2)dlsym(lib, "c_ffmpeg_get_avpacket2"); + if (!fn_get_avpacket2) return -1; + } + return fn_get_avpacket2(h, data, size, key); +} // for encoder cencoder wrap_fn_create_encoder(void *lib, const int w, const int h, const int fps, const int br, const int pix_fmt, const int scale_flag, const int gi){ if (!fn_create_encoder){ -- Gitblit v1.8.0