[FFmpeg-cvslog] doc/filters.texi: fix time duration references

2014-09-05 Thread Mark Harris
ffmpeg | branch: master | Mark Harris  | Thu Sep  4 
13:19:44 2014 -0700| [ef16d1260617cb942b495e322a9668c4b93265e0] | committer: 
Stefano Sabatini

doc/filters.texi: fix time duration references

Make time duration references consistent, using @ref links, and
eliminate incorrect syntax [-]HH[:MM[:SS[.m...]]].

Signed-off-by: Stefano Sabatini 

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

 doc/filters.texi |   68 +++---
 1 file changed, 29 insertions(+), 39 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 4ae5b4f..d13278e 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -517,27 +517,21 @@ volume as the input audio, at the end of the fade-out 
transition
 the output audio will be silence. Default is 44100.
 
 @item start_time, st
-Specify time for starting to apply the fade effect. Default is 0.
-The accepted syntax is:
-@example
-[-]HH[:MM[:SS[.m...]]]
-[-]S+[.m...]
-@end example
-See also the function @code{av_parse_time()}.
-If set this option is used instead of @var{start_sample} one.
+Specify the start time of the fade effect. Default is 0.
+The value must be specified as a time duration; see
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
+If set this option is used instead of @var{start_sample}.
 
 @item duration, d
-Specify the duration for which the fade effect has to last. Default is 0.
-The accepted syntax is:
-@example
-[-]HH[:MM[:SS[.m...]]]
-[-]S+[.m...]
-@end example
-See also the function @code{av_parse_time()}.
+Specify the duration of the fade effect. See
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
 At the end of the fade-in effect the output audio will have the same
 volume as the input audio, at the end of the fade-out transition
 the output audio will be silence.
-If set this option is used instead of @var{nb_samples} one.
+By default the duration is determined by @var{nb_samples}.
+If set this option is used instead of @var{nb_samples}.
 
 @item curve
 Set curve for fade transition.
@@ -1120,9 +1114,9 @@ The number of the first sample that should be output.
 The number of the first sample that should be dropped.
 @end table
 
-@option{start}, @option{end}, @option{duration} are expressed as time
-duration specifications, check the "Time duration" section in the
-ffmpeg-utils manual.
+@option{start}, @option{end}, and @option{duration} are expressed as time
+duration specifications; see
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}.
 
 Note that the first two sets of the start/end options and the @option{duration}
 option look at the frame timestamp, while the _sample options simply count the
@@ -1637,9 +1631,9 @@ Set the number of samples per channel per each output 
frame, default
 is 1024. Only used if plugin have zero inputs.
 
 @item duration, d
-Set the minimum duration of the sourced audio. See the function
-@code{av_parse_time()} for the accepted format, also check the "Time duration"
-section in the ffmpeg-utils manual.
+Set the minimum duration of the sourced audio. See
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
 Note that the resulting duration may be greater than the specified duration,
 as the generated audio is always cut at the end of a complete frame.
 If not specified, or the expressed duration is negative, the audio is
@@ -2189,8 +2183,9 @@ Set the channel layout. The number of channels in the 
specified layout
 must be equal to the number of specified expressions.
 
 @item duration, d
-Set the minimum duration of the sourced audio. See the function
-@code{av_parse_time()} for the accepted format.
+Set the minimum duration of the sourced audio. See
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
 Note that the resulting duration may be greater than the specified
 duration, as the generated audio is always cut at the end of a
 complete frame.
@@ -8546,9 +8541,10 @@ The number of the first frame that should be passed to 
the output.
 The number of the first frame that should be dropped.
 @end table
 
-@option{start}, @option{end}, @option{duration} are expressed as time
-duration specifications, check the "Time duration" section in the
-ffmpeg-utils manual.
+@option{start}, @option{end}, and @option{duration} are expressed as time
+duration specifications; see
+@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) 
manual,ffmpeg-utils}
+for the accepted syntax.
 
 Note that the first two sets of the start/end options and the @option{duration}
 option look at the frame timestamp, while the _frame variants simply count the
@@ -9459,12 +9455,9 @@ number or

[FFmpeg-cvslog] lavf/ffmdec: return proper error code in ffm2_read_header()

2014-09-05 Thread Stefano Sabatini
ffmpeg | branch: master | Stefano Sabatini  | Mon Sep  1 
14:04:54 2014 +0200| [6f0fc1a96bd436a619de4c9ed33dec8db6d97c52] | committer: 
Stefano Sabatini

lavf/ffmdec: return proper error code in ffm2_read_header()

Also log an error message in case of invalid packet size.

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

 libavformat/ffmdec.c |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index f8fee2f..448762b 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -236,10 +236,16 @@ static int ffm2_read_header(AVFormatContext *s)
 AVStream *st;
 AVIOContext *pb = s->pb;
 AVCodecContext *codec;
+int ret;
 
 ffm->packet_size = avio_rb32(pb);
-if (ffm->packet_size != FFM_PACKET_SIZE)
+if (ffm->packet_size != FFM_PACKET_SIZE) {
+av_log(s, AV_LOG_ERROR, "Invalid packet size %d, expected size was 
%d\n",
+   ffm->packet_size, FFM_PACKET_SIZE);
+ret = AVERROR_INVALIDDATA;
 goto fail;
+}
+
 ffm->write_index = avio_rb64(pb);
 /* get also filesize */
 if (pb->seekable) {
@@ -266,8 +272,10 @@ static int ffm2_read_header(AVFormatContext *s)
 break;
 case MKBETAG('C', 'O', 'M', 'M'):
 st = avformat_new_stream(s, NULL);
-if (!st)
+if (!st) {
+ret = AVERROR(ENOMEM);
 goto fail;
+}
 
 avpriv_set_pts_info(st, 64, 1, 100);
 
@@ -359,7 +367,7 @@ static int ffm2_read_header(AVFormatContext *s)
 return 0;
  fail:
 ffm_close(s);
-return -1;
+return ret;
 }
 
 static int ffm_read_header(AVFormatContext *s)

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


[FFmpeg-cvslog] lavc/libvpxenc: show crf CQ value in error message

2014-09-05 Thread Stefano Sabatini
ffmpeg | branch: master | Stefano Sabatini  | Mon Sep  1 
13:10:04 2014 +0200| [39b517fac0b6d1412b94f30d7be4ec1de65e473a] | committer: 
Stefano Sabatini

lavc/libvpxenc: show crf CQ value in error message

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

 libavcodec/libvpxenc.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 227c492..163d12a 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -341,8 +341,8 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 ) {
 if (ctx->crf < enccfg.rc_min_quantizer || ctx->crf > 
enccfg.rc_max_quantizer) {
 av_log(avctx, AV_LOG_ERROR,
-   "CQ level must be between minimum and maximum quantizer 
value (%d-%d)\n",
-   enccfg.rc_min_quantizer, enccfg.rc_max_quantizer);
+   "CQ level %d must be between minimum and maximum 
quantizer value (%d-%d)\n",
+   ctx->crf, enccfg.rc_min_quantizer, 
enccfg.rc_max_quantizer);
 return AVERROR(EINVAL);
 }
 }

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


[FFmpeg-cvslog] ismindex: produce .ismf file

2014-09-05 Thread Mika Raento
ffmpeg | branch: master | Mika Raento  | Thu Sep  4 
18:09:46 2014 +0300| [b21e989a3c076d94cfdde0303724db841dd60cad] | committer: 
Martin Storsjö

ismindex: produce .ismf file

This is a non-standard file that maps the MSS segment names to offsets
in the ISMV file. This can be used to build a custom MSS streaming
server without splitting the ISMV into separate files.

Signed-off-by: Martin Storsjö 

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

 tools/ismindex.c |  117 --
 1 file changed, 95 insertions(+), 22 deletions(-)

diff --git a/tools/ismindex.c b/tools/ismindex.c
index a6a9763..bc98226 100644
--- a/tools/ismindex.c
+++ b/tools/ismindex.c
@@ -25,6 +25,9 @@
  * This step creates foo.ism and foo.ismc that is required by IIS for
  * serving it.
  *
+ * With -ismf, it also creates foo.ismf, which maps fragment names to
+ * start-end offsets in the ismv, for use in your own streaming server.
+ *
  * By adding -path-prefix path/, the produced foo.ism will refer to the
  * files foo.ismv as "path/foo.ismv" - the prefix for the generated ismc
  * file can be set with the -ismc-prefix option similarly.
