如何使用libvlc检索编解码器信息? [英] How to retrieve codec information using libvlc?

查看:136
本文介绍了如何使用libvlc检索编解码器信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用libvlc播放远程媒体时,我需要获取编解码器信息.由于VLC播放器可以实现此目的(请参见下面的屏幕截图),因此libvlc可能也可以做到这一点.

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.

此外,我发现libvlc_media_tracks_get可以返回如下相关结构:

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;

也许成员 i_codec 存储了此类信息,但是它不是人类可读的,并且我不知道特定值的含义.他们之间可能有一张地图,但我还没有找到.

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.

推荐答案

第三行已经告诉您 i_codec 应该解释为

The third line already tells you that i_codec should be interpreted as fourcc.

fourcc是四个 ASCII c 变体字符 c 的序列,它们实际上是人类可读的,而不是整数.这些代码的列表可此处.

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在 vlc_fourcc.h 中声明了 vlc_fourcc_GetDescription ,该代码可用于获取描述字符串.

libvlc declares vlc_fourcc_GetDescription in vlc_fourcc.h, which can be used to get a description string.

这篇关于如何使用libvlc检索编解码器信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