[FFmpeg-cvslog] Merge commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24'

James Almer git at videolan.org
Thu Nov 2 01:07:29 EET 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Wed Nov  1 20:05:09 2017 -0300| [e621b1ca646a2f268797adc3194b694a852548d2] | committer: James Almer

Merge commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24'

* commit '97cfe1d8bd1968143e2ba9aa46ebe9504a835e24':
  Convert all AVClass struct declarations to designated initializers.

Merged-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e621b1ca646a2f268797adc3194b694a852548d2
---

 libavcodec/aacenc.c          | 8 ++++----
 libavcodec/libfdk-aacdec.c   | 5 ++++-
 libavcodec/libfdk-aacenc.c   | 5 ++++-
 libavcodec/libopencore-amr.c | 5 ++++-
 libavcodec/libopenh264enc.c  | 5 ++++-
 libavcodec/libvo-amrwbenc.c  | 5 ++++-
 libavcodec/mpeg4videodec.c   | 8 ++++----
 libavcodec/s302m.c           | 8 ++++----
 libavcodec/v210dec.c         | 8 ++++----
 libavutil/eval.c             | 9 ++++++++-
 libavutil/file.c             | 8 ++++++--
 libavutil/file_open.c        | 8 ++++++--
 libavutil/imgutils.c         | 7 ++++---
 libavutil/tests/opt.c        | 6 +++---
 14 files changed, 63 insertions(+), 32 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 11da260742..3efcbda403 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -1066,10 +1066,10 @@ static const AVOption aacenc_options[] = {
 };
 
 static const AVClass aacenc_class = {
-    "AAC encoder",
-    av_default_item_name,
-    aacenc_options,
-    LIBAVUTIL_VERSION_INT,
+    .class_name = "AAC encoder",
+    .item_name  = av_default_item_name,
+    .option     = aacenc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static const AVCodecDefault aac_encode_defaults[] = {
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c
index 2857b9453f..a0110da62b 100644
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@ -79,7 +79,10 @@ static const AVOption fdk_aac_dec_options[] = {
 };
 
 static const AVClass fdk_aac_dec_class = {
-    "libfdk-aac decoder", av_default_item_name, fdk_aac_dec_options, LIBAVUTIL_VERSION_INT
+    .class_name = "libfdk-aac decoder",
+    .item_name  = av_default_item_name,
+    .option     = fdk_aac_dec_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static int get_stream_info(AVCodecContext *avctx)
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 0e2051b468..ca0f4bf722 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -54,7 +54,10 @@ static const AVOption aac_enc_options[] = {
 };
 
 static const AVClass aac_enc_class = {
-    "libfdk_aac", av_default_item_name, aac_enc_options, LIBAVUTIL_VERSION_INT
+    .class_name = "libfdk_aac",
+    .item_name  = av_default_item_name,
+    .option     = aac_enc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static const char *aac_get_error(AACENC_ERROR err)
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 8545ffe109..d509804315 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -183,7 +183,10 @@ static const AVOption options[] = {
 };
 
 static const AVClass amrnb_class = {
-    "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+    .class_name = "libopencore_amrnb",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index 9c22bf4f30..1152d0036f 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -75,7 +75,10 @@ static const AVOption options[] = {
 };
 
 static const AVClass class = {
-    "libopenh264enc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+    .class_name = "libvo_amrwbenc",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static av_cold int svc_encode_close(AVCodecContext *avctx)
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index 2a15650572..f756940879 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -46,7 +46,10 @@ static const AVOption options[] = {
 };
 
 static const AVClass amrwb_class = {
-    "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+    .class_name = "libvo_amrwbenc",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 0203503599..76247c3b8c 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2823,10 +2823,10 @@ static const AVOption mpeg4_options[] = {
 };
 
 static const AVClass mpeg4_class = {
-    "MPEG4 Video Decoder",
-    av_default_item_name,
-    mpeg4_options,
-    LIBAVUTIL_VERSION_INT,
+    .class_name = "MPEG4 Video Decoder",
+    .item_name  = av_default_item_name,
+    .option     = mpeg4_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 AVCodec ff_mpeg4_decoder = {
diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c
index 4350d97f0a..584b58e28e 100644
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@ -212,10 +212,10 @@ static const AVOption s302m_options[] = {
 };
 
 static const AVClass s302m_class = {
-    "SMPTE 302M Decoder",
-    av_default_item_name,
-    s302m_options,
-    LIBAVUTIL_VERSION_INT,
+    .class_name = "SMPTE 302M Decoder",
+    .item_name  = av_default_item_name,
+    .option     = s302m_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 AVCodec ff_s302m_decoder = {
diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index 9af9af6797..99199ddc15 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -162,10 +162,10 @@ static const AVOption v210dec_options[] = {
 };
 
 static const AVClass v210dec_class = {
-    "V210 Decoder",
-    av_default_item_name,
-    v210dec_options,
-    LIBAVUTIL_VERSION_INT,
+    .class_name = "V210 Decoder",
+    .item_name  = av_default_item_name,
+    .option     = v210dec_options,
+    .version    = LIBAVUTIL_VERSION_INT,
 };
 
 AVCodec ff_v210_decoder = {
diff --git a/libavutil/eval.c b/libavutil/eval.c
index b5f4ea2409..5da9a6d83b 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -57,7 +57,14 @@ typedef struct Parser {
     double *var;
 } Parser;
 
-static const AVClass eval_class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) };
+static const AVClass eval_class = {
+    .class_name                = "Eval",
+    .item_name                 = av_default_item_name,
+    .option                    = NULL,
+    .version                   = LIBAVUTIL_VERSION_INT,
+    .log_level_offset_offset   = offsetof(Parser, log_offset),
+    .parent_log_context_offset = offsetof(Parser, log_ctx),
+};
 
 static const struct {
     double bin_val;
diff --git a/libavutil/file.c b/libavutil/file.c
index 7bdf6cde84..24a86c3f35 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -42,8 +42,12 @@ typedef struct FileLogContext {
 } FileLogContext;
 
 static const AVClass file_log_ctx_class = {
-    "FILE", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT,
-    offsetof(FileLogContext, log_offset), offsetof(FileLogContext, log_ctx)
+    .class_name                = "FILE",
+    .item_name                 = av_default_item_name,
+    .option                    = NULL,
+    .version                   = LIBAVUTIL_VERSION_INT,
+    .log_level_offset_offset   = offsetof(FileLogContext, log_offset),
+    .parent_log_context_offset = offsetof(FileLogContext, log_ctx),
 };
 
 int av_file_map(const char *filename, uint8_t **bufptr, size_t *size,
diff --git a/libavutil/file_open.c b/libavutil/file_open.c
index 34070d933b..258bb3074e 100644
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@ -99,8 +99,12 @@ typedef struct FileLogContext {
 } FileLogContext;
 
 static const AVClass file_log_ctx_class = {
-    "TEMPFILE", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT,
-    offsetof(FileLogContext, log_offset), offsetof(FileLogContext, log_ctx)
+    .class_name                = "TEMPFILE",
+    .item_name                 = av_default_item_name,
+    .option                    = NULL,
+    .version                   = LIBAVUTIL_VERSION_INT,
+    .log_level_offset_offset   = offsetof(FileLogContext, log_offset),
+    .parent_log_context_offset = offsetof(FileLogContext, log_ctx),
 };
 
 int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx)
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 5005178804..5af4fc20a0 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -242,9 +242,10 @@ typedef struct ImgUtils {
 } ImgUtils;
 
 static const AVClass imgutils_class = {
-    .class_name = "IMGUTILS",
-    .item_name  = av_default_item_name,
-    .version    = LIBAVUTIL_VERSION_INT,
+    .class_name                = "IMGUTILS",
+    .item_name                 = av_default_item_name,
+    .option                    = NULL,
+    .version                   = LIBAVUTIL_VERSION_INT,
     .log_level_offset_offset   = offsetof(ImgUtils, log_offset),
     .parent_log_context_offset = offsetof(ImgUtils, log_ctx),
 };
diff --git a/libavutil/tests/opt.c b/libavutil/tests/opt.c
index 568eb45668..f4cfa590aa 100644
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@ -98,9 +98,9 @@ static const char *test_get_name(void *ctx)
 }
 
 static const AVClass test_class = {
-    "TestContext",
-    test_get_name,
-    test_options
+    .class_name = "TestContext",
+    .item_name  = test_get_name,
+    .option     = test_options,
 };
 
 static void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)


======================================================================

diff --cc libavcodec/aacenc.c
index 11da260742,b7f60fb872..3efcbda403
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@@ -1066,17 -803,12 +1066,17 @@@ static const AVOption aacenc_options[] 
  };
  
  static const AVClass aacenc_class = {
-     "AAC encoder",
-     av_default_item_name,
-     aacenc_options,
-     LIBAVUTIL_VERSION_INT,
+     .class_name = "AAC encoder",
+     .item_name  = av_default_item_name,
+     .option     = aacenc_options,
+     .version    = LIBAVUTIL_VERSION_INT,
  };
  
 +static const AVCodecDefault aac_encode_defaults[] = {
 +    { "b", "0" },
 +    { NULL }
 +};
 +
  AVCodec ff_aac_encoder = {
      .name           = "aac",
      .long_name      = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
diff --cc libavcodec/libfdk-aacdec.c
index 2857b9453f,637d1352a0..a0110da62b
--- a/libavcodec/libfdk-aacdec.c
+++ b/libavcodec/libfdk-aacdec.c
@@@ -79,7 -79,10 +79,10 @@@ static const AVOption fdk_aac_dec_optio
  };
  
  static const AVClass fdk_aac_dec_class = {
-     "libfdk-aac decoder", av_default_item_name, fdk_aac_dec_options, LIBAVUTIL_VERSION_INT
+     .class_name = "libfdk-aac decoder",
+     .item_name  = av_default_item_name,
+     .option     = fdk_aac_dec_options,
 -    .version    = LIBAVUTIL_VERSION_INT
++    .version    = LIBAVUTIL_VERSION_INT,
  };
  
  static int get_stream_info(AVCodecContext *avctx)
diff --cc libavcodec/libopencore-amr.c
index 8545ffe109,8200f6719c..d509804315
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@@ -182,8 -183,11 +182,11 @@@ static const AVOption options[] = 
      { NULL }
  };
  
 -static const AVClass class = {
 +static const AVClass amrnb_class = {
-     "libopencore_amrnb", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+     .class_name = "libopencore_amrnb",
+     .item_name  = av_default_item_name,
+     .option     = options,
+     .version    = LIBAVUTIL_VERSION_INT,
  };
  
  static av_cold int amr_nb_encode_init(AVCodecContext *avctx)
diff --cc libavcodec/libopenh264enc.c
index 9c22bf4f30,3b32790bae..1152d0036f
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@@ -75,7 -75,10 +75,10 @@@ static const AVOption options[] = 
  };
  
  static const AVClass class = {
-     "libopenh264enc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
 -    .class_name = "libopenh264enc",
++    .class_name = "libvo_amrwbenc",
+     .item_name  = av_default_item_name,
+     .option     = options,
+     .version    = LIBAVUTIL_VERSION_INT,
  };
  
  static av_cold int svc_encode_close(AVCodecContext *avctx)
diff --cc libavcodec/libvo-amrwbenc.c
index 2a15650572,5439d66110..f756940879
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@@ -45,8 -45,11 +45,11 @@@ static const AVOption options[] = 
      { NULL }
  };
  
 -static const AVClass class = {
 +static const AVClass amrwb_class = {
-     "libvo_amrwbenc", av_default_item_name, options, LIBAVUTIL_VERSION_INT
+     .class_name = "libvo_amrwbenc",
+     .item_name  = av_default_item_name,
+     .option     = options,
+     .version    = LIBAVUTIL_VERSION_INT,
  };
  
  static int get_wb_bitrate_mode(int bitrate, void *log_ctx)
diff --cc libavcodec/mpeg4videodec.c
index 0203503599,eb1b67273b..76247c3b8c
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@@ -2816,19 -2613,6 +2816,19 @@@ static av_cold int decode_init(AVCodecC
      return 0;
  }
  
 +static const AVOption mpeg4_options[] = {
 +    {"quarter_sample", "1/4 subpel MC", offsetof(MpegEncContext, quarter_sample), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0},
 +    {"divx_packed", "divx style packed b frames", offsetof(MpegEncContext, divx_packed), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0},
 +    {NULL}
 +};
 +
 +static const AVClass mpeg4_class = {
-     "MPEG4 Video Decoder",
-     av_default_item_name,
-     mpeg4_options,
-     LIBAVUTIL_VERSION_INT,
++    .class_name = "MPEG4 Video Decoder",
++    .item_name  = av_default_item_name,
++    .option     = mpeg4_options,
++    .version    = LIBAVUTIL_VERSION_INT,
 +};
 +
  AVCodec ff_mpeg4_decoder = {
      .name                  = "mpeg4",
      .long_name             = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"),
diff --cc libavcodec/s302m.c
index 4350d97f0a,635f697b5c..584b58e28e
--- a/libavcodec/s302m.c
+++ b/libavcodec/s302m.c
@@@ -201,23 -140,6 +201,23 @@@ static int s302m_decode_frame(AVCodecCo
      return avpkt->size;
  }
  
 +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_DECODING_PARAM
 +static const AVOption s302m_options[] = {
 +    {"non_pcm_mode", "Chooses what to do with NON-PCM", offsetof(S302Context, non_pcm_mode), AV_OPT_TYPE_INT, {.i64 = 3}, 0, 3, FLAGS, "non_pcm_mode"},
 +    {"copy"        , "Pass NON-PCM through unchanged"     , 0, AV_OPT_TYPE_CONST, {.i64 = 0}, 0, 3, FLAGS, "non_pcm_mode"},
 +    {"drop"        , "Drop NON-PCM"                       , 0, AV_OPT_TYPE_CONST, {.i64 = 1}, 0, 3, FLAGS, "non_pcm_mode"},
 +    {"decode_copy" , "Decode if possible else passthrough", 0, AV_OPT_TYPE_CONST, {.i64 = 2}, 0, 3, FLAGS, "non_pcm_mode"},
 +    {"decode_drop" , "Decode if possible else drop"       , 0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 3, FLAGS, "non_pcm_mode"},
 +    {NULL}
 +};
 +
 +static const AVClass s302m_class = {
-     "SMPTE 302M Decoder",
-     av_default_item_name,
-     s302m_options,
-     LIBAVUTIL_VERSION_INT,
++    .class_name = "SMPTE 302M Decoder",
++    .item_name  = av_default_item_name,
++    .option     = s302m_options,
++    .version    = LIBAVUTIL_VERSION_INT,
 +};
 +
  AVCodec ff_s302m_decoder = {
      .name           = "s302m",
      .long_name      = NULL_IF_CONFIG_SMALL("SMPTE 302M"),
diff --cc libavcodec/v210dec.c
index 9af9af6797,74301fe48b..99199ddc15
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@@ -154,20 -106,6 +154,20 @@@ static int decode_frame(AVCodecContext 
      return avpkt->size;
  }
  
 +#define V210DEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
 +static const AVOption v210dec_options[] = {
 +    {"custom_stride", "Custom V210 stride", offsetof(V210DecContext, custom_stride), AV_OPT_TYPE_INT,
 +     {.i64 = 0}, INT_MIN, INT_MAX, V210DEC_FLAGS},
 +    {NULL}
 +};
 +
 +static const AVClass v210dec_class = {
-     "V210 Decoder",
-     av_default_item_name,
-     v210dec_options,
-     LIBAVUTIL_VERSION_INT,
++    .class_name = "V210 Decoder",
++    .item_name  = av_default_item_name,
++    .option     = v210dec_options,
++    .version    = LIBAVUTIL_VERSION_INT,
 +};
 +
  AVCodec ff_v210_decoder = {
      .name           = "v210",
      .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
diff --cc libavutil/eval.c
index b5f4ea2409,7d7c16e927..5da9a6d83b
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@@ -54,46 -49,39 +54,53 @@@ typedef struct Parser 
      int log_offset;
      void *log_ctx;
  #define VARS 10
 -    double var[VARS];
 +    double *var;
  } Parser;
  
- static const AVClass eval_class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) };
 -static const AVClass class = {
++static const AVClass eval_class = {
+     .class_name                = "Eval",
+     .item_name                 = av_default_item_name,
+     .option                    = NULL,
+     .version                   = LIBAVUTIL_VERSION_INT,
+     .log_level_offset_offset   = offsetof(Parser, log_offset),
+     .parent_log_context_offset = offsetof(Parser, log_ctx),
+ };
  
 -static const int8_t si_prefixes['z' - 'E' + 1] = {
 -    ['y'-'E']= -24,
 -    ['z'-'E']= -21,
 -    ['a'-'E']= -18,
 -    ['f'-'E']= -15,
 -    ['p'-'E']= -12,
 -    ['n'-'E']= - 9,
 -    ['u'-'E']= - 6,
 -    ['m'-'E']= - 3,
 -    ['c'-'E']= - 2,
 -    ['d'-'E']= - 1,
 -    ['h'-'E']=   2,
 -    ['k'-'E']=   3,
 -    ['K'-'E']=   3,
 -    ['M'-'E']=   6,
 -    ['G'-'E']=   9,
 -    ['T'-'E']=  12,
 -    ['P'-'E']=  15,
 -    ['E'-'E']=  18,
 -    ['Z'-'E']=  21,
 -    ['Y'-'E']=  24,
 +static const struct {
 +    double bin_val;
 +    double dec_val;
 +    int8_t exp;
 +} si_prefixes['z' - 'E' + 1] = {
 +    ['y'-'E']= { 8.271806125530276749e-25, 1e-24, -24 },
 +    ['z'-'E']= { 8.4703294725430034e-22, 1e-21, -21 },
 +    ['a'-'E']= { 8.6736173798840355e-19, 1e-18, -18 },
 +    ['f'-'E']= { 8.8817841970012523e-16, 1e-15, -15 },
 +    ['p'-'E']= { 9.0949470177292824e-13, 1e-12, -12 },
 +    ['n'-'E']= { 9.3132257461547852e-10, 1e-9,  -9 },
 +    ['u'-'E']= { 9.5367431640625e-7, 1e-6, -6 },
 +    ['m'-'E']= { 9.765625e-4, 1e-3, -3 },
 +    ['c'-'E']= { 9.8431332023036951e-3, 1e-2, -2 },
 +    ['d'-'E']= { 9.921256574801246e-2, 1e-1, -1 },
 +    ['h'-'E']= { 1.0159366732596479e2, 1e2, 2 },
 +    ['k'-'E']= { 1.024e3, 1e3, 3 },
 +    ['K'-'E']= { 1.024e3, 1e3, 3 },
 +    ['M'-'E']= { 1.048576e6, 1e6, 6 },
 +    ['G'-'E']= { 1.073741824e9, 1e9, 9 },
 +    ['T'-'E']= { 1.099511627776e12, 1e12, 12 },
 +    ['P'-'E']= { 1.125899906842624e15, 1e15, 15 },
 +    ['E'-'E']= { 1.152921504606847e18, 1e18, 18 },
 +    ['Z'-'E']= { 1.1805916207174113e21, 1e21, 21 },
 +    ['Y'-'E']= { 1.2089258196146292e24, 1e24, 24 },
 +};
 +
 +static const struct {
 +    const char *name;
 +    double value;
 +} constants[] = {
 +    { "E",   M_E   },
 +    { "PI",  M_PI  },
 +    { "PHI", M_PHI },
 +    { "QP2LAMBDA", FF_QP2LAMBDA },
  };
  
  double av_strtod(const char *numstr, char **tail)
diff --cc libavutil/file_open.c
index 34070d933b,f14ea70862..258bb3074e
--- a/libavutil/file_open.c
+++ b/libavutil/file_open.c
@@@ -91,96 -86,3 +91,100 @@@ int avpriv_open(const char *filename, i
  
      return fd;
  }
 +
 +typedef struct FileLogContext {
 +    const AVClass *class;
 +    int   log_offset;
 +    void *log_ctx;
 +} FileLogContext;
 +
 +static const AVClass file_log_ctx_class = {
-     "TEMPFILE", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT,
-     offsetof(FileLogContext, log_offset), offsetof(FileLogContext, log_ctx)
++    .class_name                = "TEMPFILE",
++    .item_name                 = av_default_item_name,
++    .option                    = NULL,
++    .version                   = LIBAVUTIL_VERSION_INT,
++    .log_level_offset_offset   = offsetof(FileLogContext, log_offset),
++    .parent_log_context_offset = offsetof(FileLogContext, log_ctx),
 +};
 +
 +int avpriv_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx)
 +{
 +    FileLogContext file_log_ctx = { &file_log_ctx_class, log_offset, log_ctx };
 +    int fd = -1;
 +#if !HAVE_MKSTEMP
 +    void *ptr= tempnam(NULL, prefix);
 +    if(!ptr)
 +        ptr= tempnam(".", prefix);
 +    *filename = av_strdup(ptr);
 +#undef free
 +    free(ptr);
 +#else
 +    size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
 +    *filename  = av_malloc(len);
 +#endif
 +    /* -----common section-----*/
 +    if (!*filename) {
 +        av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
 +        return AVERROR(ENOMEM);
 +    }
 +#if !HAVE_MKSTEMP
 +#   ifndef O_BINARY
 +#       define O_BINARY 0
 +#   endif
 +#   ifndef O_EXCL
 +#       define O_EXCL 0
 +#   endif
 +    fd = open(*filename, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600);
 +#else
 +    snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
 +    fd = mkstemp(*filename);
 +#if defined(_WIN32) || defined (__ANDROID__)
 +    if (fd < 0) {
 +        snprintf(*filename, len, "./%sXXXXXX", prefix);
 +        fd = mkstemp(*filename);
 +    }
 +#endif
 +#endif
 +    /* -----common section-----*/
 +    if (fd < 0) {
 +        int err = AVERROR(errno);
 +        av_log(&file_log_ctx, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
 +        av_freep(filename);
 +        return err;
 +    }
 +    return fd; /* success */
 +}
 +
 +FILE *av_fopen_utf8(const char *path, const char *mode)
 +{
 +    int fd;
 +    int access;
 +    const char *m = mode;
 +
 +    switch (*m++) {
 +    case 'r': access = O_RDONLY; break;
 +    case 'w': access = O_CREAT|O_WRONLY|O_TRUNC; break;
 +    case 'a': access = O_CREAT|O_WRONLY|O_APPEND; break;
 +    default :
 +        errno = EINVAL;
 +        return NULL;
 +    }
 +    while (*m) {
 +        if (*m == '+') {
 +            access &= ~(O_RDONLY | O_WRONLY);
 +            access |= O_RDWR;
 +        } else if (*m == 'b') {
 +#ifdef O_BINARY
 +            access |= O_BINARY;
 +#endif
 +        } else if (*m) {
 +            errno = EINVAL;
 +            return NULL;
 +        }
 +        m++;
 +    }
 +    fd = avpriv_open(path, access, 0666);
 +    if (fd == -1)
 +        return NULL;
 +    return fdopen(fd, mode);
 +}
diff --cc libavutil/tests/opt.c
index 568eb45668,9ed9d2b6b1..f4cfa590aa
--- a/libavutil/tests/opt.c
+++ b/libavutil/tests/opt.c
@@@ -98,16 -59,11 +98,16 @@@ static const char *test_get_name(void *
  }
  
  static const AVClass test_class = {
-     "TestContext",
-     test_get_name,
-     test_options
+     .class_name = "TestContext",
+     .item_name  = test_get_name,
+     .option     = test_options,
  };
  
 +static void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
 +{
 +    vfprintf(stdout, fmt, vl);
 +}
 +
  int main(void)
  {
      int i;



More information about the ffmpeg-cvslog mailing list