@@ -51,7 +54,7 @@
 
 static int usage(const char *argv0, int ret)
 {
-fprintf(stderr, "%s [-split] [-n basename] [-path-prefix prefix] "
+fprintf(stderr, "%s [-split] [-ismf] [-n basename] [-path-prefix prefix] "
 "[-ismc-prefix prefix] [-output dir] file1 [file2] ...\n", 
argv0);
 return ret;
 }
@@ -88,6 +91,18 @@ struct Tracks {
 int nb_video_tracks, nb_audio_tracks;
 };
 
+static int expect_tag(int32_t got_tag, int32_t expected_tag) {
+if (got_tag != expected_tag) {
+char got_tag_str[4], expected_tag_str[4];
+AV_WB32(got_tag_str, got_tag);
+AV_WB32(expected_tag_str, expected_tag);
+fprintf(stderr, "wanted tag %.4s, got %.4s\n", expected_tag_str,
+got_tag_str);
+return -1;
+}
+return 0;
+}
+
 static int copy_tag(AVIOContext *in, AVIOContext *out, int32_t tag_name)
 {
 int32_t size, tag;
@@ -96,13 +111,8 @@ static int copy_tag(AVIOContext *in, AVIOContext *out, 
int32_t tag_name)
 tag  = avio_rb32(in);
 avio_wb32(out, size);
 avio_wb32(out, tag);
-if (tag != tag_name) {
-char tag_str[4], tag_name_str[4];
-AV_WB32(tag_str, tag);
-AV_WB32(tag_name_str, tag_name);
-fprintf(stderr, "wanted tag %.4s, got %.4s\n", tag_name_str, tag_str);
+if (expect_tag(tag, tag_name) != 0)
 return -1;
-}
 size -= 8;
 while (size > 0) {
 char buf[1024];
@@ -118,6 +128,19 @@ static int copy_tag(AVIOContext *in, AVIOContext *out, 
int32_t tag_name)
 return 0;
 }
 
+static int skip_tag(AVIOContext *in, int32_t tag_name)
+{
+int64_t pos = avio_tell(in);
+int32_t size, tag;
+
+size = avio_rb32(in);
+tag  = avio_rb32(in);
+if (expect_tag(tag, tag_name) != 0)
+return -1;
+avio_seek(in, pos + size, SEEK_SET);
+return 0;
+}
+
 static int write_fragment(const char *filename, AVIOContext *in)
 {
 AVIOContext *out = NULL;
@@ -139,25 +162,66 @@ static int write_fragment(const char *filename, 
AVIOContext *in)
 return ret;
 }
 
-static int write_fragments(struct Tracks *tracks, int start_index,
-   AVIOContext *in, const char *output_prefix)
+static int skip_fragment(AVIOContext *in)
 {
-char dirname[2048], filename[2048];
-int i, j;
+int ret;
+ret = skip_tag(in, MKBETAG('m', 'o', 'o', 'f'));
+if (!ret)
+ret = skip_tag(in, MKBETAG('m', 'd', 'a', 't'));
+return ret;
+}
 
+static int write_fragments(struct Tracks *tracks, int start_index,
+   AVIOContext *in, const char *basename,
+   int split, int ismf, const char* output_prefix)
+{
+char dirname[2048], filename[2048], idxname[2048];
+int i, j, ret = 0, fragment_ret;
+FILE* out = NULL;
+
+if (ismf) {
+snprintf(idxname, sizeof(idxname), "%s%s.ismf", output_prefix, 
basename);
+out = fopen(idxname, "w");
+if (!out) {
+ret = AVERROR(errno);
+perror(idxname);
+goto fail;
+}
+}
 for (i = start_index; i < tracks->nb_tracks; i++) {
 struct Track *track = tracks->tracks[i];
 const char *type= track->is_video ? "video" : "audio";
 snprintf(dirname, sizeof(dirname), "%sQualityLevels(%d)", 
output_prefix, track->bitrate);
-mkdir(dirname, 0777);
+if (split) {
+if (mkdir(dirname, 0777) == -1 && errno != EEXIST) {
+ret = AVERROR(errno);
+perror(dirname);
+goto fail;
+}
+}
 for (j = 0; j < track->chunks; j++) {
 snprintf(filename, sizeof(filename), "%s/Fragments(%s=%"PRId64")",
  dirname, type, track->offsets[j].tim

[FFmpeg-cvslog] Merge commit 'b21e989a3c076d94cfdde0303724db841dd60cad'

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
12:14:42 2014 +0200| [0940066b803769f041a7ac83cf0df7c23ab033cc] | committer: 
Michael Niedermayer

Merge commit 'b21e989a3c076d94cfdde0303724db841dd60cad'

* commit 'b21e989a3c076d94cfdde0303724db841dd60cad':
  ismindex: produce .ismf file

Conflicts:
tools/ismindex.c

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] avfilter/x86/idet: fix license header (GPL -> LGPL)

2014-09-05 Thread Pascal Massimino
ffmpeg | branch: master | Pascal Massimino  | Fri 
Sep  5 11:59:03 2014 +0200| [161fc0f463773a12abb985c1adf55db971c76134] | 
committer: Michael Niedermayer

avfilter/x86/idet: fix license header (GPL -> LGPL)

Signed-off-by: Michael Niedermayer 

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

 libavfilter/vf_idet.h  |   12 ++--
 libavfilter/x86/vf_idet.asm|   41 +---
 libavfilter/x86/vf_idet_init.c |   12 ++--
 3 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/libavfilter/vf_idet.h b/libavfilter/vf_idet.h
index 3820e94..0550690 100644
--- a/libavfilter/vf_idet.h
+++ b/libavfilter/vf_idet.h
@@ -2,17 +2,17 @@
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
  * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License along
- * with FFmpeg; if not, write to the Free Software
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
diff --git a/libavfilter/x86/vf_idet.asm b/libavfilter/x86/vf_idet.asm
index fb29804..35f0e07 100644
--- a/libavfilter/x86/vf_idet.asm
+++ b/libavfilter/x86/vf_idet.asm
@@ -1,22 +1,25 @@
-; *
-; * x86-optimized functions for idet filter
-; *
-; * This file is part of FFmpeg.
-; *
-; * FFmpeg is free software; you can redistribute it and/or modify
-; * it under the terms of the GNU General Public License as published by
-; * the Free Software Foundation; either version 2 of the License, or
-; * (at your option) any later version.
-; *
-; * FFmpeg is distributed in the hope that it will be useful,
-; * but WITHOUT ANY WARRANTY; without even the implied warranty of
-; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-; * GNU General Public License for more details.
-; *
-; * You should have received a copy of the GNU General Public License along
-; * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
-; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-; 
**
+;*
+;* x86-optimized functions for idet filter
+;*
+;* Copyright (C) 2014 Pascal Massimino (pascal.massim...@gmail.com)
+;* Copyright (c) 2014 Neil Birkbeck (birkb...@google.com)
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;**
 
 %include "libavutil/x86/x86util.asm"
 
diff --git a/libavfilter/x86/vf_idet_init.c b/libavfilter/x86/vf_idet_init.c
index 2203437..fb9ad83 100644
--- a/libavfilter/x86/vf_idet_init.c
+++ b/libavfilter/x86/vf_idet_init.c
@@ -2,17 +2,17 @@
  * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
  *
  * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNE

[FFmpeg-cvslog] vfi/x86/vf_idet: fix incorrect use of paddq

2014-09-05 Thread James Darnley
ffmpeg | branch: master | James Darnley  | Fri Sep  5 
00:22:04 2014 +0200| [db8970d7b61ae8a83bab1d69dd1b7b0ff8a3a664] | committer: 
Michael Niedermayer

vfi/x86/vf_idet: fix incorrect use of paddq

paddq is an SSE2 instruction so it cannot be used for MMX.

This was probably just a typo because the sums are dwords anyway.

Reviewed-by: Pascal Massimino 
Signed-off-by: Michael Niedermayer 

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

 libavfilter/x86/vf_idet.asm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/x86/vf_idet.asm b/libavfilter/x86/vf_idet.asm
index 35f0e07..14b16c5 100644
--- a/libavfilter/x86/vf_idet.asm
+++ b/libavfilter/x86/vf_idet.asm
@@ -73,7 +73,7 @@ cglobal idet_filter_line, 4, 5, 0, a, b, c, width, index
 
 mova  m0, m_sum
 psrlq m_sum, 0x20
-paddq m0, m_sum
+paddd m0, m_sum
 movd  eax, m0
 RET
 %endmacro

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


[FFmpeg-cvslog] tiff: fix {2,4}bpp grayscale palettes.

2014-09-05 Thread Benoit Fouet
ffmpeg | branch: master | Benoit Fouet  | Fri Sep  5 
11:15:13 2014 +0200| [4f10495055edc009ceaff8b5b69c90fd665698e1] | committer: 
Michael Niedermayer

tiff: fix {2,4}bpp grayscale palettes.

Create a default grayscale palette for 2 or 4 bpp grayscale tiff, if
there is no palette defined.
Fixes ticket #3915

Signed-off-by: Michael Niedermayer 

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

 libavcodec/tiff.c |   16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 1e2d235..0352639 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -653,6 +653,7 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, 
uint8_t *dst, int strid
 static int init_image(TiffContext *s, ThreadFrame *frame)
 {
 int ret;
+int create_gray_palette = 0;
 
 switch (s->planar * 1000 + s->bpp * 10 + s->bppcount) {
 case 11:
@@ -662,6 +663,11 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
 }
 case 21:
 case 41:
+s->avctx->pix_fmt = AV_PIX_FMT_PAL8;
+if (!s->palette_is_set) {
+create_gray_palette = 1;
+}
+break;
 case 81:
 s->avctx->pix_fmt = s->palette_is_set ? AV_PIX_FMT_PAL8 : 
AV_PIX_FMT_GRAY8;
 break;
@@ -741,7 +747,15 @@ static int init_image(TiffContext *s, ThreadFrame *frame)
 if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0)
 return ret;
 if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) {
-memcpy(frame->f->data[1], s->palette, sizeof(s->palette));
+if (!create_gray_palette)
+memcpy(frame->f->data[1], s->palette, sizeof(s->palette));
+else {
+/* make default grayscale pal */
+int i;
+uint32_t *pal = (uint32_t *)frame->f->data[1];
+for (i = 0; i < 1

[FFmpeg-cvslog] x86inc: Make INIT_CPUFLAGS support an arbitrary number of cpuflags

2014-09-05 Thread Henrik Gramner
ffmpeg | branch: master | Henrik Gramner  | Fri Sep  5 
00:13:38 2014 +0200| [428aa14a4851711ea1aa3f9b2d5bac867434993f] | committer: 
Michael Niedermayer

x86inc: Make INIT_CPUFLAGS support an arbitrary number of cpuflags

Previously there was a limit of two cpuflags.

Signed-off-by: Michael Niedermayer 

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

 libavutil/x86/x86inc.asm |   41 ++---
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index d8f0242..8a13064 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -99,9 +99,6 @@
 %endif
 %endmacro
 
-; Always use long nops (reduces 0x90 spam in disassembly on x86_32)
-CPUNOP amdnop
-
 ; Macros to eliminate most code duplication between x86_32 and x86_64:
 ; Currently this works only for leaf functions which load all their arguments
 ; into registers at the start, and make no other use of the stack. Luckily that
@@ -759,19 +756,26 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
 %definecpuflag(x) ((cpuflags & (cpuflags_ %+ x)) == (cpuflags_ %+ x))
 %define notcpuflag(x) ((cpuflags & (cpuflags_ %+ x)) != (cpuflags_ %+ x))
 
-; Takes up to 2 cpuflags from the above list.
+; Takes an arbitrary number of cpuflags from the above list.
 ; All subsequent functions (up to the next INIT_CPUFLAGS) is built for the 
specified cpu.
 ; You shouldn't need to invoke this macro directly, it's a subroutine for 
INIT_MMX &co.
-%macro INIT_CPUFLAGS 0-2
-CPUNOP amdnop
+%macro INIT_CPUFLAGS 0-*
+%xdefine SUFFIX
+%undef cpuname
+%assign cpuflags 0
+
 %if %0 >= 1
-%xdefine cpuname %1
-%assign cpuflags cpuflags_%1
-%if %0 >= 2
-%xdefine cpuname %1_%2
-%assign cpuflags cpuflags | cpuflags_%2
-%endif
+%rep %0
+%ifdef cpuname
+%xdefine cpuname cpuname %+ _%1
+%else
+%xdefine cpuname %1
+%endif
+%assign cpuflags cpuflags | cpuflags_%1
+%rotate 1
+%endrep
 %xdefine SUFFIX _ %+ cpuname
+
 %if cpuflag(avx)
 %assign avx_enabled 1
 %endif
@@ -782,16 +786,15 @@ SECTION .note.GNU-stack noalloc noexec nowrite progbits
 %endif
 %if cpuflag(aligned)
 %define movu mova
-%elifidn %1, sse3
+%elif cpuflag(sse3) && notcpuflag(ssse3)
 %define movu lddqu
 %endif
-%if notcpuflag(sse2)
-CPUNOP basicnop
-%endif
+%endif
+
+%if cpuflag(sse2)
+CPUNOP amdnop
 %else
-%xdefine SUFFIX
-%undef cpuname
-%undef cpuflags
+CPUNOP basicnop
 %endif
 %endmacro
 

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


[FFmpeg-cvslog] MAINTAINERS: add myself as lavd/v4l2 maintainer

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
16:26:11 2014 +0200| [d247a40aadb8b8f8300cba46664b4bd5a583f198] | committer: 
Michael Niedermayer

MAINTAINERS: add myself as lavd/v4l2 maintainer

Signed-off-by: Michael Niedermayer 

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

 MAINTAINERS |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 0992ab5..eb1f98b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -319,7 +319,7 @@ libavdevice
   pulse_audio_enc.c Lukasz Marek
   qtkit.m   Thilo Borgmann
   sdl   Stefano Sabatini
-  v4l2.cLuca Abeni
+  v4l2.cGiorgio Vazzana
   vfwcap.c  Ramiro Polla
   xv.c  Lukasz Marek
 

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


[FFmpeg-cvslog] lavd/v4l2: Replace s1 with ctx for consistency.

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
17:12:39 2014 +0200| [39750b73641e4a2f10e4c025b6424d1c864683fb] | committer: 
Michael Niedermayer

lavd/v4l2: Replace s1 with ctx for consistency.

No functional change in the code.

Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |  114 ++--
 1 file changed, 57 insertions(+), 57 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 7b9e2f3..a765e64 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -635,9 +635,9 @@ static void mmap_close(struct video_data *s)
 av_free(s->buf_len);
 }
 
-static int v4l2_set_parameters(AVFormatContext *s1)
+static int v4l2_set_parameters(AVFormatContext *ctx)
 {
-struct video_data *s = s1->priv_data;
+struct video_data *s = ctx->priv_data;
 struct v4l2_standard standard = { 0 };
 struct v4l2_streamparm streamparm = { 0 };
 struct v4l2_fract *tpf;
@@ -646,7 +646,7 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 
 if (s->framerate &&
 (ret = av_parse_video_rate(&framerate_q, s->framerate)) < 0) {
-av_log(s1, AV_LOG_ERROR, "Could not parse framerate '%s'.\n",
+av_log(ctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n",
s->framerate);
 return ret;
 }
@@ -654,7 +654,7 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 if (s->standard) {
 if (s->std_id) {
 ret = 0;
-av_log(s1, AV_LOG_DEBUG, "Setting standard: %s\n", s->standard);
+av_log(ctx, AV_LOG_DEBUG, "Setting standard: %s\n", s->standard);
 /* set tv standard */
 for (i = 0; ; i++) {
 standard.index = i;
@@ -666,17 +666,17 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 break;
 }
 if (ret < 0) {
-av_log(s1, AV_LOG_ERROR, "Unknown or unsupported standard 
'%s'\n", s->standard);
+av_log(ctx, AV_LOG_ERROR, "Unknown or unsupported standard 
'%s'\n", s->standard);
 return ret;
 }
 
 if (v4l2_ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
 ret = AVERROR(errno);
-av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_STD): %s\n", 
av_err2str(ret));
+av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_S_STD): %s\n", 
av_err2str(ret));
 return ret;
 }
 } else {
-av_log(s1, AV_LOG_WARNING,
+av_log(ctx, AV_LOG_WARNING,
"This device does not support any standard\n");
 }
 }
@@ -696,11 +696,11 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 tpf = &streamparm.parm.capture.timeperframe;
 break;
 }
-av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", 
av_err2str(ret));
+av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_ENUMSTD): %s\n", 
av_err2str(ret));
 return ret;
 }
 if (standard.id == s->std_id) {
-av_log(s1, AV_LOG_DEBUG,
+av_log(ctx, AV_LOG_DEBUG,
"Current standard: %s, id: %"PRIx64", frameperiod: 
%d/%d\n",
standard.name, (uint64_t)standard.id, tpf->numerator, 
tpf->denominator);
 break;
@@ -713,7 +713,7 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) {
 ret = AVERROR(errno);
-av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", 
av_err2str(ret));
+av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", 
av_err2str(ret));
 return ret;
 }
 
@@ -721,41 +721,41 @@ static int v4l2_set_parameters(AVFormatContext *s1)
 if (streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {
 tpf = &streamparm.parm.capture.timeperframe;
 
-av_log(s1, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n",
+av_log(ctx, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n",
framerate_q.den, framerate_q.num);
 tpf->numerator   = framerate_q.den;
 tpf->denominator = framerate_q.num;
 
 if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) < 0) {
 ret = AVERROR(errno);
-av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n", 
av_err2str(ret));
+av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n", 
av_err2str(ret));
 return ret;
 }
 
 if (framerate_q.num != tpf->denominator ||
 framerate_q.den != tpf->numerator) {
-av_log(s1, AV_LOG_INFO,
+av_log(ctx, AV_LOG_INFO,
"The drive

[FFmpeg-cvslog] lavd/v4l2: simplify first_field()

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
17:24:43 2014 +0200| [3da359c140a29c1f45eb7844a6d68aa958cd604c] | committer: 
Michael Niedermayer

lavd/v4l2: simplify first_field()

There is no need to pass fd as a second parameter. Additionally remove
unneeded curly braces.

Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index a765e64..2fd4966 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -225,18 +225,16 @@ static int device_init(AVFormatContext *ctx, int *width, 
int *height,
 return res;
 }
 
-static int first_field(const struct video_data *s, int fd)
+static int first_field(const struct video_data *s)
 {
 int res;
 v4l2_std_id std;
 
-res = v4l2_ioctl(fd, VIDIOC_G_STD, &std);
-if (res < 0) {
+res = v4l2_ioctl(s->fd, VIDIOC_G_STD, &std);
+if (res < 0)
 return 0;
-}
-if (std & V4L2_STD_NTSC) {
+if (std & V4L2_STD_NTSC)
 return 0;
-}
 
 return 1;
 }
@@ -935,7 +933,7 @@ static int v4l2_read_header(AVFormatContext *ctx)
 (res = mmap_start(ctx)) < 0)
 goto fail;
 
-s->top_field_first = first_field(s, s->fd);
+s->top_field_first = first_field(s);
 
 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
 st->codec->codec_id = codec_id;

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


[FFmpeg-cvslog] lavd/v4l2: remove unneeded variable in device_init()

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
17:34:51 2014 +0200| [55cf7d9713dc839da47b56a19c97dc1b943d7d72] | committer: 
Michael Niedermayer

lavd/v4l2: remove unneeded variable in device_init()

Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 2fd4966..a1eed1a 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -186,10 +186,8 @@ static int device_init(AVFormatContext *ctx, int *width, 
int *height,
uint32_t pix_fmt)
 {
 struct video_data *s = ctx->priv_data;
-int fd = s->fd;
 struct v4l2_format fmt = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
 struct v4l2_pix_format *pix = &fmt.fmt.pix;
-
 int res = 0;
 
 pix->width = *width;
@@ -197,7 +195,7 @@ static int device_init(AVFormatContext *ctx, int *width, 
int *height,
 pix->pixelformat = pix_fmt;
 pix->field = V4L2_FIELD_ANY;
 
-if (v4l2_ioctl(fd, VIDIOC_S_FMT, &fmt) < 0)
+if (v4l2_ioctl(s->fd, VIDIOC_S_FMT, &fmt) < 0)
 res = AVERROR(errno);
 
 if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) {

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


[FFmpeg-cvslog] lavd/v4l2: simplify list_framesizes()

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
17:39:50 2014 +0200| [7865cafec295b545f6a2b813ca7539086917e513] | committer: 
Michael Niedermayer

lavd/v4l2: simplify list_framesizes()

We can avoid passing file descriptor fd explicitely.

Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index a1eed1a..f0d0e2e 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -238,12 +238,12 @@ static int first_field(const struct video_data *s)
 }
 
 #if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE
-static void list_framesizes(AVFormatContext *ctx, int fd, uint32_t pixelformat)
+static void list_framesizes(AVFormatContext *ctx, uint32_t pixelformat)
 {
 const struct video_data *s = ctx->priv_data;
 struct v4l2_frmsizeenum vfse = { .pixel_format = pixelformat };
 
-while(!v4l2_ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &vfse)) {
+while(!v4l2_ioctl(s->fd, VIDIOC_ENUM_FRAMESIZES, &vfse)) {
 switch (vfse.type) {
 case V4L2_FRMSIZE_TYPE_DISCRETE:
 av_log(ctx, AV_LOG_INFO, " %ux%u",
@@ -296,7 +296,7 @@ static void list_formats(AVFormatContext *ctx, int fd, int 
type)
 av_log(ctx, AV_LOG_INFO, " Emulated :");
 #endif
 #if HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE
-list_framesizes(ctx, fd, vfd.pixelformat);
+list_framesizes(ctx, vfd.pixelformat);
 #endif
 av_log(ctx, AV_LOG_INFO, "\n");
 }

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


[FFmpeg-cvslog] Merge commit 'b574e1e97ea7067a5fcd3876e30a67df0e4e6611'

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
19:08:27 2014 +0200| [8c6cfffa01b27afde8bb983c6421611e07688aa6] | committer: 
Michael Niedermayer

Merge commit 'b574e1e97ea7067a5fcd3876e30a67df0e4e6611'

* commit 'b574e1e97ea7067a5fcd3876e30a67df0e4e6611':
  get_bits: Add OPEN_READER macro variant w/o size_plus8

Conflicts:
libavcodec/get_bits.h

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] get_bits: Add OPEN_READER macro variant w/o size_plus8

2014-09-05 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Fri Aug 22 
14:37:39 2014 +0200| [b574e1e97ea7067a5fcd3876e30a67df0e4e6611] | committer: 
Diego Biurrun

get_bits: Add OPEN_READER macro variant w/o size_plus8

This avoids a trillion warnings from MSVC.

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

 libavcodec/dvdec.c|2 +-
 libavcodec/get_bits.h |   13 +++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c
index 476f8c9..876a4a2 100644
--- a/libavcodec/dvdec.c
+++ b/libavcodec/dvdec.c
@@ -88,7 +88,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, 
int16_t *block)
 int partial_bit_count = mb->partial_bit_count;
 int level, run, vlc_len, index;
 
-OPEN_READER(re, gb);
+OPEN_READER_NOSIZE(re, gb);
 UPDATE_CACHE(re, gb);
 
 /* if we must parse a partial VLC, we do it here */
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index f1962f2..b7c68e1 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -123,17 +123,18 @@ typedef struct RL_VLC_ELEM {
 #   define MIN_CACHE_BITS 25
 #endif
 
-#if UNCHECKED_BITSTREAM_READER
-#define OPEN_READER(name, gb)   \
+#define OPEN_READER_NOSIZE(name, gb)\
 unsigned int name ## _index = (gb)->index;  \
 unsigned int av_unused name ## _cache = 0
 
+#if UNCHECKED_BITSTREAM_READER
+#define OPEN_READER(name, gb) OPEN_READER_NOSIZE(name, gb)
+
 #define BITS_AVAILABLE(name, gb) 1
 #else
 #define OPEN_READER(name, gb)   \
-unsigned int name ## _index = (gb)->index;  \
-unsigned int av_unused name ## _cache = 0;  \
-unsigned int av_unused name ## _size_plus8 = (gb)->size_in_bits_plus8
+OPEN_READER_NOSIZE(name, gb);   \
+unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8
 
 #define BITS_AVAILABLE(name, gb) name ## _index < name ## _size_plus8
 #endif
@@ -254,7 +255,7 @@ static inline unsigned int get_bits(GetBitContext *s, int n)
 static inline unsigned int show_bits(GetBitContext *s, int n)
 {
 register int tmp;
-OPEN_READER(re, s);
+OPEN_READER_NOSIZE(re, s);
 UPDATE_CACHE(re, s);
 tmp = SHOW_UBITS(re, s, n);
 return tmp;

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


[FFmpeg-cvslog] Merge commit '096a1d5b46391f65dfd0bee6292e9962f53bd7c8'

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
19:15:52 2014 +0200| [73aeb27cfe4ec51c2577097c980fe126dcd1908b] | committer: 
Michael Niedermayer

Merge commit '096a1d5b46391f65dfd0bee6292e9962f53bd7c8'

* commit '096a1d5b46391f65dfd0bee6292e9962f53bd7c8':
  rdft: Move some variables into a separate block

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] rdft: Move some variables into a separate block

2014-09-05 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Fri Aug 29 
16:56:20 2014 +0200| [096a1d5b46391f65dfd0bee6292e9962f53bd7c8] | committer: 
Diego Biurrun

rdft: Move some variables into a separate block

This avoids an unused variable warning with hardcoded tables.

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

 libavcodec/rdft.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/rdft.c b/libavcodec/rdft.c
index 54cf14a..1965253 100644
--- a/libavcodec/rdft.c
+++ b/libavcodec/rdft.c
@@ -99,8 +99,6 @@ static void rdft_calc_c(RDFTContext *s, FFTSample *data)
 av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType 
trans)
 {
 int n = 1 << nbits;
-int i;
-const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 
1)*2*M_PI/n;
 
 s->nbits   = nbits;
 s->inverse = trans == IDFT_C2R || trans == DFT_C2R;
@@ -116,8 +114,11 @@ av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum 
RDFTransformType trans)
 s->tcos = ff_cos_tabs[nbits];
 s->tsin = ff_sin_tabs[nbits]+(trans == DFT_R2C || trans == DFT_C2R)*(n>>2);
 #if !CONFIG_HARDCODED_TABLES
-for (i = 0; i < (n>>2); i++) {
-s->tsin[i] = sin(i*theta);
+{
+int i;
+const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1) * 
2 * M_PI / n;
+for (i = 0; i < (n >> 2); i++)
+s->tsin[i] = sin(i * theta);
 }
 #endif
 s->rdft_calc   = rdft_calc_c;

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


[FFmpeg-cvslog] Merge commit '213e606752d16f51337e94431962fb5d7749c07e'

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
19:24:49 2014 +0200| [1e4e760f767b597f88442b75e90d726ae626b230] | committer: 
Michael Niedermayer

Merge commit '213e606752d16f51337e94431962fb5d7749c07e'

* commit '213e606752d16f51337e94431962fb5d7749c07e':
  Replace av_unused attributes by block structures

Conflicts:
libavcodec/h264_loopfilter.c

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] Replace av_unused attributes by block structures

2014-09-05 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Sep  2 
23:23:03 2014 +0200| [213e606752d16f51337e94431962fb5d7749c07e] | committer: 
Diego Biurrun

Replace av_unused attributes by block structures

This is more portable and avoids warnings with compilers that do not
properly support av_unused.

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

 libavcodec/faandct.c |   20 
 libavcodec/faanidct.c|   10 ++
 libavcodec/h264_loopfilter.c |   11 ---
 libavcodec/rangecoder.h  |   12 ++--
 4 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/libavcodec/faandct.c b/libavcodec/faandct.c
index b1d7a14..4053d69 100644
--- a/libavcodec/faandct.c
+++ b/libavcodec/faandct.c
@@ -68,7 +68,6 @@ static av_always_inline void row_fdct(FLOAT temp[64], int16_t 
*data)
 FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
 FLOAT tmp10, tmp11, tmp12, tmp13;
 FLOAT z2, z4, z11, z13;
-FLOAT av_unused z5;
 int i;
 
 for (i=0; i<8*8; i+=8) {
@@ -99,9 +98,12 @@ static av_always_inline void row_fdct(FLOAT temp[64], 
int16_t *data)
 tmp6 += tmp7;
 
 #if 0
-z5= (tmp4 - tmp6) * A5;
-z2= tmp4*A2 + z5;
-z4= tmp6*A4 + z5;
+{
+FLOAT z5;
+z5 = (tmp4 - tmp6) * A5;
+z2 =  tmp4 * A2 + z5;
+z4 =  tmp6 * A4 + z5;
+}
 #else
 z2= tmp4*(A2+A5) - tmp6*A5;
 z4= tmp6*(A4-A5) + tmp4*A5;
@@ -123,7 +125,6 @@ void ff_faandct(int16_t *data)
 FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
 FLOAT tmp10, tmp11, tmp12, tmp13;
 FLOAT z2, z4, z11, z13;
-FLOAT av_unused z5;
 FLOAT temp[64];
 int i;
 
@@ -159,9 +160,12 @@ void ff_faandct(int16_t *data)
 tmp6 += tmp7;
 
 #if 0
-z5= (tmp4 - tmp6) * A5;
-z2= tmp4*A2 + z5;
-z4= tmp6*A4 + z5;
+{
+FLOAT z5;
+z5 = (tmp4 - tmp6) * A5;
+z2 =  tmp4 * A2 + z5;
+z4 =  tmp6 * A4 + z5;
+}
 #else
 z2= tmp4*(A2+A5) - tmp6*A5;
 z4= tmp6*(A4-A5) + tmp4*A5;
diff --git a/libavcodec/faanidct.c b/libavcodec/faanidct.c
index 5cacfdd..2e9ce9c 100644
--- a/libavcodec/faanidct.c
+++ b/libavcodec/faanidct.c
@@ -49,7 +49,6 @@ B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, 
B7*B6/8, B7*B7/8,
 
 static inline void p8idct(int16_t data[64], FLOAT temp[64], uint8_t *dest, int 
stride, int x, int y, int type){
 int i;
-FLOAT av_unused tmp0;
 FLOAT s04, d04, s17, d17, s26, d26, s53, d53;
 FLOAT os07, os16, os25, os34;
 FLOAT od07, od16, od25, od34;
@@ -64,9 +63,12 @@ static inline void p8idct(int16_t data[64], FLOAT temp[64], 
uint8_t *dest, int s
 od25= (s17 - s53)*(2*A4);
 
 #if 0 //these 2 are equivalent
-tmp0= (d17 + d53)*(2*A2);
-od34=  d17*( 2*B6) - tmp0;
-od16=  d53*(-2*B2) + tmp0;
+{
+FLOAT tmp0;
+tmp0 = (d17 + d53) *  (2 * A2);
+od34 =  d17*  (2 * B6) - tmp0;
+od16 =  d53* (-2 * B2) + tmp0;
+}
 #else
 od34=  d17*(2*(B6-A2)) - d53*(2*A2);
 od16=  d53*(2*(A2-B2)) + d17*(2*A2);
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 717c225..a15130c 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -704,7 +704,6 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, 
uint8_t *img_y, uint
 const int mb_type = h->cur_pic.mb_type[mb_xy];
 const int mvy_limit = IS_INTERLACED(mb_type) ? 2 : 4;
 int first_vertical_edge_done = 0;
-av_unused int dir;
 int chroma = !(CONFIG_GRAY && (h->flags&CODEC_FLAG_GRAY));
 int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
 int a = 52 + h->slice_alpha_c0_offset - qp_bd_offset;
@@ -815,8 +814,14 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int 
mb_y, uint8_t *img_y, uint
 }
 
 #if CONFIG_SMALL
-for( dir = 0; dir < 2; dir++ )
-filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, 
uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, a, 
b, chroma, dir);
+{
+int dir;
+for (dir = 0; dir < 2; dir++)
+filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize,
+  uvlinesize, mb_xy, mb_type, mvy_limit,
+  dir ? 0 : first_vertical_edge_done, a, b,
+  chroma, dir);
+}
 #else
 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 
mb_xy, mb_type, mvy_limit, first_vertical_edge_done, a, b, chroma, 0);
 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, 
mb_xy, mb_type, mvy_limit, 0,a, b, chroma, 1);
diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h
index ad9c81f..4c88169 100644
--- a/libavcodec/rangecode

