Changeset 2d071ad


Ignore:
Timestamp:
Apr 25, 2016, 4:38:14 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
b60f297
Parents:
b1d2be8
Message:

src/io/source_avcodec.h: add _get_duration

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_avcodec.c

    rb1d2be8 r2d071ad  
    401401}
    402402
     403uint_t aubio_source_avcodec_get_duration (aubio_source_avcodec_t * s) {
     404  if (s && &(s->avFormatCtx) != NULL) {
     405    int64_t duration = s->avFormatCtx->duration;
     406    return s->samplerate * ((uint_t)duration / 1e6 );
     407  }
     408  return 0;
     409}
     410
    403411uint_t aubio_source_avcodec_close(aubio_source_avcodec_t * s) {
    404412  if (s->avr != NULL) {
  • src/io/source_avcodec.h

    rb1d2be8 r2d071ad  
    119119uint_t aubio_source_avcodec_seek (aubio_source_avcodec_t *s, uint_t pos);
    120120
     121uint_t aubio_source_avcodec_get_duration (aubio_source_avcodec_t * s);
     122
    121123/**
    122124
  • tests/src/io/test-source_avcodec.c

    rb1d2be8 r2d071ad  
    3939  fvec_t *vec = new_fvec(hop_size);
    4040
     41  uint_t n_frames_expected = aubio_source_avcodec_get_duration(s);
     42
    4143  samplerate = aubio_source_avcodec_get_samplerate(s);
    4244
     
    4749  } while ( read == hop_size );
    4850
    49   PRINT_MSG("read %d frames at %dHz (%d blocks) from %s\n", n_frames, samplerate,
    50     n_frames / hop_size, source_path);
     51  PRINT_MSG("read %d frames (expected %d) at %dHz (%d blocks) from %s\n",
     52            n_frames, n_frames_expected, samplerate, n_frames / hop_size,
     53            source_path);
    5154
    5255  del_fvec (vec);
Note: See TracChangeset for help on using the changeset viewer.