I need to get codec information when using libvlc to play remote media. Since the VLC player can achieve this(see the screenshot below), libvlc may well be able to do it too.
Also, I find that libvlc_media_tracks_get can return a related struct as follows:
typedef struct libvlc_media_track_t
{
/* Codec fourcc */
uint32_t i_codec;
uint32_t i_original_fourcc;
int i_id;
libvlc_track_type_t i_type;
/* Codec specific */
int i_profile;
int i_level;
union {
libvlc_audio_track_t *audio;
libvlc_video_track_t *video;
libvlc_subtitle_track_t *subtitle;
};
unsigned int i_bitrate;
char *psz_language;
char *psz_description;
} libvlc_media_track_t;
Maybe the member i_codec
stores such information, but it's not human-readable and I don't know the meaning of a specific value. Probably there is a map between them and I haven't found it yet.
The third line already tells you that i_codec
should be interpreted as fourcc.
fourcc is a sequence of four ASCII character codes, which are actually human readable, just not as an integer. A list of these codes is available here.
libvlc declares vlc_fourcc_GetDescription
in vlc_fourcc.h
, which can be used to get a description string.