[3/6] libvpx: Deduplicate priv_class declaration for VP8 and VP9

Message ID 1472138898-16470-3-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Aug. 25, 2016, 3:28 p.m.
---
 libavcodec/libvpxenc.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

Patch

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index c6c9105..754a4c5 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -632,19 +632,19 @@  static const AVCodecDefault defaults[] = {
     { NULL },
 };
 
-#if CONFIG_LIBVPX_VP8_ENCODER
-static av_cold int vp8_init(AVCodecContext *avctx)
-{
-    return vpx_init(avctx, &vpx_codec_vp8_cx_algo);
-}
-
-static const AVClass class_vp8 = {
+static const AVClass vpx_class = {
     .class_name = "libvpx encoder",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
+#if CONFIG_LIBVPX_VP8_ENCODER
+static av_cold int vp8_init(AVCodecContext *avctx)
+{
+    return vpx_init(avctx, &vpx_codec_vp8_cx_algo);
+}
+
 AVCodec ff_libvpx_vp8_encoder = {
     .name           = "libvpx",
     .long_name      = NULL_IF_CONFIG_SMALL("libvpx VP8"),
@@ -656,7 +656,7 @@  AVCodec ff_libvpx_vp8_encoder = {
     .close          = vp8_free,
     .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
     .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
-    .priv_class     = &class_vp8,
+    .priv_class     = &vpx_class,
     .defaults       = defaults,
 };
 #endif /* CONFIG_LIBVPX_VP8_ENCODER */
@@ -667,13 +667,6 @@  static av_cold int vp9_init(AVCodecContext *avctx)
     return vpx_init(avctx, &vpx_codec_vp9_cx_algo);
 }
 
-static const AVClass class_vp9 = {
-    .class_name = "libvpx encoder",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
-
 static const AVProfile profiles[] = {
     { FF_PROFILE_VP9_0, "Profile 0" },
     { FF_PROFILE_VP9_1, "Profile 1" },
@@ -700,7 +693,7 @@  AVCodec ff_libvpx_vp9_encoder = {
         AV_PIX_FMT_NONE,
     },
     .profiles       = NULL_IF_CONFIG_SMALL(profiles),
-    .priv_class     = &class_vp9,
+    .priv_class     = &vpx_class,
     .defaults       = defaults,
 };
 #endif /* CONFIG_LIBVPX_VP9_ENCODER */