Correct String format for QTTimeFromString()

QTTimeFromString() doesn’t seem to work as it is explained.

If there is a “day” part in the string, it is not properly converted.
( The 2nd to the last example. )

The 2nd to the last example has an additional string at its front. That is why it couldn’t be converted properly.

The document should explain more about the string format.

QTTime testTime;

testTime = QTTimeFromString( @"00:00:03:16.00/2997" );
JALog(@"test time is set to : %@", QTStringFromTime(testTime) );

testTime = QTTimeFromString( @"00:03:00:16.00/2997" );
JALog(@"test time is set to : %@", QTStringFromTime(testTime) );

testTime = QTTimeFromString( @"00:00:03:16.0000/2997" );
JALog(@"test time is set to : %@", QTStringFromTime(testTime) );

testTime = QTTimeFromString( @"00:00:03:16.000000/2997" );
JALog(@"test time is set to : %@", QTStringFromTime(testTime) );

testTime = QTTimeFromString( @"0:00:00:03:16.000000/2997" );
JALog(@"test time is set to : %@ - Doesn't work because of the \"day\" part.", QTStringFromTime(testTime) );

testTime = QTTimeFromString( @"00:00:03:16/2997" );
JALog(@"test time is set to : %@ - Doesn't work because of the \"frame\" is in integer.", QTStringFromTime(testTime) );

Output is :

test time is set to : 0:00:03:16.00/2997
test time is set to : 0:03:00:16.00/2997
test time is set to : 0:00:03:16.00/2997
test time is set to : 0:00:03:16.00/2997
test time is set to : 0:00:00:03.00/2997 – Doesn’t work because of the “day” part.
test time is set to : 0:00:00:00.00/1 – Doesn’t work because of the “frame” is in integer.

It turned out that the document explain things wrongly.

Apple’s document states :

This function returns a QTTime structure whose time is set to the time expressed by the string; the string is assumed to be in the form “days:hours:minutes:seconds:frames/timescale”.

There is a problem in seconds:frames/timescale part.
It should be seconds.frames/timescale.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: