Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
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
Ewout ter Hoeven
VLC-Android
Commits
b57ab967
Commit
b57ab967
authored
Feb 02, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MediaList: also send Media with MediaListItemDeleted events
parent
27f1d4c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
8 deletions
+17
-8
libvlc/src/org/videolan/libvlc/MediaList.java
libvlc/src/org/videolan/libvlc/MediaList.java
+17
-8
No files found.
libvlc/src/org/videolan/libvlc/MediaList.java
View file @
b57ab967
...
...
@@ -26,6 +26,12 @@ public final class MediaList extends VLCObject {
private
final
static
String
TAG
=
"LibVLC/MediaList"
;
public
static
class
Event
extends
VLCObject
.
Event
{
/**
* The media can be already released. If it's released, cached attributes are still
* available (like media.getMrl()).
* You should call {@link Media#retain()} and check the return value
* before calling media native methods.
*/
public
final
Media
media
;
public
final
int
index
;
...
...
@@ -74,22 +80,25 @@ public final class MediaList extends VLCObject {
init
();
}
private
synchronized
void
insertMedia
(
int
index
)
{
private
synchronized
Media
insertMedia
(
int
index
)
{
mCount
++;
for
(
int
i
=
mCount
-
1
;
i
>=
index
;
--
i
)
mMediaArray
.
put
(
i
+
1
,
mMediaArray
.
valueAt
(
i
));
mMediaArray
.
put
(
index
,
new
Media
(
this
,
index
));
final
Media
media
=
new
Media
(
this
,
index
);
mMediaArray
.
put
(
index
,
media
);
return
media
;
}
private
synchronized
void
removeMedia
(
int
index
)
{
private
synchronized
Media
removeMedia
(
int
index
)
{
mCount
--;
Media
media
=
mMediaArray
.
get
(
index
);
final
Media
media
=
mMediaArray
.
get
(
index
);
if
(
media
!=
null
)
media
.
release
();
for
(
int
i
=
index
;
i
<
mCount
;
++
i
)
{
mMediaArray
.
put
(
i
,
mMediaArray
.
valueAt
(
i
+
1
));
}
return
media
;
}
@Override
...
...
@@ -99,15 +108,15 @@ public final class MediaList extends VLCObject {
case
Events
.
MediaListItemAdded
:
index
=
(
int
)
arg1
;
if
(
index
!=
-
1
)
{
insertMedia
(
index
);
return
new
Event
(
eventType
,
m
MediaArray
.
get
(
index
)
,
index
);
final
Media
media
=
insertMedia
(
index
);
return
new
Event
(
eventType
,
m
edia
,
index
);
}
else
return
null
;
case
Events
.
MediaListItemDeleted
:
index
=
(
int
)
arg1
;
if
(
index
!=
-
1
)
{
removeMedia
(
index
);
return
new
Event
(
eventType
,
null
,
index
);
final
Media
media
=
removeMedia
(
index
);
return
new
Event
(
eventType
,
media
,
index
);
}
else
return
null
;
case
Events
.
MediaListEndReached
:
...
...
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