[vlc-devel] [PATCH 2/2] Replaces vlc_gc_incref and decref by input_item_Hold and Release

Julien 'Lta' BALLET elthariel at gmail.com
Sat May 24 16:31:48 CEST 2014


From: Julien 'Lta' BALLET <contact at lta.io>

---
 include/vlc_fingerprinter.h                        |  4 ++--
 lib/media.c                                        |  6 ++---
 lib/media_list.c                                   |  2 +-
 modules/access/cdda.c                              |  2 +-
 modules/access/mms/mmsh.c                          |  2 +-
 modules/control/rc.c                               |  2 +-
 modules/demux/mp4/mp4.c                            |  2 +-
 modules/demux/playlist/asx.c                       |  4 ++--
 modules/demux/playlist/b4s.c                       |  4 ++--
 modules/demux/playlist/dvb.c                       |  6 ++---
 modules/demux/playlist/gvp.c                       |  4 ++--
 modules/demux/playlist/ifo.c                       |  8 +++----
 modules/demux/playlist/itml.c                      |  4 ++--
 modules/demux/playlist/m3u.c                       |  4 ++--
 modules/demux/playlist/playlist.c                  |  2 +-
 modules/demux/playlist/pls.c                       |  6 ++---
 modules/demux/playlist/podcast.c                   |  6 ++---
 modules/demux/playlist/qtl.c                       |  6 ++---
 modules/demux/playlist/ram.c                       |  4 ++--
 modules/demux/playlist/sgimb.c                     |  4 ++--
 modules/demux/playlist/shoutcast.c                 |  6 ++---
 modules/demux/playlist/wpl.c                       |  4 ++--
 modules/demux/playlist/xspf.c                      | 26 +++++++++++-----------
 modules/demux/playlist/zpl.c                       |  4 ++--
 modules/gui/macosx/ConvertAndSave.m                |  2 +-
 modules/gui/macosx/playlist.m                      |  6 ++---
 modules/gui/macosx/playlistinfo.m                  | 12 +++++-----
 modules/gui/macosx/wizard.m                        |  2 +-
 modules/gui/qt4/components/interface_widgets.cpp   |  8 +++----
 .../gui/qt4/components/playlist/playlist_item.cpp  |  4 ++--
 .../gui/qt4/components/playlist/playlist_model.cpp |  4 ++--
 modules/gui/qt4/components/playlist/selector.cpp   |  6 ++---
 modules/gui/qt4/dialogs/epg.cpp                    |  4 ++--
 modules/gui/qt4/input_manager.hpp                  |  4 ++--
 modules/gui/skins2/commands/cmd_vars.hpp           |  4 ++--
 modules/lua/extension.c                            |  6 ++---
 modules/lua/libs/input.c                           |  4 ++--
 modules/lua/libs/sd.c                              |  4 ++--
 modules/lua/vlc.c                                  |  2 +-
 modules/services_discovery/bonjour.c               |  2 +-
 modules/services_discovery/mediadirs.c             |  4 ++--
 modules/services_discovery/mtp.c                   |  2 +-
 modules/services_discovery/podcast.c               |  6 ++---
 modules/services_discovery/pulse.c                 |  8 +++----
 modules/services_discovery/sap.c                   |  2 +-
 modules/services_discovery/udev.c                  |  4 ++--
 modules/services_discovery/upnp.cpp                | 16 ++++++-------
 modules/services_discovery/xcb_apps.c              |  4 ++--
 src/input/input.c                                  |  4 ++--
 src/input/item.c                                   |  4 ++--
 src/input/vlm.c                                    |  6 ++---
 src/playlist/engine.c                              |  4 ++--
 src/playlist/fetcher.c                             |  6 ++---
 src/playlist/item.c                                |  6 ++---
 src/playlist/loadsave.c                            |  4 ++--
 src/playlist/preparser.c                           |  6 ++---
 src/playlist/tree.c                                |  2 +-
 test/native/gc.c                                   |  8 +++----
 58 files changed, 146 insertions(+), 146 deletions(-)

diff --git a/include/vlc_fingerprinter.h b/include/vlc_fingerprinter.h
index e5d3afe..0da5b5f 100644
--- a/include/vlc_fingerprinter.h
+++ b/include/vlc_fingerprinter.h
@@ -51,7 +51,7 @@ static inline fingerprint_request_t *fingerprint_request_New( input_item_t *p_it
     if ( !p_r ) return NULL;
     p_r->results.psz_fingerprint = NULL;
     p_r->i_duration = 0;
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     p_r->p_item = p_item;
     vlc_array_init( & p_r->results.metas_array ); /* shouldn't be needed */
     return p_r;
@@ -59,7 +59,7 @@ static inline fingerprint_request_t *fingerprint_request_New( input_item_t *p_it
 
 static inline void fingerprint_request_Delete( fingerprint_request_t *p_f )
 {
-    vlc_gc_decref( p_f->p_item );
+    input_item_Release( p_f->p_item );
     free( p_f->results.psz_fingerprint );
     for( int i = 0; i < vlc_array_count( & p_f->results.metas_array ); i++ )
         vlc_meta_Delete( (vlc_meta_t *) vlc_array_item_at_index( & p_f->results.metas_array, i ) );
diff --git a/lib/media.c b/lib/media.c
index 1f6fb9e..5f538e5 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -317,7 +317,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
     libvlc_event_manager_register_event_type(em, libvlc_MediaParsedChanged);
     libvlc_event_manager_register_event_type(em, libvlc_MediaSubItemTreeAdded);
 
-    vlc_gc_incref( p_md->p_input_item );
+    input_item_Hold( p_md->p_input_item );
 
     install_input_item_observer( p_md );
 
@@ -344,7 +344,7 @@ libvlc_media_t *libvlc_media_new_location( libvlc_instance_t *p_instance,
     p_md = libvlc_media_new_from_input_item( p_instance, p_input_item );
 
     /* The p_input_item is retained in libvlc_media_new_from_input_item */
-    vlc_gc_decref( p_input_item );
+    input_item_Release( p_input_item );
 
     return p_md;
 }
@@ -438,7 +438,7 @@ void libvlc_media_release( libvlc_media_t *p_md )
         libvlc_media_list_release( p_md->p_subitems );
 
     uninstall_input_item_observer( p_md );
-    vlc_gc_decref( p_md->p_input_item );
+    input_item_Release( p_md->p_input_item );
 
     vlc_cond_destroy( &p_md->parsed_cond );
     vlc_mutex_destroy( &p_md->parsed_lock );
diff --git a/lib/media_list.c b/lib/media_list.c
index 1d57025..f18bc7f 100644
--- a/lib/media_list.c
+++ b/lib/media_list.c
@@ -261,7 +261,7 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
                                              p_input_item );
     if( !p_md )
     {
-        vlc_gc_decref( p_input_item );
+        input_item_Release( p_input_item );
         return -1;
     }
 
diff --git a/modules/access/cdda.c b/modules/access/cdda.c
index a7bd701..5632020 100644
--- a/modules/access/cdda.c
+++ b/modules/access/cdda.c
@@ -558,7 +558,7 @@ static int GetTracks( access_t *p_access, input_item_t *p_current )
         input_item_SetTrackNum( p_input_item, psz_num );
 
         input_item_node_AppendItem( p_root, p_input_item );
-        vlc_gc_decref( p_input_item );
+        input_item_Release( p_input_item );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
     }
diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index d1d3c2d..e134794 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -167,7 +167,7 @@ int MMSHOpen( access_t *p_access )
         input_item_t *p_item = input_GetItem( p_input );
         input_item_PostSubItem( p_item, p_new_loc );
 
-        vlc_gc_decref( p_new_loc );
+        input_item_Release( p_new_loc );
         vlc_object_release( p_input );
 
         free( psz_location );
diff --git a/modules/control/rc.c b/modules/control/rc.c
index 8e5a162..440c665 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -1316,7 +1316,7 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
             int i_ret =playlist_AddInput( p_playlist, p_item,
                      PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, true,
                      pl_Unlocked );
-            vlc_gc_decref( p_item );
+            input_item_Release( p_item );
             if( i_ret != VLC_SUCCESS )
             {
                 return VLC_EGENERIC;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index b5f782a..5f586d0 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -557,7 +557,7 @@ static int Open( vlc_object_t * p_this )
                 input_item_t *p_item = input_item_New( psz_ref, NULL );
                 input_item_CopyOptions( p_current, p_item );
                 input_item_node_AppendItem( p_subitems, p_item );
-                vlc_gc_decref( p_item );
+                input_item_Release( p_item );
             }
             else
             {
diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index 79a841d..f80bb46 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -416,7 +416,7 @@ static int Demux( demux_t *p_demux )
                 input_item_CopyOptions( p_current_input, p_input );
                 input_item_node_AppendItem( p_subitems, p_input );
 
-                vlc_gc_decref( p_input );
+                input_item_Release( p_input );
             }
 
             /* Entry Handler */
@@ -451,7 +451,7 @@ error:
     if( p_subitems )
         input_item_node_Delete( p_subitems );
 
-    vlc_gc_decref( p_current_input );
+    input_item_Release( p_current_input );
 
     return 0;
 }
