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
73f14c79
Commit
73f14c79
authored
Feb 21, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Safe handle class for LibVLC heap allocation
parent
d2e7edbd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
bindings/cil/src/libvlc.cs
bindings/cil/src/libvlc.cs
+1
-1
bindings/cil/src/ustring.cs
bindings/cil/src/ustring.cs
+31
-1
No files found.
bindings/cil/src/libvlc.cs
View file @
73f14c79
...
...
@@ -98,7 +98,7 @@ namespace VideoLAN.LibVLC
[
DllImport
(
"libvlc.dll"
,
EntryPoint
=
"libvlc_media_get_mrl"
)]
public
static
extern
void
MediaGetMRL
(
MediaHandle
media
);
MemoryHandle
MediaGetMRL
(
MediaHandle
media
,
NativeException
ex
);
[
DllImport
(
"libvlc.dll"
,
EntryPoint
=
"libvlc_media_duplicate"
)]
public
static
extern
...
...
bindings/cil/src/ustring.cs
View file @
73f14c79
...
...
@@ -33,7 +33,7 @@ namespace VideoLAN.LibVLC
* arrays (as used by the native LibVLC) and managed strings.
*/
[
StructLayout
(
LayoutKind
.
Sequential
)]
public
struct
U8String
internal
struct
U8String
{
public
byte
[]
mb_str
;
/**< nul-terminated UTF-8 bytes array */
...
...
@@ -91,4 +91,34 @@ namespace VideoLAN.LibVLC
return
new
U8String
(
ptr
).
ToString
();
}
};
/**
* @brief MemoryHandle: heap allocation by the C run-time
* @ingroup Internals
*/
internal
sealed
class
MemoryHandle
:
NonNullHandle
{
[
DllImport
(
"libvlc.dll"
,
EntryPoint
=
"libvlc_free"
)]
private
static
extern
void
Free
(
IntPtr
ptr
);
/**
* NonNullHandle.Destroy
*/
protected
override
void
Destroy
()
{
Free
(
handle
);
}
public
override
string
ToString
()
{
return
U8String
.
FromNative
(
handle
);
}
public
string
Transform
()
{
string
value
=
ToString
();
Close
();
return
value
;
}
};
};
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