]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libaribb24.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / libaribb24.c
index d6cccd117ba27c5cff2e22d0b648e3ffe9c1eaf6..0766c0079d980cc7b0b8bb34ae0a507b7e820591 100644 (file)
@@ -202,7 +202,7 @@ static int libaribb24_close(AVCodecContext *avctx)
     return 0;
 }
 
-#define RGB_TO_BGR(c) ((c & 0xff) << 16 | (c & 0xff00) | ((c >> 16) & 0xff))
+#define RGB_TO_BGR(c) (((c) & 0xff) << 16 | ((c) & 0xff00) | (((c) >> 16) & 0xff))
 
 static int libaribb24_handle_regions(AVCodecContext *avctx, AVSubtitle *sub)
 {
@@ -249,11 +249,11 @@ static int libaribb24_handle_regions(AVCodecContext *avctx, AVSubtitle *sub)
         // font size
         if (region->i_fontwidth  != profile_font_size ||
             region->i_fontheight != profile_font_size) {
-            av_bprintf(&buf, "{\\fscx%d\\fscy%d}",
-                       (int)round(((double)region->i_fontwidth /
-                                   (double)profile_font_size) * 100),
-                       (int)round(((double)region->i_fontheight /
-                                   (double)profile_font_size) * 100));
+            av_bprintf(&buf, "{\\fscx%"PRId64"\\fscy%"PRId64"}",
+                       av_rescale(region->i_fontwidth, 100,
+                                  profile_font_size),
+                       av_rescale(region->i_fontheight, 100,
+                                  profile_font_size));
         }
 
         // TODO: positioning
@@ -367,9 +367,9 @@ static void libaribb24_flush(AVCodecContext *avctx)
 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
     { "aribb24-base-path", "set the base path for the libaribb24 library",
-      OFFSET(aribb24_base_path), AV_OPT_TYPE_STRING, { 0 }, 0, 0, SD },
+      OFFSET(aribb24_base_path), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
     { "aribb24-skip-ruby-text", "skip ruby text blocks during decoding",
-      OFFSET(aribb24_skip_ruby), AV_OPT_TYPE_BOOL, { 1 }, 0, 1, SD },
+      OFFSET(aribb24_skip_ruby), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, SD },
     { NULL }
 };
 
@@ -380,7 +380,7 @@ static const AVClass aribb24_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-AVCodec ff_libaribb24_decoder = {
+const AVCodec ff_libaribb24_decoder = {
     .name      = "libaribb24",
     .long_name = NULL_IF_CONFIG_SMALL("libaribb24 ARIB STD-B24 caption decoder"),
     .type      = AVMEDIA_TYPE_SUBTITLE,