[vlc-commits] mmal: move the converter in its own plugin

Steve Lhomme git at videolan.org
Fri Jan 24 14:15:54 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 24 13:39:44 2020 +0100| [5bd945c984d88fd4669e776432c40ab429536725] | committer: Steve Lhomme

mmal: move the converter in its own plugin

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5bd945c984d88fd4669e776432c40ab429536725
---

 modules/hw/mmal/Makefile.am    |  9 ++++++-
 modules/hw/mmal/codec.c        | 18 -------------
 modules/hw/mmal/converter.c    | 58 ++++++++++++++++++++++++++++++++++++++++++
 modules/hw/mmal/mmal_picture.c | 33 ------------------------
 modules/hw/mmal/mmal_picture.h |  8 ------
 5 files changed, 66 insertions(+), 60 deletions(-)

diff --git a/modules/hw/mmal/Makefile.am b/modules/hw/mmal/Makefile.am
index 44be760053..023adb774a 100644
--- a/modules/hw/mmal/Makefile.am
+++ b/modules/hw/mmal/Makefile.am
@@ -11,13 +11,20 @@ libmmal_vout_plugin_la_LDFLAGS = $(AM_LDFLAGS) -lm
 libmmal_vout_plugin_la_LIBADD = $(LIBS_mmal)
 mmal_LTLIBRARIES = libmmal_vout_plugin.la
 
-libmmal_codec_plugin_la_SOURCES = codec.c converter.c subpic.c subpic.h mmal_picture.c mmal_picture.h \
+libmmal_codec_plugin_la_SOURCES = codec.c subpic.c subpic.h mmal_picture.c mmal_picture.h \
   mmal_cma.c mmal_cma.h
 libmmal_codec_plugin_la_CFLAGS = $(AM_CFLAGS)
 libmmal_codec_plugin_la_LDFLAGS = $(AM_LDFLAGS)
 libmmal_codec_plugin_la_LIBADD = $(LIBS_mmal)
 mmal_LTLIBRARIES += libmmal_codec_plugin.la
 
+libmmal_converter_plugin_la_SOURCES = converter.c subpic.c subpic.h mmal_picture.c mmal_picture.h \
+  mmal_cma.c mmal_cma.h
+libmmal_converter_plugin_la_CFLAGS = $(AM_CFLAGS)
+libmmal_converter_plugin_la_LDFLAGS = $(AM_LDFLAGS)
+libmmal_converter_plugin_la_LIBADD = $(LIBS_mmal)
+mmal_LTLIBRARIES += libmmal_converter_plugin.la
+
 libmmal_deinterlace_plugin_la_SOURCES = deinterlace.c mmal_picture.c mmal_picture.h \
   mmal_cma.c mmal_cma.h
 libmmal_deinterlace_plugin_la_CFLAGS = $(AM_CFLAGS)
diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index d03533d4cf..ac9ec15316 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -31,7 +31,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_codec.h>
-#include <vlc_filter.h>
 
 #include <interface/mmal/mmal.h>
 #include <interface/mmal/util/mmal_util.h>
@@ -45,12 +44,6 @@
 #define NUM_EXTRA_BUFFERS 5
 //#define NUM_EXTRA_BUFFERS 10
 
-#define MMAL_RESIZE_TEXT N_("Use mmal resizer rather than hvs.")
-#define MMAL_RESIZE_LONGTEXT N_("Use mmal resizer rather than isp. This uses less gpu memory than the ISP but is slower.")
-
-#define MMAL_ISP_TEXT N_("Use mmal isp rather than hvs.")
-#define MMAL_ISP_LONGTEXT N_("Use mmal isp rather than Hardware Video Scaler. This may be faster but has no blend.")
-
 static int OpenDecoder(vlc_object_t *);
 static void CloseDecoder(vlc_object_t *);
 
@@ -63,17 +56,6 @@ vlc_module_begin()
     add_shortcut("mmal_decoder")
     add_obsolete_bool("mmal-opaque")
     set_callbacks(OpenDecoder, CloseDecoder)
-
-    add_submodule()
-    set_category( CAT_VIDEO )
-    set_subcategory( SUBCAT_VIDEO_VFILTER )
-    set_shortname(N_("MMAL resizer"))
-    set_description(N_("MMAL resizing conversion filter"))
-    add_shortcut("mmal_converter")
-    set_capability( "video converter", 900 )
-    add_bool(MMAL_RESIZE_NAME, /* default */ false, MMAL_RESIZE_TEXT, MMAL_RESIZE_LONGTEXT, /* advanced option */ false)
-    add_bool(MMAL_ISP_NAME, /* default */ false, MMAL_ISP_TEXT, MMAL_ISP_LONGTEXT, /* advanced option */ false)
-    set_callbacks(OpenConverter, CloseConverter)
 vlc_module_end()
 
 typedef struct
diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index 74cbda4fd2..c57474cd10 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -31,6 +31,7 @@
 #include <vlc_common.h>
 #include <vlc_codec.h>
 #include <vlc_filter.h>
+#include <vlc_plugin.h>
 
 #include <interface/mmal/mmal.h>
 #include <interface/mmal/util/mmal_util.h>
@@ -40,10 +41,67 @@
 
 #include "subpic.h"
 
