Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
libvlcpp
Commits
169ad3f6
Commit
169ad3f6
authored
Feb 18, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not manually handle c strings.
parent
4e18daee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
36 deletions
+29
-36
src/Media.hpp
src/Media.hpp
+8
-12
src/MediaDiscoverer.hpp
src/MediaDiscoverer.hpp
+4
-6
src/MediaPlayer.hpp
src/MediaPlayer.hpp
+12
-18
src/common.hpp
src/common.hpp
+5
-0
No files found.
src/Media.hpp
View file @
169ad3f6
...
...
@@ -201,12 +201,10 @@ public:
*/
std
::
string
mrl
()
{
char
*
c_result
=
libvlc_media_get_mrl
(
*
this
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_media_get_mrl
(
*
this
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
@@ -240,12 +238,10 @@ public:
*/
std
::
string
meta
(
libvlc_meta_t
e_meta
)
{
char
*
c_result
=
libvlc_media_get_meta
(
*
this
,
e_meta
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_media_get_meta
(
*
this
,
e_meta
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
src/MediaDiscoverer.hpp
View file @
169ad3f6
...
...
@@ -60,12 +60,10 @@ public:
*/
std
::
string
localizedName
()
{
char
*
c_result
=
libvlc_media_discoverer_localized_name
(
*
this
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_media_discoverer_localized_name
(
*
this
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
src/MediaPlayer.hpp
View file @
169ad3f6
...
...
@@ -1147,12 +1147,10 @@ public:
*/
std
::
string
aspectRatio
()
{
char
*
c_result
=
libvlc_video_get_aspect_ratio
(
*
this
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_video_get_aspect_ratio
(
*
this
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
@@ -1289,12 +1287,10 @@ public:
*/
std
::
string
cropGeometry
()
{
char
*
c_result
=
libvlc_video_get_crop_geometry
(
*
this
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_video_get_crop_geometry
(
*
this
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
@@ -1424,12 +1420,10 @@ public:
*/
std
::
string
marqueeString
(
unsigned
option
)
{
char
*
c_result
=
libvlc_video_get_marquee_string
(
*
this
,
option
);
if
(
c_result
==
NULL
)
return
std
::
string
();
std
::
string
result
=
c_result
;
libvlc_free
(
c_result
);
return
result
;
auto
str
=
wrapCStr
(
libvlc_video_get_marquee_string
(
*
this
,
option
)
);
if
(
str
==
nullptr
)
return
{};
return
str
.
get
();
}
/**
...
...
src/common.hpp
View file @
169ad3f6
...
...
@@ -48,6 +48,11 @@ namespace VLC
{
return
ref
.
get
();
}
std
::
unique_ptr
<
char
,
void
(
*
)(
void
*
)
>
wrapCStr
(
char
*
str
)
{
return
std
::
unique_ptr
<
char
,
void
(
*
)(
void
*
)
>
(
str
,
[](
void
*
ptr
)
{
libvlc_free
(
ptr
);
}
);
}
}
#endif
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