Re: [FFmpeg-devel] [PATCH] avfilter/vf_psnr: Add support for writing stats to stdout

2015-10-20 Thread Paul B Mahol
On 10/20/15, Tobias Rapp  wrote:
> Attached patch implements writing PSNR frame stats to standard output if
> the filename is "-".
>
> Regards,
> Tobias
>

Looks fine to me.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter/vf_psnr: Add support for writing stats to stdout

2015-10-20 Thread Michael Niedermayer
On Tue, Oct 20, 2015 at 09:10:53PM +0200, Paul B Mahol wrote:
> On 10/20/15, Tobias Rapp  wrote:
> > Attached patch implements writing PSNR frame stats to standard output if
> > the filename is "-".
> >
> > Regards,
> > Tobias
> >
> 
> Looks fine to me.

applied

thanks

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

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


[FFmpeg-devel] [PATCH] avfilter/vf_psnr: Add support for writing stats to stdout

2015-10-20 Thread Tobias Rapp
Attached patch implements writing PSNR frame stats to standard output if 
the filename is "-".


Regards,
Tobias
>From 163f8a547e7a4c4847c8b988017fd1ec73768d9e Mon Sep 17 00:00:00 2001
From: Tobias Rapp 
Date: Tue, 20 Oct 2015 15:02:21 +0200
Subject: [PATCH] avfilter/vf_psnr: Add support for writing stats to stdout

---
 doc/filters.texi  | 3 ++-
 libavfilter/vf_psnr.c | 6 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 5300134..4edc4f3 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8933,7 +8933,8 @@ The description of the accepted parameters follows.
 @table @option
 @item stats_file, f
 If specified the filter will use the named file to save the PSNR of
-each individual frame.
+each individual frame. When filename equals "-" the data is sent to
+standard output.
 @end table
 
 The file printed if @var{stats_file} is selected, contains a sequence of
diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c
index a01b2c1..bfb0711 100644
--- a/libavfilter/vf_psnr.c
+++ b/libavfilter/vf_psnr.c
@@ -193,7 +193,9 @@ static av_cold int init(AVFilterContext *ctx)
 s->min_mse = +INFINITY;
 s->max_mse = -INFINITY;
 
-if (s->stats_file_str) {
+if (!strcmp(s->stats_file_str, "-")) {
+s->stats_file = stdout;
+} else if (s->stats_file_str) {
 s->stats_file = fopen(s->stats_file_str, "w");
 if (!s->stats_file) {
 int err = AVERROR(errno);
@@ -334,7 +336,7 @@ static av_cold void uninit(AVFilterContext *ctx)
 
 ff_dualinput_uninit(>dinput);
 
-if (s->stats_file)
+if (s->stats_file && s->stats_file != stdout)
 fclose(s->stats_file);
 }
 
-- 
1.9.1

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