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

Function updateDuration

libhb/sync.c:1788–1812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1786}
1787
1788static void updateDuration( sync_stream_t * stream )
1789{
1790 // The video decoder sets a nominal duration for frames. But the
1791 // actual duration needs to be computed from timestamps.
1792 if (stream->type == SYNC_TYPE_VIDEO)
1793 {
1794 int count = hb_list_count(stream->in_queue);
1795 if (count >= 2)
1796 {
1797 hb_buffer_t * buf1 = hb_list_item(stream->in_queue, count - 1);
1798 hb_buffer_t * buf2 = hb_list_item(stream->in_queue, count - 2);
1799 double duration = buf1->s.start - buf2->s.start;
1800 if (duration > 0)
1801 {
1802 buf2->s.duration = duration;
1803 buf2->s.stop = buf1->s.start;
1804 }
1805 else
1806 {
1807 buf2->s.duration = 0.;
1808 buf2->s.start = buf2->s.stop = buf1->s.start;
1809 }
1810 }
1811 }
1812}
1813
1814static void ProcessSCRDelayQueue( sync_common_t * common )
1815{

Callers 1

QueueBufferFunction · 0.85

Calls 2

hb_list_countFunction · 0.85
hb_list_itemFunction · 0.85

Tested by

no test coverage detected