[vlc-commits] mmal/codec: Try to apply fmt changes without disabling port

Julian Scheel git at videolan.org
Fri Jun 5 15:37:14 CEST 2015


vlc | branch: master | Julian Scheel <julian at jusst.de> | Wed Jun  3 09:50:27 2015 +0200| [2698e5893cedd9ac388b21789097e4ddb5cae725] | committer: Jean-Baptiste Kempf

mmal/codec: Try to apply fmt changes without disabling port

Depending on what parts of the format have changed it can be possible to apply
the changes without resetting the whole port. As this saves some time try to
make use of it.

Signed-off-by: Julian Scheel <julian at jusst.de>
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/hw/mmal/codec.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/hw/mmal/codec.c b/modules/hw/mmal/codec.c
index 36af836..6dd6e1a 100644
--- a/modules/hw/mmal/codec.c
+++ b/modules/hw/mmal/codec.c
@@ -290,6 +290,20 @@ static int change_output_format(decoder_t *dec)
     int pool_size;
     int ret = 0;
 
+    if (sys->output_pool) {
+        mmal_format_full_copy(sys->output->format, sys->output_format);
+        status = mmal_port_format_commit(sys->output);
+        if (status != MMAL_SUCCESS) {
+            msg_Err(dec, "Failed to commit output format (status=%"PRIx32" %s)",
+                    status, mmal_status_to_string(status));
+            ret = -1;
+            goto port_reset;
+        }
+        goto apply_fmt;
+    }
+
+port_reset:
+    msg_Dbg(dec, "%s: Do full port reset", __func__);
     status = mmal_port_disable(sys->output);
     if (status != MMAL_SUCCESS) {
         msg_Err(dec, "Failed to disable output port (status=%"PRIx32" %s)",
@@ -344,6 +358,7 @@ static int change_output_format(decoder_t *dec)
         msg_Dbg(dec, "Request %d extra pictures", dec->i_extra_picture_buffers);
     }
 
+apply_fmt:
     dec->fmt_out.video.i_width = sys->output->format->es->video.width;
     dec->fmt_out.video.i_height = sys->output->format->es->video.height;
     dec->fmt_out.video.i_x_offset = sys->output->format->es->video.crop.x;



More information about the vlc-commits mailing list