[FFmpeg-cvslog] add silenceremove filter

2014-09-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Wed Jul  2 09:39:07 
2014 +| [422619646ea0e938188a49a06226831cc42e2a6a] | committer: Paul B Mahol

add silenceremove filter

Signed-off-by: Paul B Mahol 

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

 Changelog  |1 +
 MAINTAINERS|1 +
 RELEASE_NOTES  |1 +
 doc/filters.texi   |   69 ++
 libavfilter/Makefile   |1 +
 libavfilter/af_silenceremove.c |  482 
 libavfilter/allfilters.c   |1 +
 libavfilter/version.h  |4 +-
 8 files changed, 558 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 72c783a..c5185f7 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@ version :
 - added codecview filter to visualize information exported by some codecs
 - Matroska 3D support thorugh side data
 - HTML generation using texi2html is deprecated in favor of makeinfo/texi2any
+- silenceremove filter
 
 
 version 2.3:
diff --git a/MAINTAINERS b/MAINTAINERS
index eb1f98b..8af02ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -343,6 +343,7 @@ Filters:
   af_compand.c  Paul B Mahol
   af_ladspa.c   Paul B Mahol
   af_pan.c  Nicolas George
+  af_silenceremove.cPaul B Mahol
   avf_avectorscope.cPaul B Mahol
   avf_showcqt.c Muhammad Faiz
   vf_blend.cPaul B Mahol
