Changeset 109 for fm_server/trunk/src/fm_input_gst/fm_input_gst.c
- Timestamp:
- 09/02/06 23:16:15 (6 years ago)
- Files:
-
- 1 modified
-
fm_server/trunk/src/fm_input_gst/fm_input_gst.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fm_server/trunk/src/fm_input_gst/fm_input_gst.c
r108 r109 15 15 #include "gstfmsink.h" 16 16 #include "fm_input_gst.h" 17 18 //#define USE_AUDIORESAMPLE 17 19 18 20 extern int temp_fd; … … 369 371 370 372 common->converter = gst_element_factory_make ("audioconvert", "converter"); 371 // common->resampler = gst_element_factory_make ("audioresample", "resampler"); 373 #ifdef USE_AUDIORESAMPLE 374 common->resampler = gst_element_factory_make ("audioresample", "resampler"); 375 #endif 372 376 common->output_pad = gst_element_get_pad (common->converter, "sink"); 373 377 common->sink = gst_element_factory_make ("fm_sink", "sink"); 374 378 375 379 gst_bin_add_many (GST_BIN (common->output_bin), common->converter, 376 /*common->resampler,*/ common->sink, NULL); 377 378 gst_element_link_many (common->converter, /*common->resampler,*/ common->sink, NULL); 380 #ifdef USE_AUDIORESAMPLE 381 common->resampler, 382 #endif 383 common->sink, NULL); 384 385 gst_element_link_many (common->converter, 386 #ifdef USE_AUDIORESAMPLE 387 common->resampler, 388 #endif 389 common->sink, NULL); 379 390 380 391 gst_element_add_pad (common->output_bin, gst_ghost_pad_new ("sink", common->output_pad)); … … 450 461 } 451 462 452 if (input_gst->seek_at_sample > -1) { 463 if ((input_gst->seek_at_sample > -1) && chk){ 464 453 465 glong first_avail_sample = input_gst->current_pos_samples - BYTES_TO_SAMPLES(chk->bytes_behind_us); 454 466 glong last_avail_sample = input_gst->current_pos_samples + BYTES_TO_SAMPLES(jack_ringbuffer_read_space(chk->ring)); // we need an offset … … 485 497 // bytes da scartare 486 498 guint bytes_from_ring = chk->bytes_behind_us + SAMPLES_TO_BYTES(FM_BUFFER_REQUESTED(buffer)); 499 if ((chk->eos_offset_samples > 0) && 500 ((input_gst->current_pos_samples + FM_BUFFER_REQUESTED (buffer)) > chk->eos_offset_samples)) 501 bytes_from_ring = SAMPLES_TO_BYTES (chk->eos_offset_samples - input_gst->current_pos_samples); 502 487 503 size_t read_bytes = jack_ringbuffer_peek(chk->ring, (gchar *) input_gst->interleaved_buffer, bytes_from_ring); 488 504 … … 503 519 504 520 if ((chk->eos_offset_samples) && (input_gst->current_pos_samples >= chk->eos_offset_samples)) { 505 g_print ("We're at % d samples - end of file!\n", input_gst->current_pos_samples);521 g_print ("We're at %lld samples - end of file!\n", input_gst->current_pos_samples); 506 522 common->read_chunk = NULL; 507 523 }
