Access to the contents of a QuickTime Movie Track's Edit Atom? - quicktime

Is there any way to get hold of the contents of a QuickTime Movie Track's Edit Atom ( i.e. 'edts' ) in general and the contents of its Edit List Atom ( i.e. 'elst' ) in special using the QuickTime (C) API?
The goal is to identify any edits in a given track along with their duration and start time.
I have been checking the QuickTime Reference Library (both legacy and current) for the last two hours and yet have not been able to identify any API to achieve this.
Any hints would be greatly appreciated.
Cheers,
\Bjoern

To answer my own question:
The contents of a track's edit list (if any), i.e. the edits/segments present in a track may be determined via the GetTrackNextInterestingTime() API function (code ripped from Movies.h):
/*
* GetTrackNextInterestingTime()
*
* Availability:
* Non-Carbon CFM: in QuickTimeLib 2.5 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
* Windows: in qtmlClient.lib 3.0 and later
*/
EXTERN_API( void )
GetTrackNextInterestingTime(
Track theTrack,
short interestingTimeFlags,
TimeValue time,
Fixed rate,
TimeValue * interestingTime,
TimeValue * interestingDuration);
by passing nextTimeTrackEdit (to look for track edits) and nextTimeEdgeOK (to include borderline cases) in interestingTimeFlags.
For most cases in which you may be interested into the edits being present in a track you will have to map the returned interestingTime from track time to media time (f.e. if you've been examining the track's edits to determine a possible track offset).
This is accomplished via the TrackTimeToMediaTime() API function:
/*
* TrackTimeToMediaTime()
*
* Availability:
* Non-Carbon CFM: in QuickTimeLib 2.5 and later
* CarbonLib: in CarbonLib 1.0 and later
* Mac OS X: in version 10.0 and later
* Windows: in qtmlClient.lib 3.0 and later
*/
EXTERN_API( TimeValue )
TrackTimeToMediaTime(
TimeValue value,
Track theTrack);
Edit
The state of the art way to convert track time to media time would be TrackTimeToMediaDisplayTime():
/*
* TrackTimeToMediaDisplayTime()
*
* Summary:
* Converts a track's time value to a display time value that is
* appropriate to the track's media, using the track's edit list.
* This is a 64-bit replacement for TrackTimeToMediaTime.
*
* Discussion:
* This function maps the track time through the track's edit list
* to come up with the media time. This time value contains the
* track's time value according to the media's time coordinate
* system. If the time you specified lies outside of the movie's
* active segment or corresponds to empty space in the track, this
* function returns a value of -1. Hence you can use it to determine
* whether a specified track edit is empty.
*
* Parameters:
*
* value:
* The track's time value; must be expressed in the time scale of
* the movie that contains the track.
*
* theTrack:
* The track for this operation. Your application obtains this
* track identifier from such functions as NewMovieTrack and
* GetMovieTrack.
*
* Result:
* The corresponding time in media display time, in the media's time
* coordinate system. If the track time corresponds to empty space,
* this function returns a value of -1.
*
* Availability:
* Non-Carbon CFM: not available
* CarbonLib: not available
* Mac OS X: in version 10.4 (or QuickTime 7.0) and later
* Windows: in qtmlClient.lib version 10.4 (or QuickTime 7.0) and later
*/
EXTERN_API( TimeValue64 )
TrackTimeToMediaDisplayTime(
TimeValue64 value,
Track theTrack);

Related

Scheduling a build x times

I'm trying to understand the way to scheduling a job
H 6 * * * -> this launch every day at morning
So How can I launch 3 builds every morning ?
Thanks
You can click on the "?" in the GUI to get this help:
To specify multiple values for one field, the following operators are available. In the order of precedence,
- * specifies all valid values
- M-N specifies a range of values
- M-N/X or */X steps by intervals of X through the specified range or whole valid range
- A,B,...,Z enumerates multiple values
With this help you should use
H 6-7/3 * * *
to get three build between 6 AM and 7 AM.

Simple Babymonitor with Bass.DLL

I am trying to program a simple Babymonitor for Windows (personal use).
The babymonitor should just detect the dB level of the microphone and triggers at a certain volume.
After some research, I found the Bass.dll library and came across it's function BASS_ChannelGetLevel, which is great but seems to have limitations and doesn't fit my needs (Peak equals to a DWORD value).
In the examples I found a livespec example which is "almost" what I need. The example uses BASS_ChannelGetData, but I don't quite know how to handle the returned array...
I want to keep it as simple as possible: Detect the volume from the microphone as dB or any other value (e.g. value 0-MAXINT).
How can this be done with the Bass.dll library?
The BASS_ChannelGetLevel returns the value that is capped to 0dB (return value is 32768 in this case). If you adjust your source level (lower microphone level in sound card settings) then it will work just fine.
Another way, if you want to get uncapped value is to use the BASS_ChannelGetLevelEx function instead: it returns floating point levels, where 1 is maximum (0dB) value that corresponds to BASS_ChannelGetLevel's 32767, but it can exceed 1 to detect sound levels above 0dB which is what you may need.
I also suggest you to monitor sound level for a while: trigger only if certain level exists for 2-3 seconds at least (this way you will exclude false alarms).
Here is how you obtain the db level given an input stream handle (streamHandle):
var peak = (double)Bass.BASS_ChannelGetLevel(streamHandle);
var decibels = 20 * Math.Log10(peak / Int32.MaxValue);
Alternatively, you can use the following to get the RMS (average) peak. To get the RMS value, you have to pass in a sample length into BASS_ChannelGetLevel. I'm using 20 milliseconds here but you can play with the value to see which works best for your needs.
var decibels = 0m;
var channelCount = 2; //Assuming two channels
var sampleLengthMS = 20f;
var rmsLevels = new float[channelCount];
var rmsObtained = Bass.BASS_ChannelGetLevel(streamHandle, rmsLevels, sampleLengthMS / 1000f, BASSLevel.BASS_LEVEL_RMS);
if (rmsObtained)
decibels = 20*Math.Log10(rmsLevels[0]); //using first channel (index 0) but you can get both if needed.
else
Console.WriteLine(Bass.BASS_ErrorGetCode());
Hope this helps.

