From 68a19a73681301c6712e10d55bc64324716dbd24 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期三, 09 十月 2019 15:38:47 +0800
Subject: [PATCH] split scale

---
 libcffmpeg.c |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/libcffmpeg.c b/libcffmpeg.c
index 69fcbb9..2414a16 100644
--- a/libcffmpeg.c
+++ b/libcffmpeg.c
@@ -25,8 +25,6 @@
         release_if_err(fn_destroy, lib);
         fn_run = (lib_cffmpeg_run)dlsym(lib, "c_ffmpeg_run");
         release_if_err(fn_run, lib);
-        fn_scale = (lib_cffmpeg_scale)dlsym(lib, "c_ffmpeg_scale");
-        release_if_err(fn_scale, lib);
         fn_gb28181 = (lib_cffmpeg_gb28181)dlsym(lib, "c_ffmpeg_run_gb28181");
         release_if_err(fn_gb28181, lib);
         fn_cpu = (lib_cffmpeg_cpu)dlsym(lib, "c_ffmepg_use_cpu");
@@ -52,6 +50,16 @@
         release_if_err(fn_destroy_encoder, lib);
         fn_encode = (lib_cffmpeg_encode)dlsym(lib, "c_ffmpeg_encode");
         release_if_err(fn_encode, lib);
+
+        fn_create_conv = (lib_cffmpeg_create_conv)dlsym(lib, "c_ffmpeg_create_conv");
+        release_if_err(fn_create_conv, lib);
+        fn_destroy_conv = (lib_cffmpeg_destroy_conv)dlsym(lib, "c_ffmpeg_destroy_conv");
+        release_if_err(fn_destroy_conv, lib);
+        fn_conv = (lib_cffmpeg_conv)dlsym(lib, "c_ffmpeg_conv");
+        release_if_err(fn_conv, lib);
+
+        fn_gpu_conv = (lib_gpu_conv)dlsym(lib, "c_gpu_conv");
+        release_if_err(fn_gpu_conv, lib);
 
     }else{
         printf("dlopen - %s\n", dlerror());  
@@ -81,10 +89,6 @@
     fn_run(h, input);
 }
 
-void wrap_fn_scale(const cffmpeg h, const int wid, const int hei, const int flags){
-    fn_scale(h, wid, hei, flags);
-}
-
 void wrap_fn_run_gb28181(const cffmpeg h){
     fn_gb28181(h);
 }
@@ -109,8 +113,8 @@
     fn_decoder(h);
 }
 
-void* wrap_fn_decoder_pic(const cffmpeg h, int* wid, int* hei, int64_t *id){
-    return fn_decoder_pic(h, wid, hei, id);
+void* wrap_fn_decoder_pic(const cffmpeg h, int *wid, int *hei, int *format, int *length, int64_t *id){
+    return fn_decoder_pic(h, wid, hei, format, length, id);
 }
 
 void* wrap_fn_get_avpacket(const cffmpeg h, int* size, int* key){
@@ -120,6 +124,10 @@
 // return val: -1 open error; -2, find stream error; -3, converter create error
 void* wrap_fn_decode(const char* file, const int gb, int* wid, int* hei){
     return fn_decode(file, gb, wid, hei);
+}
+
+void* wran_fn_gpu_conv(void *in, const int w, const int h, const int dst_w, const int dst_h, int *length){
+    return fn_gpu_conv(in, w, h, dst_w, dst_h, length);
 }
 
 // for encoder
@@ -141,3 +149,16 @@
     *key = 0;
     return NULL;
 }
+
+// for conv
+cconv wrap_fn_create_conv(const int srcW, const int srcH, const int srcFormat,
+                          const int dstW, const int dstH, const int flag){
+    return fn_create_conv(srcW, srcH, srcFormat, dstW, dstH, flag);
+}
+
+void wrap_fn_destroy_conv(const cconv h){
+    fn_destroy_conv(h);
+}
+void* wrap_fn_conv(const cconv h, uint8_t *in){
+    return fn_conv(h, in);
+}

--
Gitblit v1.8.0