Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
5e253797
Commit
5e253797
authored
Nov 09, 2006
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle seeking with best effort in dump filter
instead of aborting
parent
ea641770
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
modules/access_filter/dump.c
modules/access_filter/dump.c
+16
-7
No files found.
modules/access_filter/dump.c
View file @
5e253797
...
@@ -75,6 +75,7 @@ struct access_sys_t
...
@@ -75,6 +75,7 @@ struct access_sys_t
{
{
FILE
*
stream
;
FILE
*
stream
;
int64_t
tmp_max
;
int64_t
tmp_max
;
int64_t
dumpsize
;
};
};
/**
/**
...
@@ -145,21 +146,34 @@ static void Dump (access_t *access, const uint8_t *buffer, size_t len)
...
@@ -145,21 +146,34 @@ 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
;
if
((
stream
==
NULL
)
||
(
len
==
0
))
if
((
stream
==
NULL
)
/* not dumping */
||
(
access
->
info
.
i_pos
<
p_sys
->
dumpsize
)
/* already known data */
)
return
;
return
;
size_t
needed
=
access
->
info
.
i_pos
-
p_sys
->
dumpsize
;
if
(
len
<
needed
)
return
;
/* gap between data and dump offset (seek too far ahead?) */
buffer
+=
len
-
needed
;
len
=
needed
;
if
(
len
==
0
)
return
;
/* no useful data */
if
((
p_sys
->
tmp_max
!=
-
1
)
&&
(
access
->
info
.
i_pos
>
p_sys
->
tmp_max
))
if
((
p_sys
->
tmp_max
!=
-
1
)
&&
(
access
->
info
.
i_pos
>
p_sys
->
tmp_max
))
{
{
msg_Dbg
(
access
,
"too much data - dump will not work"
);
msg_Dbg
(
access
,
"too much data - dump will not work"
);
goto
error
;
goto
error
;
}
}
assert
(
len
>
0
);
if
(
fwrite
(
buffer
,
len
,
1
,
stream
)
!=
1
)
if
(
fwrite
(
buffer
,
len
,
1
,
stream
)
!=
1
)
{
{
msg_Err
(
access
,
"cannot write to file: %s"
,
strerror
(
errno
));
msg_Err
(
access
,
"cannot write to file: %s"
,
strerror
(
errno
));
goto
error
;
goto
error
;
}
}
p_sys
->
dumpsize
+=
len
;
return
;
return
;
error:
error:
...
@@ -177,7 +191,6 @@ static int Read (access_t *access, uint8_t *buffer, int len)
...
@@ -177,7 +191,6 @@ static int Read (access_t *access, uint8_t *buffer, int len)
access
->
info
=
src
->
info
;
access
->
info
=
src
->
info
;
Dump
(
access
,
buffer
,
len
);
Dump
(
access
,
buffer
,
len
);
//Trigger (access);
return
len
;
return
len
;
}
}
...
@@ -221,11 +234,7 @@ static int Seek (access_t *access, int64_t offset)
...
@@ -221,11 +234,7 @@ static int Seek (access_t *access, int64_t offset)
}
}
if
(
p_sys
->
stream
!=
NULL
)
if
(
p_sys
->
stream
!=
NULL
)
{
msg_Dbg
(
access
,
"seeking - dump might not work"
);
msg_Dbg
(
access
,
"seeking - dump will not work"
);
fclose
(
p_sys
->
stream
);
p_sys
->
stream
=
NULL
;
}
src
->
info
.
i_update
=
access
->
info
.
i_update
;
src
->
info
.
i_update
=
access
->
info
.
i_update
;
int
ret
=
src
->
pf_seek
(
src
,
offset
);
int
ret
=
src
->
pf_seek
(
src
,
offset
);
...
...
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