diff --git a/modules/demux/playlist/b4s.c b/modules/demux/playlist/b4s.c
index d9c0465..8396216 100644
--- a/modules/demux/playlist/b4s.c
+++ b/modules/demux/playlist/b4s.c
@@ -203,7 +203,7 @@ static int Demux( demux_t *p_demux )
                         msg_Err( p_demux, "Unsupported meta bitrate" );
 
                     input_item_node_AppendItem( p_subitems, p_input );
-                    vlc_gc_decref( p_input );
+                    input_item_Release( p_input );
                     FREENULL( psz_title );
                     FREENULL( psz_mrl );
                     FREENULL( psz_genre );
@@ -229,7 +229,7 @@ end:
     if( p_subitems )
         input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref( p_current_input );
+    input_item_Release( p_current_input );
     if( p_xml_reader )
         xml_ReaderDelete( p_xml_reader );
     return i_ret;
diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 0b5e796..04377f1 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -67,7 +67,7 @@ int Import_DVB(vlc_object_t *obj)
     input_item_t *item = ParseLine(line);
     if (item == NULL)
         return VLC_EGENERIC;
-    vlc_gc_decref(item);
+    input_item_Release(item);
 
     msg_Dbg(demux, "found valid channels.conf file");
     demux->pf_control = Control;
@@ -90,11 +90,11 @@ static int Demux(demux_t *demux)
             continue;
 
         input_item_node_AppendItem(subitems, item);
-        vlc_gc_decref(item);
+        input_item_Release(item);
     }
 
     input_item_node_PostAndDelete(subitems);
-    vlc_gc_decref(input);
+    input_item_Release(input);
 
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/gvp.c b/modules/demux/playlist/gvp.c
index 1b810de..0b769c9 100644
--- a/modules/demux/playlist/gvp.c
+++ b/modules/demux/playlist/gvp.c
@@ -210,12 +210,12 @@ static int Demux( demux_t *p_demux )
         SADD_INFO( "docid", psz_docid );
         SADD_INFO( "description", psz_description );
         input_item_node_AppendItem( p_subitems, p_input );
-        vlc_gc_decref( p_input );
+        input_item_Release( p_input );
     }
 
     input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
 
     free( psz_version );
     free( psz_url );
diff --git a/modules/demux/playlist/ifo.c b/modules/demux/playlist/ifo.c
index e031f8b..eb6af05 100644
--- a/modules/demux/playlist/ifo.c
+++ b/modules/demux/playlist/ifo.c
@@ -106,9 +106,9 @@ static int Demux( demux_t *p_demux )
     input_item_t *p_current_input = GetCurrentItem(p_demux);
     input_item_t *p_input = input_item_New( psz_url, psz_url );
     input_item_PostSubItem( p_current_input, p_input );
-    vlc_gc_decref( p_input );
+    input_item_Release( p_input );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     free( psz_url );
 
     return 0; /* Needed for correct operation of go back */
@@ -130,9 +130,9 @@ static int DemuxDVD_VR( demux_t *p_demux )
     input_item_t *p_input = input_item_New( psz_url, psz_url );
     input_item_PostSubItem( p_current_input, p_input );
 
-    vlc_gc_decref( p_input );
+    input_item_Release( p_input );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     free( psz_url );
 
     return 0; /* Needed for correct operation of go back */
diff --git a/modules/demux/playlist/itml.c b/modules/demux/playlist/itml.c
index e000ec3..cad056d 100644
--- a/modules/demux/playlist/itml.c
+++ b/modules/demux/playlist/itml.c
@@ -104,7 +104,7 @@ int Demux( demux_t *p_demux )
                       pl_elements );
     input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
 
 end:
     if( p_xml_reader )
@@ -330,7 +330,7 @@ static bool parse_track_dict( demux_t *p_demux, input_item_node_t *p_input_node,
 
     /* add meta info */
     add_meta( p_new_input, p_track );
-    vlc_gc_decref( p_new_input );
+    input_item_Release( p_new_input );
 
     p_demux->p_sys->i_ntracks++;
 
diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 02a9598..c44a516 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -267,7 +267,7 @@ static int Demux( demux_t *p_demux )
                 input_item_SetArtURL( p_input, psz_album_art );
 
             input_item_node_AppendItem( p_subitems, p_input );
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
         }
 
  error:
@@ -293,7 +293,7 @@ static int Demux( demux_t *p_demux )
         }
     }
     input_item_node_PostAndDelete( p_subitems );
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 0b4a053..fe19e06 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -157,7 +157,7 @@ input_item_t * GetCurrentItem(demux_t *p_demux)
 {
     input_thread_t *p_input_thread = demux_GetParentInput( p_demux );
     input_item_t *p_current_input = input_GetItem( p_input_thread );
-    vlc_gc_incref(p_current_input);
+    input_item_Hold(p_current_input);
     vlc_object_release(p_input_thread);
     return p_current_input;
 }
