<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">1. Seconds are used for length computation and display I think (in media library widget). I didn’t research where else this value is used. Will change the code as requested in next version of the patch.<div class="">2. IIRC removing m_begin and m_end may require a non-trivial refactor of dependent code. m_begin and m_end give us EXACT frames and when we use m_beginPosition and m_endPosition only, frame computation may lose some precision which may lead to some bugs in dependent code.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Wiadomość napisana przez Hugo Beauzée-Luyssen <<a href="mailto:hugo@beauzee.fr" class="">hugo@beauzee.fr</a>> w dniu 09.05.2016, o godz. 11:36:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On 05/02/2016 08:20 PM, Pawel Golinski wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Length was computed using frames only (and ISource's length() was<br class="">ignored) which caused it to be zero in sound files.<br class="">---<br class=""> src/Media/Clip.cpp | 16 +++++++++++-----<br class=""> src/Media/Clip.h | 8 ++++++++<br class=""> 2 files changed, 19 insertions(+), 5 deletions(-)<br class=""><br class="">diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp<br class="">index 4f29f8e..b634442 100644<br class="">--- a/src/Media/Clip.cpp<br class="">+++ b/src/Media/Clip.cpp<br class="">@@ -40,12 +40,15 @@ Clip::Clip( Media *media, qint64 begin /*= 0*/, qint64 end /*= -1*/, const QStri<br class=""> m_end( end ),<br class=""> m_parent( media->baseClip() )<br class=""> {<br class="">+ int64_t nbSourceFrames = media->source()->nbFrames();<br class=""> if ( end == -1 )<br class="">- m_end = media->source()->nbFrames();<br class="">+ m_end = nbSourceFrames;<br class=""> if ( uuid.isEmpty() == true )<br class=""> m_uuid = QUuid::createUuid();<br class=""> else<br class=""> m_uuid = QUuid( uuid );<br class="">+ m_beginPosition = (float)begin / (float)nbSourceFrames;<br class="">+ m_endPosition = (float)end / (float)nbSourceFrames;<br class=""> m_childs = new MediaContainer( this );<br class=""> m_rootClip = media->baseClip();<br class=""> computeLength();<br class="">@@ -61,6 +64,7 @@ Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -1*/,<br class=""> m_rootClip( parent->rootClip() ),<br class=""> m_parent( parent )<br class=""> {<br class="">+ int64_t nbSourceFrames = parent->media()->source()->nbFrames();<br class=""> if ( begin < 0 )<br class=""> m_begin = parent->m_begin;<br class=""> if ( end < 0 )<br class="">@@ -69,6 +73,8 @@ Clip::Clip( Clip *parent, qint64 begin /*= -1*/, qint64 end /*= -1*/,<br class=""> m_uuid = QUuid::createUuid();<br class=""> else<br class=""> m_uuid = QUuid( uuid );<br class="">+ m_beginPosition = (float)begin / (float)nbSourceFrames;<br class="">+ m_endPosition = (float)end / (float)nbSourceFrames;<br class=""> m_childs = new MediaContainer( this );<br class=""> computeLength();<br class=""> }<br class="">@@ -108,11 +114,9 @@ Clip::lengthSecond() const<br class=""> void<br class=""> Clip::computeLength()<br class=""> {<br class="">- float fps = m_media->source()->fps();<br class="">- if ( fps < 0.1f )<br class="">- fps = Clip::DefaultFPS;<br class="">+ int64_t sourceLengthSeconds = m_media->source()->length() / 1000;<br class=""> m_nbFrames = m_end - m_begin;<br class="">- m_lengthSeconds = qRound64( (float)m_nbFrames / fps );<br class="">+ m_lengthSeconds = qRound64( ( m_endPosition - m_beginPosition ) * sourceLengthSeconds );<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It would probably allow for a better precision to use milliseconds first, and then convert to seconds.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Though it feels strange to use seconds anyway, but I don't recall which unit gets used when :/</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> }<br class=""><br class=""> const QStringList&<br class="">@@ -274,6 +278,8 @@ Clip::mediaMetadataUpdated()<br class=""> {<br class=""> m_begin = 0;<br class=""> m_end = m_media->source()->nbFrames();<br class="">+ m_beginPosition = 0.0f;<br class="">+ m_endPosition = 1.0f;<br class=""> computeLength();<br class=""> }<br class=""> }<br class="">diff --git a/src/Media/Clip.h b/src/Media/Clip.h<br class="">index 5fb5997..8b49b9a 100644<br class="">--- a/src/Media/Clip.h<br class="">+++ b/src/Media/Clip.h<br class="">@@ -149,6 +149,14 @@ class Clip : public QObject<br class=""> * beginning of the parent Media.<br class=""> */<br class=""> qint64 m_end;<br class="">+ /**<br class="">+ * \brief This represents the beginning of the Clip in form of [0; 1] float<br class="">+ */<br class="">+ float m_beginPosition;<br class="">+ /**<br class="">+ * \brief This represents the end of the Clip in form of [0;1] float<br class="">+ */<br class="">+ float m_endPosition;<br class=""><br class=""> /**<br class=""> * \brief The length in frames<br class=""><br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Do we need to keep m_begin & m_end if we switch to a position based approach?</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Vlmc-devel mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:Vlmc-devel@videolan.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Vlmc-devel@videolan.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="https://mailman.videolan.org/listinfo/vlmc-devel" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://mailman.videolan.org/listinfo/vlmc-devel</a></div></blockquote></div><br class=""></div></body></html>