当我检查 ffmpeg 的源代码时,我看到了这一行:
enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method
(const AVFormatContext* ctx);
这里的功能是enum什么?
当我检查 ffmpeg 的源代码时,我看到了这一行:
enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method
(const AVFormatContext* ctx);
这里的功能是enum什么?
av_fmt_ctx_get_duration_estimation_method是一个返回枚举类型对象的函数AVDurationEstimationMethod。
enum AVDurationEstimationMethodtogether 是函数av_fmt_ctx_get_duration_estimation_method返回的类型
关键字enum和是表示类型所必需的struct。union要省略它,请使用typedef:
typedef enum AVDurationEstimationMethod sometype;
然后你可以像这样使用它:
sometype av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx);
您发布的代码是一个函数的声明,它返回enum AVDurationEstimationMethod一个枚举类型的实例。
在 C 中,枚举有效地存在于它们自己的“命名空间”中(结构也是如此)。为了清楚地表明您指定了枚举类型,您必须在其前面加上enum关键字。
这里函数av_fmt_ctx_get_duration_estimation_method();作为const AVFormatContext* ctx参数并返回enum AVDurationEstimationMethod