| | |
| | | fn_run(h, input); |
| | | } |
| | | |
| | | int wrap_fn_fps(void *lib, const cffmpeg h){ |
| | | if(!fn_fps){ |
| | | fn_fps = (lib_cffmpeg_fps)dlsym(lib, "c_ffmpeg_get_fps"); |
| | | if (!fn_fps) return 25; |
| | | } |
| | | return fn_fps(h); |
| | | } |
| | | |
| | | void wrap_fn_run_gb28181(void *lib, const cffmpeg h){ |
| | | if (!fn_gb28181){ |
| | | fn_gb28181 = (lib_cffmpeg_gb28181)dlsym(lib, "c_ffmpeg_run_gb28181"); |
| | |
| | | return fn_get_avpacket(h, size, key); |
| | | } |
| | | |
| | | // return val: -1 open error; -2, find stream error; -3, converter create error |
| | | void* wrap_fn_decode(void *lib, const char* file, const int gb, int* wid, int* hei){ |
| | | if (!fn_decode){ |
| | | fn_decode = (lib_cffmpeg_decode)dlsym(lib, "c_ffmpeg_decode"); |
| | | release_if_err(fn_decode, lib); |
| | | } |
| | | return fn_decode(file, gb, wid, hei); |
| | | } |
| | | |
| | | // for encoder |
| | | cencoder wrap_fn_create_encoder(void *lib, const int w, const int h, const int fps, const int br, const int scale_flag, const int gi){ |
| | | if (!fn_create_encoder){ |
| | |
| | | |
| | | uint8_t *out = NULL; |
| | | const int flag = fn_encode(hdl, (uint8_t*)in, w, h, &out, out_size, key); |
| | | if (flag > 0 && out != NULL) { |
| | | if (flag == 0 && out != NULL) { |
| | | return out; |
| | | } |
| | | *out_size = 0; |
| | | *key = 0; |
| | | return NULL; |
| | | } |
| | | |
| | | // for conv |
| | | cconv wrap_fn_create_conv(void *lib, const int srcW, const int srcH, const int srcFormat, |
| | | const int dstW, const int dstH, const int dstFormat, const int flag){ |
| | | if (!fn_create_conv){ |
| | | fn_create_conv = (lib_cffmpeg_create_conv)dlsym(lib, "c_ffmpeg_create_conv"); |
| | | release_if_err(fn_create_conv, lib); |
| | | } |
| | | return fn_create_conv(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flag); |
| | | } |
| | | |
| | | void wrap_fn_destroy_conv(void *lib, const cconv h){ |
| | | if (!fn_destroy_conv){ |
| | | fn_destroy_conv = (lib_cffmpeg_destroy_conv)dlsym(lib, "c_ffmpeg_destroy_conv"); |
| | | if(!fn_destroy_conv) return; |
| | | } |
| | | fn_destroy_conv(h); |
| | | } |
| | | |
| | | void* wrap_fn_conv(void *lib, const cconv h, uint8_t *in){ |
| | | if (!fn_conv){ |
| | | fn_conv = (lib_cffmpeg_conv)dlsym(lib, "c_ffmpeg_conv"); |
| | | release_if_err(fn_conv, lib); |
| | | } |
| | | |
| | | return fn_conv(h, in); |
| | | } |