Changeset 5bdef1c76ad3d3e6ef9601265362dc49bc05ee0c
- Timestamp:
- 17/10/04 15:38:22
(4 years ago)
- Author:
- Derk-Jan Hartman <hartman@videolan.org>
- git-committer:
- Derk-Jan Hartman <hartman@videolan.org> 1098020302 +0000
- git-parent:
[a95e32965feec730866b90d0ab544d05a69b1d50]
- git-author:
- Derk-Jan Hartman <hartman@videolan.org> 1098020302 +0000
- Message:
* vobsub.c: implemented vobsub seeking support.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r24b0610 |
r5bdef1c |
|
| 70 | 70 | typedef struct |
|---|
| 71 | 71 | { |
|---|
| 72 | | mtime_t i_start; |
|---|
| | 72 | int64_t i_start; |
|---|
| 73 | 73 | int i_vobsub_location; |
|---|
| 74 | 74 | } subtitle_t; |
|---|
| … | … | |
| 166 | 166 | { |
|---|
| 167 | 167 | if( p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start > p_sys->i_length ) |
|---|
| 168 | | p_sys->i_length = (mtime_t) p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start + 1 * 1000 * 1000; |
|---|
| | 168 | p_sys->i_length = (int64_t) p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start + ( 1 *1000 *1000 ); |
|---|
| 169 | 169 | } |
|---|
| 170 | 170 | } |
|---|
| … | … | |
| 215 | 215 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 216 | 216 | int64_t *pi64, i64; |
|---|
| | 217 | int i; |
|---|
| 217 | 218 | double *pf, f; |
|---|
| 218 | 219 | |
|---|
| … | … | |
| 221 | 222 | case DEMUX_GET_LENGTH: |
|---|
| 222 | 223 | pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| 223 | | *pi64 = p_sys->i_length; |
|---|
| | 224 | *pi64 = (int64_t) p_sys->i_length; |
|---|
| 224 | 225 | return VLC_SUCCESS; |
|---|
| 225 | 226 | |
|---|
| 226 | 227 | case DEMUX_GET_TIME: |
|---|
| 227 | 228 | pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| 228 | | /*if( p_sys->i_current_subtitle < p_sys->i_subtitles ) |
|---|
| 229 | | { |
|---|
| 230 | | *pi64 = p_sys->subtitle[p_sys->i_current_subtitle].i_start; |
|---|
| | 229 | for( i = 0; i < p_sys->i_tracks; i++ ) |
|---|
| | 230 | { |
|---|
| | 231 | vlc_bool_t b_selected; |
|---|
| | 232 | /* Check the ES is selected */ |
|---|
| | 233 | es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, |
|---|
| | 234 | p_sys->track[i].p_es, &b_selected ); |
|---|
| | 235 | if( b_selected ) break; |
|---|
| | 236 | } |
|---|
| | 237 | if( i < p_sys->i_tracks && p_sys->track[i].i_current_subtitle < p_sys->track[i].i_subtitles ) |
|---|
| | 238 | { |
|---|
| | 239 | *pi64 = p_sys->track[i].p_subtitles[p_sys->track[i].i_current_subtitle].i_start; |
|---|
| 231 | 240 | return VLC_SUCCESS; |
|---|
| 232 | | }*/ |
|---|
| | 241 | } |
|---|
| 233 | 242 | return VLC_EGENERIC; |
|---|
| 234 | 243 | |
|---|
| 235 | 244 | case DEMUX_SET_TIME: |
|---|
| 236 | 245 | i64 = (int64_t)va_arg( args, int64_t ); |
|---|
| 237 | | /*p_sys->i_current_subtitle = 0; |
|---|
| 238 | | while( p_sys->i_current_subtitle < p_sys->i_subtitles && |
|---|
| 239 | | p_sys->subtitle[p_sys->i_current_subtitle].i_start < i64 ) |
|---|
| 240 | | { |
|---|
| 241 | | p_sys->i_current_subtitle++; |
|---|
| 242 | | } |
|---|
| 243 | | |
|---|
| 244 | | if( p_sys->i_current_subtitle >= p_sys->i_subtitles ) |
|---|
| 245 | | return VLC_EGENERIC;*/ |
|---|
| | 246 | for( i = 0; i < p_sys->i_tracks; i++ ) |
|---|
| | 247 | { |
|---|
| | 248 | p_sys->track[i].i_current_subtitle = 0; |
|---|
| | 249 | while( p_sys->track[i].i_current_subtitle < p_sys->track[i].i_subtitles && |
|---|
| | 250 | p_sys->track[i].p_subtitles[p_sys->track[i].i_current_subtitle].i_start < i64 ) |
|---|
| | 251 | { |
|---|
| | 252 | p_sys->track[i].i_current_subtitle++; |
|---|
| | 253 | } |
|---|
| | 254 | |
|---|
| | 255 | if( p_sys->track[i].i_current_subtitle >= p_sys->track[i].i_subtitles ) |
|---|
| | 256 | return VLC_EGENERIC; |
|---|
| | 257 | } |
|---|
| 246 | 258 | return VLC_SUCCESS; |
|---|
| 247 | 259 | |
|---|
| 248 | 260 | case DEMUX_GET_POSITION: |
|---|
| 249 | 261 | pf = (double*)va_arg( args, double * ); |
|---|
| 250 | | /*if( p_sys->i_current_subtitle >= p_sys->i_subtitles ) |
|---|
| | 262 | for( i = 0; i < p_sys->i_tracks; i++ ) |
|---|
| | 263 | { |
|---|
| | 264 | vlc_bool_t b_selected; |
|---|
| | 265 | /* Check the ES is selected */ |
|---|
| | 266 | es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, |
|---|
| | 267 | p_sys->track[i].p_es, &b_selected ); |
|---|
| | 268 | if( b_selected ) break; |
|---|
| | 269 | } |
|---|
| | 270 | if( p_sys->track[i].i_current_subtitle >= p_sys->track[i].i_subtitles ) |
|---|
| 251 | 271 | { |
|---|
| 252 | 272 | *pf = 1.0; |
|---|
| 253 | 273 | } |
|---|
| 254 | | else if( p_sys->i_subtitles > 0 ) |
|---|
| 255 | | { |
|---|
| 256 | | *pf = (double)p_sys->subtitle[p_sys->i_current_subtitle].i_start / |
|---|
| | 274 | else if( p_sys->track[i].i_subtitles > 0 ) |
|---|
| | 275 | { |
|---|
| | 276 | *pf = (double)p_sys->track[i].p_subtitles[p_sys->track[i].i_current_subtitle].i_start / |
|---|
| 257 | 277 | (double)p_sys->i_length; |
|---|
| 258 | 278 | } |
|---|
| … | … | |
| 260 | 280 | { |
|---|
| 261 | 281 | *pf = 0.0; |
|---|
| 262 | | }*/ |
|---|
| | 282 | } |
|---|
| 263 | 283 | return VLC_SUCCESS; |
|---|
| 264 | 284 | |
|---|
| 265 | 285 | case DEMUX_SET_POSITION: |
|---|
| 266 | 286 | f = (double)va_arg( args, double ); |
|---|
| 267 | | /*i64 = f * p_sys->i_length; |
|---|
| 268 | | |
|---|
| 269 | | p_sys->i_current_subtitle = 0; |
|---|
| 270 | | while( p_sys->i_current_subtitle < p_sys->i_subtitles && |
|---|
| 271 | | p_sys->subtitle[p_sys->i_current_subtitle].i_start < i64 ) |
|---|
| 272 | | { |
|---|
| 273 | | p_sys->i_current_subtitle++; |
|---|
| 274 | | } |
|---|
| 275 | | if( p_sys->i_current_subtitle >= p_sys->i_subtitles ) |
|---|
| 276 | | return VLC_EGENERIC;*/ |
|---|
| | 287 | i64 = (int64_t) f * p_sys->i_length; |
|---|
| | 288 | |
|---|
| | 289 | for( i = 0; i < p_sys->i_tracks; i++ ) |
|---|
| | 290 | { |
|---|
| | 291 | p_sys->track[i].i_current_subtitle = 0; |
|---|
| | 292 | while( p_sys->track[i].i_current_subtitle < p_sys->track[i].i_subtitles && |
|---|
| | 293 | p_sys->track[i].p_subtitles[p_sys->track[i].i_current_subtitle].i_start < i64 ) |
|---|
| | 294 | { |
|---|
| | 295 | p_sys->track[i].i_current_subtitle++; |
|---|
| | 296 | } |
|---|
| | 297 | if( p_sys->track[i].i_current_subtitle >= p_sys->track[i].i_subtitles ) |
|---|
| | 298 | return VLC_EGENERIC; |
|---|
| | 299 | } |
|---|
| 277 | 300 | return VLC_SUCCESS; |
|---|
| 278 | 301 | |
|---|
| … | … | |
| 305 | 328 | #define tk p_sys->track[i] |
|---|
| 306 | 329 | if( tk.i_current_subtitle >= tk.i_subtitles ) |
|---|
| 307 | | return 0; |
|---|
| 308 | | |
|---|
| 309 | | i_maxdate = p_sys->i_next_demux_date; |
|---|
| | 330 | continue; |
|---|
| | 331 | |
|---|
| | 332 | i_maxdate = (int64_t) p_sys->i_next_demux_date; |
|---|
| 310 | 333 | if( i_maxdate <= 0 && tk.i_current_subtitle < tk.i_subtitles ) |
|---|
| 311 | 334 | { |
|---|
| 312 | 335 | /* Should not happen */ |
|---|
| 313 | | i_maxdate = tk.p_subtitles[tk.i_current_subtitle].i_start + 1; |
|---|
| | 336 | i_maxdate = (int64_t) tk.p_subtitles[tk.i_current_subtitle].i_start + 1; |
|---|
| 314 | 337 | } |
|---|
| 315 | 338 | |
|---|
| … | … | |
| 496 | 519 | * |
|---|
| 497 | 520 | */ |
|---|
| 498 | | unsigned int h, m, s, ms, loc; |
|---|
| 499 | | int i_start, i_location = 0; |
|---|
| | 521 | int h, m, s, ms, loc; |
|---|
| | 522 | int64_t i_start, i_location = 0; |
|---|
| 500 | 523 | |
|---|
| 501 | 524 | vobsub_track_t *current_tk = &p_sys->track[p_sys->i_tracks - 1]; |
|---|
| … | … | |
| 506 | 529 | subtitle_t *current_sub; |
|---|
| 507 | 530 | |
|---|
| 508 | | i_start = ( (mtime_t)h * 3600*1000 + |
|---|
| 509 | | (mtime_t)m * 60*1000 + |
|---|
| 510 | | (mtime_t)s * 1000 + |
|---|
| 511 | | (mtime_t)ms ) * 1000; |
|---|
| | 531 | i_start = (int64_t) ( h * 3600*1000 + |
|---|
| | 532 | m * 60*1000 + |
|---|
| | 533 | s * 1000 + |
|---|
| | 534 | ms ) * 1000; |
|---|
| 512 | 535 | i_location = loc; |
|---|
| 513 | 536 | |
|---|
| … | … | |
| 516 | 539 | current_sub = ¤t_tk->p_subtitles[current_tk->i_subtitles - 1]; |
|---|
| 517 | 540 | |
|---|
| 518 | | current_sub->i_start = i_start; |
|---|
| | 541 | current_sub->i_start = (int64_t) i_start; |
|---|
| 519 | 542 | current_sub->i_vobsub_location = i_location; |
|---|
| 520 | 543 | } |
|---|
| … | … | |
| 550 | 573 | if( p[3] != 0xbd ) |
|---|
| 551 | 574 | { |
|---|
| 552 | | msg_Dbg( p_demux, "we don't need these ps packets (id=0x1%2.2x)", p[3] ); |
|---|
| | 575 | /* msg_Dbg( p_demux, "we don't need these ps packets (id=0x1%2.2x)", p[3] ); */ |
|---|
| 553 | 576 | p += i_size; |
|---|
| 554 | 577 | continue; |
|---|
| … | … | |
| 568 | 591 | } |
|---|
| 569 | 592 | i_spu = i_id&0x1f; |
|---|
| 570 | | msg_Dbg( p_demux, "SPU track %d size %d", i_spu, i_size ); |
|---|
| 571 | | |
|---|
| 572 | | /* FIXME i_spu == determines which of the spu tracks we will show. */ |
|---|
| | 593 | /* msg_Dbg( p_demux, "SPU track %d size %d", i_spu, i_size ); */ |
|---|
| | 594 | |
|---|
| 573 | 595 | for( i = 0; i < p_sys->i_tracks; i++ ) |
|---|
| 574 | 596 | { |
|---|