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
03df9567
Commit
03df9567
authored
Nov 25, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes: #847
parent
97130e01
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
modules/access_filter/dump.c
modules/access_filter/dump.c
+25
-20
No files found.
modules/access_filter/dump.c
View file @
03df9567
...
@@ -85,6 +85,7 @@ static int Open (vlc_object_t *obj)
...
@@ -85,6 +85,7 @@ static int Open (vlc_object_t *obj)
{
{
access_t
*
access
=
(
access_t
*
)
obj
;
access_t
*
access
=
(
access_t
*
)
obj
;
access_t
*
src
=
access
->
p_source
;
access_t
*
src
=
access
->
p_source
;
access_sys_t
*
p_sys
;
if
(
!
var_CreateGetBool
(
access
,
"dump-force"
))
if
(
!
var_CreateGetBool
(
access
,
"dump-force"
))
{
{
...
@@ -106,7 +107,7 @@ static int Open (vlc_object_t *obj)
...
@@ -106,7 +107,7 @@ static int Open (vlc_object_t *obj)
access
->
pf_control
=
Control
;
access
->
pf_control
=
Control
;
access
->
info
=
src
->
info
;
access
->
info
=
src
->
info
;
access_sys_t
*
p_sys
=
access
->
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
p_sys
=
access
->
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
if
(
p_sys
==
NULL
)
if
(
p_sys
==
NULL
)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
));
memset
(
p_sys
,
0
,
sizeof
(
*
p_sys
));
...
@@ -145,12 +146,13 @@ static void Dump (access_t *access, const uint8_t *buffer, size_t len)
...
@@ -145,12 +146,13 @@ static void Dump (access_t *access, const uint8_t *buffer, size_t len)
{
{
access_sys_t
*
p_sys
=
access
->
p_sys
;
access_sys_t
*
p_sys
=
access
->
p_sys
;
FILE
*
stream
=
p_sys
->
stream
;
FILE
*
stream
=
p_sys
->
stream
;
size_t
needed
;
if
((
stream
==
NULL
)
/* not dumping */
if
((
stream
==
NULL
)
/* not dumping */
||
(
access
->
info
.
i_pos
<
p_sys
->
dumpsize
)
/* already known data */
)
||
(
access
->
info
.
i_pos
<
p_sys
->
dumpsize
)
/* already known data */
)
return
;
return
;
size_t
needed
=
access
->
info
.
i_pos
-
p_sys
->
dumpsize
;
needed
=
access
->
info
.
i_pos
-
p_sys
->
dumpsize
;
if
(
len
<
needed
)
if
(
len
<
needed
)
return
;
/* gap between data and dump offset (seek too far ahead?) */
return
;
/* gap between data and dump offset (seek too far ahead?) */
...
@@ -226,6 +228,7 @@ static int Seek (access_t *access, int64_t offset)
...
@@ -226,6 +228,7 @@ static int Seek (access_t *access, int64_t offset)
{
{
access_t
*
src
=
access
->
p_source
;
access_t
*
src
=
access
->
p_source
;
access_sys_t
*
p_sys
=
access
->
p_sys
;
access_sys_t
*
p_sys
=
access
->
p_sys
;
int
ret
;
if
(
p_sys
->
tmp_max
==
-
1
)
if
(
p_sys
->
tmp_max
==
-
1
)
{
{
...
@@ -237,7 +240,7 @@ static int Seek (access_t *access, int64_t offset)
...
@@ -237,7 +240,7 @@ static int Seek (access_t *access, int64_t offset)
msg_Dbg
(
access
,
"seeking - dump might not work"
);
msg_Dbg
(
access
,
"seeking - dump might not work"
);
src
->
info
.
i_update
=
access
->
info
.
i_update
;
src
->
info
.
i_update
=
access
->
info
.
i_update
;
int
ret
=
src
->
pf_seek
(
src
,
offset
);
ret
=
src
->
pf_seek
(
src
,
offset
);
access
->
info
=
src
->
info
;
access
->
info
=
src
->
info
;
return
ret
;
return
ret
;
}
}
...
@@ -265,6 +268,10 @@ static inline struct tm *localtime_r (const time_t *now, struct tm *res)
...
@@ -265,6 +268,10 @@ static inline struct tm *localtime_r (const time_t *now, struct tm *res)
static
void
Trigger
(
access_t
*
access
)
static
void
Trigger
(
access_t
*
access
)
{
{
access_sys_t
*
p_sys
=
access
->
p_sys
;
access_sys_t
*
p_sys
=
access
->
p_sys
;
const
char
*
home
=
access
->
p_vlc
->
psz_homedir
;
FILE
*
newstream
,
*
oldstream
;
struct
tm
t
;
time_t
now
;
if
(
p_sys
->
stream
==
NULL
)
if
(
p_sys
->
stream
==
NULL
)
return
;
// too late
return
;
// too late
...
@@ -272,10 +279,8 @@ static void Trigger (access_t *access)
...
@@ -272,10 +279,8 @@ static void Trigger (access_t *access)
if
(
p_sys
->
tmp_max
==
-
1
)
if
(
p_sys
->
tmp_max
==
-
1
)
return
;
// already triggered - should we stop? FIXME
return
;
// already triggered - should we stop? FIXME
time_t
now
;
time
(
&
now
);
time
(
&
now
);
struct
tm
t
;
if
(
localtime_r
(
&
now
,
&
t
)
==
NULL
)
if
(
localtime_r
(
&
now
,
&
t
)
==
NULL
)
return
;
// No time, eh? Well, I'd rather not run on your computer.
return
;
// No time, eh? Well, I'd rather not run on your computer.
...
@@ -283,9 +288,8 @@ static void Trigger (access_t *access)
...
@@ -283,9 +288,8 @@ static void Trigger (access_t *access)
// Humanity is about 300 times older than when this was written,
// Humanity is about 300 times older than when this was written,
// and there is an off-by-one in the following sprintf().
// and there is an off-by-one in the following sprintf().
return
;
return
;
else
const
char
*
home
=
access
->
p_vlc
->
psz_homedir
;
{
/* Hmm what about the extension?? */
/* Hmm what about the extension?? */
char
filename
[
strlen
(
home
)
+
sizeof
(
"/vlcdump-YYYYYYYYY-MM-DD-HH-MM-SS.ts"
)];
char
filename
[
strlen
(
home
)
+
sizeof
(
"/vlcdump-YYYYYYYYY-MM-DD-HH-MM-SS.ts"
)];
sprintf
(
filename
,
"%s/vlcdump-%04u-%02u-%02u-%02u-%02u-%02u.ts"
,
home
,
sprintf
(
filename
,
"%s/vlcdump-%04u-%02u-%02u-%02u-%02u-%02u.ts"
,
home
,
...
@@ -293,16 +297,17 @@ static void Trigger (access_t *access)
...
@@ -293,16 +297,17 @@ static void Trigger (access_t *access)
msg_Info
(
access
,
"dumping media to
\"
%s
\"
..."
,
filename
);
msg_Info
(
access
,
"dumping media to
\"
%s
\"
..."
,
filename
);
FILE
*
newstream
=
fopen
(
filename
,
"wb"
);
newstream
=
fopen
(
filename
,
"wb"
);
if
(
newstream
==
NULL
)
if
(
newstream
==
NULL
)
{
{
msg_Err
(
access
,
"cannot create dump file
\"
%s
\"
: %s"
,
filename
,
msg_Err
(
access
,
"cannot create dump file
\"
%s
\"
: %s"
,
filename
,
strerror
(
errno
));
strerror
(
errno
));
return
;
return
;
}
}
}
/* This might cause excessive hard drive work :( */
/* This might cause excessive hard drive work :( */
FILE
*
oldstream
=
p_sys
->
stream
;
oldstream
=
p_sys
->
stream
;
rewind
(
oldstream
);
rewind
(
oldstream
);
for
(;;)
for
(;;)
...
...
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