diff --git a/modules/demux/playlist/pls.c b/modules/demux/playlist/pls.c
index 5608084..0e52fc9 100644
--- a/modules/demux/playlist/pls.c
+++ b/modules/demux/playlist/pls.c
@@ -144,7 +144,7 @@ static int Demux( demux_t *p_demux )
                 p_input = input_item_New( psz_mrl, psz_name );
                 input_item_CopyOptions( p_current_input, p_input );
                 input_item_node_AppendItem( p_subitems, p_input );
-                vlc_gc_decref( p_input );
+                input_item_Release( p_input );
                 free( psz_mrl_orig );
                 psz_mrl_orig = psz_mrl = NULL;
             }
@@ -196,7 +196,7 @@ static int Demux( demux_t *p_demux )
         p_input = input_item_New( psz_mrl, psz_name );
         input_item_CopyOptions( p_current_input, p_input );
         input_item_node_AppendItem( p_subitems, p_input );
-        vlc_gc_decref( p_input );
+        input_item_Release( p_input );
         free( psz_mrl_orig );
     }
     else
@@ -208,6 +208,6 @@ static int Demux( demux_t *p_demux )
 
     input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index b0c44d9..b095e61 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -296,7 +296,7 @@ static int Demux( demux_t *p_demux )
                         FREENULL( psz_item_size );
                     }
                     input_item_node_AppendItem( p_subitems, p_input );
-                    vlc_gc_decref( p_input );
+                    input_item_Release( p_input );
                     b_item = false;
                 }
                 else if( !strcmp( node, "image" ) )
@@ -318,7 +318,7 @@ static int Demux( demux_t *p_demux )
     xml_ReaderDelete( p_xml_reader );
 
     input_item_node_PostAndDelete( p_subitems );
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     return 0; /* Needed for correct operation of go back */
 
 error:
@@ -341,7 +341,7 @@ error:
     if( p_subitems )
         input_item_node_Delete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     return -1;
 }
 
diff --git a/modules/demux/playlist/qtl.c b/modules/demux/playlist/qtl.c
index 958b29e..8df0a1e 100644
--- a/modules/demux/playlist/qtl.c
+++ b/modules/demux/playlist/qtl.c
@@ -241,13 +241,13 @@ static int Demux( demux_t *p_demux )
         SADD_INFO( "href", psz_href );
         SADD_INFO( _("Mime"), psz_mimetype );
         input_item_node_AppendItem( p_subitems, p_input );
-        vlc_gc_decref( p_input );
+        input_item_Release( p_input );
         if( psz_qtnext )
         {
             resolve_xml_special_chars( psz_qtnext );
             p_input = input_item_New( psz_qtnext, NULL );
             input_item_node_AppendItem( p_subitems, p_input );
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
         }
         input_item_node_PostAndDelete( p_subitems );
     }
@@ -258,7 +258,7 @@ error:
     if( p_xml_reader )
         xml_ReaderDelete( p_xml_reader );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
 
     free( psz_href );
     free( psz_moviename );
diff --git a/modules/demux/playlist/ram.c b/modules/demux/playlist/ram.c
index 8c8de71..106ef72 100644
--- a/modules/demux/playlist/ram.c
+++ b/modules/demux/playlist/ram.c
@@ -348,7 +348,7 @@ static int Demux( demux_t *p_demux )
             if( !EMPTY_STR( psz_comments ) ) input_item_SetDescription( p_input, psz_comments );
 
             input_item_node_AppendItem( p_subitems, p_input );
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
             free( psz_mrl );
         }
 
@@ -380,7 +380,7 @@ static int Demux( demux_t *p_demux )
         }
     }
     input_item_node_PostAndDelete( p_subitems );
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     var_Destroy( p_demux, "m3u-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/sgimb.c b/modules/demux/playlist/sgimb.c
index 7aaa886..e2edf45 100644
--- a/modules/demux/playlist/sgimb.c
+++ b/modules/demux/playlist/sgimb.c
@@ -399,7 +399,7 @@ static int Demux ( demux_t *p_demux )
         input_item_AddOption( p_child, "rtsp-kasenna", VLC_INPUT_OPTION_TRUSTED );
 
     input_item_PostSubItem( p_current_input, p_child );
-    vlc_gc_decref( p_child );
-    vlc_gc_decref(p_current_input);
+    input_item_Release( p_child );
+    input_item_Release(p_current_input);
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/shoutcast.c b/modules/demux/playlist/shoutcast.c
index a7d7afc..77d53d9 100644
--- a/modules/demux/playlist/shoutcast.c
+++ b/modules/demux/playlist/shoutcast.c
@@ -119,7 +119,7 @@ error:
     if( p_xml_reader )
         xml_ReaderDelete( p_xml_reader );
     if( p_input_node ) input_item_node_Delete( p_input_node );
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     return i_ret;
 }
 
@@ -175,7 +175,7 @@ static int DemuxGenre( demux_t *p_demux, xml_reader_t *p_xml_reader,
                         input_item_CopyOptions( p_input_node->p_item, p_input );
                         free( psz_mrl );
                         input_item_node_AppendItem( p_input_node, p_input );
-                        vlc_gc_decref( p_input );
+                        input_item_Release( p_input );
                     }
                     FREENULL( psz_name );
                 }
@@ -335,7 +335,7 @@ static int DemuxStation( demux_t *p_demux, xml_reader_t *p_xml_reader,
                     if( psz_rt )
                         input_item_SetRating( p_input, psz_rt );
                     input_item_node_AppendItem( p_input_node, p_input );
-                    vlc_gc_decref( p_input );
+                    input_item_Release( p_input );
                     FREENULL( psz_base );
                     FREENULL( psz_name );
                     FREENULL( psz_mt );
diff --git a/modules/demux/playlist/wpl.c b/modules/demux/playlist/wpl.c
index 365488b..af01e37 100644
--- a/modules/demux/playlist/wpl.c
+++ b/modules/demux/playlist/wpl.c
@@ -103,7 +103,7 @@ static int Demux( demux_t *p_demux )
                 p_input = input_item_NewExt( psz_uri, psz_uri,
                                         0, NULL, 0, -1 );
                 input_item_node_AppendItem( p_subitems, p_input );
-                vlc_gc_decref( p_input );
+                input_item_Release( p_input );
             }
         }
 
@@ -114,7 +114,7 @@ static int Demux( demux_t *p_demux )
 
     input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     var_Destroy( p_demux, "wpl-extvlcopt" );
     return 0; /* Needed for correct operation of go back */
 }
diff --git a/modules/demux/playlist/xspf.c b/modules/demux/playlist/xspf.c
index a58782b..431ef3a 100644
--- a/modules/demux/playlist/xspf.c
+++ b/modules/demux/playlist/xspf.c
@@ -95,7 +95,7 @@ void Close_xspf(vlc_object_t *p_this)
     demux_sys_t *p_sys = p_demux->p_sys;
     for (int i = 0; i < p_sys->i_tracklist_entries; i++)
         if (p_sys->pp_tracklist[i])
-            vlc_gc_decref(p_sys->pp_tracklist[i]);
+            input_item_Release(p_sys->pp_tracklist[i]);
     free(p_sys->pp_tracklist);
     free(p_sys->psz_base);
     free(p_sys);
