Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
da623e25
Commit
da623e25
authored
May 13, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input: private input item reference count
(And remove an useless constant function pointer.)
parent
c52e96aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
7 deletions
+28
-7
include/vlc_input_item.h
include/vlc_input_item.h
+9
-1
src/input/item.c
src/input/item.c
+15
-6
src/input/item.h
src/input/item.h
+2
-0
src/libvlccore.sym
src/libvlccore.sym
+2
-0
No files found.
include/vlc_input_item.h
View file @
da623e25
...
...
@@ -54,7 +54,6 @@ struct info_category_t
struct
input_item_t
{
VLC_GC_MEMBERS
int
i_id
;
/**< Identifier of the item */
char
*
psz_name
;
/**< text describing this item */
...
...
@@ -267,6 +266,15 @@ VLC_API input_item_t * input_item_NewExt( const char *psz_uri, const char *psz_n
*/
VLC_API
input_item_t
*
input_item_Copy
(
input_item_t
*
)
VLC_USED
;
/** Holds an input item, i.e. creates a new reference. */
VLC_API
input_item_t
*
input_item_Hold
(
input_item_t
*
);
/** Releases an input item, i.e. decrements its reference counter. */
VLC_API
void
input_item_Release
(
input_item_t
*
);
/* Historical hack... */
#define vlc_gc_incref(i) input_item_Hold(i)
#define vlc_gc_decref(i) input_item_Release(i)
/******************
* Input stats
...
...
src/input/item.c
View file @
da623e25
...
...
@@ -29,10 +29,8 @@
#include <vlc_common.h>
#include <vlc_url.h>
#include "vlc_playlist.h"
#include "vlc_interface.h"
#include <vlc_interface.h>
#include <vlc_charset.h>
#include <vlc_atomic.h>
#include "item.h"
#include "info.h"
...
...
@@ -407,11 +405,21 @@ bool input_item_IsArtFetched( input_item_t *p_item )
return
b_fetched
;
}
static
void
input_item_Destroy
(
gc_object_t
*
p_gc
)
input_item_t
*
input_item_Hold
(
input_item_t
*
p_item
)
{
input_item_t
*
p_item
=
vlc_priv
(
p_gc
,
input_item_t
);
input_item_owner_t
*
owner
=
item_owner
(
p_item
);
atomic_fetch_add
(
&
owner
->
refs
,
1
);
return
p_item
;
}
void
input_item_Release
(
input_item_t
*
p_item
)
{
input_item_owner_t
*
owner
=
item_owner
(
p_item
);
if
(
atomic_fetch_sub
(
&
owner
->
refs
,
1
)
!=
1
)
return
;
vlc_event_manager_fini
(
&
p_item
->
event_manager
);
free
(
p_item
->
psz_name
);
...
...
@@ -810,11 +818,12 @@ input_item_NewWithType( const char *psz_uri, const char *psz_name,
if
(
unlikely
(
owner
==
NULL
)
)
return
NULL
;
atomic_init
(
&
owner
->
refs
,
1
);
input_item_t
*
p_input
=
&
owner
->
item
;
vlc_event_manager_t
*
p_em
=
&
p_input
->
event_manager
;
p_input
->
i_id
=
atomic_fetch_add
(
&
last_input_id
,
1
);
vlc_gc_init
(
p_input
,
input_item_Destroy
);
vlc_mutex_init
(
&
p_input
->
lock
);
p_input
->
psz_name
=
NULL
;
...
...
src/input/item.h
View file @
da623e25
...
...
@@ -25,6 +25,7 @@
#define LIBVLC_INPUT_ITEM_H 1
#include "input_interface.h"
#include <vlc_atomic.h>
void
input_item_SetErrorWhenReading
(
input_item_t
*
p_i
,
bool
b_error
);
void
input_item_UpdateTracksInfo
(
input_item_t
*
item
,
const
es_format_t
*
fmt
);
...
...
@@ -32,6 +33,7 @@ void input_item_UpdateTracksInfo( input_item_t *item, const es_format_t *fmt );
typedef
struct
input_item_owner
{
input_item_t
item
;
atomic_uint
refs
;
}
input_item_owner_t
;
# define item_owner(item) ((struct input_item_owner *)(item))
...
...
src/libvlccore.sym
View file @
da623e25
...
...
@@ -197,6 +197,8 @@ input_item_MetaMatch
input_item_MergeInfos
input_item_NewExt
input_item_NewWithType
input_item_Hold
input_item_Release
input_item_node_AppendItem
input_item_node_AppendNode
input_item_node_Create
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment