Changeset 5e2537971a6e4870333667628e014cfe2e7381e8
- Timestamp:
- 11/09/06 21:17:17
(2 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1163103437 +0000
- git-parent:
[ea64177035896669780fc00f4edee086ab0094fa]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1163103437 +0000
- Message:
Handle seeking with best effort in dump filter
instead of aborting
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r919c654 |
r5e25379 |
|
| 76 | 76 | FILE *stream; |
|---|
| 77 | 77 | int64_t tmp_max; |
|---|
| | 78 | int64_t dumpsize; |
|---|
| 78 | 79 | }; |
|---|
| 79 | 80 | |
|---|
| … | … | |
| 146 | 147 | FILE *stream = p_sys->stream; |
|---|
| 147 | 148 | |
|---|
| 148 | | if ((stream == NULL) || (len == 0)) |
|---|
| | 149 | if ((stream == NULL) /* not dumping */ |
|---|
| | 150 | || (access->info.i_pos < p_sys->dumpsize) /* already known data */) |
|---|
| 149 | 151 | return; |
|---|
| | 152 | |
|---|
| | 153 | size_t needed = access->info.i_pos - p_sys->dumpsize; |
|---|
| | 154 | if (len < needed) |
|---|
| | 155 | return; /* gap between data and dump offset (seek too far ahead?) */ |
|---|
| | 156 | |
|---|
| | 157 | buffer += len - needed; |
|---|
| | 158 | len = needed; |
|---|
| | 159 | |
|---|
| | 160 | if (len == 0) |
|---|
| | 161 | return; /* no useful data */ |
|---|
| 150 | 162 | |
|---|
| 151 | 163 | if ((p_sys->tmp_max != -1) && (access->info.i_pos > p_sys->tmp_max)) |
|---|
| … | … | |
| 155 | 167 | } |
|---|
| 156 | 168 | |
|---|
| | 169 | assert (len > 0); |
|---|
| 157 | 170 | if (fwrite (buffer, len, 1, stream) != 1) |
|---|
| 158 | 171 | { |
|---|
| … | … | |
| 161 | 174 | } |
|---|
| 162 | 175 | |
|---|
| | 176 | p_sys->dumpsize += len; |
|---|
| 163 | 177 | return; |
|---|
| 164 | 178 | |
|---|
| … | … | |
| 178 | 192 | |
|---|
| 179 | 193 | Dump (access, buffer, len); |
|---|
| 180 | | //Trigger (access); |
|---|
| 181 | 194 | |
|---|
| 182 | 195 | return len; |
|---|
| … | … | |
| 222 | 235 | |
|---|
| 223 | 236 | if (p_sys->stream != NULL) |
|---|
| 224 | | { |
|---|
| 225 | | msg_Dbg (access, "seeking - dump will not work"); |
|---|
| 226 | | fclose (p_sys->stream); |
|---|
| 227 | | p_sys->stream = NULL; |
|---|
| 228 | | } |
|---|
| | 237 | msg_Dbg (access, "seeking - dump might not work"); |
|---|
| 229 | 238 | |
|---|
| 230 | 239 | src->info.i_update = access->info.i_update; |
|---|