@@ -152,7 +152,7 @@ static int Demux(demux_t *p_demux)
     input_item_node_PostAndDelete(p_subitems);
 
 end:
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
     if (p_xml_reader)
         xml_ReaderDelete(p_xml_reader);
     return i_ret; /* Needed for correct operation of go back */
@@ -431,7 +431,7 @@ static bool parse_track_node COMPLEX_INTERFACE
              || (size_t)p_sys->i_track_id >= (SIZE_MAX / sizeof(p_new_input)))
             {
                 input_item_node_AppendNode(p_input_node, p_new_node);
-                vlc_gc_decref(p_new_input);
+                input_item_Release(p_new_input);
                 return true;
             }
 
@@ -442,7 +442,7 @@ static bool parse_track_node COMPLEX_INTERFACE
                     (p_sys->i_track_id + 1) * sizeof(*pp));
                 if (!pp)
                 {
-                    vlc_gc_decref(p_new_input);
+                    input_item_Release(p_new_input);
                     input_item_node_Delete(p_new_node);
                     return false;
                 }
@@ -453,7 +453,7 @@ static bool parse_track_node COMPLEX_INTERFACE
             else if (p_sys->pp_tracklist[p_sys->i_track_id] != NULL)
             {
                 msg_Err(p_demux, "track ID %d collision", p_sys->i_track_id);
-                vlc_gc_decref(p_new_input);
+                input_item_Release(p_new_input);
                 input_item_node_Delete(p_new_node);
                 return false;
             }
@@ -672,7 +672,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 {
                     msg_Err(p_demux, "invalid xml stream");
                     FREE_VALUE();
-                    if (b_release_input_item) vlc_gc_decref(p_new_input);
+                    if (b_release_input_item) input_item_Release(p_new_input);
                     return false;
                 }
                 /* choose handler */
@@ -681,7 +681,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 {
                     msg_Err(p_demux, "unexpected element <%s>", name);
                     FREE_VALUE();
-                    if (b_release_input_item) vlc_gc_decref(p_new_input);
+                    if (b_release_input_item) input_item_Release(p_new_input);
                     return false;
                 }
                 /* complex content is parsed in a separate function */
@@ -698,7 +698,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                     else
                     {
                         FREE_VALUE();
-                        if (b_release_input_item) vlc_gc_decref(p_new_input);
+                        if (b_release_input_item) input_item_Release(p_new_input);
                         return false;
                     }
                 }
@@ -711,7 +711,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 if (unlikely(!psz_value))
                 {
                     FREE_VALUE();
-                    if (b_release_input_item) vlc_gc_decref(p_new_input);
+                    if (b_release_input_item) input_item_Release(p_new_input);
                     return false;
                 }
                 break;
@@ -722,7 +722,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 if (!strcmp(name, psz_element))
                 {
                     FREE_VALUE();
-                    if (b_release_input_item) vlc_gc_decref(p_new_input);
+                    if (b_release_input_item) input_item_Release(p_new_input);
                     return true;
                 }
                 /* there MUST have been a start tag for that element name */
@@ -732,7 +732,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                     msg_Err(p_demux, "there's no open element left for <%s>",
                              name);
                     FREE_VALUE();
-                    if (b_release_input_item) vlc_gc_decref(p_new_input);
+                    if (b_release_input_item) input_item_Release(p_new_input);
                     return false;
                 }
 
@@ -751,7 +751,7 @@ static bool parse_extension_node COMPLEX_INTERFACE
                 break;
         }
     }
-    if (b_release_input_item) vlc_gc_decref(p_new_input);
+    if (b_release_input_item) input_item_Release(p_new_input);
     return false;
 }
 
@@ -793,7 +793,7 @@ static bool parse_extitem_node COMPLEX_INTERFACE
     if (p_new_input)
     {
         input_item_node_AppendItem(p_input_node, p_new_input);
-        vlc_gc_decref(p_new_input);
+        input_item_Release(p_new_input);
         p_demux->p_sys->pp_tracklist[i_tid] = NULL;
     }
 
diff --git a/modules/demux/playlist/zpl.c b/modules/demux/playlist/zpl.c
index f909c47..a53b1d7 100644
--- a/modules/demux/playlist/zpl.c
+++ b/modules/demux/playlist/zpl.c
@@ -195,7 +195,7 @@ static int Demux( demux_t *p_demux )
             SET( psz_publisher, Publisher );
 #undef SET
 
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
         }
         else
             msg_Warn( p_demux, "invalid line '%s'", psz_parse );
@@ -207,7 +207,7 @@ static int Demux( demux_t *p_demux )
 
     input_item_node_PostAndDelete( p_subitems );
 
-    vlc_gc_decref(p_current_input);
+    input_item_Release(p_current_input);
 
     // Free everything if the file is wrongly formated
     free( psz_title );
diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m
index 631af73..ce2a38c 100644
--- a/modules/gui/macosx/ConvertAndSave.m
+++ b/modules/gui/macosx/ConvertAndSave.m
@@ -319,7 +319,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
         msg_Err(VLCIntf, "CAS: playlist add input failed :(");
 
     /* we're done with this input */
-    vlc_gc_decref(p_input);
+    input_item_Release(p_input);
 
     [_window performClose:sender];
 }
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index 6582642..c104706 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1130,7 +1130,7 @@
         /* Add the item */
         int returnValue = playlist_AddInput(p_playlist, p_input, PLAYLIST_INSERT, i_position == -1 ? PLAYLIST_END : i_position + i_item, b_usingPlaylist, pl_Locked);
         if (returnValue != VLC_SUCCESS) {
-            vlc_gc_decref(p_input);
+            input_item_Release(p_input);
             continue;
         }
 
@@ -1139,7 +1139,7 @@
             playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_item->p_parent, p_item);
         }
 
-        vlc_gc_decref(p_input);
+        input_item_Release(p_input);
     }
     PL_UNLOCK;
     [self playlistUpdated];
@@ -1176,7 +1176,7 @@
             playlist_Control(p_playlist, PLAYLIST_VIEWPLAY, pl_Locked, p_node, p_item);
         }
         PL_UNLOCK;
-        vlc_gc_decref(p_input);
+        input_item_Release(p_input);
     }
     [self playlistUpdated];
 }
diff --git a/modules/gui/macosx/playlistinfo.m b/modules/gui/macosx/playlistinfo.m
index 40bb85f..93af415 100644
--- a/modules/gui/macosx/playlistinfo.m
+++ b/modules/gui/macosx/playlistinfo.m
@@ -130,7 +130,7 @@ static VLCInfo *_o_sharedInstance = nil;
     [rootItem release];
 
     if (p_item)
-        vlc_gc_decref(p_item);
+        input_item_Release(p_item);
 
     [super dealloc];
 }
@@ -185,9 +185,9 @@ static VLCInfo *_o_sharedInstance = nil;
 {
     NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
     if (_p_item != p_item) {
-        if (p_item) vlc_gc_decref(p_item);
+        if (p_item) input_item_Release(p_item);
         [o_saveMetaData_btn setEnabled: NO];
-        if (_p_item) vlc_gc_incref(_p_item);
+        if (_p_item) input_item_Hold(_p_item);
         p_item = _p_item;
     }
 
@@ -370,7 +370,7 @@ error:
 
 - (input_item_t *)item
 {
-    if (p_item) vlc_gc_incref(p_item);
+    if (p_item) input_item_Hold(p_item);
     return p_item;
 }
 
@@ -449,7 +449,7 @@ error:
     if (o_children != IsALeafNode) [o_children release];
     [o_name release];
     [o_value release];
-    if (p_item) vlc_gc_decref(p_item);
+    if (p_item) input_item_Release(p_item);
     [super dealloc];
 }
 
