| 1 |
// |
| 2 |
// HMXSPFComponent.h |
| 3 |
// HMXSPFComponent |
| 4 |
// |
| 5 |
// Created by Hori,Masaki on 08/08/29. |
| 6 |
// |
| 7 |
|
| 8 |
/* |
| 9 |
This source code is release under the New BSD License. |
| 10 |
Copyright (c) 2008-2010,2012,, masakih |
| 11 |
All rights reserved. |
| 12 |
|
| 13 |
ソースコード形式かバイナリ形式か、変更するかしないかを問わず、以下の条件を満たす場合に |
| 14 |
限り、再頒布および使用が許可されます。 |
| 15 |
|
| 16 |
1, ソースコードを再頒布する場合、上記の著作権表示、本条件一覧、および下記免責条項を含 |
| 17 |
めること。 |
| 18 |
2, バイナリ形式で再頒布する場合、頒布物に付属のドキュメント等の資料に、上記の著作権表 |
| 19 |
示、本条件一覧、および下記免責条項を含めること。 |
| 20 |
3, 書面による特別の許可なしに、本ソフトウェアから派生した製品の宣伝または販売促進に、 |
| 21 |
コントリビューターの名前を使用してはならない。 |
| 22 |
本ソフトウェアは、著作権者およびコントリビューターによって「現状のまま」提供されており、 |
| 23 |
明示黙示を問わず、商業的な使用可能性、および特定の目的に対する適合性に関する暗黙の保証 |
| 24 |
も含め、またそれに限定されない、いかなる保証もありません。著作権者もコントリビューター |
| 25 |
も、事由のいかんを問わず、 損害発生の原因いかんを問わず、かつ責任の根拠が契約であるか |
| 26 |
厳格責任であるか(過失その他の)不法行為であるかを問わず、仮にそのような損害が発生する |
| 27 |
可能性を知らされていたとしても、本ソフトウェアの使用によって発生した(代替品または代用 |
| 28 |
サービスの調達、使用の喪失、データの喪失、利益の喪失、業務の中断も含め、またそれに限定 |
| 29 |
されない)直接損害、間接損害、偶発的な損害、特別損害、懲罰的損害、または結果損害につい |
| 30 |
て、一切責任を負わないものとします。 |
| 31 |
------------------------------------------------------------------- |
| 32 |
Copyright (c) 2008-2010,2012,, masakih |
| 33 |
All rights reserved. |
| 34 |
|
| 35 |
Redistribution and use in source and binary forms, with or without |
| 36 |
modification, are permitted provided that the following conditions |
| 37 |
are met: |
| 38 |
|
| 39 |
1, Redistributions of source code must retain the above copyright |
| 40 |
notice, this list of conditions and the following disclaimer. |
| 41 |
2, Redistributions in binary form must reproduce the above copyright |
| 42 |
notice, this list of conditions and the following disclaimer in |
| 43 |
the documentation and/or other materials provided with the |
| 44 |
distribution. |
| 45 |
3, The names of its contributors may be used to endorse or promote |
| 46 |
products derived from this software without specific prior |
| 47 |
written permission. |
| 48 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 49 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 50 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 51 |
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 52 |
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 53 |
INCIDENTAL, SPECIAL,EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 54 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 55 |
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 56 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 57 |
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 58 |
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 59 |
POSSIBILITY OF SUCH DAMAGE. |
| 60 |
*/ |
| 61 |
|
| 62 |
|
| 63 |
#import <Cocoa/Cocoa.h> |
| 64 |
|
| 65 |
@interface HMXSPFComponent : NSObject <NSCoding> |
| 66 |
{ |
| 67 |
NSIndexPath *_selectionIndexPath; |
| 68 |
|
| 69 |
#ifndef __LP64__ |
| 70 |
NSString *_title; |
| 71 |
BOOL _isSelected; |
| 72 |
HMXSPFComponent *_parent; // not retained. |
| 73 |
#endif |
| 74 |
} |
| 75 |
|
| 76 |
+ (id)xspfPlaylist; |
| 77 |
+ (id)xspfTrackList; |
| 78 |
+ (id)xspfTrackWithLocation:(NSURL *)location; |
| 79 |
+ (id)xspfComponentWithXMLElementString:(NSString *)string error:(NSError **)outError; |
| 80 |
|
| 81 |
+ (id)xspfComponentWithContentsOfURL:(NSURL *)url error:(NSError **)error; |
| 82 |
- (id)initWithContentsOfURL:(NSURL *)url error:(NSError **)error; |
| 83 |
|
| 84 |
+ (id)xspfComponentWithXMLElement:(NSXMLElement *)element; |
| 85 |
- (id)initWithXMLElement:(NSXMLElement *)element; // abstract. |
| 86 |
|
| 87 |
@property (readonly) NSXMLElement *XMLElement; // abstract. |
| 88 |
@property (readonly) NSURL *movieLocation; |
| 89 |
@property (copy) NSString *title; |
| 90 |
@property (retain) NSDate *duration; |
| 91 |
@end |
| 92 |
|
| 93 |
@interface HMXSPFComponent (XspfComponentSelection) |
| 94 |
// selection for playing. |
| 95 |
@property (readonly) BOOL isSelected; |
| 96 |
@property NSUInteger selectionIndex; |
| 97 |
@property (retain) NSIndexPath *selectionIndexPath; |
| 98 |
@property BOOL isPlayed; |
| 99 |
@property (readonly) HMXSPFComponent *currentTrack; // default self; |
| 100 |
@property (retain) NSDate *currentTrackDuration; |
| 101 |
|
| 102 |
- (void)select; |
| 103 |
- (void)deselect; |
| 104 |
|
| 105 |
- (void)next; // abstract. |
| 106 |
- (void)previous; // abstract. |
| 107 |
@end |
| 108 |
|
| 109 |
@interface HMXSPFComponent(XspfConainerComponent) |
| 110 |
@property (readonly, assign) HMXSPFComponent *parent; |
| 111 |
@property (readonly) NSArray *children; // default nil. |
| 112 |
@property NSUInteger childrenCount; // default [[self children] count]. |
| 113 |
@property BOOL isLeaf; // default YES. |
| 114 |
|
| 115 |
- (NSUInteger)indexOfChild:(HMXSPFComponent *)child; // default [[self children] indexOfObject:]. |
| 116 |
- (HMXSPFComponent *)childAtIndex:(NSUInteger)index; // default [[self children] objectAtIndex:]. |
| 117 |
|
| 118 |
- (void)addChild:(HMXSPFComponent *)child; // not implemented. |
| 119 |
- (void)removeChild:(HMXSPFComponent *)child; // not implemented. |
| 120 |
- (void)insertChild:(HMXSPFComponent *)child atIndex:(NSUInteger)index; // not implemented. |
| 121 |
- (void)removeChildAtIndex:(NSUInteger)index; //not implemented. |
| 122 |
- (void)moveChildFromIndex:(NSUInteger)from toIndex:(NSUInteger)to; //not implemented. |
| 123 |
- (void)setParent:(HMXSPFComponent *)parent; // Do not call directly. call in only -addChild: method. |
| 124 |
@end |
| 125 |
|
| 126 |
@interface HMXSPFComponent(XspfThumbnailSupport) |
| 127 |
@property (readonly) HMXSPFComponent *thumbnailTrack; |
| 128 |
@property (readonly) NSTimeInterval thumbnailTimeInterval; |
| 129 |
|
| 130 |
- (void)setThumbnailTrackNum:(NSUInteger)trackNum timeIntarval:(NSTimeInterval)timeIntarval; |
| 131 |
- (void)setThumbnailComponent:(HMXSPFComponent *)item timeIntarval:(NSTimeInterval)timeIntarval; |
| 132 |
- (void)removeThumbnailFrame; |
| 133 |
@end |
| 134 |
|
| 135 |
extern NSString *XspfQTXMLTrackElementName; |
| 136 |
extern NSString *XspfQTXMLTrackListElementName; |
| 137 |
extern NSString *XspfQTXMLPlaylistElementName; |
| 138 |
extern NSString *XspfQTXMLTitleElementName; |
| 139 |
extern NSString *XspfQTXMLLocationElementName; |
| 140 |
extern NSString *XspfQTXMLDurationElementName; |
| 141 |
|
| 142 |
extern NSString *XspfQTXMLExtensionElementName; |
| 143 |
extern NSString *XspfQTXMLApplicationAttributeName; |
| 144 |
|
| 145 |
|
| 146 |
extern NSString *XspfQTXMLNamespaceseURI; |
| 147 |
extern NSString *XspfQTXMLNamespacesePrefix; |
| 148 |
extern NSString *XspfQTXMLAliasElement; |
| 149 |
extern NSString *XspfQTXMLThumbnailElementName; |
| 150 |
extern NSString *XspfQTXMLThumbnailTrackNumAttributeName; |
| 151 |
extern NSString *XspfQTXMLThumbnailTimeAttributeName; |
| 152 |
|