diff --git a/RELEASE_NOTES b/RELEASE_NOTES
index 15eb81b..113cc5e 100644
--- a/RELEASE_NOTES
+++ b/RELEASE_NOTES
@@ -42,6 +42,7 @@
 • ported lenscorrection filter from frei0r filter
 • large optimizations in dctdnoiz to make it usable
 • added codecview filter to visualize information exported by some codecs
+• added silenceremove filter
 
┌┐
│ libavutil  │
diff --git a/doc/filters.texi b/doc/filters.texi
index d13278e..627f112 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1875,6 +1875,75 @@ ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f 
null -
 @end example
 @end itemize
 
+@section silenceremove
+
+Remove silence from the beginning, middle or end of the audio.
+
+The filter accepts the following options:
+
+@table @option
+@item start_periods
+This value is used to indicate if audio should be trimmed at beginning of
+the audio. A value of zero indicates no silence should be trimmed from the
+beginning. When specifying a non-zero value, it trims audio up until it
+finds non-silence. Normally, when trimming silence from beginning of audio
+the @var{start_periods} will be @code{1} but it can be increased to higher
+values to trim all audio up to specific count of non-silence periods.
+Default value is @code{0}.
+
+@item start_duration
+Specify the amount of time that non-silence must be detected before it stops
+trimming audio. By increasing the duration, bursts of noises can be treated
+as silence and trimmed off. Default value is @code{0}.
+
+@item start_threshold
+This indicates what sample value should be treated as silence. For digital
+audio, a value of @code{0} may be fine but for audio recorded from analog,
+you may wish to increase the value to account for background noise.
+Can be specified in dB (in case "dB" is appended to the specified value)
+or amplitude ratio. Default value is @code{0}.
+
+@item stop_periods
+Set the count for trimming silence from the end of audio.
+To remove silence from the middle of a file, specify a @var{stop_periods}
+that is negative. This value is then threated as a positive value and is
+used to indicate the effect should restart processing as specified by
+@var{start_periods}, making it suitable for removing periods of silence
+in the middle of the audio.
+Default value is @code{0}.
+
+@item stop_duration
+Specify a duration of silence that must exist before audio is not copied any
+more. By specifying a higher duration, silence that is wanted can be left in
+the audio.
+Default value is @code{0}.
+
+@item stop_threshold
+This is the same as @option{start_threshold} but for trimming silence from
+the end of audio.
+Can be specified in dB (in case "dB" is appended to the specified value)
+or amplitude ratio. Default value is @code{0}.
+
+@item leave_silence
+This indicate that @var{stop_duration} length of audio should be left intact
+at the beginning of each period of silence.
+For example, if you want to remove long pauses between words but do not want
+to remove the pauses completely. Default value is @code{0}.
+
+@end table
+
+@subsection Examples
+
+@itemize
+@item
+The following example shows how this filter can be used to start a recording
+that does not contain the delay at the start which usually occurs between
+pressing the record button and the start of the performance:
+@example
+silencer