@@ -496,7 +496,7 @@ error:
     input_item_t * oldItem = p_item;
     p_item = [(VLCInfo *)[[VLCMain sharedInstance] info] item];
     if (oldItem && oldItem != p_item)
-        vlc_gc_decref(oldItem);
+        input_item_Release(oldItem);
 
     [o_children release];
     o_children = nil;
diff --git a/modules/gui/macosx/wizard.m b/modules/gui/macosx/wizard.m
index e8c832f..093aef5 100644
--- a/modules/gui/macosx/wizard.m
+++ b/modules/gui/macosx/wizard.m
@@ -1252,7 +1252,7 @@ static VLCWizard *_o_sharedInstance = nil;
                 PL_UNLOCK;
             }
 
-            vlc_gc_decref( p_input);
+            input_item_Release( p_input);
             x += 1;
         }
 
diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp
index 84babdb..e18f20e 100644
--- a/modules/gui/qt4/components/interface_widgets.cpp
+++ b/modules/gui/qt4/components/interface_widgets.cpp
@@ -654,7 +654,7 @@ CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
     p_item = THEMIM->currentInputItem();
     if( p_item )
     {
-        vlc_gc_incref( p_item );
+        input_item_Hold( p_item );
         showArtUpdate( p_item );
     }
     else
@@ -666,14 +666,14 @@ CoverArtLabel::~CoverArtLabel()
     QList< QAction* > artActions = actions();
     foreach( QAction *act, artActions )
         removeAction( act );
-    if ( p_item ) vlc_gc_decref( p_item );
+    if ( p_item ) input_item_Release( p_item );
 }
 
 void CoverArtLabel::setItem( input_item_t *_p_item )
 {
-    if ( p_item ) vlc_gc_decref( p_item );
+    if ( p_item ) input_item_Release( p_item );
     p_item = _p_item;
-    if ( p_item ) vlc_gc_incref( p_item );
+    if ( p_item ) input_item_Hold( p_item );
 }
 
 void CoverArtLabel::showArtUpdate( const QString& url )
diff --git a/modules/gui/qt4/components/playlist/playlist_item.cpp b/modules/gui/qt4/components/playlist/playlist_item.cpp
index 0fbbcba..9cca926 100644
--- a/modules/gui/qt4/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_item.cpp
@@ -59,7 +59,7 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent )
     parentItem = parent;          /* Can be NULL, but only for the rootItem */
     i_playlist_id = _playlist_item->i_id;           /* Playlist item specific id */
     p_input = _playlist_item->p_input;
-    vlc_gc_incref( p_input );
+    input_item_Hold( p_input );
 }
 
 /*
@@ -78,7 +78,7 @@ PLItem::PLItem( playlist_item_t * p_item )
 
 PLItem::~PLItem()
 {
-    vlc_gc_decref( p_input );
+    input_item_Release( p_input );
     qDeleteAll( children );
     children.clear();
 }
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index f9d7f85..4012fc1 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -1003,12 +1003,12 @@ bool PLModel::isSupportedAction( actions action, const QModelIndex &index ) cons
 PlMimeData::~PlMimeData()
 {
     foreach( input_item_t *p_item, _inputItems )
-        vlc_gc_decref( p_item );
+        input_item_Release( p_item );
 }
 
 void PlMimeData::appendItem( input_item_t *p_item )
 {
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     _inputItems.append( p_item );
 }
 
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
index 41ad88d..89a7f7b 100644
--- a/modules/gui/qt4/components/playlist/selector.cpp
+++ b/modules/gui/qt4/components/playlist/selector.cpp
@@ -171,7 +171,7 @@ PLSelector::~PLSelector()
         {
             QTreeWidgetItem *item = podcastsParent->child(i);
             input_item_t *p_input = item->data( 0, IN_ITEM_ROLE ).value<input_item_t*>();
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
         }
     }
 }
@@ -431,7 +431,7 @@ PLSelItem * PLSelector::addItem (
 
 PLSelItem *PLSelector::addPodcastItem( playlist_item_t *p_item )
 {
-    vlc_gc_incref( p_item->p_input );
+    input_item_Hold( p_item->p_input );
 
     char *psz_name = input_item_GetName( p_item->p_input );
     PLSelItem *item = addItem( PL_ITEM_TYPE,  psz_name, false, false, podcastsParent );
@@ -539,7 +539,7 @@ void PLSelector::plItemRemoved( int id )
         {
             input_item_t *p_input = item->data( 0, IN_ITEM_ROLE ).value<input_item_t*>();
             //msg_Dbg( p_intf, "Removing podcast: (%d) %s", id, p_input->psz_uri );
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
             delete item;
             return;
         }
diff --git a/modules/gui/qt4/dialogs/epg.cpp b/modules/gui/qt4/dialogs/epg.cpp
index bedd3da..bc975c8 100644
--- a/modules/gui/qt4/dialogs/epg.cpp
+++ b/modules/gui/qt4/dialogs/epg.cpp
@@ -130,13 +130,13 @@ void EpgDialog::updateInfos()
     {
         PL_LOCK; /* as input_GetItem still unfixed */
         p_input_item = input_GetItem( p_input_thread );
-        if ( p_input_item ) vlc_gc_incref( p_input_item );
+        if ( p_input_item ) input_item_Hold( p_input_item );
         PL_UNLOCK;
         vlc_object_release( p_input_thread );
         if ( p_input_item )
         {
             epg->updateEPG( p_input_item );
-            vlc_gc_decref( p_input_item );
+            input_item_Release( p_input_item );
             if ( isVisible() ) timer->start();
         }
     }
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index dac3bc3..06d19ef 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -81,13 +81,13 @@ public:
         : QEvent( (QEvent::Type)(type) )
     {
         if( (p_item = p_input) != NULL )
-            vlc_gc_incref( p_item );
+            input_item_Hold( p_item );
     }
 
     virtual ~IMEvent()
     {
         if( p_item )
-            vlc_gc_decref( p_item );
+            input_item_Release( p_item );
     }
 
     input_item_t *item() const { return p_item; };
diff --git a/modules/gui/skins2/commands/cmd_vars.hpp b/modules/gui/skins2/commands/cmd_vars.hpp
index a27e7aa..634d01e 100644
--- a/modules/gui/skins2/commands/cmd_vars.hpp
+++ b/modules/gui/skins2/commands/cmd_vars.hpp
@@ -46,12 +46,12 @@ public:
         CmdGeneric( pIntf ), m_pItem( pItem )
     {
         if( pItem )
-            vlc_gc_incref( pItem );
+            input_item_Hold( pItem );
     }
     virtual ~CmdItemUpdate()
     {
         if( m_pItem )
-            vlc_gc_decref( m_pItem );
+            input_item_Release( m_pItem );
     }
     virtual void execute();
     virtual string getType() const { return "playtree update"; }
diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 5958af1..ae8d217 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -580,7 +580,7 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
                                       vlc_InputItemMetaChanged,
                                       inputItemMetaChanged,
                                       p_ext );
-                    vlc_gc_decref( p_item );
+                    input_item_Release( p_item );
                 }
                 vlc_object_release( old );
             }
@@ -599,7 +599,7 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
                 p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
             {
                 p_item = input_GetItem( p_ext->p_sys->p_input );
-                vlc_gc_incref( p_item );
+                input_item_Hold( p_item );
                 vlc_event_attach( &p_item->event_manager,
                                   vlc_InputItemMetaChanged,
                                   inputItemMetaChanged,
@@ -659,7 +659,7 @@ int lua_ExtensionDeactivate( extensions_manager_t *p_mgr, extension_t *p_ext )
         {
             // Release item
             input_item_t *p_item = input_GetItem( p_ext->p_sys->p_input );
-            vlc_gc_decref( p_item );
+            input_item_Release( p_item );
         }
         vlc_object_release( p_ext->p_sys->p_input );
         p_ext->p_sys->p_input = NULL;
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 5b80080..6087b11 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -250,14 +250,14 @@ static int vlclua_input_item_delete( lua_State *L )
         return luaL_error( L, "script went completely foobar" );
 
     *pp_item = NULL;
-    vlc_gc_decref( p_item );
+    input_item_Release( p_item );
 
     return 1;
 }
 
 static int vlclua_input_item_get( lua_State *L, input_item_t *p_item )
 {
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     input_item_t **pp = lua_newuserdata( L, sizeof( input_item_t* ) );
     *pp = p_item;
 
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index f162847..fe536a8 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -301,7 +301,7 @@ static int vlclua_sd_add_item( lua_State *L )
                     lua_setfield( L, -2, "__metatable" );
                 }
                 lua_setmetatable( L, -2 );
-                vlc_gc_decref( p_input );
+                input_item_Release( p_input );
             }
             while( i_options > 0 )
                 free( ppsz_options[--i_options] );
@@ -404,7 +404,7 @@ static int vlclua_node_add_subitem( lua_State *L )
                         lua_setfield( L, -2, "__metatable" );
                     }
                     lua_setmetatable( L, -2 );
-                    vlc_gc_decref( p_input );
+                    input_item_Release( p_input );
                 }
                 while( i_options > 0 )
                     free( ppsz_options[--i_options] );
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index eac7724..67fa5d2 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -583,7 +583,7 @@ int vlclua_playlist_add_internal( vlc_object_t *p_this, lua_State *L,
                                ( b_play ? PLAYLIST_GO : PLAYLIST_PREPARSE ),
                                PLAYLIST_END, true, false );
                     i_count ++; /* increment counter */
-                    vlc_gc_decref( p_input );
+                    input_item_Release( p_input );
                     while( i_options > 0 )
                         free( ppsz_options[--i_options] );
                     free( ppsz_options );
diff --git a/modules/services_discovery/bonjour.c b/modules/services_discovery/bonjour.c
index e118ab2..0d19279 100644
--- a/modules/services_discovery/bonjour.c
+++ b/modules/services_discovery/bonjour.c
@@ -184,7 +184,7 @@ static void resolve_callback(
             vlc_dictionary_insert( &p_sys->services_name_to_input_item,
                 name, p_input );
             services_discovery_AddItem( p_sd, p_input, NULL /* no category */ );
-            vlc_gc_decref( p_input );
+            input_item_Release( p_input );
        }
     }
 
diff --git a/modules/services_discovery/mediadirs.c b/modules/services_discovery/mediadirs.c
index 0e081e9..6aae067 100644
--- a/modules/services_discovery/mediadirs.c
+++ b/modules/services_discovery/mediadirs.c
@@ -209,7 +209,7 @@ static void *Run( void *data )
         vlc_event_detach( p_em, vlc_InputItemSubItemAdded,
                           input_item_subitem_added, p_sd );
 
-        vlc_gc_decref( p_root );
+        input_item_Release( p_root );
         free( psz_uri );
     }
 
@@ -300,7 +300,7 @@ static int onNewFileAdded( vlc_object_t *p_this, char const *psz_var,
         }
     }
 
-    vlc_gc_decref( p_item );
+    input_item_Release( p_item );
     free( psz_uri );
 
     return VLC_SUCCESS;
diff --git a/modules/services_discovery/mtp.c b/modules/services_discovery/mtp.c
index a0e4ed5..3ee5ac8 100644
--- a/modules/services_discovery/mtp.c
+++ b/modules/services_discovery/mtp.c
@@ -280,7 +280,7 @@ static void CloseDevice( services_discovery_t *p_sd )
             if( pp_items[i_i] != NULL )
             {
                 services_discovery_RemoveItem( p_sd, pp_items[i_i] );
-                vlc_gc_decref( pp_items[i_i] );
+                input_item_Release( pp_items[i_i] );
             }
         }
         free( pp_items );
diff --git a/modules/services_discovery/podcast.c b/modules/services_discovery/podcast.c
index d3064f2..d386c51 100644
--- a/modules/services_discovery/podcast.c
+++ b/modules/services_discovery/podcast.c
@@ -194,7 +194,7 @@ static void Close( vlc_object_t *p_this )
     free( p_sd->p_sys->pp_input );
     for( i = 0; i < p_sys->i_urls; i++ ) free( p_sys->ppsz_urls[i] );
     free( p_sys->ppsz_urls );
-    for( i = 0; i < p_sys->i_items; i++ ) vlc_gc_decref( p_sys->pp_items[i] );
+    for( i = 0; i < p_sys->i_items; i++ ) input_item_Release( p_sys->pp_items[i] );
     free( p_sys->pp_items );
     free( p_sys->psz_request );
     free( p_sys );
@@ -345,7 +345,7 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
         if( j == i_new_items )
         {
             services_discovery_RemoveItem( p_sd, p_sys->pp_items[i] );
-            vlc_gc_decref( p_sys->pp_items[i] );
+            input_item_Release( p_sys->pp_items[i] );
         }
     }
     free( p_sys->pp_items );
@@ -411,7 +411,7 @@ static void ParseRequest( services_discovery_t *p_sd )
         if( i != p_sys->i_urls )
         {
             services_discovery_RemoveItem( p_sd, p_sys->pp_items[i] );
-            vlc_gc_decref( p_sys->pp_items[i] );
+            input_item_Release( p_sys->pp_items[i] );
             REMOVE_ELEM( p_sys->ppsz_urls, p_sys->i_urls, i );
             REMOVE_ELEM( p_sys->pp_items, p_sys->i_items, i );
         }
diff --git a/modules/services_discovery/pulse.c b/modules/services_discovery/pulse.c
index a981154..f2fb569 100644
--- a/modules/services_discovery/pulse.c
+++ b/modules/services_discovery/pulse.c
@@ -120,7 +120,7 @@ static void DestroySource (void *data)
     struct device *d = data;
 
     services_discovery_RemoveItem (d->sd, d->item);
