diff options
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | addons/visualization.itunes/addon.xml | 88 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/Main.cpp | 383 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/Makefile.in | 15 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/common.h | 36 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/common_osx.m | 263 | ||||
-rwxr-xr-x | xbmc/visualizations/iTunes/iTunesAPI.c | 424 | ||||
-rwxr-xr-x | xbmc/visualizations/iTunes/iTunesAPI.h | 718 | ||||
-rwxr-xr-x | xbmc/visualizations/iTunes/iTunesVisualAPI.h | 314 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/itunes_vis.c | 600 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/itunes_vis.h | 135 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/message_order.txt | 13 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/qview.h | 28 | ||||
-rw-r--r-- | xbmc/visualizations/iTunes/qview.m | 85 |
14 files changed, 0 insertions, 3106 deletions
diff --git a/Makefile.in b/Makefile.in index 31826b1afc..39dc6f9000 100644 --- a/Makefile.in +++ b/Makefile.in @@ -200,10 +200,6 @@ ifneq (@DISABLE_PROJECTM@,1) VIS_DIRS+= xbmc/visualizations/XBMCProjectM endif -ifeq (($(findstring osx,@ARCH@), osx),(@USE_OPENGL@,1)) - VIS_DIRS+=xbmc/visualizations/iTunes -endif - ifneq (@DISABLE_GOOM@,1) VIS_DIRS+=xbmc/visualizations/Goom endif diff --git a/addons/visualization.itunes/addon.xml b/addons/visualization.itunes/addon.xml deleted file mode 100644 index 6ff00d9194..0000000000 --- a/addons/visualization.itunes/addon.xml +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<addon - id="visualization.itunes" - version="1.0.0" - name="iTunes Visualizations" - provider-name="Team XBMC"> - <extension - point="xbmc.player.musicviz" - library_osx="iTunes.mvis"/> - <extension point="xbmc.addon.metadata"> - <summary lang="af">iTunes Visualisering Omhulsel</summary> - <summary lang="ar">مفتاح تصوير اي تونز</summary> - <summary lang="be">iTunes Visualization Wrapper</summary> - <summary lang="bg">Обвивка за визуализации от iTunes</summary> - <summary lang="ca">Visualitzador d'efectes de l'iTunes</summary> - <summary lang="cs">Obal vizualizace iTunes</summary> - <summary lang="da">iTunes Visualization Wrapper</summary> - <summary lang="de">iTunes Visualisierung</summary> - <summary lang="el">Συλλογή Οπτικοποιήσεων iTunes</summary> - <summary lang="en">iTunes Visualization Wrapper</summary> - <summary lang="es">Wrapper de visualizaciones de iTunes</summary> - <summary lang="es_MX">Envoltura de Visualización de iTunes</summary> - <summary lang="et">iTunes-i visuaali pakend</summary> - <summary lang="fi">iTunes-visualisoinnit</summary> - <summary lang="fr">Adaptateur de visualisation iTunes</summary> - <summary lang="gl">Envoltorio da Visualización de iTunes</summary> - <summary lang="he">חיזוי iTunes</summary> - <summary lang="hr">iTunes Vizualizacija Omota</summary> - <summary lang="hu">iTunes Vizualizáció</summary> - <summary lang="is">iTunes myndskreytingar </summary> - <summary lang="it">Raccoglitore visualizzazioni di iTunes</summary> - <summary lang="ja">iTunes ビジュアライザラッパー</summary> - <summary lang="ko">iTunes 음악 시각화 랩퍼</summary> - <summary lang="lt">iTunes Vizualizacijos Wrapper (įpakavimas)</summary> - <summary lang="nl">iTunes-visualisaties</summary> - <summary lang="no">iTunes visualisering wrapper</summary> - <summary lang="pl">Wrapper wizualizacji iTunes</summary> - <summary lang="pt">Visualização iTunes Wrapper</summary> - <summary lang="pt_BR">iTunes Visualização Wrapper</summary> - <summary lang="ro">Anvelopa vizualizare iTunes</summary> - <summary lang="ru">Оболочка для визуализаций iTunes</summary> - <summary lang="se">iTunes visualiseringsomslag</summary> - <summary lang="sk">Obal (wrapper) pre iTunes vizualizácie</summary> - <summary lang="sl">Vizualizacije preko iTunes</summary> - <summary lang="sv">iTunes Visualization Wrapper</summary> - <summary lang="uk">Обгортка для візуалізацій iTunes</summary> - <summary lang="zh">iTunes可视化效果包</summary> - <description lang="af">iTunes Visualisering Omhulsel laat jou toe om visualiserings vanaf jou OSX iTunes installasie in XBMC te gebruik</description> - <description lang="ar">مفتاح تصوير اي تونز يسمح لك باستخدام الهيئات من تثبيت OSx اي تونز الخاص بك في XBMC </description> - <description lang="be">iTunes Visualization Wrapper allows you to use visualizations from your OSX iTunes install in XBMC</description> - <description lang="bg">iTunes Visualization Wrapper Ви позволява да използвате визуализациите от локалната инсталация на OSX iTunes в XBMC</description> - <description lang="ca">El visualitzador d'efectes de l'iTunes utilitza les visualitzacions de l'iTunes instal·lat al seu OSX a l'XBMC.</description> - <description lang="cs">Obal vizualizace iTunes umožňuje použití vizualizací z Vaší instalace OSX iTunes v XBMC</description> - <description lang="da">iTunes Visualization Wrapper tillader dig at bruge visualiseringer fra din OSX iTunes installation i XBMC</description> - <description lang="de">iTunes Visualisierung ermöglicht es von der OSX iTunes Installation die Visualisierung in XBMC nutzen zu können</description> - <description lang="el">Η Συλλογή Οπτικοποιήσεων iTunes σας επιτρέπει να χρησιμοποιήσετε οπτικοποιήσεις από την OSX εγκατάσταση του iTunes στο XBMC</description> - <description lang="en">iTunes Visualization Wrapper allows you to use visualizations from your OSX iTunes install in XBMC</description> - <description lang="es">El Wrapper de visualizaciones de iTunes le permite usar las visualizaciones de su OSX iTunes en XBMC</description> - <description lang="es_MX">La Envoltura de visualización de iTunes te permite utilizar visualizaciones de tu instalación de iTunes OSX en XBMC</description> - <description lang="et">iTunes-i visuaali pakend võimaldab kasutada sinu OSX iTunes-i installiga kaasa tulnud visuaale XBMC-s.</description> - <description lang="fi">Mahdollistaa OSX iTunes -asennuksen visualisointien käytön XBMC:ssä.</description> - <description lang="fr">L'adaptateur de visualisation iTunes vous permet d'utiliser dans XBMC les visualisations de votre version d'iTunes installée sous OS X</description> - <description lang="gl">O Envoltorio de Visualización de iTunes permítelle empregar as visualizacións da súa instalación de iTunes de OSX en XBMC</description> - <description lang="he">חיזוי iTunes מאפשר לך להשתמש בחיזוי iTunes אשר מותקן בתוך OSX שלך</description> - <description lang="hr">iTunes Vizualizacija Omota uvijek koristi vizualizacije iz svog OSX iTunes instalirano iz XBMC</description> - <description lang="hu">Az iTunes Vizualizáció lehetővé teszi, hogy használd az OSX iTunes telepítésedben meglévő vizualizációkat az XBMC-ben</description> - <description lang="is">iTunes myndskreytingin leyfir þér að nota myndskreytingar frá OSX iTunes uppsetningunni þinni í XBMC</description> - <description lang="it">Il 'Raccoglitore visualizzazioni di iTunes' ti permette di usare le visualizzazioni di iTunes su OSX direttamente in XBMC</description> - <description lang="ja">iTunes ビジュアライザラッパーは、XBMC 内で OSX の iTunes ビジュアライザを使用可能にするものです</description> - <description lang="ko">iTunes 음악시각화 랩퍼는 OSX iTunes 음악 시각화를 XBMC에서 사용할 수 있게 해줍니다.</description> - <description lang="lt">iTunes Vizualizacijos Wrapper (įpakavimas) leidžia jums naudoti vizualizacijas iš jūsų OSX iTunes instaliuoti į XBMC</description> - <description lang="nl">Dankzij iTunes-visualisaties kan XBMC gebruik maken van de visualisaties van uw iTunesinstallatie in OS X</description> - <description lang="no">iTunes visualisering wrapper lar deg bruke visualiseringer fra din OSX iTunes installasjon i XBMC</description> - <description lang="pl">Wrapper pozwala XBMC na użycie wizualizacji z iTunes (tylko system OSX)</description> - <description lang="pt">O iTunes Visualization Wrapper permite usar visualizações do seu OSX iTunes no XBMC</description> - <description lang="pt_BR">O iTunes Visualization Wrapper permite usar visualizações do seu OSX iTunes no XBMC</description> - <description lang="ro">Anvelopa vizualizare iTunes vă permite să folosiți vizualizări din instalarea iTunes de pe OSX în XBMC</description> - <description lang="ru">Оболочка для визуализаций iTunes позволяет использовать визуализации OSX для iTunes в XBMC</description> - <description lang="se">iTunes visualiseringsomslag tillåter dig att använda visualiseringar från din OSX iTunes installation i XBMC</description> - <description lang="sk">Obal (wrapper) pre iTunes vizualizácie ti dovolí použiť vizualizácie z OSX iTunes v XBMC </description> - <description lang="sl">Vizualizacije preko iTunes vam omogočajo uporabo vizualizacij iz vaše namestitve OSX iTunes v XBMC</description> - <description lang="sv">iTunes Visualization Wrapper gör det möjligt för dig att använda visualiseringar från din OSX iTunes-installation i XBMC.</description> - <description lang="uk">Обгортка для візуалізацій iTunes дозволяє вам використовувати встановлені візуалізації з вашим OSX iTunes у XBMC.</description> - <description lang="zh">iTunes可视化效果包允许你使用安装到XBMC的来自于OSX iTunes的可视化效果</description> - <platform>osx</platform> - </extension> -</addon> - diff --git a/xbmc/visualizations/iTunes/Main.cpp b/xbmc/visualizations/iTunes/Main.cpp deleted file mode 100644 index 7c409ba7e0..0000000000 --- a/xbmc/visualizations/iTunes/Main.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -/* - iTunes Visualization Wrapper for XBMC -*/ - - -#include <GL/glew.h> -#include <string> - -#include "itunes_vis.h" -#include "../../addons/include/xbmc_vis_dll.h" - -int g_tex_width = 512; -int g_tex_height = 512; -int g_window_width = 512; -int g_window_height = 512; -int g_window_xpos = 0; -int g_window_ypos = 0; - -short g_audio_data[2][512]; -float g_freq_data[2][512]; -bool g_new_audio; -std::string g_sub_module; -std::string g_vis_name; -GLuint g_tex_id = 0; -GLbyte* g_tex_buffer = NULL; -long g_tex_buffer_size = 0; -ITunesVis* g_plugin = NULL; - -//-- Create ------------------------------------------------------------------- -// Called on load. Addon should fully initalize or return error status -//----------------------------------------------------------------------------- -ADDON_STATUS ADDON_Create(void* hdl, void* visProps) -{ - if (!visProps) - return ADDON_STATUS_UNKNOWN; - - VIS_PROPS* props = (VIS_PROPS*) visProps; - - if (!props->submodule) - return ADDON_STATUS_UNKNOWN; - - g_vis_name = props->name; - g_sub_module = props->submodule; - - /* copy window dimensions */ - g_window_width = g_tex_width = props->width; - g_window_height = g_tex_height = props->height; - g_window_xpos = props->x; - g_window_ypos = props->y; - - /* create texture buffer */ - g_tex_buffer_size = g_tex_width * g_tex_height * 4; - g_tex_buffer = (GLbyte*)malloc( g_tex_buffer_size ); - - if ( !g_tex_buffer ) - return ADDON_STATUS_UNKNOWN; - - if ( g_plugin ) - { - ivis_close( g_plugin ); - g_plugin = NULL; - } - - /* load the plugin */ - g_plugin = ivis_open( g_sub_module.c_str() ); - - if ( g_plugin == NULL ) - { - printf( "Error loading %s\n", g_vis_name.c_str() ); - return ADDON_STATUS_UNKNOWN; - } - - /* initialize and start the plugin */ - if ( ivis_init( g_plugin, g_tex_width, g_tex_height ) == false ) - { - printf( "Error initializing %s\n", g_vis_name.c_str() ); - ivis_close( g_plugin ); - g_plugin = NULL; - } - else - { - ivis_start( g_plugin ); - } - - return ADDON_STATUS_OK; -} - -//-- Start -------------------------------------------------------------------- -// Called when a new soundtrack is played -//----------------------------------------------------------------------------- -extern "C" void Start(int iChannels, int iSamplesPerSec, int iBitsPerSample, - const char* szSongName) -{ - -} - -//-- Stop --------------------------------------------------------------------- -// Called when the visualisation is closed by XBMC -//----------------------------------------------------------------------------- -extern "C" void ADDON_Stop() -{ - if ( g_tex_id ) - { - glDeleteTextures( 1, &g_tex_id ); - } - ivis_close( g_plugin ); - free( g_tex_buffer ); - g_tex_buffer = NULL; - g_tex_buffer_size = 0; - g_plugin = NULL; - g_new_audio = false; -} - -//-- Audiodata ---------------------------------------------------------------- -// Called by XBMC to pass new audio data to the vis -//----------------------------------------------------------------------------- -extern "C" void AudioData(const short* pAudioData, int iAudioDataLength, - float *pFreqData, int iFreqDataLength) -{ - int copysize = iAudioDataLength < (int)sizeof( g_audio_data ) ? iAudioDataLength : (int)sizeof( g_audio_data ); - for (int i = 0 ; i < copysize*2 ; i+=2 ) - { - g_audio_data[0][i/2] = *(pAudioData + i); - g_audio_data[1][i/2] = *(pAudioData + i + 1); - } - if ( pFreqData ) - { - copysize = iFreqDataLength < (int)sizeof( g_freq_data ) ? iFreqDataLength : (int)sizeof( g_freq_data ); - memcpy( g_freq_data[0], pFreqData, copysize ); - memcpy( g_freq_data[1], pFreqData, copysize ); - } - g_new_audio = true; -} - - -//-- Render ------------------------------------------------------------------- -// Called once per frame. Do all rendering here. -//----------------------------------------------------------------------------- -extern "C" void Render() -{ - static ITunesPixelFormat format; - static float yflip = 0.0; - if ( ! g_tex_id ) - { - // initialize the texture we'll be using - glGenTextures( 1, &g_tex_id ); - if ( ! g_tex_id ) - return; - - /* render the vislualization */ - format = ivis_render( g_plugin, g_audio_data, g_freq_data, (void*)g_tex_buffer, - g_tex_buffer_size, !g_new_audio ); - glActiveTextureARB( GL_TEXTURE3_ARB ); - glDisable( GL_TEXTURE_2D ); - glActiveTextureARB( GL_TEXTURE2_ARB ); - glDisable( GL_TEXTURE_2D ); - glActiveTextureARB( GL_TEXTURE1_ARB ); - glDisable( GL_TEXTURE_2D ); - - /* update texture */ - glActiveTextureARB( GL_TEXTURE0_ARB ); - glEnable(GL_TEXTURE_2D); - glBindTexture( GL_TEXTURE_2D, g_tex_id ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - if ( format == ITunesPixelFormatRGBA32 ) - { - glTexImage2D( GL_TEXTURE_2D, 0, 4, g_tex_width, g_tex_height, 0, - GL_BGRA, GL_UNSIGNED_BYTE, g_tex_buffer ); - } - else if ( format == ITunesPixelFormatRGB24 ) - { - glTexImage2D( GL_TEXTURE_2D, 0, 4, g_tex_width, g_tex_height, 0, - GL_RGB, GL_UNSIGNED_BYTE, g_tex_buffer ); - yflip = 1.0; - } - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } - else - { - /* render the vislualization */ - format = ivis_render( g_plugin, g_audio_data, g_freq_data, (void*)g_tex_buffer, - g_tex_buffer_size, !g_new_audio ); - glActiveTextureARB( GL_TEXTURE3_ARB ); - glDisable( GL_TEXTURE_2D ); - glActiveTextureARB( GL_TEXTURE2_ARB ); - glDisable( GL_TEXTURE_2D ); - glActiveTextureARB( GL_TEXTURE1_ARB ); - glDisable( GL_TEXTURE_2D ); - - /* update texture */ - glActiveTextureARB( GL_TEXTURE0_ARB ); - glEnable(GL_TEXTURE_2D); - glBindTexture( GL_TEXTURE_2D, g_tex_id ); - if ( format == ITunesPixelFormatRGBA32 ) - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, g_tex_width, g_tex_height, - GL_BGRA, GL_UNSIGNED_BYTE, g_tex_buffer ); - else if ( format == ITunesPixelFormatRGB24 ) - glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, g_tex_width, g_tex_height, - GL_RGB, GL_UNSIGNED_BYTE, g_tex_buffer ); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } - g_new_audio = false; - - /* draw a quad with the updated texture */ - glDisable(GL_BLEND); - glBegin( GL_QUADS ); - { - glColor3f( 1.0, 1.0, 1.0 ); - glTexCoord2f( 0.0, 1.0 - yflip ); - glVertex2f( g_window_xpos, g_window_ypos ); - - glTexCoord2f( 0.0, yflip - 0.0 ); - glVertex2f( g_window_xpos, g_window_ypos + g_window_height ); - - glTexCoord2f( 1.0, yflip - 0.0 ); - glVertex2f( g_window_xpos + g_window_width, g_window_ypos + g_window_height ); - - glTexCoord2f( 1.0, 1.0 - yflip ); - glVertex2f( g_window_xpos + g_window_width, g_window_ypos ); - } - glEnd(); - glDisable( GL_TEXTURE_2D ); - glEnable(GL_BLEND); -} - -//-- GetInfo ------------------------------------------------------------------ -// Tell XBMC our requirements -//----------------------------------------------------------------------------- -extern "C" void GetInfo(VIS_INFO* pInfo) -{ - pInfo->bWantsFreq = false; - pInfo->iSyncDelay = 0; -} - -//-- OnAction ----------------------------------------------------------------- -// Handle XBMC actions such as next preset, lock preset, album art changed etc -//----------------------------------------------------------------------------- -extern "C" bool OnAction(long flags, const void *param) -{ - bool ret = false; - - switch( flags ) - { - case VIS_ACTION_UPDATE_ALBUMART: - if ( param ) - ivis_set_album_art( g_plugin, (const char*)param ); - break; - - case VIS_ACTION_UPDATE_TRACK: - if ( param ) - { - VisTrack* info_param = (VisTrack*)param; - ITunesTrack track_info; - memset( &track_info, 0, sizeof(track_info) ); - - track_info.title = info_param->title; - track_info.artist = info_param->artist; - track_info.album = info_param->album; - track_info.album_artist = info_param->albumArtist; - track_info.track_number = info_param->trackNumber; - track_info.disc_number = info_param->discNumber; - track_info.duration = info_param->duration; - track_info.year = info_param->year; - track_info.genre = info_param->genre; - track_info.rating = info_param->rating * 20; - - ivis_set_track_info( g_plugin, &track_info ); - } - } - return ret; -} - -//-- GetPresets --------------------------------------------------------------- -// Return a list of presets to XBMC for display -//----------------------------------------------------------------------------- -extern "C" unsigned int GetPresets(char ***pPresets) -{ - return 0; -} - -//-- GetPreset ---------------------------------------------------------------- -// Return the index of the current playing preset -//----------------------------------------------------------------------------- -extern "C" unsigned GetPreset() -{ - return 0; -} - -//-- IsLocked ----------------------------------------------------------------- -// Returns true if this add-on use settings -//----------------------------------------------------------------------------- -extern "C" bool IsLocked() -{ - return false; -} - -//-- GetSubModules ------------------------------------------------------------ -// Return a list of names and paths for submodules -//----------------------------------------------------------------------------- -extern "C" unsigned int GetSubModules(char ***modules) -{ - char **path; - unsigned int num_plugins; - - num_plugins = ivis_get_visualisations(modules, &path); - free(path); - return num_plugins; -} - -//-- Destroy------------------------------------------------------------------- -// Do everything before unload of this add-on -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -extern "C" void ADDON_Destroy() -{ -} - -//-- HasSettings -------------------------------------------------------------- -// Returns true if this add-on use settings -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -extern "C" bool ADDON_HasSettings() -{ - return false; -} - -//-- GetStatus --------------------------------------------------------------- -// Returns the current Status of this visualisation -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -extern "C" ADDON_STATUS ADDON_GetStatus() -{ - return ADDON_STATUS_OK; -} - -//-- GetSettings -------------------------------------------------------------- -// Return the settings for XBMC to display -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -extern "C" unsigned int ADDON_GetSettings(ADDON_StructSetting ***sSet) -{ - return 0; -} - -//-- FreeSettings -------------------------------------------------------------- -// Free the settings struct passed from XBMC -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- - -extern "C" void ADDON_FreeSettings() -{ -} - -//-- SetSetting --------------------------------------------------------------- -// Set a specific Setting value (called from XBMC) -// !!! Add-on master function !!! -//----------------------------------------------------------------------------- -extern "C" ADDON_STATUS ADDON_SetSetting(const char *strSetting, const void* value) -{ - return ADDON_STATUS_OK; -} - diff --git a/xbmc/visualizations/iTunes/Makefile.in b/xbmc/visualizations/iTunes/Makefile.in deleted file mode 100644 index 2f344a371f..0000000000 --- a/xbmc/visualizations/iTunes/Makefile.in +++ /dev/null @@ -1,15 +0,0 @@ -ARCH=@ARCH@ -INCLUDES=-I. -I@abs_top_srcdir@/addons/include -OBJS=Main.o itunes_vis.o qview.o common_osx.o -CXXFLAGS=-Wall -g -fPIC -SLIB=../../../addons/visualization.itunes/iTunes.mvis - -$(SLIB): $(OBJS) -ifeq ($(findstring osx,$(ARCH)), osx) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -Wl,-alias_list,@abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper_mach_alias \ - -framework Carbon -bundle -undefined dynamic_lookup -read_only_relocs suppress -o $@ \ - @abs_top_srcdir@/xbmc/cores/DllLoader/exports/wrapper.o $(OBJS) -endif - -include ../../../Makefile.include - diff --git a/xbmc/visualizations/iTunes/common.h b/xbmc/visualizations/iTunes/common.h deleted file mode 100644 index e4ea5c8e63..0000000000 --- a/xbmc/visualizations/iTunes/common.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#ifndef __ITUNES_VIS_COMMON_H__ -#define __ITUNES_VIS_COMMON_H__ - -/***********************************************************************/ -/* Common functions that have platform specific implementation */ -/***********************************************************************/ - -int _get_visualisations(char*** names, char*** paths); -char* _get_visualisation_path(const char* name); -char* _get_executable_path(const char* plugin_path); -void _get_album_art_from_file( const char *filename, Handle* handle, OSType* format ); - -void _copy_to_pascal_string( unsigned char dest[], const char* src, int dest_length ); -void _copy_to_unicode_string( unsigned short dest[], const char* src, int dest_length ); - -#endif // __ITUNES_VIS_COMMON_H__ diff --git a/xbmc/visualizations/iTunes/common_osx.m b/xbmc/visualizations/iTunes/common_osx.m deleted file mode 100644 index 1b421419b6..0000000000 --- a/xbmc/visualizations/iTunes/common_osx.m +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -/*********************************************************************/ -/* OS X implementation of common platform specific functions */ -/*********************************************************************/ - -#import <Cocoa/Cocoa.h> -#import <Quartz/Quartz.h> - -#include "common.h" - -void find_normal_plugins ( NSArray* searchPaths, NSMutableDictionary* pluginMap ); -void find_composition_plugins( NSMutableDictionary* pluginMap ); - -NSArray* get_search_paths() -{ - return [ [ NSArray alloc ] initWithObjects: - @"/Library/iTunes/iTunes Plug-ins", - @"~/Library/iTunes/iTunes Plug-ins", - @"~/Library/Application Support/XBMC/visualisations/iTunes", - nil ]; -} - -/*********************************************************************/ -/* _get_visualisations */ -/*********************************************************************/ -int _get_visualisations(char*** names, char*** paths) -{ - /* search for iTunes visualisers in the following directories */ - NSArray *searchPaths = get_search_paths(); - - NSMutableDictionary *pluginMap = [ [ NSMutableDictionary alloc ] init ]; - NSEnumerator *pluginEnumerator; - - /* search the searchPaths for iTunes plugins */ - find_normal_plugins ( searchPaths, pluginMap ); - //find_composition_plugins( pluginMap ); - - /* allocate enough memory for the names and paths of the plugins */ - int pluginCount = [ [ pluginMap allKeys ] count ]; - *names = (char**)calloc( pluginCount, sizeof(char *) ); - *paths = (char**)calloc( pluginCount, sizeof(char *) ); - - /* populate 'names' and 'paths' */ - int current = 0; - if ( names && paths ) - { - NSString *pluginName; - - pluginEnumerator = [ pluginMap keyEnumerator ]; - while ( ( pluginName = [ pluginEnumerator nextObject ] ) ) - { - const char *cStringName = [ pluginName cStringUsingEncoding: NSASCIIStringEncoding ]; - const char *cStringPath = [ [ pluginMap objectForKey: pluginName ] cStringUsingEncoding: NSASCIIStringEncoding ]; - - if ( cStringName && cStringPath ) - { - char *name = *( *names + current ) = (char*)malloc( strlen(cStringName) * sizeof(char) + 1 ); - char *path = *( *paths + current ) = (char*)malloc( strlen(cStringPath) * sizeof(char) + 1 ); - - if ( name && path ) - { - strcpy( name, cStringName ); - strcpy( path, cStringPath ); - current++; - } - } - } - } - - /* free the plugin map */ - [ pluginMap removeAllObjects ]; - [ pluginMap release ]; - [ searchPaths release ]; - - /* return the number of plugins that were loaded */ - return current; -} - -/*********************************************************************/ -/* _get_visualisation_path */ -/*********************************************************************/ -char* _get_visualisation_path( const char* name ) -{ - /* search for iTunes visualisers in the following directories */ - NSArray *searchPaths = get_search_paths(); - NSMutableDictionary *pluginMap = [ [ NSMutableDictionary alloc ] init ]; - NSString *pluginName = [ NSString stringWithCString: name - encoding: NSASCIIStringEncoding ]; - - /* search the searchPaths for iTunes plugins */ - find_normal_plugins ( searchPaths, pluginMap ); - find_composition_plugins( pluginMap ); - - NSString* pluginPath = [ pluginMap objectForKey: pluginName ]; - if ( pluginPath ) - { - int strLength = [ pluginPath lengthOfBytesUsingEncoding: NSASCIIStringEncoding ] + 1; - char *path = (char*)malloc( strLength ); - if ( path ) - { - strncpy( path, [ pluginPath cStringUsingEncoding: NSASCIIStringEncoding ], strLength ); - return path; - } - } - return NULL; -} - -/*********************************************************************/ -/* _get_executable_path */ -/*********************************************************************/ -char* _get_executable_path( const char* plugin_path ) -{ - char *exe_path = NULL; - NSString *pluginPath = [ NSString stringWithCString: plugin_path encoding: NSASCIIStringEncoding ]; - NSBundle *pluginBundle = [ NSBundle bundleWithPath: pluginPath ]; - - if ( pluginBundle ) - { - NSString *ns_exe_path = [ pluginBundle executablePath ]; - if ( ns_exe_path ) - { - int strLength = [ ns_exe_path lengthOfBytesUsingEncoding: NSASCIIStringEncoding ] + 1; - exe_path = (char*)malloc( strLength ); - if ( exe_path ) - { - strncpy( exe_path, [ ns_exe_path cStringUsingEncoding: NSASCIIStringEncoding ], strLength ); - } - } - } - return exe_path; -} - -/*********************************************************************/ -/* _copy_to_pascal_string */ -/*********************************************************************/ -void _copy_to_pascal_string( unsigned char dest[], const char* src, int dest_length ) -{ - CFStringGetPascalString( (CFStringRef)[NSString stringWithCString: src encoding: NSUTF8StringEncoding ], - (StringPtr)dest, dest_length, kCFStringEncodingASCII ); -} - -/*********************************************************************/ -/* _copy_to_unicode_string */ -/*********************************************************************/ -void _copy_to_unicode_string( unsigned short dest[], const char* src, int dest_length ) -{ - NSString *srcString = [NSString stringWithCString: src encoding: NSUTF8StringEncoding ]; - [ srcString getCString: (char*)dest maxLength: dest_length encoding: NSUnicodeStringEncoding ]; -} - -/*********************************************************************/ -/* _get_album_art_from_file */ -/*********************************************************************/ -void _get_album_art_from_file( const char *filename, Handle* handle, OSType* format ) -{ - NSString *album_art_file = [ NSString stringWithUTF8String: filename ]; - NSData *album_art_data = [ [ NSData alloc ] initWithContentsOfFile: album_art_file ]; - if ( album_art_data != nil ) - { - PtrToHand( [ album_art_data bytes ], handle, [ album_art_data length ] ); - NSString *type = NSHFSTypeOfFile( album_art_file ); - NSLog( @"Type: %@ (length=%d)", type, [type length] ); - - /* since XBMC thumbs usually have .tbn extension, we'll likely not - get a match. For now, default to OSType 'JPEG' until we have a - proper image type detection mechanism. */ - if ( [ type isEqualToString:@"''" ] ) - *format = 'JPEG'; - else - *format = NSHFSTypeCodeFromFileType(type); - } -} - -/*********************************************************************/ -/* find_composition_plugins */ -/*********************************************************************/ -void find_composition_plugins( NSMutableDictionary* pluginMap ) -#if (MAC_OS_X_VERSION_MAX_ALLOWED <= 1040) -{ - /* QCComposition and QCCompositionRepository are 10.5 only */ - return; -} -#else -{ - QCCompositionRepository *repo = [ QCCompositionRepository sharedCompositionRepository ]; - if ( repo ) - { - NSArray *visualisers = [ repo compositionsWithProtocols: - [ NSArray arrayWithObjects: - @"com.apple.QuartzComposer.protocol.visualizer-music", - nil ] - andAttributes: nil ]; - if ( visualisers ) - { - QCComposition *vis; - NSString *pluginName; - - for ( vis in visualisers ) - { - /* get plugin name */ - pluginName = [ [ vis attributes ] objectForKey: QCCompositionAttributeNameKey ]; - - /* add plugin to plugin map using an empty string as path */ - [ pluginMap setObject: @"" forKey: [ pluginName retain ] ]; - } - } - } -} -#endif - -/*********************************************************************/ -/* find_normal_plugins */ -/*********************************************************************/ -void find_normal_plugins( NSArray* searchPaths, NSMutableDictionary* pluginMap ) -{ - NSString *path; - NSEnumerator *pluginEnumerator; - NSEnumerator *pathEnumerator = [ searchPaths objectEnumerator ]; - - while ( ( path = [ pathEnumerator nextObject ] ) ) - { - path = [ path stringByExpandingTildeInPath ]; - NSString *pluginPath; - NSArray *plugins = [ NSBundle pathsForResourcesOfType:@"bundle" inDirectory:path ]; - - pluginEnumerator = [ plugins objectEnumerator ]; - while( ( pluginPath = [ pluginEnumerator nextObject ] ) ) - { - NSBundle *pluginBundle = nil; - NSString *pluginName = nil; - - pluginName = [ pluginPath lastPathComponent ]; - pluginBundle = [ NSBundle bundleWithPath: pluginPath ]; - - if ( pluginBundle && pluginName - && ( pluginName = [ pluginName stringByDeletingPathExtension ] ) - && ( [ pluginName compare: @"Quartz Composer Visualizer" ] != 0 ) ) - { - /* save the path and name to the plugin map */ - [ pluginMap setValue: pluginPath forKey: pluginName ]; - } - } - } -} diff --git a/xbmc/visualizations/iTunes/iTunesAPI.c b/xbmc/visualizations/iTunes/iTunesAPI.c deleted file mode 100755 index 1f42c09f1c..0000000000 --- a/xbmc/visualizations/iTunes/iTunesAPI.c +++ /dev/null @@ -1,424 +0,0 @@ -// -// File: iTunesAPI.c -// -// Abstract: part of iTunes Visual SDK -// -// Version: 1.2 -// -// Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ( "Apple" ) -// in consideration of your agreement to the following terms, and your use, -// installation, modification or redistribution of this Apple software -// constitutes acceptance of these terms. If you do not agree with these -// terms, please do not use, install, modify or redistribute this Apple -// software. -// -// In consideration of your agreement to abide by the following terms, and -// subject to these terms, Apple grants you a personal, non - exclusive -// license, under Apple's copyrights in this original Apple software ( the -// "Apple Software" ), to use, reproduce, modify and redistribute the Apple -// Software, with or without modifications, in source and / or binary forms; -// provided that if you redistribute the Apple Software in its entirety and -// without modifications, you must retain this notice and the following text -// and disclaimers in all such redistributions of the Apple Software. Neither -// the name, trademarks, service marks or logos of Apple Inc. may be used to -// endorse or promote products derived from the Apple Software without specific -// prior written permission from Apple. Except as expressly stated in this -// notice, no other rights or licenses, express or implied, are granted by -// Apple herein, including but not limited to any patent rights that may be -// infringed by your derivative works or by other works in which the Apple -// Software may be incorporated. -// -// The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -// WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -// WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION -// ALONE OR IN COMBINATION WITH YOUR PRODUCTS. -// -// IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION -// AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER -// UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR -// OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright ( C ) 2000-2007 Apple Inc. All Rights Reserved. -// - -#include "iTunesAPI.h" -#include "iTunesVisualAPI.h" - -// MyMemClear -// -static void MyMemClear (LogicalAddress dest, SInt32 length) -{ - register unsigned char *ptr; - - ptr = (unsigned char *) dest; - - if( length > 16 ) - { - register unsigned long *longPtr; - - while( ((unsigned long) ptr & 3) != 0 ) - { - *ptr++ = 0; - --length; - } - - longPtr = (unsigned long *) ptr; - - while( length >= 4 ) - { - *longPtr++ = 0; - length -= 4; - } - - ptr = (unsigned char *) longPtr; - } - - while( --length >= 0 ) - { - *ptr++ = 0; - } -} - - -// SetNumVersion -// -void SetNumVersion (NumVersion *numVersion, UInt8 majorRev, UInt8 minorAndBugRev, UInt8 stage, UInt8 nonRelRev) -{ - numVersion->majorRev = majorRev; - numVersion->minorAndBugRev = minorAndBugRev; - numVersion->stage = stage; - numVersion->nonRelRev = nonRelRev; -} - - -// ITCallApplication -// -static OSStatus ITCallApplicationInternal (void *appCookie, ITAppProcPtr handler, OSType message, UInt32 messageMajorVersion, UInt32 messageMinorVersion, PlayerMessageInfo *messageInfo) -{ - PlayerMessageInfo localMessageInfo; - - if (messageInfo == nil) - { - MyMemClear(&localMessageInfo, sizeof(localMessageInfo)); - - messageInfo = &localMessageInfo; - } - - messageInfo->messageMajorVersion = messageMajorVersion; - messageInfo->messageMinorVersion = messageMinorVersion; - messageInfo->messageInfoSize = sizeof(PlayerMessageInfo); - - return handler(appCookie, message, messageInfo); -} - -// ITCallApplication -// -OSStatus ITCallApplication (void *appCookie, ITAppProcPtr handler, OSType message, PlayerMessageInfo *messageInfo) -{ - return ITCallApplicationInternal(appCookie, handler, message, kITPluginMajorMessageVersion, kITPluginMinorMessageVersion, messageInfo); -} - - -// PlayerSetFullScreen -// -OSStatus PlayerSetFullScreen (void *appCookie, ITAppProcPtr appProc, Boolean fullScreen) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.setFullScreenMessage.fullScreen = fullScreen; - - return ITCallApplication(appCookie, appProc, kPlayerSetFullScreenMessage, &messageInfo); -} - - -// PlayerSetFullScreenOptions -// -OSStatus PlayerSetFullScreenOptions (void *appCookie, ITAppProcPtr appProc, SInt16 minBitDepth, SInt16 maxBitDepth, SInt16 preferredBitDepth, SInt16 desiredWidth, SInt16 desiredHeight) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.setFullScreenOptionsMessage.minBitDepth = minBitDepth; - messageInfo.u.setFullScreenOptionsMessage.maxBitDepth = maxBitDepth; - messageInfo.u.setFullScreenOptionsMessage.preferredBitDepth = preferredBitDepth; - messageInfo.u.setFullScreenOptionsMessage.desiredWidth = desiredWidth; - messageInfo.u.setFullScreenOptionsMessage.desiredHeight = desiredHeight; - - return ITCallApplication(appCookie, appProc, kPlayerSetFullScreenOptionsMessage, &messageInfo); -} - -// PlayerGetCurrentTrackCoverArt -// -OSStatus PlayerGetCurrentTrackCoverArt (void *appCookie, ITAppProcPtr appProc, Handle *coverArt, OSType *coverArtFormat) -{ - OSStatus status; - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getCurrentTrackCoverArtMessage.coverArt = nil; - - status = ITCallApplication(appCookie, appProc, kPlayerGetCurrentTrackCoverArtMessage, &messageInfo); - - *coverArt = messageInfo.u.getCurrentTrackCoverArtMessage.coverArt; - if (coverArtFormat) - *coverArtFormat = messageInfo.u.getCurrentTrackCoverArtMessage.coverArtFormat; - return status; -} - -// PlayerGetPluginData -// -OSStatus PlayerGetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize) -{ - OSStatus status; - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getPluginDataMessage.dataPtr = dataPtr; - messageInfo.u.getPluginDataMessage.dataBufferSize = dataBufferSize; - - status = ITCallApplication(appCookie, appProc, kPlayerGetPluginDataMessage, &messageInfo); - - if (dataSize != nil) - *dataSize = messageInfo.u.getPluginDataMessage.dataSize; - - return status; -} - - -// PlayerSetPluginData -// -OSStatus PlayerSetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataSize) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.setPluginDataMessage.dataPtr = dataPtr; - messageInfo.u.setPluginDataMessage.dataSize = dataSize; - - return ITCallApplication(appCookie, appProc, kPlayerSetPluginDataMessage, &messageInfo); -} - - -// PlayerGetPluginNamedData -// -OSStatus PlayerGetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize) -{ - OSStatus status; - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getPluginNamedDataMessage.dataName = dataName; - messageInfo.u.getPluginNamedDataMessage.dataPtr = dataPtr; - messageInfo.u.getPluginNamedDataMessage.dataBufferSize = dataBufferSize; - - status = ITCallApplication(appCookie, appProc, kPlayerGetPluginNamedDataMessage, &messageInfo); - - if (dataSize != nil) - *dataSize = messageInfo.u.getPluginNamedDataMessage.dataSize; - - return status; -} - - -// PlayerSetPluginNamedData -// -OSStatus PlayerSetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataSize) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.setPluginNamedDataMessage.dataName = dataName; - messageInfo.u.setPluginNamedDataMessage.dataPtr = dataPtr; - messageInfo.u.setPluginNamedDataMessage.dataSize = dataSize; - - return ITCallApplication(appCookie, appProc, kPlayerSetPluginNamedDataMessage, &messageInfo); -} - - -// PlayerIdle -// -OSStatus PlayerIdle (void *appCookie, ITAppProcPtr appProc) -{ - return ITCallApplication(appCookie, appProc, kPlayerIdleMessage, nil); -} - - -// PlayerShowAbout -// -void PlayerShowAbout (void *appCookie, ITAppProcPtr appProc) -{ - ITCallApplication(appCookie, appProc, kPlayerShowAboutMessage, nil); -} - - -// PlayerOpenURL -// -void PlayerOpenURL (void *appCookie, ITAppProcPtr appProc, SInt8 *string, UInt32 length) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.openURLMessage.url = string; - messageInfo.u.openURLMessage.length = length; - - ITCallApplication(appCookie, appProc, kPlayerOpenURLMessage, &messageInfo); -} - -// PlayerUnregisterPlugin -// -OSStatus PlayerUnregisterPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo) -{ - return ITCallApplication(appCookie, appProc, kPlayerUnregisterPluginMessage, messageInfo); -} - - -// PlayerRegisterVisualPlugin -// -OSStatus PlayerRegisterVisualPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo) -{ - return ITCallApplicationInternal(appCookie, appProc, kPlayerRegisterVisualPluginMessage, kITVisualPluginMajorMessageVersion, kITVisualPluginMinorMessageVersion, messageInfo); -} - - -// PlayerHandleMacOSEvent -// -OSStatus PlayerHandleMacOSEvent (void *appCookie, ITAppProcPtr appProc, const EventRecord *theEvent, Boolean *eventHandled) -{ - PlayerMessageInfo messageInfo; - OSStatus status; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.handleMacOSEventMessage.theEvent = theEvent; - - status = ITCallApplication(appCookie, appProc, kPlayerHandleMacOSEventMessage, &messageInfo); - - if( eventHandled != nil ) - *eventHandled = messageInfo.u.handleMacOSEventMessage.handled; - - return status; -} - -// PlayerGetPluginFileSpec -// -#if TARGET_OS_MAC -OSStatus PlayerGetPluginFileSpec (void *appCookie, ITAppProcPtr appProc, FSSpec *pluginFileSpec) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getPluginFileSpecMessage.fileSpec = pluginFileSpec; - - return ITCallApplication(appCookie, appProc, kPlayerGetPluginFileSpecMessage, &messageInfo); -} -#endif // TARGET_OS_MAC - -// PlayerGetPluginITFileSpec -// -OSStatus PlayerGetPluginITFileSpec (void *appCookie, ITAppProcPtr appProc, ITFileSpec *pluginFileSpec) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getPluginITFileSpecMessage.fileSpec = pluginFileSpec; - - return ITCallApplication(appCookie, appProc, kPlayerGetPluginITFileSpecMessage, &messageInfo); -} - -// PlayerGetFileTrackInfo -// -OSStatus PlayerGetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, ITTrackInfo *trackInfo) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.getFileTrackInfoMessage.fileSpec = fileSpec; - messageInfo.u.getFileTrackInfoMessage.trackInfo = trackInfo; - - return ITCallApplication(appCookie, appProc, kPlayerGetFileTrackInfoMessage, &messageInfo); -} - -// PlayerSetFileTrackInfo -// -OSStatus PlayerSetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, const ITTrackInfo *trackInfo) -{ - PlayerMessageInfo messageInfo; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - messageInfo.u.setFileTrackInfoMessage.fileSpec = fileSpec; - messageInfo.u.setFileTrackInfoMessage.trackInfo = trackInfo; - - return ITCallApplication(appCookie, appProc, kPlayerSetFileTrackInfoMessage, &messageInfo); -} - -// PlayerGetITTrackInfoSize -// -OSStatus PlayerGetITTrackInfoSize (void *appCookie, ITAppProcPtr appProc, UInt32 appPluginMajorVersion, UInt32 appPluginMinorVersion, UInt32 *itTrackInfoSize) -{ - PlayerMessageInfo messageInfo; - OSStatus status; - - /* - Note: appPluginMajorVersion and appPluginMinorVersion are the versions given to the plugin by iTunes in the plugin's init message. - These versions are *not* the version of the API used when the plugin was compiled. - */ - - *itTrackInfoSize = 0; - - MyMemClear(&messageInfo, sizeof(messageInfo)); - - status = ITCallApplication(appCookie, appProc, kPlayerGetITTrackInfoSizeMessage, &messageInfo); - if( status == noErr ) - { - *itTrackInfoSize = messageInfo.u.getITTrackInfoSizeMessage.itTrackInfoSize; - } - else if( appPluginMajorVersion == 10 && appPluginMinorVersion == 2 ) - { - // iTunes 2.0.x - - *itTrackInfoSize = ((UInt32) &((ITTrackInfo *) 0)->composer); - - status = noErr; - } - else if( appPluginMajorVersion == 10 && appPluginMinorVersion == 3 ) - { - // iTunes 3.0.x - - *itTrackInfoSize = ((UInt32) &((ITTrackInfo *) 0)->beatsPerMinute); - - status = noErr; - } - else - { - // iTunes 4.0 and later implement the kPlayerGetITTrackInfoSizeMessage message. If you got here - // then the appPluginMajorVersion or appPluginMinorVersion are incorrect. - - status = paramErr; - } - - if( status == noErr && (*itTrackInfoSize) > sizeof(ITTrackInfo) ) - { - // iTunes is using a larger ITTrackInfo than the one when this plugin was compiled. Pin *itTrackInfoSize to the plugin's known size - - *itTrackInfoSize = sizeof(ITTrackInfo); - } - - return status; -} diff --git a/xbmc/visualizations/iTunes/iTunesAPI.h b/xbmc/visualizations/iTunes/iTunesAPI.h deleted file mode 100755 index f9aa90af91..0000000000 --- a/xbmc/visualizations/iTunes/iTunesAPI.h +++ /dev/null @@ -1,718 +0,0 @@ -// -// File: iTunesAPI.h -// -// Abstract: part of iTunes Visual SDK -// -// Version: 1.2 -// -// Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ( "Apple" ) -// in consideration of your agreement to the following terms, and your use, -// installation, modification or redistribution of this Apple software -// constitutes acceptance of these terms. If you do not agree with these -// terms, please do not use, install, modify or redistribute this Apple -// software. -// -// In consideration of your agreement to abide by the following terms, and -// subject to these terms, Apple grants you a personal, non - exclusive -// license, under Apple's copyrights in this original Apple software ( the -// "Apple Software" ), to use, reproduce, modify and redistribute the Apple -// Software, with or without modifications, in source and / or binary forms; -// provided that if you redistribute the Apple Software in its entirety and -// without modifications, you must retain this notice and the following text -// and disclaimers in all such redistributions of the Apple Software. Neither -// the name, trademarks, service marks or logos of Apple Inc. may be used to -// endorse or promote products derived from the Apple Software without specific -// prior written permission from Apple. Except as expressly stated in this -// notice, no other rights or licenses, express or implied, are granted by -// Apple herein, including but not limited to any patent rights that may be -// infringed by your derivative works or by other works in which the Apple -// Software may be incorporated. -// -// The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -// WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -// WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION -// ALONE OR IN COMBINATION WITH YOUR PRODUCTS. -// -// IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION -// AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER -// UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR -// OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright ( C ) 2000-2007 Apple Inc. All Rights Reserved. -// -#ifndef ITUNESAPI_H_ -#define ITUNESAPI_H_ - -#if PRAGMA_ONCE -#pragma once -#endif - - -#if defined(_MSC_VER) - #define TARGET_OS_MAC 0 - #define TARGET_OS_WIN32 1 -#else - #define TARGET_OS_MAC 1 - #define TARGET_OS_WIN32 0 -#endif - -#if TARGET_OS_MAC - #include <Carbon/Carbon.h> - #include <CoreAudio/CoreAudioTypes.h> -#endif -#if TARGET_OS_WIN32 - #include <windows.h> -#endif - -#if !defined(__CONDITIONALMACROS__) -typedef unsigned long UInt32; -typedef signed long SInt32; -typedef unsigned short UInt16; -typedef signed short SInt16; -typedef unsigned char UInt8; -typedef signed char SInt8; -typedef UInt32 OptionBits; - -typedef UInt8 Str255[256]; -typedef UInt8 Str63[64]; -typedef UInt8 * StringPtr; -typedef const UInt8 * ConstStringPtr; -typedef UInt32 OSType; - -typedef SInt32 OSStatus; - -typedef UInt16 EventKind; - -typedef UInt16 EventModifiers; - -typedef UInt16 UniChar; - -typedef double Float64; - - -#if TARGET_OS_WIN32 -typedef unsigned __int64 UInt64; -#else -typedef unsigned long long UInt64; -#endif - -typedef void ** Handle; - -struct NumVersion { - UInt8 majorRev; - UInt8 minorAndBugRev; - UInt8 stage; - UInt8 nonRelRev; -}; -typedef struct NumVersion NumVersion; - -struct Point { - short v; - short h; -}; -typedef struct Point Point; - -struct Rect { - short top; - short left; - short bottom; - short right; -}; -typedef struct Rect Rect; - -struct EventRecord { - EventKind what; - UInt32 message; - UInt32 when; - Point where; - EventModifiers modifiers; -}; -typedef struct EventRecord EventRecord; - -typedef UInt8 Boolean; - -typedef UInt32 UnsignedFixed; - -typedef void * LogicalAddress; - -#define false 0 -#define true 1 -#define nil NULL - -enum { - noErr = 0, - unimpErr = -4, - readErr = -19, - writErr = -20, - openErr = -23, - closErr = -24, - dirFulErr = -33, - dskFulErr = -34, - nsvErr = -35, - ioErr = -36, - bdNamErr = -37, - fnOpnErr = -38, - eofErr = -39, - posErr = -40, - tmfoErr = -42, - fnfErr = -43, - wPrErr = -44, - fLckdErr = -45, - vLckdErr = -46, - fBsyErr = -47, - dupFNErr = -48, - opWrErr = -49, - paramErr = -50, - permErr = -54, - nsDrvErr = -56, - wrPermErr = -61, - memFullErr = -108, - dirNFErr = -120, - badMovErr = -122 -}; - -enum { - developStage = 0x20, - alphaStage = 0x40, - betaStage = 0x60, - finalStage = 0x80 -}; - -struct SoundComponentData { - long flags; - OSType format; - short numChannels; - short sampleSize; - UnsignedFixed sampleRate; - long sampleCount; - UInt8 * buffer; - long reserved; -}; -typedef struct SoundComponentData SoundComponentData; - -struct AudioStreamBasicDescription -{ - Float64 mSampleRate; - UInt32 mFormatID; - UInt32 mFormatFlags; - UInt32 mBytesPerPacket; - UInt32 mFramesPerPacket; - UInt32 mBytesPerFrame; - UInt32 mChannelsPerFrame; - UInt32 mBitsPerChannel; - UInt32 mReserved; -}; -typedef struct AudioStreamBasicDescription AudioStreamBasicDescription; - -#endif - -#if TARGET_OS_WIN32 -#define GRAPHICS_DEVICE HWND -#define GRAPHICS_DEVICE_NAME window -#else -#define GRAPHICS_DEVICE CGrafPtr -#define GRAPHICS_DEVICE_NAME port -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=power -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(push, 4) -#elif PRAGMA_STRUCT_PACK - #pragma pack(4) -#endif - - -enum { - kITPluginMajorMessageVersion = 10, - kITPluginMinorMessageVersion = 9 -}; - -enum { - kTrackSupportsID3Tags = (1L << 0), - kTrackHasVariableBitRate = (1L << 1), - kTrackIsLocked = (1L << 3), /* Device tracks only. Track cannot be deleted or renamed */ - kTrackCanBeDownloaded = (1L << 4), /* Device tracks only. Track can be copied from device to desktop. */ - kTrackIsHidden = (1L << 5), /* Device tracks only. Track should not be displayed in the device window. */ - kTrackHasVideo = (1L << 6) /* Track has video track which can be played in iTunes */ -}; -typedef OptionBits ITTrackAttributes; - -enum { - /* - These mask values are specified in ITTrackInfo.validFields - to indicate which fields contain valid data - */ - - kITTIFieldInvalid = 0, - kITTINameFieldMask = (1L << 0), - kITTIFileNameFieldMask = (1L << 1), - kITTIArtistFieldMask = (1L << 2), - kITTIAlbumFieldMask = (1L << 3), - kITTIGenreFieldMask = (1L << 4), - kITTIKindFieldMask = (1L << 5), - kITTITrackNumberFieldsMask = (1L << 6), - kITTIYearFieldMask = (1L << 7), - kITTISoundVolumeFieldMask = (1L << 8), - kITTIEQPresetFieldMask = (1L << 9), - kITTICommentsFieldMask = (1L << 10), - kITTITotalTimeFieldMask = (1L << 11), - kITTIStartTimeFieldMask = (1L << 12), - kITTIStopTimeFieldMask = (1L << 13), - kITTISizeFieldMask = (1L << 14), - kITTIBitRateFieldMask = (1L << 15), - kITTISampleRateFieldMask = (1L << 16), - kITTIAttributesFieldMask = (1L << 17), - kITTIFileTypeFieldMask = (1L << 18), - kITTIDateFieldMask = (1L << 19), - kITTIFileCreatorFieldMask = (1L << 20), - kITTIComposerFieldMask = (1L << 21), /* Added in iTunes 3.0 */ - kITTICompilationFieldMask = (1L << 22), /* Added in iTunes 3.0 */ - kITTIDiscNumberFieldsMask = (1L << 23), /* Added in iTunes 3.0 */ - kITTITrackRatingFieldMask = (1L << 24), /* Added in iTunes 3.0 - used to be called kITTIUserRatingFieldMask */ - kITTIPlayCountFieldMask = (1L << 25), /* Added in iTunes 3.0 */ - kITTILastPlayDateFieldMask = (1L << 26), /* Added in iTunes 3.0 */ - kITTIBeatsPerMinuteFieldMask = (1L << 27), /* Added in iTunes 4.0 */ - kITTIGroupingFieldMask = (1L << 28), /* Added in iTunes 4.2 */ - kITTIGaplessAlbumFieldMask = (1L << 29), /* Added in iTunes 7.0 */ - kITTIAlbumArtistFieldMask = (1L << 30) /* Added in iTunes 7.0 */ -}; -typedef OptionBits ITTIFieldMask; - -#define kLastKnownITTIField kITTIAlbumArtistFieldMask -#define kAllKnownITTIFieldsMask ((((UInt32) kLastKnownITTIField) << 1) - 1) - -enum -{ - kITTIUserModifiableFieldsMask = kITTINameFieldMask | kITTIArtistFieldMask | kITTIAlbumFieldMask | kITTIGroupingFieldMask | kITTIGenreFieldMask | - kITTITrackNumberFieldsMask | kITTIYearFieldMask | kITTISoundVolumeFieldMask | kITTIEQPresetFieldMask | - kITTICommentsFieldMask | kITTIStartTimeFieldMask | kITTIStopTimeFieldMask | kITTIComposerFieldMask | - kITTICompilationFieldMask | kITTIDiscNumberFieldsMask | kITTITrackRatingFieldMask | kITTIBeatsPerMinuteFieldMask | - kITTIGaplessAlbumFieldMask | kITTIAlbumArtistFieldMask -}; - -typedef UniChar ITUniStr255[256]; /* Similar to Str255. First element is length of string in characters. */ -typedef UniChar * ITUniStringPtr; -typedef const UniChar * ConstITUniStringPtr; - -#if TARGET_OS_MAC - typedef FSRef ITFileSpec; -#endif - -#if TARGET_OS_WIN32 - #define kITFileSpecMaxPathLength (MAX_PATH - 1) - - typedef struct ITFileSpec - { - UInt16 length; // Length in characters - UniChar fullPath[kITFileSpecMaxPathLength]; - } ITFileSpec; -#endif - -struct ITTrackInfo { - ITTIFieldMask validFields; - UInt32 recordLength; /* Size of this structure in bytes */ - - ITUniStr255 name; - ITUniStr255 fileName; - ITUniStr255 artist; - ITUniStr255 album; - ITUniStr255 genre; - ITUniStr255 kind; - ITUniStr255 eqPresetName; - ITUniStr255 comments; - - UInt32 trackNumber; - UInt32 numTracks; - - UInt16 year; - SInt16 soundVolumeAdjustment; /* Valid range is -255 to +255 */ - - UInt32 totalTimeInMS; - UInt32 startTimeInMS; - UInt32 stopTimeInMS; - - UInt32 date; - UInt32 oldSizeInBytes; /* Deprecated in iTunes 7.1 */ - - UInt32 bitRate; - UInt32 oldSampleRateFixed; /* Deprecated in iTunes 5.0 */ - - OSType fileType; - OSType fileCreator; - - ITTrackAttributes attributes; - ITTrackAttributes validAttributes; /* Mask indicating which attributes are applicable */ - - ITUniStr255 composer; /* Added in iTunes 3.0 */ - - Boolean isCompilationTrack; /* Added in iTunes 3.0 */ - Boolean partOfGaplessAlbum; /* Added in iTunes 7.0 (was reserved) */ - - UInt16 trackRating; /* Added in iTunes 3.0. 0 = unrated, valid values are 20, 40, 60, 80 and 100. Used to be called userRating */ - - UInt16 discNumber; /* Added in iTunes 3.0 */ - UInt16 numDiscs; /* Added in iTunes 3.0 */ - - UInt32 playCount; /* Added in iTunes 3.0 */ - UInt32 lastPlayDate; /* Added in iTunes 3.0 */ - - UInt16 beatsPerMinute; /* Added in iTunes 4.0 */ - UInt16 reserved; /* Reserved. Must be zero. */ - - ITUniStr255 grouping; /* Added in iTunes 4.0 */ - - float sampleRateFloat; /* Added in iTunes 5.0 */ - - ITUniStr255 albumArtist; /* Added in iTunes 7.0 */ - - UInt64 sizeInBytes; /* Added in iTunes 7.1 */ -}; -typedef struct ITTrackInfo ITTrackInfo; - -struct ITStreamInfo { - SInt32 version; - ITUniStr255 streamTitle; - ITUniStr255 streamURL; - ITUniStr255 streamMessage; -}; -typedef struct ITStreamInfo ITStreamInfo; - -enum { - /* messages sent to plugin main */ - - kPluginInitMessage = 'init', - kPluginCleanupMessage = 'clr ', - kPluginPrepareToQuitMessage = 'prqt', - - kPluginIdleMessage = 'idle' -}; - - -enum { - /* PluginInitMessage.options */ - - kPluginWantsIdleMessages = (1L << 1), /* Send idle messages to plugin main */ - kPluginWantsToBeLeftOpen = (1L << 2), /* Don't close this plugin just because it didn't register anyone */ - kPluginWantsVolumeMessages = (1L << 3), /* The plugin wants to be notified when volumes are mounted/unmounted/renamed */ - kPluginWantsDisplayNotification = (1L << 5) /* The plugin wants to know when the display depth/size changes */ -}; - - -enum { - /* iTunes API messages */ - - kPlayerRegisterVisualPluginMessage = 'rvis', /* Register a visual plugin */ - - /* Available for all plugins */ - - kPlayerUnregisterPluginMessage = 'unrg', /* Unregister the plugin this comes from */ - kPlayerIdleMessage = 'idle', /* Give iTunes some time */ - - kPlayerShowAboutMessage = 'abou', /* Show the about box. */ - kPlayerOpenURLMessage = 'url ', /* Open a URL */ - - kPlayerSetPluginDataMessage = 'sprf', /* Set plugin preferences */ - kPlayerGetPluginDataMessage = 'gprf', /* Get plugin preferences */ - - kPlayerSetPluginNamedDataMessage = 'snpr', /* Set plugin named preferenes */ - kPlayerGetPluginNamedDataMessage = 'gnpr', /* Get plugin named preferenes */ - - kPlayerGetFileTrackInfoMessage = 'gfti', /* Query iTunes for information about a file */ - kPlayerSetFileTrackInfoMessage = 'sfti', /* Ask iTunes to set information about a file */ - - kPlayerGetITTrackInfoSizeMessage = 'itsz', /* Query iTunes for the sizeof(ITTrackInfo). This allows newer plugins to correctly workd with older versions of iTunes. */ - - kPlayerHandleMacOSEventMessage = 'evnt', /* Tell player to handle unhandled event */ - -#if TARGET_OS_MAC - kPlayerGetPluginFileSpecMessage = 'pspc', /* Get the location of the plugin executable (compatibility only) */ -#endif - - kPlayerGetPluginITFileSpecMessage = 'itfs', /* Get the location of the plugin executable (iTunes 4.1 or later) */ - - kPluginDisplayChangedMessage = 'disp' /* Something about some display has changed */ -}; - -struct PlayerMessageInfo; - -typedef OSStatus (*ITAppProcPtr)(void *appCookie, OSType message, struct PlayerMessageInfo *messageInfo); - - -/* - Plugin main Messages -*/ - -struct PluginInitMessage { - UInt32 majorVersion; /* Input */ - UInt32 minorVersion; /* Input */ - - void * appCookie; /* Input */ - ITAppProcPtr appProc; /* Input */ - - OptionBits options; /* Output, see above for values */ - void * refCon; /* Output */ -}; -typedef struct PluginInitMessage PluginInitMessage; - - -struct PluginMessageInfo { - union { - PluginInitMessage initMessage; - } u; -}; -typedef struct PluginMessageInfo PluginMessageInfo; - -/* Plugin main entry point message handler */ -typedef OSStatus (*PluginProcPtr)(OSType message, PluginMessageInfo *messageInfo, void *refCon); - -/* Visual plugin message handler */ -struct VisualPluginMessageInfo; -typedef OSStatus (*VisualPluginProcPtr)(OSType message, struct VisualPluginMessageInfo *messageInfo, void *refCon); - - -/* - Callbacks to iTunes -*/ -struct PlayerOpenURLMessage { - SInt8 * url; - UInt32 length; -}; -typedef struct PlayerOpenURLMessage PlayerOpenURLMessage; - -struct PlayerSetPluginDataMessage { - void * dataPtr; /* Input */ - UInt32 dataSize; /* Input */ -}; -typedef struct PlayerSetPluginDataMessage PlayerSetPluginDataMessage; - -struct PlayerGetPluginDataMessage { - void * dataPtr; /* Input */ - UInt32 dataBufferSize; /* Input */ - - UInt32 dataSize; /* Output */ -}; -typedef struct PlayerGetPluginDataMessage PlayerGetPluginDataMessage; - -struct PlayerSetPluginNamedDataMessage { - ConstStringPtr dataName; /* Input */ - - void * dataPtr; /* Input */ - UInt32 dataSize; /* Input */ -}; -typedef struct PlayerSetPluginNamedDataMessage PlayerSetPluginNamedDataMessage; - -struct PlayerGetPluginNamedDataMessage { - ConstStringPtr dataName; /* Input */ - - void * dataPtr; /* Input */ - UInt32 dataBufferSize; /* Input */ - - UInt32 dataSize; /* Output */ -}; -typedef struct PlayerGetPluginNamedDataMessage PlayerGetPluginNamedDataMessage; - -struct PlayerHandleMacOSEventMessage { - const EventRecord * theEvent; /* Input */ - - Boolean handled; /* Output */ -}; -typedef struct PlayerHandleMacOSEventMessage PlayerHandleMacOSEventMessage; - -#if TARGET_OS_MAC -struct PlayerGetPluginFileSpecMessage { - FSSpec * fileSpec; /* Output */ -}; -typedef struct PlayerGetPluginFileSpecMessage PlayerGetPluginFileSpecMessage; -#endif - -struct PlayerGetPluginITFileSpecMessage { - ITFileSpec * fileSpec; /* Output */ -}; -typedef struct PlayerGetPluginITFileSpecMessage PlayerGetPluginITFileSpecMessage; - -struct PlayerGetFileTrackInfoMessage { - const ITFileSpec * fileSpec; /* Input */ - ITTrackInfo * trackInfo; /* Output */ -}; -typedef struct PlayerGetFileTrackInfoMessage PlayerGetFileTrackInfoMessage; - -struct PlayerSetFileTrackInfoMessage { - const ITFileSpec * fileSpec; /* Input */ - const ITTrackInfo * trackInfo; /* Input */ -}; -typedef struct PlayerSetFileTrackInfoMessage PlayerSetFileTrackInfoMessage; - -struct PlayerGetITTrackInfoSizeMessage { - UInt32 itTrackInfoSize; /* Output */ -}; -typedef struct PlayerGetITTrackInfoSizeMessage PlayerGetITTrackInfoSizeMessage; - -/* - iTunes API callback visual structures -*/ -enum { - /* PlayerRegisterVisualPluginMessage.options */ - - kVisualWantsIdleMessages = (1L << 3), - kVisualWantsConfigure = (1L << 5), - kVisualProvidesUnicodeName = (1L << 6) /* Added in iTunes 7.3 */ -}; - -struct PlayerRegisterVisualPluginMessage { - /* Input from plugin */ - - Str63 name; /* Displayed in the Visual menu -- may be empty if options include kVisualProvidesUnicodeName */ - OptionBits options; /* See above */ - - OSType creator; /* Identifies the plugin */ - - NumVersion pluginVersion; /* Version number of the plugin */ - - VisualPluginProcPtr handler; /* Handler for the plugin's messages */ - void * registerRefCon; /* RefCon for the plugin's handler */ - - UInt32 timeBetweenDataInMS; /* How often to call the plugin (0xFFFFFFFF = as often as possible) */ - UInt32 numWaveformChannels; /* 0-2 waveforms requested */ - UInt32 numSpectrumChannels; /* 0-2 spectrums requested */ - - SInt16 minWidth; /* Minimum resizeable width */ - SInt16 minHeight; /* Minimum resizeable height */ - - SInt16 maxWidth; /* Maximum resizeable width */ - SInt16 maxHeight; /* Maximum resizeable height */ - - UInt16 minFullScreenBitDepth; /* 0 = Any */ - UInt16 maxFullScreenBitDepth; /* 0 = Any */ - - UInt16 windowAlignmentInBytes; /* Reserved (should be zero) */ - - ITUniStr255 unicodeName; /* options must include kVisualProvidesUnicodeName for this to be used -- Added in iTunes 7.3*/ -}; -typedef struct PlayerRegisterVisualPluginMessage PlayerRegisterVisualPluginMessage; - -struct PlayerSetFullScreenMessage { - Boolean fullScreen; -}; -typedef struct PlayerSetFullScreenMessage PlayerSetFullScreenMessage; - -struct PlayerSetFullScreenOptionsMessage { - SInt16 minBitDepth; /* 0 = Any */ - SInt16 maxBitDepth; /* 0 = Any */ - SInt16 preferredBitDepth; /* 0 = Current */ - - SInt16 desiredWidth; /* Must be within minWidth & maxWidth */ - SInt16 desiredHeight; /* Must be within minHeight & maxHeight */ -}; -typedef struct PlayerSetFullScreenOptionsMessage PlayerSetFullScreenOptionsMessage; - -struct PlayerGetCurrentTrackCoverArtMessage { - Handle coverArt; /* output - client must dispose */ - OSType coverArtFormat; /* output - format of cover art */ -}; -typedef struct PlayerGetCurrentTrackCoverArtMessage PlayerGetCurrentTrackCoverArtMessage; - - -// iTunes API callback union structure -struct PlayerMessageInfo { - UInt32 messageMajorVersion; /* Should be kITPluginMajorMessageVersion */ - UInt32 messageMinorVersion; /* Should be kITPluginMinorMessageVersion */ - UInt32 messageInfoSize; /* Should be sizeof(PlayerMessageInfo) */ - - union { - PlayerOpenURLMessage openURLMessage; - - PlayerSetPluginDataMessage setPluginDataMessage; - PlayerGetPluginDataMessage getPluginDataMessage; - - PlayerSetPluginNamedDataMessage setPluginNamedDataMessage; - PlayerGetPluginNamedDataMessage getPluginNamedDataMessage; - - - PlayerGetFileTrackInfoMessage getFileTrackInfoMessage; - PlayerSetFileTrackInfoMessage setFileTrackInfoMessage; - PlayerGetITTrackInfoSizeMessage getITTrackInfoSizeMessage; - - PlayerHandleMacOSEventMessage handleMacOSEventMessage; - -#if TARGET_OS_MAC - PlayerGetPluginFileSpecMessage getPluginFileSpecMessage; -#endif - - PlayerGetPluginITFileSpecMessage getPluginITFileSpecMessage; - - // visual APIs - PlayerRegisterVisualPluginMessage registerVisualPluginMessage; - PlayerSetFullScreenMessage setFullScreenMessage; - PlayerSetFullScreenOptionsMessage setFullScreenOptionsMessage; - PlayerGetCurrentTrackCoverArtMessage getCurrentTrackCoverArtMessage; - } u; -}; -typedef struct PlayerMessageInfo PlayerMessageInfo; - -extern OSStatus ITCallApplication (void *appCookie, ITAppProcPtr appProc, OSType message, PlayerMessageInfo *messageInfo); -extern void SetNumVersion (NumVersion *numVersion, UInt8 majorRev, UInt8 minorAndBugRev, UInt8 stage, UInt8 nonRelRev); - - -/* For all plugins */ - -extern OSStatus PlayerUnregisterPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo); -extern OSStatus PlayerIdle (void *appCookie, ITAppProcPtr appProc); - -extern void PlayerShowAbout (void *appCookie, ITAppProcPtr appProc); -extern void PlayerOpenURL (void *appCookie, ITAppProcPtr appProc, SInt8 *string, UInt32 length); - -extern OSStatus PlayerGetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize); -extern OSStatus PlayerSetPluginData (void *appCookie, ITAppProcPtr appProc, void *dataPtr, UInt32 dataSize); - -extern OSStatus PlayerGetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataBufferSize, UInt32 *dataSize); -extern OSStatus PlayerSetPluginNamedData (void *appCookie, ITAppProcPtr appProc, ConstStringPtr dataName, void *dataPtr, UInt32 dataSize); - -extern OSStatus PlayerGetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, ITTrackInfo *trackInfo); -extern OSStatus PlayerSetFileTrackInfo (void *appCookie, ITAppProcPtr appProc, const ITFileSpec *fileSpec, const ITTrackInfo *trackInfo); - -extern OSStatus PlayerGetITTrackInfoSize (void *appCookie, ITAppProcPtr appProc, UInt32 appPluginMajorVersion, UInt32 appPluginMinorVersion, UInt32 *itTrackInfoSize); - -extern OSStatus PlayerHandleMacOSEvent (void *appCookie, ITAppProcPtr appProc, const EventRecord *theEvent, Boolean *eventHandled); - - -#if TARGET_OS_MAC -extern OSStatus PlayerGetPluginFileSpec (void *appCookie, ITAppProcPtr appProc, FSSpec *pluginFileSpec); -#endif -extern OSStatus PlayerGetPluginITFileSpec (void *appCookie, ITAppProcPtr appProc, ITFileSpec *pluginFileSpec); - -/* iTunes APIs For visual plugins */ -enum { - kPlayerSetFullScreenMessage = 'sful', /* Set full screen mode */ - kPlayerSetFullScreenOptionsMessage = 'sfop', /* Set full screen options */ - kPlayerGetCurrentTrackCoverArtMessage = 'covr' /* Get current player track cover artwork */ -}; - -extern OSStatus PlayerRegisterVisualPlugin (void *appCookie, ITAppProcPtr appProc, PlayerMessageInfo *messageInfo); - -extern OSStatus PlayerSetFullScreen (void *appCookie, ITAppProcPtr appProc, Boolean fullScreen); -extern OSStatus PlayerSetFullScreenOptions (void *appCookie, ITAppProcPtr appProc, SInt16 minBitDepth, SInt16 maxBitDepth, SInt16 preferredBitDepth, SInt16 desiredWidth, SInt16 desiredHeight); -extern OSStatus PlayerGetCurrentTrackCoverArt (void *appCookie, ITAppProcPtr appProc, Handle *coverArt, OSType *coverArtFormat); - - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=reset -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(pop) -#elif PRAGMA_STRUCT_PACK - #pragma pack() -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ITUNESAPI_H_ */ diff --git a/xbmc/visualizations/iTunes/iTunesVisualAPI.h b/xbmc/visualizations/iTunes/iTunesVisualAPI.h deleted file mode 100755 index d7cd7fea31..0000000000 --- a/xbmc/visualizations/iTunes/iTunesVisualAPI.h +++ /dev/null @@ -1,314 +0,0 @@ -// -// File: iTunesVisualAPI.h -// -// Abstract: part of iTunes Visual SDK -// -// Version: 1.2 -// -// Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. ( "Apple" ) -// in consideration of your agreement to the following terms, and your use, -// installation, modification or redistribution of this Apple software -// constitutes acceptance of these terms. If you do not agree with these -// terms, please do not use, install, modify or redistribute this Apple -// software. -// -// In consideration of your agreement to abide by the following terms, and -// subject to these terms, Apple grants you a personal, non - exclusive -// license, under Apple's copyrights in this original Apple software ( the -// "Apple Software" ), to use, reproduce, modify and redistribute the Apple -// Software, with or without modifications, in source and / or binary forms; -// provided that if you redistribute the Apple Software in its entirety and -// without modifications, you must retain this notice and the following text -// and disclaimers in all such redistributions of the Apple Software. Neither -// the name, trademarks, service marks or logos of Apple Inc. may be used to -// endorse or promote products derived from the Apple Software without specific -// prior written permission from Apple. Except as expressly stated in this -// notice, no other rights or licenses, express or implied, are granted by -// Apple herein, including but not limited to any patent rights that may be -// infringed by your derivative works or by other works in which the Apple -// Software may be incorporated. -// -// The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -// WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -// WARRANTIES OF NON - INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A -// PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION -// ALONE OR IN COMBINATION WITH YOUR PRODUCTS. -// -// IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -// CONSEQUENTIAL DAMAGES ( INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION ) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION -// AND / OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER -// UNDER THEORY OF CONTRACT, TORT ( INCLUDING NEGLIGENCE ), STRICT LIABILITY OR -// OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Copyright ( C ) 2000-2007 Apple Inc. All Rights Reserved. -// -#ifndef ITUNESVISUALAPI_H_ -#define ITUNESVISUALAPI_H_ - -#include "iTunesAPI.h" - -#if PRAGMA_ONCE -#pragma once -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=power -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(push, 4) -#elif PRAGMA_STRUCT_PACK - #pragma pack(4) -#endif - -struct ITTrackInfoV1 { - ITTIFieldMask validFields; - UInt32 reserved; /* Must be zero */ - - Str255 name; - Str255 fileName; - Str255 artist; - Str255 album; - - Str255 genre; - Str255 kind; - - UInt32 trackNumber; - UInt32 numTracks; - - UInt16 year; - SInt16 soundVolumeAdjustment; /* Valid range is -255 to +255 */ - - Str255 eqPresetName; - Str255 comments; - - UInt32 totalTimeInMS; - UInt32 startTimeInMS; - UInt32 stopTimeInMS; - - UInt32 sizeInBytes; - - UInt32 bitRate; - UInt32 sampleRateFixed; - - OSType fileType; - - UInt32 date; - UInt32 unusedReserved2; /* Must be zero */ - - ITTrackAttributes attributes; - ITTrackAttributes validAttributes; /* Mask indicating which attributes are applicable */ - - OSType fileCreator; -}; -typedef struct ITTrackInfoV1 ITTrackInfoV1; - -enum { - kCurrentITStreamInfoVersion = 1 -}; - -struct ITStreamInfoV1 { - SInt32 version; - Str255 streamTitle; - Str255 streamURL; - Str255 streamMessage; -}; -typedef struct ITStreamInfoV1 ITStreamInfoV1; - - -enum { - kITVisualPluginMajorMessageVersion = 10, - kITVisualPluginMinorMessageVersion = 7 -}; - -enum { - /* VisualPlugin messages */ - - kVisualPluginIdleMessage = 'null', - - kVisualPluginInitMessage = 'init', - kVisualPluginCleanupMessage = 'clr ', - - kVisualPluginConfigureMessage = 'cnfg', /* Configure the plugin (may not be enabled) */ - - kVisualPluginEnableMessage = 'von ', /* Turn on the module (automatic)*/ - kVisualPluginDisableMessage = 'voff', /* Turn off the module */ - - kVisualPluginShowWindowMessage = 'show', /* Show the plugin window (allocate large memory here!) */ - kVisualPluginHideWindowMessage = 'hide', /* Hide the plugin window (deallocate large memory here!) */ - - kVisualPluginSetWindowMessage = 'swin', /* Change the window parameters */ - - kVisualPluginRenderMessage = 'vrnd', /* Render to window */ - - kVisualPluginUpdateMessage = 'vupd', /* Update the window */ - - kVisualPluginPlayMessage = 'vply', /* Playing a track */ - kVisualPluginChangeTrackMessage = 'ctrk', /* Change track (for CD continuous play) or info about currently playing track has changed */ - kVisualPluginStopMessage = 'vstp', /* Stopping a track */ - kVisualPluginSetPositionMessage = 'setp', /* Setting the position of a track */ - - kVisualPluginPauseMessage = 'vpau', /* Pausing a track (unused - Pause is stop) */ - kVisualPluginUnpauseMessage = 'vunp', /* Unpausing a track (unused - Pause is stop) */ - - kVisualPluginEventMessage = 'vevt', /* Mac-event. */ - - kVisualPluginDisplayChangedMessage = 'dchn' /* Something about display state changed */ -}; - -/* - VisualPlugin messages -*/ - -enum { - kVisualMaxDataChannels = 2, - - kVisualNumWaveformEntries = 512, - kVisualNumSpectrumEntries = 512 -}; - -enum { - /* Set/ShowWindow options */ - - kWindowIsFullScreen = (1L << 0), - kWindowIsStretched = (1L << 1) -}; - -enum { - /* Initialize options */ - - kVisualDoesNotNeedResolutionSwitch = (1L << 0), /* Added in 7.0 */ - kVisualDoesNotNeedErase = (1L << 1) /* Added in 7.0 */ -}; - -struct RenderVisualData { - UInt8 numWaveformChannels; - UInt8 waveformData[kVisualMaxDataChannels][kVisualNumWaveformEntries]; - - UInt8 numSpectrumChannels; - UInt8 spectrumData[kVisualMaxDataChannels][kVisualNumSpectrumEntries]; -}; -typedef struct RenderVisualData RenderVisualData; - -struct VisualPluginInitMessage { - UInt32 messageMajorVersion; /* Input */ - UInt32 messageMinorVersion; /* Input */ - NumVersion appVersion; /* Input */ - - void * appCookie; /* Input */ - ITAppProcPtr appProc; /* Input */ - - OptionBits options; /* Output */ - void * refCon; /* Output */ -}; -typedef struct VisualPluginInitMessage VisualPluginInitMessage; - -struct VisualPluginShowWindowMessage { - GRAPHICS_DEVICE GRAPHICS_DEVICE_NAME; /* Input */ - Rect drawRect; /* Input */ - OptionBits options; /* Input */ - Rect totalVisualizerRect; /* Input -- Added in 7.0 */ -}; -typedef struct VisualPluginShowWindowMessage VisualPluginShowWindowMessage; - -struct VisualPluginSetWindowMessage { - GRAPHICS_DEVICE GRAPHICS_DEVICE_NAME; /* Input */ - Rect drawRect; /* Input */ - OptionBits options; /* Input */ - Rect totalVisualizerRect; /* Input -- Added in 7.0 */ -}; -typedef struct VisualPluginSetWindowMessage VisualPluginSetWindowMessage; - -struct VisualPluginPlayMessage { - ITTrackInfoV1 * trackInfo; /* Input */ - ITStreamInfoV1 * streamInfo; /* Input */ - SInt32 volume; /* Input */ - - UInt32 bitRate; /* Input */ - - SoundComponentData oldSoundFormat; /* Input -- deprecated in 7.1 */ - ITTrackInfo * trackInfoUnicode; /* Input */ - ITStreamInfo * streamInfoUnicode; /* Input */ - AudioStreamBasicDescription audioFormat; /* Input -- added in 7.1 */ -}; -typedef struct VisualPluginPlayMessage VisualPluginPlayMessage; - -struct VisualPluginChangeTrackMessage { - ITTrackInfoV1 * trackInfo; /* Input */ - ITStreamInfoV1 * streamInfo; /* Input */ - ITTrackInfo * trackInfoUnicode; /* Input */ - ITStreamInfo * streamInfoUnicode; /* Input */ -}; -typedef struct VisualPluginChangeTrackMessage VisualPluginChangeTrackMessage; - -struct VisualPluginRenderMessage { - RenderVisualData * renderData; /* Input */ - UInt32 timeStampID; /* Input */ - UInt32 currentPositionInMS; /* Input -- added in 4.7 */ -}; -typedef struct VisualPluginRenderMessage VisualPluginRenderMessage; - -struct VisualPluginSetPositionMessage { - UInt32 positionTimeInMS; /* Input */ -}; -typedef struct VisualPluginSetPositionMessage VisualPluginSetPositionMessage; - -#if TARGET_OS_MAC -struct VisualPluginEventMessage { - EventRecord * event; /* Input */ -}; -#endif -typedef struct VisualPluginEventMessage VisualPluginEventMessage; - -enum { - kVisualDisplayDepthChanged = 1 << 0, /* the display's depth has changed */ - kVisualDisplayRectChanged = 1 << 1, /* the display's location changed */ - kVisualWindowMovedMoved = 1 << 2, /* the window has moved location */ - kVisualDisplayConfigChanged = 1 << 3, /* something else about the display changed */ -}; - -struct VisualPluginDisplayChangedMessage { - UInt32 flags; /* Input */ -}; -typedef struct VisualPluginDisplayChangedMessage VisualPluginDisplayChangedMessage; - -struct VisualPluginIdleMessage { - UInt32 timeBetweenDataInMS; /* Output -- added in 4.8 */ -}; -typedef struct VisualPluginIdleMessage VisualPluginIdleMessage; - -struct VisualPluginMessageInfo { - union { - VisualPluginInitMessage initMessage; - VisualPluginShowWindowMessage showWindowMessage; - VisualPluginSetWindowMessage setWindowMessage; - VisualPluginPlayMessage playMessage; - VisualPluginChangeTrackMessage changeTrackMessage; - VisualPluginRenderMessage renderMessage; - VisualPluginSetPositionMessage setPositionMessage; -#if TARGET_OS_MAC - VisualPluginEventMessage eventMessage; -#endif - VisualPluginDisplayChangedMessage displayChangedMessage; - VisualPluginIdleMessage idleMessage; - } u; -}; -typedef struct VisualPluginMessageInfo VisualPluginMessageInfo; - -#if PRAGMA_STRUCT_ALIGN - #pragma options align=reset -#elif PRAGMA_STRUCT_PACKPUSH - #pragma pack(pop) -#elif PRAGMA_STRUCT_PACK - #pragma pack() -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ITUNESVISUALAPI_H_ */ diff --git a/xbmc/visualizations/iTunes/itunes_vis.c b/xbmc/visualizations/iTunes/itunes_vis.c deleted file mode 100644 index 44293575b4..0000000000 --- a/xbmc/visualizations/iTunes/itunes_vis.c +++ /dev/null @@ -1,600 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <dlfcn.h> /* for dlopen, dlclose */ -#include <string.h> -#include <QuickTime/QuickTime.h> -#include <Accelerate/Accelerate.h> /* for doing FFT */ -#include <sys/time.h> -#include <AGL/agl.h> - -#include "common.h" -#include "itunes_vis.h" -#include "qview.h" - -/***********************************************************************/ -/* ivis_open */ -/* open a file as an iTunes visualizer and return a handle */ -/***********************************************************************/ -int ivis_get_visualisations( char ***names, char ***paths ) -{ - /* call the platform specific implementation */ - return _get_visualisations( names, paths ); -} - -/***********************************************************************/ -/* ivis_open */ -/* open a file as an iTunes visualizer and return a handle */ -/***********************************************************************/ -ITunesVis* ivis_open( const char *name ) -{ - ITunesVis* vis = (ITunesVis*) malloc( sizeof(ITunesVis) ); - - if ( vis != NULL ) - { - /* initialize to 0 */ - memset( vis, 0, sizeof(ITunesVis) ); - vis->track_info.recordLength = sizeof(ITTrackInfo); - - /* get path to visualiser from name */ - char *plugin_path = _get_visualisation_path( name ); - - if ( plugin_path ) - { - /* check if it's a composition or regular visualiser */ - if ( strstr( plugin_path, ".qtz" ) != NULL ) - { - vis->vis_type = ITunesVisTypeComposition; - strncpy( (char*)vis->filename, (const char*)plugin_path, sizeof(vis->filename) ); - } - else - { - vis->vis_type = ITunesVisTypeNormal; - char *exe_path = _get_executable_path( plugin_path ); - - if ( exe_path ) - { - vis->handle = dlopen( exe_path, RTLD_NOW ); - - if ( vis->handle == NULL ) - { - free( vis ); - vis = NULL; - } - else - { - strncpy( (char*)vis->bundle_path, (const char*)plugin_path, sizeof(vis->bundle_path) ); - strncpy( (char*)vis->filename, (const char*)exe_path, sizeof(vis->filename) ); - } - free( exe_path ); - } - } - free( plugin_path ); - } - else - { - free( vis ); - vis = NULL; - } - } - return vis; -} - -/***********************************************************************/ -/* ivis_init */ -/* initialize the iTunes visulizer with the specified widht & height */ -/***********************************************************************/ -bool ivis_init( ITunesVis* plugin, int width, int height ) -{ - if ( plugin == NULL ) - return false; - - /* load imports */ - plugin->imports.main = (iTunesPluginMainMachOPtr) dlsym( plugin->handle, "iTunesPluginMainMachO" ); - if ( ! plugin->imports.main ) - return false; - - /* configure kPluginInitMessage message */ - memset( &plugin->message.u.initMessage, 0, sizeof(plugin->message.u.initMessage) ); - plugin->message.u.initMessage.majorVersion = 7; - plugin->message.u.initMessage.minorVersion = 4; - plugin->message.u.initMessage.appCookie = (void*)plugin; - plugin->message.u.initMessage.appProc = XBMCITAppProc; - - /* send the visualizer the kPluginInitMessage */ - plugin->imports.main( kPluginInitMessage, &( plugin->message ), NULL ); - - /* keep track of ref */ - plugin->main_ref = plugin->message.u.initMessage.refCon; - - /* ensure we got a visual handler */ - if ( ! plugin->imports.visual_handler ) - return false; - - /* configure kVisualPluginInitMessage message */ - memset( &plugin->visual_message.u.initMessage, 0, sizeof(plugin->visual_message.u.initMessage) ); - plugin->visual_message.u.initMessage.messageMajorVersion = kITPluginMajorMessageVersion; - plugin->visual_message.u.initMessage.messageMinorVersion = kITPluginMinorMessageVersion; - plugin->visual_message.u.initMessage.appCookie = (void*)plugin; - plugin->visual_message.u.initMessage.appProc = XBMCITAppProc; - plugin->visual_message.u.initMessage.appVersion.majorRev = 7; - plugin->visual_message.u.initMessage.appVersion.minorAndBugRev = 4; - plugin->visual_message.u.initMessage.appVersion.stage = finalStage; - plugin->visual_message.u.initMessage.appVersion.nonRelRev = 0; - - /* send the plugin the kVisualPluginInitMessage message */ - plugin->imports.visual_handler( kVisualPluginInitMessage, - &( plugin->visual_message ), - plugin->vis_ref ); - - /* update our ref pointer */ - if ( plugin->visual_message.u.initMessage.refCon ) - plugin->vis_ref = plugin->visual_message.u.initMessage.refCon; - - /* set the render rect */ - SetRect( &(plugin->rect), 0, 0, width, height ); - - /* create FFT object (use what iTunes uses for doing FFT) */ - plugin->fft_setup = create_fftsetup( 9, FFT_RADIX2 ); - - return true; -} - -/***********************************************************************/ -/* ivis_start */ -/* TODO */ -/***********************************************************************/ -void ivis_start( ITunesVis* plugin ) -{ - /* make sure we have a plugin and a visual handler */ - if ( !plugin || !plugin->imports.visual_handler ) - return; - - /* if we don't have an offscreen buffer, create one */ - if ( ! plugin->screen ) - plugin->screen = get_view( plugin->rect.right, plugin->rect.bottom ); - - /* customize the show window message */ - memset( &plugin->visual_message.u.showWindowMessage, 0, - sizeof(plugin->visual_message.u.showWindowMessage) ); - plugin->visual_message.u.showWindowMessage.GRAPHICS_DEVICE_NAME = plugin->screen; - plugin->visual_message.u.showWindowMessage.drawRect = plugin->rect; - plugin->visual_message.u.showWindowMessage.options = 0; - plugin->visual_message.u.showWindowMessage.totalVisualizerRect = plugin->rect; - - /* set our start time */ - plugin->start_time = ivis_current_time(); - - /* send the show window message */ - CGLContextObj currentContext = CGLGetCurrentContext(); - plugin->imports.visual_handler( kVisualPluginEnableMessage, &( plugin->visual_message ), - plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginShowWindowMessage, &( plugin->visual_message ), - plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginUpdateMessage, &( plugin->visual_message ), - plugin->vis_ref ); - plugin->gl_context = (void*)aglGetCurrentContext(); - CGLSetCurrentContext( currentContext ); -} - -unsigned long ivis_current_time() -{ - struct timeval current_time; - gettimeofday( ¤t_time, NULL ); - return ( current_time.tv_sec * 1000 + current_time.tv_usec / 1000 ); -} - -/***********************************************************************/ -/* ivis_render */ -/* process audio data and update frame */ -/***********************************************************************/ -ITunesPixelFormat ivis_render( ITunesVis* plugin, short audio_data[][512], float freq_data[][512], - void* buffer, long buffer_size, bool idle ) -{ - ITunesPixelFormat format = ITunesPixelFormatUnknown; - - /* make sure we have a plugin and a visual handler */ - if ( !plugin || !plugin->imports.visual_handler ) - return format; - - int i=0, w=0; - RenderVisualData visual_data; - DSPSplitComplex splitComplex[2]; - float *data[2]; - - /* perform FFT if we're not idling */ - if ( ! idle ) - { - /* allocate some complex vars */ - for ( i = 0 ; i < 2 ; i++ ) - { - splitComplex[i].realp = calloc( 512, sizeof(float) ); - splitComplex[i].imagp = calloc( 512, sizeof(float) ); - data[i] = calloc( 512, sizeof(float) ); - } - - /* 2 channels for spectrum and waveform data */ - visual_data.numWaveformChannels = 2; - visual_data.numSpectrumChannels = 2; - - /* copy spectrum audio data to visual data strucure */ - for ( w = 0 ; w < 512 ; w++ ) - { - /* iTunes visualizers expect waveform data from 0 - 255, with level 0 at 128 */ - visual_data.waveformData[0][w] = (UInt8)( (long)(audio_data[0][w]) / 128 + 128 ); - visual_data.waveformData[1][w] = (UInt8)( (long)(audio_data[1][w]) / 128 + 128 ); - - /* scale to -1, +1 */ - *( data[0] + w ) = (float)(( audio_data[0][w]) / (2.0 * 8192.0) ); - *( data[1] + w ) = (float)(( audio_data[1][w]) / (2.0 * 8192.0) ); - } - - /* FFT scaler */ - float scale = ( 1.0 / 1024.0 ) ; /* scale by length of input * 2 (due to how vDSP does FFTs) */ - float nyq=0, dc=0, freq=0; - - for ( i = 0 ; i < 2 ; i++ ) - { - /* pack data into format fft_zrip expects it */ - vDSP_ctoz( (COMPLEX*)( data[i] ), 2, &( splitComplex[i] ), 1, 256 ); - - /* perform FFT on normalized audio data */ - fft_zrip( plugin->fft_setup, &( splitComplex[i] ), 1, 9, FFT_FORWARD ); - - /* scale the values */ - vDSP_vsmul( splitComplex[i].realp, 1, &scale, splitComplex[i].realp, 1, 256 ); - vDSP_vsmul( splitComplex[i].imagp, 1, &scale, splitComplex[i].imagp, 1, 256 ); - - /* unpack data */ - vDSP_ztoc( &splitComplex[i], 1, (COMPLEX*)( data[i] ), 2, 256 ); - - /* ignore phase */ - dc = *(data[i]) = fabs( *(data[i]) ); - nyq = fabs( *(data[i] + 1) ); - - for ( w = 1 ; w < 256 ; w++ ) - { - /* don't use vDSP for this since there's some overflow */ - freq = hypot( *(data[i] + w * 2), *(data[i] + w * 2 + 1) ) * 256 * 16; - freq = MAX( 0, freq ); - freq = MIN( 255, freq ); - visual_data.spectrumData[i][ w - 1 ] = (UInt8)( freq ); - } - visual_data.spectrumData[i][256] = nyq; - } - - /* deallocate complex vars */ - for ( i = 0 ; i < 2 ; i++ ) - { - free( splitComplex[i].realp ); - free( splitComplex[i].imagp ); - free( data[i] ); - } - - /* update the render message with the new visual data and timestamp */ - plugin->visual_message.u.renderMessage.renderData = &visual_data; - plugin->visual_message.u.renderMessage.timeStampID++; - } - - /* update time */ - plugin->visual_message.u.renderMessage.currentPositionInMS = - ivis_current_time() - plugin->start_time; // FIXME: real time - - /* save our GL context and send the vis a render message */ - CGLContextObj currentContext = CGLGetCurrentContext(); - if ( plugin->gl_context ) - aglSetCurrentContext( (AGLContext)(plugin->gl_context ) ); - - /* call the plugin's render method */ - if ( idle ) - { - /* idle message */ - if ( plugin->wants_idle ) - plugin->imports.visual_handler( kVisualPluginIdleMessage, - &( plugin->visual_message ), - plugin->vis_ref ); - } - else - { - /* render message */ - plugin->imports.visual_handler( kVisualPluginRenderMessage, - &( plugin->visual_message ), - plugin->vis_ref ); - - /* set position message */ - plugin->visual_message.u.setPositionMessage.positionTimeInMS - = plugin->visual_message.u.renderMessage.currentPositionInMS; - plugin->imports.visual_handler( kVisualPluginSetPositionMessage, &( plugin->visual_message ), - plugin->vis_ref ); - } - /* update message */ - plugin->imports.visual_handler( kVisualPluginUpdateMessage, NULL, - plugin->vis_ref ); - - /* read pixels and restore our GL context */ - CGLLockContext( CGLGetCurrentContext() ); - - switch ( get_pixels( buffer, buffer_size, CGLGetCurrentContext() != currentContext ) ) - { - case 3: - format = ITunesPixelFormatRGB24; - break; - - case 4: - format = ITunesPixelFormatRGBA32; - break; - - default: - break; - } - - CGLUnlockContext ( CGLGetCurrentContext() ); - - /* restore our GL context */ - CGLSetCurrentContext( currentContext ); - return format; -} - -/***********************************************************************/ -/* ivis_set_track_info */ -/* sets track metadata for the currently playing track */ -/***********************************************************************/ -void ivis_set_track_info( ITunesVis* plugin, ITunesTrack* track_info ) -{ - if ( !plugin || !track_info ) - return; - - ITTrackInfo *info = &( plugin->track_info ); - ITTrackInfoV1 *info_v1 = &( plugin->track_info_v1 ); - ITStreamInfo *stream = &( plugin->stream_info ); - ITStreamInfoV1 *stream_v1 = &( plugin->stream_info_v1 ); - - /* reset valid fields */ - info->validFields = 0; - info_v1->validFields = 0; - memset( info, 0, sizeof(ITTrackInfo) ); - memset( info_v1, 0, sizeof(ITTrackInfoV1) ); - - if ( is_valid_field( track_info->title ) ) - { - _copy_to_pascal_string( info_v1->name, track_info->title, sizeof(info_v1->name) ); - _copy_to_unicode_string( info->name, track_info->title, sizeof(info->name) ); - info_v1->validFields = info->validFields |= kITTINameFieldMask; - } - - if ( is_valid_field( track_info->artist ) ) - { - _copy_to_pascal_string( info_v1->artist, track_info->artist, sizeof(info_v1->artist) ); - _copy_to_unicode_string( info->artist, track_info->artist, sizeof(info->artist) ); - info_v1->validFields = info->validFields |= kITTIArtistFieldMask; - } - - if ( is_valid_field( track_info->album ) ) - { - _copy_to_pascal_string( info_v1->album, track_info->album, sizeof(info_v1->album) ); - _copy_to_unicode_string( info->album, track_info->album, sizeof(info->album) ); - info_v1->validFields = info->validFields |= kITTIAlbumFieldMask; - } - - if ( is_valid_field( track_info->genre ) ) - { - _copy_to_pascal_string( info_v1->genre, track_info->genre, sizeof(info_v1->genre) ); - _copy_to_unicode_string( info->genre, track_info->genre, sizeof(info->genre) ); - info_v1->validFields = info->validFields |= kITTIGenreFieldMask; - } - - /* iTunes sends a 'stop and play' instead of a 'change track' */ - if ( 1 /*! plugin->playing*/ ) - { - /* send a play message */ - plugin->playing = true; - - memset( &(plugin->visual_message.u.playMessage), 0, - sizeof(plugin->visual_message.u.playMessage) ); - - plugin->visual_message.u.playMessage.trackInfo = info_v1; - plugin->visual_message.u.playMessage.trackInfoUnicode = info; - plugin->visual_message.u.playMessage.streamInfo = stream_v1; - plugin->visual_message.u.playMessage.streamInfoUnicode = stream; - plugin->visual_message.u.playMessage.volume = 100; - plugin->imports.visual_handler( kVisualPluginStopMessage, - &( plugin->visual_message ), plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginPlayMessage, - &( plugin->visual_message ), plugin->vis_ref ); - } - else - { - /* send a change track message */ - memset( &(plugin->visual_message.u.changeTrackMessage), 0, - sizeof(plugin->visual_message.u.changeTrackMessage) ); - - plugin->visual_message.u.changeTrackMessage.trackInfo = info_v1; - plugin->visual_message.u.changeTrackMessage.trackInfoUnicode = info; - plugin->visual_message.u.changeTrackMessage.streamInfo = stream_v1; - plugin->visual_message.u.changeTrackMessage.streamInfoUnicode = stream; - plugin->imports.visual_handler( kVisualPluginChangeTrackMessage, - &( plugin->visual_message ), plugin->vis_ref ); - } -} - -/***********************************************************************/ -/* ivis_set_album_art */ -/* sets album art for the currently playing track */ -/***********************************************************************/ -void ivis_set_album_art( ITunesVis* plugin, const char* filename ) -{ - if ( !plugin || !filename) - return; - strncpy( plugin->album_art, filename, sizeof( plugin->album_art ) ); -} - -/***********************************************************************/ -/* ivis_wants_idle */ -/* returns true if the plugin wants idle messages */ -/***********************************************************************/ -bool ivis_wants_idle( ITunesVis* plugin ) -{ - return plugin->wants_idle; -} - -/***********************************************************************/ -/* ivis_close */ -/* close an iTunes visualizer */ -/***********************************************************************/ -void ivis_close( ITunesVis* plugin ) -{ - if ( plugin != NULL ) - { - /* destroy FFT setup */ - destroy_fftsetup( plugin->fft_setup ); - - /* send the plugin, visual hide and cleanup messages */ - if ( plugin->imports.visual_handler ) - { - plugin->imports.visual_handler( kVisualPluginStopMessage, NULL, plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginDisableMessage, NULL, plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginHideWindowMessage, NULL, plugin->vis_ref ); - plugin->imports.visual_handler( kVisualPluginCleanupMessage, NULL, plugin->vis_ref ); - } - - /* send the plugin a cleanup message */ - // FIXME: iTunes plugins don't expect to be unloaded until app terminates - //if ( plugin->imports.main ) - // plugin->imports.main( kPluginCleanupMessage, NULL, plugin->main_ref ); - - /* free our screen if it was allocated */ - if ( plugin->screen ) - release_view( plugin->screen ); - - /* if we have an open handle, then close it */ - if ( plugin->handle ) - { - // FIXME: iTunes plugins don't expect to be unloaded until app terminates - //dlclose( plugin->handle ); - plugin->handle = NULL; - } - - /* deallocate */ - free( plugin ); - } -} - -/***********************************************************************/ -/***********************************************************************/ -static OSStatus XBMCITAppProc(void *appCookie, OSType message, struct PlayerMessageInfo *messageInfo) -{ - /* cast app cookie into ITunesVis object */ - ITunesVis* plugin = (ITunesVis*) appCookie; - FSRef ref; - - if ( plugin == NULL ) - return noErr; - - /* initial registration response */ - switch (message) - { - case kPlayerRegisterVisualPluginMessage: - printf( "REGISTER: visual plugin\n" ); - /* copy the supplied ref from the plugin */ - plugin->vis_ref - = messageInfo->u.registerVisualPluginMessage.registerRefCon; - - /* keep track of the visual handler so we can send it messages */ - plugin->imports.visual_handler - = messageInfo->u.registerVisualPluginMessage.handler; - - /* check if plugin wants idle */ - if ( messageInfo->u.registerVisualPluginMessage.options & kVisualWantsIdleMessages ) - { - printf( "REGISTER: plugin wants idle message\n" ); - plugin->wants_idle = true; - } - break; - - - case kPlayerGetPluginFileSpecMessage: - printf( "GET: plugin file spec\n" ); - /* get the plugin's FSSpec */ - memset( &ref, 0, sizeof(FSRef) ); - FSPathMakeRef( (UInt8 *)(plugin->bundle_path), &ref, NULL ); - FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL, - messageInfo->u.getPluginFileSpecMessage.fileSpec, - NULL ); - break; - - case kPlayerSetPluginDataMessage: /* Set plugin preferences */ - printf( "SET: plugin data\n" ); - break; - - case kPlayerGetPluginDataMessage: /* Get plugin preferences */ - printf( "GET: plugin data message\n" ); - messageInfo->u.getPluginDataMessage.dataSize = 0; - break; - - case kPlayerGetPluginNamedDataMessage: /* Get plugin preferences */ - printf( "GET: plugin named data message\n" ); - messageInfo->u.getPluginNamedDataMessage.dataSize = 0; - break; - - case kPlayerGetCurrentTrackCoverArtMessage: - printf( "GET: current track cover art message\n" ); - messageInfo->u.getCurrentTrackCoverArtMessage.coverArt = 0; - messageInfo->u.getCurrentTrackCoverArtMessage.coverArtFormat = 0; - if ( strlen(plugin->album_art) > 0 ) - { - printf( "GET: %s\n", plugin->album_art ); - _get_album_art_from_file( (const char *)(plugin->album_art), - &( messageInfo->u.getCurrentTrackCoverArtMessage.coverArt ), - &( messageInfo->u.getCurrentTrackCoverArtMessage.coverArtFormat ) ); - } - break; - - case kPlayerGetFileTrackInfoMessage: /* Query iTunes for information about a file */ - printf( "GET: file track info\n" ); - break; - - case kPlayerSetFileTrackInfoMessage: /* Ask iTunes to set information about a file */ - printf( "SET: file track info\n" ); - break; - - case kPlayerGetPluginITFileSpecMessage: /* Get the location of the plugin executable (iTunes 4.1 or later) */ - printf( "GET: plugin it file spec\n" ); - break; - - case kPlayerGetITTrackInfoSizeMessage: /* Query iTunes for the sizeof(ITTrackInfo). */ - /* allows newer plugins to work with older versions of iTunes. */ - printf( "GET: IT track info size\n" ); - break; - - - /* These messages should probably return error free */ - case kPlayerSetFullScreenMessage: - break; - - case kPlayerSetFullScreenOptionsMessage: - break; - - default: - printf( "unknown message received\n" ); - break; - } - - return noErr; -} diff --git a/xbmc/visualizations/iTunes/itunes_vis.h b/xbmc/visualizations/iTunes/itunes_vis.h deleted file mode 100644 index cb37fccc5c..0000000000 --- a/xbmc/visualizations/iTunes/itunes_vis.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#ifndef XBMC_ITUNES_VIS_H -#define XBMC_ITUNES_VIS_H - -#define IPLUGIN void* - -#include <Accelerate/Accelerate.h> -#include <QuickTime/QuickTime.h> - -#include "iTunesAPI.h" -#include "iTunesVisualAPI.h" - -#ifdef __cplusplus -extern "C" { -#endif - - static OSStatus XBMCITAppProc(void *appCookie, OSType message, struct PlayerMessageInfo *messageInfo); - typedef OSStatus (*iTunesPluginMainMachOPtr)(OSType message,PluginMessageInfo *messageInfo,void *refCon); - - /* structure to hold imported function pointers */ - typedef struct _Imports - { - iTunesPluginMainMachOPtr main; - VisualPluginProcPtr visual_handler; - } Imports; - - typedef enum _ITunesVisType { - ITunesVisTypeNormal = 1, - ITunesVisTypeComposition - } ITunesVisType ; - - typedef enum _ITunesPixelFormat { - ITunesPixelFormatRGBA32 = 1, - ITunesPixelFormatRGB24, - ITunesPixelFormatUnknown = 0, - } ITunesPixelFormat; - - /* container around relevant iTunes visualiser data */ - typedef struct _ITunesVis - { - Imports imports; - PluginMessageInfo message; - VisualPluginMessageInfo visual_message; - IPLUGIN handle; - ITTrackInfo track_info; - ITTrackInfoV1 track_info_v1; - ITStreamInfo stream_info; - ITStreamInfoV1 stream_info_v1; - void* vis_ref; - void* main_ref; - void* screen; - Rect rect; - char filename[512]; - char bundle_path[512]; - char album_art[512]; - ITunesVisType vis_type; - unsigned long start_time; - FFTSetup fft_setup; - void* gl_context; - bool playing; - bool wants_idle; - } ITunesVis; - - /* container around track info */ - typedef struct _ITunesTrack - { - const char *title; - const char *artist; - const char *album; - const char *album_artist; - const char *genre; - const char *comment; - const char *lyrics; - - int track_number; - int disc_number; - int duration; - int year; - char rating; - } ITunesTrack; - - /* helper functions for loading and initializing iTunes visualisers */ - int ivis_get_visualisations( char ***names, char ***paths ); - ITunesVis* ivis_open ( const char *name ); - bool ivis_init ( ITunesVis* plugin, int width, int height ); - void ivis_start ( ITunesVis* plugin ); - void ivis_set_track_info ( ITunesVis* plugin, ITunesTrack* track_info ); - void ivis_set_album_art ( ITunesVis* plugin, const char* filename ); - void ivis_close ( ITunesVis* plugin ); - bool ivis_wants_idle ( ITunesVis* plugin ); - ITunesPixelFormat ivis_render( ITunesVis* plugin, short audio_data[][512], - float freq_data[][512], - void* buffer, long buffer_size, bool idle ); - unsigned long ivis_current_time(); - - /* inline helper functions */ - inline bool is_valid_field( const char *field ) - { - if ( field && ( strlen(field) > 0 ) ) - return true; - return false; - } - -#ifdef __cplusplus -} -#endif - -#ifndef MIN -#define MIN( a, b ) (a)<(b)?(a):(b) -#endif - -#ifndef MAX -#define MAX( a, b ) (a)>(b)?(a):(b) -#endif - -#endif // XBMC_ITUNES_VIS_H diff --git a/xbmc/visualizations/iTunes/message_order.txt b/xbmc/visualizations/iTunes/message_order.txt deleted file mode 100644 index a1ec101090..0000000000 --- a/xbmc/visualizations/iTunes/message_order.txt +++ /dev/null @@ -1,13 +0,0 @@ -kPluginInitMessage -kVisualPluginInitMessage -kVisualPluginIdleMessage -kVisualPluginPlayMessage -kVisualPluginShowWindowMessage -kVisualPluginUpdateMessage -kVisualPluginRenderMessage -kVisualPluginStopMessage -kVisualPluginPlayMessage -kVisualPluginEnable/DisableMessage -HideWindow -kVisualPluginCleanupMessage -kPluginCleanupMessage diff --git a/xbmc/visualizations/iTunes/qview.h b/xbmc/visualizations/iTunes/qview.h deleted file mode 100644 index b3f982f835..0000000000 --- a/xbmc/visualizations/iTunes/qview.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#ifndef __QVIEW_H__ -#define __QVIEW_H__ - -void* get_view (int width, int height); -int get_pixels (void* dest, long dest_size, bool opengl); -void release_view(void* view); - -#endif // __QVIEW_H__ diff --git a/xbmc/visualizations/iTunes/qview.m b/xbmc/visualizations/iTunes/qview.m deleted file mode 100644 index 66e25c1b83..0000000000 --- a/xbmc/visualizations/iTunes/qview.m +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2005-2012 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#import <QuickTime/QuickTime.h> -#import <Carbon/Carbon.h> -#import <Cocoa/Cocoa.h> - -NSView* g_view = NULL; -int g_width = 0; -int g_height = 0; - -void* get_view(int width, int height) -{ - NSWindow *window = [ [NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, width, height) - styleMask: NSBorderlessWindowMask - backing: NSBackingStoreBuffered /* NSBackingStoreNonretained */ - defer: NO ]; - [ window display ]; - - if ( g_view ) - { - [ g_view release ]; - g_view = nil; - } - g_view = [ window contentView ]; - g_width = width; - g_height = height; - return GetWindowPort( [ window windowRef ] ); -} - -int get_pixels(void* dest, long dest_size, bool opengl) -{ - int bpp = 0; - if ( !g_view || !dest ) - return bpp; - - [ g_view lockFocus ]; - if ( opengl ) - { - glReadBuffer( GL_FRONT ); - glReadPixels( 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, dest ); - glReadBuffer( GL_BACK ); - bpp = 4; - } - else - { - NSBitmapImageRep* bmp = [ [ NSBitmapImageRep alloc ] initWithFocusedViewRect:[ g_view bounds ] ]; - if (bmp) - { - // FIXME: much better error checking - memcpy( dest, (void*)[ bmp bitmapData ], [ bmp bytesPerPlane ] ); - [ bmp release ]; - bpp = 3; - } - } - [ g_view unlockFocus ]; - return bpp; -} - -void release_view(void* view) -{ - if ( view && g_view ) - { - [ g_view release ]; - g_view = nil; - // FIXME: use 'view' - } -} |