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
9144bc11
Commit
9144bc11
authored
Mar 20, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DTV: remove useless reference counter
parent
6232d987
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
54 deletions
+2
-54
modules/access/dtv/access.c
modules/access/dtv/access.c
+2
-54
No files found.
modules/access/dtv/access.c
View file @
9144bc11
...
@@ -240,17 +240,9 @@ vlc_module_begin ()
...
@@ -240,17 +240,9 @@ vlc_module_begin ()
#endif
#endif
vlc_module_end
()
vlc_module_end
()
typedef
struct
{
uint16_t
pid
;
uint16_t
refs
;
}
pid_ref_t
;
struct
access_sys_t
struct
access_sys_t
{
{
dvb_device_t
*
dev
;
dvb_device_t
*
dev
;
pid_ref_t
*
refv
;
size_t
refc
;
};
};
struct
delsys
struct
delsys
...
@@ -317,8 +309,6 @@ static int Open (vlc_object_t *obj)
...
@@ -317,8 +309,6 @@ static int Open (vlc_object_t *obj)
}
}
sys
->
dev
=
dev
;
sys
->
dev
=
dev
;
sys
->
refv
=
NULL
;
sys
->
refc
=
0
;
access
->
p_sys
=
sys
;
access
->
p_sys
=
sys
;
if
(
freq
!=
0
)
if
(
freq
!=
0
)
...
@@ -356,7 +346,6 @@ static void Close (vlc_object_t *obj)
...
@@ -356,7 +346,6 @@ static void Close (vlc_object_t *obj)
access_t
*
access
=
(
access_t
*
)
obj
;
access_t
*
access
=
(
access_t
*
)
obj
;
access_sys_t
*
sys
=
access
->
p_sys
;
access_sys_t
*
sys
=
access
->
p_sys
;
free
(
sys
->
refv
);
dvb_close
(
sys
->
dev
);
dvb_close
(
sys
->
dev
);
free
(
sys
);
free
(
sys
);
}
}
...
@@ -383,44 +372,6 @@ static block_t *Read (access_t *access)
...
@@ -383,44 +372,6 @@ static block_t *Read (access_t *access)
return
block
;
return
block
;
}
}
/* A PID can be enabled multiple times by the demux, but packets must not be
* duplicated, so we need to do some reference counting. */
static
int
pid_ref
(
access_sys_t
*
sys
,
uint16_t
pid
)
{
pid_ref_t
*
tab
=
sys
->
refv
;
size_t
n
=
sys
->
refc
;
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
if
(
tab
[
i
].
pid
==
pid
)
return
++
tab
[
i
].
refs
;
}
tab
=
realloc
(
tab
,
(
n
+
1
)
*
sizeof
(
*
tab
));
if
(
unlikely
(
tab
==
NULL
))
return
-
1
;
tab
[
n
].
pid
=
pid
;
tab
[
n
].
refs
=
1
;
sys
->
refv
=
tab
;
sys
->
refc
=
n
;
return
0
;
}
static
int
pid_unref
(
access_sys_t
*
sys
,
uint16_t
pid
)
{
pid_ref_t
*
tab
=
sys
->
refv
;
size_t
n
=
sys
->
refc
;
/* FIXME? bound memory leak (worst case 32kb) until Close() */
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
if
(
tab
[
i
].
pid
==
pid
)
return
--
tab
[
i
].
refs
;
}
return
-
1
;
}
static
int
Control
(
access_t
*
access
,
int
query
,
va_list
args
)
static
int
Control
(
access_t
*
access
,
int
query
,
va_list
args
)
{
{
access_sys_t
*
sys
=
access
->
p_sys
;
access_sys_t
*
sys
=
access
->
p_sys
;
...
@@ -475,14 +426,11 @@ static int Control (access_t *access, int query, va_list args)
...
@@ -475,14 +426,11 @@ static int Control (access_t *access, int query, va_list args)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
if
(
add
)
if
(
add
)
{
{
if
(
pid_ref
(
sys
,
pid
)
==
0
&&
dvb_add_pid
(
dev
,
pid
))
if
(
dvb_add_pid
(
dev
,
pid
))
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
else
else
{
dvb_remove_pid
(
dev
,
pid
);
if
(
pid_unref
(
sys
,
pid
)
==
0
)
dvb_remove_pid
(
sys
->
dev
,
pid
);
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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