Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3b6a46b8
Commit
3b6a46b8
authored
Jun 06, 2004
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* access/*: use var_* helpers.
* access/vcd/ clean up.
parent
e34b5beb
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
173 additions
and
252 deletions
+173
-252
modules/access/cdda.c
modules/access/cdda.c
+5
-11
modules/access/directory.c
modules/access/directory.c
+6
-7
modules/access/file.c
modules/access/file.c
+7
-12
modules/access/ftp.c
modules/access/ftp.c
+13
-18
modules/access/http.c
modules/access/http.c
+11
-23
modules/access/mms/mmsh.c
modules/access/mms/mmsh.c
+5
-11
modules/access/mms/mmstu.c
modules/access/mms/mmstu.c
+5
-10
modules/access/tcp.c
modules/access/tcp.c
+1
-3
modules/access/udp.c
modules/access/udp.c
+7
-11
modules/access/vcd/vcd.c
modules/access/vcd/vcd.c
+113
-146
No files found.
modules/access/cdda.c
View file @
3b6a46b8
...
@@ -46,12 +46,12 @@ static void Close( vlc_object_t * );
...
@@ -46,12 +46,12 @@ static void Close( vlc_object_t * );
vlc_module_begin
();
vlc_module_begin
();
set_description
(
_
(
"Audio CD input"
)
);
set_description
(
_
(
"Audio CD input"
)
);
set_capability
(
"access2"
,
10
);
set_callbacks
(
Open
,
Close
);
add_usage_hint
(
N_
(
"[cdda:][device][@[track]]"
)
);
add_integer
(
"cdda-caching"
,
DEFAULT_PTS_DELAY
/
1000
,
NULL
,
CACHING_TEXT
,
add_integer
(
"cdda-caching"
,
DEFAULT_PTS_DELAY
/
1000
,
NULL
,
CACHING_TEXT
,
CACHING_LONGTEXT
,
VLC_TRUE
);
CACHING_LONGTEXT
,
VLC_TRUE
);
set_capability
(
"access2"
,
10
);
set_callbacks
(
Open
,
Close
);
add_shortcut
(
"cdda"
);
add_shortcut
(
"cdda"
);
add_shortcut
(
"cddasimple"
);
add_shortcut
(
"cddasimple"
);
vlc_module_end
();
vlc_module_end
();
...
@@ -98,7 +98,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -98,7 +98,6 @@ static int Open( vlc_object_t *p_this )
int
i
;
int
i
;
int
i_title
=
0
;
int
i_title
=
0
;
vcddev_t
*
vcddev
;
vcddev_t
*
vcddev
;
vlc_value_t
val
;
/* Command line: cdda://[dev_path][@title] */
/* Command line: cdda://[dev_path][@title] */
if
(
(
psz
=
strchr
(
psz_dup
,
'@'
)
)
)
if
(
(
psz
=
strchr
(
psz_dup
,
'@'
)
)
)
...
@@ -117,10 +116,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -117,10 +116,7 @@ static int Open( vlc_object_t *p_this )
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
var_Create
(
p_access
,
"cd-audio"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz_dup
=
var_CreateGetString
(
p_access
,
"cd-audio"
);
var_Get
(
p_access
,
"cd-audio"
,
&
val
);
psz_dup
=
val
.
psz_string
;
if
(
*
psz_dup
==
'\0'
)
if
(
*
psz_dup
==
'\0'
)
{
{
free
(
psz_dup
);
free
(
psz_dup
);
...
@@ -361,7 +357,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -361,7 +357,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
int
*
pi_int
;
int
*
pi_int
;
int64_t
*
pi_64
;
int64_t
*
pi_64
;
input_title_t
***
ppp_title
;
input_title_t
***
ppp_title
;
vlc_value_t
val
;
int
i
;
int
i
;
switch
(
i_query
)
switch
(
i_query
)
...
@@ -383,8 +378,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -383,8 +378,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"cdda-caching"
,
&
val
);
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"cdda-caching"
)
*
I64C
(
1000
);
*
pi_64
=
val
.
i_int
*
1000
;
break
;
break
;
/* */
/* */
...
...
modules/access/directory.c
View file @
3b6a46b8
...
@@ -164,8 +164,8 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
...
@@ -164,8 +164,8 @@ static int ReadNull( access_t *p_access, uint8_t *p_buffer, int i_len)
*****************************************************************************/
*****************************************************************************/
static
int
Read
(
access_t
*
p_access
,
uint8_t
*
p_buffer
,
int
i_len
)
static
int
Read
(
access_t
*
p_access
,
uint8_t
*
p_buffer
,
int
i_len
)
{
{
char
*
psz_name
=
0
;
char
*
psz_name
=
NULL
;
vlc_value_t
val
;
char
*
psz
;
int
i_mode
,
i_pos
;
int
i_mode
,
i_pos
;
playlist_t
*
p_playlist
=
playlist_t
*
p_playlist
=
...
@@ -190,13 +190,12 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
...
@@ -190,13 +190,12 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
}
}
/* Initialize structure */
/* Initialize structure */
var_Create
(
p_access
,
"recursive"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz
=
var_CreateGetString
(
p_access
,
"recursive"
);
var_Get
(
p_access
,
"recursive"
,
&
val
);
if
(
*
psz
==
'\0'
||
!
strncmp
(
psz
,
"none"
,
4
)
)
if
(
*
val
.
psz_string
==
'\0'
||
!
strncmp
(
val
.
psz_string
,
"none"
,
4
)
)
{
{
i_mode
=
MODE_NONE
;
i_mode
=
MODE_NONE
;
}
}
else
if
(
!
strncmp
(
val
.
psz_string
,
"collapse"
,
8
)
)
else
if
(
!
strncmp
(
psz
,
"collapse"
,
8
)
)
{
{
i_mode
=
MODE_COLLAPSE
;
i_mode
=
MODE_COLLAPSE
;
}
}
...
@@ -204,7 +203,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
...
@@ -204,7 +203,7 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
{
{
i_mode
=
MODE_EXPAND
;
i_mode
=
MODE_EXPAND
;
}
}
free
(
val
.
psz_string
);
free
(
psz
);
/* Make sure we are deleted when we are done */
/* Make sure we are deleted when we are done */
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
b_autodeletion
=
VLC_TRUE
;
p_playlist
->
pp_items
[
p_playlist
->
i_index
]
->
b_autodeletion
=
VLC_TRUE
;
...
...
modules/access/file.c
View file @
3b6a46b8
...
@@ -129,15 +129,14 @@ static int Open( vlc_object_t *p_this )
...
@@ -129,15 +129,14 @@ static int Open( vlc_object_t *p_this )
{
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
access_sys_t
*
p_sys
;
char
*
psz_name
=
p_access
->
psz_path
;
char
*
psz_name
=
p_access
->
psz_path
;
char
*
psz
;
#ifdef HAVE_SYS_STAT_H
#ifdef HAVE_SYS_STAT_H
int
i_stat
;
int
i_stat
;
struct
stat
stat_info
;
struct
stat
stat_info
;
#endif
#endif
vlc_bool_t
b_stdin
;
vlc_bool_t
b_stdin
;
vlc_value_t
val
;
file_entry_t
*
p_file
;
file_entry_t
*
p_file
;
...
@@ -251,12 +250,10 @@ static int Open( vlc_object_t *p_this )
...
@@ -251,12 +250,10 @@ static int Open( vlc_object_t *p_this )
p_file
->
psz_name
=
strdup
(
psz_name
);
p_file
->
psz_name
=
strdup
(
psz_name
);
TAB_APPEND
(
p_sys
->
i_file
,
p_sys
->
file
,
p_file
);
TAB_APPEND
(
p_sys
->
i_file
,
p_sys
->
file
,
p_file
);
var_Create
(
p_access
,
"file-cat"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz
=
var_CreateGetString
(
p_access
,
"file-cat"
);
var_Get
(
p_access
,
"file-cat"
,
&
val
);
if
(
*
psz
)
if
(
*
val
.
psz_string
)
{
{
char
*
psz_parser
=
psz_name
=
val
.
psz_string
;
char
*
psz_parser
=
psz_name
=
psz
;
int64_t
i_size
;
int64_t
i_size
;
while
(
psz_name
&&
*
psz_name
)
while
(
psz_name
&&
*
psz_name
)
...
@@ -292,7 +289,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -292,7 +289,7 @@ static int Open( vlc_object_t *p_this )
if
(
psz_name
)
psz_name
++
;
if
(
psz_name
)
psz_name
++
;
}
}
}
}
free
(
val
.
psz_string
);
free
(
psz
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -515,7 +512,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -515,7 +512,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t
*
pb_bool
;
vlc_bool_t
*
pb_bool
;
int
*
pi_int
;
int
*
pi_int
;
int64_t
*
pi_64
;
int64_t
*
pi_64
;
vlc_value_t
val
;
switch
(
i_query
)
switch
(
i_query
)
{
{
...
@@ -540,8 +536,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -540,8 +536,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"file-caching"
,
&
val
);
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"file-caching"
)
*
I64C
(
1000
);
*
pi_64
=
val
.
i_int
*
1000
;
break
;
break
;
/* */
/* */
case
ACCESS_SET_PAUSE_STATE
:
case
ACCESS_SET_PAUSE_STATE
:
...
...
modules/access/ftp.c
View file @
3b6a46b8
...
@@ -94,7 +94,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -94,7 +94,6 @@ static int Open( vlc_object_t *p_this )
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
access_sys_t
*
p_sys
;
char
*
psz
;
char
*
psz
;
vlc_value_t
val
;
int
i_answer
;
int
i_answer
;
char
*
psz_arg
;
char
*
psz_arg
;
...
@@ -158,15 +157,14 @@ static int Open( vlc_object_t *p_this )
...
@@ -158,15 +157,14 @@ static int Open( vlc_object_t *p_this )
msg_Dbg
(
p_access
,
"connection accepted (%d)"
,
i_answer
);
msg_Dbg
(
p_access
,
"connection accepted (%d)"
,
i_answer
);
var_Create
(
p_access
,
"ftp-user"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz
=
var_CreateGetString
(
p_access
,
"ftp-user"
);
var_Get
(
p_access
,
"ftp-user"
,
&
val
);
if
(
ftp_SendCommand
(
p_access
,
"USER %s"
,
psz
)
<
0
||
if
(
ftp_SendCommand
(
p_access
,
"USER %s"
,
val
.
psz_string
)
<
0
||
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
{
{
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
goto
exit_error
;
goto
exit_error
;
}
}
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
switch
(
i_answer
/
100
)
switch
(
i_answer
/
100
)
{
{
...
@@ -175,15 +173,14 @@ static int Open( vlc_object_t *p_this )
...
@@ -175,15 +173,14 @@ static int Open( vlc_object_t *p_this )
break
;
break
;
case
3
:
case
3
:
msg_Dbg
(
p_access
,
"password needed"
);
msg_Dbg
(
p_access
,
"password needed"
);
var_Create
(
p_access
,
"ftp-pwd"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz
=
var_CreateGetString
(
p_access
,
"ftp-pwd"
);
var_Get
(
p_access
,
"ftp-pwd"
,
&
val
);
if
(
ftp_SendCommand
(
p_access
,
"PASS %s"
,
psz
)
<
0
||
if
(
ftp_SendCommand
(
p_access
,
"PASS %s"
,
val
.
psz_string
)
<
0
||
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
{
{
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
goto
exit_error
;
goto
exit_error
;
}
}
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
switch
(
i_answer
/
100
)
switch
(
i_answer
/
100
)
{
{
...
@@ -192,17 +189,15 @@ static int Open( vlc_object_t *p_this )
...
@@ -192,17 +189,15 @@ static int Open( vlc_object_t *p_this )
break
;
break
;
case
3
:
case
3
:
msg_Dbg
(
p_access
,
"account needed"
);
msg_Dbg
(
p_access
,
"account needed"
);
var_Create
(
p_access
,
"ftp-account"
,
psz
=
var_CreateGetString
(
p_access
,
"ftp-account"
);
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_access
,
"ftp-account"
,
&
val
);
if
(
ftp_SendCommand
(
p_access
,
"ACCT %s"
,
if
(
ftp_SendCommand
(
p_access
,
"ACCT %s"
,
val
.
psz_string
)
<
0
||
psz
)
<
0
||
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
ftp_ReadCommand
(
p_access
,
&
i_answer
,
NULL
)
<
0
)
{
{
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
goto
exit_error
;
goto
exit_error
;
}
}
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
free
(
psz
);
if
(
i_answer
/
100
!=
2
)
if
(
i_answer
/
100
!=
2
)
{
{
...
@@ -372,7 +367,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -372,7 +367,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"ftp-caching"
,
&
val
);
var_Get
(
p_access
,
"ftp-caching"
,
&
val
);
*
pi_64
=
val
.
i_int
*
1000
;
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"ftp-caching"
)
*
I64C
(
1000
)
;
break
;
break
;
/* */
/* */
...
...
modules/access/http.c
View file @
3b6a46b8
...
@@ -129,7 +129,7 @@ static int Open ( vlc_object_t *p_this )
...
@@ -129,7 +129,7 @@ static int Open ( vlc_object_t *p_this )
{
{
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_t
*
p_access
=
(
access_t
*
)
p_this
;
access_sys_t
*
p_sys
;
access_sys_t
*
p_sys
;
vlc_value_t
val
;
char
*
psz
;
/* First set ipv4/ipv6 */
/* First set ipv4/ipv6 */
var_Create
(
p_access
,
"ipv4"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_access
,
"ipv4"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
...
@@ -137,6 +137,7 @@ static int Open ( vlc_object_t *p_this )
...
@@ -137,6 +137,7 @@ static int Open ( vlc_object_t *p_this )
if
(
*
p_access
->
psz_access
)
if
(
*
p_access
->
psz_access
)
{
{
vlc_value_t
val
;
/* Find out which shortcut was used */
/* Find out which shortcut was used */
if
(
!
strncmp
(
p_access
->
psz_access
,
"http4"
,
6
)
)
if
(
!
strncmp
(
p_access
->
psz_access
,
"http4"
,
6
)
)
{
{
...
@@ -191,27 +192,19 @@ static int Open ( vlc_object_t *p_this )
...
@@ -191,27 +192,19 @@ static int Open ( vlc_object_t *p_this )
}
}
if
(
!
p_sys
->
psz_user
||
*
p_sys
->
psz_user
==
'\0'
)
if
(
!
p_sys
->
psz_user
||
*
p_sys
->
psz_user
==
'\0'
)
{
{
var_Create
(
p_access
,
"http-user"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
p_sys
->
psz_user
=
var_CreateGetString
(
p_access
,
"http-user"
);
var_Get
(
p_access
,
"http-user"
,
&
val
);
p_sys
->
psz_passwd
=
var_CreateGetString
(
p_access
,
"http-pwd"
);
p_sys
->
psz_user
=
val
.
psz_string
;
var_Create
(
p_access
,
"http-pwd"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_access
,
"http-pwd"
,
&
val
);
p_sys
->
psz_passwd
=
val
.
psz_string
;
}
}
/* Do user agent */
/* Do user agent */
var_Create
(
p_access
,
"http-user-agent"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
p_sys
->
psz_user_agent
=
var_CreateGetString
(
p_access
,
"http-user-agent"
);
var_Get
(
p_access
,
"http-user-agent"
,
&
val
);
p_sys
->
psz_user_agent
=
val
.
psz_string
;
/* Check proxy */
/* Check proxy */
var_Create
(
p_access
,
"http-proxy"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
psz
=
var_CreateGetString
(
p_access
,
"http-proxy"
);
var_Get
(
p_access
,
"http-proxy"
,
&
val
);
if
(
*
psz
)
if
(
val
.
psz_string
&&
*
val
.
psz_string
)
{
{
p_sys
->
b_proxy
=
VLC_TRUE
;
p_sys
->
b_proxy
=
VLC_TRUE
;
vlc_UrlParse
(
&
p_sys
->
proxy
,
val
.
psz_string
,
0
);
vlc_UrlParse
(
&
p_sys
->
proxy
,
psz
,
0
);
}
}
else
else
{
{
...
@@ -219,17 +212,12 @@ static int Open ( vlc_object_t *p_this )
...
@@ -219,17 +212,12 @@ static int Open ( vlc_object_t *p_this )
if
(
psz_proxy
&&
*
psz_proxy
)
if
(
psz_proxy
&&
*
psz_proxy
)
{
{
p_sys
->
b_proxy
=
VLC_TRUE
;
p_sys
->
b_proxy
=
VLC_TRUE
;
vlc_UrlParse
(
&
p_sys
->
proxy
,
val
.
psz_string
,
0
);
vlc_UrlParse
(
&
p_sys
->
proxy
,
psz_proxy
,
0
);
}
}
if
(
psz_proxy
)
if
(
psz_proxy
)
{
free
(
psz_proxy
);
free
(
psz_proxy
);
}
}
}
free
(
psz
);
if
(
val
.
psz_string
)
{
free
(
val
.
psz_string
);
}
if
(
p_sys
->
b_proxy
)
if
(
p_sys
->
b_proxy
)
{
{
...
@@ -497,7 +485,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -497,7 +485,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"http-caching"
,
&
val
);
var_Get
(
p_access
,
"http-caching"
,
&
val
);
*
pi_64
=
val
.
i_int
*
1000
;
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"http-caching"
)
*
1000
;
break
;
break
;
/* */
/* */
...
...
modules/access/mms/mmsh.c
View file @
3b6a46b8
...
@@ -66,7 +66,6 @@ int E_(MMSHOpen)( access_t *p_access )
...
@@ -66,7 +66,6 @@ int E_(MMSHOpen)( access_t *p_access )
{
{
access_sys_t
*
p_sys
;
access_sys_t
*
p_sys
;
char
*
psz_location
=
NULL
;
char
*
psz_location
=
NULL
;
vlc_value_t
val
;
/* init p_sys */
/* init p_sys */
...
@@ -145,9 +144,6 @@ int E_(MMSHOpen)( access_t *p_access )
...
@@ -145,9 +144,6 @@ int E_(MMSHOpen)( access_t *p_access )
p_access
->
info
.
i_size
=
p_sys
->
asfh
.
i_file_size
;
p_access
->
info
.
i_size
=
p_sys
->
asfh
.
i_file_size
;
}
}
/* Update default_pts to a suitable value for mms access */
var_Get
(
p_access
,
"mms-caching"
,
&
val
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -171,7 +167,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -171,7 +167,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t
*
pb_bool
;
vlc_bool_t
*
pb_bool
;
int
*
pi_int
;
int
*
pi_int
;
int64_t
*
pi_64
;
int64_t
*
pi_64
;
vlc_value_t
val
;
switch
(
i_query
)
switch
(
i_query
)
{
{
...
@@ -195,8 +190,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -195,8 +190,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"mms-caching"
,
&
val
);
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"mms-caching"
)
*
I64C
(
1000
);
*
pi_64
=
val
.
i_int
*
1000
;
break
;
break
;
/* */
/* */
...
@@ -531,10 +525,10 @@ static int Describe( access_t *p_access, char **ppsz_location )
...
@@ -531,10 +525,10 @@ static int Describe( access_t *p_access, char **ppsz_location )
p_sys
->
asfh
.
i_min_data_packet_size
);
p_sys
->
asfh
.
i_min_data_packet_size
);
E_
(
asf_StreamSelect
)(
&
p_sys
->
asfh
,
E_
(
asf_StreamSelect
)(
&
p_sys
->
asfh
,
config_GetInt
(
p_access
,
"mms-maxbitrate"
),
var_CreateGetInteger
(
p_access
,
"mms-maxbitrate"
),
config_GetInt
(
p_access
,
"mms-all"
),
var_CreateGetInteger
(
p_access
,
"mms-all"
),
config_GetInt
(
p_access
,
"audio"
),
var_CreateGetInteger
(
p_access
,
"audio"
),
config_GetInt
(
p_access
,
"video"
)
);
var_CreateGetInteger
(
p_access
,
"video"
)
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
...
...
modules/access/mms/mmstu.c
View file @
3b6a46b8
...
@@ -120,7 +120,6 @@ int E_(MMSTUOpen)( access_t *p_access )
...
@@ -120,7 +120,6 @@ int E_(MMSTUOpen)( access_t *p_access )
access_sys_t
*
p_sys
;
access_sys_t
*
p_sys
;
int
i_proto
;
int
i_proto
;
int
i_status
;
int
i_status
;
vlc_value_t
val
;
/* Set up p_access */
/* Set up p_access */
p_access
->
pf_read
=
Read
;
p_access
->
pf_read
=
Read
;
...
@@ -215,10 +214,6 @@ int E_(MMSTUOpen)( access_t *p_access )
...
@@ -215,10 +214,6 @@ int E_(MMSTUOpen)( access_t *p_access )
vlc_UrlClean
(
&
p_sys
->
url
);
vlc_UrlClean
(
&
p_sys
->
url
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
/* Update default_pts to a suitable value for mms access */
var_Get
(
p_access
,
"mms-caching"
,
&
val
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -272,7 +267,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -272,7 +267,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"mms-caching"
,
&
val
);
var_Get
(
p_access
,
"mms-caching"
,
&
val
);
*
pi_64
=
val
.
i_int
*
1000
;
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"mms-caching"
)
*
I64C
(
1000
)
;
break
;
break
;
/* */
/* */
...
@@ -748,10 +743,10 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
...
@@ -748,10 +743,10 @@ static int MMSOpen( access_t *p_access, vlc_url_t *p_url, int i_proto )
E_
(
asf_HeaderParse
)(
&
p_sys
->
asfh
,
E_
(
asf_HeaderParse
)(
&
p_sys
->
asfh
,
p_sys
->
p_header
,
p_sys
->
i_header
);
p_sys
->
p_header
,
p_sys
->
i_header
);
E_
(
asf_StreamSelect
)(
&
p_sys
->
asfh
,
E_
(
asf_StreamSelect
)(
&
p_sys
->
asfh
,
config_GetInt
(
p_access
,
"mms-maxbitrate"
),
var_CreateGetInteger
(
p_access
,
"mms-maxbitrate"
),
config_GetInt
(
p_access
,
"mms-all"
),
var_CreateGetInteger
(
p_access
,
"mms-all"
),
config_GetInt
(
p_access
,
"audio"
),
var_CreateGetInteger
(
p_access
,
"audio"
),
config_GetInt
(
p_access
,
"video"
)
);
var_CreateGetInteger
(
p_access
,
"video"
)
);
/* *** now select stream we want to receive *** */
/* *** now select stream we want to receive *** */
/* TODO take care of stream bitrate TODO */
/* TODO take care of stream bitrate TODO */
...
...
modules/access/tcp.c
View file @
3b6a46b8
...
@@ -172,7 +172,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -172,7 +172,6 @@ static int Control( access_t *p_access, int i_query, va_list args )
vlc_bool_t
*
pb_bool
;
vlc_bool_t
*
pb_bool
;
int
*
pi_int
;
int
*
pi_int
;
int64_t
*
pi_64
;
int64_t
*
pi_64
;
vlc_value_t
val
;
switch
(
i_query
)
switch
(
i_query
)
{
{
...
@@ -199,8 +198,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -199,8 +198,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"tcp-caching"
,
&
val
);
*
pi_64
=
(
int64_t
)
var_GetInteger
(
p_access
,
"tcp-caching"
)
*
I64C
(
1000
);
*
pi_64
=
val
.
i_int
*
1000
;
break
;
break
;
/* */
/* */
...
...
modules/access/udp.c
View file @
3b6a46b8
...
@@ -103,7 +103,6 @@ static int Open( vlc_object_t *p_this )
...
@@ -103,7 +103,6 @@ static int Open( vlc_object_t *p_this )
char
*
psz_bind_port
=
""
;
char
*
psz_bind_port
=
""
;
int
i_bind_port
=
0
;
int
i_bind_port
=
0
;
int
i_server_port
=
0
;
int
i_server_port
=
0
;
vlc_value_t
val
;
/* First set ipv4/ipv6 */
/* First set ipv4/ipv6 */
...
@@ -112,6 +111,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -112,6 +111,7 @@ static int Open( vlc_object_t *p_this )
if
(
*
p_access
->
psz_access
)
if
(
*
p_access
->
psz_access
)
{
{
vlc_value_t
val
;
/* Find out which shortcut was used */
/* Find out which shortcut was used */
if
(
!
strncmp
(
p_access
->
psz_access
,
"udp4"
,
6
)
||
if
(
!
strncmp
(
p_access
->
psz_access
,
"udp4"
,
6
)
||
!
strncmp
(
p_access
->
psz_access
,
"rtp4"
,
6
))
!
strncmp
(
p_access
->
psz_access
,
"rtp4"
,
6
))
...
@@ -201,9 +201,7 @@ static int Open( vlc_object_t *p_this )
...
@@ -201,9 +201,7 @@ static int Open( vlc_object_t *p_this )
i_server_port
=
strtol
(
psz_server_port
,
NULL
,
10
);
i_server_port
=
strtol
(
psz_server_port
,
NULL
,
10
);
if
(
(
i_bind_port
=
strtol
(
psz_bind_port
,
NULL
,
10
)
)
==
0
)
if
(
(
i_bind_port
=
strtol
(
psz_bind_port
,
NULL
,
10
)
)
==
0
)
{
{
var_Create
(
p_access
,
"server-port"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
i_bind_port
=
var_CreateGetInteger
(
p_access
,
"server-port"
);
var_Get
(
p_access
,
"server-port"
,
&
val
);
i_bind_port
=
val
.
i_int
;
}
}
msg_Dbg
(
p_access
,
"opening server=%s:%d local=%s:%d"
,
msg_Dbg
(
p_access
,
"opening server=%s:%d local=%s:%d"
,
...
@@ -234,13 +232,11 @@ static int Open( vlc_object_t *p_this )
...
@@ -234,13 +232,11 @@ static int Open( vlc_object_t *p_this )
free
(
psz_name
);
free
(
psz_name
);
/* FIXME */
/* FIXME */
var_Create
(
p_access
,
"mtu"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
p_sys
->
i_mtu
=
var_CreateGetInteger
(
p_access
,
"mtu"
);
var_Get
(
p_access
,
"mtu"
,
&
val
);
if
(
p_sys
->
i_mtu
<=
1
)
p_sys
->
i_mtu
=
val
.
i_int
>
0
?
val
.
i_int
:
1500
;
/* a
void problem */
p_sys
->
i_mtu
=
1500
;
/* A
void problem */
var_Create
(
p_access
,
"udp-auto-mtu"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
p_sys
->
b_auto_mtu
=
var_CreateGetBool
(
p_access
,
"udp-auto-mtu"
);;
var_Get
(
p_access
,
"udp-auto-mtu"
,
&
val
);
p_sys
->
b_auto_mtu
=
val
.
b_bool
;
/* Update default_pts to a suitable value for udp access */
/* Update default_pts to a suitable value for udp access */
var_Create
(
p_access
,
"udp-caching"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_access
,
"udp-caching"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
...
@@ -290,7 +286,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
...
@@ -290,7 +286,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
case
ACCESS_GET_PTS_DELAY
:
case
ACCESS_GET_PTS_DELAY
:
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
pi_64
=
(
int64_t
*
)
va_arg
(
args
,
int64_t
*
);
var_Get
(
p_access
,
"udp-caching"
,
&
val
);
var_Get
(
p_access
,
"udp-caching"
,
&
val
);
*
pi_64
=
va
l
.
i_int
*
1000
;
*
pi_64
=
va
r_GetInteger
(
p_access
,
"udp-caching"
)
*
1000
;
break
;
break
;
/* */
/* */
...
...
modules/access/vcd/vcd.c
View file @
3b6a46b8
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* vcd.c : VCD input module for vlc
* vcd.c : VCD input module for vlc
*****************************************************************************
*****************************************************************************
* Copyright (C) 2000-2004 VideoLAN
* Copyright (C) 2000-2004 VideoLAN
* $Id
: vcd.c,v 1.25 2004/01/25 17:31:22 gbazin Exp
$
* $Id$
*
*
* Author: Johan Bilien <jobi@via.ecp.fr>
* Author: Johan Bilien <jobi@via.ecp.fr>
*
*
...
@@ -24,30 +24,37 @@
...
@@ -24,30 +24,37 @@
/*****************************************************************************
/*****************************************************************************
* Preamble
* Preamble
*****************************************************************************/
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc/input.h>
#include "../../demux/mpeg/system.h"
#include "cdrom.h"
/*****************************************************************************
* Module descriptior
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
#ifdef HAVE_UNISTD_H
vlc_module_begin
();
# include <unistd.h>
set_description
(
_
(
"VCD input"
)
);
#endif
set_capability
(
"access"
,
80
);
set_callbacks
(
Open
,
Close
);
#include <string.h>
add_usage_hint
(
N_
(
"[vcd:][device][@[title][,[chapter]]]"
)
);
add_shortcut
(
"svcd"
);
vlc_module_end
();
#include "cdrom.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
/* how many blocks VCDRead will read in each loop */
/* how many blocks VCDRead will read in each loop */
#define VCD_BLOCKS_ONCE 20
#define VCD_BLOCKS_ONCE 20
#define VCD_DATA_ONCE (VCD_BLOCKS_ONCE * VCD_DATA_SIZE)
#define VCD_DATA_ONCE (VCD_BLOCKS_ONCE * VCD_DATA_SIZE)
/*****************************************************************************
struct
access_sys_t
* thread_vcd_data_t: VCD information
*****************************************************************************/
typedef
struct
thread_vcd_data_s
{
{
vcddev_t
*
vcddev
;
/* vcd device descriptor */
vcddev_t
*
vcddev
;
/* vcd device descriptor */
int
i_nb_tracks
;
/* Nb of tracks (titles) */
int
i_nb_tracks
;
/* Nb of tracks (titles) */
...
@@ -58,111 +65,77 @@ typedef struct thread_vcd_data_s
...
@@ -58,111 +65,77 @@ typedef struct thread_vcd_data_s
int
*
p_entries
;
/* Entry points */
int
*
p_entries
;
/* Entry points */
vlc_bool_t
b_valid_ep
;
/* Valid entry points flag */
vlc_bool_t
b_valid_ep
;
/* Valid entry points flag */
vlc_bool_t
b_end_of_track
;
/* If the end of track was reached */
vlc_bool_t
b_end_of_track
;
/* If the end of track was reached */
};
}
thread_vcd_data_t
;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
VCDOpen
(
vlc_object_t
*
);
static
void
VCDClose
(
vlc_object_t
*
);
static
int
VCDRead
(
input_thread_t
*
,
byte_t
*
,
size_t
);
static
int
VCDRead
(
input_thread_t
*
,
byte_t
*
,
size_t
);
static
void
VCDSeek
(
input_thread_t
*
,
off_t
);
static
void
VCDSeek
(
input_thread_t
*
,
off_t
);
static
int
VCDSetArea
(
input_thread_t
*
,
input_area_t
*
);
static
int
VCDSetArea
(
input_thread_t
*
,
input_area_t
*
);
static
int
VCDSetProgram
(
input_thread_t
*
,
pgrm_descriptor_t
*
);
static
int
VCDSetProgram
(
input_thread_t
*
,
pgrm_descriptor_t
*
);
static
int
VCDEntryPoints
(
input_thread_t
*
);
static
int
VCDEntryPoints
(
input_thread_t
*
);
/*****************************************************************************
* Module descriptior
*****************************************************************************/
vlc_module_begin
();
set_description
(
_
(
"VCD input"
)
);
set_capability
(
"access"
,
80
);
set_callbacks
(
VCDOpen
,
VCDClose
);
add_shortcut
(
"svcd"
);
vlc_module_end
();
/*
* Data reading functions
*/
/*****************************************************************************
/*****************************************************************************
* VCDOpen: open vcd
* VCDOpen: open vcd
*****************************************************************************/
*****************************************************************************/
static
int
VCD
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
char
*
psz_orig
;
access_sys_t
*
p_sys
;
char
*
psz_parser
;
char
*
psz_dup
=
strdup
(
p_input
->
psz_name
);
char
*
psz_source
;
char
*
psz
;
char
*
psz_next
;
thread_vcd_data_t
*
p_vcd
;
int
i
;
int
i
;
input_area_t
*
p_area
;
input_area_t
*
p_area
;
int
i_title
=
1
;
int
i_title
=
0
;
int
i_chapter
=
1
;
int
i_chapter
=
0
;
vcddev_t
*
vcddev
;
vcddev_t
*
vcddev
;
/* parse the options passed in command line : */
/* Command line: vcd://[dev_path][@title[,chapter]] */
psz_orig
=
psz_parser
=
psz_source
=
strdup
(
p_input
->
psz_name
);
if
(
(
psz
=
strchr
(
psz_dup
,
'@'
)
)
)
if
(
!
psz_orig
)
{
{
return
(
-
1
);
*
psz
++
=
'\0'
;
}
while
(
*
psz_parser
&&
*
psz_parser
!=
'@'
)
i_title
=
strtol
(
psz
,
&
psz
,
0
);
if
(
*
psz
)
{
{
psz_parser
++
;
i_chapter
=
strtol
(
psz
,
&
psz
,
0
);
}
}
}
if
(
*
psz_parser
==
'@'
)
if
(
*
psz_dup
==
'\0'
)
{
/* Found options */
*
psz_parser
=
'\0'
;
++
psz_parser
;
i_title
=
(
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
if
(
*
psz_next
)
{
{
psz_parser
=
psz_next
+
1
;
free
(
psz_dup
);
i_chapter
=
(
int
)
strtol
(
psz_parser
,
&
psz_next
,
10
);
}
i_title
=
i_title
>
0
?
i_title
:
1
;
/* Only when selected */
i
_chapter
=
i_chapter
>
0
?
i_chapter
:
1
;
i
f
(
*
p_input
->
psz_access
==
'\0'
)
}
return
VLC_EGENERIC
;
if
(
!*
psz_source
)
psz_dup
=
var_CreateGetString
(
p_input
,
"vcd"
);
{
if
(
*
psz_dup
==
'\0'
)
if
(
!
p_input
->
psz_access
)
{
{
free
(
psz_
orig
);
free
(
psz_
dup
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
psz_source
=
config_GetPsz
(
p_input
,
"vcd"
);
if
(
!
psz_source
)
return
-
1
;
}
}
/* Open VCD */
/* Open VCD */
if
(
!
(
vcddev
=
ioctl_Open
(
p_this
,
psz_
source
))
)
if
(
!
(
vcddev
=
ioctl_Open
(
p_this
,
psz_
dup
))
)
{
{
msg_Warn
(
p_input
,
"could not open %s"
,
psz_
source
);
msg_Warn
(
p_input
,
"could not open %s"
,
psz_
dup
);
free
(
psz_
source
);
free
(
psz_
dup
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
p_
vcd
=
malloc
(
sizeof
(
thread_vcd_data
_t
)
);
p_
sys
=
malloc
(
sizeof
(
access_sys
_t
)
);
if
(
p_
vcd
==
NULL
)
if
(
p_
sys
==
NULL
)
{
{
msg_Err
(
p_input
,
"out of memory"
);
msg_Err
(
p_input
,
"out of memory"
);
free
(
psz_
source
);
free
(
psz_
dup
);
return
-
1
;
return
VLC_EGENERIC
;
}
}
free
(
psz_
source
);
free
(
psz_
dup
);
p_
vcd
->
vcddev
=
vcddev
;
p_
sys
->
vcddev
=
vcddev
;
p_input
->
p_access_data
=
(
void
*
)
p_
vcd
;
p_input
->
p_access_data
=
(
void
*
)
p_
sys
;
p_input
->
i_mtu
=
VCD_DATA_ONCE
;
p_input
->
i_mtu
=
VCD_DATA_ONCE
;
...
@@ -174,34 +147,34 @@ static int VCDOpen( vlc_object_t *p_this )
...
@@ -174,34 +147,34 @@ static int VCDOpen( vlc_object_t *p_this )
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
/* We read the Table Of Content information */
/* We read the Table Of Content information */
p_
vcd
->
i_nb_tracks
=
ioctl_GetTracksMap
(
VLC_OBJECT
(
p_input
),
p_
sys
->
i_nb_tracks
=
ioctl_GetTracksMap
(
VLC_OBJECT
(
p_input
),
p_
vcd
->
vcddev
,
&
p_vcd
->
p_sectors
);
p_
sys
->
vcddev
,
&
p_sys
->
p_sectors
);
if
(
p_
vcd
->
i_nb_tracks
<
0
)
if
(
p_
sys
->
i_nb_tracks
<
0
)
msg_Err
(
p_input
,
"unable to count tracks"
);
msg_Err
(
p_input
,
"unable to count tracks"
);
else
if
(
p_
vcd
->
i_nb_tracks
<=
1
)
else
if
(
p_
sys
->
i_nb_tracks
<=
1
)
msg_Err
(
p_input
,
"no movie tracks found"
);
msg_Err
(
p_input
,
"no movie tracks found"
);
if
(
p_
vcd
->
i_nb_tracks
<=
1
)
if
(
p_
sys
->
i_nb_tracks
<=
1
)
{
{
ioctl_Close
(
p_this
,
p_
vcd
->
vcddev
);
ioctl_Close
(
p_this
,
p_
sys
->
vcddev
);
free
(
p_
vcd
);
free
(
p_
sys
);
return
-
1
;
return
-
1
;
}
}
/* Allocate the entry points table */
/* Allocate the entry points table */
p_
vcd
->
p_entries
=
malloc
(
p_vcd
->
i_nb_tracks
*
sizeof
(
int
)
);
p_
sys
->
p_entries
=
malloc
(
p_sys
->
i_nb_tracks
*
sizeof
(
int
)
);
if
(
p_
vcd
->
p_entries
==
NULL
)
if
(
p_
sys
->
p_entries
==
NULL
)
{
{
msg_Err
(
p_input
,
"not enough memory"
);
msg_Err
(
p_input
,
"not enough memory"
);
ioctl_Close
(
p_this
,
p_
vcd
->
vcddev
);
ioctl_Close
(
p_this
,
p_
sys
->
vcddev
);
free
(
p_
vcd
);
free
(
p_
sys
);
}
}
/* Set stream and area data */
/* Set stream and area data */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
/* Initialize ES structures */
/* Initialize ES structures */
input_InitStream
(
p_input
,
sizeof
(
stream_ps_data_t
)
);
input_InitStream
(
p_input
,
0
);
/* disc input method */
/* disc input method */
p_input
->
stream
.
i_method
=
INPUT_METHOD_VCD
;
p_input
->
stream
.
i_method
=
INPUT_METHOD_VCD
;
...
@@ -209,14 +182,14 @@ static int VCDOpen( vlc_object_t *p_this )
...
@@ -209,14 +182,14 @@ static int VCDOpen( vlc_object_t *p_this )
p_input
->
stream
.
i_area_nb
=
1
;
p_input
->
stream
.
i_area_nb
=
1
;
#define area p_input->stream.pp_areas
#define area p_input->stream.pp_areas
for
(
i
=
1
;
i
<
p_
vcd
->
i_nb_tracks
;
i
++
)
for
(
i
=
1
;
i
<
p_
sys
->
i_nb_tracks
;
i
++
)
{
{
/* Titles are Program Chains */
/* Titles are Program Chains */
input_AddArea
(
p_input
,
i
,
1
);
input_AddArea
(
p_input
,
i
,
1
);
/* Absolute start offset and size */
/* Absolute start offset and size */
area
[
i
]
->
i_start
=
(
off_t
)
p_
vcd
->
p_sectors
[
i
]
*
(
off_t
)
VCD_DATA_SIZE
;
area
[
i
]
->
i_start
=
(
off_t
)
p_
sys
->
p_sectors
[
i
]
*
(
off_t
)
VCD_DATA_SIZE
;
area
[
i
]
->
i_size
=
(
off_t
)(
p_
vcd
->
p_sectors
[
i
+
1
]
-
p_vcd
->
p_sectors
[
i
])
area
[
i
]
->
i_size
=
(
off_t
)(
p_
sys
->
p_sectors
[
i
+
1
]
-
p_sys
->
p_sectors
[
i
])
*
(
off_t
)
VCD_DATA_SIZE
;
*
(
off_t
)
VCD_DATA_SIZE
;
/* Default Chapter */
/* Default Chapter */
...
@@ -228,13 +201,13 @@ static int VCDOpen( vlc_object_t *p_this )
...
@@ -228,13 +201,13 @@ static int VCDOpen( vlc_object_t *p_this )
}
}
#undef area
#undef area
p_area
=
p_input
->
stream
.
pp_areas
[
__MIN
(
i_title
,
p_
vcd
->
i_nb_tracks
-
1
)];
p_area
=
p_input
->
stream
.
pp_areas
[
__MIN
(
i_title
,
p_
sys
->
i_nb_tracks
-
1
)];
p_
vcd
->
b_valid_ep
=
1
;
p_
sys
->
b_valid_ep
=
1
;
if
(
VCDEntryPoints
(
p_input
)
<
0
)
if
(
VCDEntryPoints
(
p_input
)
<
0
)
{
{
msg_Warn
(
p_input
,
"could not read entry points, will not use them"
);
msg_Warn
(
p_input
,
"could not read entry points, will not use them"
);
p_
vcd
->
b_valid_ep
=
0
;
p_
sys
->
b_valid_ep
=
0
;
}
}
VCDSetArea
(
p_input
,
p_area
);
VCDSetArea
(
p_input
,
p_area
);
...
@@ -257,13 +230,13 @@ static int VCDOpen( vlc_object_t *p_this )
...
@@ -257,13 +230,13 @@ static int VCDOpen( vlc_object_t *p_this )
/*****************************************************************************
/*****************************************************************************
* VCDClose: closes vcd
* VCDClose: closes vcd
*****************************************************************************/
*****************************************************************************/
static
void
VCD
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
input_thread_t
*
p_input
=
(
input_thread_t
*
)
p_this
;
thread_vcd_data_t
*
p_vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_access_data
;
access_sys_t
*
p_sys
=
p_input
->
p_access_data
;
ioctl_Close
(
p_this
,
p_
vcd
->
vcddev
);
ioctl_Close
(
p_this
,
p_
sys
->
vcddev
);
free
(
p_
vcd
);
free
(
p_
sys
);
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -275,13 +248,13 @@ static void VCDClose( vlc_object_t *p_this )
...
@@ -275,13 +248,13 @@ static void VCDClose( vlc_object_t *p_this )
static
int
VCDRead
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
static
int
VCDRead
(
input_thread_t
*
p_input
,
byte_t
*
p_buffer
,
size_t
i_len
)
size_t
i_len
)
{
{
thread_vcd_data_t
*
p_vcd
;
access_sys_t
*
p_sys
;
int
i_blocks
;
int
i_blocks
;
int
i_index
;
int
i_index
;
int
i_read
;
int
i_read
;
byte_t
p_last_sector
[
VCD_DATA_SIZE
];
byte_t
p_last_sector
[
VCD_DATA_SIZE
];
p_
vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_access_data
;
p_
sys
=
p_input
->
p_access_data
;
i_read
=
0
;
i_read
=
0
;
...
@@ -291,20 +264,20 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -291,20 +264,20 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
for
(
i_index
=
0
;
i_index
<
i_blocks
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
i_blocks
;
i_index
++
)
{
{
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
vcd
->
vcddev
,
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
sys
->
vcddev
,
p_
vcd
->
i_sector
,
p_buffer
+
i_index
*
VCD_DATA_SIZE
,
1
,
p_
sys
->
i_sector
,
p_buffer
+
i_index
*
VCD_DATA_SIZE
,
1
,
VCD_TYPE
)
<
0
)
VCD_TYPE
)
<
0
)
{
{
msg_Err
(
p_input
,
"could not read sector %d"
,
p_
vcd
->
i_sector
);
msg_Err
(
p_input
,
"could not read sector %d"
,
p_
sys
->
i_sector
);
return
-
1
;
return
-
1
;
}
}
p_
vcd
->
i_sector
++
;
p_
sys
->
i_sector
++
;
if
(
p_
vcd
->
i_sector
==
p_vcd
->
p_sectors
[
p_vcd
->
i_track
+
1
]
)
if
(
p_
sys
->
i_sector
==
p_sys
->
p_sectors
[
p_sys
->
i_track
+
1
]
)
{
{
input_area_t
*
p_area
;
input_area_t
*
p_area
;
if
(
p_
vcd
->
i_track
>=
p_vcd
->
i_nb_tracks
-
1
)
if
(
p_
sys
->
i_track
>=
p_sys
->
i_nb_tracks
-
1
)
return
0
;
/* EOF */
return
0
;
/* EOF */
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
...
@@ -319,7 +292,7 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -319,7 +292,7 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
}
}
/* Update chapter */
/* Update chapter */
else
if
(
p_
vcd
->
b_valid_ep
&&
else
if
(
p_
sys
->
b_valid_ep
&&
/* FIXME kludge so that read does not update chapter
/* FIXME kludge so that read does not update chapter
* when a manual chapter change was requested and not
* when a manual chapter change was requested and not
* yet accomplished */
* yet accomplished */
...
@@ -331,8 +304,8 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -331,8 +304,8 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
i_entry
=
p_input
->
stream
.
p_selected_area
->
i_plugin_data
i_entry
=
p_input
->
stream
.
p_selected_area
->
i_plugin_data
/* 1st entry point of the track (area)*/
/* 1st entry point of the track (area)*/
+
p_input
->
stream
.
p_selected_area
->
i_part
-
1
;
+
p_input
->
stream
.
p_selected_area
->
i_part
-
1
;
if
(
i_entry
+
1
<
p_
vcd
->
i_entries_nb
&&
if
(
i_entry
+
1
<
p_
sys
->
i_entries_nb
&&
p_
vcd
->
i_sector
>=
p_vcd
->
p_entries
[
i_entry
+
1
]
)
p_
sys
->
i_sector
>=
p_sys
->
p_entries
[
i_entry
+
1
]
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
...
@@ -352,10 +325,10 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
...
@@ -352,10 +325,10 @@ static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
if
(
i_len
%
VCD_DATA_SIZE
)
/* this should not happen */
if
(
i_len
%
VCD_DATA_SIZE
)
/* this should not happen */
{
{
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
vcd
->
vcddev
,
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
sys
->
vcddev
,
p_
vcd
->
i_sector
,
p_last_sector
,
1
,
VCD_TYPE
)
<
0
)
p_
sys
->
i_sector
,
p_last_sector
,
1
,
VCD_TYPE
)
<
0
)
{
{
msg_Err
(
p_input
,
"could not read sector %d"
,
p_
vcd
->
i_sector
);
msg_Err
(
p_input
,
"could not read sector %d"
,
p_
sys
->
i_sector
);
return
-
1
;
return
-
1
;
}
}
...
@@ -382,11 +355,9 @@ static int VCDSetProgram( input_thread_t * p_input,
...
@@ -382,11 +355,9 @@ static int VCDSetProgram( input_thread_t * p_input,
****************************************************************************/
****************************************************************************/
static
int
VCDSetArea
(
input_thread_t
*
p_input
,
input_area_t
*
p_area
)
static
int
VCDSetArea
(
input_thread_t
*
p_input
,
input_area_t
*
p_area
)
{
{
thread_vcd_data_t
*
p_vcd
;
access_sys_t
*
p_sys
=
p_input
->
p_access_data
;
vlc_value_t
val
;
vlc_value_t
val
;
p_vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_access_data
;
/* we can't use the interface slider until initilization is complete */
/* we can't use the interface slider until initilization is complete */
p_input
->
stream
.
b_seekable
=
0
;
p_input
->
stream
.
b_seekable
=
0
;
...
@@ -403,8 +374,8 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
...
@@ -403,8 +374,8 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
/* Change the current track */
/* Change the current track */
/* The first track is not a valid one */
/* The first track is not a valid one */
p_
vcd
->
i_track
=
p_area
->
i_id
;
p_
sys
->
i_track
=
p_area
->
i_id
;
p_
vcd
->
i_sector
=
p_vcd
->
p_sectors
[
p_vcd
->
i_track
];
p_
sys
->
i_sector
=
p_sys
->
p_sectors
[
p_sys
->
i_track
];
/* Update the navigation variables without triggering a callback */
/* Update the navigation variables without triggering a callback */
val
.
i_int
=
p_area
->
i_id
;
val
.
i_int
=
p_area
->
i_id
;
...
@@ -417,18 +388,18 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
...
@@ -417,18 +388,18 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
}
}
}
}
if
(
p_
vcd
->
b_valid_ep
)
if
(
p_
sys
->
b_valid_ep
)
{
{
int
i_entry
=
p_area
->
i_plugin_data
/* 1st entry point of
int
i_entry
=
p_area
->
i_plugin_data
/* 1st entry point of
the track (area)*/
the track (area)*/
+
p_area
->
i_part
-
1
;
+
p_area
->
i_part
-
1
;
p_
vcd
->
i_sector
=
p_vcd
->
p_entries
[
i_entry
];
p_
sys
->
i_sector
=
p_sys
->
p_entries
[
i_entry
];
}
}
else
else
p_
vcd
->
i_sector
=
p_vcd
->
p_sectors
[
p_vcd
->
i_track
];
p_
sys
->
i_sector
=
p_sys
->
p_sectors
[
p_sys
->
i_track
];
p_input
->
stream
.
p_selected_area
->
i_tell
=
p_input
->
stream
.
p_selected_area
->
i_tell
=
(
off_t
)
p_
vcd
->
i_sector
*
(
off_t
)
VCD_DATA_SIZE
(
off_t
)
p_
sys
->
i_sector
*
(
off_t
)
VCD_DATA_SIZE
-
p_input
->
stream
.
p_selected_area
->
i_start
;
-
p_input
->
stream
.
p_selected_area
->
i_start
;
/* warn interface that something has changed */
/* warn interface that something has changed */
...
@@ -447,22 +418,20 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
...
@@ -447,22 +418,20 @@ static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
****************************************************************************/
****************************************************************************/
static
void
VCDSeek
(
input_thread_t
*
p_input
,
off_t
i_off
)
static
void
VCDSeek
(
input_thread_t
*
p_input
,
off_t
i_off
)
{
{
thread_vcd_data_t
*
p_vcd
;
access_sys_t
*
p_sys
=
p_input
->
p_access_data
;
unsigned
int
i_index
;
unsigned
int
i_index
;
p_vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_access_data
;
p_sys
->
i_sector
=
p_sys
->
p_sectors
[
p_sys
->
i_track
]
p_vcd
->
i_sector
=
p_vcd
->
p_sectors
[
p_vcd
->
i_track
]
+
i_off
/
(
off_t
)
VCD_DATA_SIZE
;
+
i_off
/
(
off_t
)
VCD_DATA_SIZE
;
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_lock
(
&
p_input
->
stream
.
stream_lock
);
#define p_area p_input->stream.p_selected_area
#define p_area p_input->stream.p_selected_area
/* Find chapter */
/* Find chapter */
if
(
p_
vcd
->
b_valid_ep
)
if
(
p_
sys
->
b_valid_ep
)
{
{
for
(
i_index
=
2
;
i_index
<=
p_area
->
i_part_nb
;
i_index
++
)
for
(
i_index
=
2
;
i_index
<=
p_area
->
i_part_nb
;
i_index
++
)
{
{
if
(
p_
vcd
->
i_sector
<
p_vcd
->
p_entries
[
p_area
->
i_plugin_data
if
(
p_
sys
->
i_sector
<
p_sys
->
p_entries
[
p_area
->
i_plugin_data
+
i_index
-
1
]
)
+
i_index
-
1
]
)
{
{
vlc_value_t
val
;
vlc_value_t
val
;
...
@@ -480,7 +449,7 @@ static void VCDSeek( input_thread_t * p_input, off_t i_off )
...
@@ -480,7 +449,7 @@ static void VCDSeek( input_thread_t * p_input, off_t i_off )
#undef p_area
#undef p_area
p_input
->
stream
.
p_selected_area
->
i_tell
=
p_input
->
stream
.
p_selected_area
->
i_tell
=
(
off_t
)
p_
vcd
->
i_sector
*
(
off_t
)
VCD_DATA_SIZE
(
off_t
)
p_
sys
->
i_sector
*
(
off_t
)
VCD_DATA_SIZE
-
p_input
->
stream
.
p_selected_area
->
i_start
;
-
p_input
->
stream
.
p_selected_area
->
i_start
;
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
vlc_mutex_unlock
(
&
p_input
->
stream
.
stream_lock
);
}
}
...
@@ -490,15 +459,13 @@ static void VCDSeek( input_thread_t * p_input, off_t i_off )
...
@@ -490,15 +459,13 @@ static void VCDSeek( input_thread_t * p_input, off_t i_off )
*****************************************************************************/
*****************************************************************************/
static
int
VCDEntryPoints
(
input_thread_t
*
p_input
)
static
int
VCDEntryPoints
(
input_thread_t
*
p_input
)
{
{
thread_vcd_data_t
*
p_vcd
;
access_sys_t
*
p_sys
=
p_input
->
p_access_data
;
byte_t
*
p_sector
;
byte_t
*
p_sector
;
entries_sect_t
entries
;
entries_sect_t
entries
;
uint16_t
i_nb
;
uint16_t
i_nb
;
int
i
,
i_entry_index
=
0
;
int
i
,
i_entry_index
=
0
;
int
i_previous_track
=
-
1
;
int
i_previous_track
=
-
1
;
p_vcd
=
(
thread_vcd_data_t
*
)
p_input
->
p_access_data
;
p_sector
=
malloc
(
VCD_DATA_SIZE
*
sizeof
(
byte_t
)
);
p_sector
=
malloc
(
VCD_DATA_SIZE
*
sizeof
(
byte_t
)
);
if
(
p_sector
==
NULL
)
if
(
p_sector
==
NULL
)
{
{
...
@@ -506,7 +473,7 @@ static int VCDEntryPoints( input_thread_t * p_input )
...
@@ -506,7 +473,7 @@ static int VCDEntryPoints( input_thread_t * p_input )
return
-
1
;
return
-
1
;
}
}
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
vcd
->
vcddev
,
if
(
ioctl_ReadSectors
(
VLC_OBJECT
(
p_input
),
p_
sys
->
vcddev
,
VCD_ENTRIES_SECTOR
,
p_sector
,
1
,
VCD_TYPE
)
<
0
)
VCD_ENTRIES_SECTOR
,
p_sector
,
1
,
VCD_TYPE
)
<
0
)
{
{
msg_Err
(
p_input
,
"could not read entry points sector"
);
msg_Err
(
p_input
,
"could not read entry points sector"
);
...
@@ -523,8 +490,8 @@ static int VCDEntryPoints( input_thread_t * p_input )
...
@@ -523,8 +490,8 @@ static int VCDEntryPoints( input_thread_t * p_input )
return
(
-
1
);
return
(
-
1
);
}
}
p_
vcd
->
p_entries
=
malloc
(
sizeof
(
int
)
*
i_nb
);
p_
sys
->
p_entries
=
malloc
(
sizeof
(
int
)
*
i_nb
);
if
(
p_
vcd
->
p_entries
==
NULL
)
if
(
p_
sys
->
p_entries
==
NULL
)
{
{
msg_Err
(
p_input
,
"not enough memory for entry points treatment"
);
msg_Err
(
p_input
,
"not enough memory for entry points treatment"
);
return
-
1
;
return
-
1
;
...
@@ -534,11 +501,11 @@ static int VCDEntryPoints( input_thread_t * p_input )
...
@@ -534,11 +501,11 @@ static int VCDEntryPoints( input_thread_t * p_input )
&&
strncmp
(
entries
.
psz_id
,
"ENTRYSVD"
,
sizeof
(
entries
.
psz_id
)
))
&&
strncmp
(
entries
.
psz_id
,
"ENTRYSVD"
,
sizeof
(
entries
.
psz_id
)
))
{
{
msg_Err
(
p_input
,
"unrecognized entry points format"
);
msg_Err
(
p_input
,
"unrecognized entry points format"
);
free
(
p_
vcd
->
p_entries
);
free
(
p_
sys
->
p_entries
);
return
-
1
;
return
-
1
;
}
}
p_
vcd
->
i_entries_nb
=
0
;
p_
sys
->
i_entries_nb
=
0
;
#define i_track BCD_TO_BIN(entries.entry[i].i_track)
#define i_track BCD_TO_BIN(entries.entry[i].i_track)
/* Reset the i_part_nb for each track */
/* Reset the i_part_nb for each track */
...
@@ -554,7 +521,7 @@ static int VCDEntryPoints( input_thread_t * p_input )
...
@@ -554,7 +521,7 @@ static int VCDEntryPoints( input_thread_t * p_input )
{
{
if
(
i_track
<=
p_input
->
stream
.
i_area_nb
)
if
(
i_track
<=
p_input
->
stream
.
i_area_nb
)
{
{
p_
vcd
->
p_entries
[
i_entry_index
]
=
p_
sys
->
p_entries
[
i_entry_index
]
=
(
MSF_TO_LBA2
(
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
minute
),
(
MSF_TO_LBA2
(
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
minute
),
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
second
),
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
second
),
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
frame
)
));
BCD_TO_BIN
(
entries
.
entry
[
i
].
msf
.
frame
)
));
...
@@ -568,10 +535,10 @@ static int VCDEntryPoints( input_thread_t * p_input )
...
@@ -568,10 +535,10 @@ static int VCDEntryPoints( input_thread_t * p_input )
i_previous_track
=
i_track
;
i_previous_track
=
i_track
;
}
}
msg_Dbg
(
p_input
,
"entry point %i begins at LBA: %i"
,
msg_Dbg
(
p_input
,
"entry point %i begins at LBA: %i"
,
i_entry_index
,
p_
vcd
->
p_entries
[
i_entry_index
]
);
i_entry_index
,
p_
sys
->
p_entries
[
i_entry_index
]
);
i_entry_index
++
;
i_entry_index
++
;
p_
vcd
->
i_entries_nb
++
;
p_
sys
->
i_entries_nb
++
;
}
}
else
else
msg_Warn
(
p_input
,
"wrong track number found in entry points"
);
msg_Warn
(
p_input
,
"wrong track number found in entry points"
);
...
...
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