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