Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
db4a6b82
Commit
db4a6b82
authored
Oct 20, 2007
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/Framework: Fix tabs.
parent
3b44ce0d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
722 additions
and
722 deletions
+722
-722
extras/MacOSX/Framework/Headers/Internal/VLCEventManager.h
extras/MacOSX/Framework/Headers/Internal/VLCEventManager.h
+4
-4
extras/MacOSX/Framework/Headers/Internal/VLCLibrary.h
extras/MacOSX/Framework/Headers/Internal/VLCLibrary.h
+2
-2
extras/MacOSX/Framework/Headers/Public/VLCAudio.h
extras/MacOSX/Framework/Headers/Public/VLCAudio.h
+1
-1
extras/MacOSX/Framework/Headers/Public/VLCMedia.h
extras/MacOSX/Framework/Headers/Public/VLCMedia.h
+26
-26
extras/MacOSX/Framework/Headers/Public/VLCMediaList.h
extras/MacOSX/Framework/Headers/Public/VLCMediaList.h
+5
-5
extras/MacOSX/Framework/Headers/Public/VLCMediaPlayer.h
extras/MacOSX/Framework/Headers/Public/VLCMediaPlayer.h
+12
-12
extras/MacOSX/Framework/Headers/Public/VLCVideoView.h
extras/MacOSX/Framework/Headers/Public/VLCVideoView.h
+6
-6
extras/MacOSX/Framework/Pre-Compile.sh
extras/MacOSX/Framework/Pre-Compile.sh
+210
-210
extras/MacOSX/Framework/Sources/VLCAudio.m
extras/MacOSX/Framework/Sources/VLCAudio.m
+24
-24
extras/MacOSX/Framework/Sources/VLCEventManager.m
extras/MacOSX/Framework/Sources/VLCEventManager.m
+21
-21
extras/MacOSX/Framework/Sources/VLCLibrary.m
extras/MacOSX/Framework/Sources/VLCLibrary.m
+64
-64
extras/MacOSX/Framework/Sources/VLCMediaList.m
extras/MacOSX/Framework/Sources/VLCMediaList.m
+77
-77
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
+270
-270
No files found.
extras/MacOSX/Framework/Headers/Internal/VLCEventManager.h
View file @
db4a6b82
...
@@ -38,10 +38,10 @@
...
@@ -38,10 +38,10 @@
+
(
id
)
sharedManager
;
+
(
id
)
sharedManager
;
-
(
void
)
callOnMainThreadDelegateOfObject
:(
id
)
aTarget
-
(
void
)
callOnMainThreadDelegateOfObject
:(
id
)
aTarget
withDelegateMethod
:(
SEL
)
aSelector
withDelegateMethod
:(
SEL
)
aSelector
withNotificationName
:(
NSString
*
)
aNotificationName
;
withNotificationName
:(
NSString
*
)
aNotificationName
;
-
(
void
)
callOnMainThreadObject
:(
id
)
aTarget
-
(
void
)
callOnMainThreadObject
:(
id
)
aTarget
withMethod
:(
SEL
)
aSelector
withMethod
:(
SEL
)
aSelector
withArgumentAsObject
:(
id
)
arg
;
withArgumentAsObject
:(
id
)
arg
;
@end
@end
extras/MacOSX/Framework/Headers/Internal/VLCLibrary.h
View file @
db4a6b82
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
// TODO: Documentation
// TODO: Documentation
@interface
VLCLibrary
:
NSObject
@interface
VLCLibrary
:
NSObject
{
{
void
*
instance
;
void
*
instance
;
VLCAudio
*
audio
;
VLCAudio
*
audio
;
}
}
/* Factories */
/* Factories */
...
...
extras/MacOSX/Framework/Headers/Public/VLCAudio.h
View file @
db4a6b82
...
@@ -36,7 +36,7 @@ extern NSString *VLCMediaPlayerVolumeChanged;
...
@@ -36,7 +36,7 @@ extern NSString *VLCMediaPlayerVolumeChanged;
// TODO: Documentation
// TODO: Documentation
@interface
VLCAudio
:
NSObject
@interface
VLCAudio
:
NSObject
{
{
VLCLibrary
*
library
;
//< Library to control audio for
VLCLibrary
*
library
;
//< Library to control audio for
}
}
/* Initializers */
/* Initializers */
...
...
extras/MacOSX/Framework/Headers/Public/VLCMedia.h
View file @
db4a6b82
...
@@ -30,32 +30,32 @@
...
@@ -30,32 +30,32 @@
/**
/**
* Standard dictionary keys for retreiving meta data.
* Standard dictionary keys for retreiving meta data.
*/
*/
extern
NSString
*
VLCMetaInformationTitle
;
/* NSString */
extern
NSString
*
VLCMetaInformationTitle
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtist
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtist
;
/* NSString */
extern
NSString
*
VLCMetaInformationTitle
;
/* NSString */
extern
NSString
*
VLCMetaInformationTitle
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtist
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtist
;
/* NSString */
extern
NSString
*
VLCMetaInformationGenre
;
/* NSString */
extern
NSString
*
VLCMetaInformationGenre
;
/* NSString */
extern
NSString
*
VLCMetaInformationCopyright
;
/* NSString */
extern
NSString
*
VLCMetaInformationCopyright
;
/* NSString */
extern
NSString
*
VLCMetaInformationAlbum
;
/* NSString */
extern
NSString
*
VLCMetaInformationAlbum
;
/* NSString */
extern
NSString
*
VLCMetaInformationTrackNumber
;
/* NSString */
extern
NSString
*
VLCMetaInformationTrackNumber
;
/* NSString */
extern
NSString
*
VLCMetaInformationDescription
;
/* NSString */
extern
NSString
*
VLCMetaInformationDescription
;
/* NSString */
extern
NSString
*
VLCMetaInformationRating
;
/* NSString */
extern
NSString
*
VLCMetaInformationRating
;
/* NSString */
extern
NSString
*
VLCMetaInformationDate
;
/* NSString */
extern
NSString
*
VLCMetaInformationDate
;
/* NSString */
extern
NSString
*
VLCMetaInformationSetting
;
/* NSString */
extern
NSString
*
VLCMetaInformationSetting
;
/* NSString */
extern
NSString
*
VLCMetaInformationURL
;
/* NSString */
extern
NSString
*
VLCMetaInformationURL
;
/* NSString */
extern
NSString
*
VLCMetaInformationLanguage
;
/* NSString */
extern
NSString
*
VLCMetaInformationLanguage
;
/* NSString */
extern
NSString
*
VLCMetaInformationNowPlaying
;
/* NSString */
extern
NSString
*
VLCMetaInformationNowPlaying
;
/* NSString */
extern
NSString
*
VLCMetaInformationPublisher
;
/* NSString */
extern
NSString
*
VLCMetaInformationPublisher
;
/* NSString */
extern
NSString
*
VLCMetaInformationEncodedBy
;
/* NSString */
extern
NSString
*
VLCMetaInformationEncodedBy
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtworkURL
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtworkURL
;
/* NSString */
extern
NSString
*
VLCMetaInformationArtwork
;
/* NSImage */
extern
NSString
*
VLCMetaInformationArtwork
;
/* NSImage */
extern
NSString
*
VLCMetaInformationTrackID
;
/* NSString */
extern
NSString
*
VLCMetaInformationTrackID
;
/* NSString */
/* Notification Messages */
/* Notification Messages */
/**
/**
* Available notification messages.
* Available notification messages.
*/
*/
extern
NSString
*
VLCMediaMetaChanged
;
//< Notification message for when the media's meta data has changed
extern
NSString
*
VLCMediaMetaChanged
;
//< Notification message for when the media's meta data has changed
// Forward declarations, supresses compiler error messages
// Forward declarations, supresses compiler error messages
@class
VLCMediaList
;
@class
VLCMediaList
;
...
@@ -103,13 +103,13 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when the med
...
@@ -103,13 +103,13 @@ extern NSString *VLCMediaMetaChanged; //< Notification message for when the med
*/
*/
@interface
VLCMedia
:
NSObject
@interface
VLCMedia
:
NSObject
{
{
void
*
p_md
;
//< Internal media descriptor instance
void
*
p_md
;
//< Internal media descriptor instance
NSString
*
url
;
//< URL for this media resource
NSString
*
url
;
//< URL for this media resource
VLCMediaList
*
subitems
;
//< Sub list of items
VLCMediaList
*
subitems
;
//< Sub list of items
VLCTime
*
length
;
//< Duration of the media
VLCTime
*
length
;
//< Duration of the media
NSMutableDictionary
*
metaDictionary
;
//< Meta data storage
NSMutableDictionary
*
metaDictionary
;
//< Meta data storage
id
delegate
;
//< Delegate object
id
delegate
;
//< Delegate object
BOOL
preparsed
;
//< Value used to determine of the file has been preparsed
BOOL
preparsed
;
//< Value used to determine of the file has been preparsed
}
}
/* Object Factories */
/* Object Factories */
...
...
extras/MacOSX/Framework/Headers/Public/VLCMediaList.h
View file @
db4a6b82
...
@@ -42,8 +42,8 @@ extern NSString *VLCMediaListItemDeleted;
...
@@ -42,8 +42,8 @@ extern NSString *VLCMediaListItemDeleted;
// TODO: Documentation
// TODO: Documentation
@interface
VLCMediaList
:
NSObject
@interface
VLCMediaList
:
NSObject
{
{
void
*
p_mlist
;
//< Internal instance of media list
void
*
p_mlist
;
//< Internal instance of media list
id
delegate
;
//< Delegate object
id
delegate
;
//< Delegate object
}
}
/* Properties */
/* Properties */
...
@@ -61,8 +61,8 @@ extern NSString *VLCMediaListItemDeleted;
...
@@ -61,8 +61,8 @@ extern NSString *VLCMediaListItemDeleted;
-
(
int
)
indexOfMedia
:(
VLCMedia
*
)
media
;
-
(
int
)
indexOfMedia
:(
VLCMedia
*
)
media
;
-
(
int
)
count
;
-
(
int
)
count
;
-
(
NSArray
*
)
sublists
;
// I don't see why this would be useful
-
(
NSArray
*
)
sublists
;
// I don't see why this would be useful
//- (VLCMediaList *)flatPlaylist;
// nore this one
//- (VLCMediaList *)flatPlaylist;
// nore this one
//- (VLCMedia *)providerMedia;
// I have no clue what this does
//- (VLCMedia *)providerMedia;
// I have no clue what this does
@end
@end
\ No newline at end of file
extras/MacOSX/Framework/Headers/Public/VLCMediaPlayer.h
View file @
db4a6b82
...
@@ -32,13 +32,13 @@ extern NSString *VLCMediaPlayerStateChanged;
...
@@ -32,13 +32,13 @@ extern NSString *VLCMediaPlayerStateChanged;
// TODO: Documentation
// TODO: Documentation
typedef
enum
VLCMediaPlayerState
typedef
enum
VLCMediaPlayerState
{
{
VLCMediaPlayerStateStopped
,
//< Player has stopped
VLCMediaPlayerStateStopped
,
//< Player has stopped
VLCMediaPlayerStateOpening
,
//< Stream is opening
VLCMediaPlayerStateOpening
,
//< Stream is opening
VLCMediaPlayerStateBuffering
,
//< Stream is buffering
VLCMediaPlayerStateBuffering
,
//< Stream is buffering
VLCMediaPlayerStateEnded
,
//< Stream has ended
VLCMediaPlayerStateEnded
,
//< Stream has ended
VLCMediaPlayerStateError
,
//< Player has generated an error
VLCMediaPlayerStateError
,
//< Player has generated an error
VLCMediaPlayerStatePlaying
,
//< Stream is playing
VLCMediaPlayerStatePlaying
,
//< Stream is playing
VLCMediaPlayerStatePaused
//< Stream is paused
VLCMediaPlayerStatePaused
//< Stream is paused
}
VLCMediaPlayerState
;
}
VLCMediaPlayerState
;
extern
NSString
*
VLCMediaPlayerStateToString
(
VLCMediaPlayerState
state
);
extern
NSString
*
VLCMediaPlayerStateToString
(
VLCMediaPlayerState
state
);
...
@@ -57,11 +57,11 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
...
@@ -57,11 +57,11 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
// TODO: Should we use medialist_player or our own flavor of media player?
// TODO: Should we use medialist_player or our own flavor of media player?
@interface
VLCMediaPlayer
:
NSObject
@interface
VLCMediaPlayer
:
NSObject
{
{
id
delegate
;
//< Object delegate
id
delegate
;
//< Object delegate
VLCVideoView
*
videoView
;
//< NSView instance where media is rendered to
VLCVideoView
*
videoView
;
//< NSView instance where media is rendered to
void
*
instance
;
// Internal
void
*
instance
;
// Internal
VLCMedia
*
media
;
//< Current media being played
VLCMedia
*
media
;
//< Current media being played
}
}
/* Initializers */
/* Initializers */
...
@@ -177,5 +177,5 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
...
@@ -177,5 +177,5 @@ extern NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state);
* \see VLCMediaState
* \see VLCMediaState
*/
*/
-
(
VLCMediaPlayerState
)
state
;
-
(
VLCMediaPlayerState
)
state
;
@end
@end
extras/MacOSX/Framework/Headers/Public/VLCVideoView.h
View file @
db4a6b82
...
@@ -52,12 +52,12 @@ extern NSString *VLCVideoViewLeftFullScreen;
...
@@ -52,12 +52,12 @@ extern NSString *VLCVideoViewLeftFullScreen;
@interface
VLCVideoView
:
NSView
<
VLCOpenGLVoutEmbedding
>
@interface
VLCVideoView
:
NSView
<
VLCOpenGLVoutEmbedding
>
{
{
id
delegate
;
id
delegate
;
NSColor
*
backColor
;
NSColor
*
backColor
;
BOOL
stretchesVideo
;
BOOL
stretchesVideo
;
// TODO: Allow for view to report transparency to do some cool effects
// TODO: Allow for view to report transparency to do some cool effects
// with the video?
// with the video?
}
}
-
(
void
)
setDelegate
:(
id
)
value
;
-
(
void
)
setDelegate
:(
id
)
value
;
...
...
extras/MacOSX/Framework/Pre-Compile.sh
View file @
db4a6b82
if
[
${
ACTION
}
=
""
]
;
then
if
[
${
ACTION
}
=
""
]
;
then
# Debug --
# Debug --
TARGET_BUILD_DIR
=
"."
TARGET_BUILD_DIR
=
"."
FULL_PRODUCT_NAME
=
"VLC.framework"
FULL_PRODUCT_NAME
=
"VLC.framework"
CONTENTS_FOLDER_PATH
=
"
${
FULL_PRODUCT_NAME
}
/Versions/A"
CONTENTS_FOLDER_PATH
=
"
${
FULL_PRODUCT_NAME
}
/Versions/A"
VLC_BUILD_DIR
=
"../../.."
VLC_BUILD_DIR
=
"../../.."
VLC_SRC_DIR
=
"../../.."
VLC_SRC_DIR
=
"../../.."
# Debug --
# Debug --
fi
fi
if
[
${
ACTION
}
=
"build"
]
;
then
if
[
${
ACTION
}
=
"build"
]
;
then
vlc_config
=
"
${
VLC_SRC_DIR
}
/vlc-config"
vlc_config
=
"
${
VLC_SRC_DIR
}
/vlc-config"
lib
=
"lib"
lib
=
"lib"
modules
=
"modules"
modules
=
"modules"
target
=
"
${
TARGET_BUILD_DIR
}
/
${
CONTENTS_FOLDER_PATH
}
"
target
=
"
${
TARGET_BUILD_DIR
}
/
${
CONTENTS_FOLDER_PATH
}
"
target_lib
=
"
${
target
}
/
${
lib
}
"
# Should we consider using a different well-known folder like shared resources?
target_lib
=
"
${
target
}
/
${
lib
}
"
# Should we consider using a different well-known folder like shared resources?
target_modules
=
"
${
target
}
/
${
modules
}
"
# Should we consider using a different well-known folder like shared resources?
target_modules
=
"
${
target
}
/
${
modules
}
"
# Should we consider using a different well-known folder like shared resources?
##########################
##########################
# @function install_library(src_lib, dest_dir)
# @function install_library(src_lib, dest_dir)
# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
# @param src_lib
source library to copy to the destination directory
# @param src_lib
source library to copy to the destination directory
# @param dest_dir
destination directory where the src_lib should be copied to
# @param dest_dir
destination directory where the src_lib should be copied to
install_library
()
{
install_library
()
{
if
[
${
3
}
=
"library"
]
;
then
if
[
${
3
}
=
"library"
]
;
then
install_name
=
"@loader_path/lib"
install_name
=
"@loader_path/lib"
else
else
install_name
=
"@loader_path/modules"
install_name
=
"@loader_path/modules"
fi
fi
if
[
"
${
4
}
"
!=
""
]
;
then
if
[
"
${
4
}
"
!=
""
]
;
then
lib_dest
=
"
${
2
}
/
${
4
}
"
lib_dest
=
"
${
2
}
/
${
4
}
"
else
else
lib_dest
=
"
${
2
}
/
`
basename
${
1
}
`
"
lib_dest
=
"
${
2
}
/
`
basename
${
1
}
`
"
fi
fi
if
test
-e
${
1
}
&&
!
test
-e
${
lib_dest
}
;
then
if
test
-e
${
1
}
&&
!
test
-e
${
lib_dest
}
;
then
mkdir
-p
${
2
}
mkdir
-p
${
2
}
# Lets copy the library from the source folder to our new destination folder
# Lets copy the library from the source folder to our new destination folder
cp
${
1
}
${
lib_dest
}
cp
${
1
}
${
lib_dest
}
# Update the dynamic library so it will know where to look for the other libraries
# Update the dynamic library so it will know where to look for the other libraries
echo
"Installing
${
3
}
`
basename
${
lib_dest
}
`
"
echo
"Installing
${
3
}
`
basename
${
lib_dest
}
`
"
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
install_name_tool
-change
/usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib
${
lib_dest
}
install_name_tool
-change
/usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib
${
lib_dest
}
install_name_tool
-change
@executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib
${
lib_dest
}
install_name_tool
-change
@executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib
${
lib_dest
}
install_name_tool
-id
"
${
install_name
}
/
`
basename
${
lib_dest
}
`
"
${
lib_dest
}
install_name_tool
-id
"
${
install_name
}
/
`
basename
${
lib_dest
}
`
"
${
lib_dest
}
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
for
linked_lib
in
`
otool
-L
"
${
lib_dest
}
"
|
grep
@executable_path |
sed
's/(\([0-z]*\ *\.*\,*\)*)//g'
`
;
do
for
linked_lib
in
`
otool
-L
"
${
lib_dest
}
"
|
grep
@executable_path |
sed
's/(\([0-z]*\ *\.*\,*\)*)//g'
`
;
do
ref_lib
=
`
echo
"
${
linked_lib
}
"
|
sed
's:executable_path/:loader_path/../:'
`
ref_lib
=
`
echo
"
${
linked_lib
}
"
|
sed
's:executable_path/:loader_path/../:'
`
install_name_tool
-change
${
linked_lib
}
${
ref_lib
}
${
lib_dest
}
install_name_tool
-change
${
linked_lib
}
${
ref_lib
}
${
lib_dest
}
done
done
fi
fi
}
}
# @function install_library
# @function install_library
##########################
##########################
##########################
##########################
# Create a symbolic link in the root of the framework
# Create a symbolic link in the root of the framework
mkdir
-p
${
target_lib
}
mkdir
-p
${
target_lib
}
mkdir
-p
${
target_modules
}
mkdir
-p
${
target_modules
}
pushd
`
pwd
`
>
/dev/null
pushd
`
pwd
`
>
/dev/null
cd
${
TARGET_BUILD_DIR
}
/
${
FULL_PRODUCT_NAME
}
cd
${
TARGET_BUILD_DIR
}
/
${
FULL_PRODUCT_NAME
}
ln
-sf
Versions/Current/
${
lib
}
.
ln
-sf
Versions/Current/
${
lib
}
.
ln
-sf
Versions/Current/
${
modules
}
.
ln
-sf
Versions/Current/
${
modules
}
.
popd
>
/dev/null
popd
>
/dev/null
# Create a symbolic link in the root of the framework
# Create a symbolic link in the root of the framework
##########################
##########################
##########################
##########################
# Build the library folder (Same as VLC.framework/lib in Makefile)
# Build the library folder (Same as VLC.framework/lib in Makefile)
echo
"Building library folder..."
echo
"Building library folder..."
# Check to see if there are any vlc libraries available
# Check to see if there are any vlc libraries available
echo
"Copying VLC libraries..."
echo
"Copying VLC libraries..."
if
test
-d
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib
;
then
if
test
-d
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib
;
then
# Iterate through the dyanmic libraries available
# Iterate through the dyanmic libraries available
for
lib_src
in
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/
*
.dylib
;
do
for
lib_src
in
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/
*
.dylib
;
do
install_library
${
lib_src
}
${
target_lib
}
"library"
install_library
${
lib_src
}
${
target_lib
}
"library"
done
done
fi
fi
# Check to see if there are any core libraries available
# Check to see if there are any core libraries available
echo
"Copying core libraries..."
echo
"Copying core libraries..."
#
if test -d ${VLC_BUILD_DIR}/src/.libs; then
#
if test -d ${VLC_BUILD_DIR}/src/.libs; then
#
# Iterate through all the core libraries
#
# Iterate through all the core libraries
#
for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
#
for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
#
# Only install the library if it is not a symbolic link
#
# Only install the library if it is not a symbolic link
#
if ! test -L ${lib_src}; then
#
if ! test -L ${lib_src}; then
#
echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
#
echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
#
fi
#
fi
#
done
#
done
#
fi
#
fi
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc-control.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc-control.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/vlc_libintl.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/vlc_libintl.dylib"
${
target_lib
}
"library"
# Build the library folder
# Build the library folder
##########################
##########################
##########################
##########################
# Build the modules folder (Same as VLC.framework/modules in Makefile)
# Build the modules folder (Same as VLC.framework/modules in Makefile)
echo
"Building modules folder..."
echo
"Building modules folder..."
# Figure out what modules are available to install
# Figure out what modules are available to install
for
module
in
`
top_builddir
=
"
${
VLC_BUILD_DIR
}
"
${
vlc_config
}
--target
plugin
`
;
do
for
module
in
`
top_builddir
=
"
${
VLC_BUILD_DIR
}
"
${
vlc_config
}
--target
plugin
`
;
do
# Check to see that the reported module actually exists
# Check to see that the reported module actually exists
if
test
-n
${
module
}
;
then
if
test
-n
${
module
}
;
then
module_src
=
"
`
dirname
${
module
}
`
/.libs/
`
basename
${
module
}
`
.dylib"
module_src
=
"
`
dirname
${
module
}
`
/.libs/
`
basename
${
module
}
`
.dylib"
install_library
${
module_src
}
${
target_modules
}
"module"
install_library
${
module_src
}
${
target_modules
}
"module"
fi
fi
done
done
# Build the modules folder
# Build the modules folder
##########################
##########################
fi
fi
if
[
${
ACTION
}
=
""
]
;
then
if
[
${
ACTION
}
=
""
]
;
then
# Debug --
# Debug --
TARGET_BUILD_DIR
=
"."
TARGET_BUILD_DIR
=
"."
FULL_PRODUCT_NAME
=
"VLC.framework"
FULL_PRODUCT_NAME
=
"VLC.framework"
CONTENTS_FOLDER_PATH
=
"
${
FULL_PRODUCT_NAME
}
/Versions/A"
CONTENTS_FOLDER_PATH
=
"
${
FULL_PRODUCT_NAME
}
/Versions/A"
VLC_BUILD_DIR
=
"../../.."
VLC_BUILD_DIR
=
"../../.."
VLC_SRC_DIR
=
"../../.."
VLC_SRC_DIR
=
"../../.."
# Debug --
# Debug --
fi
fi
if
[
${
ACTION
}
=
"build"
]
;
then
if
[
${
ACTION
}
=
"build"
]
;
then
vlc_config
=
"
${
VLC_SRC_DIR
}
/vlc-config"
vlc_config
=
"
${
VLC_SRC_DIR
}
/vlc-config"
lib
=
"lib"
lib
=
"lib"
modules
=
"modules"
modules
=
"modules"
target
=
"
${
TARGET_BUILD_DIR
}
/
${
CONTENTS_FOLDER_PATH
}
"
target
=
"
${
TARGET_BUILD_DIR
}
/
${
CONTENTS_FOLDER_PATH
}
"
target_lib
=
"
${
target
}
/
${
lib
}
"
# Should we consider using a different well-known folder like shared resources?
target_lib
=
"
${
target
}
/
${
lib
}
"
# Should we consider using a different well-known folder like shared resources?
target_modules
=
"
${
target
}
/
${
modules
}
"
# Should we consider using a different well-known folder like shared resources?
target_modules
=
"
${
target
}
/
${
modules
}
"
# Should we consider using a different well-known folder like shared resources?
##########################
##########################
# @function install_library(src_lib, dest_dir)
# @function install_library(src_lib, dest_dir)
# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
# @description Installs the specified library into the destination folder, automatically changes the references to dependencies
# @param src_lib
source library to copy to the destination directory
# @param src_lib
source library to copy to the destination directory
# @param dest_dir
destination directory where the src_lib should be copied to
# @param dest_dir
destination directory where the src_lib should be copied to
install_library
()
{
install_library
()
{
if
[
${
3
}
=
"library"
]
;
then
if
[
${
3
}
=
"library"
]
;
then
install_name
=
"@loader_path/lib"
install_name
=
"@loader_path/lib"
else
else
install_name
=
"@loader_path/modules"
install_name
=
"@loader_path/modules"
fi
fi
if
[
"
${
4
}
"
!=
""
]
;
then
if
[
"
${
4
}
"
!=
""
]
;
then
lib_dest
=
"
${
2
}
/
${
4
}
"
lib_dest
=
"
${
2
}
/
${
4
}
"
else
else
lib_dest
=
"
${
2
}
/
`
basename
${
1
}
`
"
lib_dest
=
"
${
2
}
/
`
basename
${
1
}
`
"
fi
fi
if
test
-e
${
1
}
&&
!
test
-e
${
lib_dest
}
;
then
if
test
-e
${
1
}
&&
!
test
-e
${
lib_dest
}
;
then
mkdir
-p
${
2
}
mkdir
-p
${
2
}
# Lets copy the library from the source folder to our new destination folder
# Lets copy the library from the source folder to our new destination folder
cp
${
1
}
${
lib_dest
}
cp
${
1
}
${
lib_dest
}
# Update the dynamic library so it will know where to look for the other libraries
# Update the dynamic library so it will know where to look for the other libraries
echo
"Installing
${
3
}
`
basename
${
lib_dest
}
`
"
echo
"Installing
${
3
}
`
basename
${
lib_dest
}
`
"
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
# Change the reference of libvlc.1 stored in the usr directory to libvlc.dylib in the framework's library directory
install_name_tool
-change
/usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib
${
lib_dest
}
install_name_tool
-change
/usr/local/lib/libvlc.1.dylib @loader_path/../lib/libvlc.dylib
${
lib_dest
}
install_name_tool
-change
@executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib
${
lib_dest
}
install_name_tool
-change
@executable_path/lib/vlc_libintl.dylib @loader_path/../lib/vlc_libintl.dylib
${
lib_dest
}
install_name_tool
-id
"
${
install_name
}
/
`
basename
${
lib_dest
}
`
"
${
lib_dest
}
install_name_tool
-id
"
${
install_name
}
/
`
basename
${
lib_dest
}
`
"
${
lib_dest
}
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
# Iterate through each installed library and modify the references to other dynamic libraries to match the framework's library directory
for
linked_lib
in
`
otool
-L
"
${
lib_dest
}
"
|
grep
@executable_path |
sed
's/(\([0-z]*\ *\.*\,*\)*)//g'
`
;
do
for
linked_lib
in
`
otool
-L
"
${
lib_dest
}
"
|
grep
@executable_path |
sed
's/(\([0-z]*\ *\.*\,*\)*)//g'
`
;
do
ref_lib
=
`
echo
"
${
linked_lib
}
"
|
sed
's:executable_path/:loader_path/../:'
`
ref_lib
=
`
echo
"
${
linked_lib
}
"
|
sed
's:executable_path/:loader_path/../:'
`
install_name_tool
-change
${
linked_lib
}
${
ref_lib
}
${
lib_dest
}
install_name_tool
-change
${
linked_lib
}
${
ref_lib
}
${
lib_dest
}
done
done
fi
fi
}
}
# @function install_library
# @function install_library
##########################
##########################
##########################
##########################
# Create a symbolic link in the root of the framework
# Create a symbolic link in the root of the framework
mkdir
-p
${
target_lib
}
mkdir
-p
${
target_lib
}
mkdir
-p
${
target_modules
}
mkdir
-p
${
target_modules
}
pushd
`
pwd
`
>
/dev/null
pushd
`
pwd
`
>
/dev/null
cd
${
TARGET_BUILD_DIR
}
/
${
FULL_PRODUCT_NAME
}
cd
${
TARGET_BUILD_DIR
}
/
${
FULL_PRODUCT_NAME
}
ln
-sf
Versions/Current/
${
lib
}
.
ln
-sf
Versions/Current/
${
lib
}
.
ln
-sf
Versions/Current/
${
modules
}
.
ln
-sf
Versions/Current/
${
modules
}
.
popd
>
/dev/null
popd
>
/dev/null
# Create a symbolic link in the root of the framework
# Create a symbolic link in the root of the framework
##########################
##########################
##########################
##########################
# Build the library folder (Same as VLC.framework/lib in Makefile)
# Build the library folder (Same as VLC.framework/lib in Makefile)
echo
"Building library folder..."
echo
"Building library folder..."
# Check to see if there are any vlc libraries available
# Check to see if there are any vlc libraries available
echo
"Copying VLC libraries..."
echo
"Copying VLC libraries..."
if
test
-d
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib
;
then
if
test
-d
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib
;
then
# Iterate through the dyanmic libraries available
# Iterate through the dyanmic libraries available
for
lib_src
in
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/
*
.dylib
;
do
for
lib_src
in
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/
*
.dylib
;
do
install_library
${
lib_src
}
${
target_lib
}
"library"
install_library
${
lib_src
}
${
target_lib
}
"library"
done
done
fi
fi
# Check to see if there are any core libraries available
# Check to see if there are any core libraries available
echo
"Copying core libraries..."
echo
"Copying core libraries..."
#
if test -d ${VLC_BUILD_DIR}/src/.libs; then
#
if test -d ${VLC_BUILD_DIR}/src/.libs; then
#
# Iterate through all the core libraries
#
# Iterate through all the core libraries
#
for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
#
for lib_src = ${VLC_BUILD_DIR}/src/.libs/*.dylib; do
#
# Only install the library if it is not a symbolic link
#
# Only install the library if it is not a symbolic link
#
if ! test -L ${lib_src}; then
#
if ! test -L ${lib_src}; then
#
echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
#
echo "install_library ${lib_src} ${target_lib} `echo "${lib_src}" | sed 's:(.\d+)+.dylib:.dylib:'`"
#
fi
#
fi
#
done
#
done
#
fi
#
fi
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc-control.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/src/.libs/libvlc-control.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/vlc_libintl.dylib"
${
target_lib
}
"library"
install_library
"
${
VLC_BUILD_DIR
}
/extras/contrib/vlc-lib/vlc_libintl.dylib"
${
target_lib
}
"library"
# Build the library folder
# Build the library folder
##########################
##########################
##########################
##########################
# Build the modules folder (Same as VLC.framework/modules in Makefile)
# Build the modules folder (Same as VLC.framework/modules in Makefile)
echo
"Building modules folder..."
echo
"Building modules folder..."
# Figure out what modules are available to install
# Figure out what modules are available to install
for
module
in
`
top_builddir
=
"
${
VLC_BUILD_DIR
}
"
${
vlc_config
}
--target
plugin
`
;
do
for
module
in
`
top_builddir
=
"
${
VLC_BUILD_DIR
}
"
${
vlc_config
}
--target
plugin
`
;
do
# Check to see that the reported module actually exists
# Check to see that the reported module actually exists
if
test
-n
${
module
}
;
then
if
test
-n
${
module
}
;
then
module_src
=
"
`
dirname
${
module
}
`
/.libs/
`
basename
${
module
}
`
.dylib"
module_src
=
"
`
dirname
${
module
}
`
/.libs/
`
basename
${
module
}
`
.dylib"
install_library
${
module_src
}
${
target_modules
}
"module"
install_library
${
module_src
}
${
target_modules
}
"module"
fi
fi
done
done
# Build the modules folder
# Build the modules folder
##########################
##########################
fi
fi
\ No newline at end of file
extras/MacOSX/Framework/Sources/VLCAudio.m
View file @
db4a6b82
...
@@ -35,50 +35,50 @@ NSString *VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
...
@@ -35,50 +35,50 @@ NSString *VLCMediaPlayerVolumeChanged = @"VLCMediaPlayerVolumeChanged";
-
(
id
)
init
-
(
id
)
init
{
{
return
nil
;
return
nil
;
}
}
-
(
id
)
initWithLibrary
:(
VLCLibrary
*
)
aLibrary
-
(
id
)
initWithLibrary
:(
VLCLibrary
*
)
aLibrary
{
{
if
(
!
[
library
audio
]
&&
(
self
=
[
super
init
]))
if
(
!
[
library
audio
]
&&
(
self
=
[
super
init
]))
{
{
library
=
aLibrary
;
library
=
aLibrary
;
[
library
setAudio
:
self
];
[
library
setAudio
:
self
];
}
}
return
self
;
return
self
;
}
}
-
(
void
)
setMute
:(
BOOL
)
value
-
(
void
)
setMute
:(
BOOL
)
value
{
{
libvlc_audio_set_mute
([
library
instance
],
value
,
NULL
);
libvlc_audio_set_mute
([
library
instance
],
value
,
NULL
);
}
}
-
(
BOOL
)
isMuted
-
(
BOOL
)
isMuted
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
BOOL
result
=
libvlc_audio_get_mute
([
library
instance
],
&
ex
);
BOOL
result
=
libvlc_audio_get_mute
([
library
instance
],
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setVolume
:(
int
)
value
-
(
void
)
setVolume
:(
int
)
value
{
{
if
(
value
<
0
)
if
(
value
<
0
)
value
=
0
;
value
=
0
;
else
if
(
value
>
200
)
else
if
(
value
>
200
)
value
=
200
;
value
=
200
;
libvlc_audio_set_volume
([
library
instance
],
value
,
NULL
);
libvlc_audio_set_volume
([
library
instance
],
value
,
NULL
);
}
}
-
(
int
)
volume
-
(
int
)
volume
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_audio_get_volume
([
library
instance
],
&
ex
);
int
result
=
libvlc_audio_get_volume
([
library
instance
],
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
@end
@end
\ No newline at end of file
extras/MacOSX/Framework/Sources/VLCEventManager.m
View file @
db4a6b82
...
@@ -71,9 +71,9 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -71,9 +71,9 @@ static void * EventDispatcherMainLoop(void * user_data)
/* Wait until we have something on the queue */
/* Wait until we have something on the queue */
while
([[
self
messageQueue
]
count
]
<=
0
)
while
([[
self
messageQueue
]
count
]
<=
0
)
{
{
pthread_cond_wait
(
[
self
signalData
],
[
self
queueLock
]
);
pthread_cond_wait
(
[
self
signalData
],
[
self
queueLock
]
);
}
}
message
=
(
struct
message
*
)[(
NSData
*
)[[
self
messageQueue
]
lastObject
]
bytes
];
message
=
(
struct
message
*
)[(
NSData
*
)[[
self
messageQueue
]
lastObject
]
bytes
];
/* Don't send the same notification twice */
/* Don't send the same notification twice */
...
@@ -84,7 +84,7 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -84,7 +84,7 @@ static void * EventDispatcherMainLoop(void * user_data)
message_newer
=
(
struct
message
*
)[(
NSData
*
)[[
self
messageQueue
]
objectAtIndex
:
i
]
bytes
];
message_newer
=
(
struct
message
*
)[(
NSData
*
)[[
self
messageQueue
]
objectAtIndex
:
i
]
bytes
];
if
(
message_newer
->
type
!=
VLCNotification
)
if
(
message_newer
->
type
!=
VLCNotification
)
continue
;
continue
;
if
(
message_newer
->
target
==
message
->
target
&&
message_newer
->
target
==
message
->
target
&&
[
message_newer
->
u
.
name
isEqualToString
:
message
->
u
.
name
]
)
if
(
message_newer
->
target
==
message
->
target
&&
message_newer
->
target
==
message
->
target
&&
[
message_newer
->
u
.
name
isEqualToString
:
message
->
u
.
name
]
)
{
{
[
message_newer
->
target
release
];
[
message_newer
->
target
release
];
...
@@ -110,7 +110,7 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -110,7 +110,7 @@ static void * EventDispatcherMainLoop(void * user_data)
[
pool
release
];
[
pool
release
];
};
};
return
nil
;
return
nil
;
}
}
@implementation
VLCEventManager
@implementation
VLCEventManager
...
@@ -143,7 +143,7 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -143,7 +143,7 @@ static void * EventDispatcherMainLoop(void * user_data)
pthread_kill
(
dispatcherThread
,
SIGKILL
);
pthread_kill
(
dispatcherThread
,
SIGKILL
);
pthread_join
(
dispatcherThread
,
NULL
);
pthread_join
(
dispatcherThread
,
NULL
);
[
messageQueue
release
];
[
messageQueue
release
];
[
super
dealloc
];
[
super
dealloc
];
}
}
...
@@ -151,14 +151,14 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -151,14 +151,14 @@ static void * EventDispatcherMainLoop(void * user_data)
{
{
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
struct
message
message
=
struct
message
message
=
{
{
[
aTarget
retain
],
[
aTarget
retain
],
aSelector
,
aSelector
,
[
aNotificationName
retain
],
[
aNotificationName
retain
],
VLCNotification
VLCNotification
};
};
pthread_mutex_lock
(
[
self
queueLock
]
);
pthread_mutex_lock
(
[
self
queueLock
]
);
[[
self
messageQueue
]
insertObject
:[
NSData
dataWithBytes
:
&
message
length
:
sizeof
(
struct
message
)]
atIndex
:
0
];
[[
self
messageQueue
]
insertObject
:[
NSData
dataWithBytes
:
&
message
length
:
sizeof
(
struct
message
)]
atIndex
:
0
];
pthread_cond_signal
(
[
self
signalData
]
);
pthread_cond_signal
(
[
self
signalData
]
);
...
@@ -172,18 +172,18 @@ static void * EventDispatcherMainLoop(void * user_data)
...
@@ -172,18 +172,18 @@ static void * EventDispatcherMainLoop(void * user_data)
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
NSAutoreleasePool
*
pool
=
[[
NSAutoreleasePool
alloc
]
init
];
struct
message
message
=
struct
message
message
=
{
{
[
aTarget
retain
],
[
aTarget
retain
],
aSelector
,
aSelector
,
[
arg
retain
],
[
arg
retain
],
VLCObjectMethodWithObjectArg
VLCObjectMethodWithObjectArg
};
};
pthread_mutex_lock
(
[
self
queueLock
]
);
pthread_mutex_lock
(
[
self
queueLock
]
);
[[
self
messageQueue
]
insertObject
:[
NSData
dataWithBytes
:
&
message
length
:
sizeof
(
struct
message
)]
atIndex
:
0
];
[[
self
messageQueue
]
insertObject
:[
NSData
dataWithBytes
:
&
message
length
:
sizeof
(
struct
message
)]
atIndex
:
0
];
pthread_cond_signal
(
[
self
signalData
]
);
pthread_cond_signal
(
[
self
signalData
]
);
pthread_mutex_unlock
(
[
self
queueLock
]
);
pthread_mutex_unlock
(
[
self
queueLock
]
);
[
pool
release
];
[
pool
release
];
}
}
@end
@end
...
...
extras/MacOSX/Framework/Sources/VLCLibrary.m
View file @
db4a6b82
...
@@ -32,110 +32,110 @@ static VLCLibrary *sharedLibrary = nil;
...
@@ -32,110 +32,110 @@ static VLCLibrary *sharedLibrary = nil;
// TODO: Change from a terminal error to raising an exception?
// TODO: Change from a terminal error to raising an exception?
void
__quit_on_exception
(
void
*
e
,
const
char
*
function
,
const
char
*
file
,
int
line_number
)
void
__quit_on_exception
(
void
*
e
,
const
char
*
function
,
const
char
*
file
,
int
line_number
)
{
{
libvlc_exception_t
*
ex
=
(
libvlc_exception_t
*
)
e
;
libvlc_exception_t
*
ex
=
(
libvlc_exception_t
*
)
e
;
if
(
libvlc_exception_raised
(
ex
))
if
(
libvlc_exception_raised
(
ex
))
{
{
/* XXX: localization */
/* XXX: localization */
NSRunCriticalAlertPanel
(
@"Error"
,
[
NSString
stringWithFormat
:
@"libvlc has thrown us an error: %s (%s:%d %s)"
,
NSRunCriticalAlertPanel
(
@"Error"
,
[
NSString
stringWithFormat
:
@"libvlc has thrown us an error: %s (%s:%d %s)"
,
libvlc_exception_get_message
(
ex
),
file
,
line_number
,
function
],
@"Quit"
,
nil
,
nil
);
libvlc_exception_get_message
(
ex
),
file
,
line_number
,
function
],
@"Quit"
,
nil
,
nil
);
exit
(
ex
->
i_code
);
exit
(
ex
->
i_code
);
}
}
}
}
static
void
*
DestroySharedLibraryAtExit
()
static
void
*
DestroySharedLibraryAtExit
()
{
{
// Destroy the shared library
// Destroy the shared library
if
(
sharedLibrary
)
if
(
sharedLibrary
)
[
sharedLibrary
release
];
[
sharedLibrary
release
];
sharedLibrary
=
nil
;
sharedLibrary
=
nil
;
return
nil
;
return
nil
;
}
}
@implementation
VLCLibrary
@implementation
VLCLibrary
+
(
VLCLibrary
*
)
sharedLibrary
+
(
VLCLibrary
*
)
sharedLibrary
{
{
if
(
!
sharedLibrary
)
if
(
!
sharedLibrary
)
{
{
// Initialize a shared instance
// Initialize a shared instance
[[
self
alloc
]
init
];
[[
self
alloc
]
init
];
// Register a function to gracefully destroy the shared library on exit.
// Register a function to gracefully destroy the shared library on exit.
atexit
((
void
*
)
DestroySharedLibraryAtExit
);
atexit
((
void
*
)
DestroySharedLibraryAtExit
);
}
}
return
sharedLibrary
;
return
sharedLibrary
;
}
}
+
(
void
*
)
sharedInstance
+
(
void
*
)
sharedInstance
{
{
return
[[
self
sharedLibrary
]
instance
];
return
[[
self
sharedLibrary
]
instance
];
}
}
-
(
id
)
init
-
(
id
)
init
{
{
if
(
self
=
[
super
init
])
if
(
self
=
[
super
init
])
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
// Figure out the frameworks path
// Figure out the frameworks path
char
*
applicationPath
=
strdup
([[
NSString
stringWithFormat
:
@"%@/Versions/Current/VLC"
,
char
*
applicationPath
=
strdup
([[
NSString
stringWithFormat
:
@"%@/Versions/Current/VLC"
,
[[
NSBundle
bundleForClass
:[
VLCLibrary
class
]]
bundlePath
]]
UTF8String
]);
[[
NSBundle
bundleForClass
:[
VLCLibrary
class
]]
bundlePath
]]
UTF8String
]);
// TODO: Raise error if there is no memory available
// TODO: Raise error if there is no memory available
char
*
lib_vlc_params
[]
=
{
char
*
lib_vlc_params
[]
=
{
applicationPath
,
"-I"
,
"dummy"
,
"-vvvv"
,
applicationPath
,
"-I"
,
"dummy"
,
"-vvvv"
,
"--opengl-provider"
,
"minimal_macosx"
,
"--opengl-provider"
,
"minimal_macosx"
,
"--no-video-title-show"
,
NULL
"--no-video-title-show"
,
NULL
};
};
instance
=
(
void
*
)
libvlc_new
(
7
,
lib_vlc_params
,
&
ex
);
instance
=
(
void
*
)
libvlc_new
(
7
,
lib_vlc_params
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
if
(
!
sharedLibrary
)
if
(
!
sharedLibrary
)
sharedLibrary
=
[[
self
retain
]
autorelease
];
sharedLibrary
=
[[
self
retain
]
autorelease
];
// Assignment unneeded, as the audio unit will do it for us
// Assignment unneeded, as the audio unit will do it for us
/*audio = */
[[
VLCAudio
alloc
]
initWithLibrary
:
self
];
/*audio = */
[[
VLCAudio
alloc
]
initWithLibrary
:
self
];
// free allocated resources
// free allocated resources
free
(
applicationPath
);
free
(
applicationPath
);
}
}
return
self
;
return
self
;
}
}
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
// TODO: libvlc core locks up or has segfaults while shutting down, the
// TODO: libvlc core locks up or has segfaults while shutting down, the
// following code allows for the framework to be removed without crashing
// following code allows for the framework to be removed without crashing
// the host application.
// the host application.
@try
@try
{
{
if
(
instance
)
if
(
instance
)
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_destroy
(
instance
,
&
ex
);
libvlc_destroy
(
instance
,
&
ex
);
}
}
}
}
@finally
@finally
{
{
instance
=
nil
;
instance
=
nil
;
[
audio
release
];
[
audio
release
];
[
super
dealloc
];
[
super
dealloc
];
}
}
}
}
-
(
void
*
)
instance
-
(
void
*
)
instance
{
{
return
instance
;
return
instance
;
}
}
-
(
VLCAudio
*
)
audio
-
(
VLCAudio
*
)
audio
{
{
return
audio
;
return
audio
;
}
}
@end
@end
...
@@ -144,8 +144,8 @@ static void *DestroySharedLibraryAtExit()
...
@@ -144,8 +144,8 @@ static void *DestroySharedLibraryAtExit()
-
(
void
)
setAudio
:(
VLCAudio
*
)
value
-
(
void
)
setAudio
:(
VLCAudio
*
)
value
{
{
if
(
!
audio
)
if
(
!
audio
)
audio
=
value
;
audio
=
value
;
}
}
@end
@end
...
...
extras/MacOSX/Framework/Sources/VLCMediaList.m
View file @
db4a6b82
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
#include <vlc/libvlc.h>
#include <vlc/libvlc.h>
/* Notification Messages */
/* Notification Messages */
NSString
*
VLCMediaListItemAdded
=
@"VLCMediaListItemAdded"
;
NSString
*
VLCMediaListItemAdded
=
@"VLCMediaListItemAdded"
;
NSString
*
VLCMediaListItemDeleted
=
@"VLCMediaListItemDeleted"
;
NSString
*
VLCMediaListItemDeleted
=
@"VLCMediaListItemDeleted"
;
// TODO: Documentation
// TODO: Documentation
@interface
VLCMediaList
(
Private
)
@interface
VLCMediaList
(
Private
)
...
@@ -49,26 +49,26 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
...
@@ -49,26 +49,26 @@ NSString *VLCMediaListItemDeleted = @"VLCMediaListItemDeleted";
static
void
HandleMediaListItemAdded
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
static
void
HandleMediaListItemAdded
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
{
id
self
=
user_data
;
id
self
=
user_data
;
// Check to see if the last item added is this item we're trying to introduce
// Check to see if the last item added is this item we're trying to introduce
// If no, then add the item to the local list, otherwise, the item has already
// If no, then add the item to the local list, otherwise, the item has already
// been added
// been added
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaListItemAdded
:)
withMethod:
@selector
(
mediaListItemAdded
:)
withArgumentAsObject:
[
NSArray
arrayWithObjects
:[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
event
->
u
.
media_list_item_added
.
item
],
withArgumentAsObject:
[
NSArray
arrayWithObjects
:[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
event
->
u
.
media_list_item_added
.
item
],
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_added
.
index
],
nil
]];
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_added
.
index
],
nil
]];
}
}
static
void
HandleMediaListItemDeleted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
static
void
HandleMediaListItemDeleted
(
const
libvlc_event_t
*
event
,
void
*
user_data
)
{
{
id
self
=
user_data
;
id
self
=
user_data
;
// Check to see if the last item deleted is this item we're trying delete now.
// Check to see if the last item deleted is this item we're trying delete now.
// If no, then delete the item from the local list, otherwise, the item has already
// If no, then delete the item from the local list, otherwise, the item has already
// been deleted
// been deleted
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadObject
:
self
withMethod:
@selector
(
mediaListItemRemoved
:)
withMethod:
@selector
(
mediaListItemRemoved
:)
withArgumentAsObject:
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_deleted
.
index
]];
withArgumentAsObject:
[
NSNumber
numberWithInt
:
event
->
u
.
media_list_item_deleted
.
index
]];
}
}
@implementation
VLCMediaList
@implementation
VLCMediaList
...
@@ -77,14 +77,14 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -77,14 +77,14 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
{
{
if
(
self
=
[
super
init
])
if
(
self
=
[
super
init
])
{
{
// Create a new libvlc media list instance
// Create a new libvlc media list instance
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
p_mlist
=
libvlc_media_list_new
([
VLCLibrary
sharedInstance
],
&
p_e
);
p_mlist
=
libvlc_media_list_new
([
VLCLibrary
sharedInstance
],
&
p_e
);
quit_on_exception
(
&
p_e
);
quit_on_exception
(
&
p_e
);
// Initialize internals to defaults
// Initialize internals to defaults
delegate
=
nil
;
delegate
=
nil
;
[
self
initInternalMediaList
];
[
self
initInternalMediaList
];
}
}
return
self
;
return
self
;
...
@@ -109,20 +109,20 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -109,20 +109,20 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
// Release allocated memory
// Release allocated memory
libvlc_media_list_release
(
p_mlist
);
libvlc_media_list_release
(
p_mlist
);
[
super
dealloc
];
[
super
dealloc
];
}
}
-
(
void
)
setDelegate
:(
id
)
value
-
(
void
)
setDelegate
:(
id
)
value
{
{
delegate
=
value
;
delegate
=
value
;
}
}
-
(
id
)
delegate
-
(
id
)
delegate
{
{
return
delegate
;
return
delegate
;
}
}
-
(
void
)
lock
-
(
void
)
lock
...
@@ -137,16 +137,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -137,16 +137,16 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
-
(
int
)
addMedia
:(
VLCMedia
*
)
media
-
(
int
)
addMedia
:(
VLCMedia
*
)
media
{
{
int
index
=
[
self
count
];
int
index
=
[
self
count
];
[
self
insertMedia
:
media
atIndex
:
index
];
[
self
insertMedia
:
media
atIndex
:
index
];
return
index
;
return
index
;
}
}
-
(
void
)
insertMedia
:(
VLCMedia
*
)
media
atIndex
:
(
int
)
index
-
(
void
)
insertMedia
:(
VLCMedia
*
)
media
atIndex
:
(
int
)
index
{
{
[
media
retain
];
[
media
retain
];
// Add it to the libvlc's medialist
// Add it to the libvlc's medialist
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
libvlc_media_list_insert_media_descriptor
(
p_mlist
,
[
media
libVLCMediaDescriptor
],
index
,
&
p_e
);
libvlc_media_list_insert_media_descriptor
(
p_mlist
,
[
media
libVLCMediaDescriptor
],
index
,
&
p_e
);
...
@@ -155,9 +155,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -155,9 +155,9 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
-
(
void
)
removeMediaAtIndex
:(
int
)
index
-
(
void
)
removeMediaAtIndex
:(
int
)
index
{
{
[[
self
mediaAtIndex
:
index
]
release
];
[[
self
mediaAtIndex
:
index
]
release
];
// Remove it from the libvlc's medialist
// Remove it from the libvlc's medialist
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
libvlc_media_list_remove_index
(
p_mlist
,
index
,
&
p_e
);
libvlc_media_list_remove_index
(
p_mlist
,
index
,
&
p_e
);
...
@@ -166,34 +166,34 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -166,34 +166,34 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
-
(
VLCMedia
*
)
mediaAtIndex
:(
int
)
index
-
(
VLCMedia
*
)
mediaAtIndex
:(
int
)
index
{
{
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
libvlc_media_descriptor_t
*
p_md
=
libvlc_media_list_item_at_index
(
p_mlist
,
index
,
&
p_e
);
libvlc_media_descriptor_t
*
p_md
=
libvlc_media_list_item_at_index
(
p_mlist
,
index
,
&
p_e
);
quit_on_exception
(
&
p_e
);
quit_on_exception
(
&
p_e
);
// Returns local object for media descriptor, searchs for user data first. If not found it creates a
// Returns local object for media descriptor, searchs for user data first. If not found it creates a
// new cocoa object representation of the media descriptor.
// new cocoa object representation of the media descriptor.
return
[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
p_md
];
return
[
VLCMedia
mediaWithLibVLCMediaDescriptor
:
p_md
];
}
}
-
(
int
)
count
-
(
int
)
count
{
{
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
int
result
=
libvlc_media_list_count
(
p_mlist
,
&
p_e
);
int
result
=
libvlc_media_list_count
(
p_mlist
,
&
p_e
);
quit_on_exception
(
&
p_e
);
quit_on_exception
(
&
p_e
);
return
result
;
return
result
;
}
}
-
(
int
)
indexOfMedia
:(
VLCMedia
*
)
media
-
(
int
)
indexOfMedia
:(
VLCMedia
*
)
media
{
{
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
int
result
=
libvlc_media_list_index_of_item
(
p_mlist
,
[
media
libVLCMediaDescriptor
],
&
p_e
);
int
result
=
libvlc_media_list_index_of_item
(
p_mlist
,
[
media
libVLCMediaDescriptor
],
&
p_e
);
quit_on_exception
(
&
p_e
);
quit_on_exception
(
&
p_e
);
return
result
;
return
result
;
}
}
-
(
NSArray
*
)
sublists
-
(
NSArray
*
)
sublists
...
@@ -277,7 +277,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -277,7 +277,7 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
-
(
void
)
initInternalMediaList
-
(
void
)
initInternalMediaList
{
{
// Add event callbacks
// Add event callbacks
[
self
lock
];
[
self
lock
];
libvlc_exception_t
p_e
;
libvlc_exception_t
p_e
;
libvlc_exception_init
(
&
p_e
);
libvlc_exception_init
(
&
p_e
);
...
@@ -286,40 +286,40 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
...
@@ -286,40 +286,40 @@ static void HandleMediaListItemDeleted( const libvlc_event_t * event, void * use
libvlc_event_attach
(
p_em
,
libvlc_MediaListItemAdded
,
HandleMediaListItemAdded
,
self
,
&
p_e
);
libvlc_event_attach
(
p_em
,
libvlc_MediaListItemAdded
,
HandleMediaListItemAdded
,
self
,
&
p_e
);
libvlc_event_attach
(
p_em
,
libvlc_MediaListItemDeleted
,
HandleMediaListItemDeleted
,
self
,
&
p_e
);
libvlc_event_attach
(
p_em
,
libvlc_MediaListItemDeleted
,
HandleMediaListItemDeleted
,
self
,
&
p_e
);
[
self
unlock
];
[
self
unlock
];
quit_on_exception
(
&
p_e
);
quit_on_exception
(
&
p_e
);
}
}
-
(
void
)
mediaListItemAdded
:(
NSArray
*
)
args
-
(
void
)
mediaListItemAdded
:(
NSArray
*
)
args
{
{
VLCMedia
*
media
=
[
args
objectAtIndex
:
0
];
VLCMedia
*
media
=
[
args
objectAtIndex
:
0
];
NSNumber
*
index
=
[
args
objectAtIndex
:
1
];
NSNumber
*
index
=
[
args
objectAtIndex
:
1
];
// Post the notification
// Post the notification
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCMediaListItemAdded
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCMediaListItemAdded
object:
self
object:
self
userInfo:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
userInfo:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
media
,
@"media"
,
media
,
@"media"
,
index
,
@"index"
,
index
,
@"index"
,
nil
]];
nil
]];
// Let the delegate know that the item was added
// Let the delegate know that the item was added
if
(
delegate
&&
[
delegate
respondsToSelector
:
@selector
(
mediaList
:
mediaAdded
:
atIndex
:
)])
if
(
delegate
&&
[
delegate
respondsToSelector
:
@selector
(
mediaList
:
mediaAdded
:
atIndex
:
)])
[
delegate
mediaList
:
self
mediaAdded
:
media
atIndex
:
[
index
intValue
]];
[
delegate
mediaList
:
self
mediaAdded
:
media
atIndex
:
[
index
intValue
]];
}
}
-
(
void
)
mediaListItemRemoved
:(
NSNumber
*
)
index
-
(
void
)
mediaListItemRemoved
:(
NSNumber
*
)
index
{
{
// Post the notification
// Post the notification
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCMediaListItemDeleted
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCMediaListItemDeleted
object:
self
object:
self
userInfo:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
userInfo:
[
NSDictionary
dictionaryWithObjectsAndKeys
:
index
,
@"index"
,
index
,
@"index"
,
nil
]];
nil
]];
// Let the delegate know that the item is being removed
// Let the delegate know that the item is being removed
if
(
delegate
&&
[
delegate
respondsToSelector
:
@selector
(
mediaList
:
mediaRemovedAtIndex
:
)])
if
(
delegate
&&
[
delegate
respondsToSelector
:
@selector
(
mediaList
:
mediaRemovedAtIndex
:
)])
[
delegate
mediaList
:
self
mediaRemovedAtIndex
:
index
];
[
delegate
mediaList
:
self
mediaRemovedAtIndex
:
index
];
}
}
@end
@end
...
...
extras/MacOSX/Framework/Sources/VLCMediaPlayer.m
View file @
db4a6b82
...
@@ -37,37 +37,37 @@ NSString *VLCMediaPlayerStateChanged = @"VLCMediaPlayerStateChanged";
...
@@ -37,37 +37,37 @@ NSString *VLCMediaPlayerStateChanged = @"VLCMediaPlayerStateChanged";
static
void
HandleMediaInstanceVolumeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
static
void
HandleMediaInstanceVolumeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
{
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
withDelegateMethod:
@selector
(
mediaPlayerVolumeChanged
:)
withDelegateMethod:
@selector
(
mediaPlayerVolumeChanged
:)
withNotificationName:
VLCMediaPlayerVolumeChanged
];
withNotificationName:
VLCMediaPlayerVolumeChanged
];
}
}
static
void
HandleMediaTimeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
static
void
HandleMediaTimeChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
{
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
withDelegateMethod:
@selector
(
mediaPlayerTimeChanged
:)
withDelegateMethod:
@selector
(
mediaPlayerTimeChanged
:)
withNotificationName:
VLCMediaPlayerTimeChanged
];
withNotificationName:
VLCMediaPlayerTimeChanged
];
}
}
static
void
HandleMediaInstanceStateChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
static
void
HandleMediaInstanceStateChanged
(
const
libvlc_event_t
*
event
,
void
*
self
)
{
{
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
[[
VLCEventManager
sharedManager
]
callOnMainThreadDelegateOfObject
:
self
withDelegateMethod:
@selector
(
mediaPlayerStateChanged
:)
withDelegateMethod:
@selector
(
mediaPlayerStateChanged
:)
withNotificationName:
VLCMediaPlayerStateChanged
];
withNotificationName:
VLCMediaPlayerStateChanged
];
}
}
NSString
*
VLCMediaPlayerStateToString
(
VLCMediaPlayerState
state
)
NSString
*
VLCMediaPlayerStateToString
(
VLCMediaPlayerState
state
)
{
{
static
NSString
*
stateToStrings
[]
=
{
static
NSString
*
stateToStrings
[]
=
{
[
VLCMediaPlayerStateStopped
]
=
@"VLCMediaPlayerStateStopped"
,
[
VLCMediaPlayerStateStopped
]
=
@"VLCMediaPlayerStateStopped"
,
[
VLCMediaPlayerStateOpening
]
=
@"VLCMediaPlayerStateOpening"
,
[
VLCMediaPlayerStateOpening
]
=
@"VLCMediaPlayerStateOpening"
,
[
VLCMediaPlayerStateBuffering
]
=
@"VLCMediaPlayerStateBuffering"
,
[
VLCMediaPlayerStateBuffering
]
=
@"VLCMediaPlayerStateBuffering"
,
[
VLCMediaPlayerStateEnded
]
=
@"VLCMediaPlayerStateEnded"
,
[
VLCMediaPlayerStateEnded
]
=
@"VLCMediaPlayerStateEnded"
,
[
VLCMediaPlayerStateError
]
=
@"VLCMediaPlayerStateError"
,
[
VLCMediaPlayerStateError
]
=
@"VLCMediaPlayerStateError"
,
[
VLCMediaPlayerStatePlaying
]
=
@"VLCMediaPlayerStatePlaying"
,
[
VLCMediaPlayerStatePlaying
]
=
@"VLCMediaPlayerStatePlaying"
,
[
VLCMediaPlayerStatePaused
]
=
@"VLCMediaPlayerStatePaused"
[
VLCMediaPlayerStatePaused
]
=
@"VLCMediaPlayerStatePaused"
};
};
return
stateToStrings
[
state
];
return
stateToStrings
[
state
];
}
}
// TODO: Documentation
// TODO: Documentation
...
@@ -82,344 +82,344 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -82,344 +82,344 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
-
(
id
)
init
-
(
id
)
init
{
{
self
=
[
self
initWithVideoView
:
nil
];
self
=
[
self
initWithVideoView
:
nil
];
return
self
;
return
self
;
}
}
-
(
id
)
initWithVideoView
:(
VLCVideoView
*
)
aVideoView
-
(
id
)
initWithVideoView
:(
VLCVideoView
*
)
aVideoView
{
{
if
(
self
=
[
super
init
])
if
(
self
=
[
super
init
])
{
{
delegate
=
nil
;
delegate
=
nil
;
media
=
nil
;
media
=
nil
;
// Create a media instance, it doesn't matter what library we start off with
// Create a media instance, it doesn't matter what library we start off with
// it will change depending on the media descriptor provided to the media
// it will change depending on the media descriptor provided to the media
// instance
// instance
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
instance
=
(
void
*
)
libvlc_media_instance_new
([
VLCLibrary
sharedInstance
],
&
ex
);
instance
=
(
void
*
)
libvlc_media_instance_new
([
VLCLibrary
sharedInstance
],
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
[
self
registerObservers
];
[
self
registerObservers
];
[
self
setVideoView
:
aVideoView
];
[
self
setVideoView
:
aVideoView
];
}
}
return
self
;
return
self
;
}
}
-
(
void
)
dealloc
-
(
void
)
dealloc
{
{
// Always get rid of the delegate first so we can stop sending messages to it
// Always get rid of the delegate first so we can stop sending messages to it
// TODO: Should we tell the delegate that we're shutting down?
// TODO: Should we tell the delegate that we're shutting down?
delegate
=
nil
;
delegate
=
nil
;
// Next get rid of the event managers so we can stop trapping events
// Next get rid of the event managers so we can stop trapping events
[
self
unregisterObservers
];
[
self
unregisterObservers
];
libvlc_media_instance_release
((
libvlc_media_instance_t
*
)
instance
);
libvlc_media_instance_release
((
libvlc_media_instance_t
*
)
instance
);
// Get rid of everything else
// Get rid of everything else
instance
=
nil
;
instance
=
nil
;
videoView
=
nil
;
videoView
=
nil
;
[
media
release
];
[
media
release
];
[
super
dealloc
];
[
super
dealloc
];
}
}
-
(
void
)
setDelegate
:(
id
)
value
-
(
void
)
setDelegate
:(
id
)
value
{
{
delegate
=
value
;
delegate
=
value
;
}
}
-
(
id
)
delegate
-
(
id
)
delegate
{
{
return
delegate
;
return
delegate
;
}
}
-
(
void
)
setVideoView
:(
VLCVideoView
*
)
value
-
(
void
)
setVideoView
:(
VLCVideoView
*
)
value
{
{
videoView
=
value
;
videoView
=
value
;
// Make sure that this instance has been associated with the drawing canvas.
// Make sure that this instance has been associated with the drawing canvas.
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_instance_set_drawable
((
libvlc_media_instance_t
*
)
instance
,
libvlc_media_instance_set_drawable
((
libvlc_media_instance_t
*
)
instance
,
(
libvlc_drawable_t
)
videoView
,
(
libvlc_drawable_t
)
videoView
,
&
ex
);
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
}
}
-
(
VLCVideoView
*
)
videoView
-
(
VLCVideoView
*
)
videoView
{
{
return
videoView
;
return
videoView
;
}
}
-
(
void
)
setFullscreen
:(
BOOL
)
value
-
(
void
)
setFullscreen
:(
BOOL
)
value
{
{
libvlc_set_fullscreen
(
instance
,
value
,
NULL
);
libvlc_set_fullscreen
(
instance
,
value
,
NULL
);
}
}
-
(
BOOL
)
fullscreen
-
(
BOOL
)
fullscreen
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_get_fullscreen
(
instance
,
&
ex
);
int
result
=
libvlc_get_fullscreen
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setVideoAspectRatio
:(
char
*
)
value
-
(
void
)
setVideoAspectRatio
:(
char
*
)
value
{
{
libvlc_video_set_aspect_ratio
(
instance
,
value
,
NULL
);
libvlc_video_set_aspect_ratio
(
instance
,
value
,
NULL
);
}
}
-
(
char
*
)
videoAspectRatio
-
(
char
*
)
videoAspectRatio
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
char
*
result
=
libvlc_video_get_aspect_ratio
(
instance
,
&
ex
);
char
*
result
=
libvlc_video_get_aspect_ratio
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setVideoSubTitles
:(
int
)
value
-
(
void
)
setVideoSubTitles
:(
int
)
value
{
{
libvlc_video_set_spu
(
instance
,
value
,
NULL
);
libvlc_video_set_spu
(
instance
,
value
,
NULL
);
}
}
-
(
int
)
videoSubTitles
-
(
int
)
videoSubTitles
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_video_get_spu
(
instance
,
&
ex
);
int
result
=
libvlc_video_get_spu
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setVideoCropGeometry
:(
char
*
)
value
-
(
void
)
setVideoCropGeometry
:(
char
*
)
value
{
{
libvlc_video_set_crop_geometry
(
instance
,
value
,
NULL
);
libvlc_video_set_crop_geometry
(
instance
,
value
,
NULL
);
}
}
-
(
char
*
)
videoCropGeometry
-
(
char
*
)
videoCropGeometry
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
char
*
result
=
libvlc_video_get_crop_geometry
(
instance
,
&
ex
);
char
*
result
=
libvlc_video_get_crop_geometry
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setVideoTeleText
:(
int
)
value
-
(
void
)
setVideoTeleText
:(
int
)
value
{
{
libvlc_video_set_teletext
(
instance
,
value
,
NULL
);
libvlc_video_set_teletext
(
instance
,
value
,
NULL
);
}
}
-
(
int
)
videoTeleText
-
(
int
)
videoTeleText
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_video_get_teletext
(
instance
,
&
ex
);
int
result
=
libvlc_video_get_teletext
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setRate
:(
int
)
value
-
(
void
)
setRate
:(
int
)
value
{
{
libvlc_media_instance_set_rate
(
instance
,
value
,
NULL
);
libvlc_media_instance_set_rate
(
instance
,
value
,
NULL
);
}
}
-
(
int
)
rate
-
(
int
)
rate
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
float
result
=
libvlc_media_instance_get_rate
(
instance
,
&
ex
);
float
result
=
libvlc_media_instance_get_rate
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
NSSize
)
videoSize
-
(
NSSize
)
videoSize
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
NSSize
result
=
NSMakeSize
(
libvlc_video_get_height
((
libvlc_media_instance_t
*
)
instance
,
&
ex
),
NSSize
result
=
NSMakeSize
(
libvlc_video_get_height
((
libvlc_media_instance_t
*
)
instance
,
&
ex
),
libvlc_video_get_width
((
libvlc_media_instance_t
*
)
instance
,
&
ex
));
libvlc_video_get_width
((
libvlc_media_instance_t
*
)
instance
,
&
ex
));
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
BOOL
)
hasVideoOut
-
(
BOOL
)
hasVideoOut
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
BOOL
result
=
libvlc_media_instance_has_vout
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
BOOL
result
=
libvlc_media_instance_has_vout
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
))
if
(
libvlc_exception_raised
(
&
ex
))
{
{
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
NO
;
return
NO
;
}
}
else
else
return
result
;
return
result
;
}
}
-
(
float
)
framesPerSecond
-
(
float
)
framesPerSecond
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
float
result
=
libvlc_media_instance_get_fps
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
float
result
=
libvlc_media_instance_get_fps
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setTime
:(
VLCTime
*
)
value
-
(
void
)
setTime
:(
VLCTime
*
)
value
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
// Time is managed in seconds, while duration is managed in microseconds
// Time is managed in seconds, while duration is managed in microseconds
// TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
// TODO: Redo VLCTime to provide value numberAsMilliseconds, numberAsMicroseconds, numberAsSeconds, numberAsMinutes, numberAsHours
libvlc_media_instance_set_time
((
libvlc_media_instance_t
*
)
instance
,
libvlc_media_instance_set_time
((
libvlc_media_instance_t
*
)
instance
,
(
value
?
[[
value
numberValue
]
longLongValue
]
/
1000
:
0
),
(
value
?
[[
value
numberValue
]
longLongValue
]
/
1000
:
0
),
&
ex
);
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
}
}
-
(
VLCTime
*
)
time
-
(
VLCTime
*
)
time
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
// Results are returned in seconds...duration is returned in milliseconds
// Results are returned in seconds...duration is returned in milliseconds
long
long
time
=
libvlc_media_instance_get_time
((
libvlc_media_instance_t
*
)
instance
,
&
ex
)
*
1000
;
long
long
time
=
libvlc_media_instance_get_time
((
libvlc_media_instance_t
*
)
instance
,
&
ex
)
*
1000
;
if
(
libvlc_exception_raised
(
&
ex
))
if
(
libvlc_exception_raised
(
&
ex
))
{
{
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
[
VLCTime
nullTime
];
// Error in obtaining the time, return a null time defintition (--:--:--)
return
[
VLCTime
nullTime
];
// Error in obtaining the time, return a null time defintition (--:--:--)
}
}
else
else
return
[
VLCTime
timeWithNumber
:[
NSNumber
numberWithLongLong
:
time
]];
return
[
VLCTime
timeWithNumber
:[
NSNumber
numberWithLongLong
:
time
]];
}
}
-
(
void
)
setAudioTrack
:(
int
)
value
-
(
void
)
setAudioTrack
:(
int
)
value
{
{
libvlc_audio_set_track
(
instance
,
value
,
NULL
);
libvlc_audio_set_track
(
instance
,
value
,
NULL
);
}
}
-
(
int
)
audioTrack
-
(
int
)
audioTrack
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_audio_get_track
(
instance
,
&
ex
);
int
result
=
libvlc_audio_get_track
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setAudioChannel
:(
int
)
value
-
(
void
)
setAudioChannel
:(
int
)
value
{
{
libvlc_audio_set_channel
(
instance
,
value
,
NULL
);
libvlc_audio_set_channel
(
instance
,
value
,
NULL
);
}
}
-
(
int
)
audioChannel
-
(
int
)
audioChannel
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_audio_get_channel
(
instance
,
&
ex
);
int
result
=
libvlc_audio_get_channel
(
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
result
;
return
result
;
}
}
-
(
void
)
setMedia
:(
VLCMedia
*
)
value
-
(
void
)
setMedia
:(
VLCMedia
*
)
value
{
{
// We only know how to play media files...not media resources with subitems
// We only know how to play media files...not media resources with subitems
if
(
media
!=
value
&&
[
media
subitems
]
==
nil
)
if
(
media
!=
value
&&
[
media
subitems
]
==
nil
)
{
{
if
(
media
&&
[
media
compare
:
value
]
==
NSOrderedSame
)
if
(
media
&&
[
media
compare
:
value
]
==
NSOrderedSame
)
return
;
return
;
BOOL
wasPlaying
;
BOOL
wasPlaying
;
if
(
wasPlaying
=
[
self
isPlaying
])
if
(
wasPlaying
=
[
self
isPlaying
])
{
{
[
self
pause
];
[
self
pause
];
//
// TODO: Should we wait until it stops playing?
//
// TODO: Should we wait until it stops playing?
//
while ([self isPlaying])
//
while ([self isPlaying])
//
usleep(1000);
//
usleep(1000);
}
}
[
self
willChangeValueForKey
:
@"media"
];
[
self
willChangeValueForKey
:
@"media"
];
[
media
release
];
[
media
release
];
media
=
[
value
retain
];
media
=
[
value
retain
];
[
self
didChangeValueForKey
:
@"media"
];
[
self
didChangeValueForKey
:
@"media"
];
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_instance_set_media_descriptor
(
instance
,
[
media
libVLCMediaDescriptor
],
&
ex
);
libvlc_media_instance_set_media_descriptor
(
instance
,
[
media
libVLCMediaDescriptor
],
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
if
(
media
)
{
if
(
media
)
{
if
(
wasPlaying
)
if
(
wasPlaying
)
[
self
play
];
[
self
play
];
}
}
}
}
}
}
-
(
VLCMedia
*
)
media
-
(
VLCMedia
*
)
media
{
{
return
media
;
return
media
;
}
}
-
(
BOOL
)
play
-
(
BOOL
)
play
{
{
// Return if there is no media available or if the stream is already playing something
// Return if there is no media available or if the stream is already playing something
if
(
!
media
||
[
self
isPlaying
])
if
(
!
media
||
[
self
isPlaying
])
return
[
self
isPlaying
];
return
[
self
isPlaying
];
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_instance_play
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
libvlc_media_instance_play
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
return
YES
;
return
YES
;
}
}
-
(
void
)
pause
-
(
void
)
pause
{
{
// Return if there is no media available or if the stream is not paused or
// Return if there is no media available or if the stream is not paused or
// playing something else
// playing something else
if
(
!
media
||
(
!
[
self
isPlaying
]
&&
[
self
state
]
!=
VLCMediaPlayerStatePaused
))
if
(
!
media
||
(
!
[
self
isPlaying
]
&&
[
self
state
]
!=
VLCMediaPlayerStatePaused
))
return
;
return
;
// Should never get here.
// Should never get here.
if
(
!
instance
)
if
(
!
instance
)
return
;
return
;
// Pause the stream
// Pause the stream
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_instance_pause
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
libvlc_media_instance_pause
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
// TODO: Should we record the time in case the media instance is destroyed
// TODO: Should we record the time in case the media instance is destroyed
// then rebuilt?
// then rebuilt?
}
}
-
(
void
)
stop
-
(
void
)
stop
{
{
// Return if there is no media available or if the system is not in play status
// Return if there is no media available or if the system is not in play status
// or pause status.
// or pause status.
if
(
!
media
||
(
!
[
self
isPlaying
]
&&
[
self
state
]
!=
VLCMediaPlayerStatePaused
))
if
(
!
media
||
(
!
[
self
isPlaying
]
&&
[
self
state
]
!=
VLCMediaPlayerStatePaused
))
return
;
return
;
// The following is not implemented in the core, should I fix it or just
// The following is not implemented in the core, should I fix it or just
// compensate?
// compensate?
//
libvlc_exception_t ex;
//
libvlc_exception_t ex;
//
libvlc_exception_init(&ex);
//
libvlc_exception_init(&ex);
//
libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex);
//
libvlc_media_instance_stop((libvlc_media_instance_t *)instance, &ex);
//
quit_on_exception(&ex);
//
quit_on_exception(&ex);
// Pause and reposition to the begining of the stream.
// Pause and reposition to the begining of the stream.
[
self
pause
];
[
self
pause
];
[
self
setTime
:
0
];
[
self
setTime
:
0
];
// TODO: Should we pause this or destroy the media instance so that it appears as being "stopped"?
// TODO: Should we pause this or destroy the media instance so that it appears as being "stopped"?
}
}
//- (void)fastForward;
//- (void)fastForward;
...
@@ -429,52 +429,52 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
...
@@ -429,52 +429,52 @@ NSString *VLCMediaPlayerStateToString(VLCMediaPlayerState state)
-
(
BOOL
)
isPlaying
-
(
BOOL
)
isPlaying
{
{
VLCMediaPlayerState
state
=
[
self
state
];
VLCMediaPlayerState
state
=
[
self
state
];
return
((
state
==
VLCMediaPlayerStateOpening
)
||
(
state
==
VLCMediaPlayerStateBuffering
)
||
return
((
state
==
VLCMediaPlayerStateOpening
)
||
(
state
==
VLCMediaPlayerStateBuffering
)
||
(
state
==
VLCMediaPlayerStatePlaying
));
(
state
==
VLCMediaPlayerStatePlaying
));
}
}
-
(
BOOL
)
willPlay
-
(
BOOL
)
willPlay
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
BOOL
ret
=
libvlc_media_instance_will_play
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
BOOL
ret
=
libvlc_media_instance_will_play
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
))
if
(
libvlc_exception_raised
(
&
ex
))
{
{
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
NO
;
return
NO
;
}
}
else
else
return
ret
;
return
ret
;
}
}
static
VLCMediaPlayerState
libvlc_to_local_state
[]
=
static
VLCMediaPlayerState
libvlc_to_local_state
[]
=
{
{
[
libvlc_Stopped
]
=
VLCMediaPlayerStateStopped
,
[
libvlc_Stopped
]
=
VLCMediaPlayerStateStopped
,
[
libvlc_Opening
]
=
VLCMediaPlayerStateOpening
,
[
libvlc_Opening
]
=
VLCMediaPlayerStateOpening
,
[
libvlc_Buffering
]
=
VLCMediaPlayerStateBuffering
,
[
libvlc_Buffering
]
=
VLCMediaPlayerStateBuffering
,
[
libvlc_Playing
]
=
VLCMediaPlayerStatePlaying
,
[
libvlc_Playing
]
=
VLCMediaPlayerStatePlaying
,
[
libvlc_Paused
]
=
VLCMediaPlayerStatePaused
,
[
libvlc_Paused
]
=
VLCMediaPlayerStatePaused
,
[
libvlc_Ended
]
=
VLCMediaPlayerStateEnded
,
[
libvlc_Ended
]
=
VLCMediaPlayerStateEnded
,
[
libvlc_Error
]
=
VLCMediaPlayerStateError
[
libvlc_Error
]
=
VLCMediaPlayerStateError
};
};
-
(
VLCMediaPlayerState
)
state
-
(
VLCMediaPlayerState
)
state
{
{
// If there is no instance, assume that we're in a stopped state
// If there is no instance, assume that we're in a stopped state
if
(
!
instance
)
if
(
!
instance
)
return
VLCMediaPlayerStateStopped
;
return
VLCMediaPlayerStateStopped
;
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_state_t
libvlc_state
=
libvlc_media_instance_get_state
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
libvlc_state_t
libvlc_state
=
libvlc_media_instance_get_state
((
libvlc_media_instance_t
*
)
instance
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
))
if
(
libvlc_exception_raised
(
&
ex
))
{
{
libvlc_exception_clear
(
&
ex
);
libvlc_exception_clear
(
&
ex
);
return
VLCMediaPlayerStateError
;
return
VLCMediaPlayerStateError
;
}
}
else
else
return
libvlc_to_local_state
[
libvlc_state
];
return
libvlc_to_local_state
[
libvlc_state
];
}
}
@end
@end
...
@@ -483,25 +483,25 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
...
@@ -483,25 +483,25 @@ static VLCMediaPlayerState libvlc_to_local_state [] =
-
(
void
)
registerObservers
-
(
void
)
registerObservers
{
{
libvlc_exception_t
ex
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
// Attach event observers into the media instance
// Attach event observers into the media instance
libvlc_event_manager_t
*
p_em
=
libvlc_media_instance_event_manager
(
instance
,
&
ex
);
libvlc_event_manager_t
*
p_em
=
libvlc_media_instance_event_manager
(
instance
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
&
ex
);
libvlc_event_attach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
&
ex
);
quit_on_exception
(
&
ex
);
quit_on_exception
(
&
ex
);
}
}
-
(
void
)
unregisterObservers
-
(
void
)
unregisterObservers
{
{
libvlc_event_manager_t
*
p_em
=
libvlc_media_instance_event_manager
(
instance
,
NULL
);
libvlc_event_manager_t
*
p_em
=
libvlc_media_instance_event_manager
(
instance
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePlayed
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePaused
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstanceReachedEnd
,
HandleMediaInstanceStateChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
NULL
);
libvlc_event_detach
(
p_em
,
libvlc_MediaInstancePositionChanged
,
HandleMediaTimeChanged
,
self
,
NULL
);
}
}
@end
@end
\ No newline at end of file
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