[FFmpeg-cvslog] MAINTAINERS: fix typo

2014-09-05 Thread Paul B Mahol
ffmpeg | branch: master | Paul B Mahol  | Fri Sep  5 17:32:41 
2014 +| [7bd0079e9e024faafebcb94be369cf0d1ed7ddee] | committer: Paul B Mahol

MAINTAINERS: fix typo

Signed-off-by: Paul B Mahol 

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

 MAINTAINERS |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 8af02ae..ddd84b0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -354,7 +354,7 @@ Filters:
   vf_extractplanes.cPaul B Mahol
   vf_histogram.cPaul B Mahol
   vf_hqx.c  Clément Bœsch
-  vf_idec.c Pascal Massimino
+  vf_idet.c Pascal Massimino
   vf_il.c   Paul B Mahol
   vf_lenscorrection.c   Daniel Oberhoff
   vf_mergeplanes.c  Paul B Mahol

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


[FFmpeg-cvslog] [ffmpeg-web] branch master updated. f28c4f5 web: do not try to create projects.html page

2014-09-05 Thread gitolite
The branch, master has been updated
   via  f28c4f5302608b1da130f6a6980ca21d741c178d (commit)
  from  bc326b5464c0bd0ce3c4dc5552edf6826ebb83c9 (commit)


- Log -
commit f28c4f5302608b1da130f6a6980ca21d741c178d
Author: Clément Bœsch 
AuthorDate: Fri Sep 5 19:37:09 2014 +0200
Commit: Clément Bœsch 
CommitDate: Fri Sep 5 19:37:23 2014 +0200

web: do not try to create projects.html page

Fix build after 00b72f63772b7cb60f0e0f8105049827d0ea2d04 (and a make
clean)

diff --git a/Makefile b/Makefile
index 5c376eb..f13a36f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # ffmpeg.org HTML generation from source files
 
 SRCS = about bugreports consulting contact donations documentation download \
-   olddownload index legal projects shame security archive
+   olddownload index legal shame security archive
 
 HTML_TARGETS  = $(addsuffix .html,$(addprefix htdocs/,$(SRCS)))
 

---

Summary of changes:
 Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


hooks/post-receive
-- 

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


[FFmpeg-cvslog] Drop unnecessary av_unused attributes.

2014-09-05 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Sep  2 
23:25:07 2014 +0200| [2143948381c8118bdc2f50bd4079520b9885bd54] | committer: 
Diego Biurrun

Drop unnecessary av_unused attributes.

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

 libavcodec/h264_cabac.c|2 +-
 libavcodec/h264qpel_template.c |2 +-
 libavcodec/rv30dsp.c   |2 +-
 libavcodec/rv40dsp.c   |2 +-
 libavcodec/vp56.h  |4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index f1ab97a..a55a8f3 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1604,7 +1604,7 @@ decode_cabac_residual_internal(H264Context *h, int16_t 
*block,
 
 int index[64];
 
-int av_unused last;
+int last;
 int coeff_count = 0;
 int node_ctx = 0;
 
diff --git a/libavcodec/h264qpel_template.c b/libavcodec/h264qpel_template.c
index 7dd901c..e846ac9 100644
--- a/libavcodec/h264qpel_template.c
+++ b/libavcodec/h264qpel_template.c
@@ -378,7 +378,7 @@ static void FUNC(OPNAME ## h264_qpel16_hv_lowpass)(uint8_t 
*dst, int16_t *tmp, c
 }\
 
 #define H264_MC(OPNAME, SIZE) \
-static av_unused void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc00)(uint8_t 
*dst, const uint8_t *src, ptrdiff_t stride)\
+static void FUNCC(OPNAME ## h264_qpel ## SIZE ## _mc00)(uint8_t *dst, const 
uint8_t *src, ptrdiff_t stride)\
 {\
 FUNCC(OPNAME ## pixels ## SIZE)(dst, src, stride, SIZE);\
 }\
diff --git a/libavcodec/rv30dsp.c b/libavcodec/rv30dsp.c
index 36187a7..50f4186 100644
--- a/libavcodec/rv30dsp.c
+++ b/libavcodec/rv30dsp.c
@@ -31,7 +31,7 @@
 #include "rv34dsp.h"
 
 #define RV30_LOWPASS(OPNAME, OP) \
-static av_unused void OPNAME ## rv30_tpel8_h_lowpass(uint8_t *dst, const 
uint8_t *src, int dstStride, int srcStride, const int C1, const int C2){\
+static void OPNAME ## rv30_tpel8_h_lowpass(uint8_t *dst, const uint8_t *src, 
int dstStride, int srcStride, const int C1, const int C2){\
 const int h = 8;\
 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;\
 int i;\
diff --git a/libavcodec/rv40dsp.c b/libavcodec/rv40dsp.c
index d1643e0..da3efb4 100644
--- a/libavcodec/rv40dsp.c
+++ b/libavcodec/rv40dsp.c
@@ -34,7 +34,7 @@
 #include "rv34dsp.h"
 
 #define RV40_LOWPASS(OPNAME, OP) \
-static av_unused void OPNAME ## rv40_qpel8_h_lowpass(uint8_t *dst, const 
uint8_t *src, int dstStride, int srcStride,\
+static void OPNAME ## rv40_qpel8_h_lowpass(uint8_t *dst, const uint8_t *src, 
int dstStride, int srcStride,\
  const int h, const int 
C1, const int C2, const int SHIFT){\
 const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;\
 int i;\
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index a852ff8..f2ed770 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -299,7 +299,7 @@ static av_always_inline int vp8_rac_get(VP56RangeCoder *c)
 return vp56_rac_get_prob(c, 128);
 }
 
-static av_unused int vp56_rac_gets(VP56RangeCoder *c, int bits)
+static int vp56_rac_gets(VP56RangeCoder *c, int bits)
 {
 int value = 0;
 
@@ -310,7 +310,7 @@ static av_unused int vp56_rac_gets(VP56RangeCoder *c, int 
bits)
 return value;
 }
 
-static av_unused int vp8_rac_get_uint(VP56RangeCoder *c, int bits)
+static int vp8_rac_get_uint(VP56RangeCoder *c, int bits)
 {
 int value = 0;
 

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


[FFmpeg-cvslog] Merge commit '2143948381c8118bdc2f50bd4079520b9885bd54'

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
19:29:41 2014 +0200| [0a7239ae25e0741106b00def14ad8d8d4f211490] | committer: 
Michael Niedermayer

Merge commit '2143948381c8118bdc2f50bd4079520b9885bd54'

* commit '2143948381c8118bdc2f50bd4079520b9885bd54':
  Drop unnecessary av_unused attributes.

Merged-by: Michael Niedermayer 

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



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


[FFmpeg-cvslog] lavd/v4l2: simplify list_formats()

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Fri Sep  5 
17:43:59 2014 +0200| [0b890425e3547cd1818cbe24cadfbcf1b6c93e9a] | committer: 
Michael Niedermayer

lavd/v4l2: simplify list_formats()

We can avoid passing file descriptor fd explicitely.

Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index f0d0e2e..b473f7e 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -264,12 +264,12 @@ static void list_framesizes(AVFormatContext *ctx, 
uint32_t pixelformat)
 }
 #endif
 
