[vlc-devel] commit: libvlc: Use a union for libvlc_media_track_info_t. (Pierre d' Herbemont )
git version control
git at videolan.org
Sun Feb 28 23:53:48 CET 2010
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Thu Feb 25 23:53:08 2010 +0100| [7b5b08e3c744f3f8c08b27dcc02a1c1b53ad30d1] | committer: Pierre d'Herbemont
libvlc: Use a union for libvlc_media_track_info_t.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7b5b08e3c744f3f8c08b27dcc02a1c1b53ad30d1
---
include/vlc/libvlc_media.h | 19 ++++++++++++-------
src/control/media.c | 12 ++++--------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index e1a8e8b..52de810 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -154,13 +154,18 @@ typedef struct libvlc_media_track_info_t
int i_profile;
int i_level;
- /* Audio specific */
- unsigned i_channels;
- unsigned i_rate;
-
- /* Video specific */
- unsigned i_height;
- unsigned i_width;
+ union {
+ struct {
+ /* Audio specific */
+ unsigned i_channels;
+ unsigned i_rate;
+ } audio;
+ struct {
+ /* Video specific */
+ unsigned i_height;
+ unsigned i_width;
+ } video;
+ } u;
} libvlc_media_track_info_t;
diff --git a/src/control/media.c b/src/control/media.c
index 1e8675b..3fad99e 100644
--- a/src/control/media.c
+++ b/src/control/media.c
@@ -703,10 +703,6 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
libvlc_media_track_info_t *p_mes = *pp_es+i;
const es_format_t *p_es = p_input_item->es[i];
- p_mes->i_channels = p_mes->i_rate = 0;
- p_mes->i_width = p_mes->i_height = 0;
-
-
p_mes->i_codec = p_es->i_codec;
p_mes->i_id = p_es->i_id;
@@ -721,13 +717,13 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
break;
case VIDEO_ES:
p_mes->i_type = libvlc_track_video;
- p_mes->i_height = p_es->video.i_height;
- p_mes->i_width = p_es->video.i_width;
+ p_mes->u.video.i_height = p_es->video.i_height;
+ p_mes->u.video.i_width = p_es->video.i_width;
break;
case AUDIO_ES:
p_mes->i_type = libvlc_track_audio;
- p_mes->i_channels = p_es->audio.i_channels;
- p_mes->i_rate = p_es->audio.i_rate;
+ p_mes->u.audio.i_channels = p_es->audio.i_channels;
+ p_mes->u.audio.i_rate = p_es->audio.i_rate;
break;
case SPU_ES:
p_mes->i_type = libvlc_track_text;
More information about the vlc-devel
mailing list