+#define MMAL_RESIZE_NAME "mmal-resize"
+#define MMAL_RESIZE_TEXT N_("Use mmal resizer rather than hvs.")
+#define MMAL_RESIZE_LONGTEXT N_("Use mmal resizer rather than isp. This uses less gpu memory than the ISP but is slower.")
+
+#define MMAL_ISP_NAME    "mmal-isp"
+#define MMAL_ISP_TEXT N_("Use mmal isp rather than hvs.")
+#define MMAL_ISP_LONGTEXT N_("Use mmal isp rather than Hardware Video Scaler. This may be faster but has no blend.")
+
+int OpenConverter(vlc_object_t *);
+void CloseConverter(vlc_object_t *);
+
+vlc_module_begin()
+    add_submodule()
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VFILTER )
+    set_shortname(N_("MMAL resizer"))
+    set_description(N_("MMAL resizing conversion filter"))
+    add_shortcut("mmal_converter")
+    set_capability( "video converter", 900 )
+    add_bool(MMAL_RESIZE_NAME, /* default */ false, MMAL_RESIZE_TEXT, MMAL_RESIZE_LONGTEXT, /* advanced option */ false)
+    add_bool(MMAL_ISP_NAME, /* default */ false, MMAL_ISP_TEXT, MMAL_ISP_LONGTEXT, /* advanced option */ false)
+    set_callbacks(OpenConverter, CloseConverter)
+vlc_module_end()
+
 #define MMAL_SLICE_HEIGHT 16
 
 #define CONV_MAX_LATENCY 1  // In frames
 
+static MMAL_FOURCC_T pic_to_slice_mmal_fourcc(MMAL_FOURCC_T fcc)
+{
+    switch (fcc){
+    case MMAL_ENCODING_I420:
+        return MMAL_ENCODING_I420_SLICE;
+    case MMAL_ENCODING_I422:
+        return MMAL_ENCODING_I422_SLICE;
+    case MMAL_ENCODING_ARGB:
+        return MMAL_ENCODING_ARGB_SLICE;
+    case MMAL_ENCODING_RGBA:
+        return MMAL_ENCODING_RGBA_SLICE;
+    case MMAL_ENCODING_ABGR:
+        return MMAL_ENCODING_ABGR_SLICE;
+    case MMAL_ENCODING_BGRA:
+        return MMAL_ENCODING_BGRA_SLICE;
+    case MMAL_ENCODING_RGB16:
+        return MMAL_ENCODING_RGB16_SLICE;
+    case MMAL_ENCODING_RGB24:
+        return MMAL_ENCODING_RGB24_SLICE;
+    case MMAL_ENCODING_RGB32:
+        return MMAL_ENCODING_RGB32_SLICE;
+    case MMAL_ENCODING_BGR16:
+        return MMAL_ENCODING_BGR16_SLICE;
+    case MMAL_ENCODING_BGR24:
+        return MMAL_ENCODING_BGR24_SLICE;
+    case MMAL_ENCODING_BGR32:
+        return MMAL_ENCODING_BGR32_SLICE;
+    default:
+        break;
+    }
+    return 0;
+}
+
 typedef struct pic_fifo_s {
     picture_t * head;
     picture_t * tail;
diff --git a/modules/hw/mmal/mmal_picture.c b/modules/hw/mmal/mmal_picture.c
index 0fe7f4ee18..0d8af70f74 100644
--- a/modules/hw/mmal/mmal_picture.c
+++ b/modules/hw/mmal/mmal_picture.c
@@ -1206,36 +1206,3 @@ vzc_pool_ctl_t * hw_mmal_vzc_pool_new(bool is_cma)
 bool rpi_is_model_pi4(void) {
     return bcm_host_is_model_pi4();
 }
-
-MMAL_FOURCC_T pic_to_slice_mmal_fourcc(MMAL_FOURCC_T fcc)
-{
-    switch (fcc){
-    case MMAL_ENCODING_I420:
-        return MMAL_ENCODING_I420_SLICE;
-    case MMAL_ENCODING_I422:
-        return MMAL_ENCODING_I422_SLICE;
-    case MMAL_ENCODING_ARGB:
-        return MMAL_ENCODING_ARGB_SLICE;
-    case MMAL_ENCODING_RGBA:
-        return MMAL_ENCODING_RGBA_SLICE;
-    case MMAL_ENCODING_ABGR:
-        return MMAL_ENCODING_ABGR_SLICE;
-    case MMAL_ENCODING_BGRA:
-        return MMAL_ENCODING_BGRA_SLICE;
-    case MMAL_ENCODING_RGB16:
-        return MMAL_ENCODING_RGB16_SLICE;
-    case MMAL_ENCODING_RGB24:
-        return MMAL_ENCODING_RGB24_SLICE;
-    case MMAL_ENCODING_RGB32:
-        return MMAL_ENCODING_RGB32_SLICE;
-    case MMAL_ENCODING_BGR16:
-        return MMAL_ENCODING_BGR16_SLICE;
-    case MMAL_ENCODING_BGR24:
-        return MMAL_ENCODING_BGR24_SLICE;
-    case MMAL_ENCODING_BGR32:
-        return MMAL_ENCODING_BGR32_SLICE;
-    default:
-        break;
-    }
-    return 0;
-}
\ No newline at end of file
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index e53e1491da..dc79db004a 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -156,16 +156,8 @@ vzc_pool_ctl_t * hw_mmal_vzc_pool_new(bool is_cma);
 
 #define NUM_DECODER_BUFFER_HEADERS 30
 
-MMAL_FOURCC_T pic_to_slice_mmal_fourcc(MMAL_FOURCC_T);
-
 bool rpi_is_model_pi4(void);
 
-#define MMAL_RESIZE_NAME "mmal-resize"
-#define MMAL_ISP_NAME    "mmal-isp"
-
-int OpenConverter(vlc_object_t *);
-void CloseConverter(vlc_object_t *);
-
 
 #define MMAL_COMPONENT_DEFAULT_RESIZER "vc.ril.resize"
 #define MMAL_COMPONENT_ISP_RESIZER     "vc.ril.isp"



More information about the vlc-commits mailing list