-static void list_formats(AVFormatContext *ctx, int fd, int type)
+static void list_formats(AVFormatContext *ctx, int type)
 {
 const struct video_data *s = ctx->priv_data;
 struct v4l2_fmtdesc vfd = { .type = V4L2_BUF_TYPE_VIDEO_CAPTURE };
 
-while(!v4l2_ioctl(fd, VIDIOC_ENUM_FMT, &vfd)) {
+while(!v4l2_ioctl(s->fd, VIDIOC_ENUM_FMT, &vfd)) {
 enum AVCodecID codec_id = avpriv_fmt_v4l2codec(vfd.pixelformat);
 enum AVPixelFormat pix_fmt = avpriv_fmt_v4l2ff(vfd.pixelformat, 
codec_id);
 
@@ -857,7 +857,7 @@ static int v4l2_read_header(AVFormatContext *ctx)
s->channel, input.name, (uint64_t)input.std);
 
 if (s->list_format) {
-list_formats(ctx, s->fd, s->list_format);
+list_formats(ctx, s->list_format);
 res = AVERROR_EXIT;
 goto fail;
 }

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


[FFmpeg-cvslog] avcodec/mpegvideo: Factor ff_mpv_decode_init() out

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
16:57:57 2014 +0200| [4dee4a4470cd28132cc9c96e00a6cc1080a4b27f] | committer: 
Michael Niedermayer

avcodec/mpegvideo: Factor ff_mpv_decode_init() out

Reviewed-by: Benoit Fouet 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/h261dec.c   |7 ++-
 libavcodec/h263dec.c   |6 ++
 libavcodec/mpeg12dec.c |3 +--
 libavcodec/mpegvideo.c |   12 
 libavcodec/mpegvideo.h |1 +
 libavcodec/rv10.c  |3 +--
 libavcodec/rv34.c  |7 +--
 7 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index a8aae6e..ead81fc 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -76,14 +76,11 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
 
 // set defaults
 ff_mpv_decode_defaults(s);
-s->avctx   = avctx;
-s->width   = s->avctx->coded_width;
-s->height  = s->avctx->coded_height;
-s->codec_id= s->avctx->codec->id;
+ff_mpv_decode_init(s, avctx);
+
 s->out_format  = FMT_H261;
 s->low_delay   = 1;
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
-s->codec_id= avctx->codec->id;
 
 ff_h261_common_init();
 h261_decode_init_vlc(h);
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9f5500d..b39a63b 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -48,14 +48,12 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
 MpegEncContext *s = avctx->priv_data;
 int ret;
 
-s->avctx   = avctx;
 s->out_format  = FMT_H263;
-s->width   = avctx->coded_width;
-s->height  = avctx->coded_height;
-s->workaround_bugs = avctx->workaround_bugs;
 
 // set defaults
 ff_mpv_decode_defaults(s);
+ff_mpv_decode_init(s, avctx);
+
 s->quant_precision = 5;
 s->decode_mb   = ff_h263_decode_mb;
 s->low_delay   = 1;
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 40aad16..ed3490b 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1120,10 +1120,9 @@ static av_cold int mpeg_decode_init(AVCodecContext 
*avctx)
 MpegEncContext *s2 = &s->mpeg_enc_ctx;
 
 ff_mpv_decode_defaults(s2);
+ff_mpv_decode_init(s2, avctx);
 
 s->mpeg_enc_ctx.avctx  = avctx;
-s->mpeg_enc_ctx.flags  = avctx->flags;
-s->mpeg_enc_ctx.flags2 = avctx->flags2;
 
 /* we need some permutation to store matrices,
  * until the decoder sets the real permutation. */
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 85cb41d..f5306cb 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1109,6 +1109,18 @@ void ff_mpv_decode_defaults(MpegEncContext *s)
 ff_mpv_common_defaults(s);
 }
 
+void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx)
+{
+s->avctx   = avctx;
+s->width   = avctx->coded_width;
+s->height  = avctx->coded_height;
+s->codec_id= avctx->codec->id;
+s->workaround_bugs = avctx->workaround_bugs;
+s->flags   = avctx->flags;
+s->flags2  = avctx->flags2;
+
+}
+
 static int init_er(MpegEncContext *s)
 {
 ERContext *er = &s->er;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index fa20665..87fe87f 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -726,6 +726,7 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s);
 void ff_mpv_common_end(MpegEncContext *s);
 
 void ff_mpv_decode_defaults(MpegEncContext *s);
+void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx);
 void ff_mpv_decode_mb(MpegEncContext *s, int16_t block[12][64]);
 void ff_mpv_report_decode_progress(MpegEncContext *s);
 
diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c
index 4a5cf41..7097b29 100644
--- a/libavcodec/rv10.c
+++ b/libavcodec/rv10.c
@@ -475,10 +475,9 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
 return ret;
 
 ff_mpv_decode_defaults(s);
+ff_mpv_decode_init(s, avctx);
 
-s->avctx   = avctx;
 s->out_format  = FMT_H263;
-s->codec_id= avctx->codec_id;
 
 rv->orig_width  =
 s->width= avctx->coded_width;
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index c8aa6b6..a232ab2 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -1490,14 +1490,9 @@ av_cold int ff_rv34_decode_init(AVCodecContext *avctx)
 int ret;
 
 ff_mpv_decode_defaults(s);
-s->avctx  = avctx;
+ff_mpv_decode_init(s, avctx);
 s->out_format = FMT_H263;
-s->codec_id   = avctx->codec_id;
 
-s->width  = avctx->width;
-s->height = avctx->height;
-
-r->s.avctx = avctx;
 avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 avctx->has_b_frames = 1;
 s->low_delay = 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org

[FFmpeg-cvslog] avcodec/mpegvideo: set codec tags in ff_mpv_decode_init()

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Fri Sep  5 
17:14:50 2014 +0200| [dcb29d37d4ffedc84e44df99f8d22ecf27e0f2cd] | committer: 
Michael Niedermayer

avcodec/mpegvideo: set codec tags in ff_mpv_decode_init()

Fixes Ticket3912

Reviewed-by: Benoit Fouet 
Signed-off-by: Michael Niedermayer 

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

 libavcodec/mpegvideo.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index f5306cb..41a8799 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1119,6 +1119,10 @@ void ff_mpv_decode_init(MpegEncContext *s, 
AVCodecContext *avctx)
 s->flags   = avctx->flags;
 s->flags2  = avctx->flags2;
 
+/* convert fourcc to upper case */
+s->codec_tag  = avpriv_toupper4(avctx->codec_tag);
+
+s->stream_codec_tag   = avpriv_toupper4(avctx->stream_codec_tag);
 }
 
 static int init_er(MpegEncContext *s)
@@ -1331,10 +1335,6 @@ av_cold int ff_mpv_common_init(MpegEncContext *s)
   &s->chroma_x_shift,
   &s->chroma_y_shift);
 
-/* convert fourcc to upper case */
-s->codec_tag  = avpriv_toupper4(s->avctx->codec_tag);
-
-s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
 
 FF_ALLOCZ_OR_GOTO(s->avctx, s->picture,
   MAX_PICTURE_COUNT * sizeof(Picture), fail);

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


[FFmpeg-cvslog] avformat/realtextdec: UTF-16 support

2014-09-05 Thread wm4
ffmpeg | branch: master | wm4  | Tue Sep  2 20:54:16 
2014 +0200| [b7f641dc9bff452c0af75700d1127f54dadf4247] | committer: Clément 
Bœsch

avformat/realtextdec: UTF-16 support

Also remove ff_smil_extract_next_chunk - this was the last user of it.

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

 libavformat/realtextdec.c |   17 ++---
 libavformat/subtitles.c   |9 -
 libavformat/subtitles.h   |5 -
 3 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/libavformat/realtextdec.c b/libavformat/realtextdec.c
