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
Casanowow Life for love
VLC-Android
Commits
bfa9801e
Commit
bfa9801e
authored
Jan 20, 2012
by
Rafaël Carré
Browse files
hasVideoTrack: fix memleaks
parent
46b3e1a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
vlc-android/jni/libvlcjni.c
View file @
bfa9801e
...
...
@@ -296,7 +296,6 @@ void Java_org_videolan_vlc_android_LibVLC_setEventManager(JNIEnv *env, jobject t
jobjectArray
Java_org_videolan_vlc_android_LibVLC_readMediaMeta
(
JNIEnv
*
env
,
jobject
thiz
,
jint
instance
,
jstring
mrl
)
{
jboolean
isCopy
;
jobjectArray
array
=
(
*
env
)
->
NewObjectArray
(
env
,
8
,
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
),
(
*
env
)
->
NewStringUTF
(
env
,
""
));
...
...
@@ -312,6 +311,7 @@ jobjectArray Java_org_videolan_vlc_android_LibVLC_readMediaMeta(JNIEnv *env,
libvlc_meta_Genre
,
};
jboolean
isCopy
;
const
char
*
psz_mrl
=
(
*
env
)
->
GetStringUTFChars
(
env
,
mrl
,
&
isCopy
);
libvlc_media_t
*
m
=
libvlc_media_new_path
((
libvlc_instance_t
*
)
instance
,
psz_mrl
);
...
...
@@ -395,24 +395,32 @@ jboolean Java_org_videolan_vlc_android_LibVLC_hasVideoTrack(JNIEnv *env, jobject
/* Create a new item and assign it to the media player. */
libvlc_media_t
*
p_m
=
libvlc_media_new_path
(
p_instance
,
psz_filePath
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
filePath
,
psz_filePath
);
if
(
p_m
==
NULL
)
{
LOGE
(
"Couldn't create the media!"
);
return
0
;
return
JNI_FALSE
;
}
/* Get the tracks information of the media. */
libvlc_media_track_info_t
*
p_tracks
;
libvlc_media_parse
(
p_m
);
int
i_nbTracks
=
libvlc_media_get_tracks_info
(
p_m
,
&
p_tracks
);
jboolean
hasVideo
=
JNI_FALSE
;
int
i_nbTracks
=
libvlc_media_get_tracks_info
(
p_m
,
&
p_tracks
);
unsigned
i
;
for
(
i
=
0
;
i
<
i_nbTracks
;
++
i
)
{
if
(
p_tracks
[
i
].
i_type
==
libvlc_track_video
)
return
1
;
}
return
0
;
{
hasVideo
=
JNI_TRUE
;
break
;
}
free
(
p_tracks
);
libvlc_media_release
(
p_m
);
return
hasVideo
;
}
struct
length_change_monitor
{
...
...
Write
Preview
Supports
Markdown
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