-    vlc_gc_decref (d->item);
+    input_item_Release (d->item);
     free (d);
 }
 
@@ -158,7 +158,7 @@ static int AddSource (services_discovery_t *sd, const pa_source_info *info)
     struct device *d = malloc (sizeof (*d));
     if (unlikely(d == NULL))
     {
-        vlc_gc_decref (item);
+        input_item_Release (item);
         return -1;
     }
     d->index = info->index;
@@ -168,7 +168,7 @@ static int AddSource (services_discovery_t *sd, const pa_source_info *info)
     if (dp == NULL) /* Out-of-memory */
     {
         free (d);
-        vlc_gc_decref (item);
+        input_item_Release (item);
         return -1;
     }
     if (*dp != d) /* Update existing source */
@@ -177,7 +177,7 @@ static int AddSource (services_discovery_t *sd, const pa_source_info *info)
         d = *dp;
         input_item_SetURI (d->item, item->psz_uri);
         input_item_SetName (d->item, item->psz_name);
-        vlc_gc_decref (item);
+        input_item_Release (item);
         return 0;
     }
 
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 430d234..9c7d3e8 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -1567,7 +1567,7 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
     if( p_announce->p_item )
     {
         services_discovery_RemoveItem( p_sd, p_announce->p_item );
-        vlc_gc_decref( p_announce->p_item );
+        input_item_Release( p_announce->p_item );
         p_announce->p_item = NULL;
     }
 
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index e70f5c6..0a9591b 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -150,7 +150,7 @@ static void DestroyDevice (void *data)
 
     if (d->sd)
         services_discovery_RemoveItem (d->sd, d->item);
-    vlc_gc_decref (d->item);
+    input_item_Release (d->item);
     free (d);
 }
 
@@ -179,7 +179,7 @@ static int AddDevice (services_discovery_t *sd, struct udev_device *dev)
     struct device *d = malloc (sizeof (*d));
     if (d == NULL)
     {
-        vlc_gc_decref (item);
+        input_item_Release (item);
         return -1;
     }
     d->devnum = udev_device_get_devnum (dev);
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 5cecff2..b5b1a24 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -1054,9 +1054,9 @@ void MediaServer::setInputItem( input_item_t* p_input_item )
         return;
 
     if( _p_input_item )
-        vlc_gc_decref( _p_input_item );
+        input_item_Release( _p_input_item );
 
-    vlc_gc_incref( p_input_item );
+    input_item_Hold( p_input_item );
     _p_input_item = p_input_item;
 }
 
@@ -1183,7 +1183,7 @@ Item::Item( Container* p_parent,
 Item::~Item()
 {
     if( _p_input_item )
-        vlc_gc_decref( _p_input_item );
+        input_item_Release( _p_input_item );
 }
 
 const char* Item::getObjectID() const
@@ -1276,9 +1276,9 @@ void Item::setInputItem( input_item_t* p_input_item )
         return;
 
     if( _p_input_item )
-        vlc_gc_decref( _p_input_item );
+        input_item_Release( _p_input_item );
 
-    vlc_gc_incref( p_input_item );
+    input_item_Hold( p_input_item );
     _p_input_item = p_input_item;
 }
 
@@ -1310,7 +1310,7 @@ Container::~Container()
     }
 
     if( _p_input_item )
-        vlc_gc_decref( _p_input_item );
+        input_item_Release( _p_input_item );
 }
 
 void Container::addItem( Item* item )
@@ -1366,9 +1366,9 @@ void Container::setInputItem( input_item_t* p_input_item )
         return;
 
     if( _p_input_item )
-        vlc_gc_decref( _p_input_item );
+        input_item_Release( _p_input_item );
 
-    vlc_gc_incref( p_input_item );
+    input_item_Hold( p_input_item );
     _p_input_item = p_input_item;
 }
 
diff --git a/modules/services_discovery/xcb_apps.c b/modules/services_discovery/xcb_apps.c
index 1db34f5..5a0f3e6 100644
--- a/modules/services_discovery/xcb_apps.c
+++ b/modules/services_discovery/xcb_apps.c
@@ -266,7 +266,7 @@ static struct app *AddApp (services_discovery_t *sd, xcb_window_t xid)
     struct app *app = malloc (sizeof (*app));
     if (app == NULL)
     {
-        vlc_gc_decref (item);
+        input_item_Release (item);
         return NULL;
     }
     app->xid = xid;
@@ -281,7 +281,7 @@ static void DelApp (void *data)
     struct app *app = data;
 
     services_discovery_RemoveItem (app->owner, app->item);
-    vlc_gc_decref (app->item);
+    input_item_Release (app->item);
     free (app);
 }
 
diff --git a/src/input/input.c b/src/input/input.c
index 7e71d4e..f2a6468 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -345,7 +345,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->p_sout   = NULL;
     p_input->p->b_out_pace_control = false;
 
-    vlc_gc_incref( p_item ); /* Released in Destructor() */
+    input_item_Hold( p_item ); /* Released in Destructor() */
     p_input->p->p_item = p_item;
 
     /* Init Input fields */
@@ -490,7 +490,7 @@ static void Destructor( input_thread_t * p_input )
     if( p_input->p->p_resource_private )
         input_resource_Release( p_input->p->p_resource_private );
 
-    vlc_gc_decref( p_input->p->p_item );
+    input_item_Release( p_input->p->p_item );
 
     vlc_mutex_destroy( &p_input->p->counters.counters_lock );
 
diff --git a/src/input/item.c b/src/input/item.c
index b27250b..f26c238 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -992,7 +992,7 @@ input_item_node_t *input_item_node_Create( input_item_t *p_input )
     assert( p_input );
 
     p_node->p_item = p_input;
-    vlc_gc_incref( p_input );
+    input_item_Hold( p_input );
 
     p_node->p_parent = NULL;
     p_node->i_children = 0;
@@ -1006,7 +1006,7 @@ static void RecursiveNodeDelete( input_item_node_t *p_node )
     for( int i = 0; i < p_node->i_children; i++ )
         RecursiveNodeDelete( p_node->pp_children[i] );
 
-    vlc_gc_decref( p_node->p_item );
+    input_item_Release( p_node->p_item );
     free( p_node->pp_children );
     free( p_node );
 }
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 5c78179..d02c3b5 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -603,7 +603,7 @@ static int vlm_OnMediaUpdate( vlm_t *p_vlm, vlm_media_sys_t *p_media )
             char *psz_dup;
             int i;
 
