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
6f4f5211
Commit
6f4f5211
authored
Dec 21, 2009
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx/framework: Simplify the API for audio tracks, chapters, titles, and subtitles.
parent
e0ee5193
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
74 deletions
+114
-74
projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
+37
-15
projects/macosx/framework/Sources/VLCMediaPlayer.m
projects/macosx/framework/Sources/VLCMediaPlayer.m
+77
-59
No files found.
projects/macosx/framework/Headers/Public/VLCMediaPlayer.h
View file @
6f4f5211
...
...
@@ -105,11 +105,6 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
-
(
void
)
setVideoAspectRatio
:(
char
*
)
value
;
-
(
char
*
)
videoAspectRatio
;
-
(
void
)
setVideoSubTitles
:(
int
)
value
;
-
(
int
)
countOfVideoSubTitles
;
-
(
BOOL
)
openVideoSubTitlesFromFile
:(
NSString
*
)
path
;
-
(
int
)
currentVideoSubTitles
;
-
(
NSArray
*
)
videoSubTitles
;
-
(
void
)
setVideoCropGeometry
:(
char
*
)
value
;
-
(
char
*
)
videoCropGeometry
;
...
...
@@ -161,20 +156,47 @@ extern NSString * VLCMediaPlayerStateToString(VLCMediaPlayerState state);
@property
(
readonly
)
VLCTime
*
remainingTime
;
@property
(
readonly
)
int
fps
;
-
(
void
)
setChapter
:(
int
)
value
;
-
(
int
)
currentChapter
;
-
(
int
)
countOfChapters
;
-
(
NSArray
*
)
chaptersForTitle
:(
int
)
title
;
/**
* Return the current video subtitle index, or
* \return NSNotFound if none is set.
*
* To disable subtitle pass NSNotFound.
*/
@property
(
readwrite
)
NSUInteger
currentVideoSubTitleIndex
;
-
(
NSArray
*
)
videoSubTitles
;
/**
* Load and set a specific video subtitle, from a file.
* \param path to a file
* \return if the call succeed..
*/
-
(
BOOL
)
openVideoSubTitlesFromFile
:(
NSString
*
)
path
;
-
(
void
)
setCurrentTitle
:(
int
)
value
;
-
(
int
)
currentTitle
;
-
(
int
)
countOfTitles
;
/**
* Chapter selection and enumeration, it is bound
* to a title option.
*/
/**
* Return the current video subtitle index, or
* \return NSNotFound if none is set.
*
* To disable subtitle pass NSNotFound.
*/
@property
(
readwrite
)
NSUInteger
currentChapterIndex
;
-
(
void
)
previousChapter
;
-
(
void
)
nextChapter
;
-
(
NSArray
*
)
chaptersForTitleIndex
:(
NSUInteger
)
titleIndex
;
/**
* Title selection and enumeration
* \return NSNotFound if none is set.
*/
@property
(
readwrite
)
NSUInteger
currentTitleIndex
;
-
(
NSArray
*
)
titles
;
/* Audio Options */
-
(
void
)
setAudioTrack
:(
int
)
value
;
-
(
int
)
currentAudioTrack
;
-
(
int
)
countOfAudioTracks
;
@property
(
readwrite
)
NSUInteger
currentAudioTrackIndex
;
-
(
NSArray
*
)
audioTracks
;
-
(
void
)
setAudioChannel
:(
int
)
value
;
...
...
projects/macosx/framework/Sources/VLCMediaPlayer.m
View file @
6f4f5211
...
...
@@ -258,45 +258,26 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
[[
VLCLibrary
sharedLibrary
]
audio
];
}
-
(
void
)
setVideoAspectRatio
:(
char
*
)
value
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_video_set_aspect_ratio
(
instance
,
value
,
&
ex
);
catch_exception
(
&
ex
);
}
-
(
char
*
)
videoAspectRatio
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
char
*
result
=
libvlc_video_get_aspect_ratio
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
#pragma mark -
#pragma mark Subtitles
-
(
void
)
set
VideoSubTitles
:(
int
)
value
-
(
void
)
set
CurrentVideoSubTitleIndex
:(
NSUInteger
)
index
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_video_set_spu
(
instance
,
value
,
&
ex
);
libvlc_video_set_spu
(
instance
,
(
int
)
index
,
&
ex
);
catch_exception
(
&
ex
);
}
-
(
int
)
countOfVideoSubTitles
-
(
NSUInteger
)
currentVideoSubTitleIndex
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
resul
t
=
libvlc_video_get_spu_count
(
instance
,
&
ex
);
int
coun
t
=
libvlc_video_get_spu_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
-
(
int
)
currentVideoSubTitles
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_video_get_spu
(
instance
,
&
ex
);
if
(
count
<=
0
)
return
NSNotFound
;
NSUInteger
result
=
libvlc_video_get_spu
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
...
...
@@ -314,10 +295,13 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
count
=
libvlc_video_get_spu_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
libvlc_track_description_t
*
tracks
=
libvlc_video_get_spu_description
(
instance
,
&
ex
);
NSMutableArray
*
tempArray
=
[
NSMutableArray
array
];
NSInteger
i
;
for
(
i
=
0
;
i
<
[
self
countOfVideoSubTitles
]
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
[
tempArray
addObject
:[
NSString
stringWithUTF8String
:
tracks
->
psz_name
]];
tracks
=
tracks
->
p_next
;
...
...
@@ -325,6 +309,10 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
[
NSArray
arrayWithArray
:
tempArray
];
}
#pragma mark -
#pragma mark Video Crop geometry
-
(
void
)
setVideoCropGeometry
:(
char
*
)
value
{
libvlc_exception_t
ex
;
...
...
@@ -342,6 +330,23 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
result
;
}
-
(
void
)
setVideoAspectRatio
:(
char
*
)
value
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_video_set_aspect_ratio
(
instance
,
value
,
&
ex
);
catch_exception
(
&
ex
);
}
-
(
char
*
)
videoAspectRatio
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
char
*
result
=
libvlc_video_get_aspect_ratio
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
-
(
void
)
setVideoTeleText
:(
int
)
value
{
libvlc_exception_t
ex
;
...
...
@@ -458,7 +463,9 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
result
;
}
-
(
void
)
setChapter
:(
int
)
value
;
#pragma mark -
#pragma mark Chapters
-
(
void
)
setCurrentChapterIndex
:(
NSUInteger
)
value
;
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
...
...
@@ -466,20 +473,15 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
catch_exception
(
&
ex
);
}
-
(
int
)
currentChapter
-
(
NSUInteger
)
currentChapterIndex
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_media_player_get_chapter
(
instance
,
&
ex
);
int
count
=
libvlc_media_player_get_chapter_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
-
(
int
)
countOfChapters
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_media_player_get_chapter_count
(
instance
,
&
ex
);
if
(
count
<=
0
)
return
NSNotFound
;
NSUInteger
result
=
libvlc_media_player_get_chapter
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
...
...
@@ -500,14 +502,18 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
catch_exception
(
&
ex
);
}
-
(
NSArray
*
)
chaptersForTitle
:(
int
)
title
-
(
NSArray
*
)
chaptersForTitle
Index
:(
NSUInteger
)
title
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
count
=
libvlc_media_player_get_chapter_count
(
instance
,
&
ex
);
if
(
count
<=
0
)
return
[
NSArray
array
];
libvlc_track_description_t
*
tracks
=
libvlc_video_get_chapter_description
(
instance
,
title
,
&
ex
);
NSMutableArray
*
tempArray
=
[
NSMutableArray
array
];
NSInteger
i
;
for
(
i
=
0
;
i
<
[
self
countOfChapters
]
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
[
tempArray
addObject
:[
NSString
stringWithUTF8String
:
tracks
->
psz_name
]];
tracks
=
tracks
->
p_next
;
...
...
@@ -515,19 +521,28 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
[
NSArray
arrayWithArray
:
tempArray
];
}
-
(
void
)
setCurrentTitle
:(
int
)
value
#pragma mark -
#pragma mark Titles
-
(
void
)
setCurrentTitleIndex
:(
NSUInteger
)
value
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_exception_init
(
&
ex
);
libvlc_media_player_set_title
(
instance
,
value
,
&
ex
);
catch_exception
(
&
ex
);
}
-
(
int
)
currentTitle
-
(
NSUInteger
)
currentTitleIndex
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_media_player_get_title
(
instance
,
&
ex
);
int
count
=
libvlc_media_player_get_title_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
if
(
count
<=
0
)
return
NSNotFound
;
NSUInteger
result
=
libvlc_media_player_get_title
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
...
...
@@ -556,28 +571,26 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
return
[
NSArray
arrayWithArray
:
tempArray
];
}
-
(
void
)
setAudioTrack
:(
int
)
value
#pragma mark -
#pragma mark Audio tracks
-
(
void
)
setCurrentAudioTrackIndex
:(
NSUInteger
)
value
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
libvlc_audio_set_track
(
instance
,
value
,
&
ex
);
libvlc_audio_set_track
(
instance
,
(
int
)
value
,
&
ex
);
catch_exception
(
&
ex
);
}
-
(
int
)
currentAudioTrack
-
(
NSUInteger
)
currentAudioTrackIndex
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_audio_get_track
(
instance
,
&
ex
);
int
count
=
libvlc_audio_get_track_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
-
(
int
)
countOfAudioTracks
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
result
=
libvlc_audio_get_track_count
(
instance
,
&
ex
);
if
(
count
<=
0
)
return
NSNotFound
;
NSUInteger
result
=
libvlc_audio_get_track
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
return
result
;
}
...
...
@@ -586,10 +599,15 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
{
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
int
count
=
libvlc_audio_get_track_count
(
instance
,
&
ex
);
catch_exception
(
&
ex
);
if
(
count
<=
0
)
return
[
NSArray
array
];
libvlc_track_description_t
*
tracks
=
libvlc_audio_get_track_description
(
instance
,
&
ex
);
NSMutableArray
*
tempArray
=
[
NSMutableArray
array
];
NSInteger
i
;
for
(
i
=
0
;
i
<
[
self
countOfAudioTracks
]
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
[
tempArray
addObject
:[
NSString
stringWithUTF8String
:
tracks
->
psz_name
]];
tracks
=
tracks
->
p_next
;
...
...
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