summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2010-05-18 16:22:00 +0000
committerdynaflash <[email protected]>2010-05-18 16:22:00 +0000
commit8ce6a2514aa10e3ad28c34b8933238001b15c7d4 (patch)
tree4cd695a97cdb7e0c3dcdf79b8ec2d6d0c06d0fc6 /macosx
parent89d4a3ba2ecf35c4bde144ec6f35b348fca77fd0 (diff)
MacGui: Live Preview HUD Overlay playback controller initial implementation
- Fixes current issue where a live preview with the display res larger than storage res would not show the built in QTKit control bar. - Replaces the stock QTKit movie controller. - Adds playback time code information to HUD display. - Allows frame by frame scrubbing via keyboard arrow keys. -- Methods exist for frame by frame step through but buttons are not on the HUD overlay yet. Known Bugs: - If movie is playing, first click on the scrubber bar can cause the movie to jump to beginning or end unless scrubber is held and dragged. - Probably some others I haven't seen yet. To Do (not that it ever will get done): - Replace the current crappy stock buttons with some decent ones. - Display accurate frame number hopefully though QTKit offers little documentation to get that exact info. - Add a volume slider and remember the volume setting in the prefs. - Add a subtitle control widget hopefully so that users can see what the subtitles would look like. Other small changes include adding some tooltips to the hud overlay controller widgets to hopefully make it a bit more intuitive. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3300 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/English.lproj/PicturePreview.xib566
-rw-r--r--macosx/HBPreviewController.h36
-rw-r--r--macosx/HBPreviewController.m351
3 files changed, 914 insertions, 39 deletions
diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib
index 906930dd5..a068db4a5 100644
--- a/macosx/English.lproj/PicturePreview.xib
+++ b/macosx/English.lproj/PicturePreview.xib
@@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10C540</string>
+ <string key="IBDocument.SystemVersion">10D573</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
- <string key="IBDocument.AppKitVersion">1038.25</string>
- <string key="IBDocument.HIToolboxVersion">458.00</string>
+ <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -16,12 +16,12 @@
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>740</string>
- <string>1591.3</string>
+ <string>1729</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="257"/>
+ <integer value="251"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -435,7 +435,7 @@
<reference key="NSSuperview" ref="92351498"/>
</object>
</object>
- <string key="NSFrame">{{21, 91}, {440, 99}}</string>
+ <string key="NSFrame">{{21, 121}, {440, 99}}</string>
<reference key="NSSuperview" ref="353606868"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -476,6 +476,198 @@
<bytes key="NSRGB">MCAwIDAgMC42AA</bytes>
</object>
</object>
+ <object class="NSBox" id="700607930">
+ <reference key="NSNextResponder" ref="353606868"/>
+ <int key="NSvFlags">-2147483611</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSView" id="1068222891">
+ <reference key="NSNextResponder" ref="700607930"/>
+ <int key="NSvFlags">256</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSSlider" id="886140787">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">290</int>
+ <string key="NSFrame">{{18, 27}, {407, 21}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <object class="NSArray" key="NSViewContentFilters">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="CIColorMonochrome">
+ <object class="CIColor" key="CI_inputColor">
+ <float key="red">0.70196080207824707</float>
+ <float key="green">0.70196080207824707</float>
+ <float key="blue">0.70196080207824707</float>
+ <float key="alpha">1</float>
+ </object>
+ <integer value="1" key="CI_inputIntensity"/>
+ <bool key="CIEnabled">YES</bool>
+ </object>
+ </object>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSSliderCell" key="NSCell" id="493667684">
+ <int key="NSCellFlags">67501824</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents"/>
+ <reference key="NSControlView" ref="886140787"/>
+ <double key="NSMaxValue">100</double>
+ <double key="NSMinValue">0.0</double>
+ <double key="NSValue">0.0</double>
+ <double key="NSAltIncValue">0.0</double>
+ <int key="NSNumberOfTickMarks">0</int>
+ <int key="NSTickMarkPosition">1</int>
+ <bool key="NSAllowsTickMarkValuesOnly">NO</bool>
+ <bool key="NSVertical">NO</bool>
+ </object>
+ </object>
+ <object class="NSButton" id="102183813">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{200, 53}, {39, 25}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="19809002">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents"/>
+ <object class="NSFont" key="NSSupport" id="353643025">
+ <string key="NSName">LucidaGrande</string>
+ <double key="NSSize">13</double>
+ <int key="NSfFlags">1044</int>
+ </object>
+ <reference key="NSControlView" ref="102183813"/>
+ <int key="NSButtonFlags">-2038169345</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="897614796">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{171, 53}, {30, 25}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="913339095">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">|&lt;</string>
+ <reference key="NSSupport" ref="353643025"/>
+ <reference key="NSControlView" ref="897614796"/>
+ <int key="NSButtonFlags">-2038169345</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="894608246">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{238, 53}, {32, 25}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="117507013">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134217728</int>
+ <string key="NSContents">&gt;|</string>
+ <reference key="NSSupport" ref="353643025"/>
+ <reference key="NSControlView" ref="894608246"/>
+ <int key="NSButtonFlags">-2038169345</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSButton" id="630042886">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{335, 53}, {77, 25}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <object class="NSArray" key="NSViewContentFilters">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="CIColorMonochrome">
+ <object class="CIColor" key="CI_inputColor">
+ <float key="red">0.70196080207824707</float>
+ <float key="green">0.70196080207824707</float>
+ <float key="blue">0.70196080207824707</float>
+ <float key="alpha">1</float>
+ </object>
+ <integer value="1" key="CI_inputIntensity"/>
+ <bool key="CIEnabled">YES</bool>
+ </object>
+ </object>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSButtonCell" key="NSCell" id="999505395">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">134479872</int>
+ <string key="NSContents">Still Previews</string>
+ <reference key="NSSupport" ref="22"/>
+ <reference key="NSControlView" ref="630042886"/>
+ <int key="NSButtonFlags">-2038284033</int>
+ <int key="NSButtonFlags2">163</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">200</int>
+ <int key="NSPeriodicInterval">25</int>
+ </object>
+ </object>
+ <object class="NSTextField" id="964331174">
+ <reference key="NSNextResponder" ref="1068222891"/>
+ <int key="NSvFlags">290</int>
+ <string key="NSFrame">{{18, 10}, {399, 12}}</string>
+ <reference key="NSSuperview" ref="1068222891"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSTextFieldCell" key="NSCell" id="113790059">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">4456448</int>
+ <string key="NSContents"/>
+ <reference key="NSSupport" ref="811969608"/>
+ <reference key="NSControlView" ref="964331174"/>
+ <bool key="NSDrawsBackground">YES</bool>
+ <reference key="NSBackgroundColor" ref="407686733"/>
+ <reference key="NSTextColor" ref="978544139"/>
+ </object>
+ </object>
+ </object>
+ <string key="NSFrame">{{1, 1}, {438, 97}}</string>
+ <reference key="NSSuperview" ref="700607930"/>
+ </object>
+ </object>
+ <string key="NSFrame">{{21, 16}, {440, 99}}</string>
+ <reference key="NSSuperview" ref="353606868"/>
+ <string key="NSOffsets">{0, 0}</string>
+ <object class="NSTextFieldCell" key="NSTitleCell">
+ <int key="NSCellFlags">67239424</int>
+ <int key="NSCellFlags2">0</int>
+ <string key="NSContents">Playback Controls</string>
+ <reference key="NSSupport" ref="26"/>
+ <reference key="NSBackgroundColor" ref="384686844"/>
+ <object class="NSColor" key="NSTextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes>
+ </object>
+ </object>
+ <reference key="NSContentView" ref="1068222891"/>
+ <int key="NSBorderType">1</int>
+ <int key="NSBoxType">4</int>
+ <int key="NSTitlePosition">0</int>
+ <bool key="NSTransparent">NO</bool>
+ <double key="NSCornerRadius2">12</double>
+ <object class="NSColor" key="NSBorderColor2">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEgMC41AA</bytes>
+ </object>
+ <object class="NSColor" key="NSFillColor2">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MCAwIDAgMC42AA</bytes>
+ </object>
+ </object>
<object class="NSBox" id="768906858">
<reference key="NSNextResponder" ref="353606868"/>
<int key="NSvFlags">-2147483611</int>
@@ -512,7 +704,7 @@
<object class="NSButton" id="569473100">
<reference key="NSNextResponder" ref="1067699710"/>
<int key="NSvFlags">265</int>
- <string key="NSFrame">{{368, 23}, {46, 25}}</string>
+ <string key="NSFrame">{{368, 21}, {46, 25}}</string>
<reference key="NSSuperview" ref="1067699710"/>
<object class="NSArray" key="NSViewContentFilters">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -566,7 +758,7 @@
<reference key="NSSuperview" ref="768906858"/>
</object>
</object>
- <string key="NSFrame">{{21, 204}, {440, 100}}</string>
+ <string key="NSFrame">{{21, 233}, {440, 100}}</string>
<reference key="NSSuperview" ref="353606868"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -824,6 +1016,102 @@
</object>
<int key="connectionID">282</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fMoviePlaybackControlBox</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="700607930"/>
+ </object>
+ <int key="connectionID">363</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fPlayPauseButton</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="102183813"/>
+ </object>
+ <int key="connectionID">364</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fGoToStillPreviewButton</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="630042886"/>
+ </object>
+ <int key="connectionID">368</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">pictureSliderChanged:</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="630042886"/>
+ </object>
+ <int key="connectionID">369</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">toggleMoviePreviewPlayPause:</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="102183813"/>
+ </object>
+ <int key="connectionID">370</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fMovieScrubberSlider</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="886140787"/>
+ </object>
+ <int key="connectionID">371</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fMovieInfoField</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="964331174"/>
+ </object>
+ <int key="connectionID">374</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fGoToBeginningButton</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="897614796"/>
+ </object>
+ <int key="connectionID">380</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">fGoToEndButton</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="894608246"/>
+ </object>
+ <int key="connectionID">381</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">moviePlaybackGoToBeginning:</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="897614796"/>
+ </object>
+ <int key="connectionID">382</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">moviePlaybackGoToEnd:</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="894608246"/>
+ </object>
+ <int key="connectionID">383</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">previewScrubberChanged:</string>
+ <reference key="source" ref="355312334"/>
+ <reference key="destination" ref="886140787"/>
+ </object>
+ <int key="connectionID">384</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -878,8 +1166,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="844127024"/>
<reference ref="92351498"/>
- <reference ref="48693112"/>
<reference ref="768906858"/>
+ <reference ref="48693112"/>
+ <reference ref="700607930"/>
</object>
<reference key="parent" ref="49161063"/>
</object>
@@ -1104,6 +1393,104 @@
<reference key="object" ref="48693112"/>
<reference key="parent" ref="289177107"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">335</int>
+ <reference key="object" ref="700607930"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="886140787"/>
+ <reference ref="102183813"/>
+ <reference ref="630042886"/>
+ <reference ref="894608246"/>
+ <reference ref="964331174"/>
+ <reference ref="897614796"/>
+ </object>
+ <reference key="parent" ref="289177107"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">341</int>
+ <reference key="object" ref="886140787"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="493667684"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">346</int>
+ <reference key="object" ref="493667684"/>
+ <reference key="parent" ref="886140787"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">361</int>
+ <reference key="object" ref="102183813"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="19809002"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">362</int>
+ <reference key="object" ref="19809002"/>
+ <reference key="parent" ref="102183813"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">365</int>
+ <reference key="object" ref="630042886"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="999505395"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">366</int>
+ <reference key="object" ref="999505395"/>
+ <reference key="parent" ref="630042886"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">372</int>
+ <reference key="object" ref="964331174"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="113790059"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">373</int>
+ <reference key="object" ref="113790059"/>
+ <reference key="parent" ref="964331174"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">375</int>
+ <reference key="object" ref="897614796"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="913339095"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">376</int>
+ <reference key="object" ref="913339095"/>
+ <reference key="parent" ref="897614796"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">378</int>
+ <reference key="object" ref="894608246"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="117507013"/>
+ </object>
+ <reference key="parent" ref="700607930"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">379</int>
+ <reference key="object" ref="117507013"/>
+ <reference key="parent" ref="894608246"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -1119,6 +1506,7 @@
<string>209.IBPluginDependency</string>
<string>210.IBPluginDependency</string>
<string>213.IBPluginDependency</string>
+ <string>215.IBAttributePlaceholdersKey</string>
<string>215.IBPluginDependency</string>
<string>215.IBViewIntegration.shadowBlurRadius</string>
<string>215.IBViewIntegration.shadowColor</string>
@@ -1127,6 +1515,7 @@
<string>216.IBPluginDependency</string>
<string>223.IBPluginDependency</string>
<string>224.IBPluginDependency</string>
+ <string>226.IBAttributePlaceholdersKey</string>
<string>226.IBPluginDependency</string>
<string>226.ImportedFromIB2</string>
<string>227.IBPluginDependency</string>
@@ -1152,14 +1541,17 @@
<string>252.IBViewIntegration.shadowOffsetHeight</string>
<string>252.IBViewIntegration.shadowOffsetWidth</string>
<string>257.IBPluginDependency</string>
+ <string>261.IBAttributePlaceholdersKey</string>
<string>261.IBPluginDependency</string>
<string>262.IBPluginDependency</string>
+ <string>271.IBAttributePlaceholdersKey</string>
<string>271.IBPluginDependency</string>
<string>271.IBViewIntegration.shadowBlurRadius</string>
<string>271.IBViewIntegration.shadowColor</string>
<string>271.IBViewIntegration.shadowOffsetHeight</string>
<string>271.IBViewIntegration.shadowOffsetWidth</string>
<string>272.IBPluginDependency</string>
+ <string>275.IBAttributePlaceholdersKey</string>
<string>275.IBPluginDependency</string>
<string>275.IBViewIntegration.shadowBlurRadius</string>
<string>275.IBViewIntegration.shadowColor</string>
@@ -1169,6 +1561,32 @@
<string>280.IBPluginDependency</string>
<string>280.ImportedFromIB2</string>
<string>281.IBPluginDependency</string>
+ <string>335.IBPluginDependency</string>
+ <string>335.IBViewIntegration.shadowBlurRadius</string>
+ <string>335.IBViewIntegration.shadowColor</string>
+ <string>335.IBViewIntegration.shadowOffsetHeight</string>
+ <string>335.IBViewIntegration.shadowOffsetWidth</string>
+ <string>341.IBPluginDependency</string>
+ <string>346.IBPluginDependency</string>
+ <string>361.IBAttributePlaceholdersKey</string>
+ <string>361.IBPluginDependency</string>
+ <string>362.IBPluginDependency</string>
+ <string>365.IBAttributePlaceholdersKey</string>
+ <string>365.IBPluginDependency</string>
+ <string>365.IBViewIntegration.shadowBlurRadius</string>
+ <string>365.IBViewIntegration.shadowColor</string>
+ <string>365.IBViewIntegration.shadowOffsetHeight</string>
+ <string>365.IBViewIntegration.shadowOffsetWidth</string>
+ <string>366.IBPluginDependency</string>
+ <string>372.IBPluginDependency</string>
+ <string>372.ImportedFromIB2</string>
+ <string>373.IBPluginDependency</string>
+ <string>375.IBAttributePlaceholdersKey</string>
+ <string>375.IBPluginDependency</string>
+ <string>376.IBPluginDependency</string>
+ <string>378.IBAttributePlaceholdersKey</string>
+ <string>378.IBPluginDependency</string>
+ <string>379.IBPluginDependency</string>
<string>38.IBPluginDependency</string>
<string>38.ImportedFromIB2</string>
<string>5.IBEditorWindowLastContentRect</string>
@@ -1195,6 +1613,14 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="798240356"/>
+ <string key="toolTip">Encode And Play Back A Live Preview At Your Current Settings</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<object class="NSColor" id="864448722">
@@ -1206,6 +1632,14 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="598619000"/>
+ <string key="toolTip">Select The Length Of Live Preview to Encode</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -1231,14 +1665,38 @@
<integer value="0"/>
<integer value="0"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="569473100"/>
+ <string key="toolTip">Cancel Live Preview Encode</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="141370142"/>
+ <string key="toolTip">Show Picture Settings Inspector</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<reference ref="864448722"/>
<integer value="0"/>
<integer value="0"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="81685190"/>
+ <string key="toolTip">Scale Preview To Screen</string>
+ </object>
+ </object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="0"/>
<reference ref="864448722"/>
@@ -1249,11 +1707,65 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="0"/>
+ <reference ref="864448722"/>
+ <integer value="0"/>
+ <integer value="0"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="102183813"/>
+ <string key="toolTip">Toggle Play/Pause</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="630042886"/>
+ <string key="toolTip">Show Still Previews</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="0"/>
+ <reference ref="864448722"/>
+ <integer value="0"/>
+ <integer value="0"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <integer value="1"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="897614796"/>
+ <string key="toolTip">Go To Beginning</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <object class="NSMutableDictionary">
+ <string key="NS.key.0">ToolTip</string>
+ <object class="IBToolTipAttribute" key="NS.object.0">
+ <string key="name">ToolTip</string>
+ <reference key="object" ref="894608246"/>
+ <string key="toolTip">Go To End</string>
+ </object>
+ </object>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
- <string>{{261, 473}, {480, 360}}</string>
+ <string>{{262, 474}, {480, 360}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
- <string>{{261, 473}, {480, 360}}</string>
+ <string>{{262, 474}, {480, 360}}</string>
<integer value="1"/>
<string>{{221, 276}, {533, 580}}</string>
<boolean value="NO"/>
@@ -1280,7 +1792,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">282</int>
+ <int key="maxID">394</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1318,11 +1830,17 @@
<string>SettingsChanged:</string>
<string>createMoviePreview:</string>
<string>goWindowedScreen:</string>
+ <string>moviePlaybackGoBackwardOneFrame:</string>
+ <string>moviePlaybackGoForwardOneFrame:</string>
+ <string>moviePlaybackGoToBeginning:</string>
+ <string>moviePlaybackGoToEnd:</string>
<string>pictureSliderChanged:</string>
<string>previewDurationPopUpChanged:</string>
+ <string>previewScrubberChanged:</string>
<string>showMoviePreview:</string>
<string>showPictureSettings:</string>
<string>showPreviewWindow:</string>
+ <string>toggleMoviePreviewPlayPause:</string>
<string>toggleScaleToScreen:</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -1332,10 +1850,16 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
<string>NSString</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
@@ -1345,15 +1869,23 @@
<string>fCancelPreviewMovieButton</string>
<string>fCreatePreviewMovieButton</string>
<string>fEncodingControlBox</string>
- <string>fFullScreenToggleButton</string>
+ <string>fGoBackwardOneFrameButton</string>
+ <string>fGoForwardOneFrameButton</string>
+ <string>fGoToBeginningButton</string>
+ <string>fGoToEndButton</string>
+ <string>fGoToStillPreviewButton</string>
<string>fInfoField</string>
<string>fMovieCreationProgressIndicator</string>
+ <string>fMovieInfoField</string>
+ <string>fMoviePlaybackControlBox</string>
+ <string>fMovieScrubberSlider</string>
<string>fMovieView</string>
<string>fPictureControlBox</string>
<string>fPictureSettingsToggleButton</string>
<string>fPictureSlider</string>
<string>fPictureView</string>
<string>fPictureViewArea</string>
+ <string>fPlayPauseButton</string>
<string>fPreviewMovieLengthPopUp</string>
<string>fPreviewMovieStatusField</string>
<string>fPreviewWindow</string>
@@ -1367,14 +1899,22 @@
<string>NSButton</string>
<string>NSBox</string>
<string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
+ <string>NSButton</string>
<string>NSTextField</string>
<string>NSProgressIndicator</string>
+ <string>NSTextField</string>
+ <string>NSBox</string>
+ <string>NSSlider</string>
<string>QTMovieView</string>
<string>NSBox</string>
<string>NSButton</string>
<string>NSSlider</string>
<string>NSImageView</string>
<string>NSBox</string>
+ <string>NSButton</string>
<string>NSPopUpButton</string>
<string>NSTextField</string>
<string>NSWindow</string>
diff --git a/macosx/HBPreviewController.h b/macosx/HBPreviewController.h
index cbfd04c9c..c8dc6d023 100644
--- a/macosx/HBPreviewController.h
+++ b/macosx/HBPreviewController.h
@@ -30,6 +30,7 @@
IBOutlet NSBox * fPictureViewArea;
IBOutlet NSBox * fPictureControlBox;
IBOutlet NSBox * fEncodingControlBox;
+ IBOutlet NSBox * fMoviePlaybackControlBox;
IBOutlet NSSlider * fPictureSlider;
IBOutlet NSTextField * fInfoField;
@@ -52,7 +53,22 @@
IBOutlet NSButton * fScaleToScreenToggleButton;
IBOutlet NSButton * fPictureSettingsToggleButton;
BOOL scaleToScreen;
+
/* Movie Previews */
+ QTMovie * aMovie;
+ IBOutlet QTMovieView * fMovieView;
+ /* Playback Panel Controls */
+ IBOutlet NSButton * fPlayPauseButton;
+ IBOutlet NSButton * fGoToBeginningButton;
+ IBOutlet NSButton * fGoToEndButton;
+ IBOutlet NSButton * fGoForwardOneFrameButton;
+ IBOutlet NSButton * fGoBackwardOneFrameButton;
+ IBOutlet NSSlider * fMovieScrubberSlider;
+ IBOutlet NSButton * fGoToStillPreviewButton;
+ IBOutlet NSTextField * fMovieInfoField;
+ NSTimer * fMovieTimer;
+
+
IBOutlet NSButton * fCreatePreviewMovieButton;
IBOutlet NSButton * fCancelPreviewMovieButton;
IBOutlet NSButton * fShowPreviewMovieButton;
@@ -61,7 +77,6 @@
hb_handle_t * fPreviewLibhb; // private libhb for creating previews
NSTimer * fLibhbTimer; // timer for retrieving state from libhb
IBOutlet NSTextField * fPreviewMovieStatusField;
- IBOutlet QTMovieView * fMovieView;
IBOutlet NSPopUpButton * fPreviewMovieLengthPopUp; // popup of choices for length of preview in seconds
}
- (id)init;
@@ -89,9 +104,28 @@
- (void) startReceivingLibhbNotifications;
- (void) stopReceivingLibhbNotifications;
+- (void) installMovieCallbacks;
+- (void)removeMovieCallbacks;
+
- (IBAction) createMoviePreview: (id) sender;
- (void) libhbStateChanged: (hb_state_t ) state;
- (IBAction) showMoviePreview: (NSString *) path;
+- (IBAction) toggleMoviePreviewPlayPause: (id) sender;
+- (IBAction) moviePlaybackGoToBeginning: (id) sender;
+- (IBAction) moviePlaybackGoToEnd: (id) sender;
+- (IBAction) moviePlaybackGoBackwardOneFrame: (id) sender;
+- (IBAction) moviePlaybackGoForwardOneFrame: (id) sender;
+
+-(void) initPreviewScrubberForMovie;
+-(void) adjustPreviewScrubberForCurrentMovieTime;
+- (IBAction) previewScrubberChanged: (id) sender;
+-(void)setTime:(int)timeValue;
+-(void)timeToQTTime:(long)timeValue resultTime:(QTTime *)aQTTime;
+- (void) startMovieTimer;
+- (void) stopMovieTimer;
+- (NSString*) calculatePlaybackSMTPETimecodeForDisplay;
+
+
- (IBAction) previewDurationPopUpChanged: (id) sender;
diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m
index 764da459d..5ad59761c 100644
--- a/macosx/HBPreviewController.m
+++ b/macosx/HBPreviewController.m
@@ -14,6 +14,8 @@
}
@end
+
+
@interface PreviewController (Private)
- (NSSize)optimalViewSizeForImageSize: (NSSize)imageSize;
@@ -44,12 +46,13 @@
int loggingLevel = [[[NSUserDefaults standardUserDefaults] objectForKey:@"LoggingLevel"] intValue];
fPreviewLibhb = hb_init(loggingLevel, 0);
+
+
}
return self;
}
-
//------------------------------------------------------------------------------------
// Displays and brings the picture window to the front
//------------------------------------------------------------------------------------
@@ -130,6 +133,8 @@
// Show the picture view
[fPictureView setHidden:NO];
[fMovieView pause:nil];
+ [fMovieTimer invalidate];
+ [fMovieTimer release];
[fMovieView setHidden:YES];
[fMovieView setMovie:nil];
@@ -157,11 +162,16 @@
[fHudTimer invalidate];
[fHudTimer release];
+ [fMovieTimer invalidate];
+ [fMovieTimer release];
+
[fPicturePreviews release];
[fFullScreenWindow release];
hb_close(&fPreviewLibhb);
-
+
+ [self removeMovieCallbacks];
+
[super dealloc];
}
@@ -219,6 +229,7 @@
hudControlBoxOrigin.y = ([[self window] frame].size.height / 2) - [fPictureControlBox frame].size.height;
[fPictureControlBox setFrameOrigin:hudControlBoxOrigin];
[fEncodingControlBox setFrameOrigin:hudControlBoxOrigin];
+ [fMoviePlaybackControlBox setFrameOrigin:hudControlBoxOrigin];
}
@@ -232,11 +243,15 @@
/* lets make sure that the still picture view is not hidden and that
* the movie preview is
*/
+ aMovie = nil;
[fMovieView pause:nil];
[fMovieView setHidden:YES];
[fMovieView setMovie:nil];
[fMovieCreationProgressIndicator stopAnimation: nil];
[fMovieCreationProgressIndicator setHidden: YES];
+ [fMoviePlaybackControlBox setHidden: YES];
+ [self stopMovieTimer];
+ [fPictureControlBox setHidden: NO];
[fPictureView setHidden:NO];
@@ -473,19 +488,35 @@
NSPoint mouseLoc = [theEvent locationInWindow];
/* Test for mouse location to show/hide hud controls */
- if( isEncoding == NO ) {
+ if( isEncoding == NO )
+ {
+ /* Since we are not encoding, verify which control hud to show
+ * or hide based on aMovie ( aMovie indicates we need movie controls )
+ */
+ NSBox * hudBoxToShow;
+ if ( aMovie == nil ) // No movie loaded up
+ {
+ hudBoxToShow = fPictureControlBox;
+ }
+ else // We have a movie
+ {
+ hudBoxToShow = fMoviePlaybackControlBox;
+ }
+
if( NSPointInRect( mouseLoc, [fPictureControlBox frame] ) )
{
- [[fPictureControlBox animator] setHidden: NO];
+ [[hudBoxToShow animator] setHidden: NO];
[self stopHudTimer];
}
else if( NSPointInRect( mouseLoc, [fPictureViewArea frame] ) )
{
- [[fPictureControlBox animator] setHidden: NO];
+ [[hudBoxToShow animator] setHidden: NO];
[self startHudTimer];
}
else
- [[fPictureControlBox animator] setHidden: YES];
+ {
+ [[hudBoxToShow animator] setHidden: YES];
+ }
}
}
@@ -513,8 +544,13 @@
- (void) hudTimerFired: (NSTimer*)theTimer
{
hudTimerSeconds++;
- if( hudTimerSeconds >= 10 ) {
+ if( hudTimerSeconds >= 10 )
+ {
+ /* Regardless which control box is active, after the timer
+ * period we want either one to fade to hidden.
+ */
[[fPictureControlBox animator] setHidden: YES];
+ [[fMoviePlaybackControlBox animator] setHidden: YES];
[self stopHudTimer];
}
}
@@ -923,6 +959,7 @@
[fMovieCreationProgressIndicator stopAnimation: nil];
[fMovieCreationProgressIndicator setHidden: YES];
[fEncodingControlBox setHidden: YES];
+ [fPictureControlBox setHidden: YES];
isEncoding = NO;
// Show the movie view
@@ -934,6 +971,103 @@
}
}
+- (IBAction) toggleMoviePreviewPlayPause: (id) sender
+{
+ /* make sure a movie is even loaded up */
+ if (aMovie != nil)
+ {
+ /* For some stupid reason there is no "isPlaying" method for a QTMovie
+ * object, given that, we detect the rate to determine whether the movie
+ * is playing or not.
+ */
+ if ([aMovie rate] != 0) // we are playing
+ {
+ [fMovieView pause:aMovie];
+ [fPlayPauseButton setTitle: @">"];
+ }
+ else // we are paused or stopped
+ {
+ [fMovieView play:aMovie];
+ [fPlayPauseButton setTitle: @"||"];
+ }
+ }
+
+}
+
+- (IBAction) moviePlaybackGoToBeginning: (id) sender
+{
+ /* make sure a movie is even loaded up */
+ if (aMovie != nil)
+ {
+ [fMovieView gotoBeginning:aMovie];
+ }
+
+}
+
+- (IBAction) moviePlaybackGoToEnd: (id) sender
+{
+ /* make sure a movie is even loaded up */
+ if (aMovie != nil)
+ {
+ [fMovieView gotoEnd:aMovie];
+ }
+
+}
+
+- (IBAction) moviePlaybackGoBackwardOneFrame: (id) sender
+{
+ /* make sure a movie is even loaded up */
+ if (aMovie != nil)
+ {
+ [fMovieView pause:aMovie]; // Pause the movie
+ [fMovieView stepBackward:aMovie];
+ }
+
+}
+
+- (IBAction) moviePlaybackGoForwardOneFrame: (id) sender
+{
+ /* make sure a movie is even loaded up */
+ if (aMovie != nil)
+ {
+ [fMovieView pause:aMovie]; // Pause the movie
+ [fMovieView stepForward:aMovie];
+ }
+
+}
+
+
+- (void) startMovieTimer
+{
+ if( fMovieTimer ) {
+ [fMovieTimer invalidate];
+ [fMovieTimer release];
+ }
+ fMovieTimer = [NSTimer scheduledTimerWithTimeInterval:0.10 target:self selector:@selector(movieTimerFired:) userInfo:nil repeats:YES];
+ [fMovieTimer retain];
+}
+
+- (void) stopMovieTimer
+{
+ if( fMovieTimer )
+ {
+ [fMovieTimer invalidate];
+ [fMovieTimer release];
+ fMovieTimer = nil;
+ }
+}
+
+- (void) movieTimerFired: (NSTimer*)theTimer
+{
+ if (aMovie != nil)
+ {
+ [self adjustPreviewScrubberForCurrentMovieTime];
+ [fMovieInfoField setStringValue: [NSString stringWithFormat:NSLocalizedString( @"%@", @"" ),[self calculatePlaybackSMTPETimecodeForDisplay]]];
+ }
+}
+
+
+
- (IBAction) showMoviePreview: (NSString *) path
{
/* Since the gray background for the still images is part of
@@ -946,7 +1080,7 @@
/* Load the new movie into fMovieView */
if (path)
{
- QTMovie * aMovie;
+ //QTMovie * aMovie;
NSError *outError;
NSURL *movieUrl = [NSURL fileURLWithPath:path];
NSDictionary *movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
@@ -955,11 +1089,13 @@
[NSNumber numberWithBool:YES], @"QTMovieOpenForPlaybackAttribute",
[NSNumber numberWithBool:NO], @"QTMovieOpenAsyncRequiredAttribute",
[NSNumber numberWithBool:NO], @"QTMovieOpenAsyncOKAttribute",
+ [NSNumber numberWithBool:YES], @"QTMovieIsSteppableAttribute",
QTMovieApertureModeClean, QTMovieApertureModeAttribute,
nil];
aMovie = [[[QTMovie alloc] initWithAttributes:movieAttributes error:&outError] autorelease];
+
if (!aMovie)
{
NSLog(@"Unable to open movie");
@@ -973,6 +1109,7 @@
movieBounds.size.height = movieSize.height;
/* We also get our view size to use for scaling fMovieView's size */
NSSize scaledMovieViewSize = [fPictureView frame].size;
+ [fMovieView setControllerVisible:FALSE];
if ([fMovieView isControllerVisible])
{
CGFloat controllerBarHeight = [fMovieView controllerBarHeight];
@@ -994,23 +1131,6 @@
if (scaledMovieViewSize.height > [[self window] frame].size.height)
{
[fHBController writeToActivityLog: "showMoviePreview: Our window is not tall enough to show the controller bar ..."];
- /*we need to scale the movie down vertically by 15 px to allow for the controller bar
- * and scale the width accordingly.
- */
-
- // FIX ME: currently trying to scale everything to show the controller bar does not work right.
- // Commented out til fixed, resulting issue when the movie is the full size of the window is no
- // controller bar is visible. Live Preview still plays fine though.
- /*
- CGFloat pictureAspectRatio = scaledMovieViewSize.width / scaledMovieViewSize.height;
- scaledMovieViewSize.height = [[self window] frame].size.height - 15;
- scaledMovieViewSize.width = scaledMovieViewSize.height * pictureAspectRatio;
- NSRect windowFrame = [[self window] frame];
- windowFrame.size.width = scaledMovieViewSize.width;
- windowFrame.size.height = scaledMovieViewSize.height + 15;
- [[self window] setFrame:windowFrame display:YES animate:YES];
- [fPictureView setFrameSize:scaledMovieViewSize];
- */
}
@@ -1028,12 +1148,193 @@
[fMovieView setFrameOrigin:origin];
[fMovieView setMovie:aMovie];
[fMovieView setHidden:NO];
+ [fMoviePlaybackControlBox setHidden: NO];
+ [fPictureControlBox setHidden: YES];
+
// to actually play the movie
+
+ [self initPreviewScrubberForMovie];
+ [self startMovieTimer];
+ /* Install amovie notifications */
+ [aMovie setDelegate:self];
+ [self installMovieCallbacks];
[fMovieView play:aMovie];
+
}
}
isEncoding = NO;
}
+#pragma mark *** Movie Playback Scrubber and time code methods ***
+
+/* Since MacOSX Leopard QTKit has taken over some responsibility for assessing movie playback
+ * information from the old QuickTime carbon api ( time code information as well as fps, etc.).
+ * However, the QTKit devs at apple were not really big on documentation and further ...
+ * QuickTimes ability to playback HB's largely variable framerate output makes perfectly frame
+ * accurate information at best convoluted. Still, for the purpose of a custom hud based custom
+ * playback scrubber slider this has so far proven to be as accurate as I have found. To say it
+ * could use some better accuracy is not understating it enough probably.
+ * Most of this was gleaned from this obscure Apple Mail list thread:
+ * http://www.mailinglistarchive.com/[email protected]/msg05642.html
+ * Now as we currently do not show a QTKit control bar with scrubber for display sizes > container
+ * size, this seems to facilitate playback control from the HB custom HUD controller fairly close
+ * to the built in controller bar.
+ * Further work needs to be done to try to get accurate frame by frame playback display if we want it.
+ * Note that the keyboard commands for frame by frame step through etc. work as always.
+ */
+
+// Returns a human readable string from the currentTime of movie playback
+- (NSString*) calculatePlaybackSMTPETimecodeForDisplay
+{
+ QTTime time = [aMovie currentTime];
+
+ NSString *smtpeTimeCodeString;
+ int days, hour, minute, second, frame;
+ long long result;
+
+ result = time.timeValue / time.timeScale; // second
+ frame = (time.timeValue % time.timeScale) / 100;
+
+ second = result % 60;
+
+ result = result / 60; // minute
+ minute = result % 60;
+
+ result = result / 60; // hour
+ hour = result % 24;
+ days = result;
+
+ smtpeTimeCodeString = [NSString stringWithFormat:@"Time: %02d:%02d:%02d", hour, minute, second]; // hh:mm:ss
+ return smtpeTimeCodeString;
+
+}
+
+
+// Initialize the preview scrubber min/max to appropriate values for the current movie
+-(void) initPreviewScrubberForMovie
+{
+ if (aMovie)
+ {
+
+ QTTime duration = [aMovie duration];
+ float result = duration.timeValue / duration.timeScale;
+
+ [fMovieScrubberSlider setMinValue:0.0];
+ [fMovieScrubberSlider setMaxValue: (float)result];
+ [fMovieScrubberSlider setFloatValue: 0.0];
+ }
+}
+
+
+-(void) adjustPreviewScrubberForCurrentMovieTime
+{
+ if (aMovie)
+ {
+ QTTime time = [aMovie currentTime];
+
+ float result = (float)time.timeValue / (float)time.timeScale;;
+ [fMovieScrubberSlider setFloatValue:result];
+ }
+}
+
+- (IBAction) previewScrubberChanged: (id) sender
+{
+ if (aMovie)
+ {
+ [fMovieView pause:aMovie]; // Pause the movie
+ QTTime time = [aMovie currentTime];
+ [self setTime: time.timeScale * [fMovieScrubberSlider floatValue]];
+ [self calculatePlaybackSMTPETimecodeForDisplay];
+ }
+}
+#pragma mark *** Movie Notifications ***
+
+- (void) installMovieCallbacks
+{
+
+
+/*Notification for any time the movie rate changes */
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(movieRateDidChange:)
+ name:@"QTMovieRateDidChangeNotification"
+ object:aMovie];
+ /*Notification for when the movie ends */
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(movieDidEnd:)
+ name:@"QTMovieDidEndNotification"
+ object:aMovie];
+}
+
+- (void)removeMovieCallbacks
+{
+ if (aMovie)
+ {
+ /*Notification for any time the movie rate changes */
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:@"QTMovieRateDidChangeNotification"
+ object:aMovie];
+ /*Notification for when the movie ends */
+ [[NSNotificationCenter defaultCenter] removeObserver:self
+ name:@"QTMovieDidEndNotification"
+ object:aMovie];
+ }
+}
+
+- (void)movieRateDidChange:(NSNotification *)notification
+{
+ if (aMovie != nil)
+ {
+ /* For some stupid reason there is no "isPlaying" method for a QTMovie
+ * object, given that, we detect the rate to determine whether the movie
+ * is playing or not.
+ */
+ //[self adjustPreviewScrubberForCurrentMovieTime];
+ if ([aMovie rate] != 0) // we are playing
+ {
+ [fPlayPauseButton setTitle: @"||"];
+ }
+ else // we are paused or stopped
+ {
+ [fPlayPauseButton setTitle: @">"];
+ }
+ }
+}
+/* This notification is not currently used. However we should keep it "just in case" as
+ * live preview playback is enhanced.
+ */
+- (void)movieDidEnd:(NSNotification *)notification
+{
+
+ //[fHBController writeToActivityLog: "Movie DidEnd Notification Received"];
+}
+
+
+#pragma mark *** QTTime Utilities ***
+
+ // convert a time value (long) to a QTTime structure
+-(void)timeToQTTime:(long)timeValue resultTime:(QTTime *)aQTTime
+{
+ NSNumber *timeScaleObj;
+ long timeScaleValue;
+
+ timeScaleObj = [aMovie attributeForKey:QTMovieTimeScaleAttribute];
+ timeScaleValue = [timeScaleObj longValue];
+
+ *aQTTime = QTMakeTime(timeValue, timeScaleValue);
+}
+
+ // set the movie's current time
+-(void)setTime:(int)timeValue
+{
+ QTTime movieQTTime;
+ NSValue *valueForQTTime;
+
+ [self timeToQTTime:timeValue resultTime:&movieQTTime];
+
+ valueForQTTime = [NSValue valueWithQTTime:movieQTTime];
+
+ [aMovie setAttribute:valueForQTTime forKey:QTMovieCurrentTimeAttribute];
+}
+
@end