index e1225d5..19af108 100644
--- a/libavformat/realtextdec.c
+++ b/libavformat/realtextdec.c
@@ -37,11 +37,12 @@ typedef struct {
 
 static int realtext_probe(AVProbeData *p)
 {
-const unsigned char *ptr = p->buf;
+char buf[7];
+FFTextReader tr;
+ff_text_init_buf(&tr, p->buf, p->buf_size);
+ff_text_read(&tr, buf, sizeof(buf));
 
-if (AV_RB24(ptr) == 0xEFBBBF)
-ptr += 3;  /* skip UTF-8 BOM */
-return !av_strncasecmp(ptr, "pb);
 
 if (!st)
 return AVERROR(ENOMEM);
@@ -72,10 +75,10 @@ static int realtext_read_header(AVFormatContext *s)
 
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 
-while (!avio_feof(s->pb)) {
+while (!ff_text_eof(&tr)) {
 AVPacket *sub;
-const int64_t pos = avio_tell(s->pb) - (c != 0);
-int n = ff_smil_extract_next_chunk(s->pb, &buf, &c);
+const int64_t pos = ff_text_pos(&tr) - (c != 0);
+int n = ff_smil_extract_next_text_chunk(&tr, &buf, &c);
 
 if (n == 0)
 break;
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 6b59538..95faca6 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -297,15 +297,6 @@ int ff_smil_extract_next_text_chunk(FFTextReader *tr, 
AVBPrint *buf, char *c)
 return i;
 }
 
-int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c)
-{
-FFTextReader tr;
-tr.buf_pos = tr.buf_len = 0;
-tr.type = 0;
-tr.pb = pb;
-return ff_smil_extract_next_text_chunk(&tr, buf, c);
-}
-
 const char *ff_smil_get_attr_ptr(const char *s, const char *attr)
 {
 int in_quotes = 0;
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 67ddf4d..903c24d 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -144,11 +144,6 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q);
  *
  * @param c cached character, to avoid a backward seek
  */
-int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c);
-
-/**
- * As ff_smil_extract_next_chunk(), but with FFTextReader.
- */
 int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c);
 
 /**

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


[FFmpeg-cvslog] avformat/assdec: UTF-16 support

2014-09-05 Thread wm4
ffmpeg | branch: master | wm4  | Tue Sep  2 20:48:45 
2014 +0200| [3e8426170ce005c111dfcae7982e18b647b7383f] | committer: Clément 
Bœsch

avformat/assdec: UTF-16 support

Use the UTF-16 BOM to detect UTF-16 encoding. Convert the file contents
to UTF-8 on the fly using FFTextReader, which acts as converting wrapper
around AVIOContext. It also can work on a static buffer, needed for
format probing. The FFTextReader wrapper now also takes care of skipping
the UTF-8 BOM.

Fix Ticket #3496.

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

 libavformat/assdec.c|   19 --
 libavformat/subtitles.c |   63 +++
 libavformat/subtitles.h |   56 +
 3 files changed, 131 insertions(+), 7 deletions(-)

diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index bb953c7..a5f792a 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -33,10 +33,13 @@ typedef struct ASSContext {
 
 static int ass_probe(AVProbeData *p)
 {
-const char *header = "[Script Info]";
+char buf[13];
+FFTextReader tr;
+ff_text_init_buf(&tr, p->buf, p->buf_size);
 
-if (!memcmp(p->buf, header, strlen(header)) ||
-!memcmp(p->buf + 3, header, strlen(header)))
+ff_text_read(&tr, buf, sizeof(buf));
+
+if (!memcmp(buf, "[Script Info]", 13))
 return AVPROBE_SCORE_MAX;
 
 return 0;
@@ -66,13 +69,13 @@ static int read_ts(const uint8_t *p, int64_t *start, int 
*duration)
 return -1;
 }
 
-static int64_t get_line(AVBPrint *buf, AVIOContext *pb)
+static int64_t get_line(AVBPrint *buf, FFTextReader *tr)
 {
-int64_t pos = avio_tell(pb);
+int64_t pos = ff_text_pos(tr);
 
 av_bprint_clear(buf);
 for (;;) {
-char c = avio_r8(pb);
+char c = ff_text_r8(tr);
 if (!c)
 break;
 av_bprint_chars(buf, c, 1);
@@ -88,6 +91,8 @@ static int ass_read_header(AVFormatContext *s)
 AVBPrint header, line;
 int header_remaining, res = 0;
 AVStream *st;
+FFTextReader tr;
+ff_text_init_avio(&tr, s->pb);
 
 st = avformat_new_stream(s, NULL);
 if (!st)
@@ -102,7 +107,7 @@ static int ass_read_header(AVFormatContext *s)
 av_bprint_init(&line,   0, AV_BPRINT_SIZE_UNLIMITED);
 
 for (;;) {
-int64_t pos = get_line(&line, s->pb);
+int64_t pos = get_line(&line, &tr);
 
 if (!line.str[0]) // EOF
 break;
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index fce2bf1..cebd453 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -20,9 +20,72 @@
 
 #include "avformat.h"
 #include "subtitles.h"
+#include "avio_internal.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 
+void ff_text_init_avio(FFTextReader *r, AVIOContext *pb)
+{
+int i;
+r->pb = pb;
+r->buf_pos = r->buf_len = 0;
+r->type = FF_UTF_8;
+for (i = 0; i < 2; i++)
+r->buf[r->buf_len++] = avio_r8(r->pb);
+if (strncmp("\xFF\xFE", r->buf, 2) == 0) {
+r->type = FF_UTF16LE;
+r->buf_pos += 2;
+} else if (strncmp("\xFE\xFF", r->buf, 2) == 0) {
+r->type = FF_UTF16BE;
+r->buf_pos += 2;
+} else {
+r->buf[r->buf_len++] = avio_r8(r->pb);
+if (strncmp("\xEF\xBB\xBF", r->buf, 3) == 0) {
+// UTF8
+r->buf_pos += 3;
+}
+}
+}
+
+void ff_text_init_buf(FFTextReader *r, void *buf, size_t size)
+{
+memset(&r->buf_pb, 0, sizeof(r->buf_pb));
+ffio_init_context(&r->buf_pb, buf, size, 0, NULL, NULL, NULL, NULL);
+ff_text_init_avio(r, &r->buf_pb);
+}
+
+int64_t ff_text_pos(FFTextReader *r)
+{
+return avio_tell(r->pb) - r->buf_len + r->buf_pos;
+}
+
+int ff_text_r8(FFTextReader *r)
+{
+uint32_t val;
+uint8_t tmp;
+if (r->buf_pos < r->buf_len)
+return r->buf[r->buf_pos++];
+if (r->type == FF_UTF16LE) {
+GET_UTF16(val, avio_rl16(r->pb), return 0;)
+} else if (r->type == FF_UTF16BE) {
+GET_UTF16(val, avio_rb16(r->pb), return 0;)
+} else {
+return avio_r8(r->pb);
+}
+if (!val)
+return 0;
+r->buf_pos = 0;
+r->buf_len = 0;
+PUT_UTF8(val, tmp, r->buf[r->buf_len++] = tmp;)
+return r->buf[r->buf_pos++]; // buf_len is at least 1
+}
+
+void ff_text_read(FFTextReader *r, char *buf, size_t size)
+{
+for ( ; size > 0; size--)
+*buf++ = ff_text_r8(r);
+}
+
 AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
 const uint8_t *event, int len, int merge)
 {
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index b5a96ec..38502d6 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -30,6 +30,62 @@ enum sub_sort {
 SUB_SORT_POS_TS,///< sort by position, then timestamps
 };
 
+enum ff_utf_type {
+FF_UTF_8,   // or other 8 bit encodings
+FF_UTF16LE,
+FF_UTF16BE

[FFmpeg-cvslog] avformat/srtdec: speed up probing

2014-09-05 Thread wm4
ffmpeg | branch: master | wm4  | Thu Sep  4 21:16:13 
2014 +0200| [c368538667121fb20c5414dfaf0fb273035a0854] | committer: Clément 
Bœsch

avformat/srtdec: speed up probing

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

 libavformat/srtdec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index b63d344..f5f3933 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -43,6 +43,7 @@ static int srt_probe(AVProbeData *p)
 if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0)
 break;
 if ((num == i || num + 1 == i)
+&& buf[0] >= '0' && buf[1] <= '9' && strstr(buf, " --> ")
 && sscanf(buf, "%*d:%*2d:%*2d%*1[,.]%*3d --> 
%*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)
 return AVPROBE_SCORE_MAX;
 num = atoi(buf);

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


[FFmpeg-cvslog] avformat/srtdec: UTF-16 support

2014-09-05 Thread wm4
ffmpeg | branch: master | wm4  | Tue Sep  2 20:52:07 
2014 +0200| [d658ef18e3d1ebe63a64f404ac4646890ecf02c9] | committer: Clément 
Bœsch

avformat/srtdec: UTF-16 support

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

 libavformat/srtdec.c|   25 --
 libavformat/subtitles.c |   53 +--
 libavformat/subtitles.h |   34 +++---
 3 files changed, 96 insertions(+), 16 deletions(-)

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 53182cd..b63d344 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -31,20 +31,21 @@ typedef struct {
 
 static int srt_probe(AVProbeData *p)
 {
-const unsigned char *ptr = p->buf;
 int i, v, num = 0;
+FFTextReader tr;
 
-if (AV_RB24(ptr) == 0xEFBBBF)
-ptr += 3;  /* skip UTF-8 BOM */
+ff_text_init_buf(&tr, p->buf, p->buf_size);
 
-while (*ptr == '\r' || *ptr == '\n')
-ptr++;
+while (ff_text_peek_r8(&tr) == '\r' || ff_text_peek_r8(&tr) == '\n')
+ff_text_r8(&tr);
 for (i=0; i<2; i++) {
+char buf[128];
+if (ff_subtitles_read_line(&tr, buf, sizeof(buf)) < 0)
+break;
 if ((num == i || num + 1 == i)
-&& sscanf(ptr, "%*d:%*2d:%*2d%*1[,.]%*3d --> 
%*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)
+&& sscanf(buf, "%*d:%*2d:%*2d%*1[,.]%*3d --> 
%*d:%*2d:%*2d%*1[,.]%3d", &v) == 1)
 return AVPROBE_SCORE_MAX;
-num = atoi(ptr);
-ptr += ff_subtitles_next_line(ptr);
+num = atoi(buf);
 }
 return 0;
 }
@@ -79,6 +80,8 @@ static int srt_read_header(AVFormatContext *s)
 AVBPrint buf;
 AVStream *st = avformat_new_stream(s, NULL);
 int res = 0;
+FFTextReader tr;
+ff_text_init_avio(&tr, s->pb);
 
 if (!st)
 return AVERROR(ENOMEM);
@@ -88,11 +91,11 @@ static int srt_read_header(AVFormatContext *s)
 
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 
-while (!avio_feof(s->pb)) {
-ff_subtitles_read_chunk(s->pb, &buf);
+while (!ff_text_eof(&tr)) {
+ff_subtitles_read_text_chunk(&tr, &buf);
 
 if (buf.len) {
-int64_t pos = avio_tell(s->pb);
+int64_t pos = ff_text_pos(&tr);
 int64_t pts;
 int duration;
 const char *ptr = buf.str;
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index cebd453..bb526cd 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -86,6 +86,25 @@ void ff_text_read(FFTextReader *r, char *buf, size_t size)
 *buf++ = ff_text_r8(r);
 }
 
+int ff_text_eof(FFTextReader *r)
+{
+return r->buf_pos >= r->buf_len && avio_feof(r->pb);
+}
+
+int ff_text_peek_r8(FFTextReader *r)
+{
+int c;
+if (r->buf_pos < r->buf_len)
+return r->buf[r->buf_pos];
+c = ff_text_r8(r);
+if (!avio_feof(r->pb)) {
+r->buf_pos = 0;
+r->buf_len = 1;
+r->buf[0] = c;
+}
+return c;
+}
+
 AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
 const uint8_t *event, int len, int merge)
 {
@@ -303,7 +322,7 @@ static inline int is_eol(char c)
 return c == '\r' || c == '\n';
 }
 
-void ff_subtitles_read_chunk(AVIOContext *pb, AVBPrint *buf)
+void ff_subtitles_read_text_chunk(FFTextReader *tr, AVBPrint *buf)
 {
 char eol_buf[5], last_was_cr = 0;
 int n = 0, i = 0, nb_eol = 0;
@@ -311,7 +330,7 @@ void ff_subtitles_read_chunk(AVIOContext *pb, AVBPrint *buf)
 av_bprint_clear(buf);
 
 for (;;) {
-char c = avio_r8(pb);
+char c = ff_text_r8(tr);
 
 if (!c)
 break;
@@ -344,3 +363,33 @@ void ff_subtitles_read_chunk(AVIOContext *pb, AVBPrint 
*buf)
 n++;
 }
 }
+
+void ff_subtitles_read_chunk(AVIOContext *pb, AVBPrint *buf)
+{
+FFTextReader tr;
+tr.buf_pos = tr.buf_len = 0;
+tr.type = 0;
+tr.pb = pb;
+ff_subtitles_read_text_chunk(&tr, buf);
+}
+
+ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
+{
+size_t cur = 0;
+if (!size)
+return 0;
+while (cur + 1 < size) {
+unsigned char c = ff_text_r8(tr);
+if (!c)
+return ff_text_eof(tr) ? cur : AVERROR_INVALIDDATA;
+if (c == '\r' || c == '\n')
+break;
+buf[cur++] = c;
+buf[cur] = '\0';
+}
+if (ff_text_peek_r8(tr) == '\r')
+ff_text_r8(tr);
+if (ff_text_peek_r8(tr) == '\n')
+ff_text_r8(tr);
+return cur;
+}
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index 38502d6..cf8c408 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -22,6 +22,7 @@
 #define AVFORMAT_SUBTITLES_H
 
 #include 
+#include 
 #include "avformat.h"
 #include "libavutil/bprint.h"
 
@@ -81,6 +82,16 @@ int64_t ff_text_pos(FFTextReader *r);
 int ff_text_r8(FFTextReader *r);
 
 /**
+ * Return non-zero if EO

[FFmpeg-cvslog] avformat/samidec: UTF-16 support

2014-09-05 Thread wm4
ffmpeg | branch: master | wm4  | Tue Sep  2 20:53:08 
2014 +0200| [231a514dd3d246b38d0bf2a400a1759902a6f051] | committer: Clément 
Bœsch

avformat/samidec: UTF-16 support

ff_smil_extract_next_chunk() is still used by RealText.

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

 libavformat/samidec.c   |   17 ++---
 libavformat/subtitles.c |   15 ---
 libavformat/subtitles.h |5 +
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/libavformat/samidec.c b/libavformat/samidec.c
index 1a12eca..4dbf2cf 100644
--- a/libavformat/samidec.c
+++ b/libavformat/samidec.c
@@ -38,11 +38,12 @@ typedef struct {
 
 static int sami_probe(AVProbeData *p)
 {
-const unsigned char *ptr = p->buf;
+char buf[6];
+FFTextReader tr;
+ff_text_init_buf(&tr, p->buf, p->buf_size);
+ff_text_read(&tr, buf, sizeof(buf));
 
-if (AV_RB24(ptr) == 0xEFBBBF)
-ptr += 3;  /* skip UTF-8 BOM */
-return !strncmp(ptr, "", 6) ? AVPROBE_SCORE_MAX : 0;
+return !strncmp(buf, "", 6) ? AVPROBE_SCORE_MAX : 0;
 }
 
 static int sami_read_header(AVFormatContext *s)
@@ -52,6 +53,8 @@ static int sami_read_header(AVFormatContext *s)
 AVBPrint buf, hdr_buf;
 char c = 0;
 int res = 0, got_first_sync_point = 0;
+FFTextReader tr;
+ff_text_init_avio(&tr, s->pb);
 
 if (!st)
 return AVERROR(ENOMEM);
@@ -62,10 +65,10 @@ static int sami_read_header(AVFormatContext *s)
 av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 av_bprint_init(&hdr_buf, 0, AV_BPRINT_SIZE_UNLIMITED);
 
-while (!avio_feof(s->pb)) {
+while (!ff_text_eof(&tr)) {
 AVPacket *sub;
-const int64_t pos = avio_tell(s->pb) - (c != 0);
-int is_sync, n = ff_smil_extract_next_chunk(s->pb, &buf, &c);
+const int64_t pos = ff_text_pos(&tr) - (c != 0);
+int is_sync, n = ff_smil_extract_next_text_chunk(&tr, &buf, &c);
 
 if (n == 0)
 break;
diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index bb526cd..6b59538 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -274,20 +274,20 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q)
 q->nb_subs = q->allocated_size = q->current_sub_idx = 0;
 }
 
-int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c)
+int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c)
 {
 int i = 0;
 char end_chr;
 
 if (!*c) // cached char?
-*c = avio_r8(pb);
+*c = ff_text_r8(tr);
 if (!*c)
 return 0;
 
 end_chr = *c == '<' ? '>' : '<';
 do {
 av_bprint_chars(buf, *c, 1);
-*c = avio_r8(pb);
+*c = ff_text_r8(tr);
 i++;
 } while (*c != end_chr && *c);
 if (end_chr == '>') {
@@ -297,6 +297,15 @@ int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint 
*buf, char *c)
 return i;
 }
 
