[vlc-commits] picture: split picture_NewFromResource() in two

Rémi Denis-Courmont git at videolan.org
Sun Feb 11 09:17:02 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 10 11:52:17 2018 +0200| [d622423f42285f04c56d51d12965cdf6120fd456] | committer: Rémi Denis-Courmont

picture: split picture_NewFromResource() in two

Separate the common part for resourced and non-resourced cases.

No functional changes.

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

 src/misc/picture.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/misc/picture.c b/src/misc/picture.c
index f6671edd51..832a8495ae 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -207,7 +207,8 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
 /*****************************************************************************
  *
  *****************************************************************************/
-picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_resource_t *p_resource )
+
+static picture_priv_t *picture_NewPrivate(const video_format_t *restrict p_fmt)
 {
     video_format_t fmt = *p_fmt;
 
@@ -242,6 +243,17 @@ picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_r
     atomic_init( &priv->gc.refs, 1 );
     priv->gc.opaque = NULL;
 
+    return priv;
+}
+
+picture_t *picture_NewFromResource( const video_format_t *p_fmt, const picture_resource_t *p_resource )
+{
+    picture_priv_t *priv = picture_NewPrivate(p_fmt);
+    if (unlikely(priv == NULL))
+        return NULL;
+
+    picture_t *p_picture = &priv->picture;
+
     if( p_resource )
     {
         p_picture->p_sys = p_resource->p_sys;



More information about the vlc-commits mailing list