-            vlc_gc_decref( p_media->vod.p_item );
+            input_item_Release( p_media->vod.p_item );
 
             if( strstr( p_cfg->ppsz_input[0], "://" ) == NULL )
             {
@@ -811,7 +811,7 @@ static int vlm_ControlMediaDel( vlm_t *p_vlm, int64_t id )
 
     vlm_media_Clean( &p_media->cfg );
 
-    vlc_gc_decref( p_media->vod.p_item );
+    input_item_Release( p_media->vod.p_item );
 
     if( p_media->vod.p_media )
         p_vlm->p_vod->pf_media_del( p_vlm->p_vod, p_media->vod.p_media );
@@ -916,7 +916,7 @@ static void vlm_MediaInstanceDelete( vlm_t *p_vlm, int64_t id, vlm_media_instanc
     vlc_object_release( p_instance->p_parent );
 
     TAB_REMOVE( p_media->i_instance, p_media->instance, p_instance );
-    vlc_gc_decref( p_instance->p_item );
+    input_item_Release( p_instance->p_item );
     free( p_instance->psz_name );
     free( p_instance );
 }
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index ebb46dc..59ad0fc 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -352,13 +352,13 @@ void playlist_Destroy( playlist_t *p_playlist )
     /* Remove all remaining items */
     FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
         free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
+        input_item_Release( p_del->p_input );
         free( p_del );
     FOREACH_END();
     ARRAY_RESET( p_playlist->all_items );
     FOREACH_ARRAY( playlist_item_t *p_del, p_sys->items_to_delete )
         free( p_del->pp_children );
-        vlc_gc_decref( p_del->p_input );
+        input_item_Release( p_del->p_input );
         free( p_del );
     FOREACH_END();
     ARRAY_RESET( p_sys->items_to_delete );
diff --git a/src/playlist/fetcher.c b/src/playlist/fetcher.c
index efb0c2a..f919adc 100644
--- a/src/playlist/fetcher.c
+++ b/src/playlist/fetcher.c
@@ -120,7 +120,7 @@ void playlist_fetcher_Push( playlist_fetcher_t *p_fetcher, input_item_t *p_item,
     fetcher_entry_t *p_entry = malloc( sizeof(fetcher_entry_t) );
     if ( !p_entry ) return;
 
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     p_entry->p_item = p_item;
     p_entry->p_next = NULL;
     p_entry->i_options = i_options;
@@ -155,7 +155,7 @@ void playlist_fetcher_Delete( playlist_fetcher_t *p_fetcher )
         while( p_fetcher->p_waiting_head[i_queue] )
         {
             p_next = p_fetcher->p_waiting_head[i_queue]->p_next;
-            vlc_gc_decref( p_fetcher->p_waiting_head[i_queue]->p_item );
+            input_item_Release( p_fetcher->p_waiting_head[i_queue]->p_item );
             free( p_fetcher->p_waiting_head[i_queue] );
             p_fetcher->p_waiting_head[i_queue] = p_next;
         }
@@ -543,7 +543,7 @@ static void *Thread( void *p_data )
                 input_item_SetArtNotFound( p_entry->p_item, true );
             }
             free( psz_name );
-            vlc_gc_decref( p_entry->p_item );
+            input_item_Release( p_entry->p_item );
             free( p_entry );
         }
     }
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 9281481..7fa0c4c 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -230,7 +230,7 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
     assert( p_input );
 
     p_item->p_input = p_input;
-    vlc_gc_incref( p_item->p_input );
+    input_item_Hold( p_item->p_input );
 
     p_item->i_id = ++pl_priv(p_playlist)->i_last_playlist_id;
 
@@ -426,7 +426,7 @@ int playlist_AddExt( playlist_t *p_playlist, const char * psz_uri,
         return VLC_ENOMEM;
     i_ret = playlist_AddInput( p_playlist, p_input, i_mode, i_pos, b_playlist,
                                b_locked );
-    vlc_gc_decref( p_input );
+    input_item_Release( p_input );
     return i_ret;
 }
 
@@ -897,7 +897,7 @@ static int RecursiveInsertCopy (
         else
             p_new_item = playlist_NodeCreate( p_playlist, NULL,
                                  p_parent, i_pos, 0, p_new_input );
-        vlc_gc_decref( p_new_input );
+        input_item_Release( p_new_input );
         if( !p_new_item ) return i_pos;
 
         i_pos++;
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index 605059f..c9722fe 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -155,7 +155,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
 
     const char *const options[1] = { "meta-file", };
     /* that option has to be cleaned in input_item_subitem_tree_added() */
-    /* vlc_gc_decref() in the same function */
+    /* input_item_Release() in the same function */
     p_input = input_item_NewExt( psz_uri, _("Media Library"),
                                  1, options, VLC_INPUT_OPTION_TRUSTED, -1 );
     free( psz_uri );
@@ -164,7 +164,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
 
     PL_LOCK;
     if( p_playlist->p_media_library->p_input )
-        vlc_gc_decref( p_playlist->p_media_library->p_input );
+        input_item_Release( p_playlist->p_media_library->p_input );
 
     p_playlist->p_media_library->p_input = p_input;
 
diff --git a/src/playlist/preparser.c b/src/playlist/preparser.c
index b44b9f8..3b9b24a 100644
--- a/src/playlist/preparser.c
+++ b/src/playlist/preparser.c
@@ -74,7 +74,7 @@ playlist_preparser_t *playlist_preparser_New( vlc_object_t *parent )
 void playlist_preparser_Push( playlist_preparser_t *p_preparser, input_item_t *p_item,
                               input_item_meta_request_option_t i_options )
 {
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     VLC_UNUSED( i_options );
 
     vlc_mutex_lock( &p_preparser->lock );
@@ -104,7 +104,7 @@ void playlist_preparser_Delete( playlist_preparser_t *p_preparser )
     /* Remove pending item to speed up preparser thread exit */
     while( p_preparser->i_waiting > 0 )
     {
-        vlc_gc_decref( p_preparser->pp_waiting[0] );
+        input_item_Release( p_preparser->pp_waiting[0] );
         REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
     }
 
@@ -223,7 +223,7 @@ static void *Thread( void *data )
         Preparse( obj, p_current );
 
         Art( p_preparser, p_current );
-        vlc_gc_decref(p_current);
+        input_item_Release(p_current);
     }
     return NULL;
 }
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index eca12b1..3a202e2 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -72,7 +72,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
     p_item = playlist_ItemNewFromInput( p_playlist,
                                         p_input ? p_input : p_new_input );
     if( p_new_input )
-        vlc_gc_decref( p_new_input );
+        input_item_Release( p_new_input );
 
     if( p_item == NULL )  return NULL;
     p_item->i_children = 0;
diff --git a/test/native/gc.c b/test/native/gc.c
index f52263a..70da068 100644
--- a/test/native/gc.c
+++ b/test/native/gc.c
@@ -25,14 +25,14 @@ static PyObject *gc_test( PyObject *self, PyObject *args )
 
      vlc_gc_init( gc, mygc_destructor, NULL );
      ASSERT( gc->i_gc_refcount == 0, "Refcount should be 0" );
-     vlc_gc_incref( gc );
+     input_item_Hold( gc );
      ASSERT( gc->i_gc_refcount == 1, "Refcount should be 1" );
-     vlc_gc_incref( gc );
+     input_item_Hold( gc );
      ASSERT( gc->i_gc_refcount == 2, "Refcount should be 2" );
      gc->i++;
-     vlc_gc_decref( gc );
+     input_item_Release( gc );
      ASSERT( gc->i_gc_refcount == 1, "Refcount should be 1" );
-     vlc_gc_decref( gc );
+     input_item_Release( gc );
 
      Py_INCREF( Py_None );
      return Py_None;
-- 
1.9.3




More information about the vlc-devel mailing list