Re: [FFmpeg-devel] [PATCH 1/2] avcodec/options: factorize avcodec_copy_context cleanup code

2017-04-22 Thread Aaron Levinson

On 4/22/2017 10:26 AM, James Almer wrote:

Signed-off-by: James Almer 
---
 libavcodec/options.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7bdb0be5af..b98da9378a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -188,6 +188,19 @@ void avcodec_free_context(AVCodecContext **pavctx)
 }

 #if FF_API_COPY_CONTEXT
+static void copy_context_reset(AVCodecContext *avctx)
+{
+av_opt_free(avctx);
+av_freep(&avctx->rc_override);
+av_freep(&avctx->intra_matrix);
+av_freep(&avctx->inter_matrix);
+av_freep(&avctx->extradata);
+av_freep(&avctx->subtitle_header);
+av_buffer_unref(&avctx->hw_frames_ctx);
+avctx->subtitle_header_size = 0;
+avctx->extradata_size = 0;
+}
+
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {
 const AVCodec *orig_codec = dest->codec;
@@ -200,12 +213,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 return AVERROR(EINVAL);
 }

-av_opt_free(dest);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_freep(&dest->subtitle_header);
+copy_context_reset(dest);

 memcpy(dest, src, sizeof(*dest));
 av_opt_copy(dest, src);
@@ -264,15 +272,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;

 fail:
-av_freep(&dest->subtitle_header);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_buffer_unref(&dest->hw_frames_ctx);
-dest->subtitle_header_size = 0;
-dest->extradata_size = 0;
-av_opt_free(dest);
+copy_context_reset(dest);
 return AVERROR(ENOMEM);
 }
 #endif



There is one real difference in the behavior--it will call 
av_buffer_unref(&dest->hw_frames_ctx) the first time around, and this 
wasn't done before.  The initialization of subtitle_header_size and 
extradata_size to 0 doesn't really matter the first time around, since 
they will be overwritten anyway as a result of using memcpy(), but the 
use of av_buffer_unref() does technically change the behavior compared 
to what it used to do.  It is likely correct to do that the first time 
through, but I wonder, why not also do 
av_buffer_unref(&avctx->hw_device_ctx) and a bunch of the other things 
that avcodec_close() already does?  The call to memcpy() will basically 
overwrite dest with the values in src, and besides the copies made of 
dest->codec and dest->priv_data earlier in the function, anything else 
that is overwritten could in theory leak.  But, I guess that would have 
been a preexisting issue with this function and not really relevant for 
this patch.  And this function is deprecated anyway.


If there is no issue with the additional call to av_buffer_unref(), as 
mentioned above, this patch looks good.


Aaron Levinson
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Notify user when encode a CBR mp3 file without "-write_xing false". This may result in mp3 file duration incorect on ios safari browser and webview. I try to fix it but it c

2017-04-22 Thread sharp bai
ios safari browser support the xing header, and the duration of the
mp3 file with xing header is correct. But with "Info" replaced "Xing"
in xing header in CBR mode, ios safari browser does not skip the first
frame and using the first frame header(the bitrate in header has
changed to enlarge frame size as xing frame needs at least 177 bytes)
to calculate duration.

2017-04-23 0:29 GMT+08:00 Michael Niedermayer :
> On Fri, Apr 21, 2017 at 10:59:41PM +0800, sharp...@gmail.com wrote:
>> From: sharpbai 
>>
>> Bug example:
>>
>> ffmpeg -i a.mp3 -c:a mp3 -ab 32k -ar 44100 -ac 1 b.mp3
>>
>> The duration of the generated file b.mp3 is wrong on ios safari browser from 
>> ios7 to ios10.
>> ---
>>  libavformat/mp3enc.c | 7 ++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> ios safari browser doesnt support the xing header ?
>
> [...]
>
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>



-- 
Regards,

Sharpbai
Focus on web programming.

Blog - http://blog.tbai.me/
Weibo - http://weibo.com/iambaitian
Renren - http://renren.com/sharpbai
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavformat/mp3enc: Notify to add "-write_xing false" in CBR mode

2017-04-22 Thread sharpbai
From: sharpbai 

Encoding a CBR mp3 file without "-write_xing false" may result in
mp3 file duration incorect on ios safari browser and webview.
I try to fix it but it can’t be done as mp3 muxer don’t know
it is a CBR file until encode process finished. And it’s hard
to remove the first frame at that time. Only the mp3 encoder
(such as libmp3lame) know it is CBR or not before encoding start.

Bug example:

ffmpeg -i a.mp3 -c:a mp3 -ab 32k -ar 44100 -ac 1 b.mp3

The duration of the generated file b.mp3 is wrong on ios safari
browser from ios7 to ios10.

Working example:
ffmpeg -i a.mp3 -c:a mp3 -ab 32k -ar 44100 -ac 1 \
-write_xing false b.mp3
---
 libavformat/mp3enc.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 3cbf7bd..a55dbf4 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -395,8 +395,13 @@ static void mp3_update_xing(AVFormatContext *s)
 int i, rg_size;
 
 /* replace "Xing" identification string with "Info" for CBR files. */
-if (!mp3->has_variable_bitrate)
+if (!mp3->has_variable_bitrate) {
 AV_WL32(mp3->xing_frame + mp3->xing_offset, MKTAG('I', 'n', 'f', 'o'));
+av_log(s, AV_LOG_WARNING,
+"This is a CBR mp3 file. But its first frame header might be 
wrong, "
+"which result in file duration incorrect on ios browser. "
+"Please add \"-write_xing false\" to avoid this problem.\n");
+}
 
 AV_WB32(mp3->xing_frame + mp3->xing_offset + 8,  mp3->frames);
 AV_WB32(mp3->xing_frame + mp3->xing_offset + 12, mp3->size);
-- 
2.10.1

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


Re: [FFmpeg-devel] [PATCH 1/7] avcodec: do not use AVFrame accessor

2017-04-22 Thread Hendrik Leppkes
On Sat, Apr 22, 2017 at 8:57 PM, Nicolas George  wrote:
> Le tridi 3 floréal, an CCXXV, Aaron Levinson a écrit :
>> Then why have the accessors at all if the fields are public?
>
> To ensure ABI compatibility with the fork, which has been dropped.
>

To elaborate on that, the accessors existed primarily for fields which
only exist in FFmpeg, and not in Libav, so that when Libav added a
field, we could add it in the same position as them, and preserve ABI
compatibility to Libav (ie. having all fields in the struct in the
same place).
Due to this practice, any fields Libav didn't have had to be at the
end of the struct, and they would move everytime a new field was added
on Libavs side (which would end up before the FFmpeg-only fields) -
hence accessors to work around the constant ABI changes to these
fields.

But we have decided a while ago that we do no longer want to pretent
to maintain ABI compat (it was never fully functional and basically
untested), and as such there is no need to have them anymore (it was a
bit clumsy to use either  way, as only a minority of fields had them,
so it was easy to use it wrong).

On top of these changes, the accessors should also be deprecated and
then eventually removed (after the typical deprecation period), and
all public fields in the structs accessed directly again.

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


Re: [FFmpeg-devel] libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL is greater than 1

2017-04-22 Thread Marton Balint


On Fri, 21 Apr 2017, Marton Balint wrote:



On Thu, 20 Apr 2017, Aaron Levinson wrote:


On 4/19/2017 2:27 PM, Marton Balint wrote:


On Mon, 17 Apr 2017, James Almer wrote:


On 4/17/2017 5:39 AM, Clément Bœsch wrote:

On Sun, Apr 16, 2017 at 05:20:02PM -0700, Aaron Levinson wrote:

From 9e6a9e2b8d58f17c661a3f455e03c95587ec7b18 Mon Sep 17 00:00:00 2001
From: Aaron Levinson 
Date: Sun, 16 Apr 2017 17:13:31 -0700
Subject: [PATCH] libavutil/thread.h:  Fixed g++ build error when
 ASSERT_LEVEL is greater than 1

Purpose: libavutil/thread.h: Fixed g++ build error when ASSERT_LEVEL
is greater than 1.  This is only relevant when thread.h is included by
C++ files.  In this case, the relevant code is only defined if
HAVE_PTHREADS is defined as 1.  Use configure --assert-level=2 to do
so.

Note: Issue discovered as a result of Coverity build failure.  Cause
of build failure pinpointed by Hendrik Leppkes.

Comments:

-- libavutil/thread.h: Altered ASSERT_PTHREAD_NORET definition such
   that it uses av_make_error_string instead of av_err2str().
   av_err2str() uses a "parenthesized type followed by an initializer
   list", which is apparently not valid C++.  This issue started
   occurring because thread.h is now included by the DeckLink C++
   files.  The alteration does the equivalent of what av_err2str()
   does, but instead declares the character buffer as a local
   variable.
