| 450 | } |
| 451 | |
| 452 | static int reader_work( hb_work_object_t * w, hb_buffer_t ** buf_in, |
| 453 | hb_buffer_t ** buf_out) |
| 454 | { |
| 455 | hb_work_private_t * r = w->private_data; |
| 456 | hb_fifo_t ** fifos; |
| 457 | hb_buffer_t * buf; |
| 458 | hb_buffer_list_t list; |
| 459 | int ii, chapter = -1; |
| 460 | |
| 461 | hb_buffer_list_clear(&list); |
| 462 | |
| 463 | if (r->bd) |
| 464 | chapter = hb_bd_chapter( r->bd ); |
| 465 | else if (r->dvd) |
| 466 | chapter = hb_dvd_chapter( r->dvd ); |
| 467 | else if (r->stream) |
| 468 | chapter = hb_stream_chapter( r->stream ); |
| 469 | |
| 470 | if( chapter < 0 ) |
| 471 | { |
| 472 | hb_log( "reader: end of the title reached" ); |
| 473 | reader_send_eof(r); |
| 474 | return HB_WORK_DONE; |
| 475 | } |
| 476 | if( chapter > r->chapter_end ) |
| 477 | { |
| 478 | hb_log("reader: end of chapter %d (media %d) reached at media chapter %d", |
| 479 | r->job->chapter_end, r->chapter_end, chapter); |
| 480 | reader_send_eof(r); |
| 481 | return HB_WORK_DONE; |
| 482 | } |
| 483 | |
| 484 | if (r->bd) |
| 485 | { |
| 486 | if( (buf = hb_bd_read( r->bd )) == NULL ) |
| 487 | { |
| 488 | reader_send_eof(r); |
| 489 | return HB_WORK_DONE; |
| 490 | } |
| 491 | } |
| 492 | else if (r->dvd) |
| 493 | { |
| 494 | if( (buf = hb_dvd_read( r->dvd )) == NULL ) |
| 495 | { |
| 496 | reader_send_eof(r); |
| 497 | return HB_WORK_DONE; |
| 498 | } |
| 499 | } |
| 500 | else if (r->stream) |
| 501 | { |
| 502 | if ( (buf = hb_stream_read( r->stream )) == NULL ) |
| 503 | { |
| 504 | reader_send_eof(r); |
| 505 | return HB_WORK_DONE; |
| 506 | } |
| 507 | } |
| 508 | else |
| 509 | { |
nothing calls this directly
no test coverage detected