MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_stream_duration

Function hb_stream_duration

libhb/stream.c:1719–1741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1717}
1718
1719static void hb_stream_duration(hb_stream_t *stream, hb_title_t *inTitle)
1720{
1721 struct pts_pos ptspos[NDURSAMPLES];
1722 struct pts_pos *pp = ptspos;
1723 int i;
1724
1725 fseeko(stream->file_handle, 0, SEEK_END);
1726 uint64_t fsize = ftello(stream->file_handle);
1727 uint64_t fincr = fsize / NDURSAMPLES;
1728 uint64_t fpos = fincr / 2;
1729 for ( i = NDURSAMPLES; --i >= 0; fpos += fincr )
1730 {
1731 *pp++ = hb_sample_pts(stream, fpos);
1732 }
1733 uint64_t dur = compute_stream_rate( ptspos, pp - ptspos ) * (double)fsize;
1734 inTitle->duration = dur;
1735 dur /= 90000;
1736 inTitle->hours = dur / 3600;
1737 inTitle->minutes = ( dur % 3600 ) / 60;
1738 inTitle->seconds = dur % 60;
1739
1740 rewind(stream->file_handle);
1741}
1742
1743/***********************************************************************
1744 * hb_stream_read

Callers 1

hb_stream_title_scanFunction · 0.85

Calls 2

hb_sample_ptsFunction · 0.85
compute_stream_rateFunction · 0.85

Tested by

no test coverage detected