---
 libavutil/thread.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/thread.h b/libavutil/thread.h
index 6e57447..f108e20 100644
--- a/libavutil/thread.h
+++ b/libavutil/thread.h
@@ -36,8 +36,11 @@
 #define ASSERT_PTHREAD_NORET(func, ...) do
{\
 int ret =
func(__VA_ARGS__);\
 if (ret)
{  \
+char errbuf[AV_ERROR_MAX_STRING_SIZE] =
""; \
 av_log(NULL, AV_LOG_FATAL,
AV_STRINGIFY(func)   \
-   " failed with error: %s\n",
av_err2str(AVERROR(ret)));   \
+   " failed with error:
%s\n",  \
+   av_make_error_string(errbuf,
AV_ERROR_MAX_STRING_SIZE,   \
+
AVERROR(ret))); \

abort();\

}   \
 } while (0)


I don't like limiting ourselves in the common C code of the project
because C++ is a bad and limited language. Can't you solve this by
bumping
the minimal requirement of C++ version?


We're already using C++11 when available because of atomics on
mediacodec.
Also, just tried and it seems to fail even with C++14, so it just doesn't
work with C++.

We could instead just make these strict assert wrappers work only on C
code by for example checking for defined(__cplusplus).


I'd say let's apply the patch as is, that is the simplest solution.

Regards,
Marton


I don't think most people care one way or the other--perhaps someone 
with push privileges could apply the patch?  I assume that the Coverity 
builds are continuing to fail as a result of the issue that this patch 
addresses.


Ok, I will apply this tomorrow.



Applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg; check return code of avcodec_send_frame when flushing encoders

2017-04-22 Thread Marton Balint


On Wed, 19 Apr 2017, Marton Balint wrote:




On Tue, 18 Apr 2017, Michael Niedermayer wrote:


On Tue, Apr 18, 2017 at 08:46:24PM +0200, Marton Balint wrote:



On Tue, 18 Apr 2017, Michael Niedermayer wrote:


On Tue, Apr 18, 2017 at 07:09:30AM +0200, Nicolas George wrote:

Le nonidi 29 germinal, an CCXXV, Michael Niedermayer a écrit :
+while ((ret = avcodec_receive_packet(enc, &pkt)) == 

AVERROR(EAGAIN)) {

+ret = avcodec_send_frame(enc, NULL);


The doc says:

# The functions will not return AVERROR(EAGAIN), unless you forgot to
# enter draining mode.


The full paragraph in the docs which you qoted from says this:
* - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
*   (encoding) in a loop until AVERROR_EOF is returned. The functions 

will

*   not return AVERROR(EAGAIN), unless you forgot to enter draining mode.

the patch adds a check to avcodec_send_frame()





can the code be changed to not require this ?


I would say the code does not require this as is.


For decoding theres an explicit
"Sending the first flush packet will return success."


As far as I see this sentence is only true if there was no decoding
error in the legacy API during a flush. So this should probably be
changed to something like "The first flush packet will not return
AVERROR_EOF, if it returns success then any subsequent flush packets
will return AVERROR_EOF." By the way we also guarantee this at
libavcodec level, so it is harder to write a codec with the new API
which violates this.


I cannot find similar for encoding, which is the case the patch changes
and what i think should be fixed if possible as it would be simpler,
making the patch unneeded.
Its quite possible iam missing something that makes it uneeded though


The same is true for send_frame, based on the code involving the
legacy API.

We can of course decide to change the code involving the legacy API
and enforce that flushing always succeed, but I'd rather keep it as
is, even if that means a bit more error checking. It would be ugly
API-wise that you sometimes have to check the return value of a
function, sometimes you don't.


iam happy with any solution or the patch as is



Unless there are no further comments I will apply this as is and backport 
it to 3.3 as well.


Pushed.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avfilter: add pixscope filter

2017-04-22 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavfilter/Makefile   |   1 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/vf_datascope.c | 218 +++--
 3 files changed, 213 insertions(+), 7 deletions(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 50c5132..feb1404 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -244,6 +244,7 @@ OBJS-$(CONFIG_PERMS_FILTER)  += f_perms.o
 OBJS-$(CONFIG_PERSPECTIVE_FILTER)+= vf_perspective.o
 OBJS-$(CONFIG_PHASE_FILTER)  += vf_phase.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
+OBJS-$(CONFIG_PIXSCOPE_FILTER)   += vf_datascope.o
 OBJS-$(CONFIG_PP_FILTER) += vf_pp.o
 OBJS-$(CONFIG_PP7_FILTER)+= vf_pp7.o
 OBJS-$(CONFIG_PREMULTIPLY_FILTER)+= vf_premultiply.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index f482adb..262f14b 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -254,6 +254,7 @@ static void register_all(void)
 REGISTER_FILTER(PERSPECTIVE,perspective,vf);
 REGISTER_FILTER(PHASE,  phase,  vf);
 REGISTER_FILTER(PIXDESCTEST,pixdesctest,vf);
+REGISTER_FILTER(PIXSCOPE,   pixscope,   vf);
 REGISTER_FILTER(PP, pp, vf);
 REGISTER_FILTER(PP7,pp7,vf);
 REGISTER_FILTER(PREMULTIPLY,premultiply,vf);
diff --git a/libavfilter/vf_datascope.c b/libavfilter/vf_datascope.c
index 01a5d99..057a503 100644
--- a/libavfilter/vf_datascope.c
+++ b/libavfilter/vf_datascope.c
@@ -76,7 +76,7 @@ static int query_formats(AVFilterContext *ctx)
 return ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0));
 }
 
-static void draw_text(DatascopeContext *s, AVFrame *frame, FFDrawColor *color,
+static void draw_text(FFDrawContext *draw, AVFrame *frame, FFDrawColor *color,
   int x0, int y0, const uint8_t *text, int vertical)
 {
 int x = x0;
@@ -87,7 +87,7 @@ static void draw_text(DatascopeContext *s, AVFrame *frame, 
FFDrawColor *color,
 y0 += 8;
 continue;
 }
-ff_blend_mask(&s->draw, color, frame->data, frame->linesize,
+ff_blend_mask(draw, color, frame->data, frame->linesize,
   frame->width, frame->height,
   avpriv_cga_font + *text * 8, 1, 8, 8, 0, 0, x, y0);
 if (vertical) {
@@ -201,7 +201,7 @@ static int filter_color2(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs
 char text[256];
 
 snprintf(text, sizeof(text), format[C>>2], value[p]);
-draw_text(s, out, &reverse, xoff + x * C * 10 + 2, yoff + y * 
P * 12 + p * 10 + 2, text, 0);
+draw_text(&s->draw, out, &reverse, xoff + x * C * 10 + 2, yoff 
+ y * P * 12 + p * 10 + 2, text, 0);
 }
 }
 }
@@ -239,7 +239,7 @@ static int filter_color(AVFilterContext *ctx, void *arg, 
int jobnr, int nb_jobs)
 char text[256];
 
 snprintf(text, sizeof(text), format[C>>2], value[p]);
-draw_text(s, out, &color, xoff + x * C * 10 + 2, yoff + y * P 
* 12 + p * 10 + 2, text, 0);
+draw_text(&s->draw, out, &color, xoff + x * C * 10 + 2, yoff + 
y * P * 12 + p * 10 + 2, text, 0);
 }
 }
 }
@@ -276,7 +276,7 @@ static int filter_mono(AVFilterContext *ctx, void *arg, int 
jobnr, int nb_jobs)
 char text[256];
 
 snprintf(text, sizeof(text), format[C>>2], value[p]);
-draw_text(s, out, &s->white, xoff + x * C * 10 + 2, yoff + y * 
P * 12 + p * 10 + 2, text, 0);
+draw_text(&s->draw, out, &s->white, xoff + x * C * 10 + 2, 
yoff + y * P * 12 + p * 10 + 2, text, 0);
 }
 }
 }
@@ -328,7 +328,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 ff_fill_rectangle(&s->draw, &s->gray, out->data, out->linesize,
   0, xmaxlen + y * P * 12 + (P + 1) * P - 2, 
ymaxlen, 10);
 
