| | |
| | | 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){ |
| | |
| | | *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); |
| | | } |