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
f6803667
Commit
f6803667
authored
Sep 02, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stream: privatize the destruction callback
parent
5d096c30
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
45 deletions
+38
-45
include/vlc_stream.h
include/vlc_stream.h
+0
-3
src/input/access.c
src/input/access.c
+2
-3
src/input/stream.c
src/input/stream.c
+16
-9
src/input/stream.h
src/input/stream.h
+2
-1
src/input/stream_demux.c
src/input/stream_demux.c
+9
-13
src/input/stream_filter.c
src/input/stream_filter.c
+7
-13
src/input/stream_memory.c
src/input/stream_memory.c
+2
-3
No files found.
include/vlc_stream.h
View file @
f6803667
...
...
@@ -61,9 +61,6 @@ struct stream_t
int
(
*
pf_seek
)(
stream_t
*
,
uint64_t
);
int
(
*
pf_control
)(
stream_t
*
,
int
i_query
,
va_list
);
/* */
void
(
*
pf_destroy
)(
stream_t
*
);
/* Private data for module */
stream_sys_t
*
p_sys
;
...
...
src/input/access.c
View file @
f6803667
...
...
@@ -348,7 +348,7 @@ static void AStreamDestroy(stream_t *s)
stream_t
*
stream_AccessNew
(
vlc_object_t
*
parent
,
input_thread_t
*
input
,
const
char
*
url
)
{
stream_t
*
s
=
stream_CommonNew
(
parent
);
stream_t
*
s
=
stream_CommonNew
(
parent
,
AStreamDestroy
);
if
(
unlikely
(
s
==
NULL
))
return
NULL
;
...
...
@@ -391,7 +391,6 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
s
->
pf_seek
=
AStreamSeek
;
s
->
pf_control
=
AStreamControl
;
s
->
pf_destroy
=
AStreamDestroy
;
s
->
p_sys
=
sys
;
if
(
cachename
!=
NULL
)
...
...
@@ -399,6 +398,6 @@ stream_t *stream_AccessNew(vlc_object_t *parent, input_thread_t *input,
return
s
;
error:
free
(
sys
);
stream_Delete
(
s
);
stream_
Common
Delete
(
s
);
return
NULL
;
}
src/input/stream.c
View file @
f6803667
...
...
@@ -44,6 +44,7 @@
typedef
struct
stream_priv_t
{
stream_t
stream
;
void
(
*
destroy
)(
stream_t
*
);
block_t
*
peek
;
uint64_t
offset
;
...
...
@@ -58,7 +59,7 @@ typedef struct stream_priv_t
/**
* Allocates a VLC stream object
*/
stream_t
*
stream_CommonNew
(
vlc_object_t
*
parent
)
stream_t
*
stream_CommonNew
(
vlc_object_t
*
parent
,
void
(
*
destroy
)(
stream_t
*
)
)
{
stream_priv_t
*
priv
=
vlc_custom_create
(
parent
,
sizeof
(
*
priv
),
"stream"
);
if
(
unlikely
(
priv
==
NULL
))
...
...
@@ -72,8 +73,9 @@ stream_t *stream_CommonNew(vlc_object_t *parent)
s
->
pf_read
=
NULL
;
s
->
pf_readdir
=
NULL
;
s
->
pf_control
=
NULL
;
s
->
pf_destroy
=
NULL
;
s
->
p_input
=
NULL
;
assert
(
destroy
!=
NULL
);
priv
->
destroy
=
destroy
;
priv
->
peek
=
NULL
;
priv
->
offset
=
0
;
...
...
@@ -85,16 +87,10 @@ stream_t *stream_CommonNew(vlc_object_t *parent)
return
s
;
}
/**
* Destroy a stream
*/
void
stream_Delete
(
stream_t
*
s
)
void
stream_CommonDelete
(
stream_t
*
s
)
{
stream_priv_t
*
priv
=
(
stream_priv_t
*
)
s
;
if
(
s
->
pf_destroy
!=
NULL
)
s
->
pf_destroy
(
s
);
if
(
priv
->
text
.
conv
!=
(
vlc_iconv_t
)(
-
1
))
vlc_iconv_close
(
priv
->
text
.
conv
);
...
...
@@ -105,6 +101,17 @@ void stream_Delete(stream_t *s)
vlc_object_release
(
s
);
}
/**
* Destroy a stream
*/
void
stream_Delete
(
stream_t
*
s
)
{
stream_priv_t
*
priv
=
(
stream_priv_t
*
)
s
;
priv
->
destroy
(
s
);
stream_CommonDelete
(
s
);
}
#undef stream_UrlNew
/****************************************************************************
* stream_UrlNew: create a stream from a access
...
...
src/input/stream.h
View file @
f6803667
...
...
@@ -29,7 +29,8 @@
#include <vlc_stream.h>
/* */
stream_t
*
stream_CommonNew
(
vlc_object_t
*
);
stream_t
*
stream_CommonNew
(
vlc_object_t
*
,
void
(
*
destroy
)(
stream_t
*
)
);
void
stream_CommonDelete
(
stream_t
*
s
);
/**
* This function creates a stream_t with an access_t back-end.
...
...
src/input/stream_demux.c
View file @
f6803667
...
...
@@ -68,21 +68,17 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
stream_t
*
s
;
stream_sys_t
*
p_sys
;
s
=
stream_CommonNew
(
p_obj
);
s
=
stream_CommonNew
(
p_obj
,
DStreamDelete
);
if
(
s
==
NULL
)
return
NULL
;
s
->
p_input
=
p_demux
->
p_input
;
s
->
pf_read
=
DStreamRead
;
s
->
pf_seek
=
NULL
;
s
->
pf_control
=
DStreamControl
;
s
->
pf_destroy
=
DStreamDelete
;
s
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
*
p_sys
)
);
if
(
!
s
->
p_sys
)
{
stream_Delete
(
s
);
return
NULL
;
}
if
(
unlikely
(
p_sys
==
NULL
)
)
goto
error
;
p_sys
->
out
=
out
;
p_sys
->
p_block
=
NULL
;
...
...
@@ -94,10 +90,8 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
/* decoder fifo */
if
(
(
p_sys
->
p_fifo
=
block_FifoNew
()
)
==
NULL
)
{
stream_Delete
(
s
);
free
(
p_sys
->
psz_name
);
free
(
p_sys
);
return
NULL
;
goto
error
;
}
atomic_init
(
&
p_sys
->
active
,
true
);
...
...
@@ -107,13 +101,15 @@ stream_t *stream_DemuxNew( demux_t *p_demux, const char *psz_demux, es_out_t *ou
{
vlc_mutex_destroy
(
&
p_sys
->
lock
);
block_FifoRelease
(
p_sys
->
p_fifo
);
stream_Delete
(
s
);
free
(
p_sys
->
psz_name
);
free
(
p_sys
);
return
NULL
;
goto
error
;
}
return
s
;
error:
free
(
p_sys
);
stream_CommonDelete
(
s
);
return
NULL
;
}
void
stream_DemuxSend
(
stream_t
*
s
,
block_t
*
p_block
)
...
...
src/input/stream_filter.c
View file @
f6803667
...
...
@@ -42,7 +42,7 @@ stream_t *stream_FilterNew( stream_t *p_source,
stream_t
*
s
;
assert
(
p_source
!=
NULL
);
s
=
stream_CommonNew
(
p_source
->
p_parent
);
s
=
stream_CommonNew
(
p_source
->
p_parent
,
StreamDelete
);
if
(
s
==
NULL
)
return
NULL
;
...
...
@@ -52,25 +52,19 @@ stream_t *stream_FilterNew( stream_t *p_source,
{
s
->
psz_url
=
strdup
(
p_source
->
psz_url
);
if
(
unlikely
(
s
->
psz_url
==
NULL
)
)
{
stream_Delete
(
s
);
return
NULL
;
}
goto
error
;
}
s
->
p_source
=
p_source
;
/* */
s
->
p_module
=
module_need
(
s
,
"stream_filter"
,
psz_stream_filter
,
true
);
if
(
!
s
->
p_module
)
{
stream_Delete
(
s
);
return
NULL
;
}
s
->
pf_destroy
=
StreamDelete
;
if
(
s
->
p_module
==
NULL
)
goto
error
;
return
s
;
error:
stream_CommonDelete
(
s
);
return
NULL
;
}
/* Add automatic stream filter */
...
...
src/input/stream_memory.c
View file @
f6803667
...
...
@@ -54,7 +54,7 @@ static void Delete ( stream_t * );
stream_t
*
stream_MemoryNew
(
vlc_object_t
*
p_this
,
uint8_t
*
p_buffer
,
uint64_t
i_size
,
bool
i_preserve_memory
)
{
stream_t
*
s
=
stream_CommonNew
(
p_this
);
stream_t
*
s
=
stream_CommonNew
(
p_this
,
Delete
);
stream_sys_t
*
p_sys
;
if
(
!
s
)
...
...
@@ -63,7 +63,7 @@ stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
s
->
p_sys
=
p_sys
=
malloc
(
sizeof
(
stream_sys_t
)
);
if
(
!
s
->
p_sys
)
{
stream_Delete
(
s
);
stream_
Common
Delete
(
s
);
return
NULL
;
}
p_sys
->
i_pos
=
0
;
...
...
@@ -74,7 +74,6 @@ stream_t *stream_MemoryNew( vlc_object_t *p_this, uint8_t *p_buffer,
s
->
pf_read
=
Read
;
s
->
pf_seek
=
Seek
;
s
->
pf_control
=
Control
;
s
->
pf_destroy
=
Delete
;
s
->
p_input
=
NULL
;
return
s
;
...
...
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