On 25.08.2015 00:19, Michael Niedermayer wrote:
> On Tue, Aug 25, 2015 at 12:03:59AM +0200, Andreas Cadhalpun wrote:
>> On 24.08.2015 02:22, Michael Niedermayer wrote:
>>> is below diff better: ?
>>> iam quite unsure how to word this
>>>
>>> using the exact same system as FF_API_OLD_FILTER_OPTS is tricky as
>>> there is a semantic difference
>>> "codec->flags & AV_CODEC_FLAG_BITEXACT" is not deprecated as in
>>> FF_API_OLD_FILTER_OPTS
>>> Currently storing a bitexact stream in a container makes the
>>> container bitexact. with FF_API_LAVF_BITEXACT==0 this would no longer
>>> be the case and the user would have to explicitly switch the muxer
>>> into bitexact mode in addition to the encoder to get a bitexact
>>> result.
>>>
>>> --- a/libavformat/mux.c
>>> +++ b/libavformat/mux.c
>>> @@ -250,10 +250,17 @@ static int init_muxer(AVFormatContext *s, 
>>> AVDictionary **options)
>>>          (ret = av_opt_set_dict2(s->priv_data, &tmp, 
>>> AV_OPT_SEARCH_CHILDREN)) < 0)
>>>          goto fail;
>>>
>>> +    if (s->nb_streams && s->streams[0]->codec->flags & 
>>> AV_CODEC_FLAG_BITEXACT) {
>>> +        if (!(s->flags & AVFMT_FLAG_BITEXACT))
>>> +            av_log(s, AV_LOG_WARNING, "Muxer bitexact flag is not set, 
>>> please set AVFormatContext.flags |= AVFMT_FLAG_BITEXACT.\n"
>>> +#if FF_API_LAVF_BITEXACT
>>> +                                      "This will become mandatory with 
>>> future API cleanup\n"
>>> +#endif
>>> +            );
>>
>> I'd prefer something like:
> 
> whatever people/you prefer,
> please set Author to you, if you push

OK, attaching a proper patch.
I'll push that if nobody complains.

Best regards,
Andreas

>From 67f20f0a4eb918f7f7911f620cd024043fd44d7a Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
Date: Tue, 25 Aug 2015 00:37:04 +0200
Subject: [PATCH] mux: warn if the encoders bitexact flag is set, but not the
 muxers

Based-on-patch-by: Michael Niedermayer <mich...@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
---
 libavformat/mux.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 81c4676..8d5867c 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -250,10 +250,23 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options)
         (ret = av_opt_set_dict2(s->priv_data, &tmp, AV_OPT_SEARCH_CHILDREN)) < 0)
         goto fail;
 
+    if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT) {
+        if (!(s->flags & AVFMT_FLAG_BITEXACT)) {
 #if FF_API_LAVF_BITEXACT
-    if (s->nb_streams && s->streams[0]->codec->flags & AV_CODEC_FLAG_BITEXACT)
-        s->flags |= AVFMT_FLAG_BITEXACT;
+            av_log(s, AV_LOG_WARNING,
+                   "Setting the AVFormatContext to bitexact mode, because "
+                   "the AVCodecContext is in that mode. This behavior will "
+                   "change in the future. To keep the current behavior, set "
+                   "AVFormatContext.flags |= AVFMT_FLAG_BITEXACT.\n");
+            s->flags |= AVFMT_FLAG_BITEXACT;
+#else
+            av_log(s, AV_LOG_WARNING,
+                   "The AVFormatContext is not in set to bitexact mode, only "
+                   "the AVCodecContext. If this is not intended, set "
+                   "AVFormatContext.flags |= AVFMT_FLAG_BITEXACT.\n");
 #endif
+        }
+    }
 
     // some sanity checks
     if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) {
-- 
2.5.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to