- Timestamp:
- 02/04/08 22:26:46 (4 years ago)
- Location:
- trunk/fm_server/src/fm_input_gst
- Files:
-
- 4 modified
-
fm_input_gst.c (modified) (6 diffs)
-
fm_input_gst.h (modified) (1 diff)
-
fm_input_gst_common.h (modified) (2 diffs)
-
gstfmsink.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/fm_server/src/fm_input_gst/fm_input_gst.c
r221 r222 515 515 fm_buffer_reset_flags (buffer); 516 516 517 //guint64 current_pos_samples = ns_to_samples (common, input_gst->current_pos_nsec);518 519 517 /* Check if we should perform a seek */ 520 518 if ((input_gst->seek_at_ns > -1) && chk){ … … 537 535 chk->samples_behind_us += samples_to_seek; // yes, the "+" is correct 538 536 } 537 chk->samples_read += samples_to_seek; 539 538 FM_BUFFER_DISCONT (buffer) = TRUE; 540 539 } else { … … 579 578 580 579 input_gst->current_pos_samples = ns_to_samples (common, chk->start_timestamp); 581 //input_gst->current_pos_ns = chk->start_timestamp;582 580 g_print("skipping... new position = %llu\n", (long long unsigned int) chk->start_timestamp); 583 581 … … 608 606 // memset((char*) input_gst->interleaved_buffer, 0, SAMPLES_TO_BYTES(STD_CHUNK_N_SAMPLES)); 609 607 610 / / bytes da scartare608 /* Calculate how much to read */ 611 609 guint samples_from_ring = chk->samples_behind_us + FM_BUFFER_REQUESTED(buffer); 612 610 guint bytes_from_ring = SAMPLES_TO_BYTES(samples_from_ring); 613 /* guint64 eof_samples = ns_to_samples (common, chk->eof_timestamp);*/ 614 615 /* if (eof_samples > 0) {*/ 616 if (chk->eof_samples > 0) { 617 // g_print ("Get ready for EOF at chunk pos %lld\n", (long long int) chk->eof_samples); 618 619 if (chk->samples_read + FM_BUFFER_REQUESTED (buffer) > chk->eof_samples) 620 bytes_from_ring = SAMPLES_TO_BYTES (chk->eof_samples - chk->samples_read); 621 622 /* if ((input_gst->current_pos_samples + FM_BUFFER_REQUESTED (buffer)) > eof_samples) 623 bytes_from_ring = SAMPLES_TO_BYTES (eof_samples - input_gst->current_pos_samples);*/ 624 } 611 612 /* Check for EOF */ 613 if ((chk->eof_samples > 0) && (chk->samples_read + FM_BUFFER_REQUESTED (buffer) > chk->eof_samples)) 614 bytes_from_ring = SAMPLES_TO_BYTES (chk->eof_samples - chk->samples_read); 625 615 626 616 size_t read_bytes = jack_ringbuffer_peek(chk->ring, (gchar *) input_gst->interleaved_buffer, bytes_from_ring); … … 650 640 651 641 /* Check for EOF */ 652 /* if ((eof_samples) && (input_gst->current_pos_samples >= eof_samples)) {*/653 642 if ((chk->eof_samples > 0) && (chk->samples_read >= chk->eof_samples)) { 654 643 g_print ("We're at %lld samples - end of file!\n", (long long int) input_gst->current_pos_samples); … … 669 658 chk->samples_behind_us += useful_read_samples; 670 659 } 671 // g_print("behind us %d bytes\n", input_gst->bytes_behind_us);672 660 673 661 -
trunk/fm_server/src/fm_input_gst/fm_input_gst.h
r221 r222 44 44 45 45 gint64 current_pos_samples; 46 // gint64 current_pos_nsec;47 46 48 47 gboolean play_when_ready; -
trunk/fm_server/src/fm_input_gst/fm_input_gst_common.h
r221 r222 48 48 guint samples_behind_us; 49 49 50 /* FIXME: "eof" should be moved to FmInputGst */51 50 gboolean eof; // the file ends somewhere in this chunk 52 GstClockTime eof_timestamp; // where the file ends (stream timestamp)53 51 guint64 eof_samples; // where the file ends (RELATIVE TO CHUNK START!!!!) 52 54 53 gboolean start_of_file; // 1° buffer of the file 55 54 … … 57 56 // if TRUE, the buffer will be freed by the GST thread in _do_cleanup() 58 57 59 guint64 samples_read; 58 guint64 samples_read; // how many samples FmInputGst has read from this chunk 60 59 }; 61 60 -
trunk/fm_server/src/fm_input_gst/gstfmsink.c
r221 r222 236 236 case GST_EVENT_EOS: { 237 237 g_return_val_if_fail (common->write_chunk, TRUE); 238 common->write_chunk->eof_timestamp = sink->start_timestamp;239 238 common->write_chunk->eof_samples = sink->position_samples; 240 g_print("> got EOF at timestamp %lld\n", (long long int) common->write_chunk->eof_timestamp);239 g_print("> got EOF at timestamp %lld\n", (long long int) sink->start_timestamp); 241 240 sink->seek_in_progress = FALSE; 242 241 sink->seek_target_timestamp = -1;