-draw_text(s, out, &s->yellow, 2, xmaxlen + y * P * 12 + (P + 1) * 
P, text, 0);
+draw_text(&s->draw, out, &s->yellow, 2, xmaxlen + y * P * 12 + (P 
+ 1) * P, text, 0);
 }
 
 for (x = 0; x < X; x++) {
@@ -337,7 +337,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 ff_fill_rectangle(&s->draw, &s->gray, out->data, out->linesize,
   ymaxlen + x * C * 10 + 2 * C - 2, 0, 10, 
xmaxlen);
 
-draw_text(s, out, &s->yellow, ymaxlen + x * C * 10 + 2 * C, 2, 
text, 1);
+draw_text(&s->draw, out, &s->yellow, ymaxlen + x * C * 10 + 2 * C, 
2, text, 1);
 }
 }
 
@@ -419,3 +419,207 @@ AVFilter ff_vf_datascope = {
 .outputs   = outputs,
 .flags = AVFILTER_FLAG_SLICE_THREADS,
 }

Re: [FFmpeg-devel] [PATCH] Added additional note to fate.texi to describe the importance of not checking out files from git with core.autocrlf set to true

2017-04-22 Thread Aaron Levinson

On 4/22/2017 12:09 PM, Hendrik Leppkes wrote:

On Sat, Apr 22, 2017 at 9:07 PM, Aaron Levinson  wrote:



On 4/22/2017 2:16 AM, Clément Bœsch wrote:


On Fri, Apr 21, 2017 at 04:48:27PM -0700, Aaron Levinson wrote:
[...]


diff --git a/doc/fate.texi b/doc/fate.texi
index 7a96c25..f3b8c0c8 100644
--- a/doc/fate.texi
+++ b/doc/fate.texi
@@ -77,6 +77,16 @@ FATE_SAMPLES=fate-suite/ make fate
 @float NOTE
 Do not put a '~' character in the samples path to indicate a home
 directory. Because of shell nuances, this will cause FATE to fail.
+
+In addition, FATE will fail if files are checked out from git such
+that @kbd{@key{CR}@key{LF}} is used for line endings.  This will occur
+on Windows when git is installed using the default options, because
+that causes git's @var{core.autocrlf} setting to be set to
+@option{true}.  Make sure to set @var{core.autocrlf} to @option{input}
+or @option{false}, or, in the case that the repository has already
+been cloned, it is possible to get past this by executing the
+following command in the top-level ffmpeg directory: @command{find
+-name '*.h' -type f | xargs dos2unix}.
 @end float



This is documented in doc/git-howto.texi, isn't it?



Yes it is, but just because it can be found elsewhere in the documentation
doesn't mean there isn't benefit to having a fallback elsewhere in the
documentation.


Can't we just make it point there, instead of explaining it again?


OK, I'll do that.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Added additional note to fate.texi to describe the importance of not checking out files from git with core.autocrlf set to true

2017-04-22 Thread Hendrik Leppkes
On Sat, Apr 22, 2017 at 9:07 PM, Aaron Levinson  wrote:
>
>
> On 4/22/2017 2:16 AM, Clément Bœsch wrote:
>>
>> On Fri, Apr 21, 2017 at 04:48:27PM -0700, Aaron Levinson wrote:
>> [...]
>>>
>>> diff --git a/doc/fate.texi b/doc/fate.texi
>>> index 7a96c25..f3b8c0c8 100644
>>> --- a/doc/fate.texi
>>> +++ b/doc/fate.texi
>>> @@ -77,6 +77,16 @@ FATE_SAMPLES=fate-suite/ make fate
>>>  @float NOTE
>>>  Do not put a '~' character in the samples path to indicate a home
>>>  directory. Because of shell nuances, this will cause FATE to fail.
>>> +
>>> +In addition, FATE will fail if files are checked out from git such
>>> +that @kbd{@key{CR}@key{LF}} is used for line endings.  This will occur
>>> +on Windows when git is installed using the default options, because
>>> +that causes git's @var{core.autocrlf} setting to be set to
>>> +@option{true}.  Make sure to set @var{core.autocrlf} to @option{input}
>>> +or @option{false}, or, in the case that the repository has already
>>> +been cloned, it is possible to get past this by executing the
>>> +following command in the top-level ffmpeg directory: @command{find
>>> +-name '*.h' -type f | xargs dos2unix}.
>>>  @end float
>>>
>>
>> This is documented in doc/git-howto.texi, isn't it?
>
>
> Yes it is, but just because it can be found elsewhere in the documentation
> doesn't mean there isn't benefit to having a fallback elsewhere in the
> documentation.

Can't we just make it point there, instead of explaining it again?

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


Re: [FFmpeg-devel] [PATCH] Added additional note to fate.texi to describe the importance of not checking out files from git with core.autocrlf set to true

2017-04-22 Thread Aaron Levinson



On 4/22/2017 2:16 AM, Clément Bœsch wrote:

On Fri, Apr 21, 2017 at 04:48:27PM -0700, Aaron Levinson wrote:
[...]

diff --git a/doc/fate.texi b/doc/fate.texi
index 7a96c25..f3b8c0c8 100644
--- a/doc/fate.texi
+++ b/doc/fate.texi
@@ -77,6 +77,16 @@ FATE_SAMPLES=fate-suite/ make fate
 @float NOTE
 Do not put a '~' character in the samples path to indicate a home
 directory. Because of shell nuances, this will cause FATE to fail.
+
+In addition, FATE will fail if files are checked out from git such
+that @kbd{@key{CR}@key{LF}} is used for line endings.  This will occur
+on Windows when git is installed using the default options, because
+that causes git's @var{core.autocrlf} setting to be set to
+@option{true}.  Make sure to set @var{core.autocrlf} to @option{input}
+or @option{false}, or, in the case that the repository has already
+been cloned, it is possible to get past this by executing the
+following command in the top-level ffmpeg directory: @command{find
+-name '*.h' -type f | xargs dos2unix}.
 @end float



This is documented in doc/git-howto.texi, isn't it?


Yes it is, but just because it can be found elsewhere in the 
documentation doesn't mean there isn't benefit to having a fallback 
elsewhere in the documentation.


Aaron Levinson
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/7] avcodec: do not use AVFrame accessor

2017-04-22 Thread Nicolas George
Le tridi 3 floréal, an CCXXV, Aaron Levinson a écrit :
> Then why have the accessors at all if the fields are public?

To ensure ABI compatibility with the fork, which has been dropped.

Regards,

-- 
  Nicolas George


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/7] avcodec: do not use AVFrame accessor

2017-04-22 Thread Aaron Levinson

On 4/22/2017 2:27 AM, wm4 wrote:

On Sat, 22 Apr 2017 16:04:22 +0700
Muhammad Faiz  wrote:


Signed-off-by: Muhammad Faiz 
---


+1 to patches 1-7. As long as the accessors only trivially access
public fields, it's better (and less ugly) not to use accessors at all.


Then why have the accessors at all if the fields are public?  As far as 
I can tell, the benefit to using these accessors is that, if certain 
properties become internal in the future, or variable names change, or 
the structures become opaque, etc, the code will continue to work.


Aaron Levinson
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v3 1/2] avfilter/interlace: change lowpass_line function prototype

2017-04-22 Thread Michael Niedermayer
On Thu, Apr 20, 2017 at 11:53:29PM +0200, Thomas Mundt wrote:
> Hi,
> 
> this patch set
> 1) changes the lowpass_line function prototype in vf_interlace and
> vf_tinterlace as suggested by James Almer.
> 2) adds a complex (-1 2 6 2 -1) vertical low-pass filter to
> vf_interlace and vf_tinterlace.
> This one slightly less reduces interlace 'twitter' but better retains
> detail and subjective sharpness impression compared to the linear (1 2
> 1) filter.
> The (-1 2 6 2 -1) filter gave best results tested with several CRT,
> TFT and OLED monitors, hardware and software deinterlacers.
> 
> Patch attached...

>  interlace.h  |2 +-
>  tinterlace.h |2 +-
>  vf_interlace.c   |   17 +
>  vf_tinterlace.c  |   14 --
>  x86/vf_interlace.asm |   30 +++---
>  x86/vf_interlace_init.c  |6 ++
>  x86/vf_tinterlace_init.c |6 ++
>  7 files changed, 38 insertions(+), 39 deletions(-)
> 981ec0f9e7a9d4a1aa80f3bae7d65209070083c7  
> 0001-avfilter-interlace-change-lowpass_line-function-prot.patch
> From 5f1edd7cfb26d1871172dcc33abc74b0ff4e88bf Mon Sep 17 00:00:00 2001
> From: Thomas Mundt 
> Date: Thu, 20 Apr 2017 23:26:59 +0200
> Subject: [PATCH 1/2] avfilter/interlace: change lowpass_line function
>  prototype

applied

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

