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
8d305dc5
Commit
8d305dc5
authored
Jan 20, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted mms access to block mode.
parent
31346a79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
116 deletions
+107
-116
modules/access/mms/mmsh.c
modules/access/mms/mmsh.c
+66
-65
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+41
-51
No files found.
modules/access/mms/mmsh.c
View file @
8d305dc5
...
...
@@ -52,7 +52,7 @@
int
MMSHOpen
(
access_t
*
);
void
MMSHClose
(
access_t
*
);
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
block_t
*
Block
(
access_t
*
p_access
);
static
ssize_t
ReadRedirect
(
access_t
*
,
uint8_t
*
,
size_t
);
static
int
Seek
(
access_t
*
,
int64_t
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
...
...
@@ -79,7 +79,7 @@ int MMSHOpen( access_t *p_access )
char
*
psz_location
=
NULL
;
char
*
psz_proxy
;
STANDARD_
READ
_ACCESS_INIT
STANDARD_
BLOCK
_ACCESS_INIT
p_sys
->
i_proto
=
MMS_PROTO_HTTP
;
p_sys
->
fd
=
-
1
;
...
...
@@ -183,6 +183,7 @@ int MMSHOpen( access_t *p_access )
free
(
psz_location
);
p_access
->
pf_block
=
NULL
;
p_access
->
pf_read
=
ReadRedirect
;
return
VLC_SUCCESS
;
}
...
...
@@ -257,7 +258,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
/* */
case
ACCESS_GET_MTU
:
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
*
pi_int
=
3
*
p_sys
->
asfh
.
i_min_data_packet_size
;
*
pi_int
=
0
;
break
;
case
ACCESS_GET_PTS_DELAY
:
...
...
@@ -336,88 +337,85 @@ static int Seek( access_t *p_access, int64_t i_pos )
}
/*****************************************************************************
* Read:
* Read
Redirect
:
*****************************************************************************/
static
ssize_t
ReadRedirect
(
access_t
*
p_access
,
uint8_t
*
p
,
size_t
i_len
)
{
VLC_UNUSED
(
p_access
);
VLC_UNUSED
(
p
);
VLC_UNUSED
(
i_len
);
return
0
;
}
/*****************************************************************************
*
Read
:
*
Block
:
*****************************************************************************/
static
ssize_t
Read
(
access_t
*
p_access
,
uint8_t
*
p_buffer
,
size_t
i_len
)
static
block_t
*
Block
(
access_t
*
p_access
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
size_t
i_copy
;
size_t
i_data
=
0
;
const
unsigned
i_packet_min
=
p_sys
->
asfh
.
i_min_data_packet_size
;
if
(
p_access
->
info
.
b_eof
)
return
0
;
if
(
p_access
->
info
.
i_pos
<
p_sys
->
i_start
+
p_sys
->
i_header
)
{
const
size_t
i_offset
=
p_access
->
info
.
i_pos
-
p_sys
->
i_start
;
const
size_t
i_copy
=
p_sys
->
i_header
-
i_offset
;
block_t
*
p_block
=
block_New
(
p_access
,
i_copy
);
if
(
!
p_block
)
return
NULL
;
while
(
i_data
<
(
size_t
)
i_len
)
memcpy
(
p_block
->
p_buffer
,
&
p_sys
->
p_header
[
i_offset
],
i_copy
);
p_access
->
info
.
i_pos
+=
i_copy
;
return
p_block
;
}
else
if
(
p_sys
->
i_packet_length
>
0
&&
p_sys
->
i_packet_used
<
__MAX
(
p_sys
->
i_packet_length
,
i_packet_min
)
)
{
if
(
p_access
->
info
.
i_pos
<
(
p_sys
->
i_start
+
p_sys
->
i_header
)
)
{
int
i_offset
=
p_access
->
info
.
i_pos
-
p_sys
->
i_start
;
i_copy
=
__MIN
(
p_sys
->
i_header
-
i_offset
,
(
int
)((
size_t
)
i_len
-
i_data
)
);
memcpy
(
&
p_buffer
[
i_data
],
&
p_sys
->
p_header
[
i_offset
],
i_copy
);
size_t
i_copy
=
0
;
size_t
i_padding
=
0
;
i_data
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
else
if
(
p_sys
->
i_packet_used
<
p_sys
->
i_packet_length
)
{
i_copy
=
__MIN
(
p_sys
->
i_packet_length
-
p_sys
->
i_packet_used
,
i_len
-
i_data
);
memcpy
(
&
p_buffer
[
i_data
],
&
p_sys
->
p_packet
[
p_sys
->
i_packet_used
],
i_copy
);
i_data
+=
i_copy
;
p_sys
->
i_packet_used
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
else
if
(
(
p_sys
->
i_packet_length
>
0
)
&&
((
int
)
p_sys
->
i_packet_used
<
p_sys
->
asfh
.
i_min_data_packet_size
)
)
{
i_copy
=
__MIN
(
p_sys
->
asfh
.
i_min_data_packet_size
-
p_sys
->
i_packet_used
,
i_len
-
i_data
);
memset
(
&
p_buffer
[
i_data
],
0
,
i_copy
);
if
(
p_sys
->
i_packet_used
<
p_sys
->
i_packet_length
)
i_copy
=
p_sys
->
i_packet_length
-
p_sys
->
i_packet_used
;
if
(
__MAX
(
p_sys
->
i_packet_used
,
p_sys
->
i_packet_length
)
<
i_packet_min
)
i_padding
=
i_packet_min
-
__MAX
(
p_sys
->
i_packet_used
,
p_sys
->
i_packet_length
);
block_t
*
p_block
=
block_New
(
p_access
,
i_copy
+
i_padding
);
if
(
!
p_block
)
return
NULL
;
if
(
i_copy
>
0
)
memcpy
(
&
p_block
->
p_buffer
[
0
],
&
p_sys
->
p_packet
[
p_sys
->
i_packet_used
],
i_copy
);
if
(
i_padding
>
0
)
memset
(
&
p_block
->
p_buffer
[
i_copy
],
0
,
i_padding
);
p_sys
->
i_packet_used
+=
i_copy
+
i_padding
;
p_access
->
info
.
i_pos
+=
i_copy
+
i_padding
;
return
p_block
;
i_data
+=
i_copy
;
p_sys
->
i_packet_used
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
chunk_t
ck
;
if
(
GetPacket
(
p_access
,
&
ck
)
)
{
int
i_ret
=
-
1
;
if
(
p_sys
->
b_broadcast
)
{
if
(
(
ck
.
i_type
==
0x4524
)
&&
(
ck
.
i_sequence
!=
0
)
)
i_ret
=
Restart
(
p_access
);
else
if
(
ck
.
i_type
==
0x4324
)
i_ret
=
Reset
(
p_access
);
}
else
if
(
i_ret
)
{
chunk_t
ck
;
if
(
GetPacket
(
p_access
,
&
ck
)
)
{
int
i_ret
=
-
1
;
if
(
p_sys
->
b_broadcast
)
{
if
(
(
ck
.
i_type
==
0x4524
)
&&
(
ck
.
i_sequence
!=
0
)
)
i_ret
=
Restart
(
p_access
);
else
if
(
ck
.
i_type
==
0x4324
)
i_ret
=
Reset
(
p_access
);
}
if
(
i_ret
)
{
p_access
->
info
.
b_eof
=
true
;
return
0
;
}
}
if
(
ck
.
i_type
!=
0x4424
)
{
p_sys
->
i_packet_used
=
0
;
p_sys
->
i_packet_length
=
0
;
}
p_access
->
info
.
b_eof
=
true
;
return
0
;
}
}
if
(
ck
.
i_type
!=
0x4424
)
{
p_sys
->
i_packet_used
=
0
;
p_sys
->
i_packet_length
=
0
;
}
return
(
i_data
)
;
return
NULL
;
}
/* */
...
...
@@ -706,6 +704,9 @@ static int Describe( access_t *p_access, char **ppsz_location )
p_sys
->
asfh
.
i_data_packets_count
,
p_sys
->
asfh
.
i_min_data_packet_size
);
if
(
p_sys
->
asfh
.
i_min_data_packet_size
<=
0
)
goto
error
;
asf_StreamSelect
(
&
p_sys
->
asfh
,
var_CreateGetInteger
(
p_access
,
"mms-maxbitrate"
),
var_CreateGetInteger
(
p_access
,
"mms-all"
),
...
...
modules/access/mms/mmstu.c
View file @
8d305dc5
...
...
@@ -76,7 +76,7 @@ int MMSTUOpen ( access_t * );
void
MMSTUClose
(
access_t
*
);
static
ssize_t
Read
(
access_t
*
,
uint8_t
*
,
size_t
);
static
block_t
*
Block
(
access_t
*
);
static
int
Seek
(
access_t
*
,
int64_t
);
static
int
Control
(
access_t
*
,
int
,
va_list
);
...
...
@@ -102,16 +102,12 @@ int MMSTUOpen( access_t *p_access )
int
i_status
;
/* Set up p_access */
p_access
->
pf_read
=
Read
;
p_access
->
pf_block
=
NULL
;
access_InitFields
(
p_access
);
p_access
->
pf_read
=
NULL
;
p_access
->
pf_block
=
Block
;
p_access
->
pf_control
=
Control
;
p_access
->
pf_seek
=
Seek
;
p_access
->
info
.
i_update
=
0
;
p_access
->
info
.
i_size
=
0
;
p_access
->
info
.
i_pos
=
0
;
p_access
->
info
.
b_eof
=
false
;
p_access
->
info
.
i_title
=
0
;
p_access
->
info
.
i_seekpoint
=
0
;
p_access
->
p_sys
=
p_sys
=
calloc
(
1
,
sizeof
(
access_sys_t
)
);
if
(
!
p_sys
)
return
VLC_ENOMEM
;
...
...
@@ -291,7 +287,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
/* */
case
ACCESS_GET_MTU
:
pi_int
=
(
int
*
)
va_arg
(
args
,
int
*
);
*
pi_int
=
3
*
p_sys
->
i_packet_length
;
*
pi_int
=
0
;
break
;
case
ACCESS_GET_PTS_DELAY
:
...
...
@@ -442,59 +438,53 @@ static int Seek( access_t * p_access, int64_t i_pos )
}
/*****************************************************************************
*
Read
:
*
Block
:
*****************************************************************************/
static
ssize_t
Read
(
access_t
*
p_access
,
uint8_t
*
p_buffer
,
size_t
i_len
)
static
block_t
*
Block
(
access_t
*
p_access
)
{
access_sys_t
*
p_sys
=
p_access
->
p_sys
;
size_t
i_data
;
size_t
i_copy
;
if
(
p_access
->
info
.
b_eof
)
return
NULL
;
if
(
p_access
->
info
.
i_pos
<
p_sys
->
i_header
)
{
return
0
;
}
const
size_t
i_copy
=
p_sys
->
i_header
-
p_access
->
info
.
i_pos
;
i_data
=
0
;
block_t
*
p_block
=
block_New
(
p_access
,
i_copy
);
if
(
!
p_block
)
return
NULL
;
/* *** now send data if needed *** */
while
(
i_data
<
i_len
)
memcpy
(
p_block
->
p_buffer
,
&
p_sys
->
p_header
[
p_access
->
info
.
i_pos
],
i_copy
);
p_access
->
info
.
i_pos
+=
i_copy
;
return
p_block
;
}
else
if
(
p_sys
->
p_media
&&
p_sys
->
i_media_used
<
__MAX
(
p_sys
->
i_media
,
p_sys
->
i_packet_length
)
)
{
if
(
p_access
->
info
.
i_pos
<
p_sys
->
i_header
)
{
i_copy
=
__MIN
(
i_len
,
p_sys
->
i_header
-
p_access
->
info
.
i_pos
);
memcpy
(
&
p_buffer
[
i_data
],
&
p_sys
->
p_header
[
p_access
->
info
.
i_pos
],
i_copy
);
i_data
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
else
if
(
p_sys
->
i_media_used
<
p_sys
->
i_media
)
{
i_copy
=
__MIN
(
i_len
-
i_data
,
p_sys
->
i_media
-
p_sys
->
i_media_used
);
memcpy
(
&
p_buffer
[
i_data
],
&
p_sys
->
p_media
[
p_sys
->
i_media_used
],
i_copy
);
i_data
+=
i_copy
;
p_sys
->
i_media_used
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
else
if
(
p_sys
->
p_media
!=
NULL
&&
p_sys
->
i_media_used
<
p_sys
->
i_packet_length
)
{
i_copy
=
__MIN
(
i_len
-
i_data
,
p_sys
->
i_packet_length
-
p_sys
->
i_media_used
);
memset
(
&
p_buffer
[
i_data
],
0
,
i_copy
);
size_t
i_copy
=
0
;
size_t
i_padding
=
0
;
i_data
+=
i_copy
;
p_sys
->
i_media_used
+=
i_copy
;
p_access
->
info
.
i_pos
+=
i_copy
;
}
else
if
(
p_access
->
info
.
b_eof
||
mms_HeaderMediaRead
(
p_access
,
MMS_PACKET_MEDIA
)
<
0
)
{
break
;
}
if
(
p_sys
->
i_media_used
<
p_sys
->
i_media
)
i_copy
=
p_sys
->
i_media
-
p_sys
->
i_media_used
;
if
(
__MAX
(
p_sys
->
i_media
,
p_sys
->
i_media_used
)
<
p_sys
->
i_packet_length
)
i_padding
=
p_sys
->
i_packet_length
-
__MAX
(
p_sys
->
i_media
,
p_sys
->
i_media_used
);
block_t
*
p_block
=
block_New
(
p_access
,
i_copy
+
i_padding
);
if
(
!
p_block
)
return
NULL
;
if
(
i_copy
>
0
)
memcpy
(
&
p_block
->
p_buffer
[
0
],
&
p_sys
->
p_media
[
p_sys
->
i_media_used
],
i_copy
);
if
(
i_padding
>
0
)
memset
(
&
p_block
->
p_buffer
[
i_copy
],
0
,
i_padding
);
p_sys
->
i_media_used
+=
i_copy
+
i_padding
;
p_access
->
info
.
i_pos
+=
i_copy
+
i_padding
;
return
p_block
;
}
return
i_data
;
mms_HeaderMediaRead
(
p_access
,
MMS_PACKET_MEDIA
);
return
NULL
;
}
/****************************************************************************
...
...
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