Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1841 from ronie/itunes-visualization

remove broken Itunes visualization
  • Loading branch information...
commit c58514ea575e633acff5cd19b7c8f1be85c68179 2 parents a8e9c49 + 2fa6e74
@ronie ronie authored
View
4 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
View
88 addons/visualization.itunes/addon.xml
@@ -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>
-
View
383 xbmc/visualizations/iTunes/Main.cpp
@@ -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;
-}
-
View
15 xbmc/visualizations/iTunes/Makefile.in
@@ -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
-
View
36 xbmc/visualizations/iTunes/common.h
@@ -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__
View
263 xbmc/visualizations/iTunes/common_osx.m
@@ -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 ];
- }
- }
- }
-}
View
424 xbmc/visualizations/iTunes/iTunesAPI.c
@@ -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;
-}
View
718 xbmc/visualizations/iTunes/iTunesAPI.h
@@ -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_ */
View
314 xbmc/visualizations/iTunes/iTunesVisualAPI.h
@@ -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_ */
View
600 xbmc/visualizations/iTunes/itunes_vis.c
@@ -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( &current_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];