During times of universal deceit, telling the truth becomes a
revolutionary act. -- George Orwell


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/2] avcodec/options: copy the coded_side_data in avcodec_copy_context()

2017-04-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/options.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index b98da9378a..c721aa8d43 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -190,15 +190,21 @@ void avcodec_free_context(AVCodecContext **pavctx)
 #if FF_API_COPY_CONTEXT
 static void copy_context_reset(AVCodecContext *avctx)
 {
+int i;
+
 av_opt_free(avctx);
 av_freep(&avctx->rc_override);
 av_freep(&avctx->intra_matrix);
 av_freep(&avctx->inter_matrix);
 av_freep(&avctx->extradata);
 av_freep(&avctx->subtitle_header);
+for (i = 0; i < avctx->nb_coded_side_data; i++)
+av_freep(&avctx->coded_side_data[i].data);
+av_freep(&avctx->coded_side_data);
 av_buffer_unref(&avctx->hw_frames_ctx);
 avctx->subtitle_header_size = 0;
 avctx->extradata_size = 0;
+avctx->nb_coded_side_data = 0;
 }
 
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
@@ -262,6 +268,28 @@ FF_ENABLE_DEPRECATION_WARNINGS
 alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1);
 av_assert0(dest->subtitle_header_size == src->subtitle_header_size);
 #undef alloc_and_copy_or_fail
+if (src->nb_coded_side_data) {
+int i;
+
+dest->nb_coded_side_data = 0;
+dest->coded_side_data = av_realloc_array(NULL, src->nb_coded_side_data,
+ 
sizeof(*dest->coded_side_data));
+if (!dest->coded_side_data)
+goto fail;
+
+for (i = 0; i < src->nb_coded_side_data; i++) {
+const AVPacketSideData *sd_src = &src->coded_side_data[i];
+AVPacketSideData *sd_dst = &dest->coded_side_data[i];
+
+sd_dst->data = av_malloc(sd_src->size);
+if (!sd_dst->data)
+goto fail;
+memcpy(sd_dst->data, sd_src->data, sd_src->size);
+sd_dst->size = sd_src->size;
+sd_dst->type = sd_src->type;
+dest->nb_coded_side_data++;
+}
+}
 
 if (src->hw_frames_ctx) {
 dest->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
-- 
2.12.1

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


[FFmpeg-devel] [PATCH 1/2] avcodec/options: factorize avcodec_copy_context cleanup code

2017-04-22 Thread James Almer
Signed-off-by: James Almer 
---
 libavcodec/options.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index 7bdb0be5af..b98da9378a 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -188,6 +188,19 @@ void avcodec_free_context(AVCodecContext **pavctx)
 }
 
 #if FF_API_COPY_CONTEXT
+static void copy_context_reset(AVCodecContext *avctx)
+{
+av_opt_free(avctx);
+av_freep(&avctx->rc_override);
+av_freep(&avctx->intra_matrix);
+av_freep(&avctx->inter_matrix);
+av_freep(&avctx->extradata);
+av_freep(&avctx->subtitle_header);
+av_buffer_unref(&avctx->hw_frames_ctx);
+avctx->subtitle_header_size = 0;
+avctx->extradata_size = 0;
+}
+
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {
 const AVCodec *orig_codec = dest->codec;
@@ -200,12 +213,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
AVCodecContext *src)
 return AVERROR(EINVAL);
 }
 
-av_opt_free(dest);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_freep(&dest->subtitle_header);
+copy_context_reset(dest);
 
 memcpy(dest, src, sizeof(*dest));
 av_opt_copy(dest, src);
@@ -264,15 +272,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 return 0;
 
 fail:
-av_freep(&dest->subtitle_header);
-av_freep(&dest->rc_override);
-av_freep(&dest->intra_matrix);
-av_freep(&dest->inter_matrix);
-av_freep(&dest->extradata);
-av_buffer_unref(&dest->hw_frames_ctx);
-dest->subtitle_header_size = 0;
-dest->extradata_size = 0;
-av_opt_free(dest);
+copy_context_reset(dest);
 return AVERROR(ENOMEM);
 }
 #endif
-- 
2.12.1

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


Re: [FFmpeg-devel] fate/exr : fix pix_fmt for pxr24 half/uint32

2017-04-22 Thread Martin Vignali
>
> How does it fix it ?
> if it doesnt contain alpha but tests alpha thats a bit odd and may
> test things that otherwise wouldnt be tested.
> But "fix" sounds like theres something wrong, not just odd
> Can you clarify/elaborate ?
>
> thx
>
>
Hello,

I made a copy and paste of a previous line when i create this fate test
The original sample, doesn't have alpha, so testing an rgba output doesn't
seems right, for a decoder fate test.

If i build ffmpeg with a configure line made to just enable exr
decoding/framecrc (in other word, just to check exr fate test), this test
fail.
So seems to be more clean, to use the right pixel format here.

If you think it's necessary to test rgb48 to rgba64 conversion, IMHO
another fate test need to be created just for that, with different
dependancy

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


Re: [FFmpeg-devel] [PATCH] Notify user when encode a CBR mp3 file without "-write_xing false". This may result in mp3 file duration incorect on ios safari browser and webview. I try to fix it but it c

2017-04-22 Thread Michael Niedermayer
On Fri, Apr 21, 2017 at 10:59:41PM +0800, sharp...@gmail.com wrote:
> From: sharpbai 
> 
> Bug example:
> 
> ffmpeg -i a.mp3 -c:a mp3 -ab 32k -ar 44100 -ac 1 b.mp3
> 
> The duration of the generated file b.mp3 is wrong on ios safari browser from 
> ios7 to ios10.
> ---
>  libavformat/mp3enc.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

ios safari browser doesnt support the xing header ?

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] fate/exr : fix pix_fmt for pxr24 half/uint32

2017-04-22 Thread Michael Niedermayer
On Sun, Apr 02, 2017 at 11:00:52PM +0200, Martin Vignali wrote:
> Hello,
> 
> In attach a patch to fix a fate test, the sample doesn't have alpha
> 
> Martin

>  fate/image.mak   |2 +-
>  ref/fate/exr-rgb-scanline-pxr24-half-uint32-13x9 |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 61699ec097d5bb2e85563791720fe8f592822ab4  0003-fate-exr-fix-pix_fmt.patch
> From 8f8d3859ec32310f56816d77904fbd488e884dd7 Mon Sep 17 00:00:00 2001
> From: Martin Vignali 
> Date: Sun, 2 Apr 2017 22:37:51 +0200
> Subject: [PATCH 3/3] fate/exr : fix pix_fmt
> 
> rgb_scanline_pxr24_half_uint32_13x9.exr doesn't have alpha

How does it fix it ?
if it doesnt contain alpha but tests alpha thats a bit odd and may
test things that otherwise wouldnt be tested.
But "fix" sounds like theres something wrong, not just odd
Can you clarify/elaborate ?

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Fixed memory leaks associated with AVStream objects if FF_API_LAVF_AVCTX is defined

2017-04-22 Thread Michael Niedermayer
On Fri, Apr 21, 2017 at 06:05:12PM -0300, James Almer wrote:
> On 4/21/2017 6:03 PM, James Almer wrote:
> >On 4/21/2017 12:09 PM, Michael Niedermayer wrote:
> >>On Thu, Apr 20, 2017 at 11:30:13PM -0700, Aaron Levinson wrote:
> >>> From 4f27e910aca6dae6642b4d73cf07fa0d6c4b1618 Mon Sep 17 00:00:00 2001
> >>>From: Aaron Levinson 
> >>>Date: Thu, 20 Apr 2017 23:20:20 -0700
> >>>Subject: [PATCH] Fixed memory leaks associated with AVStream objects if
> >>>  FF_API_LAVF_AVCTX is defined
> >>>
> >>>Purpose: Fixed memory leaks associated with AVStream objects if
> >>>FF_API_LAVF_AVCTX is defined.  If FF_API_LAVF_AVCTX is defined,
> >>>AVStream::codec is set to an AVCodecContext object, and this wasn't
> >>>being deallocated properly when the AVStream object was freed.  While
> >>>FF_API_LAVF_AVCTX has to do with deprecated functionality, in
> >>>practice, it will always be defined for typical builds currently,
> >>>since it is defined in libavformat\version.h if
> >>>LIBAVFORMAT_VERSION_MAJOR is less than 58, and
> >>>LIBAVFORMAT_VERSION_MAJOR is currently set to 57.
> >>>
> >>>Comments:
> >>>
> >>>-- libavformat/utils.c: Now using avcodec_free_context() to properly
> >>>deallocate st->codec in free_stream() if FF_API_LAVF_AVCTX is
> >>>defined.
> >>>---
> >>>  libavformat/utils.c | 4 +---
> >>>  1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >>please use "make fate" to test your changes
> >>
> >>This one causes many all? tests to segfault
> >
> >The issue is coded_side_data in AVStream->codec.
> >
> >ffmpeg.c calls avcodec_copy_context() to copy the encoder AVCodecContext
> >to the output's AVStream->codec because the latter is still needed
> >by some internal code in lavf/utils.c and such.
> >avcodec_copy_context() copies the coded_side_data pointer as part
> >of its memcpy call but not the buffers, and by the time
> >avcodec_free_context() is called for AVStream->codec the buffers
> >said pointer points to was already freed by the
> >avcodec_free_context() call for the encoder AVCodecContext.
> >
> >The proper solution: Remove the avcodec_copy_context() call in
> >ffmpeg.c and make libavformat stop needing AVStream->codec
> >internally. It should use AVStream->internal->avctx instead. Even
> >if this is not done now, it will anyway when the deprecation
> >period ends and it's time to remove AVStream->codec.
> >The easy but ugly solution until the above is done: Copy the
> >coded_side_data buffers in avcodec_copy_context().
> >
> >One could argue that by definition avcodec_copy_context() should
> >copy said side data, but the function is clearly marked as "do not
> >use, its behavior is ill defined" and the user is asked instead to
> >copy using an intermediary AVCodecParameters context instead.
> 
> The attached patch solves this the easy-but-ugly way.

