Re: [FFmpeg-devel] [PATCH] avformat/rawenc: Store sample number for ADX

2015-06-21 Thread Michael Niedermayer
On Sun, Jun 21, 2015 at 08:32:46AM +, Paul B Mahol wrote:
> Dana 21. 6. 2015. 00:32 osoba "Michael Niedermayer" 
> napisala je:
> >
> > Fixes Ticket4540
> >
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavformat/rawenc.c   |   20 
> >  tests/ref/acodec/adpcm-adx |2 +-
> >  tests/ref/acodec/adpcm-adx-trellis |2 +-
> >  3 files changed, 22 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> > index e59f1ae..d65c7c7 100644
> > --- a/libavformat/rawenc.c
> > +++ b/libavformat/rawenc.c
> > @@ -56,6 +56,25 @@ AVOutputFormat ff_ac3_muxer = {
> >  #endif
> >
> >  #if CONFIG_ADX_MUXER
> > +
> > +static int adx_write_trailer(AVFormatContext *s)
> > +{
> > +AVIOContext *pb = s->pb;
> > +AVCodecContext *avctx = s->streams[0]->codec;
> > +
> > +if (pb->seekable) {
> > +int64_t file_size = avio_tell(pb);
> > +uint64_t sample_count = (file_size - 36) / avctx->channels / 18
> * 32;
> > +if (sample_count <= UINT32_MAX) {
> > +avio_seek(pb, 12, SEEK_SET);
> > +avio_wb32(pb, sample_count);
> > +avio_seek(pb, file_size, SEEK_SET);
> > +}
> > +}
> > +
> > +return 0;
> > +}
> > +
> >  AVOutputFormat ff_adx_muxer = {
> >  .name  = "adx",
> >  .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
> > @@ -64,6 +83,7 @@ AVOutputFormat ff_adx_muxer = {
> >  .video_codec   = AV_CODEC_ID_NONE,
> >  .write_header  = force_one_stream,
> >  .write_packet  = ff_raw_write_packet,
> > +.write_trailer = adx_write_trailer,
> >  .flags = AVFMT_NOTIMESTAMPS,
> >  };
> >  #endif
> > diff --git a/tests/ref/acodec/adpcm-adx b/tests/ref/acodec/adpcm-adx
> > index 34dd9b6..8c40100 100644
> > --- a/tests/ref/acodec/adpcm-adx
> > +++ b/tests/ref/acodec/adpcm-adx
> > @@ -1,4 +1,4 @@
> > -d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx.adx
> > +6bf1a8e5ec9cc958a31cb2b1b66bfc75 *tests/data/fate/acodec-adpcm-adx.adx
> >  297720 tests/data/fate/acodec-adpcm-adx.adx
> >  5b5a436ec9d528d6eb0bebaf667521b0
> *tests/data/fate/acodec-adpcm-adx.out.wav
> >  stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
> > diff --git a/tests/ref/acodec/adpcm-adx-trellis
> b/tests/ref/acodec/adpcm-adx-trellis
> > index d620d4a..039f69f 100644
> > --- a/tests/ref/acodec/adpcm-adx-trellis
> > +++ b/tests/ref/acodec/adpcm-adx-trellis
> > @@ -1,4 +1,4 @@
> > -d7ec7d52a2f5c91464812d031b07cc1d
> *tests/data/fate/acodec-adpcm-adx-trellis.adx
> > +6bf1a8e5ec9cc958a31cb2b1b66bfc75
> *tests/data/fate/acodec-adpcm-adx-trellis.adx
> >  297720 tests/data/fate/acodec-adpcm-adx-trellis.adx
> >  5b5a436ec9d528d6eb0bebaf667521b0
> *tests/data/fate/acodec-adpcm-adx-trellis.out.wav
> >  stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
> > --
> > 1.7.9.5
> >
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> LGTM

applied

thanks

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates


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


Re: [FFmpeg-devel] [PATCH] avformat/rawenc: Store sample number for ADX

2015-06-21 Thread Paul B Mahol
Dana 21. 6. 2015. 00:32 osoba "Michael Niedermayer" 
napisala je:
>
> Fixes Ticket4540
>
> Signed-off-by: Michael Niedermayer 
> ---
>  libavformat/rawenc.c   |   20 
>  tests/ref/acodec/adpcm-adx |2 +-
>  tests/ref/acodec/adpcm-adx-trellis |2 +-
>  3 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
> index e59f1ae..d65c7c7 100644
> --- a/libavformat/rawenc.c
> +++ b/libavformat/rawenc.c
> @@ -56,6 +56,25 @@ AVOutputFormat ff_ac3_muxer = {
>  #endif
>
>  #if CONFIG_ADX_MUXER
> +
> +static int adx_write_trailer(AVFormatContext *s)
> +{
> +AVIOContext *pb = s->pb;
> +AVCodecContext *avctx = s->streams[0]->codec;
> +
> +if (pb->seekable) {
> +int64_t file_size = avio_tell(pb);
> +uint64_t sample_count = (file_size - 36) / avctx->channels / 18
* 32;
> +if (sample_count <= UINT32_MAX) {
> +avio_seek(pb, 12, SEEK_SET);
> +avio_wb32(pb, sample_count);
> +avio_seek(pb, file_size, SEEK_SET);
> +}
> +}
> +
> +return 0;
> +}
> +
>  AVOutputFormat ff_adx_muxer = {
>  .name  = "adx",
>  .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
> @@ -64,6 +83,7 @@ AVOutputFormat ff_adx_muxer = {
>  .video_codec   = AV_CODEC_ID_NONE,
>  .write_header  = force_one_stream,
>  .write_packet  = ff_raw_write_packet,
> +.write_trailer = adx_write_trailer,
>  .flags = AVFMT_NOTIMESTAMPS,
>  };
>  #endif
> diff --git a/tests/ref/acodec/adpcm-adx b/tests/ref/acodec/adpcm-adx
> index 34dd9b6..8c40100 100644
> --- a/tests/ref/acodec/adpcm-adx
> +++ b/tests/ref/acodec/adpcm-adx
> @@ -1,4 +1,4 @@
> -d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx.adx
> +6bf1a8e5ec9cc958a31cb2b1b66bfc75 *tests/data/fate/acodec-adpcm-adx.adx
>  297720 tests/data/fate/acodec-adpcm-adx.adx
>  5b5a436ec9d528d6eb0bebaf667521b0
*tests/data/fate/acodec-adpcm-adx.out.wav
>  stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
> diff --git a/tests/ref/acodec/adpcm-adx-trellis
b/tests/ref/acodec/adpcm-adx-trellis
> index d620d4a..039f69f 100644
> --- a/tests/ref/acodec/adpcm-adx-trellis
> +++ b/tests/ref/acodec/adpcm-adx-trellis
> @@ -1,4 +1,4 @@
> -d7ec7d52a2f5c91464812d031b07cc1d
*tests/data/fate/acodec-adpcm-adx-trellis.adx
> +6bf1a8e5ec9cc958a31cb2b1b66bfc75
*tests/data/fate/acodec-adpcm-adx-trellis.adx
>  297720 tests/data/fate/acodec-adpcm-adx-trellis.adx
>  5b5a436ec9d528d6eb0bebaf667521b0
*tests/data/fate/acodec-adpcm-adx-trellis.out.wav
>  stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
> --
> 1.7.9.5
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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


[FFmpeg-devel] [PATCH] avformat/rawenc: Store sample number for ADX

2015-06-20 Thread Michael Niedermayer
Fixes Ticket4540

Signed-off-by: Michael Niedermayer 
---
 libavformat/rawenc.c   |   20 
 tests/ref/acodec/adpcm-adx |2 +-
 tests/ref/acodec/adpcm-adx-trellis |2 +-
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index e59f1ae..d65c7c7 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -56,6 +56,25 @@ AVOutputFormat ff_ac3_muxer = {
 #endif
 
 #if CONFIG_ADX_MUXER
+
+static int adx_write_trailer(AVFormatContext *s)
+{
+AVIOContext *pb = s->pb;
+AVCodecContext *avctx = s->streams[0]->codec;
+
+if (pb->seekable) {
+int64_t file_size = avio_tell(pb);
+uint64_t sample_count = (file_size - 36) / avctx->channels / 18 * 32;
+if (sample_count <= UINT32_MAX) {
+avio_seek(pb, 12, SEEK_SET);
+avio_wb32(pb, sample_count);
+avio_seek(pb, file_size, SEEK_SET);
+}
+}
+
+return 0;
+}
+
 AVOutputFormat ff_adx_muxer = {
 .name  = "adx",
 .long_name = NULL_IF_CONFIG_SMALL("CRI ADX"),
@@ -64,6 +83,7 @@ AVOutputFormat ff_adx_muxer = {
 .video_codec   = AV_CODEC_ID_NONE,
 .write_header  = force_one_stream,
 .write_packet  = ff_raw_write_packet,
+.write_trailer = adx_write_trailer,
 .flags = AVFMT_NOTIMESTAMPS,
 };
 #endif
diff --git a/tests/ref/acodec/adpcm-adx b/tests/ref/acodec/adpcm-adx
index 34dd9b6..8c40100 100644
--- a/tests/ref/acodec/adpcm-adx
+++ b/tests/ref/acodec/adpcm-adx
@@ -1,4 +1,4 @@
-d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx.adx
+6bf1a8e5ec9cc958a31cb2b1b66bfc75 *tests/data/fate/acodec-adpcm-adx.adx
 297720 tests/data/fate/acodec-adpcm-adx.adx
 5b5a436ec9d528d6eb0bebaf667521b0 *tests/data/fate/acodec-adpcm-adx.out.wav
 stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
diff --git a/tests/ref/acodec/adpcm-adx-trellis 
b/tests/ref/acodec/adpcm-adx-trellis
index d620d4a..039f69f 100644
--- a/tests/ref/acodec/adpcm-adx-trellis
+++ b/tests/ref/acodec/adpcm-adx-trellis
@@ -1,4 +1,4 @@
-d7ec7d52a2f5c91464812d031b07cc1d *tests/data/fate/acodec-adpcm-adx-trellis.adx
+6bf1a8e5ec9cc958a31cb2b1b66bfc75 *tests/data/fate/acodec-adpcm-adx-trellis.adx
 297720 tests/data/fate/acodec-adpcm-adx-trellis.adx
 5b5a436ec9d528d6eb0bebaf667521b0 
*tests/data/fate/acodec-adpcm-adx-trellis.out.wav
 stddev: 2549.93 PSNR: 28.20 MAXDIFF:57514 bytes:  1058400/  1058432
-- 
1.7.9.5

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