Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
31df6323
Commit
31df6323
authored
Dec 26, 2014
by
Felix Paul Kühne
Browse files
playback: add chapter and title support (closes #11560)
parent
26f894a7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Resources/VLCMovieViewController~ipad.xib
View file @
31df6323
...
...
@@ -19,6 +19,7 @@
<outlet
property=
"brightnessLabel"
destination=
"148"
id=
"165"
/>
<outlet
property=
"brightnessSlider"
destination=
"147"
id=
"163"
/>
<outlet
property=
"bwdButton"
destination=
"276"
id=
"284"
/>
<outlet
property=
"chapterButton"
destination=
"D3O-Bo-TYi"
id=
"o5p-gI-ydF"
/>
<outlet
property=
"contrastLabel"
destination=
"146"
id=
"160"
/>
<outlet
property=
"contrastSlider"
destination=
"145"
id=
"161"
/>
<outlet
property=
"controllerPanel"
destination=
"272"
id=
"298"
/>
...
...
@@ -428,7 +429,7 @@
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"o2q-eo-cnU"
>
<rect
key=
"frame"
x=
"5
52
"
y=
"5"
width=
"32"
height=
"40"
/>
<rect
key=
"frame"
x=
"5
41
"
y=
"5"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"22"
/>
...
...
@@ -438,6 +439,17 @@
<action
selector=
"lock:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"QFm-Re-ySf"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"D3O-Bo-TYi"
>
<rect
key=
"frame"
x=
"577"
y=
"6"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"22"
/>
<inset
key=
"contentEdgeInsets"
minX=
"0.0"
minY=
"4"
maxX=
"0.0"
maxY=
"4"
/>
<state
key=
"normal"
title=
"C"
/>
<connections>
<action
selector=
"switchChapter:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"NHE-kB-Qpz"
/>
</connections>
</button>
</subviews>
</view>
<view
contentMode=
"scaleToFill"
id=
"141"
userLabel=
"Controls panel"
customClass=
"VLCFrostedGlasView"
>
...
...
Resources/VLCMovieViewController~iphone.xib
View file @
31df6323
...
...
@@ -20,6 +20,7 @@
<outlet
property=
"brightnessSlider"
destination=
"128"
id=
"232"
/>
<outlet
property=
"bwdButton"
destination=
"77"
id=
"100"
/>
<outlet
property=
"bwdButtonLandscape"
destination=
"pQj-0t-OnU"
id=
"U8k-IC-a6H"
/>
<outlet
property=
"chapterButtonLandscape"
destination=
"aJZ-AB-35L"
id=
"d8c-zI-Ipo"
/>
<outlet
property=
"contrastLabel"
destination=
"132"
id=
"141"
/>
<outlet
property=
"contrastSlider"
destination=
"131"
id=
"142"
/>
<outlet
property=
"controllerPanel"
destination=
"92"
id=
"104"
/>
...
...
@@ -629,7 +630,7 @@
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
</view>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"lib-Hc-4qn"
>
<rect
key=
"frame"
x=
"31
4
"
y=
"5"
width=
"32"
height=
"40"
/>
<rect
key=
"frame"
x=
"31
1
"
y=
"5"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMinY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"18"
/>
<state
key=
"normal"
image=
"repeat.png"
>
...
...
@@ -663,7 +664,7 @@
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
</view>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"awR-Dt-S0B"
>
<rect
key=
"frame"
x=
"3
5
5"
y=
"6"
width=
"32"
height=
"40"
/>
<rect
key=
"frame"
x=
"3
4
5"
y=
"6"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMinY=
"YES"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"15"
/>
...
...
@@ -680,7 +681,7 @@
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"5Ty-RA-fET"
>
<rect
key=
"frame"
x=
"3
9
8"
y=
"6"
width=
"32"
height=
"40"
/>
<rect
key=
"frame"
x=
"3
7
8"
y=
"6"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"22"
/>
...
...
@@ -690,6 +691,17 @@
<action
selector=
"lock:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"58H-Ih-9tk"
/>
</connections>
</button>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
id=
"aJZ-AB-35L"
>
<rect
key=
"frame"
x=
"409"
y=
"7"
width=
"32"
height=
"40"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<color
key=
"backgroundColor"
white=
"0.0"
alpha=
"0.0"
colorSpace=
"calibratedWhite"
/>
<fontDescription
key=
"fontDescription"
type=
"boldSystem"
pointSize=
"22"
/>
<inset
key=
"contentEdgeInsets"
minX=
"0.0"
minY=
"4"
maxX=
"0.0"
maxY=
"4"
/>
<state
key=
"normal"
title=
"C"
/>
<connections>
<action
selector=
"switchChapter:"
destination=
"-1"
eventType=
"touchUpInside"
id=
"t1w-mV-9wH"
/>
</connections>
</button>
</subviews>
<color
key=
"backgroundColor"
red=
"0.1215686275"
green=
"0.1215686275"
blue=
"0.1215686275"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<freeformSimulatedSizeMetrics
key=
"simulatedDestinationMetrics"
/>
...
...
Sources/VLCMovieViewController.h
View file @
31df6323
...
...
@@ -37,6 +37,8 @@
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
repeatButtonLandscape
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
lockButton
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
lockButtonLandscape
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
chapterButton
;
@property
(
nonatomic
,
strong
)
IBOutlet
UIButton
*
chapterButtonLandscape
;
@property
(
nonatomic
,
strong
)
IBOutlet
UINavigationBar
*
toolbar
;
@property
(
nonatomic
,
strong
)
IBOutlet
VLCFrostedGlasView
*
controllerPanel
;
@property
(
nonatomic
,
strong
)
IBOutlet
VLCFrostedGlasView
*
controllerPanelLandscape
;
...
...
@@ -107,6 +109,7 @@
-
(
IBAction
)
toggleRepeatMode
:(
id
)
sender
;
-
(
IBAction
)
switchTrack
:(
id
)
sender
;
-
(
IBAction
)
lock
:(
id
)
sender
;
-
(
IBAction
)
switchChapter
:(
id
)
sender
;
-
(
IBAction
)
videoFilterToggle
:(
id
)
sender
;
-
(
IBAction
)
videoFilterSliderAction
:(
id
)
sender
;
...
...
Sources/VLCMovieViewController.m
View file @
31df6323
...
...
@@ -64,6 +64,7 @@ return
BOOL
_playerIsSetup
;
BOOL
_isScrubbing
;
BOOL
_interfaceIsLocked
;
BOOL
_switchingTracksNotChapters
;
BOOL
_swipeGesturesEnabled
;
UIPinchGestureRecognizer
*
_pinchRecognizer
;
...
...
@@ -191,6 +192,10 @@ return
_trackSwitcherButton
.
isAccessibilityElement
=
YES
;
_trackSwitcherButtonLandscape
.
accessibilityLabel
=
NSLocalizedString
(
@"OPEN_TRACK_PANEL"
,
nil
);
_trackSwitcherButtonLandscape
.
isAccessibilityElement
=
YES
;
_chapterButton
.
accessibilityLabel
=
NSLocalizedString
(
@"JUMP_TO_TITLE_OR_CHAPTER"
,
nil
);
_chapterButton
.
isAccessibilityElement
=
YES
;
_chapterButtonLandscape
.
accessibilityLabel
=
NSLocalizedString
(
@"JUMP_TO_TITLE_OR_CHAPTER"
,
nil
);
_chapterButtonLandscape
.
isAccessibilityElement
=
YES
;
_playbackSpeedButton
.
accessibilityLabel
=
_playbackSpeedLabel
.
text
;
_playbackSpeedButton
.
isAccessibilityElement
=
YES
;
_playbackSpeedButtonLandscape
.
accessibilityLabel
=
_playbackSpeedLabel
.
text
;
...
...
@@ -1081,6 +1086,14 @@ return
self
.
trackSwitcherButton
.
hidden
=
YES
;
self
.
trackSwitcherButtonLandscape
.
hidden
=
YES
;
}
if
(
_mediaPlayer
.
titles
.
count
>
1
||
[
_mediaPlayer
chaptersForTitleIndex
:
_mediaPlayer
.
currentTitleIndex
].
count
>
1
)
{
self
.
chapterButton
.
hidden
=
NO
;
self
.
chapterButtonLandscape
.
hidden
=
NO
;
}
else
{
self
.
chapterButton
.
hidden
=
YES
;
self
.
chapterButtonLandscape
.
hidden
=
YES
;
}
}
-
(
IBAction
)
playPause
...
...
@@ -1130,7 +1143,37 @@ return
{
LOCKCHECK
;
if
(
_trackSelectorContainer
.
hidden
==
YES
)
{
if
(
_trackSelectorContainer
.
hidden
==
YES
||
_switchingTracksNotChapters
==
NO
)
{
_switchingTracksNotChapters
=
YES
;
[
_trackSelectorTableView
reloadData
];
_trackSelectorContainer
.
hidden
=
NO
;
_trackSelectorContainer
.
alpha
=
1
.;
if
(
!
_playbackSpeedViewHidden
)
self
.
playbackSpeedView
.
hidden
=
_playbackSpeedViewHidden
=
YES
;
if
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPhone
)
{
if
(
!
_controlsHidden
)
{
self
.
controllerPanel
.
hidden
=
_controlsHidden
=
YES
;
self
.
controllerPanelLandscape
.
hidden
=
YES
;
}
}
self
.
videoFilterView
.
hidden
=
_videoFiltersHidden
=
YES
;
}
else
{
_trackSelectorContainer
.
hidden
=
YES
;
_switchingTracksNotChapters
=
NO
;
}
}
-
(
IBAction
)
switchChapter
:(
id
)
sender
{
LOCKCHECK
;
if
(
_trackSelectorContainer
.
hidden
==
YES
||
_switchingTracksNotChapters
==
YES
)
{
_switchingTracksNotChapters
=
NO
;
[
_trackSelectorTableView
reloadData
];
_trackSelectorContainer
.
hidden
=
NO
;
_trackSelectorContainer
.
alpha
=
1
.;
...
...
@@ -1169,11 +1212,20 @@ return
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
NSInteger
ret
=
0
;
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
)
ret
++
;
if
(
_mediaPlayer
.
videoSubTitlesIndexes
.
count
>
1
)
ret
++
;
if
(
_switchingTracksNotChapters
==
YES
)
{
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
)
ret
++
;
if
(
_mediaPlayer
.
videoSubTitlesIndexes
.
count
>
1
)
ret
++
;
}
else
{
if
(
_mediaPlayer
.
titles
.
count
>
1
)
ret
++
;
if
([
_mediaPlayer
chaptersForTitleIndex
:
_mediaPlayer
.
currentTitleIndex
].
count
>
1
)
ret
++
;
}
return
ret
;
}
...
...
@@ -1190,11 +1242,20 @@ return
-
(
NSString
*
)
tableView
:(
UITableView
*
)
tableView
titleForHeaderInSection
:(
NSInteger
)
section
{
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
section
==
0
)
return
NSLocalizedString
(
@"CHOOSE_AUDIO_TRACK"
,
nil
);
if
(
_switchingTracksNotChapters
==
YES
)
{
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
section
==
0
)
return
NSLocalizedString
(
@"CHOOSE_AUDIO_TRACK"
,
nil
);
if
(
_mediaPlayer
.
videoSubTitlesIndexes
.
count
>
1
)
return
NSLocalizedString
(
@"CHOOSE_SUBTITLE_TRACK"
,
nil
);
}
else
{
if
(
_mediaPlayer
.
titles
.
count
>
1
&&
section
==
0
)
return
NSLocalizedString
(
@"CHOOSE_TITLE"
,
nil
);
if
([
_mediaPlayer
chaptersForTitleIndex
:
_mediaPlayer
.
currentTitleIndex
].
count
>
1
)
return
NSLocalizedString
(
@"CHOOSE_CHAPTER"
,
nil
);
}
if
(
_mediaPlayer
.
videoSubTitlesIndexes
.
count
>
1
)
return
NSLocalizedString
(
@"CHOOSE_SUBTITLE_TRACK"
,
nil
);
return
@"unknown track type"
;
}
...
...
@@ -1205,26 +1266,45 @@ return
if
(
!
cell
)
cell
=
[[
VLCTrackSelectorTableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleDefault
reuseIdentifier
:
TRACK_SELECTOR_TABLEVIEW_CELL
];
NSString
*
itemSelectionIndicator
=
@""
;
NSArray
*
indexArray
;
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
indexPath
.
section
==
0
)
{
indexArray
=
_mediaPlayer
.
audioTrackIndexes
;
NSInteger
row
=
indexPath
.
row
;
if
([
indexArray
indexOfObjectIdenticalTo
:[
NSNumber
numberWithInt
:
_mediaPlayer
.
currentAudioTrackIndex
]]
==
indexPath
.
row
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
if
(
_switchingTracksNotChapters
==
YES
)
{
NSArray
*
indexArray
;
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
indexPath
.
section
==
0
)
{
indexArray
=
_mediaPlayer
.
audioTrackIndexes
;
if
([
indexArray
indexOfObjectIdenticalTo
:[
NSNumber
numberWithInt
:
_mediaPlayer
.
currentAudioTrackIndex
]]
==
row
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
_mediaPlayer
.
audioTrackNames
[
row
]];
}
else
{
indexArray
=
_mediaPlayer
.
videoSubTitlesIndexes
;
if
([
indexArray
indexOfObjectIdenticalTo
:[
NSNumber
numberWithInt
:
_mediaPlayer
.
currentVideoSubTitleIndex
]]
==
row
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@%@"
,
itemSelectionIndicator
,
_mediaPlayer
.
audioTrackNames
[
indexPath
.
row
]];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
_mediaPlayer
.
videoSubTitlesNames
[
row
]];
}
}
else
{
indexArray
=
_mediaPlayer
.
videoSubTitlesIndexes
;
if
(
_mediaPlayer
.
titles
.
count
>
1
&&
indexPath
.
section
==
0
)
{
cell
.
textLabel
.
text
=
_mediaPlayer
.
titles
[
row
];
if
([
indexArray
indexOfObjectIdenticalTo
:[
NSNumber
numberWithInt
:
_mediaPlayer
.
currentVideoSubTitleIndex
]]
==
indexPath
.
row
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
if
(
row
==
_mediaPlayer
.
currentTitleIndex
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
}
else
{
cell
.
textLabel
.
text
=
[
_mediaPlayer
chaptersForTitleIndex
:
_mediaPlayer
.
currentTitleIndex
][
row
];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@%@"
,
itemSelectionIndicator
,
_mediaPlayer
.
videoSubTitlesNames
[
indexPath
.
row
]];
if
(
row
==
_mediaPlayer
.
currentChapterIndex
)
[
cell
setShowsCurrentTrack
:
YES
];
else
[
cell
setShowsCurrentTrack
:
NO
];
}
}
return
cell
;
...
...
@@ -1245,16 +1325,23 @@ return
[
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
NO
];
NSInteger
index
=
indexPath
.
row
;
NSArray
*
indexArray
;
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
indexPath
.
section
==
0
)
{
indexArray
=
_mediaPlayer
.
audioTrackIndexes
;
if
(
index
<=
indexArray
.
count
)
_mediaPlayer
.
currentAudioTrackIndex
=
[
indexArray
[
index
]
intValue
];
if
(
_switchingTracksNotChapters
==
YES
)
{
NSArray
*
indexArray
;
if
(
_mediaPlayer
.
audioTrackIndexes
.
count
>
2
&&
indexPath
.
section
==
0
)
{
indexArray
=
_mediaPlayer
.
audioTrackIndexes
;
if
(
index
<=
indexArray
.
count
)
_mediaPlayer
.
currentAudioTrackIndex
=
[
indexArray
[
index
]
intValue
];
}
else
{
indexArray
=
_mediaPlayer
.
videoSubTitlesIndexes
;
if
(
index
<=
indexArray
.
count
)
_mediaPlayer
.
currentVideoSubTitleIndex
=
[
indexArray
[
index
]
intValue
];
}
}
else
{
indexArray
=
_mediaPlayer
.
videoSubTitlesIndexes
;
if
(
index
<=
indexArray
.
count
)
_mediaPlayer
.
currentVideoSubTitleIndex
=
[
indexArray
[
index
]
intValue
];
if
(
_mediaPlayer
.
titles
.
count
>
1
&&
indexPath
.
section
==
0
)
_mediaPlayer
.
currentTitleIndex
=
index
;
else
_mediaPlayer
.
currentChapterIndex
=
index
;
}
CGFloat
alpha
=
0
.
0
f
;
...
...
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