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
4371ecfc
Commit
4371ecfc
authored
Jun 21, 2014
by
Julien 'Lta' BALLET
Committed by
Jean-Baptiste Kempf
Jun 24, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for pf_readdir access modules in Streams
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
214854fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
12 deletions
+55
-12
include/vlc_stream.h
include/vlc_stream.h
+6
-3
src/input/stream.c
src/input/stream.c
+48
-9
src/libvlccore.sym
src/libvlccore.sym
+1
-0
No files found.
include/vlc_stream.h
View file @
4371ecfc
...
...
@@ -65,9 +65,10 @@ struct stream_t
stream_t
*
p_source
;
/* */
int
(
*
pf_read
)
(
stream_t
*
,
void
*
p_read
,
unsigned
int
i_read
);
int
(
*
pf_peek
)
(
stream_t
*
,
const
uint8_t
**
pp_peek
,
unsigned
int
i_peek
);
int
(
*
pf_control
)(
stream_t
*
,
int
i_query
,
va_list
);
int
(
*
pf_read
)
(
stream_t
*
,
void
*
p_read
,
unsigned
int
i_read
);
int
(
*
pf_peek
)
(
stream_t
*
,
const
uint8_t
**
pp_peek
,
unsigned
int
i_peek
);
int
(
*
pf_readdir
)(
stream_t
*
,
input_item_node_t
*
);
int
(
*
pf_control
)(
stream_t
*
,
int
i_query
,
va_list
);
/* */
void
(
*
pf_destroy
)(
stream_t
*
);
...
...
@@ -92,6 +93,7 @@ enum stream_query_e
STREAM_CAN_FASTSEEK
,
/**< arg1= bool * res=cannot fail*/
STREAM_CAN_PAUSE
,
/**< arg1= bool * res=cannot fail*/
STREAM_CAN_CONTROL_PACE
,
/**< arg1= bool * res=cannot fail*/
STREAM_IS_DIRECTORY
,
/**< arg1= bool * res=cannot fail*/
/* */
STREAM_SET_POSITION
,
/**< arg1= uint64_t res=can fail */
...
...
@@ -132,6 +134,7 @@ VLC_API int stream_Control( stream_t *s, int i_query, ... );
VLC_API
block_t
*
stream_Block
(
stream_t
*
s
,
int
i_size
);
VLC_API
block_t
*
stream_BlockRemaining
(
stream_t
*
s
,
int
i_max_size
);
VLC_API
char
*
stream_ReadLine
(
stream_t
*
);
VLC_API
int
stream_ReadDir
(
stream_t
*
,
input_item_node_t
*
);
/**
* Get the current position in a stream
...
...
src/input/stream.c
View file @
4371ecfc
...
...
@@ -116,7 +116,8 @@ typedef struct
typedef
enum
{
STREAM_METHOD_BLOCK
,
STREAM_METHOD_STREAM
STREAM_METHOD_STREAM
,
STREAM_METHOD_READDIR
}
stream_read_method_t
;
struct
stream_sys_t
...
...
@@ -197,7 +198,11 @@ static int AStreamSeekStream( stream_t *s, uint64_t i_pos );
static
void
AStreamPrebufferStream
(
stream_t
*
s
);
static
int
AReadStream
(
stream_t
*
s
,
void
*
p_read
,
unsigned
int
i_read
);
/* ReadDir */
static
int
AStreamReadDir
(
stream_t
*
s
,
input_item_node_t
*
p_node
);
/* Common */
static
int
AStreamGenericError
(
)
{
return
VLC_EGENERIC
;
}
static
int
AStreamControl
(
stream_t
*
s
,
int
i_query
,
va_list
);
static
void
AStreamDestroy
(
stream_t
*
s
);
static
int
ASeek
(
stream_t
*
s
,
uint64_t
i_pos
);
...
...
@@ -285,8 +290,9 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
return
NULL
;
}
s
->
pf_read
=
NULL
;
/* Set up later */
s
->
pf_peek
=
NULL
;
s
->
pf_read
=
(
void
*
)
AStreamGenericError
;
/* Replaced later */
s
->
pf_peek
=
(
void
*
)
AStreamGenericError
;
s
->
pf_readdir
=
(
void
*
)
AStreamGenericError
;
s
->
pf_control
=
AStreamControl
;
s
->
pf_destroy
=
AStreamDestroy
;
...
...
@@ -294,8 +300,10 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
p_sys
->
p_access
=
p_access
;
if
(
p_access
->
pf_block
)
p_sys
->
method
=
STREAM_METHOD_BLOCK
;
else
else
if
(
p_access
->
pf_read
)
p_sys
->
method
=
STREAM_METHOD_STREAM
;
else
p_sys
->
method
=
STREAM_METHOD_READDIR
;
p_sys
->
i_pos
=
p_access
->
info
.
i_pos
;
...
...
@@ -385,12 +393,10 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
goto
error
;
}
}
else
else
if
(
p_sys
->
method
==
STREAM_METHOD_STREAM
)
{
int
i
;
assert
(
p_sys
->
method
==
STREAM_METHOD_STREAM
);
msg_Dbg
(
s
,
"Using stream method for AStream*"
);
s
->
pf_read
=
AStreamReadStream
;
...
...
@@ -426,6 +432,11 @@ stream_t *stream_AccessNew( access_t *p_access, char **ppsz_list )
goto
error
;
}
}
else
{
assert
(
p_sys
->
method
==
STREAM_METHOD_READDIR
);
s
->
pf_readdir
=
AStreamReadDir
;
}
return
s
;
...
...
@@ -434,7 +445,7 @@ error:
{
/* Nothing yet */
}
else
else
if
(
p_sys
->
method
==
STREAM_METHOD_STREAM
)
{
free
(
p_sys
->
stream
.
p_buffer
);
}
...
...
@@ -456,7 +467,7 @@ static void AStreamDestroy( stream_t *s )
if
(
p_sys
->
method
==
STREAM_METHOD_BLOCK
)
block_ChainRelease
(
p_sys
->
block
.
p_first
);
else
else
if
(
p_sys
->
method
==
STREAM_METHOD_STREAM
)
free
(
p_sys
->
stream
.
p_buffer
);
free
(
p_sys
->
p_peek
);
...
...
@@ -637,6 +648,13 @@ static int AStreamControl( stream_t *s, int i_query, va_list args )
return
ret
;
}
case
STREAM_IS_DIRECTORY
:
{
bool
*
pb_canreaddir
=
va_arg
(
args
,
bool
*
);
*
pb_canreaddir
=
p_sys
->
method
==
STREAM_METHOD_READDIR
;
return
VLC_SUCCESS
;
}
case
STREAM_SET_RECORD_STATE
:
default:
msg_Err
(
s
,
"invalid stream_vaControl query=0x%x"
,
i_query
);
...
...
@@ -1473,6 +1491,10 @@ char *stream_ReadLine( stream_t *s )
char
*
p_line
=
NULL
;
int
i_line
=
0
,
i_read
=
0
;
/* Let's fail quickly if this is a readdir access */
if
(
s
->
pf_read
==
NULL
)
return
NULL
;
for
(
;;
)
{
char
*
psz_eol
;
...
...
@@ -1830,6 +1852,15 @@ static int ASeek( stream_t *s, uint64_t i_pos )
return
p_access
->
pf_seek
(
p_access
,
i_pos
);
}
static
int
AStreamReadDir
(
stream_t
*
s
,
input_item_node_t
*
p_node
)
{
access_t
*
p_access
=
s
->
p_sys
->
p_access
;
if
(
p_access
->
pf_readdir
!=
NULL
)
return
p_access
->
pf_readdir
(
p_access
,
p_node
);
else
return
VLC_ENOITEM
;
}
/**
* Try to read "i_read" bytes into a buffer pointed by "p_read". If
...
...
@@ -1962,3 +1993,11 @@ block_t *stream_BlockRemaining( stream_t *s, int i_max_size )
return
p_block
;
}
/**
* Returns a node containing all the input_item of the directory pointer by
* this stream. returns VLC_SUCCESS on success.
*/
int
stream_ReadDir
(
stream_t
*
s
,
input_item_node_t
*
p_node
)
{
return
s
->
pf_readdir
(
s
,
p_node
);
}
src/libvlccore.sym
View file @
4371ecfc
...
...
@@ -402,6 +402,7 @@ stream_Read
stream_ReadLine
stream_UrlNew
stream_vaControl
stream_ReadDir
str_format_meta
str_format_time
str_duration
...
...
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