Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
8837d3d6
Commit
8837d3d6
authored
Oct 21, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Playlist delete support... sorta. LibVLC crashes internally.
parent
d95b7e67
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
13 deletions
+71
-13
bindings/cil/libvlc.cs
bindings/cil/libvlc.cs
+64
-12
bindings/cil/testvlc.cs
bindings/cil/testvlc.cs
+7
-1
No files found.
bindings/cil/libvlc.cs
View file @
8837d3d6
...
...
@@ -22,6 +22,7 @@
**********************************************************************/
using
System
;
using
System.Collections.Generic
;
using
System.Runtime.InteropServices
;
namespace
VideoLAN.LibVLC
...
...
@@ -69,8 +70,11 @@ namespace VideoLAN.LibVLC
*/
public
class
Instance
:
BaseObject
<
InstanceHandle
>
{
Dictionary
<
int
,
PlaylistItem
>
items
;
internal
Instance
(
InstanceHandle
self
)
:
base
(
self
)
{
items
=
new
Dictionary
<
int
,
PlaylistItem
>
();
}
public
MediaDescriptor
CreateDescriptor
(
string
mrl
)
...
...
@@ -82,7 +86,6 @@ namespace VideoLAN.LibVLC
return
new
MediaDescriptor
(
dh
);
}
[
DllImport
(
"libvlc-control.dll"
,
EntryPoint
=
"libvlc_playlist_loop"
)]
static
extern
void
PlaylistLoop
(
InstanceHandle
self
,
bool
b
,
NativeException
ex
);
...
...
@@ -169,15 +172,19 @@ namespace VideoLAN.LibVLC
{
PlaylistClear
(
self
,
ex
);
ex
.
Raise
();
foreach
(
PlaylistItem
item
in
items
.
Values
)
item
.
Close
();
items
.
Clear
();
}
[
DllImport
(
"libvlc-control.dll"
,
EntryPoint
=
"libvlc_playlist_add_extended"
)]
static
extern
void
PlaylistAdd
(
InstanceHandle
self
,
U8String
uri
,
U8String
name
,
int
optc
,
U8String
[]
optv
,
NativeException
e
);
static
extern
int
PlaylistAdd
(
InstanceHandle
self
,
U8String
uri
,
U8String
name
,
int
optc
,
U8String
[]
optv
,
NativeException
e
);
/** Appends an item to the playlist with options */
public
void
Add
(
string
mrl
,
string
name
,
string
[]
opts
)
public
PlaylistItem
Add
(
string
mrl
,
string
name
,
string
[]
opts
)
{
U8String
umrl
=
new
U8String
(
mrl
);
U8String
uname
=
new
U8String
(
name
);
...
...
@@ -185,20 +192,65 @@ namespace VideoLAN.LibVLC
for
(
int
i
=
0
;
i
<
opts
.
Length
;
i
++)
optv
[
i
]
=
new
U8String
(
opts
[
i
]);
PlaylistAdd
(
self
,
umrl
,
uname
,
optv
.
Length
,
optv
,
ex
);
int
id
=
PlaylistAdd
(
self
,
umrl
,
uname
,
optv
.
Length
,
optv
,
ex
);
ex
.
Raise
();
PlaylistItem
item
=
new
PlaylistItem
(
id
);
items
.
Add
(
id
,
item
);
return
item
;
}
public
void
Add
(
string
mrl
,
string
[]
opts
)
public
PlaylistItem
Add
(
string
mrl
,
string
[]
opts
)
{
Add
(
mrl
,
null
,
opts
);
return
Add
(
mrl
,
null
,
opts
);
}
public
void
Add
(
string
mrl
,
string
name
)
public
PlaylistItem
Add
(
string
mrl
,
string
name
)
{
Add
(
mrl
,
name
,
new
string
[
0
]);
return
Add
(
mrl
,
name
,
new
string
[
0
]);
}
public
void
Add
(
string
mrl
)
public
PlaylistItem
Add
(
string
mrl
)
{
Add
(
mrl
,
null
,
new
string
[
0
]);
return
Add
(
mrl
,
null
,
new
string
[
0
]);
}
[
DllImport
(
"libvlc-control.dll"
,
EntryPoint
=
"libvlc_playlist_delete_item"
)]
static
extern
int
PlaylistDelete
(
InstanceHandle
self
,
int
id
,
NativeException
e
);
public
void
Delete
(
PlaylistItem
item
)
{
int
id
=
item
.
Id
;
PlaylistDelete
(
self
,
id
,
ex
);
ex
.
Raise
();
item
.
Close
();
items
.
Remove
(
id
);
}
};
public
class
PlaylistItem
{
int
id
;
bool
deleted
;
internal
PlaylistItem
(
int
id
)
{
this
.
id
=
id
;
this
.
deleted
=
false
;
}
internal
void
Close
()
{
deleted
=
true
;
}
internal
int
Id
{
get
{
if
(
deleted
)
throw
new
ObjectDisposedException
(
"Playlist item deleted"
);
return
id
;
}
}
};
...
...
bindings/cil/testvlc.cs
View file @
8837d3d6
...
...
@@ -36,12 +36,18 @@ namespace VideoLAN.LibVLC.Test
MediaDescriptor
md
=
vlc
.
CreateDescriptor
(
args
[
0
]);
md
.
Dispose
();
PlaylistItem
item
=
null
;
foreach
(
string
s
in
args
)
vlc
.
Add
(
s
);
item
=
vlc
.
Add
(
s
);
vlc
.
Loop
=
false
;
vlc
.
TogglePause
();
Console
.
ReadLine
();
if
(
item
!=
null
)
vlc
.
Delete
(
item
);
vlc
.
Clear
();
vlc
.
Dispose
();
return
0
;
}
...
...
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