diff mbox

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

Message ID 1559626724-16376-4-git-send-email-mypopydev@gmail.com
State Superseded
Headers show

Commit Message

Jun Zhao June 4, 2019, 5:38 a.m. UTC
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 |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

Comments

Michael Niedermayer June 4, 2019, 8:39 p.m. UTC | #1
On Tue, Jun 04, 2019 at 01:38:43PM +0800, Jun Zhao wrote:
> 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 |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)

breaks fate

Assertion *(const AVClass **)avctx->priv_data == codec->priv_class failed at libavcodec/utils.c:1009
make: *** [fate-sub-webvttenc] Error 134

[...]
Hendrik Leppkes June 4, 2019, 10:31 p.m. UTC | #2
On Tue, Jun 4, 2019 at 7:39 AM Jun Zhao <mypopydev@gmail.com> wrote:
>
> From: Jun Zhao <barryjzhao@tencent.com>
>
> fix ffmpeg -h full can't display webvtt encoder
>

Whats the point of adding an empty help section without any options in it?
If you use ffmpeg -encoders, for example, you'll get a full list of
all supported encoders. An empty help section without any contents
doesn't seem helpful to me.

- Hendrik
Jun Zhao June 5, 2019, 1:42 a.m. UTC | #3
On Wed, Jun 5, 2019 at 6:36 AM Hendrik Leppkes <h.leppkes@gmail.com> wrote:
>
> On Tue, Jun 4, 2019 at 7:39 AM Jun Zhao <mypopydev@gmail.com> wrote:
> >
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > fix ffmpeg -h full can't display webvtt encoder
> >
>
> Whats the point of adding an empty help section without any options in it?
> If you use ffmpeg -encoders, for example, you'll get a full list of
> all supported encoders. An empty help section without any contents
> doesn't seem helpful to me.
>
> - Hendrik
Ha, for me, I want to get more information for WebVTT from FFmpeg
command line, so I
used the command like: ffmpeg -h full | grep -i webvtt, but get
noting,  it's quite frustrating
even the WebVTT muxer/decoder/encoder without any options,  I think dumping
a name better than get nothing in this case.
Jun Zhao June 5, 2019, 2:47 a.m. UTC | #4
On Wed, Jun 5, 2019 at 4:39 AM Michael Niedermayer
<michael@niedermayer.cc> wrote:
>
> On Tue, Jun 04, 2019 at 01:38:43PM +0800, Jun Zhao wrote:
> > 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 |   13 +++++++++++++
> >  1 files changed, 13 insertions(+), 0 deletions(-)
>
> breaks fate
>
> Assertion *(const AVClass **)avctx->priv_data == codec->priv_class failed at libavcodec/utils.c:1009
> make: *** [fate-sub-webvttenc] Error 134
>
Will check this issue, Thanks
diff mbox

Patch

diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c
index c84bbf4..c19040d 100644
--- a/libavcodec/webvttenc.c
+++ b/libavcodec/webvttenc.c
@@ -24,6 +24,7 @@ 
 #include "avcodec.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
+#include "libavutil/opt.h"
 #include "ass_split.h"
 #include "ass.h"
 
@@ -224,6 +225,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 +245,5 @@  AVCodec ff_webvtt_encoder = {
     .init           = webvtt_encode_init,
     .encode_sub     = webvtt_encode_frame,
     .close          = webvtt_encode_close,
+    .priv_class     = &webvtt_encoder_class,
 };