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
c95c5508
Commit
c95c5508
authored
Aug 18, 2003
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* all: added stream_DataPacket
parent
cd4cd776
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
6 deletions
+60
-6
include/ninput.h
include/ninput.h
+2
-1
src/input/stream.c
src/input/stream.c
+58
-5
No files found.
include/ninput.h
View file @
c95c5508
...
...
@@ -2,7 +2,7 @@
* ninput.h
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ninput.h,v 1.
4 2003/08/14 11:25:56 sigmunau
Exp $
* $Id: ninput.h,v 1.
5 2003/08/18 19:17:54 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -54,6 +54,7 @@ VLC_EXPORT( int, stream_vaControl, ( stream_t *, int i_query, v
VLC_EXPORT
(
int
,
stream_Control
,
(
stream_t
*
,
int
i_query
,
...
)
);
VLC_EXPORT
(
int
,
stream_Read
,
(
stream_t
*
,
void
*
p_read
,
int
i_read
)
);
VLC_EXPORT
(
int
,
stream_Peek
,
(
stream_t
*
,
uint8_t
**
pp_peek
,
int
i_peek
)
);
VLC_EXPORT
(
data_packet_t
*
,
stream_DataPacket
,
(
stream_t
*
,
int
i_size
,
vlc_bool_t
b_force
)
);
VLC_EXPORT
(
pes_packet_t
*
,
stream_PesPacket
,
(
stream_t
*
,
int
i_size
)
);
/**
* @}
...
...
src/input/stream.c
View file @
c95c5508
...
...
@@ -2,7 +2,7 @@
* stream.c
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: stream.c,v 1.
2 2003/08/14 11:25:56 sigmunau
Exp $
* $Id: stream.c,v 1.
3 2003/08/18 19:17:54 fenrir
Exp $
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
...
...
@@ -133,7 +133,7 @@ int stream_vaControl( stream_t *s, int i_query, va_list args )
if
(
s
->
p_input
->
stream
.
b_seekable
&&
(
s
->
p_input
->
stream
.
i_method
==
INPUT_METHOD_FILE
||
i64
-
s
->
p_input
->
stream
.
p_selected_area
->
i_tell
<
0
||
i64
-
s
->
p_input
->
stream
.
p_selected_area
->
i_tell
>
1024
)
)
i64
-
s
->
p_input
->
stream
.
p_selected_area
->
i_tell
>
4096
)
)
{
input_AccessReinit
(
s
->
p_input
);
s
->
p_input
->
pf_seek
(
s
->
p_input
,
i64
);
...
...
@@ -151,7 +151,8 @@ int stream_vaControl( stream_t *s, int i_query, va_list args )
{
int
i_read
;
i_read
=
input_SplitBuffer
(
s
->
p_input
,
&
p_data
,
__MIN
(
4096
,
i_skip
)
);
i_read
=
input_SplitBuffer
(
s
->
p_input
,
&
p_data
,
__MIN
(
(
int
)
s
->
p_input
->
i_bufsize
,
i_skip
)
);
if
(
i_read
<
0
)
{
return
VLC_EGENERIC
;
...
...
@@ -222,7 +223,8 @@ int stream_Read( stream_t *s, void *p_data, int i_data )
{
int
i_count
;
i_count
=
input_SplitBuffer
(
s
->
p_input
,
&
p_packet
,
__MIN
(
i_data
,
4096
)
);
i_count
=
input_SplitBuffer
(
s
->
p_input
,
&
p_packet
,
__MIN
(
i_data
,
(
int
)
s
->
p_input
->
i_bufsize
)
);
if
(
i_count
<=
0
)
{
return
i_read
;
...
...
@@ -288,7 +290,8 @@ pes_packet_t *stream_PesPacket( stream_t *s, int i_data )
{
int
i_read
;
i_read
=
input_SplitBuffer
(
s
->
p_input
,
&
p_packet
,
__MIN
(
i_data
,
4096
)
);
i_read
=
input_SplitBuffer
(
s
->
p_input
,
&
p_packet
,
__MIN
(
i_data
,
(
int
)
s
->
p_input
->
i_bufsize
)
);
if
(
i_read
<=
0
)
{
/* should occur only with EOF and max allocation reached
...
...
@@ -315,7 +318,57 @@ pes_packet_t *stream_PesPacket( stream_t *s, int i_data )
return
p_pes
;
}
/**
* Read i_size into a data_packet_t. If b_force is not set, fewer bytes can
* be returned. You should always set b_force, unless you know what you are
* doing.
*/
data_packet_t
*
stream_DataPacket
(
stream_t
*
s
,
int
i_size
,
vlc_bool_t
b_force
)
{
data_packet_t
*
p_pk
;
int
i_read
;
if
(
i_size
<=
0
)
{
p_pk
=
input_NewPacket
(
s
->
p_input
->
p_method_data
,
0
);
if
(
p_pk
)
{
p_pk
->
p_payload_end
=
p_pk
->
p_payload_start
;
}
return
p_pk
;
}
i_read
=
input_SplitBuffer
(
s
->
p_input
,
&
p_pk
,
i_size
);
if
(
i_read
<=
0
)
{
return
NULL
;
}
/* Should be really rare, near 0 */
if
(
i_read
<
i_size
&&
b_force
)
{
data_packet_t
*
p_old
=
p_pk
;
int
i_missing
=
i_size
-
i_read
;
p_pk
=
input_NewPacket
(
s
->
p_input
->
p_method_data
,
i_size
);
if
(
p_pk
==
NULL
)
{
input_DeletePacket
(
s
->
p_input
->
p_method_data
,
p_old
);
return
NULL
;
}
p_pk
->
p_payload_end
=
p_pk
->
p_payload_start
+
i_size
;
memcpy
(
p_pk
->
p_payload_start
,
p_old
->
p_payload_start
,
i_read
);
input_DeletePacket
(
s
->
p_input
->
p_method_data
,
p_old
);
if
(
stream_Read
(
s
,
&
p_pk
->
p_payload_start
[
i_read
],
i_missing
)
<
i_missing
)
{
input_DeletePacket
(
s
->
p_input
->
p_method_data
,
p_pk
);
return
NULL
;
}
}
return
p_pk
;
}
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