+int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c)
+{
+FFTextReader tr;
+tr.buf_pos = tr.buf_len = 0;
+tr.type = 0;
+tr.pb = pb;
+return ff_smil_extract_next_text_chunk(&tr, buf, c);
+}
+
 const char *ff_smil_get_attr_ptr(const char *s, const char *attr)
 {
 int in_quotes = 0;
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index cf8c408..67ddf4d 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -147,6 +147,11 @@ void ff_subtitles_queue_clean(FFDemuxSubtitlesQueue *q);
 int ff_smil_extract_next_chunk(AVIOContext *pb, AVBPrint *buf, char *c);
 
 /**
+ * As ff_smil_extract_next_chunk(), but with FFTextReader.
+ */
+int ff_smil_extract_next_text_chunk(FFTextReader *tr, AVBPrint *buf, char *c);
+
+/**
  * SMIL helper to point on the value of an attribute in the given tag.
  *
  * @param sSMIL tag ("<...>")

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


[FFmpeg-cvslog] lavd/v4l2: introduce enqueue_buffer()

2014-09-05 Thread Giorgio Vazzana
ffmpeg | branch: master | Giorgio Vazzana  | Mon Sep  1 
22:20:05 2014 +0200| [d7e088849e33fc339ab14d3d10ada241c50880c1] | committer: 
Michael Niedermayer

lavd/v4l2: introduce enqueue_buffer()

Additionally, make sure a buffer gets enqueued again (even in error paths) after
it has been succesfully dequeued.

Tested-by: Dmitry Volyntsev 
Signed-off-by: Michael Niedermayer 

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

 libavdevice/v4l2.c |   39 +--
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index b473f7e..cf7a92c 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -399,10 +399,23 @@ static void dummy_release_buffer(AVPacket *pkt)
 }
 #endif
 
+static int enqueue_buffer(struct video_data *s, struct v4l2_buffer *buf)
+{
+int res = 0;
+
+if (v4l2_ioctl(s->fd, VIDIOC_QBUF, buf) < 0) {
+res = AVERROR(errno);
+av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", 
av_err2str(res));
+} else {
+avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
+}
+
+return res;
+}
+
 static void mmap_release_buffer(void *opaque, uint8_t *data)
 {
 struct v4l2_buffer buf = { 0 };
-int res;
 struct buff_data *buf_descriptor = opaque;
 struct video_data *s = buf_descriptor->s;
 
@@ -411,13 +424,7 @@ static void mmap_release_buffer(void *opaque, uint8_t 
*data)
 buf.index = buf_descriptor->index;
 av_free(buf_descriptor);
 
-if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) < 0) {
-res = AVERROR(errno);
-av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",
-   av_err2str(res));
-}
-
-avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
+enqueue_buffer(s, &buf);
 }
 
 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
@@ -520,6 +527,7 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket 
*pkt)
 av_log(ctx, AV_LOG_ERROR,
"The v4l2 frame is %d bytes, but %d bytes are expected\n",
buf.bytesused, s->frame_size);
+enqueue_buffer(s, &buf);
 return AVERROR_INVALIDDATA;
 }
 
@@ -529,19 +537,16 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket 
*pkt)
 res = av_new_packet(pkt, buf.bytesused);
 if (res < 0) {
 av_log(ctx, AV_LOG_ERROR, "Error allocating a packet.\n");
-if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) == 0)
-avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
+enqueue_buffer(s, &buf);
 return res;
 }
 memcpy(pkt->data, s->buf_start[buf.index], buf.bytesused);
 
-if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) < 0) {
-res = AVERROR(errno);
-av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", 
av_err2str(res));
+res = enqueue_buffer(s, &buf);
+if (res) {
 av_free_packet(pkt);
 return res;
 }
-avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
 } else {
 struct buff_data *buf_descriptor;
 
@@ -559,8 +564,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
  * allocate a buffer for memcpying into it
  */
 av_log(ctx, AV_LOG_ERROR, "Failed to allocate a buffer 
descriptor\n");
-if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) == 0)
-avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
+enqueue_buffer(s, &buf);
 
 return AVERROR(ENOMEM);
 }
@@ -571,8 +575,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 buf_descriptor, 0);
 if (!pkt->buf) {
 av_log(ctx, AV_LOG_ERROR, "Failed to create a buffer\n");
-if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) == 0)
-avpriv_atomic_int_add_and_fetch(&s->buffers_queued, 1);
+enqueue_buffer(s, &buf);
 av_freep(&buf_descriptor);
 return AVERROR(ENOMEM);
 }

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


[FFmpeg-cvslog] [ffmpeg-web] branch master updated. a1bef61 web/css: Add a license to the LESS file

2014-09-05 Thread gitolite
The branch, master has been updated
   via  a1bef615b0dfb8bc769a97a43ab3b04a302ab178 (commit)
  from  f28c4f5302608b1da130f6a6980ca21d741c178d (commit)


- Log -
commit a1bef615b0dfb8bc769a97a43ab3b04a302ab178
Author: db0company 
AuthorDate: Tue Aug 26 21:37:19 2014 +0200
Commit: Michael Niedermayer 
CommitDate: Sat Sep 6 01:19:35 2014 +0200

web/css: Add a license to the LESS file

Reviewed-by: Timothy Gu 

diff --git a/src/less/style.less b/src/less/style.less
index 0c9ea03..768d959 100644
--- a/src/less/style.less
+++ b/src/less/style.less
@@ -1,5 +1,26 @@
-// Author: db0 (db0comp...@gmail.com, http://db0.fr/)
-
+/*!
+The MIT License (MIT)
+
+Copyright (c) 2014 Barbara Lepage 
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+ */
 // * //
 // COLORS
 

---

Summary of changes:
 src/less/style.less |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)


hooks/post-receive
-- 

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


[FFmpeg-cvslog] avcodec/mjpegdec: fix rounding of chroma_height

2014-09-05 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Sat Sep  6 
03:13:57 2014 +0200| [1654ca7d4e233d4502fcc1ea3ba7ea8dbf025872] | committer: 
Michael Niedermayer

avcodec/mjpegdec: fix rounding of chroma_height

Fixes green line at the bottom
Fixes Ticket3913

Signed-off-by: Michael Niedermayer 

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

 libavcodec/mjpegdec.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index c3a3b86..827c24d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -468,7 +468,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
-s->chroma_height = s->height / 2;
+s->chroma_height = (s->height + 1) / 2;
 break;
 case 0x1100:
 case 0x1300:
@@ -492,7 +492,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 else
 goto unk_pixfmt;
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
-s->chroma_height = s->height / 2;
+s->chroma_height = (s->height + 1) / 2;
 break;
 case 0x2100:
 if (s->bits <= 8) s->avctx->pix_fmt = s->cs_itu601 ? 
AV_PIX_FMT_YUV422P : AV_PIX_FMT_YUVJ422P;
@@ -513,7 +513,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
 s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : 
AVCOL_RANGE_JPEG;
 if (pix_fmt_id == 0x4200) {
 s->upscale_h = 6;
-s->chroma_height = s->height / 2;
+s->chroma_height = (s->height + 1) / 2;
 }
 break;
 case 0x4100:

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