[vlc-commits] mmal: converter: require a valid decoder device

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 24 11:30:45 2020 +0100| [85b78249148de2e5029b642d89cf96b0e04c0e3f] | committer: Steve Lhomme

mmal: converter: require a valid decoder device

Make sure we're using a MMAL pipeline.

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

 modules/hw/mmal/converter.c    | 16 ++++++++++++++++
 modules/hw/mmal/mmal_picture.h | 13 +++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/modules/hw/mmal/converter.c b/modules/hw/mmal/converter.c
index af618b81d8..ffce6e00a7 100644
--- a/modules/hw/mmal/converter.c
+++ b/modules/hw/mmal/converter.c
@@ -135,6 +135,7 @@ typedef struct
         unsigned int line;  // Lines filled
     } slice;
 
+    vlc_decoder_device *dec_dev;
     vcsm_init_type_t vcsm_init_type;
 } converter_sys_t;
 
@@ -701,6 +702,8 @@ void CloseConverter(vlc_object_t * obj)
     if (sys->component)
         mmal_component_release(sys->component);
 
+    if (sys->dec_dev)
+        vlc_decoder_device_Release(sys->dec_dev);
     cma_vcsm_exit(sys->vcsm_init_type);
 
     vlc_sem_destroy(&sys->sem);
@@ -792,6 +795,19 @@ retry:
     sys->needs_copy_in = !hw_mmal_chroma_is_mmal(p_filter->fmt_in.video.i_chroma);
     sys->in_port_cb_fn = conv_input_port_cb;
 
+    if (hw_mmal_chroma_is_mmal(p_filter->fmt_in.video.i_chroma))
+    {
+        assert(p_filter->vctx_in);
+        sys->dec_dev = vlc_video_context_HoldDevice(p_filter->vctx_in);
+        assert(sys->dec_dev->type == VLC_DECODER_DEVICE_MMAL);
+    }
+    else
+        sys->dec_dev = filter_HoldDecoderDeviceType(p_filter, VLC_DECODER_DEVICE_MMAL);
+    if (sys->dec_dev == NULL) {
+        msg_Err(p_filter, "missing MMAL decoder device");
+        goto fail;
+    }
+
     if ((sys->vcsm_init_type = cma_vcsm_init()) == VCSM_INIT_NONE) {
         msg_Err(p_filter, "VCSM init failed");
         goto fail;
diff --git a/modules/hw/mmal/mmal_picture.h b/modules/hw/mmal/mmal_picture.h
index 75ad981886..588a66ca4f 100644
--- a/modules/hw/mmal/mmal_picture.h
+++ b/modules/hw/mmal/mmal_picture.h
@@ -123,8 +123,7 @@ MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_copied(const picture_t *const pic,
 
 MMAL_BUFFER_HEADER_T * hw_mmal_pic_buf_replicated(const picture_t *const pic, MMAL_POOL_T * const rep_pool);
 
-struct vzc_pool_ctl_s;
-typedef struct vzc_pool_ctl_s vzc_pool_ctl_t;
+//----------------------------------------------------------------------------
 
 // At the moment we cope with any mono-planar RGBA thing
 // We could cope with many other things but they currently don't occur
@@ -134,6 +133,12 @@ bool hw_mmal_vzc_buf_set_format(MMAL_BUFFER_HEADER_T * const buf, MMAL_ES_FORMAT
 MMAL_DISPLAYREGION_T * hw_mmal_vzc_buf_region(MMAL_BUFFER_HEADER_T * const buf);
 void hw_mmal_vzc_buf_scale_dest_rect(MMAL_BUFFER_HEADER_T * const buf, const MMAL_RECT_T * const scale_rect);
 unsigned int hw_mmal_vzc_buf_seq(MMAL_BUFFER_HEADER_T * const buf);
+
+//----------------------------------------------------------------------------
+
+struct vzc_pool_ctl_s;
+typedef struct vzc_pool_ctl_s vzc_pool_ctl_t;
+
 MMAL_BUFFER_HEADER_T * hw_mmal_vzc_buf_from_pic(vzc_pool_ctl_t * const pc, picture_t * const pic,
                                                 const MMAL_RECT_T dst_pic_rect,
                                                 const int x_offset, const int y_offset,
@@ -145,6 +150,8 @@ void hw_mmal_vzc_pool_ref(vzc_pool_ctl_t * const pc);
 vzc_pool_ctl_t * hw_mmal_vzc_pool_new(void);
 
 
+//----------------------------------------------------------------------------
+
 #define NUM_DECODER_BUFFER_HEADERS 30
 
 MMAL_FOURCC_T pic_to_slice_mmal_fourcc(MMAL_FOURCC_T);
@@ -173,6 +180,8 @@ void CloseConverter(vlc_object_t *);
 #define MMAL_COMPONENT_ISP_RESIZER     "vc.ril.isp"
 #define MMAL_COMPONENT_HVS             "vc.ril.hvs"
 
+//----------------------------------------------------------------------------
+
 typedef struct
 {
     vcsm_init_type_t vcsm_init_type;



More information about the vlc-commits mailing list