Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
2c10fb73
Commit
2c10fb73
authored
Apr 09, 2011
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
growl: fixed runtime behavior and compilation
parent
dc619560
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
93 deletions
+120
-93
Makefile.am
Makefile.am
+4
-0
extras/package/macosx/vlc.xcodeproj/project.pbxproj
extras/package/macosx/vlc.xcodeproj/project.pbxproj
+7
-11
modules/misc/notify/growl.m
modules/misc/notify/growl.m
+109
-82
No files found.
Makefile.am
View file @
2c10fb73
...
@@ -422,6 +422,8 @@ VLC-release.app: vlc
...
@@ -422,6 +422,8 @@ VLC-release.app: vlc
cp
-R
$(CONTRIB_DIR)
/Sparkle/Sparkle.framework
$(top_builddir)
/tmp/extras/contrib/Sparkle
cp
-R
$(CONTRIB_DIR)
/Sparkle/Sparkle.framework
$(top_builddir)
/tmp/extras/contrib/Sparkle
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
cp
-R
$(CONTRIB_DIR)
/BGHUDAppKit/BGHUDAppKit.framework
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
cp
-R
$(CONTRIB_DIR)
/BGHUDAppKit/BGHUDAppKit.framework
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/Growl
cp
-R
$(CONTRIB_DIR)
/Growl/Growl.framework
$(top_builddir)
/tmp/extras/contrib/Growl
mkdir
-p
$(top_builddir)
/tmp/modules/audio_output
mkdir
-p
$(top_builddir)
/tmp/modules/audio_output
mkdir
-p
$(top_builddir)
/tmp/modules/gui/macosx
mkdir
-p
$(top_builddir)
/tmp/modules/gui/macosx
for
i
in
\
for
i
in
\
...
@@ -577,6 +579,8 @@ VLC.app: vlc $(top_builddir)/src/.libs/libvlccore.dylib $(top_builddir)/src/.lib
...
@@ -577,6 +579,8 @@ VLC.app: vlc $(top_builddir)/src/.libs/libvlccore.dylib $(top_builddir)/src/.lib
cp
-R
$(CONTRIB_DIR)
/Sparkle/Sparkle.framework
$(top_builddir)
/tmp/extras/contrib/Sparkle
cp
-R
$(CONTRIB_DIR)
/Sparkle/Sparkle.framework
$(top_builddir)
/tmp/extras/contrib/Sparkle
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
cp
-R
$(CONTRIB_DIR)
/BGHUDAppKit/BGHUDAppKit.framework
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
cp
-R
$(CONTRIB_DIR)
/BGHUDAppKit/BGHUDAppKit.framework
$(top_builddir)
/tmp/extras/contrib/BGHUDAppKit
mkdir
-p
$(top_builddir)
/tmp/extras/contrib/Growl
cp
-R
$(CONTRIB_DIR)
/Growl/Growl.framework
$(top_builddir)
/tmp/extras/contrib/Growl
mkdir
-p
$(top_builddir)
/tmp/modules/audio_output
mkdir
-p
$(top_builddir)
/tmp/modules/audio_output
mkdir
-p
$(top_builddir)
/tmp/modules/gui/macosx
mkdir
-p
$(top_builddir)
/tmp/modules/gui/macosx
for
i
in
\
for
i
in
\
...
...
extras/package/macosx/vlc.xcodeproj/project.pbxproj
View file @
2c10fb73
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
/* Begin PBXBuildFile section */
/* Begin PBXBuildFile section */
CC0FB34C0F8BED1100F057F7
/* CoreDialogs.nib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CC0FB34A0F8BED1100F057F7
/* CoreDialogs.nib */
;
};
CC0FB34C0F8BED1100F057F7
/* CoreDialogs.nib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CC0FB34A0F8BED1100F057F7
/* CoreDialogs.nib */
;
};
CC3F9F861350B2A000B0E885
/* Growl.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CC3F9F851350B2A000B0E885
/* Growl.framework */
;
};
CC402EB00E00ABBB006A4BA4
/* vlc.icns in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F74F13DF02C2A53401EE194C
/* vlc.icns */
;
};
CC402EB00E00ABBB006A4BA4
/* vlc.icns in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F74F13DF02C2A53401EE194C
/* vlc.icns */
;
};
CC402EB10E00ABBB006A4BA4
/* MainMenu.nib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F74F13EA02C2A79C01EE194C
/* MainMenu.nib */
;
};
CC402EB10E00ABBB006A4BA4
/* MainMenu.nib in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F74F13EA02C2A79C01EE194C
/* MainMenu.nib */
;
};
CC402EB30E00ABBB006A4BA4
/* generic.icns in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F6E4F90B02D2648B01A80112
/* generic.icns */
;
};
CC402EB30E00ABBB006A4BA4
/* generic.icns in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
F6E4F90B02D2648B01A80112
/* generic.icns */
;
};
...
@@ -298,6 +299,7 @@
...
@@ -298,6 +299,7 @@
CC33C24F0D2578F5008C4683
/* volumeslider_graphite.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
name
=
volumeslider_graphite.png
;
path
=
Resources/volumeslider_graphite.png
;
sourceTree
=
"<group>"
;
};
CC33C24F0D2578F5008C4683
/* volumeslider_graphite.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
name
=
volumeslider_graphite.png
;
path
=
Resources/volumeslider_graphite.png
;
sourceTree
=
"<group>"
;
};
CC33C2500D2578F5008C4683
/* fullscreen_graphite.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
name
=
fullscreen_graphite.png
;
path
=
Resources/fullscreen_graphite.png
;
sourceTree
=
"<group>"
;
};
CC33C2500D2578F5008C4683
/* fullscreen_graphite.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
name
=
fullscreen_graphite.png
;
path
=
Resources/fullscreen_graphite.png
;
sourceTree
=
"<group>"
;
};
CC3DC89B0A7CDB9600B53F32
/* ApplicationServices.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
ApplicationServices.framework
;
path
=
/System/Library/Frameworks/ApplicationServices.framework
;
sourceTree
=
"<absolute>"
;
};
CC3DC89B0A7CDB9600B53F32
/* ApplicationServices.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
ApplicationServices.framework
;
path
=
/System/Library/Frameworks/ApplicationServices.framework
;
sourceTree
=
"<absolute>"
;
};
CC3F9F851350B2A000B0E885
/* Growl.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Growl.framework
;
path
=
"../../contrib/Growl/Growl.framework"
;
sourceTree
=
"<group>"
;
};
CC402F4B0E00ABBB006A4BA4
/* VLC.bundle */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
VLC.bundle
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CC402F4B0E00ABBB006A4BA4
/* VLC.bundle */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
VLC.bundle
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
CC426FD01020D44F00A32659
/* Sparkle.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Sparkle.framework
;
path
=
../../contrib/Sparkle/Sparkle.framework
;
sourceTree
=
SOURCE_ROOT
;
};
CC426FD01020D44F00A32659
/* Sparkle.framework */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
wrapper.framework
;
name
=
Sparkle.framework
;
path
=
../../contrib/Sparkle/Sparkle.framework
;
sourceTree
=
SOURCE_ROOT
;
};
CC4A33210F8CB017000FC4A7
/* coredialogs.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
coredialogs.m
;
path
=
../../../modules/gui/macosx/coredialogs.m
;
sourceTree
=
SOURCE_ROOT
;
};
CC4A33210F8CB017000FC4A7
/* coredialogs.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
coredialogs.m
;
path
=
../../../modules/gui/macosx/coredialogs.m
;
sourceTree
=
SOURCE_ROOT
;
};
...
@@ -444,6 +446,7 @@
...
@@ -444,6 +446,7 @@
CCBE999F0F922C51000705F8
/* CoreServices.framework in Frameworks */
,
CCBE999F0F922C51000705F8
/* CoreServices.framework in Frameworks */
,
CC426FD11020D44F00A32659
/* Sparkle.framework in Frameworks */
,
CC426FD11020D44F00A32659
/* Sparkle.framework in Frameworks */
,
CC84FB2D130083BB00816D38
/* BGHUDAppKit.framework in Frameworks */
,
CC84FB2D130083BB00816D38
/* BGHUDAppKit.framework in Frameworks */
,
CC3F9F861350B2A000B0E885
/* Growl.framework in Frameworks */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
};
};
...
@@ -552,6 +555,7 @@
...
@@ -552,6 +555,7 @@
1058C7ACFEA557BF11CA2CBB
/* Linked Frameworks */
=
{
1058C7ACFEA557BF11CA2CBB
/* Linked Frameworks */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
CC3F9F851350B2A000B0E885
/* Growl.framework */
,
CC84FB2C130083BB00816D38
/* BGHUDAppKit.framework */
,
CC84FB2C130083BB00816D38
/* BGHUDAppKit.framework */
,
CC426FD01020D44F00A32659
/* Sparkle.framework */
,
CC426FD01020D44F00A32659
/* Sparkle.framework */
,
CCBE999E0F922C51000705F8
/* CoreServices.framework */
,
CCBE999E0F922C51000705F8
/* CoreServices.framework */
,
...
@@ -857,7 +861,6 @@
...
@@ -857,7 +861,6 @@
buildPhases
=
(
buildPhases
=
(
CC402EAF0E00ABBB006A4BA4
/* Resources */
,
CC402EAF0E00ABBB006A4BA4
/* Resources */
,
CC402F400E00ABBB006A4BA4
/* Frameworks */
,
CC402F400E00ABBB006A4BA4
/* Frameworks */
,
CC402F450E00ABBB006A4BA4
/* Rez */
,
CC426FD81020D48700A32659
/* Copy Frameworks */
,
CC426FD81020D48700A32659
/* Copy Frameworks */
,
);
);
buildRules
=
(
buildRules
=
(
...
@@ -1061,16 +1064,6 @@
...
@@ -1061,16 +1064,6 @@
};
};
/* End PBXResourcesBuildPhase section */
/* End PBXResourcesBuildPhase section */
/* Begin PBXRezBuildPhase section */
CC402F450E00ABBB006A4BA4
/* Rez */
=
{
isa
=
PBXRezBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
);
runOnlyForDeploymentPostprocessing
=
0
;
};
/* End PBXRezBuildPhase section */
/* Begin PBXVariantGroup section */
/* Begin PBXVariantGroup section */
CC0FB34A0F8BED1100F057F7
/* CoreDialogs.nib */
=
{
CC0FB34A0F8BED1100F057F7
/* CoreDialogs.nib */
=
{
isa
=
PBXVariantGroup
;
isa
=
PBXVariantGroup
;
...
@@ -1192,6 +1185,7 @@
...
@@ -1192,6 +1185,7 @@
"$(inherited)"
,
"$(inherited)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/Growl\""
,
);
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
GCC_DYNAMIC_NO_PIC
=
NO
;
GCC_DYNAMIC_NO_PIC
=
NO
;
...
@@ -1227,6 +1221,7 @@
...
@@ -1227,6 +1221,7 @@
"$(inherited)"
,
"$(inherited)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/Growl\""
,
);
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
GCC_ENABLE_FIX_AND_CONTINUE
=
NO
;
GCC_ENABLE_FIX_AND_CONTINUE
=
NO
;
...
@@ -1258,6 +1253,7 @@
...
@@ -1258,6 +1253,7 @@
"$(inherited)"
,
"$(inherited)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)"
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/BGHUDAppKit\""
,
"\"$(SRCROOT)/../../contrib/Growl\""
,
);
);
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1
=
"\"$(SRCROOT)/../../contrib/Sparkle\""
;
GCC_SYMBOLS_PRIVATE_EXTERN
=
NO
;
GCC_SYMBOLS_PRIVATE_EXTERN
=
NO
;
...
...
modules/misc/notify/growl.m
View file @
2c10fb73
...
@@ -3,10 +3,11 @@
...
@@ -3,10 +3,11 @@
*****************************************************************************
*****************************************************************************
* VLC specific code:
* VLC specific code:
*
*
* Copyright © 2008 the VideoLAN team
* Copyright © 2008
,2011
the VideoLAN team
* $Id$
* $Id$
*
*
* Authors: Rafaël Carré
<funman
@
videolanorg
>
* Authors: Rafaël Carré
<funman
@
videolanorg
>
* Felix Paul Kühne
<fkuehne
@
videolan
.
org
*
*
*
This
program
is
free
software
;
you
can
redistribute
it
and
/
or
modify
*
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
*
it
under
the
terms
of
the
GNU
General
Public
License
as
published
by
...
@@ -50,7 +51,7 @@
...
@@ -50,7 +51,7 @@
#
include
"
config
.
h
"
#
include
"
config
.
h
"
#endif
#endif
#import
<
Foundation
/
Foundation
.
h
>
#import
<
CoreFoundation
/
Core
Foundation
.
h
>
#import
<Growl
/
GrowlDefines
.
h
>
#import
<Growl
/
GrowlDefines
.
h
>
#include
<vlc
_common
.
h
>
#include
<vlc
_common
.
h
>
...
@@ -67,9 +68,10 @@
...
@@ -67,9 +68,10 @@
struct intf_sys_t
struct intf_sys_t
{
{
CFDataRef default_icon;
CFDataRef default_icon;
NSAutoreleasePool *p_pool;
CFStringRef app_name;
CFStringRef app_name;
CFStringRef notification_type;
CFStringRef notification_type;
int i_id;
int i_item_changes;
};
};
/*****************************************************************************
/*****************************************************************************
...
@@ -79,7 +81,7 @@ static int Open ( vlc_object_t * );
...
@@ -79,7 +81,7 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Close ( vlc_object_t * );
static int ItemChange( vlc_object_t *, const char *,
static int ItemChange( vlc_object_t *, const char *,
vlc_value_t, vlc_value_t, void * );
vlc_value_t, vlc_value_t, void * );
static void RegisterToGrowl( vlc_object_t * );
static void RegisterToGrowl( vlc_object_t * );
static void NotifyToGrowl( intf_thread_t *, const char *, CFDataRef );
static void NotifyToGrowl( intf_thread_t *, const char *, CFDataRef );
...
@@ -91,12 +93,12 @@ static CFDataRef readFile(const char *);
...
@@ -91,12 +93,12 @@ static CFDataRef readFile(const char *);
****************************************************************************/
****************************************************************************/
vlc_module_begin ()
vlc_module_begin ()
set_category( CAT_INTERFACE )
set_category( CAT_INTERFACE )
set_subcategory( SUBCAT_INTERFACE_CONTROL )
set_subcategory( SUBCAT_INTERFACE_CONTROL )
set_shortname( "Growl" )
set_shortname( "Growl" )
set_description( N_("Growl Notification Plugin") )
set_description( N_("Growl Notification Plugin") )
set_capability( "interface", 0 )
set_capability( "interface", 0 )
set_callbacks( Open, Close )
set_callbacks( Open, Close )
vlc_module_end ()
vlc_module_end ()
/*****************************************************************************
/*****************************************************************************
...
@@ -105,24 +107,27 @@ vlc_module_end ()
...
@@ -105,24 +107,27 @@ vlc_module_end ()
static int Open( vlc_object_t *p_this )
static int Open( vlc_object_t *p_this )
{
{
intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_thread_t *p_intf = (intf_thread_t *)p_this;
playlist_t *p_playlist;
intf_sys_t *p_sys;
intf_sys_t *p_sys;
p_sys = p_intf->p_sys = calloc( 1, sizeof(intf_sys_t) );
p_sys = p_intf->p_sys = calloc( 1, sizeof(intf_sys_t) );
if( !p_sys )
if( !p_sys )
return VLC_ENOMEM;
return VLC_ENOMEM;
p_sys->p_pool = [[NSAutoreleasePool alloc] init];
p_sys->app_name = CFSTR( "VLC media player" );
p_sys->app_name = CFSTR( "VLC media player" );
p_sys->notification_type = CFSTR( "New input playing" );
p_sys->notification_type = CFSTR( "New input playing" );
char *data_path = config_GetDataDir ( p_this );
char *data_path = config_GetDataDir ( p_this );
char buf[strlen (data_path) + sizeof ("/vlc48x48.png")];
char buf[strlen (data_path) + sizeof ("/vlc512x512.png")];
snprintf (buf, sizeof (buf), "%s/vlc48x48.png", data_path);
snprintf (buf, sizeof (buf), "%s/vlc512x512.png", data_path);
msg_Dbg( p_this, "looking for icon at %s", buf );
free( data_path );
free( data_path );
p_sys->default_icon = (CFDataRef) readFile( buf );
p_sys->default_icon = (CFDataRef) readFile( buf );
var_AddCallback( pl_Get( p_intf ), "item-current", ItemChange, p_intf );
p_playlist = pl_Get( p_intf );
var_AddCallback( p_playlist, "item-change", ItemChange, p_intf );
var_AddCallback( p_playlist, "item-current", ItemChange, p_intf );
RegisterToGrowl( p_this );
RegisterToGrowl( p_this );
return VLC_SUCCESS;
return VLC_SUCCESS;
}
}
...
@@ -132,14 +137,16 @@ static int Open( vlc_object_t *p_this )
...
@@ -132,14 +137,16 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static void Close( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this )
{
{
intf_sys_t *p_sys = ((intf_thread_t*)p_this)->p_sys;
intf_thread_t *p_intf = (intf_thread_t *)p_this;
playlist_t *p_playlist = pl_Get( p_this );
var_DelCallback( pl_Get( p_this ), "item-current", ItemChange, p_this );
intf_sys_t *p_sys = p_intf->p_sys;
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_playlist, "item-current", ItemChange, p_intf );
CFRelease( p_sys->default_icon );
CFRelease( p_sys->default_icon );
CFRelease( p_sys->app_name );
CFRelease( p_sys->app_name );
CFRelease( p_sys->notification_type );
CFRelease( p_sys->notification_type );
[p_sys->p_pool release];
free( p_sys );
free( p_sys );
}
}
...
@@ -147,59 +154,79 @@ static void Close( vlc_object_t *p_this )
...
@@ -147,59 +154,79 @@ static void Close( vlc_object_t *p_this )
* ItemChange: Playlist item change callback
* ItemChange: Playlist item change callback
*****************************************************************************/
*****************************************************************************/
static int ItemChange( vlc_object_t *p_this, const char *psz_var,
static int ItemChange( vlc_object_t *p_this, const char *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *param )
vlc_value_t oldval, vlc_value_t newval, void *param )
{
{
VLC_UNUSED(
psz_var); VLC_UNUSED(oldval); VLC_UNUSED(new
val);
VLC_UNUSED(
old
val);
intf_thread_t *p_intf
= (intf_thread_t
*)param;
intf_thread_t *p_intf
= (intf_thread_t
*)param;
char *psz_tmp = NULL;
char *psz_tmp = NULL;
char *psz_title = NULL;
char *psz_title = NULL;
char *psz_artist = NULL;
char *psz_artist = NULL;
char *psz_album = NULL;
char *psz_album = NULL;
input_thread_t *p_input;
input_item_t *p_item = newval.p_address;
p_input = playlist_CurrentInput( (playlist_t*)p_this );
bool b_is_item_current = !strcmp( "item-current", psz_var );
/* Don't update each time an item has been preparsed */
if( b_is_item_current )
{ /* stores the current input item id */
p_intf->p_sys->i_id = p_item->i_id;
p_intf->p_sys->i_item_changes = 0;
return VLC_SUCCESS;
}
else
{
if( p_item->i_id != p_intf->p_sys->i_id ) { /* "item-change" */
p_intf->p_sys->i_item_changes = 0;
return VLC_SUCCESS;
}
/* Some variable bitrate inputs call "item-change" callbacks each time
* their length is updated, that is several times per second.
* We'll limit the number of changes to 1 per input. */
if( p_intf->p_sys->i_item_changes > 0 )
return VLC_SUCCESS;
p_intf->p_sys->i_item_changes++;
}
input_thread_t *p_input = playlist_CurrentInput( (playlist_t*)p_this );
if( !p_input ) return VLC_SUCCESS;
if( !p_input ) return VLC_SUCCESS;
char *psz_name = input_item_GetName( input_GetItem( p_input ) );
if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
if( p_input->b_dead || !psz_name )
{
{
/* Not playing anything ... */
/* Not playing anything ... */
free( psz_name );
vlc_object_release( p_input );
vlc_object_release( p_input );
return VLC_SUCCESS;
return VLC_SUCCESS;
}
}
free( psz_name );
/* Playing something ... */
/* Playing something ... */
input_item_t *p_item = input_GetItem( p_input );
if( input_item_GetNowPlaying( p_item ) )
psz_title = input_item_GetNowPlaying( p_item );
psz_title = input_item_GetTitleFbName( p_item );
else
psz_title = input_item_GetTitleFbName( p_item );
if( EMPTY_STR( psz_title ) )
if( EMPTY_STR( psz_title ) )
{
{
free( psz_title );
free( psz_title );
vlc_object_release( p_input );
vlc_object_release( p_input );
return VLC_SUCCESS;
return VLC_SUCCESS;
}
}
psz_artist = input_item_GetArtist( p_item );
psz_artist = input_item_GetArtist( p_item );
if( EMPTY_STR( psz_artist ) ) FREENULL( psz_artist );
if( EMPTY_STR( psz_artist ) ) FREENULL( psz_artist );
psz_album = input_item_GetAlbum( p_item ) ;
psz_album = input_item_GetAlbum( p_item ) ;
if( EMPTY_STR( psz_album ) ) FREENULL( psz_album );
if( EMPTY_STR( psz_album ) ) FREENULL( psz_album );
int i_ret;
int i_ret;
if( psz_artist
&&
psz_album )
if( psz_artist
&&
psz_album )
i_ret = asprintf(
&
psz_tmp, "%s\n%s [%s]",
i_ret = asprintf(
&
psz_tmp, "%s\n%s [%s]",
psz_title, psz_artist, psz_album );
psz_title, psz_artist, psz_album );
else if( psz_artist )
else if( psz_artist )
i_ret = asprintf(
&
psz_tmp, "%s\n%s", psz_title, psz_artist );
i_ret = asprintf(
&
psz_tmp, "%s\n%s", psz_title, psz_artist );
else
else
{
i_ret = asprintf(
&
psz_tmp, "%s", psz_title );
psz_tmp = strdup( psz_title );
if( psz_tmp == NULL )
i_ret = -1;
}
if( i_ret == -1 )
if( i_ret == -1 )
{
{
free( psz_title );
free( psz_title );
...
@@ -208,7 +235,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -208,7 +235,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
vlc_object_release( p_input );
vlc_object_release( p_input );
return VLC_ENOMEM;
return VLC_ENOMEM;
}
}
char *psz_arturl = input_item_GetArtURL( p_item );
char *psz_arturl = input_item_GetArtURL( p_item );
if( psz_arturl )
if( psz_arturl )
{
{
...
@@ -219,17 +246,17 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -219,17 +246,17 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
CFDataRef art = NULL;
CFDataRef art = NULL;
if( psz_arturl )
if( psz_arturl )
art = (CFDataRef) readFile( psz_arturl );
art = (CFDataRef) readFile( psz_arturl );
free( psz_title );
free( psz_title );
free( psz_artist );
free( psz_artist );
free( psz_album );
free( psz_album );
free( psz_arturl );
free( psz_arturl );
NotifyToGrowl( p_intf, psz_tmp, art );
NotifyToGrowl( p_intf, psz_tmp, art );
if( art ) CFRelease( art );
if( art ) CFRelease( art );
free( psz_tmp );
free( psz_tmp );
vlc_object_release( p_input );
vlc_object_release( p_input );
return VLC_SUCCESS;
return VLC_SUCCESS;
}
}
...
@@ -240,10 +267,10 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
...
@@ -240,10 +267,10 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
static void RegisterToGrowl( vlc_object_t *p_this )
static void RegisterToGrowl( vlc_object_t *p_this )
{
{
intf_sys_t *p_sys = ((intf_thread_t *)p_this)->p_sys;
intf_sys_t *p_sys = ((intf_thread_t *)p_this)->p_sys;
CFArrayRef defaultAndAllNotifications = CFArrayCreate(
CFArrayRef defaultAndAllNotifications = CFArrayCreate(
kCFAllocatorDefault, (const void **)
&
(p_sys->notification_type), 1,
kCFAllocatorDefault, (const void **)
&
(p_sys->notification_type), 1,
&
kCFTypeArrayCallBacks );
&
kCFTypeArrayCallBacks );
CFTypeRef registerKeys[4] = {
CFTypeRef registerKeys[4] = {
GROWL_APP_NAME,
GROWL_APP_NAME,
...
@@ -251,54 +278,54 @@ static void RegisterToGrowl( vlc_object_t *p_this )
...
@@ -251,54 +278,54 @@ static void RegisterToGrowl( vlc_object_t *p_this )
GROWL_NOTIFICATIONS_DEFAULT,
GROWL_NOTIFICATIONS_DEFAULT,
GROWL_APP_ICON
GROWL_APP_ICON
};
};
CFTypeRef registerValues[4] = {
CFTypeRef registerValues[4] = {
p_sys->app_name,
p_sys->app_name,
defaultAndAllNotifications,
defaultAndAllNotifications,
defaultAndAllNotifications,
defaultAndAllNotifications,
p_sys->default_icon
p_sys->default_icon
};
};
CFDictionaryRef registerInfo = CFDictionaryCreate(
CFDictionaryRef registerInfo = CFDictionaryCreate(
kCFAllocatorDefault, registerKeys, registerValues, 4,
kCFAllocatorDefault, registerKeys, registerValues, 4,
&
kCFTypeDictionaryKeyCallBacks,
&
kCFTypeDictionaryValueCallBacks );
&
kCFTypeDictionaryKeyCallBacks,
&
kCFTypeDictionaryValueCallBacks );
CFRelease( defaultAndAllNotifications );
CFRelease( defaultAndAllNotifications );
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterGetDistributedCenter(),
CFNotificationCenterGetDistributedCenter(),
(CFStringRef)GROWL_APP_REGISTRATION, NULL, registerInfo,
(CFStringRef)GROWL_APP_REGISTRATION, NULL, registerInfo,
kCFNotificationPostToAllSessions );
kCFNotificationPostToAllSessions );
CFRelease( registerInfo );
CFRelease( registerInfo );
}
}
static void NotifyToGrowl( intf_thread_t *p_intf, const char *psz_desc, CFDataRef art )
static void NotifyToGrowl( intf_thread_t *p_intf, const char *psz_desc, CFDataRef art )
{
{
intf_sys_t *p_sys = p_intf->p_sys;
intf_sys_t *p_sys = p_intf->p_sys;
CFStringRef title = CFStringCreateWithCString( kCFAllocatorDefault, _("Now playing"), kCFStringEncodingUTF8 );
CFStringRef title = CFStringCreateWithCString( kCFAllocatorDefault, _("Now playing"), kCFStringEncodingUTF8 );
CFStringRef desc = CFStringCreateWithCString( kCFAllocatorDefault, psz_desc, kCFStringEncodingUTF8 );
CFStringRef desc = CFStringCreateWithCString( kCFAllocatorDefault, psz_desc, kCFStringEncodingUTF8 );
CFMutableDictionaryRef notificationInfo = CFDictionaryCreateMutable(
CFMutableDictionaryRef notificationInfo = CFDictionaryCreateMutable(
kCFAllocatorDefault, 5,
&
kCFTypeDictionaryKeyCallBacks,
kCFAllocatorDefault, 5,
&
kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_NAME, p_sys->notification_type );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_NAME, p_sys->notification_type );
CFDictionarySetValue( notificationInfo, GROWL_APP_NAME, p_sys->app_name );
CFDictionarySetValue( notificationInfo, GROWL_APP_NAME, p_sys->app_name );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_TITLE, title );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_TITLE, title );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_DESCRIPTION, desc );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_DESCRIPTION, desc );
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_ICON,
CFDictionarySetValue( notificationInfo, GROWL_NOTIFICATION_ICON,
art ? art : p_sys->default_icon );
art ? art : p_sys->default_icon );
CFRelease( title );
CFRelease( title );
CFRelease( desc );
CFRelease( desc );
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterPostNotificationWithOptions(
CFNotificationCenterGetDistributedCenter(),
CFNotificationCenterGetDistributedCenter(),
(CFStringRef)GROWL_NOTIFICATION, NULL, notificationInfo,
(CFStringRef)GROWL_NOTIFICATION, NULL, notificationInfo,
kCFNotificationPostToAllSessions );
kCFNotificationPostToAllSessions );
CFRelease( notificationInfo );
CFRelease( notificationInfo );
}
}
...
@@ -311,8 +338,8 @@ static CFDataRef readFile(const char *filename)
...
@@ -311,8 +338,8 @@ static CFDataRef readFile(const char *filename)
// read the file into a CFDataRef
// read the file into a CFDataRef
FILE *fp = fopen(filename, "r");
FILE *fp = fopen(filename, "r");
if( !fp )
if( !fp )
return NULL;
return NULL;
fseek(fp, 0, SEEK_END);
fseek(fp, 0, SEEK_END);
long dataLength = ftell(fp);
long dataLength = ftell(fp);
fseek(fp, 0, SEEK_SET);
fseek(fp, 0, SEEK_SET);
...
@@ -320,6 +347,6 @@ static CFDataRef readFile(const char *filename)
...
@@ -320,6 +347,6 @@ static CFDataRef readFile(const char *filename)
fread(fileData, 1, dataLength, fp);
fread(fileData, 1, dataLength, fp);
fclose(fp);
fclose(fp);
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, fileData,
return CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, fileData,
dataLength, kCFAllocatorMalloc);
dataLength, kCFAllocatorMalloc);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment