Changeset 222

Show
Ignore:
Timestamp:
02/04/08 22:26:46 (4 years ago)
Author:
ath
Message:

Other cleanups for FmInputGst.

Location:
trunk/fm_server/src/fm_input_gst
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/fm_server/src/fm_input_gst/fm_input_gst.c

    r221 r222  
    515515        fm_buffer_reset_flags (buffer); 
    516516 
    517         //guint64 current_pos_samples = ns_to_samples (common, input_gst->current_pos_nsec); 
    518  
    519517        /* Check if we should perform a seek */ 
    520518        if ((input_gst->seek_at_ns > -1) && chk){ 
     
    537535                                chk->samples_behind_us += samples_to_seek;      // yes, the "+" is correct 
    538536                        } 
     537                        chk->samples_read += samples_to_seek; 
    539538                        FM_BUFFER_DISCONT (buffer) = TRUE; 
    540539                } else { 
     
    579578                 
    580579                input_gst->current_pos_samples = ns_to_samples (common, chk->start_timestamp); 
    581                 //input_gst->current_pos_ns = chk->start_timestamp; 
    582580                g_print("skipping... new position = %llu\n", (long long unsigned int) chk->start_timestamp); 
    583581 
     
    608606//      memset((char*) input_gst->interleaved_buffer, 0, SAMPLES_TO_BYTES(STD_CHUNK_N_SAMPLES)); 
    609607 
    610         // bytes da scartare 
     608        /* Calculate how much to read */ 
    611609        guint samples_from_ring = chk->samples_behind_us + FM_BUFFER_REQUESTED(buffer); 
    612610        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); 
    625615 
    626616        size_t read_bytes = jack_ringbuffer_peek(chk->ring, (gchar *) input_gst->interleaved_buffer, bytes_from_ring); 
     
    650640 
    651641        /* Check for EOF */ 
    652 /*      if ((eof_samples) && (input_gst->current_pos_samples >= eof_samples)) {*/ 
    653642        if ((chk->eof_samples > 0) && (chk->samples_read >= chk->eof_samples)) { 
    654643                g_print ("We're at %lld samples - end of file!\n", (long long int) input_gst->current_pos_samples); 
     
    669658                chk->samples_behind_us += useful_read_samples; 
    670659        } 
    671 //      g_print("behind us %d bytes\n", input_gst->bytes_behind_us); 
    672660 
    673661 
  • trunk/fm_server/src/fm_input_gst/fm_input_gst.h

    r221 r222  
    4444 
    4545        gint64          current_pos_samples; 
    46 //      gint64          current_pos_nsec; 
    4746 
    4847        gboolean        play_when_ready; 
  • trunk/fm_server/src/fm_input_gst/fm_input_gst_common.h

    r221 r222  
    4848        guint           samples_behind_us; 
    4949         
    50         /* FIXME: "eof" should be moved to FmInputGst */ 
    5150        gboolean        eof;                            // the file ends somewhere in this chunk 
    52         GstClockTime    eof_timestamp;                  // where the file ends (stream timestamp) 
    5351        guint64         eof_samples;                    // where the file ends (RELATIVE TO CHUNK START!!!!) 
     52 
    5453        gboolean        start_of_file;                  // 1° buffer of the file 
    5554 
     
    5756                                                        // if TRUE, the buffer will be freed by the GST thread in _do_cleanup() 
    5857 
    59         guint64         samples_read; 
     58        guint64         samples_read;                   // how many samples FmInputGst has read from this chunk 
    6059}; 
    6160 
  • trunk/fm_server/src/fm_input_gst/gstfmsink.c

    r221 r222  
    236236                case GST_EVENT_EOS: { 
    237237                        g_return_val_if_fail (common->write_chunk, TRUE); 
    238                         common->write_chunk->eof_timestamp = sink->start_timestamp; 
    239238                        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); 
    241240                        sink->seek_in_progress = FALSE; 
    242241                        sink->seek_target_timestamp = -1;