>  options.c |   24 
>  1 file changed, 24 insertions(+)
> 871f5fb0223f619b031ccabdf08760e54645f7ba  
> 0001-avcodec-options-copy-the-coded_side_data-in-avcodec_.patch
> From 0660ae9b5c8e045d8817e9994b15bbc70065f8ad Mon Sep 17 00:00:00 2001
> From: James Almer 
> Date: Fri, 21 Apr 2017 17:52:02 -0300
> Subject: [PATCH] avcodec/options: copy the coded_side_data in
>  avcodec_copy_context()
> 
> Signed-off-by: James Almer 
> ---
>  libavcodec/options.c | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 7bdb0be5af..406bb34678 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -192,6 +192,7 @@ int avcodec_copy_context(AVCodecContext *dest, const 
> AVCodecContext *src)
>  {
>  const AVCodec *orig_codec = dest->codec;
>  uint8_t *orig_priv_data = dest->priv_data;
> +int i;
>  
>  if (avcodec_is_open(dest)) { // check that the dest context is 
> uninitialized
>  av_log(dest, AV_LOG_ERROR,
> @@ -206,6 +207,9 @@ int avcodec_copy_context(AVCodecContext *dest, const 
> AVCodecContext *src)
>  av_freep(&dest->inter_matrix);
>  av_freep(&dest->extradata);
>  av_freep(&dest->subtitle_header);
> +for (i = 0; i < dest->nb_coded_side_data; i++)
> +av_freep(&dest->coded_side_data[i].data);
> +av_freep(&dest->coded_side_data);
>  
>  memcpy(dest, src, sizeof(*dest));
>  av_opt_copy(dest, src);
> @@ -254,6 +258,26 @@ FF_ENABLE_DEPRECATION_WARNINGS
>  alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1);
>  av_assert0(dest->subtitle_header_size == src->subtitle_header_size);
>  #undef alloc_and_copy_or_fail
> +if (src->nb_coded_side_data) {
> +dest->nb_coded_side_data = 0;
> +dest->coded_side_data = av_realloc_array(NULL, 
> src->nb_coded_side_data,
> + 
> sizeof(*dest->coded_side_data));
> +if (!dest->coded_side_data)
> +return AVERROR(ENOMEM);
> +
> +for (i = 0; i < src->nb_coded_side_data; i++) {
> +const AVPacketSideData *sd_src = &src->coded_side_d

Re: [FFmpeg-devel] [PATCH] [UPDATE] HLS, add option to skip down streams,

2017-04-22 Thread wm4
On Fri, 21 Apr 2017 15:31:55 +0100
Amine kabab  wrote:

> Normally, all the streams
> 

Wouldn't it be better to only consider the selected streams for this?

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


Re: [FFmpeg-devel] [PATCH] [UPDATE] HLS, add option to skip down streams,

2017-04-22 Thread Moritz Barsnick
On Fri, Apr 21, 2017 at 11:34:39 +0100, Amine kabab wrote:
> +{"skip_down_streams", "continue playback of HLS when one of the variant 
> streams are down",
> +OFFSET(skip_down_streams), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 
> FLAGS},

"one" is singular, so this would be "... streams is down".

I would prefer:
"continue playback of HLS if any of the variant streams is down"
as "one" is wrong, strictly speaking.

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


[FFmpeg-devel] [PATCH] configure: Correct detection of pre-processor defines for configure _LISTS.

2017-04-22 Thread Matt Oliver
Currently the find_things configure function will scan a code file (e.g.
allfilters.c) and then create a list of pre-processor values to be added
to configure.
Unfortunately the way it currently does it is incorrect with what the
original c code expects. For example the following exists in
allfilters.c:
REGISTER_FILTER(FREI0R, frei0r_src, vsrc);

where REGISTER_FILTER is defined as:
#define REGISTER_FILTER(X, x, y)
{
extern AVFilter ff_##y##_##x;
if (CONFIG_##X##_FILTER)
avfilter_register(&ff_##y##_##x);
}

In c code this will check a configuration pre-processor define called
CONFIG_FREI0R_FILTER and then register the filter if currently set.

The issue arises in that configure currently looks for REGISTER_FILTER
but when found it will use the second parameter in the macro to create
the configuration option. So it will actually return that the
pre-processor define is CONFIG_FREI0R_SRC_FILTER and not
CONFIG_FREI0R_FILTER as the source code actually expects.

This patch changes the behaviour to match what the c code expects by
using the first parameter in the macro to create configure values. Since
the first parameter is in upper case it needs to be converted to lower
case to be usable within configure (this may be why currently the
incorrect - although lower case 2nd parameter is currently used).
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index e6fe05a6ee..346dbc660b 100755
--- a/configure
+++ b/configure
@@ -3366,7 +3366,7 @@ find_things(){
 thing=$1
 pattern=$2
 file=$source_path/$3
-sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p"
"$file"
+sed -n "s/^[^#]*$pattern.*(\([^,]*\),
*\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" | tr '[:upper:]' '[:lower:]'
 }

 ENCODER_LIST=$(find_things  encoder  ENC  libavcodec/allcodecs.c)
-- 
2.11.0.windows.3


0001-configure-Correct-detection-of-pre-processor-defines.patch
Description: Binary data
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: Correct detection of pre-processor defines for configure _LISTS.

2017-04-22 Thread Matt Oliver
On 22 April 2017 at 21:09, Matt Oliver  wrote:

> Currently the find_things configure function will scan a code file (e.g.
> allfilters.c) and then create a list of pre-processor values to be added
> to configure.
> Unfortunately the way it currently does it is incorrect with what the
> original c code expects. For example the following exists in
> allfilters.c:
> REGISTER_FILTER(FREI0R, frei0r_src, vsrc);
>
> where REGISTER_FILTER is defined as:
> #define REGISTER_FILTER(X, x, y)
> {
> extern AVFilter ff_##y##_##x;
> if (CONFIG_##X##_FILTER)
> avfilter_register(&ff_##y##_##x);
> }
>
> In c code this will check a configuration pre-processor define called
> CONFIG_FREI0R_FILTER and then register the filter if currently set.
>
> The issue arises in that configure currently looks for REGISTER_FILTER
> but when found it will use the second parameter in the macro to create
> the configuration option. So it will actually return that the
> pre-processor define is CONFIG_FREI0R_SRC_FILTER and not
> CONFIG_FREI0R_FILTER as the source code actually expects.
>
> This patch changes the behaviour to match what the c code expects by
> using the first parameter in the macro to create configure values. Since
> the first parameter is in upper case it needs to be converted to lower
> case to be usable within configure (this may be why currently the
> incorrect - although lower case 2nd parameter is currently used).
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index e6fe05a6ee..346dbc660b 100755
> --- a/configure
> +++ b/configure
> @@ -3366,7 +3366,7 @@ find_things(){
>  thing=$1
>  pattern=$2
>  file=$source_path/$3
> -sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p"
> "$file"
> +sed -n "s/^[^#]*$pattern.*(\([^,]*\), *\([^,]*\)\(,.*\)*).*/\1_$thing/p"
> "$file" | tr '[:upper:]' '[:lower:]'
>  }
>
>  ENCODER_LIST=$(find_things  encoder  ENC  libavcodec/allcodecs.c)
> --
> 2.11.0.windows.3
>

Currently there are also some differences in what the makefiles expect for
the few options that have different values for the first and second macro
parameters. I can change these but i just wanted to get feedback as to
whether this is considered correct first.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/7] avcodec: do not use AVFrame accessor

2017-04-22 Thread wm4
On Sat, 22 Apr 2017 16:04:22 +0700
Muhammad Faiz  wrote:

> Signed-off-by: Muhammad Faiz 
> ---

+1 to patches 1-7. As long as the accessors only trivially access
public fields, it's better (and less ugly) not to use accessors at all.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Added additional note to fate.texi to describe the importance of not checking out files from git with core.autocrlf set to true

2017-04-22 Thread Clément Bœsch
On Fri, Apr 21, 2017 at 04:48:27PM -0700, Aaron Levinson wrote:
[...]
> diff --git a/doc/fate.texi b/doc/fate.texi
> index 7a96c25..f3b8c0c8 100644
> --- a/doc/fate.texi
> +++ b/doc/fate.texi
> @@ -77,6 +77,16 @@ FATE_SAMPLES=fate-suite/ make fate
>  @float NOTE
>  Do not put a '~' character in the samples path to indicate a home
>  directory. Because of shell nuances, this will cause FATE to fail.
> +
> +In addition, FATE will fail if files are checked out from git such
> +that @kbd{@key{CR}@key{LF}} is used for line endings.  This will occur
> +on Windows when git is installed using the default options, because
> +that causes git's @var{core.autocrlf} setting to be set to
> +@option{true}.  Make sure to set @var{core.autocrlf} to @option{input}
> +or @option{false}, or, in the case that the repository has already
> +been cloned, it is possible to get past this by executing the
> +following command in the top-level ffmpeg directory: @command{find
> +-name '*.h' -type f | xargs dos2unix}.
>  @end float
>  

This is documented in doc/git-howto.texi, isn't it?

-- 
Clément B.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/7] avformat: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 libavformat/mux.c| 2 +-
 libavformat/uncodedframecrcenc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 3a5e876..4e21083 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1422,7 +1422,7 @@ static int 
av_write_uncoded_frame_internal(AVFormatContext *s, int stream_index,
 pkt.size = UNCODED_FRAME_PACKET_SIZE;
 pkt.pts  =
 pkt.dts  = frame->pts;
-pkt.duration = av_frame_get_pkt_duration(frame);
+pkt.duration = frame->pkt_duration;
 pkt.stream_index = stream_index;
 pkt.flags |= AV_PKT_FLAG_UNCODED_FRAME;
 }
diff --git a/libavformat/uncodedframecrcenc.c b/libavformat/uncodedframecrcenc.c
index ecc42d2..2f1a14c 100644
--- a/libavformat/uncodedframecrcenc.c
+++ b/libavformat/uncodedframecrcenc.c
@@ -79,7 +79,7 @@ static void audio_frame_cksum(AVBPrint *bp, AVFrame *frame)
 int nb_planes, nb_samples, p;
 const char *name;
 
-nb_planes  = av_frame_get_channels(frame);
+nb_planes  = frame->channels;
 nb_samples = frame->nb_samples;
 if (!av_sample_fmt_is_planar(frame->format)) {
 nb_samples *= nb_planes;
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 3/7] avdevice: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 libavdevice/alsa_enc.c |  2 +-
 libavdevice/lavfi.c| 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c
index bddc61f..0bef625 100644
--- a/libavdevice/alsa_enc.c
+++ b/libavdevice/alsa_enc.c
@@ -130,7 +130,7 @@ static int audio_write_frame(AVFormatContext *s1, int 
stream_index,
 pkt.data = (*frame)->data[0];
 pkt.size = (*frame)->nb_samples * s->frame_size;
 pkt.dts  = (*frame)->pkt_dts;
-pkt.duration = av_frame_get_pkt_duration(*frame);
+pkt.duration = (*frame)->pkt_duration;
 return audio_write_packet(s1, &pkt);
 }
 
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index eca3f15..ede391f 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -376,7 +376,7 @@ static int create_subcc_packet(AVFormatContext *avctx, 
AVFrame *frame,
 memcpy(lavfi->subcc_packet.data, sd->data, sd->size);
 lavfi->subcc_packet.stream_index = stream_idx;
 lavfi->subcc_packet.pts = frame->pts;
-lavfi->subcc_packet.pos = av_frame_get_pkt_pos(frame);
+lavfi->subcc_packet.pos = frame->pkt_pos;
 return 0;
 }
 
@@ -440,15 +440,15 @@ static int lavfi_read_packet(AVFormatContext *avctx, 
AVPacket *pkt)
 
 av_image_copy_to_buffer(pkt->data, size, (const uint8_t 
**)frame->data, frame->linesize,
 frame->format, frame->width, frame->height, 1);
-} else if (av_frame_get_channels(frame) /* FIXME test audio */) {
+} else if (frame->channels /* FIXME test audio */) {
 size = frame->nb_samples * av_get_bytes_per_sample(frame->format) *
-   av_frame_get_channels(frame);
+   frame->channels;
 if ((ret = av_new_packet(pkt, size)) < 0)
 return ret;
 memcpy(pkt->data, frame->data[0], size);
 }
 
-frame_metadata = av_frame_get_metadata(frame);
+frame_metadata = frame->metadata;
 if (frame_metadata) {
 uint8_t *metadata;
 AVDictionaryEntry *e = NULL;
@@ -479,7 +479,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, 
AVPacket *pkt)
 
 pkt->stream_index = stream_idx;
 pkt->pts = frame->pts;
-pkt->pos = av_frame_get_pkt_pos(frame);
+pkt->pos = frame->pkt_pos;
 pkt->size = size;
 av_frame_unref(frame);
 return size;
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 1/7] avcodec: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 libavcodec/ac3dec.c |  2 +-
 libavcodec/cpia.c   |  8 +++
 libavcodec/cuvid.c  |  6 ++---
 libavcodec/decode.c | 62 -
 libavcodec/encode.c |  2 +-
 libavcodec/exr.c|  2 +-
 libavcodec/gifdec.c |  2 +-
 libavcodec/mjpegdec.c   |  2 +-
 libavcodec/pngdec.c |  2 +-
 libavcodec/proresdec2.c |  2 +-
 libavcodec/rawdec.c |  4 ++--
 libavcodec/tiff.c   |  8 +++
 libavcodec/webp.c   |  2 +-
 13 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 4a0d8bb..7e2cbce 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1622,7 +1622,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void 
*data,
 }
 }
 
-av_frame_set_decode_error_flags(frame, err ? 
FF_DECODE_ERROR_INVALID_BITSTREAM : 0);
+frame->decode_error_flags = err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0;
 
 /* keep last block for error concealment in next frame */
 for (ch = 0; ch < s->out_channels; ch++)
diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c
index 07cdd50..58833b2 100644
--- a/libavcodec/cpia.c
+++ b/libavcodec/cpia.c
@@ -113,12 +113,12 @@ static int cpia_decode_frame(AVCodecContext *avctx,
 src += 2;
 
 if (src_size < linelength) {
-av_frame_set_decode_error_flags(frame, 
FF_DECODE_ERROR_INVALID_BITSTREAM);
+frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM;
 av_log(avctx, AV_LOG_WARNING, "Frame ended unexpectedly!\n");
 break;
 }
 if (src[linelength - 1] != EOL) {
-av_frame_set_decode_error_flags(frame, 
FF_DECODE_ERROR_INVALID_BITSTREAM);
+frame->decode_error_flags = FF_DECODE_ERROR_INVALID_BITSTREAM;
 av_log(avctx, AV_LOG_WARNING, "Wrong line length %d or line not 
terminated properly (found 0x%02x)!\n", linelength, src[linelength - 1]);
 break;
 }
@@ -139,7 +139,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
  */
 for (j = 0; j < linelength - 1; j++) {
 if (y > y_end) {
-av_frame_set_decode_error_flags(frame, 
FF_DECODE_ERROR_INVALID_BITSTREAM);
+frame->decode_error_flags = 
FF_DECODE_ERROR_INVALID_BITSTREAM;
 av_log(avctx, AV_LOG_WARNING, "Decoded data exceeded 
linesize!\n");
 break;
 }
@@ -159,7 +159,7 @@ static int cpia_decode_frame(AVCodecContext *avctx,
  */
 for (j = 0; j < linelength - 4; ) {
 if (y + 1 > y_end || u > u_end || v > v_end) {
-av_frame_set_decode_error_flags(frame, 
FF_DECODE_ERROR_INVALID_BITSTREAM);
+frame->decode_error_flags = 
FF_DECODE_ERROR_INVALID_BITSTREAM;
 av_log(avctx, AV_LOG_WARNING, "Decoded data exceeded 
linesize!\n");
 break;
 }
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 916d7e9..71f802c 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -582,9 +582,9 @@ FF_DISABLE_DEPRECATION_WARNINGS
 frame->pkt_pts = frame->pts;
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-av_frame_set_pkt_pos(frame, -1);
-av_frame_set_pkt_duration(frame, 0);
-av_frame_set_pkt_size(frame, -1);
+frame->pkt_pos = -1;
+frame->pkt_duration = 0;
+frame->pkt_size = -1;
 
 frame->interlaced_frame = !parsed_frame.is_deinterlacing && 
!parsed_frame.dispinfo.progressive_frame;
 
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index df9af68..0aaa6c5 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -136,7 +136,7 @@ static int unrefcount_frame(AVCodecInternal *avci, AVFrame 
*frame)
 memcpy(frame->data, avci->to_free->data, sizeof(frame->data));
 memcpy(frame->linesize, avci->to_free->linesize, sizeof(frame->linesize));
 if (avci->to_free->extended_data != avci->to_free->data) {
-int planes = av_frame_get_channels(avci->to_free);
+int planes = avci->to_free->channels;
 int size   = planes * sizeof(*frame->extended_data);
 
 if (!size) {
@@ -159,7 +159,7 @@ static int unrefcount_frame(AVCodecInternal *avci, AVFrame 
*frame)
 frame->height = avci->to_free->height;
 frame->channel_layout = avci->to_free->channel_layout;
 frame->nb_samples = avci->to_free->nb_samples;
-av_frame_set_channels(frame, av_frame_get_channels(avci->to_free));
+frame->channels   = avci->to_free->channels;
 
 return 0;
 }
@@ -333,9 +333,9 @@ int attribute_align_arg 
avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
 return AVERROR_EOF;
 ret = avctx->codec->receive_frame(avctx, frame);
 if (ret >= 0) {
-if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE) {
-

[FFmpeg-devel] [PATCH 4/7] avfilter: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 libavfilter/af_afade.c |  6 +++---
 libavfilter/af_amerge.c|  2 +-
 libavfilter/af_apad.c  |  2 +-
 libavfilter/af_aphaser.c   |  2 +-
 libavfilter/af_aresample.c |  2 +-
 libavfilter/af_ashowinfo.c |  6 +++---
 libavfilter/af_astats.c|  2 +-
 libavfilter/af_biquads.c   |  2 +-
 libavfilter/af_channelmap.c|  2 +-
 libavfilter/af_channelsplit.c  |  2 +-
 libavfilter/af_dynaudnorm.c|  6 +++---
 libavfilter/af_join.c  |  2 +-
 libavfilter/af_pan.c   |  2 +-
 libavfilter/af_volume.c|  2 +-
 libavfilter/af_volumedetect.c  |  2 +-
 libavfilter/avf_aphasemeter.c  |  2 +-
 libavfilter/avf_showcqt.c  |  4 ++--
 libavfilter/avf_showspectrum.c |  2 +-
 libavfilter/avfilter.c |  8 
 libavfilter/buffersrc.c|  4 ++--
 libavfilter/f_drawgraph.c  |  2 +-
 libavfilter/f_loop.c   |  4 ++--
 libavfilter/f_metadata.c   |  2 +-
 libavfilter/f_select.c |  6 +++---
 libavfilter/fifo.c |  2 +-
 libavfilter/framepool.c|  2 +-
 libavfilter/setpts.c   |  2 +-
 libavfilter/src_movie.c|  2 +-
 libavfilter/vf_bbox.c  |  2 +-
 libavfilter/vf_blackdetect.c   |  4 ++--
 libavfilter/vf_blackframe.c|  2 +-
 libavfilter/vf_colormatrix.c   | 12 ++--
 libavfilter/vf_crop.c  |  4 ++--
 libavfilter/vf_cropdetect.c|  2 +-
 libavfilter/vf_deflicker.c |  2 +-
 libavfilter/vf_deinterlace_vaapi.c |  2 +-
 libavfilter/vf_drawtext.c  |  2 +-
 libavfilter/vf_eq.c|  2 +-
 libavfilter/vf_idet.c  |  2 +-
 libavfilter/vf_overlay.c   |  2 +-
 libavfilter/vf_psnr.c  |  2 +-
 libavfilter/vf_readeia608.c|  4 ++--
 libavfilter/vf_readvitc.c  |  4 ++--
 libavfilter/vf_scale.c |  8 
 libavfilter/vf_showinfo.c  |  2 +-
 libavfilter/vf_ssim.c  |  2 +-
 libavfilter/vf_swaprect.c  |  2 +-
 libavfilter/vf_vectorscope.c   |  2 +-
 libavfilter/vf_waveform.c  |  2 +-
 libavfilter/vsrc_testsrc.c |  4 ++--
 50 files changed, 77 insertions(+), 77 deletions(-)

diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c
index 9acadc5..3a6266f 100644
--- a/libavfilter/af_afade.c
+++ b/libavfilter/af_afade.c
@@ -291,7 +291,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 if ((!s->type && (cur_sample + nb_samples < s->start_sample)) ||
 ( s->type && (s->start_sample + s->nb_samples < cur_sample))) {
 av_samples_set_silence(out_buf->extended_data, 0, nb_samples,
-   av_frame_get_channels(out_buf), 
out_buf->format);
+   out_buf->channels, out_buf->format);
 } else {
 int64_t start;
 
@@ -301,7 +301,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 start = s->start_sample + s->nb_samples - cur_sample;
 
 s->fade_samples(out_buf->extended_data, buf->extended_data,
-nb_samples, av_frame_get_channels(buf),
+nb_samples, buf->channels,
 s->type ? -1 : 1, start,
 s->nb_samples, s->curve);
 }
@@ -498,7 +498,7 @@ static int acrossfade_filter_frame(AVFilterLink *inlink, 
AVFrame *in)
 
 s->crossfade_samples(out->extended_data, cf[0]->extended_data,
  cf[1]->extended_data,
- s->nb_samples, av_frame_get_channels(in),
+ s->nb_samples, in->channels,
  s->curve, s->curve2);
 out->pts = s->pts;
 s->pts += av_rescale_q(s->nb_samples,
diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index 8ea01e2..3cf36b3 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -280,7 +280,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*insamples)
 
 outbuf->nb_samples = nb_samples;
 outbuf->channel_layout = outlink->channel_layout;
-av_frame_set_channels(outbuf, outlink->channels);
+outbuf->channels   = outlink->channels;
 
 while (nb_samples) {
 ns = nb_samples;
diff --git a/libavfilter/af_apad.c b/libavfilter/af_apad.c
index 0a2d420..8171f2a 100644
--- a/libavfilter/af_apad.c
+++ b/libavfilter/af_apad.c
@@ -119,7 +119,7 @@ static int request_frame(AVFilterLink *outlink)
 
 av_samples_set_silence(outsamplesref->extended_data, 0,
n_out,
-   av_frame_get_channels(outsamplesref),
+   outsamplesref->channels,
outsamplesref->format);
 
 outsamplesref->pts = s->next_pts;
diff --git a/libavfilter/af_apha

[FFmpeg-devel] [PATCH 7/7] tests: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 tests/api/api-flac-test.c  | 4 ++--
 tests/api/api-seek-test.c  | 2 +-
 tests/api/api-threadmessage-test.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c
index 7b48059..c5a37f0 100644
--- a/tests/api/api-flac-test.c
+++ b/tests/api/api-flac-test.c
@@ -156,7 +156,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 
 generate_raw_frame((uint16_t*)(in_frame->data[0]), i, 
enc_ctx->sample_rate,
enc_ctx->channels, enc_ctx->frame_size);
-in_frame_bytes = in_frame->nb_samples * 
av_frame_get_channels(in_frame) * sizeof(uint16_t);
+in_frame_bytes = in_frame->nb_samples * in_frame->channels * 
sizeof(uint16_t);
 if (in_frame_bytes > in_frame->linesize[0]) {
 av_log(NULL, AV_LOG_ERROR, "Incorrect value of input frame 
linesize\n");
 return 1;
@@ -197,7 +197,7 @@ static int run_test(AVCodec *enc, AVCodec *dec, 
AVCodecContext *enc_ctx,
 av_log(NULL, AV_LOG_ERROR, "Error frames before and after 
decoding has different sample format\n");
 return AVERROR_UNKNOWN;
 }
-out_frame_bytes = out_frame->nb_samples * 
av_frame_get_channels(out_frame) * sizeof(uint16_t);
+out_frame_bytes = out_frame->nb_samples * out_frame->channels 
* sizeof(uint16_t);
 if (out_frame_bytes > out_frame->linesize[0]) {
 av_log(NULL, AV_LOG_ERROR, "Incorrect value of output 
frame linesize\n");
 return 1;
diff --git a/tests/api/api-seek-test.c b/tests/api/api-seek-test.c
index 4fd1e6e..2b32cb9 100644
--- a/tests/api/api-seek-test.c
+++ b/tests/api/api-seek-test.c
@@ -145,7 +145,7 @@ static int compute_crc_of_packets(AVFormatContext *fmt_ctx, 
int video_stream,
 }
 av_packet_unref(&pkt);
 av_init_packet(&pkt);
-} while ((!end_of_stream || got_frame) && (no_seeking || (fr->pts + 
av_frame_get_pkt_duration(fr) <= ts_end)));
+} while ((!end_of_stream || got_frame) && (no_seeking || (fr->pts + 
fr->pkt_duration <= ts_end)));
 
 av_packet_unref(&pkt);
 av_freep(&byte_buffer);
diff --git a/tests/api/api-threadmessage-test.c 
b/tests/api/api-threadmessage-test.c
index 3e0ac5c..05a8062 100644
--- a/tests/api/api-threadmessage-test.c
+++ b/tests/api/api-threadmessage-test.c
@@ -95,7 +95,7 @@ static void *sender_thread(void *arg)
 av_frame_free(&msg.frame);
 break;
 }
-av_frame_set_metadata(msg.frame, meta);
+msg.frame->metadata = meta;
 
 /* allocate a real frame in order to simulate "real" work */
 msg.frame->format = AV_PIX_FMT_RGBA;
@@ -141,7 +141,7 @@ static void *receiver_thread(void *arg)
 if (ret < 0)
 break;
 av_assert0(msg.magic == MAGIC);
-meta = av_frame_get_metadata(msg.frame);
+meta = msg.frame->metadata;
 e = av_dict_get(meta, "sig", NULL, 0);
 av_log(NULL, AV_LOG_INFO, "got \"%s\" (%p)\n", e->value, 
msg.frame);
 av_frame_free(&msg.frame);
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 6/7] examples: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 doc/examples/filtering_audio.c | 2 +-
 doc/examples/filtering_video.c | 2 +-
 doc/examples/transcoding.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index 679218c..9fc4f1c 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -201,7 +201,7 @@ end:
 
 static void print_frame(const AVFrame *frame)
 {
-const int n = frame->nb_samples * 
av_get_channel_layout_nb_channels(av_frame_get_channel_layout(frame));
+const int n = frame->nb_samples * 
av_get_channel_layout_nb_channels(frame->channel_layout);
 const uint16_t *p = (uint16_t*)frame->data[0];
 const uint16_t *p_end = p + n;
 
diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 4d97302..4e09c6f 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -253,7 +253,7 @@ int main(int argc, char **argv)
 }
 
 if (ret >= 0) {
-frame->pts = av_frame_get_best_effort_timestamp(frame);
+frame->pts = frame->best_effort_timestamp;
 
 /* push the decoded frame into the filtergraph */
 if (av_buffersrc_add_frame_flags(buffersrc_ctx, frame, 
AV_BUFFERSRC_FLAG_KEEP_REF) < 0) {
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index 476ec69..fb15a21 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -558,7 +558,7 @@ int main(int argc, char **argv)
 }
 
 if (got_frame) {
-frame->pts = av_frame_get_best_effort_timestamp(frame);
+frame->pts = frame->best_effort_timestamp;
 ret = filter_encode_write_frame(frame, stream_index);
 av_frame_free(&frame);
 if (ret < 0)
-- 
2.9.3

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


[FFmpeg-devel] [PATCH 5/7] ff*: do not use AVFrame accessor

2017-04-22 Thread Muhammad Faiz
Signed-off-by: Muhammad Faiz 
---
 ffmpeg.c| 10 +-
 ffmpeg_filter.c |  2 +-
 ffplay.c| 24 
 ffprobe.c   | 22 +++---
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 143322c..156cced 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1062,8 +1062,8 @@ static void do_video_out(OutputFile *of,
 !ost->filters &&
 next_picture &&
 ist &&
-lrintf(av_frame_get_pkt_duration(next_picture) * 
av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) {
-duration = lrintf(av_frame_get_pkt_duration(next_picture) * 
av_q2d(ist->st->time_base) / av_q2d(enc->time_base));
+lrintf(next_picture->pkt_duration * av_q2d(ist->st->time_base) / 
av_q2d(enc->time_base)) > 0) {
+duration = lrintf(next_picture->pkt_duration * 
av_q2d(ist->st->time_base) / av_q2d(enc->time_base));
 }
 
 if (!next_picture) {
@@ -1506,7 +1506,7 @@ static int reap_filters(int flush)
 break;
 case AVMEDIA_TYPE_AUDIO:
 if (!(enc->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE) &&
-enc->channels != av_frame_get_channels(filtered_frame)) {
+enc->channels != filtered_frame->channels) {
 av_log(NULL, AV_LOG_ERROR,
"Audio filter graph output is not normalized and 
encoder does not support parameter changes\n");
 break;
@@ -2118,7 +2118,7 @@ static void check_decode_result(InputStream *ist, int 
*got_output, int ret)
 exit_program(1);
 
 if (exit_on_error && *got_output && ist) {
-if (av_frame_get_decode_error_flags(ist->decoded_frame) || 
(ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
+if (ist->decoded_frame->decode_error_flags || 
(ist->decoded_frame->flags & AV_FRAME_FLAG_CORRUPT)) {
 av_log(NULL, AV_LOG_FATAL, "%s: corrupt decoded frame in stream 
%d\n", input_files[ist->file_index]->ctx->filename, ist->st->index);
 exit_program(1);
 }
@@ -2447,7 +2447,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, 
int *got_output, int eo
 }
 ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
 
-best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame);
+best_effort_timestamp= decoded_frame->best_effort_timestamp;
 
 if (ist->framerate.num)
 best_effort_timestamp = ist->cfr_next_pts++;
diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
index 219e473..896161a 100644
--- a/ffmpeg_filter.c
+++ b/ffmpeg_filter.c
@@ -1162,7 +1162,7 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, 
const AVFrame *frame)
 ifilter->sample_aspect_ratio = frame->sample_aspect_ratio;
 
 ifilter->sample_rate = frame->sample_rate;
-ifilter->channels= av_frame_get_channels(frame);
+ifilter->channels= frame->channels;
 ifilter->channel_layout  = frame->channel_layout;
 
 if (frame->hw_frames_ctx) {
diff --git a/ffplay.c b/ffplay.c
index 763fd9e..139da9f 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -569,7 +569,7 @@ static int decoder_decode_frame(Decoder *d, AVFrame *frame, 
AVSubtitle *sub) {
 ret = avcodec_receive_frame(d->avctx, frame);
 if (ret >= 0) {
 if (decoder_reorder_pts == -1) {
-frame->pts = 
av_frame_get_best_effort_timestamp(frame);
+frame->pts = frame->best_effort_timestamp;
 } else if (!decoder_reorder_pts) {
 frame->pts = frame->pkt_dts;
 }
@@ -1981,11 +1981,11 @@ static int audio_thread(void *arg)
 tb = (AVRational){1, frame->sample_rate};
 
 #if CONFIG_AVFILTER
-dec_channel_layout = 
get_valid_channel_layout(frame->channel_layout, av_frame_get_channels(frame));
+dec_channel_layout = 
get_valid_channel_layout(frame->channel_layout, frame->channels);
 
 reconfigure =
 cmp_audio_fmts(is->audio_filter_src.fmt, 
is->audio_filter_src.channels,
-   frame->format, 
av_frame_get_channels(frame))||
+   frame->format, frame->channels)||
 is->audio_filter_src.channel_layout != dec_channel_layout 
||
 is->audio_filter_src.freq   != frame->sample_rate 
||
 is->auddec.pkt_serial   != last_serial;
@@ -1997,10 +1997,10 @@ static int audio_thread(void *arg)
 av_log(NULL, AV_LOG_DEBUG,
"Audio frame changed from rate:%d ch:%d fmt:%s 
layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
is->audio_filter_src.freq, 
is->audio_filter_src.channels, 
av_get_sample_fmt_