[FFmpeg-devel,V2,4/4] lavc/webvttenc: fix ffmpeg -h full can't display webvtt encoder

Submitted by Jun Zhao on June 6, 2019, 2:07 a.m.

Details

Message ID 1559786846-30859-5-git-send-email-mypopydev@gmail.com
State New
Headers show

Commit Message

Jun Zhao June 6, 2019, 2:07 a.m.
From: Jun Zhao <barryjzhao@tencent.com>

fix ffmpeg -h full can't display webvtt encoder

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/webvttenc.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c
index c84bbf4..21e7d92 100644
--- a/libavcodec/webvttenc.c
+++ b/libavcodec/webvttenc.c
@@ -24,11 +24,13 @@ 
 #include "avcodec.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
+#include "libavutil/opt.h"
 #include "ass_split.h"
 #include "ass.h"
 
 #define WEBVTT_STACK_SIZE 64
 typedef struct {
+    const AVClass *class;
     AVCodecContext *avctx;
     ASSSplitContext *ass_ctx;
     AVBPrint buffer;
@@ -224,6 +226,17 @@  static av_cold int webvtt_encode_init(AVCodecContext *avctx)
     return s->ass_ctx ? 0 : AVERROR_INVALIDDATA;
 }
 
+static const AVOption options[] = {
+    { NULL },
+};
+
+static const AVClass webvtt_encoder_class = {
+    .class_name = "WebVTT encoder",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 AVCodec ff_webvtt_encoder = {
     .name           = "webvtt",
     .long_name      = NULL_IF_CONFIG_SMALL("WebVTT subtitle"),
@@ -233,4 +246,5 @@  AVCodec ff_webvtt_encoder = {
     .init           = webvtt_encode_init,
     .encode_sub     = webvtt_encode_frame,
     .close          = webvtt_encode_close,
+    .priv_class     = &webvtt_encoder_class,
 };