Spread load evenly by using ‘H * * * *’ rather than ‘5 * * * *’

When setting up how Jenkins shoul pull changes from subversion
I tried checked Poll SCM and set schedule to 5 * * * *, I get the following warning
Spread load evenly by using ‘H * * * *’ rather than ‘5 * * * *’
I'm not sure what H means in this context and why I should use that.
H stands for Hash
To allow periodically scheduled tasks to produce even load on the
system, the symbol H (for “hash”) should be used wherever possible.
For example, using 0 0 * * * for a dozen daily jobs will cause a large
spike at midnight. In contrast, using H H * * * would still execute
each job once a day, but not all at the same time, better using
limited resources.
Click on the question-mark beside your schedule specification.
It says there:
To allow periodically scheduled tasks to produce even load on the
system, the symbol H (for “hash”) should be used wherever possible.
For example, using 0 0 * * * for a dozen daily jobs will cause a large
spike at midnight. In contrast, using H H * * * would still execute
each job once a day, but not all at the same time, better using
limited resources.
Also in the documentation worth noting is that:
The H symbol can be used with a range. For example, H H(0-7) * * * means some time between 12:00 AM (midnight) to 7:59 AM. You can also use step intervals with H, with or without ranges.
The H symbol can be thought of as a random value over a range, but it actually is a hash of the job name, not a random function, so that the value remains stable for any given project.

Schedule nightly 22-03 build using Jenkins and H, the "hash symbol"

A build that takes about three hours to complete needs to be scheduled for nightly building outside office hours: not sooner than 22:00 and not later than 3:59 next day.
I'd also like to use the "H symbol" to avoid collision with future nightly builds. From in-line help in Jenkins:
To allow periodically scheduled tasks to produce even load on the system, the symbol H (for “hash”) should be used wherever possible. For example, using 0 0 * * * for a dozen daily jobs will cause a large spike at midnight. In contrast, using H H * * * would still execute each job once a day, but not all at the same time, better using limited resources.
(How) can I schedule this using Jenkins? What I've tried was all considered invalid by Jenkins:
H H(22,23,0,1,2,3) * * *
Invalid input: "H H(22,23,0,1,2,3) * * *": line 1:7: expecting "-", found ','
H H22,23,0,1,2,3 * * *
Invalid input: "H H22,23,0,1,2,3 * * *": line 1:4: unexpected token: 22
H H(22-3) * * *
Invalid input: "H H(22-3) * * *": line 1:9: 1 is an invalid value. Must be within 1
and -18
Is it possible to achieve this without using plug-ins?
I think the closest you will get is to use:
H H(0-3) * * * This will run at some point between 0:00 and 3:59
#midnight This will run at some point between 0:00 and 2:59
The H(4-8) construct only works if the second items is larger then the first.
But you might as well fill in the hour yourself. Jenkins actually never changes the hour the jobs runs once it is set. It will basically create some random hour once you save the job and always run the job at that particular time.
Of course, you can also file a bug report or feature request that you should be able to specify this as H(22-3) or better, fix the code and submit a patch ;)
There is no direct support to write the expression like this, but since there is timezone support (now), you can work around this.
# DONT COPY PASTE - THIS DOESNT WORK!
# This is what we would like to write, but is not supported
H H(22-3) * * *
Above expression means we want to build somewhen between 22 PM and 3 AM, this is a 5 hour period, so we could write:
# Assuming we're in GMT+2 we can just shift the timezone
# so 22-03 becomes 10-15 wich is 12 hours earlier so the
# timezone is GMT-10
TZ=Etc/GMT-10
H H(10-15) * * *
I found this workaround in the comments of JENKINS-18313
UPDATE:
There is currently a bug JENKINS-57702 and the timezone GMT-XX is not evaluated correctly. A workaround is to use a equivalent timezone, in this example the one for Hawaii:
TZ=US/Hawaii
H H(10-15) * * *

Fields for an athletic 'Race' Time, and converting to a Float

If a Track Athlete was saving their race times after a Track meet...
The athlete selects/enters 'MM:SS:ss' into a field.
I need to save it as a float (of seconds) in the database.
800M: ( '01:48.37' --to-- 108.37 )
100M: ( '00:10.59' --to-- 10.59 )
10,000M: ( '27:08.11' --to-- 1628.11 )
--
I havent found a straightforward or reliable way that allows a User to input that kind of time, then convert the object to a float before_save. Can I make this work, or is there a better way to do do this?
Thanks.
Rails allows you to store datatypes as float. You just have to handle the conversion.
How are you submitting the data? As what type? If you were submitting a string you could just do something like this:
min, sec, centi = "1:23:45".split(":")
seconds = (min.to_i * 60) + sec.to_i + (centi.to_f / 100)

Resources