Commit dc7fe584 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Examples: slightly updated Mac VLCKit test project

parent 9dec84f2
/*****************************************************************************
* test: Controller.m
*****************************************************************************
* Copyright (C) 2007-2012 Pierre d'Herbemont and VideoLAN
* Copyright (C) 2007-2013 Pierre d'Herbemont and VideoLAN
*
* Authors: Pierre d'Herbemont
* Felix Paul Kühne
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -22,17 +23,10 @@
#import "Controller.h"
static void *sleepForMe(void)
{
while (1) sleep(60);
}
@implementation Controller
- (void)awakeFromNib
{
// atexit((void*)sleepForMe); // Only used for memory leak debugging
[NSApp setDelegate:self];
// Allocate a VLCVideoView instance and tell it what area to occupy.
......@@ -71,8 +65,7 @@ static void *sleepForMe(void)
- (void)changeAndPlay:(id)sender
{
if ([playlistOutline selectedRow] != mediaIndex)
{
if ([playlistOutline selectedRow] != mediaIndex) {
[self setMediaIndex:[playlistOutline selectedRow]];
if (![player isPlaying])
[player play];
......@@ -96,8 +89,7 @@ static void *sleepForMe(void)
- (void)play:(id)sender
{
[self setMediaIndex:mediaIndex+1];
if (![player isPlaying])
{
if (![player isPlaying]) {
NSLog(@"%@ length = %@", [playlist mediaAtIndex:mediaIndex], [[playlist mediaAtIndex:mediaIndex] lengthWaitUntilDate:[NSDate dateWithTimeIntervalSinceNow:60]]);
[player play];
}
......@@ -111,9 +103,8 @@ static void *sleepForMe(void)
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"media"] && object == playlist) {
if ([keyPath isEqualToString:@"media"] && object == playlist)
[playlistOutline reloadData];
}
}
// NSTableView Implementation
......@@ -125,6 +116,7 @@ static void *sleepForMe(void)
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn
row:(int)row
{
NSLog(@"URL is %@", [playlist mediaAtIndex:row].url.absoluteString);
return [(VLCMedia *)[playlist mediaAtIndex:row].metaDictionary valueForKey:VLCMetaInformationTitle];
}
......@@ -137,13 +129,11 @@ static void *sleepForMe(void)
- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info
row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
int i;
NSArray *droppedItems = [[info draggingPasteboard] propertyListForType:NSFilenamesPboardType];
for (i = 0; i < [droppedItems count]; i++)
{
for (int i = 0; i < [droppedItems count]; i++) {
NSString * filename = [droppedItems objectAtIndex:i];
VLCMedia * media = [VLCMedia mediaWithURL:[NSURL fileURLWithPath:filename]];
VLCMedia * media = [VLCMedia mediaWithPath:filename];
[playlist addMedia:media];
}
return YES;
......
......@@ -24,8 +24,8 @@
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* test_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_Prefix.pch; sourceTree = "<group>"; };
633302780BD24CDB00193D7D /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; };
633302790BD24CDB00193D7D /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
633302780BD24CDB00193D7D /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = "<group>"; };
633302790BD24CDB00193D7D /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = test.app; sourceTree = BUILT_PRODUCTS_DIR; };
CC786BB31715AAB50024EDC0 /* VLCKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VLCKit.framework; path = ../../build/Debug/VLCKit.framework; sourceTree = "<group>"; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment