[vlc-commits] vout/android: utils: use an anonymous union in picture_sys_t

Thomas Guillem git at videolan.org
Mon Dec 19 12:06:43 CET 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 15 12:35:27 2016 +0100| [5769ac71bab4927bd08b17e5eb55f06536838372] | committer: Thomas Guillem

vout/android: utils: use an anonymous union in picture_sys_t

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

 modules/codec/omxil/mediacodec.c       | 16 ++++++-------
 modules/codec/omxil/omxil.c            | 12 +++++-----
 modules/video_output/android/display.c | 44 +++++++++++++++++-----------------
 modules/video_output/android/display.h | 40 +++++++++++++++----------------
 4 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 3f247b7..bb21d08 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -501,11 +501,11 @@ static int UpdateOpaqueVout(decoder_t *p_dec)
     }
 
     assert(p_dummy_hwpic->p_sys);
-    assert(p_dummy_hwpic->p_sys->priv.hw.p_surface);
-    assert(p_dummy_hwpic->p_sys->priv.hw.p_jsurface);
+    assert(p_dummy_hwpic->p_sys->hw.p_surface);
+    assert(p_dummy_hwpic->p_sys->hw.p_jsurface);
 
-    p_sys->video.p_surface = p_dummy_hwpic->p_sys->priv.hw.p_surface;
-    p_sys->video.p_jsurface = p_dummy_hwpic->p_sys->priv.hw.p_jsurface;
+    p_sys->video.p_surface = p_dummy_hwpic->p_sys->hw.p_surface;
+    p_sys->video.p_jsurface = p_dummy_hwpic->p_sys->hw.p_jsurface;
     picture_Release(p_dummy_hwpic);
     return VLC_SUCCESS;
 }
