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
Ewout ter Hoeven
VLC-Android
Commits
e296dc51
Commit
e296dc51
authored
Apr 22, 2012
by
Sébastien Toque
Browse files
properly release tracks_info array
parent
5493e508
Changes
2
Hide whitespace changes
Inline
Side-by-side
patches/0003-libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch
View file @
e296dc51
From
e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de
Mon Sep 17 00:00:00 2001
From
313b27201aa4757678bfc995ea611e640294ab41
Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Toque?= <xilasz@gmail.com>
Date:
Thu
,
1
2 Apr 2012
1
9:
22:43
+0200
Date:
Sun
,
2
2 Apr 2012
0
9:
35:52
+0200
Subject: [PATCH 3/3] libvlc: add language and frame rate to
libvlc_media_track_info_t
---
include/vlc/libvlc_media.h |
3
+++
lib/media.c |
3
+++
2 files changed,
6
insertions(+)
include/vlc/libvlc_media.h |
14 +++++++++++
+++
lib/media.c |
15
+++
++++++++++++
2 files changed,
29
insertions(+)
, 0 deletions(-)
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 279a29c..
577e363
100644
index 279a29c..
d4b1524
100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -164,9 +164,12 @@
typedef struct libvlc_media_track_info_t
...
...
@@ -26,8 +26,26 @@ index 279a29c..577e363 100644
} libvlc_media_track_info_t;
@@ -504,6 +507,17 @@
LIBVLC_API
int libvlc_media_get_tracks_info( libvlc_media_t *p_md,
libvlc_media_track_info_t **tracks );
+/**
+ * Release media descriptor's elementary streams description array
+ *
+ * \param p_tracks tracks info array to release
+ * \param i_count number of elements in the array
+ */
+LIBVLC_API
+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks,
+ int i_count );
+
+
/** @}*/
# ifdef __cplusplus
diff --git a/lib/media.c b/lib/media.c
index 2c01c80..
4bc832b
100644
index 2c01c80..
b3f5a9a
100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -707,6 +707,8 @@
libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
...
...
@@ -47,6 +65,22 @@ index 2c01c80..4bc832b 100644
break;
case AUDIO_ES:
p_mes->i_type = libvlc_track_audio;
@@ -735,3 +738,15 @@
libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
vlc_mutex_unlock( &p_input_item->lock );
return i_es;
}
+
+/**************************************************************************
+ * Release media descriptor's elementary streams description array
+ **************************************************************************/
+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks, int i_count )
+{
+ if (!p_tracks)
+ return;
+ for (int i = 0; i < i_count; ++i)
+ free( p_tracks[i].psz_language );
+ free( p_tracks );
+}
--
1.7.
9.5
1.7.
5.4
vlc-android/jni/libvlcjni.c
View file @
e296dc51
...
...
@@ -500,7 +500,7 @@ jboolean Java_org_videolan_vlc_LibVLC_hasVideoTrack(JNIEnv *env, jobject thiz,
break
;
}
free
(
p_t
racks
);
libvlc_media_tracks_info_release
(
p_tracks
,
i_nbT
racks
);
libvlc_media_release
(
p_m
);
return
hasVideo
;
...
...
@@ -553,7 +553,6 @@ jobjectArray Java_org_videolan_vlc_LibVLC_readTracksInfo(JNIEnv *env, jobject th
setInt
(
env
,
item
,
"Type"
,
p_tracks
[
i
].
i_type
);
setString
(
env
,
item
,
"Codec"
,
(
const
char
*
)
vlc_fourcc_GetDescription
(
0
,
p_tracks
[
i
].
i_codec
));
setString
(
env
,
item
,
"Language"
,
p_tracks
[
i
].
psz_language
);
free
(
p_tracks
[
i
].
psz_language
);
if
(
p_tracks
[
i
].
i_type
==
libvlc_track_video
)
{
...
...
@@ -569,7 +568,7 @@ jobjectArray Java_org_videolan_vlc_LibVLC_readTracksInfo(JNIEnv *env, jobject th
}
}
free
(
p_t
racks
);
libvlc_media_tracks_info_release
(
p_tracks
,
i_nbT
racks
);
libvlc_media_release
(
p_m
);
return
array
;
}
...
...
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