@@ -934,10 +934,10 @@ static int InsertInflightPicture(decoder_t *p_dec, picture_sys_t *p_picsys)
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if (!p_picsys->priv.hw.p_dec)
+    if (!p_picsys->hw.p_dec)
     {
-        p_picsys->priv.hw.p_dec = p_dec;
-        p_picsys->priv.hw.pf_release = ReleasePicture;
+        p_picsys->hw.p_dec = p_dec;
+        p_picsys->hw.pf_release = ReleasePicture;
         TAB_APPEND_CAST((picture_sys_t **),
                         p_sys->video.i_inflight_pictures,
                         p_sys->video.pp_inflight_pictures,
@@ -1003,7 +1003,7 @@ static int Video_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out,
 
         if (p_sys->api->b_direct_rendering)
         {
-            p_pic->p_sys->priv.hw.i_index = p_out->buf.i_index;
+            p_pic->p_sys->hw.i_index = p_out->buf.i_index;
             InsertInflightPicture(p_dec, p_pic->p_sys);
         } else {
             unsigned int chroma_div;
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index 47d0e19..8cc18d3 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1629,8 +1629,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
             if (invalid_picture) {
                 invalid_picture->date = VLC_TS_INVALID;
                 picture_sys_t *p_picsys = invalid_picture->p_sys;
-                p_picsys->priv.hw.p_dec = NULL;
-                p_picsys->priv.hw.i_index = -1;
+                p_picsys->hw.p_dec = NULL;
+                p_picsys->hw.i_index = -1;
             } else {
                 /* If we cannot return a picture we must free the
                    block since the decoder will proceed with the
@@ -2076,7 +2076,7 @@ static void HwBuffer_Init( decoder_t *p_dec, OmxPort *p_port )
         msg_Err(p_dec, "Opaque Vout request failed");
         goto error;
     }
-    ANativeWindow *p_anw = p_dummy_hwpic->p_sys->priv.hw.p_surface;
+    ANativeWindow *p_anw = p_dummy_hwpic->p_sys->hw.p_surface;
     if( !p_anw )
         goto error;
 
@@ -2464,9 +2464,9 @@ static int HwBuffer_GetPic( decoder_t *p_dec, OmxPort *p_port,
     p_pic->date = FromOmxTicks( p_header->nTimeStamp );
 
     p_picsys = p_pic->p_sys;
-    p_picsys->priv.hw.i_index = i_index;
-    p_picsys->priv.hw.p_dec = p_dec;
-    p_picsys->priv.hw.pf_release = ReleasePicture;
+    p_picsys->hw.i_index = i_index;
+    p_picsys->hw.p_dec = p_dec;
+    p_picsys->hw.pf_release = ReleasePicture;
 
     p_port->p_hwbuf->inflight_picture[i_index] = p_picsys;
 
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 03358c5..17c8b1d 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -183,17 +183,17 @@ static void AndroidOpaquePicture_DetachVout(picture_t *p_pic)
 {
     picture_sys_t *p_picsys = p_pic->p_sys;
 
-    vlc_mutex_lock(&p_picsys->priv.hw.lock);
+    vlc_mutex_lock(&p_picsys->hw.lock);
     p_pic->p_sys->p_vd_sys = NULL;
     /* Release p_picsys if references from VOUT and from decoder are NULL */
-    if (!p_picsys->p_vd_sys && !p_picsys->priv.hw.p_dec)
+    if (!p_picsys->p_vd_sys && !p_picsys->hw.p_dec)
     {
-        vlc_mutex_unlock(&p_picsys->priv.hw.lock);
-        vlc_mutex_destroy(&p_picsys->priv.hw.lock);
+        vlc_mutex_unlock(&p_picsys->hw.lock);
+        vlc_mutex_destroy(&p_picsys->hw.lock);
         free(p_picsys);
     }
     else
-        vlc_mutex_unlock(&p_picsys->priv.hw.lock);
+        vlc_mutex_unlock(&p_picsys->hw.lock);
     free(p_pic);
 }
 
@@ -214,10 +214,10 @@ static picture_t *PictureAlloc(vout_display_sys_t *sys, video_format_t *fmt,
 
     if (b_opaque)
     {
-        p_picsys->priv.hw.p_surface = sys->p_window->p_surface;
-        p_picsys->priv.hw.p_jsurface =  sys->p_window->p_jsurface;
-        p_picsys->priv.hw.i_index = -1;
-        vlc_mutex_init(&p_picsys->priv.hw.lock);
+        p_picsys->hw.p_surface = sys->p_window->p_surface;
+        p_picsys->hw.p_jsurface =  sys->p_window->p_jsurface;
+        p_picsys->hw.i_index = -1;
+        vlc_mutex_init(&p_picsys->hw.lock);
         rsc.pf_destroy = AndroidOpaquePicture_DetachVout;
     }
 
@@ -576,7 +576,7 @@ static void AndroidWindow_UnlockPicture(vout_display_sys_t *sys,
     picture_sys_t *p_picsys = p_pic->p_sys;
 
     if (p_window->b_use_priv) {
-        void *p_handle = p_picsys->priv.sw.p_handle;
+        void *p_handle = p_picsys->sw.p_handle;
 
         if (p_handle == NULL)
             return;
@@ -597,29 +597,29 @@ static int AndroidWindow_LockPicture(vout_display_sys_t *sys,
         int err;
 
         err = sys->anwp.lockData(p_window->p_surface_priv,
-                                 &p_handle, &p_picsys->priv.sw.buf);
+                                 &p_handle, &p_picsys->sw.buf);
         if (err != 0)
             return -1;
-        p_picsys->priv.sw.p_handle = p_handle;
+        p_picsys->sw.p_handle = p_handle;
     } else {
         if (sys->anw->winLock(p_window->p_surface,
-                              &p_picsys->priv.sw.buf, NULL) != 0)
+                              &p_picsys->sw.buf, NULL) != 0)
             return -1;
     }
-    if (p_picsys->priv.sw.buf.width < 0 ||
-        p_picsys->priv.sw.buf.height < 0 ||
-        (unsigned)p_picsys->priv.sw.buf.width < p_window->fmt.i_width ||
-        (unsigned)p_picsys->priv.sw.buf.height < p_window->fmt.i_height) {
+    if (p_picsys->sw.buf.width < 0 ||
+        p_picsys->sw.buf.height < 0 ||
+        (unsigned)p_picsys->sw.buf.width < p_window->fmt.i_width ||
+        (unsigned)p_picsys->sw.buf.height < p_window->fmt.i_height) {
         AndroidWindow_UnlockPicture(sys, p_window, p_pic, false);
         return -1;
     }
 
-    p_pic->p[0].p_pixels = p_picsys->priv.sw.buf.bits;
-    p_pic->p[0].i_lines = p_picsys->priv.sw.buf.height;
-    p_pic->p[0].i_pitch = p_pic->p[0].i_pixel_pitch * p_picsys->priv.sw.buf.stride;
+    p_pic->p[0].p_pixels = p_picsys->sw.buf.bits;
+    p_pic->p[0].i_lines = p_picsys->sw.buf.height;
+    p_pic->p[0].i_pitch = p_pic->p[0].i_pixel_pitch * p_picsys->sw.buf.stride;
 
-    if (p_picsys->priv.sw.buf.format == PRIV_WINDOW_FORMAT_YV12)
-        SetupPictureYV12(p_pic, p_picsys->priv.sw.buf.stride);
+    if (p_picsys->sw.buf.format == PRIV_WINDOW_FORMAT_YV12)
+        SetupPictureYV12(p_pic, p_picsys->sw.buf.stride);
 
     return 0;
 }
diff --git a/modules/video_output/android/display.h b/modules/video_output/android/display.h
index ab9d9da..c8c54a3 100644
--- a/modules/video_output/android/display.h
+++ b/modules/video_output/android/display.h
@@ -55,48 +55,48 @@ struct picture_sys_t
             void *p_handle;
             ANativeWindow_Buffer buf;
         } sw;
-    } priv;
+    };
     bool b_locked;
 };
 
 static inline void
 AndroidOpaquePicture_DetachDecoder(picture_sys_t *p_picsys)
 {
-    vlc_mutex_lock(&p_picsys->priv.hw.lock);
-    if (p_picsys->priv.hw.i_index >= 0)
+    vlc_mutex_lock(&p_picsys->hw.lock);
+    if (p_picsys->hw.i_index >= 0)
     {
-        assert(p_picsys->priv.hw.pf_release && p_picsys->priv.hw.p_dec);
-        p_picsys->priv.hw.pf_release(p_picsys->priv.hw.p_dec,
-                                     (unsigned int) p_picsys->priv.hw.i_index,
+        assert(p_picsys->hw.pf_release && p_picsys->hw.p_dec);
+        p_picsys->hw.pf_release(p_picsys->hw.p_dec,
+                                     (unsigned int) p_picsys->hw.i_index,
                                      false);
-        p_picsys->priv.hw.i_index = -1;
+        p_picsys->hw.i_index = -1;
     }
-    p_picsys->priv.hw.pf_release = NULL;
-    p_picsys->priv.hw.p_dec = NULL;
+    p_picsys->hw.pf_release = NULL;
+    p_picsys->hw.p_dec = NULL;
     /* Release p_picsys if references from VOUT and from decoder are NULL */
-    if (!p_picsys->p_vd_sys && !p_picsys->priv.hw.p_dec)
+    if (!p_picsys->p_vd_sys && !p_picsys->hw.p_dec)
     {
-        vlc_mutex_unlock(&p_picsys->priv.hw.lock);
-        vlc_mutex_destroy(&p_picsys->priv.hw.lock);
+        vlc_mutex_unlock(&p_picsys->hw.lock);
+        vlc_mutex_destroy(&p_picsys->hw.lock);
         free(p_picsys);
     }
     else
-        vlc_mutex_unlock(&p_picsys->priv.hw.lock);
+        vlc_mutex_unlock(&p_picsys->hw.lock);
 }
 
 static inline void
 AndroidOpaquePicture_Release(picture_sys_t *p_picsys, bool b_render)
 {
-    vlc_mutex_lock(&p_picsys->priv.hw.lock);
-    if (p_picsys->priv.hw.i_index >= 0)
+    vlc_mutex_lock(&p_picsys->hw.lock);
+    if (p_picsys->hw.i_index >= 0)
     {
-        assert(p_picsys->priv.hw.pf_release && p_picsys->priv.hw.p_dec);
-        p_picsys->priv.hw.pf_release(p_picsys->priv.hw.p_dec,
-                                     (unsigned int) p_picsys->priv.hw.i_index,
+        assert(p_picsys->hw.pf_release && p_picsys->hw.p_dec);
+        p_picsys->hw.pf_release(p_picsys->hw.p_dec,
+                                     (unsigned int) p_picsys->hw.i_index,
                                      b_render);
-        p_picsys->priv.hw.i_index = -1;
+        p_picsys->hw.i_index = -1;
     }
-    vlc_mutex_unlock(&p_picsys->priv.hw.lock);
+    vlc_mutex_unlock(&p_picsys->hw.lock);
 }
 
 #endif



More information about the vlc-commits mailing list