[FFmpeg-cvslog] wma: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Fri Apr 
15 10:46:06 2016 +0200| [f7ec7f546f0021d28da284b024416b916b61c974] | committer: 
Diego Biurrun

wma: Convert to the new bitstream reader

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

 libavcodec/wma.c|  41 +++
 libavcodec/wma.h|   8 +-
 libavcodec/wmadec.c |  64 +--
 libavcodec/wmalosslessdec.c | 188 +++
 libavcodec/wmaprodec.c  | 207 +-
 libavcodec/wmavoice.c   | 262 ++--
 6 files changed, 387 insertions(+), 383 deletions(-)

diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index 4067dff11a..697b41b0aa 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -22,6 +22,7 @@
 #include "libavutil/attributes.h"
 
 #include "avcodec.h"
+#include "bitstream.h"
 #include "internal.h"
 #include "sinewin.h"
 #include "wma.h"
@@ -382,30 +383,30 @@ int ff_wma_end(AVCodecContext *avctx)
 
 /**
  * Decode an uncompressed coefficient.
- * @param gb GetBitContext
+ * @param bc BitstreamContext
  * @return the decoded coefficient
  */
-unsigned int ff_wma_get_large_val(GetBitContext *gb)
+unsigned int ff_wma_get_large_val(BitstreamContext *bc)
 {
 /** consumes up to 34 bits */
 int n_bits = 8;
 /** decode length */
-if (get_bits1(gb)) {
+if (bitstream_read_bit(bc)) {
 n_bits += 8;
-if (get_bits1(gb)) {
+if (bitstream_read_bit(bc)) {
 n_bits += 8;
-if (get_bits1(gb))
+if (bitstream_read_bit(bc))
 n_bits += 7;
 }
 }
-return get_bits_long(gb, n_bits);
+return bitstream_read(bc, n_bits);
 }
 
 /**
  * Decode run level compressed coefficients.
  * @param avctx codec context
- * @param gb bitstream reader context
- * @param vlc vlc table for get_vlc2
+ * @param bc bitstream reader context
+ * @param vlc VLC table for bitstream_read_vlc
  * @param level_table level codes
  * @param run_table run codes
  * @param version 0 for wma1,2 1 for wmapro
@@ -417,7 +418,7 @@ unsigned int ff_wma_get_large_val(GetBitContext *gb)
  * @param coef_nb_bits number of bits for escaped level codes
  * @return 0 on success, -1 otherwise
  */
-int ff_wma_run_level_decode(AVCodecContext *avctx, GetBitContext *gb,
+int ff_wma_run_level_decode(AVCodecContext *avctx, BitstreamContext *bc,
 VLC *vlc, const float *level_table,
 const uint16_t *run_table, int version,
 WMACoef *ptr, int offset, int num_coefs,
@@ -429,11 +430,11 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, 
GetBitContext *gb,
 uint32_t *iptr = (uint32_t *) ptr;
 const unsigned int coef_mask = block_len - 1;
 for (; offset < num_coefs; offset++) {
-code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX);
+code = bitstream_read_vlc(bc, vlc->table, VLCBITS, VLCMAX);
 if (code > 1) {
 /** normal code */
 offset  += run_table[code];
-sign = get_bits1(gb) - 1;
+sign = bitstream_read_bit(bc) - 1;
 iptr[offset & coef_mask] = ilvl[code] ^ sign << 31;
 } else if (code == 1) {
 /** EOB */
@@ -441,26 +442,26 @@ int ff_wma_run_level_decode(AVCodecContext *avctx, 
GetBitContext *gb,
 } else {
 /** escape */
 if (!version) {
-level = get_bits(gb, coef_nb_bits);
+level = bitstream_read(bc, coef_nb_bits);
 /** NOTE: this is rather suboptimal. reading
  *  block_len_bits would be better */
-offset += get_bits(gb, frame_len_bits);
+offset += bitstream_read(bc, frame_len_bits);
 } else {
-level = ff_wma_get_large_val(gb);
+level = ff_wma_get_large_val(bc);
 /** escape decode */
-if (get_bits1(gb)) {
-if (get_bits1(gb)) {
-if (get_bits1(gb)) {
+if (bitstream_read_bit(bc)) {
+if (bitstream_read_bit(bc)) {
+if (bitstream_read_bit(bc)) {
 av_log(avctx, AV_LOG_ERROR,
"broken escape sequence\n");
 return -1;
 } else
-offset += get_bits(gb, frame_len_bits) + 4;
+offset += bitstream_read(bc, frame_len_bits) + 4;
 } else
-offset += get_bits(gb, 2) + 1;
+offset += bitstream_read(bc, 2) + 1;
 }
 }
-sign= get_bits1(gb) - 1;
+sign= 

[FFmpeg-cvslog] Merge commit 'f7ec7f546f0021d28da284b024416b916b61c974'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 19:18:56 
2017 -0300| [0e56321aef0b5c5a0e9f7a34f019b2e478319661] | committer: James Almer

Merge commit 'f7ec7f546f0021d28da284b024416b916b61c974'

* commit 'f7ec7f546f0021d28da284b024416b916b61c974':
  wma: Convert to the new bitstream reader

This commit is a noop, see
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209609.html

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] Merge commit '58d87e0f49bcbbc6f426328f53b657bae7430cd2'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 19:15:54 
2017 -0300| [0c224ce231c8c9a3494b21f9b3155ed18dc3e4cf] | committer: James Almer

Merge commit '58d87e0f49bcbbc6f426328f53b657bae7430cd2'

* commit '58d87e0f49bcbbc6f426328f53b657bae7430cd2':
  aarch64: vp9itxfm: Restructure the idct32 store macros
  arm: vp9itxfm: Avoid .irp when it doesn't save any lines

This commit is a noop, see
31e41350d283febda7e91b92555854ca270e075e
52c7366c83aba4dc92ceedecbee592d629c98e29

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] arm: vp9itxfm: Avoid .irp when it doesn't save any lines

2017-09-26 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Sat Feb  4 
22:16:09 2017 +0200| [3bc5b28d5a191864c54bba60646933a63da31656] | committer: 
Martin Storsjö

arm: vp9itxfm: Avoid .irp when it doesn't save any lines

This makes it more readable.

Signed-off-by: Martin Storsjö 

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

 libavcodec/arm/vp9itxfm_neon.S | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavcodec/arm/vp9itxfm_neon.S b/libavcodec/arm/vp9itxfm_neon.S
index 5abe435be9..49b993ffe3 100644
--- a/libavcodec/arm/vp9itxfm_neon.S
+++ b/libavcodec/arm/vp9itxfm_neon.S
@@ -690,21 +690,21 @@ function \txfm\()16_1d_4x16_pass1_neon
 @ for the first slice of the second pass (where it is the
 @ last 4x4 block).
 add r0,  r0,  #8
-.irp i, 20, 24, 28
-vst1.16 {d\i}, [r0,:64]!
-.endr
+vst1.16 {d20}, [r0,:64]!
+vst1.16 {d24}, [r0,:64]!
+vst1.16 {d28}, [r0,:64]!
 add r0,  r0,  #8
-.irp i, 21, 25, 29
-vst1.16 {d\i}, [r0,:64]!
-.endr
+vst1.16 {d21}, [r0,:64]!
+vst1.16 {d25}, [r0,:64]!
+vst1.16 {d29}, [r0,:64]!
 add r0,  r0,  #8
-.irp i, 22, 26, 30
-vst1.16 {d\i}, [r0,:64]!
-.endr
+vst1.16 {d22}, [r0,:64]!
+vst1.16 {d26}, [r0,:64]!
+vst1.16 {d30}, [r0,:64]!
 add r0,  r0,  #8
-.irp i, 23, 27, 31
-vst1.16 {d\i}, [r0,:64]!
-.endr
+vst1.16 {d23}, [r0,:64]!
+vst1.16 {d27}, [r0,:64]!
+vst1.16 {d31}, [r0,:64]!
 vmovd28, d16
 vmovd29, d17
 vmovd30, d18

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


[FFmpeg-cvslog] aarch64: vp9itxfm: Restructure the idct32 store macros

2017-09-26 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Thu Dec  1 
11:10:19 2016 +0200| [58d87e0f49bcbbc6f426328f53b657bae7430cd2] | committer: 
Martin Storsjö

aarch64: vp9itxfm: Restructure the idct32 store macros

This avoids concatenation, which can't be used if the whole macro
is wrapped within another macro.

This is also arguably more readable.

Signed-off-by: Martin Storsjö 

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

 libavcodec/aarch64/vp9itxfm_neon.S | 80 +++---
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/libavcodec/aarch64/vp9itxfm_neon.S 
b/libavcodec/aarch64/vp9itxfm_neon.S
index 7ce6df0a6d..c14c5f9ded 100644
--- a/libavcodec/aarch64/vp9itxfm_neon.S
+++ b/libavcodec/aarch64/vp9itxfm_neon.S
@@ -935,23 +935,23 @@ function idct32_1d_8x32_pass1_neon
 .macro store_rev a, b
 // There's no rev128 instruction, but we reverse each 64 bit
 // half, and then flip them using an ext with 8 bytes offset.
-rev64   v1.8h, v\b\().8h
-st1 {v\a\().8h},  [x0], #16
-rev64   v0.8h, v\a\().8h
+rev64   v1.8h, \b
+st1 {\a},  [x0], #16
+rev64   v0.8h, \a
 ext v1.16b, v1.16b, v1.16b, #8
-st1 {v\b\().8h},  [x0], #16
+st1 {\b},  [x0], #16
 ext v0.16b, v0.16b, v0.16b, #8
 st1 {v1.8h},  [x0], #16
 st1 {v0.8h},  [x0], #16
 .endm
-store_rev   16, 24
-store_rev   17, 25
-store_rev   18, 26
-store_rev   19, 27
-store_rev   20, 28
-store_rev   21, 29
-store_rev   22, 30
-store_rev   23, 31
+store_rev   v16.8h, v24.8h
+store_rev   v17.8h, v25.8h
+store_rev   v18.8h, v26.8h
+store_rev   v19.8h, v27.8h
+store_rev   v20.8h, v28.8h
+store_rev   v21.8h, v29.8h
+store_rev   v22.8h, v30.8h
+store_rev   v23.8h, v31.8h
 sub x0,  x0,  #512
 .purgem store_rev
 
@@ -977,14 +977,14 @@ function idct32_1d_8x32_pass1_neon
 // subtracted from the output.
 .macro store_rev a, b
 ld1 {v4.8h},  [x0]
-rev64   v1.8h, v\b\().8h
-add v4.8h, v4.8h, v\a\().8h
-rev64   v0.8h, v\a\().8h
+rev64   v1.8h, \b
+add v4.8h, v4.8h, \a
+rev64   v0.8h, \a
 st1 {v4.8h},  [x0], #16
 ext v1.16b, v1.16b, v1.16b, #8
 ld1 {v5.8h},  [x0]
 ext v0.16b, v0.16b, v0.16b, #8
-add v5.8h, v5.8h, v\b\().8h
+add v5.8h, v5.8h, \b
 st1 {v5.8h},  [x0], #16
 ld1 {v6.8h},  [x0]
 sub v6.8h, v6.8h, v1.8h
@@ -994,14 +994,14 @@ function idct32_1d_8x32_pass1_neon
 st1 {v7.8h},  [x0], #16
 .endm
 
-store_rev   31, 23
-store_rev   30, 22
-store_rev   29, 21
-store_rev   28, 20
-store_rev   27, 19
-store_rev   26, 18
-store_rev   25, 17
-store_rev   24, 16
+store_rev   v31.8h, v23.8h
+store_rev   v30.8h, v22.8h
+store_rev   v29.8h, v21.8h
+store_rev   v28.8h, v20.8h
+store_rev   v27.8h, v19.8h
+store_rev   v26.8h, v18.8h
+store_rev   v25.8h, v17.8h
+store_rev   v24.8h, v16.8h
 .purgem store_rev
 ret
 endfunc
@@ -1047,21 +1047,21 @@ function idct32_1d_8x32_pass2_neon
 .if \neg == 0
 ld1 {v4.8h},  [x2], x9
 ld1 {v5.8h},  [x2], x9
-add v4.8h, v4.8h, v\a\().8h
+add v4.8h, v4.8h, \a
 ld1 {v6.8h},  [x2], x9
-add v5.8h, v5.8h, v\b\().8h
+add v5.8h, v5.8h, \b
 ld1 {v7.8h},  [x2], x9
-add v6.8h, v6.8h, v\c\().8h
-add v7.8h, v7.8h, v\d\().8h
+add v6.8h, v6.8h, \c
+add v7.8h, v7.8h, \d
 .else
 ld1 {v4.8h},  [x2], x7
 ld1 {v5.8h},  [x2], x7
-sub v4.8h, v4.8h, v\a\().8h
+sub v4.8h, v4.8h, \a
 ld1 {v6.8h},  [x2], x7
-sub v5.8h, v5.8h, v\b\().8h
+sub v5.8h, v5.8h, \b
 ld1 {v7.8h},  [x2], x7
-sub v6.8h, v6.8h, v\c\().8h
-sub v7.8h, v7.8h, v\d\().8h
+sub v6.8h, v6.8h, \c
+sub v7.8h, v7.8h, \d
 .endif
 ld1 {v0.8b}, 

[FFmpeg-cvslog] Revert "Merge commit '66988320794a107f2a460eaa71dbd9fab8056842'"

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 19:09:57 
2017 -0300| [8f2ab180635255a4cd41c6261187ba070540d605] | committer: James Almer

Revert "Merge commit '66988320794a107f2a460eaa71dbd9fab8056842'"

This reverts commit 740e557d6eac3b579dfed53ed92ae70e2089c77c, reversing
changes made to 932e28b13e9ae29262dfd28419b700e03716e85e.

The commit apparently broke builds with shared libs, and "suggesting"
the use of external libraries that need to be explicitly enable has
dubious usefulness anyway.

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

 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index b154924d09..ba38a73906 100755
--- a/configure
+++ b/configure
@@ -3183,7 +3183,6 @@ deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
-drawtext_filter_suggest="libfontconfig"
 elbg_filter_deps="avcodec"
 eq_filter_deps="gpl"
 fftfilt_filter_deps="avcodec"

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


[FFmpeg-cvslog] asfdec: Use the ASF stream count when iterating

2017-09-26 Thread John Stebbins
ffmpeg | branch: master | John Stebbins  | Thu Jan 12 
13:36:26 2017 -0700| [8e67039c6312ba520945f2c01b7b14df056d5ed1] | committer: 
Luca Barbato

asfdec: Use the ASF stream count when iterating

The AVFormat stream count can be larger due external factors, such as
an id3 tag appended.

Avoid an out of bound read.

Signed-off-by: Luca Barbato 

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

 libavformat/asfdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index 1c50ad627c..d602af8793 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -1485,7 +1485,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 asf->return_subpayload = 0;
 return 0;
 }
-for (i = 0; i < s->nb_streams; i++) {
+for (i = 0; i < asf->nb_streams; i++) {
 ASFPacket *asf_pkt = >asf_st[i]->pkt;
 if (asf_pkt && !asf_pkt->size_left && asf_pkt->data_size) {
 if (asf->asf_st[i]->span > 1 &&

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


[FFmpeg-cvslog] Merge commit '8e67039c6312ba520945f2c01b7b14df056d5ed1'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 18:50:30 
2017 -0300| [e666c2b5ec978b0b10ed69ca34a3ed831bd0242d] | committer: James Almer

Merge commit '8e67039c6312ba520945f2c01b7b14df056d5ed1'

* commit '8e67039c6312ba520945f2c01b7b14df056d5ed1':
  asfdec: Use the ASF stream count when iterating

Merged-by: James Almer 

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

 libavformat/asfdec_o.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index f7000b0413..7450ea0f74 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1485,7 +1485,7 @@ static int asf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 asf->return_subpayload = 0;
 return 0;
 }
-for (i = 0; i < s->nb_streams; i++) {
+for (i = 0; i < asf->nb_streams; i++) {
 ASFPacket *asf_pkt = >asf_st[i]->pkt;
 if (asf_pkt && !asf_pkt->size_left && asf_pkt->data_size) {
 if (asf->asf_st[i]->span > 1 &&


==

diff --cc libavformat/asfdec_o.c
index f7000b0413,00..7450ea0f74
mode 100644,00..100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@@ -1,1792 -1,0 +1,1792 @@@
 +/*
 + * Microsoft Advanced Streaming Format demuxer
 + * Copyright (c) 2014 Alexandra Hájková
 + *
 + * 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/attributes.h"
 +#include "libavutil/avstring.h"
 +#include "libavutil/bswap.h"
 +#include "libavutil/common.h"
 +#include "libavutil/dict.h"
 +#include "libavutil/internal.h"
 +#include "libavutil/mathematics.h"
 +#include "libavutil/opt.h"
 +#include "libavutil/time_internal.h"
 +
 +#include "avformat.h"
 +#include "avio_internal.h"
 +#include "avlanguage.h"
 +#include "id3v2.h"
 +#include "internal.h"
 +#include "riff.h"
 +#include "asf.h"
 +#include "asfcrypt.h"
 +
 +#define ASF_BOOL  0x2
 +#define ASF_WORD  0x5
 +#define ASF_GUID  0x6
 +#define ASF_DWORD 0x3
 +#define ASF_QWORD 0x4
 +#define ASF_UNICODE   0x0
 +#define ASF_FLAG_BROADCAST0x1
 +#define ASF_BYTE_ARRAY0x1
 +#define ASF_TYPE_AUDIO0x2
 +#define ASF_TYPE_VIDEO0x1
 +#define ASF_STREAM_NUM0x7F
 +#define ASF_MAX_STREAMS   128
 +#define BMP_HEADER_SIZE   40
 +#define ASF_NUM_OF_PAYLOADS   0x3F
 +#define ASF_ERROR_CORRECTION_LENGTH_TYPE  0x60
 +#define ASF_PACKET_ERROR_CORRECTION_DATA_SIZE 0x2
 +
 +typedef struct GUIDParseTable {
 +const char *name;
 +ff_asf_guid guid;
 +int (*read_object)(AVFormatContext *, const struct GUIDParseTable *);
 +int is_subobject;
 +} GUIDParseTable;
 +
 +typedef struct ASFPacket {
 +AVPacket avpkt;
 +int64_t dts;
 +uint32_t frame_num; // ASF payloads with the same number are parts of the 
same frame
 +int flags;
 +int data_size;
 +int duration;
 +int size_left;
 +uint8_t stream_index;
 +} ASFPacket;
 +
 +typedef struct ASFStream {
 +uint8_t stream_index; // from packet header
 +int index;  // stream index in AVFormatContext, set in 
asf_read_stream_properties
 +int type;
 +int indexed; // added index entries from the Simple Index Object or not
 +int8_t span;   // for deinterleaving
 +uint16_t virtual_pkt_len;
 +uint16_t virtual_chunk_len;
 +int16_t lang_idx;
 +ASFPacket pkt;
 +} ASFStream;
 +
 +typedef struct ASFStreamData{
 +char langs[32];
 +AVDictionary *asf_met; // for storing per-stream metadata
 +AVRational aspect_ratio;
 +} ASFStreamData;
 +
 +typedef struct ASFContext {
 +int data_reached;
 +int is_simple_index; // is simple index present or not 1/0
 +int is_header;
 +
 +uint64_t preroll;
 +uint64_t nb_packets; // ASF packets
 +uint32_t packet_size;
 +int64_t send_time;
 +int 

[FFmpeg-cvslog] Merge commit '740b0bf03b4bb8b0a0e964750817ac0363a33c55'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 18:38:14 
2017 -0300| [62f1c9f106710b976efcdab3f08fc6b16e8b6ec8] | committer: James Almer

Merge commit '740b0bf03b4bb8b0a0e964750817ac0363a33c55'

* commit '740b0bf03b4bb8b0a0e964750817ac0363a33c55':
  build: Ignore generated .version files

This commit is a noop, see fbc304239fe6162d8da4ee7a519483f5ef79e7c2

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] Merge commit '7abdd026df6a9a52d07d8174505b33cc89db7bf6'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 18:48:06 
2017 -0300| [0c005fa86f01df75be8c9cacad7530978af80900] | committer: James Almer

Merge commit '7abdd026df6a9a52d07d8174505b33cc89db7bf6'

* commit '7abdd026df6a9a52d07d8174505b33cc89db7bf6':
  asm: Consistently uppercase SECTION markers

Merged-by: James Almer 

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

 libavcodec/x86/dirac_dwt.asm| 2 +-
 libavcodec/x86/diracdsp.asm | 2 +-
 libavcodec/x86/dnxhdenc.asm | 2 +-
 libavcodec/x86/huffyuvencdsp.asm| 2 +-
 libavcodec/x86/lossless_videoencdsp.asm | 2 +-
 libavcodec/x86/vc1dsp_loopfilter.asm| 2 +-
 libavcodec/x86/vc1dsp_mc.asm| 2 +-
 libavutil/x86/x86inc.asm| 4 ++--
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/x86/dirac_dwt.asm b/libavcodec/x86/dirac_dwt.asm
index 89806899a2..22a5c2 100644
--- a/libavcodec/x86/dirac_dwt.asm
+++ b/libavcodec/x86/dirac_dwt.asm
@@ -29,7 +29,7 @@ cextern pw_2
 cextern pw_8
 cextern pw_16
 
-section .text
+SECTION .text
 
 ; %1 -= (%2 + %3 + 2)>>2 %4 is pw_2
 %macro COMPOSE_53iL0 4
diff --git a/libavcodec/x86/diracdsp.asm b/libavcodec/x86/diracdsp.asm
index 6b3f780e41..cc8a26fca5 100644
--- a/libavcodec/x86/diracdsp.asm
+++ b/libavcodec/x86/diracdsp.asm
@@ -30,7 +30,7 @@ cextern pw_16
 cextern pw_32
 cextern pb_80
 
-section .text
+SECTION .text
 
 %macro UNPACK_ADD 6
 mov%5   %1, %3
diff --git a/libavcodec/x86/dnxhdenc.asm b/libavcodec/x86/dnxhdenc.asm
index 9dd6d51ee6..b4f759552e 100644
--- a/libavcodec/x86/dnxhdenc.asm
+++ b/libavcodec/x86/dnxhdenc.asm
@@ -22,7 +22,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
-section .text
+SECTION .text
 
 ; void get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels,
 ;  ptrdiff_t line_size)
diff --git a/libavcodec/x86/huffyuvencdsp.asm b/libavcodec/x86/huffyuvencdsp.asm
index 1228aa8355..eeef81ab8e 100644
--- a/libavcodec/x86/huffyuvencdsp.asm
+++ b/libavcodec/x86/huffyuvencdsp.asm
@@ -25,7 +25,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
-section .text
+SECTION .text
 
 ; void ff_diff_int16(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
 ;unsigned mask, int w);
diff --git a/libavcodec/x86/lossless_videoencdsp.asm 
b/libavcodec/x86/lossless_videoencdsp.asm
index 63fd72174a..3cb7dce07f 100644
--- a/libavcodec/x86/lossless_videoencdsp.asm
+++ b/libavcodec/x86/lossless_videoencdsp.asm
@@ -25,7 +25,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
-section .text
+SECTION .text
 
 ; void ff_diff_bytes(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
 ;intptr_t w);
diff --git a/libavcodec/x86/vc1dsp_loopfilter.asm 
b/libavcodec/x86/vc1dsp_loopfilter.asm
index 1838f6f235..fd33bd13dc 100644
--- a/libavcodec/x86/vc1dsp_loopfilter.asm
+++ b/libavcodec/x86/vc1dsp_loopfilter.asm
@@ -24,7 +24,7 @@
 cextern pw_4
 cextern pw_5
 
-section .text
+SECTION .text
 
 ; dst_low, dst_high (src), zero
 ; zero-extends one vector from 8 to 16 bits
diff --git a/libavcodec/x86/vc1dsp_mc.asm b/libavcodec/x86/vc1dsp_mc.asm
index 2850ca861d..0e6d87dd8b 100644
--- a/libavcodec/x86/vc1dsp_mc.asm
+++ b/libavcodec/x86/vc1dsp_mc.asm
@@ -24,7 +24,7 @@
 cextern pw_9
 cextern pw_128
 
-section .text
+SECTION .text
 
 %if HAVE_MMX_INLINE
 
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index c4ec29bd9d..6a054a3e09 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -87,9 +87,9 @@
 ; keep supporting OS/2.
 %macro SECTION_RODATA 0-1 16
 %ifidn __OUTPUT_FORMAT__,aout
-section .text
+SECTION .text
 %elifidn __OUTPUT_FORMAT__,coff
-section .text
+SECTION .text
 %else
 SECTION .rodata align=%1
 %endif


==

diff --cc libavcodec/x86/dirac_dwt.asm
index 89806899a2,00..22a5c2
mode 100644,00..100644
--- a/libavcodec/x86/dirac_dwt.asm
+++ b/libavcodec/x86/dirac_dwt.asm
@@@ -1,307 -1,0 +1,307 @@@
 
+;**
 +;* x86 optimized discrete wavelet trasnform
 +;* Copyright (c) 2010 David Conrad
 +;*
 +;* 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 

[FFmpeg-cvslog] asm: Consistently uppercase SECTION markers

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Wed Feb  1 
13:27:30 2017 +0100| [7abdd026df6a9a52d07d8174505b33cc89db7bf6] | committer: 
Diego Biurrun

asm: Consistently uppercase SECTION markers

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

 libavcodec/x86/dnxhdenc.asm  | 2 +-
 libavcodec/x86/hevc_idct.asm | 2 +-
 libavcodec/x86/vc1dsp.asm| 2 +-
 libavutil/x86/x86inc.asm | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/x86/dnxhdenc.asm b/libavcodec/x86/dnxhdenc.asm
index d39b07b9f4..091f322358 100644
--- a/libavcodec/x86/dnxhdenc.asm
+++ b/libavcodec/x86/dnxhdenc.asm
@@ -22,7 +22,7 @@
 
 %include "libavutil/x86/x86util.asm"
 
-section .text
+SECTION .text
 
 ; void get_pixels_8x4_sym_sse2(int16_t *block, const uint8_t *pixels,
 ;  ptrdiff_t line_size)
diff --git a/libavcodec/x86/hevc_idct.asm b/libavcodec/x86/hevc_idct.asm
index f397cc1097..a36fa53c2d 100644
--- a/libavcodec/x86/hevc_idct.asm
+++ b/libavcodec/x86/hevc_idct.asm
@@ -234,7 +234,7 @@ times 4 dw 78, -82
 times 4 dw 85, -88
 times 4 dw 90, -90
 
-section .text
+SECTION .text
 
 ; void ff_hevc_idctHxW_dc_{8,10}_(int16_t *coeffs)
 ; %1 = HxW
diff --git a/libavcodec/x86/vc1dsp.asm b/libavcodec/x86/vc1dsp.asm
index adf08d7d84..b9a770ee08 100644
--- a/libavcodec/x86/vc1dsp.asm
+++ b/libavcodec/x86/vc1dsp.asm
@@ -24,7 +24,7 @@
 cextern pw_4
 cextern pw_5
 
-section .text
+SECTION .text
 
 ; dst_low, dst_high (src), zero
 ; zero-extends one vector from 8 to 16 bits
diff --git a/libavutil/x86/x86inc.asm b/libavutil/x86/x86inc.asm
index 7941af304a..e04dbfedf3 100644
--- a/libavutil/x86/x86inc.asm
+++ b/libavutil/x86/x86inc.asm
@@ -87,7 +87,7 @@
 ; keep supporting OS/2.
 %macro SECTION_RODATA 0-1 16
 %ifidn __OUTPUT_FORMAT__,aout
-section .text
+SECTION .text
 %else
 SECTION .rodata align=%1
 %endif

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


[FFmpeg-cvslog] build: Ignore generated .version files

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Tue Jan 31 
15:46:50 2017 +0100| [740b0bf03b4bb8b0a0e964750817ac0363a33c55] | committer: 
Diego Biurrun

build: Ignore generated .version files

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

 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index f6d97b05f5..1a08fd15c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
 *.so.*
 *.swp
 *.ver
+*.version
 /.config
 /.version
 /avconv

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


[FFmpeg-cvslog] Merge commit '15a92e0c402c830b607f905d6bf203b6cfb4fa8c'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 18:34:25 
2017 -0300| [4ea63d2cdd04600ed2662e39d371287ba2dadc06] | committer: James Almer

Merge commit '15a92e0c402c830b607f905d6bf203b6cfb4fa8c'

* commit '15a92e0c402c830b607f905d6bf203b6cfb4fa8c':
  rtmp: Correctly handle the Window Acknowledgement Size packets

Merged-by: James Almer 

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

 libavformat/rtmpproto.c | 47 +--
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 5cd6c5a924..7320b4f022 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -93,7 +93,7 @@ typedef struct RTMPContext {
 int   flv_off;///< number of bytes read from 
current buffer
 int   flv_nb_packets; ///< number of flv packets 
published
 RTMPPacketout_pkt;///< rtmp packet, created from 
flv a/v or metadata (for output)
-uint32_t  client_report_size; ///< number of bytes after which 
client should report to server
+uint32_t  receive_report_size;///< number of bytes after which 
we should report the number of received bytes to the peer
 uint64_t  bytes_read; ///< number of bytes read from 
server
 uint64_t  last_bytes_read;///< number of bytes read last 
reported to server
 uint32_t  last_timestamp; ///< last timestamp received in 
a packet
@@ -114,7 +114,7 @@ typedef struct RTMPContext {
 char  swfverification[42];///< hash of the SWF verification
 char* pageurl;///< url of the web page
 char* subscribe;  ///< name of live stream to 
subscribe
-int   server_bw;  ///< server bandwidth
+int   max_sent_unacked;   ///< max unacked sent bytes
 int   client_buffer_time; ///< client buffer time in ms
 int   flush_interval; ///< number of packets flushed 
in the same request (RTMPT only)
 int   encrypted;  ///< use an encrypted connection 
(RTMPE only)
@@ -488,7 +488,9 @@ static int read_connect(URLContext *s, RTMPContext *rt)
  RTMP_PT_WINDOW_ACK_SIZE, 0, 4)) < 0)
 return ret;
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+// Inform the peer about how often we want acknowledgements about what
+// we send. (We don't check for the acknowledgements currently.)
+bytestream_put_be32(, rt->max_sent_unacked);
 pkt.size = p - pkt.data;
 ret = ff_rtmp_packet_write(rt->stream, , rt->out_chunk_size,
>prev_pkt[1], >nb_prev_pkt[1]);
@@ -500,7 +502,9 @@ static int read_connect(URLContext *s, RTMPContext *rt)
  RTMP_PT_SET_PEER_BW, 0, 5)) < 0)
 return ret;
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+// Tell the peer to only send this many bytes unless it gets 
acknowledgements.
+// This could be any arbitrary value we want here.
+bytestream_put_be32(, rt->max_sent_unacked);
 bytestream_put_byte(, 2); // dynamic
 pkt.size = p - pkt.data;
 ret = ff_rtmp_packet_write(rt->stream, , rt->out_chunk_size,
@@ -920,7 +924,7 @@ static int gen_window_ack_size(URLContext *s, RTMPContext 
*rt)
 return ret;
 
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+bytestream_put_be32(, rt->max_sent_unacked);
 
 return rtmp_send_packet(rt, , 0);
 }
@@ -1591,15 +1595,18 @@ static int handle_set_peer_bw(URLContext *s, RTMPPacket 
*pkt)
 return AVERROR_INVALIDDATA;
 }
 
-rt->client_report_size = AV_RB32(pkt->data);
-if (rt->client_report_size <= 0) {
-av_log(s, AV_LOG_ERROR, "Incorrect peer bandwidth %d\n",
-rt->client_report_size);
+// We currently don't check how much the peer has acknowledged of
+// what we have sent. To do that properly, we should call
+// gen_window_ack_size here, to tell the peer that we want an
+// acknowledgement with (at least) that interval.
+rt->max_sent_unacked = AV_RB32(pkt->data);
+if (rt->max_sent_unacked <= 0) {
+av_log(s, AV_LOG_ERROR, "Incorrect set peer bandwidth %d\n",
+   rt->max_sent_unacked);
 return AVERROR_INVALIDDATA;
 
 }
-av_log(s, AV_LOG_DEBUG, "Peer bandwidth = %d\n", rt->client_report_size);
-rt->client_report_size >>= 1;
+av_log(s, AV_LOG_DEBUG, "Max sent, unacked = %d\n", rt->max_sent_unacked);
 
 return 0;
 }
@@ -1615,13 +1622,17 @@ static int handle_window_ack_size(URLContext *s, 
RTMPPacket *pkt)
 return AVERROR_INVALIDDATA;
 }
 
-rt->server_bw = AV_RB32(pkt->data);
-if 

[FFmpeg-cvslog] rtmp: Correctly handle the Window Acknowledgement Size packets

2017-09-26 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Jan 31 
16:15:56 2017 +0200| [15a92e0c402c830b607f905d6bf203b6cfb4fa8c] | committer: 
Martin Storsjö

rtmp: Correctly handle the Window Acknowledgement Size packets

This swaps which field is set when the Window Acknowledgement Size
and Set Peer BW packets are received, renames the fields in
order to clarify their role further and adds verbose comments
explaining their respective roles and how well the code currently
does what it is supposed to.

The Set Peer BW packet tells the receiver of the packet (which
can be either client or server) that it should not send more data
if it already has sent more data than the specified number of bytes,
without receiving acknowledgement for them. Actually checking this
limit is currently not implemented.

In order to be able to check that properly, one can send the
Window Acknowledgement Size packet, which tells the receiver of the
packet that it needs to send Acknowledgement packets
(RTMP_PT_BYTES_READ) at least after receiving a given number of bytes
since the last Acknowledgement.

Therefore, when we receive a Window Acknowledgement Size packet,
this sets the maximum number of bytes we can receive without sending
an Acknowledgement; therefore when handling this packet we should set
the receive_report_size field (previously client_report_size).

Signed-off-by: Martin Storsjö 

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

 libavformat/rtmpproto.c | 47 +--
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index d0a36139cc..8e036961a6 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -93,7 +93,7 @@ typedef struct RTMPContext {
 int   flv_off;///< number of bytes read from 
current buffer
 int   flv_nb_packets; ///< number of flv packets 
published
 RTMPPacketout_pkt;///< rtmp packet, created from 
flv a/v or metadata (for output)
-uint32_t  client_report_size; ///< number of bytes after which 
client should report to server
+uint32_t  receive_report_size;///< number of bytes after which 
we should report the number of received bytes to the peer
 uint32_t  bytes_read; ///< number of bytes read from 
server
 uint32_t  last_bytes_read;///< number of bytes read last 
reported to server
 uint32_t  last_timestamp; ///< last timestamp received in 
a packet
@@ -114,7 +114,7 @@ typedef struct RTMPContext {
 char  swfverification[42];///< hash of the SWF verification
 char* pageurl;///< url of the web page
 char* subscribe;  ///< name of live stream to 
subscribe
-int   server_bw;  ///< server bandwidth
+int   max_sent_unacked;   ///< max unacked sent bytes
 int   client_buffer_time; ///< client buffer time in ms
 int   flush_interval; ///< number of packets flushed 
in the same request (RTMPT only)
 int   encrypted;  ///< use an encrypted connection 
(RTMPE only)
@@ -456,7 +456,9 @@ static int read_connect(URLContext *s, RTMPContext *rt)
  RTMP_PT_WINDOW_ACK_SIZE, 0, 4)) < 0)
 return ret;
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+// Inform the peer about how often we want acknowledgements about what
+// we send. (We don't check for the acknowledgements currently.)
+bytestream_put_be32(, rt->max_sent_unacked);
 pkt.size = p - pkt.data;
 ret = ff_rtmp_packet_write(rt->stream, , rt->out_chunk_size,
>prev_pkt[1], >nb_prev_pkt[1]);
@@ -468,7 +470,9 @@ static int read_connect(URLContext *s, RTMPContext *rt)
  RTMP_PT_SET_PEER_BW, 0, 5)) < 0)
 return ret;
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+// Tell the peer to only send this many bytes unless it gets 
acknowledgements.
+// This could be any arbitrary value we want here.
+bytestream_put_be32(, rt->max_sent_unacked);
 bytestream_put_byte(, 2); // dynamic
 pkt.size = p - pkt.data;
 ret = ff_rtmp_packet_write(rt->stream, , rt->out_chunk_size,
@@ -888,7 +892,7 @@ static int gen_window_ack_size(URLContext *s, RTMPContext 
*rt)
 return ret;
 
 p = pkt.data;
-bytestream_put_be32(, rt->server_bw);
+bytestream_put_be32(, rt->max_sent_unacked);
 
 return rtmp_send_packet(rt, , 0);
 }
@@ -1558,15 +1562,18 @@ static int handle_set_peer_bw(URLContext *s, RTMPPacket 
*pkt)
 return AVERROR_INVALIDDATA;
 }
 
-rt->client_report_size = AV_RB32(pkt->data);
-if 

[FFmpeg-cvslog] Merge commit 'a1a143adb0fd11c474221431417cff25db7d920f'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 18:08:25 
2017 -0300| [f858a6e27817930817303b8ffb367087d82f70be] | committer: James Almer

Merge commit 'a1a143adb0fd11c474221431417cff25db7d920f'

* commit 'a1a143adb0fd11c474221431417cff25db7d920f':
  rtmp: Rename packet types to closer match the spec

Merged-by: James Almer 

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

 libavformat/rtmppkt.c   | 14 -
 libavformat/rtmppkt.h   |  6 ++--
 libavformat/rtmpproto.c | 78 -
 3 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 3ae605d280..1eeae17337 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -574,9 +574,9 @@ static const char* rtmp_packet_type(int type)
 switch (type) {
 case RTMP_PT_CHUNK_SIZE: return "chunk size";
 case RTMP_PT_BYTES_READ: return "bytes read";
-case RTMP_PT_PING:   return "ping";
-case RTMP_PT_SERVER_BW:  return "server bandwidth";
-case RTMP_PT_CLIENT_BW:  return "client bandwidth";
+case RTMP_PT_USER_CONTROL:   return "user control";
+case RTMP_PT_WINDOW_ACK_SIZE: return "window acknowledgement size";
+case RTMP_PT_SET_PEER_BW:return "set peer bandwidth";
 case RTMP_PT_AUDIO:  return "audio packet";
 case RTMP_PT_VIDEO:  return "video packet";
 case RTMP_PT_FLEX_STREAM:return "Flex shared stream";
@@ -674,10 +674,10 @@ void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p)
 break;
 src += sz;
 }
-} else if (p->type == RTMP_PT_SERVER_BW){
-av_log(ctx, AV_LOG_DEBUG, "Server BW = %d\n", AV_RB32(p->data));
-} else if (p->type == RTMP_PT_CLIENT_BW){
-av_log(ctx, AV_LOG_DEBUG, "Client BW = %d\n", AV_RB32(p->data));
+} else if (p->type == RTMP_PT_WINDOW_ACK_SIZE) {
+av_log(ctx, AV_LOG_DEBUG, "Window acknowledgement size = %d\n", 
AV_RB32(p->data));
+} else if (p->type == RTMP_PT_SET_PEER_BW) {
+av_log(ctx, AV_LOG_DEBUG, "Set Peer BW = %d\n", AV_RB32(p->data));
 } else if (p->type != RTMP_PT_AUDIO && p->type != RTMP_PT_VIDEO && p->type 
!= RTMP_PT_METADATA) {
 int i;
 for (i = 0; i < p->size; i++)
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index a082b45f98..eb68f1d3e1 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -47,9 +47,9 @@ enum RTMPChannel {
 typedef enum RTMPPacketType {
 RTMP_PT_CHUNK_SIZE   =  1,  ///< chunk size change
 RTMP_PT_BYTES_READ   =  3,  ///< number of bytes read
-RTMP_PT_PING,   ///< ping
-RTMP_PT_SERVER_BW,  ///< server bandwidth
-RTMP_PT_CLIENT_BW,  ///< client bandwidth
+RTMP_PT_USER_CONTROL,   ///< user control
+RTMP_PT_WINDOW_ACK_SIZE,///< window acknowledgement size
+RTMP_PT_SET_PEER_BW,///< peer bandwidth
 RTMP_PT_AUDIO=  8,  ///< audio packet
 RTMP_PT_VIDEO,  ///< video packet
 RTMP_PT_FLEX_STREAM  = 15,  ///< Flex shared stream
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 7dd9cdddaf..5cd6c5a924 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -156,8 +156,8 @@ static const uint8_t rtmp_server_key[] = {
 };
 
 static int handle_chunk_size(URLContext *s, RTMPPacket *pkt);
-static int handle_server_bw(URLContext *s, RTMPPacket *pkt);
-static int handle_client_bw(URLContext *s, RTMPPacket *pkt);
+static int handle_window_ack_size(URLContext *s, RTMPPacket *pkt);
+static int handle_set_peer_bw(URLContext *s, RTMPPacket *pkt);
 
 static int add_tracked_method(RTMPContext *rt, const char *name, int id)
 {
@@ -438,13 +438,13 @@ static int read_connect(URLContext *s, RTMPContext *rt)
 return AVERROR_UNKNOWN;
 } else if (pkt.type == RTMP_PT_BYTES_READ) {
 av_log(s, AV_LOG_TRACE, "received acknowledgement\n");
-} else if (pkt.type == RTMP_PT_SERVER_BW) {
-if ((ret = handle_server_bw(s, )) < 0) {
+} else if (pkt.type == RTMP_PT_WINDOW_ACK_SIZE) {
+if ((ret = handle_window_ack_size(s, )) < 0) {
 ff_rtmp_packet_destroy();
 return ret;
 }
-} else if (pkt.type == RTMP_PT_CLIENT_BW) {
-if ((ret = handle_client_bw(s, )) < 0) {
+} else if (pkt.type == RTMP_PT_SET_PEER_BW) {
+if ((ret = handle_set_peer_bw(s, )) < 0) {
 ff_rtmp_packet_destroy();
 return ret;
 }
@@ -485,7 +485,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
 
 // Send Window Acknowledgement Size (as defined in specification)
 if ((ret = ff_rtmp_packet_create(, RTMP_NETWORK_CHANNEL,
- RTMP_PT_SERVER_BW, 0, 4)) < 0)
+ 

[FFmpeg-cvslog] rtmp: Rename packet types to closer match the spec

2017-09-26 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö  | Tue Jan 31 
15:47:00 2017 +0200| [a1a143adb0fd11c474221431417cff25db7d920f] | committer: 
Martin Storsjö

rtmp: Rename packet types to closer match the spec

Also rename comments and log messages accordingly,
and add clarifying comments for some hardcoded values.

The previous names were taken from older, reverse engineered
references.

These names match the official public rtmp specification, and
matches the names used by wirecast in annotating captured
streams. These names also avoid hardcoding the roles of server
and client, since the handling of them is irrelevant of whether
we act as server or client.

The RTMP_PT_PING type maps to RTMP_PT_USER_CONTROL.

The SERVER_BW and CLIENT_BW types are a bit more intertwined;
RTMP_PT_SERVER_BW maps to RTMP_PT_WINDOW_ACK_SIZE and
RTMP_PT_CLIENT_BW maps to RTMP_PT_SET_PEER_BW.

Signed-off-by: Martin Storsjö 

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

 libavformat/rtmppkt.c   | 14 +--
 libavformat/rtmppkt.h   |  6 ++---
 libavformat/rtmpproto.c | 66 -
 3 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 1cb3078679..0bb06143b5 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -527,9 +527,9 @@ static const char* rtmp_packet_type(int type)
 switch (type) {
 case RTMP_PT_CHUNK_SIZE: return "chunk size";
 case RTMP_PT_BYTES_READ: return "bytes read";
-case RTMP_PT_PING:   return "ping";
-case RTMP_PT_SERVER_BW:  return "server bandwidth";
-case RTMP_PT_CLIENT_BW:  return "client bandwidth";
+case RTMP_PT_USER_CONTROL:   return "user control";
+case RTMP_PT_WINDOW_ACK_SIZE: return "window acknowledgement size";
+case RTMP_PT_SET_PEER_BW:return "set peer bandwidth";
 case RTMP_PT_AUDIO:  return "audio packet";
 case RTMP_PT_VIDEO:  return "video packet";
 case RTMP_PT_FLEX_STREAM:return "Flex shared stream";
@@ -627,10 +627,10 @@ void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p)
 break;
 src += sz;
 }
-} else if (p->type == RTMP_PT_SERVER_BW){
-av_log(ctx, AV_LOG_DEBUG, "Server BW = %d\n", AV_RB32(p->data));
-} else if (p->type == RTMP_PT_CLIENT_BW){
-av_log(ctx, AV_LOG_DEBUG, "Client BW = %d\n", AV_RB32(p->data));
+} else if (p->type == RTMP_PT_WINDOW_ACK_SIZE) {
+av_log(ctx, AV_LOG_DEBUG, "Window acknowledgement size = %d\n", 
AV_RB32(p->data));
+} else if (p->type == RTMP_PT_SET_PEER_BW) {
+av_log(ctx, AV_LOG_DEBUG, "Set Peer BW = %d\n", AV_RB32(p->data));
 } else if (p->type != RTMP_PT_AUDIO && p->type != RTMP_PT_VIDEO && p->type 
!= RTMP_PT_METADATA) {
 int i;
 for (i = 0; i < p->size; i++)
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index 149c153cad..eccd299b24 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -47,9 +47,9 @@ enum RTMPChannel {
 typedef enum RTMPPacketType {
 RTMP_PT_CHUNK_SIZE   =  1,  ///< chunk size change
 RTMP_PT_BYTES_READ   =  3,  ///< number of bytes read
-RTMP_PT_PING,   ///< ping
-RTMP_PT_SERVER_BW,  ///< server bandwidth
-RTMP_PT_CLIENT_BW,  ///< client bandwidth
+RTMP_PT_USER_CONTROL,   ///< user control
+RTMP_PT_WINDOW_ACK_SIZE,///< window acknowledgement size
+RTMP_PT_SET_PEER_BW,///< peer bandwidth
 RTMP_PT_AUDIO=  8,  ///< audio packet
 RTMP_PT_VIDEO,  ///< video packet
 RTMP_PT_FLEX_STREAM  = 15,  ///< Flex shared stream
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 49a40dd66a..d0a36139cc 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -453,7 +453,7 @@ static int read_connect(URLContext *s, RTMPContext *rt)
 
 // Send Window Acknowledgement Size (as defined in specification)
 if ((ret = ff_rtmp_packet_create(, RTMP_NETWORK_CHANNEL,
- RTMP_PT_SERVER_BW, 0, 4)) < 0)
+ RTMP_PT_WINDOW_ACK_SIZE, 0, 4)) < 0)
 return ret;
 p = pkt.data;
 bytestream_put_be32(, rt->server_bw);
@@ -463,9 +463,9 @@ static int read_connect(URLContext *s, RTMPContext *rt)
 ff_rtmp_packet_destroy();
 if (ret < 0)
 return ret;
-// Send Peer Bandwidth
+// Set Peer Bandwidth
 if ((ret = ff_rtmp_packet_create(, RTMP_NETWORK_CHANNEL,
- RTMP_PT_CLIENT_BW, 0, 5)) < 0)
+ RTMP_PT_SET_PEER_BW, 0, 5)) < 0)
 return ret;
 p = pkt.data;
 bytestream_put_be32(, rt->server_bw);
@@ -477,14 +477,14 @@ static int read_connect(URLContext *s, RTMPContext *rt)
 if (ret < 0)
 return ret;
 
-// Ping request
+   

[FFmpeg-cvslog] configure: Add require_cpp_condition() convenience function

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Sun Jan 22 
16:15:38 2017 +0100| [bcaedef1189a3531aa4dfb020627eb0133ffa89c] | committer: 
Diego Biurrun

configure: Add require_cpp_condition() convenience function

Simplifies checking for conditions in external library headers and
aborting if said conditions are not met.

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

 configure | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 30f053954b..555dc8861e 100755
--- a/configure
+++ b/configure
@@ -1124,6 +1124,14 @@ require_header(){
 check_header "$header" "$@" || die "ERROR: $header not found"
 }
 
+require_cpp_condition(){
+log require "$@"
+header="$1"
+condition="$2"
+shift 2
+check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition 
not satisfied"
+}
+
 require_pkg_config(){
 log require_pkg_config "$@"
 pkg_version="$1"
@@ -4705,13 +4713,11 @@ enabled libvpx&& require_pkg_config "vpx >= 
1.3.0" vpx/vpx_codec.h v
 enabled libwavpack&& require libwavpack wavpack/wavpack.h 
WavpackOpenFileOutput  -lwavpack
 enabled libwebp   && require_pkg_config libwebp webp/encode.h 
WebPGetEncoderVersion
 enabled libx264   && require_pkg_config x264 "stdint.h x264.h" 
x264_encoder_encode &&
- { check_cpp_condition x264.h "X264_BUILD >= 118" 
||
-   die "ERROR: libx264 version must be >= 0.118."; 
} &&
+ require_cpp_condition x264.h "X264_BUILD >= 118" 
&&
  { check_cpp_condition x264.h "X264_MPEG2" &&
enable libx262; }
 enabled libx265   && require_pkg_config x265 x265.h x265_api_get &&
- { check_cpp_condition x265.h "X265_BUILD >= 57" ||
-   die "ERROR: libx265 version must be >= 57."; }
+ require_cpp_condition x265.h "X265_BUILD >= 57"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode -lxavs
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled mmal  && { check_lib mmal interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
@@ -4737,8 +4743,7 @@ enabled gnutls&& check_lib gmp gmp.h 
mpz_export -lgmp
 
 if enabled nvenc; then
 require_header nvEncodeAPI.h
-check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
-die "ERROR: NVENC API version 5 or older is not supported"
+require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
 fi
 
 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then

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


[FFmpeg-cvslog] Merge commit 'bcaedef1189a3531aa4dfb020627eb0133ffa89c'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:42:19 
2017 -0300| [c83c164f05cba9e7cdb11c9dcd4fb87b90eb6c6d] | committer: James Almer

Merge commit 'bcaedef1189a3531aa4dfb020627eb0133ffa89c'

* commit 'bcaedef1189a3531aa4dfb020627eb0133ffa89c':
  configure: Add require_cpp_condition() convenience function

Merged-by: James Almer 

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

 configure | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 035e16ec14..b154924d09 100755
--- a/configure
+++ b/configure
@@ -1379,6 +1379,14 @@ require_header(){
 check_header "$header" "$@" || die "ERROR: $header header not found"
 }
 
+require_cpp_condition(){
+log require "$@"
+header="$1"
+condition="$2"
+shift 2
+check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition 
not satisfied"
+}
+
 use_pkg_config(){
 log use_pkg_config "$@"
 pkg="$1"
@@ -6017,13 +6025,11 @@ enabled libwebp   && {
 enabled libx264   && { use_pkg_config x264 "stdint.h x264.h" 
x264_encoder_encode ||
{ require libx264 "stdint.h x264.h" 
x264_encoder_encode -lx264 &&
  warn "using libx264 without pkg-config"; } } 
&&
- { check_cpp_condition x264.h "X264_BUILD >= 118" 
||
-   die "ERROR: libx264 must be installed and 
version must be >= 0.118."; } &&
+ require_cpp_condition x264.h "X264_BUILD >= 118" 
&&
  { check_cpp_condition x264.h "X264_MPEG2" &&
enable libx262; }
 enabled libx265   && require_pkg_config x265 x265.h x265_api_get &&
- { check_cpp_condition x265.h "X265_BUILD >= 68" ||
-   die "ERROR: libx265 version must be >= 68."; }
+ require_cpp_condition x265.h "X265_BUILD >= 68"
 enabled libxavs   && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode -lxavs
 enabled libxvid   && require libxvid xvid.h xvid_global -lxvidcore
 enabled libzimg   && require_pkg_config "zimg >= 2.3.0" zimg.h 
zimg_get_api_version


==

diff --cc configure
index 035e16ec14,555dc8861e..b154924d09
--- a/configure
+++ b/configure
@@@ -1376,13 -1121,22 +1376,21 @@@ require_header()
  log require "$@"
  header="$1"
  shift
 -check_header "$header" "$@" || die "ERROR: $header not found"
 +check_header "$header" "$@" || die "ERROR: $header header not found"
  }
  
+ require_cpp_condition(){
+ log require "$@"
+ header="$1"
+ condition="$2"
+ shift 2
+ check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition 
not satisfied"
+ }
+ 
 -require_pkg_config(){
 -log require_pkg_config "$@"
 -pkg_version="$1"
 -pkg="${1%% *}"
 -check_pkg_config "$@" || die "ERROR: $pkg_version not found"
 +use_pkg_config(){
 +log use_pkg_config "$@"
 +pkg="$1"
 +check_pkg_config "$@" || return 1
  add_cflags$(get_safe "${pkg}_cflags")
  add_extralibs $(get_safe "${pkg}_extralibs")
  }
@@@ -6009,30 -4710,16 +6017,28 @@@ enabled libvpx&& 
  die "libvpx enabled but no supported decoders found"
  fi
  }
 +
  enabled libwavpack&& require libwavpack wavpack/wavpack.h 
WavpackOpenFileOutput  -lwavpack
 -enabled libwebp   && require_pkg_config libwebp webp/encode.h 
WebPGetEncoderVersion
 -enabled libx264   && require_pkg_config x264 "stdint.h x264.h" 
x264_encoder_encode &&
 +enabled libwebp   && {
 +enabled libwebp_encoder  && require_pkg_config "libwebp >= 0.2.0" 
webp/encode.h WebPGetEncoderVersion
 +enabled libwebp_anim_encoder && { use_pkg_config "libwebpmux >= 0.4.0" 
webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } }
 +enabled libx264   && { use_pkg_config x264 "stdint.h x264.h" 
x264_encoder_encode ||
 +   { require libx264 "stdint.h x264.h" 
x264_encoder_encode -lx264 &&
 + warn "using libx264 without pkg-config"; } } 
&&
-  { check_cpp_condition x264.h "X264_BUILD >= 118" 
||
-die "ERROR: libx264 must be installed and 
version must be >= 0.118."; } &&
+  require_cpp_condition x264.h "X264_BUILD >= 118" 
&&
   { check_cpp_condition x264.h "X264_MPEG2" &&
 enable libx262; }
  enabled libx265   && require_pkg_config x265 x265.h x265_api_get &&
-  { check_cpp_condition x265.h "X265_BUILD >= 68" 
||
-die "ERROR: libx265 

[FFmpeg-cvslog] Merge commit 'aba7fdcc8baaed35e804c7882b70a848a0e566c7'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:29:57 
2017 -0300| [14194090a6f65c5110689944c91a6b9030c65791] | committer: James Almer

Merge commit 'aba7fdcc8baaed35e804c7882b70a848a0e566c7'

* commit 'aba7fdcc8baaed35e804c7882b70a848a0e566c7':
  configure: Add require_header() convenience function

Merged-by: James Almer 

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

 configure | 17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index b07cef182c..035e16ec14 100755
--- a/configure
+++ b/configure
@@ -1372,6 +1372,13 @@ require_cpp(){
 check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
 }
 
+require_header(){
+log require "$@"
+header="$1"
+shift
+check_header "$header" "$@" || die "ERROR: $header header not found"
+}
+
 use_pkg_config(){
 log use_pkg_config "$@"
 pkg="$1"
@@ -5884,14 +5891,14 @@ enabled cuda_sdk  && require cuda_sdk cuda.h 
cuCtxCreate -lcuda
 enabled cuvid && { enabled cuda ||
die "ERROR: CUVID requires CUDA"; }
 enabled chromaprint   && require chromaprint chromaprint.h 
chromaprint_get_version -lchromaprint
-enabled decklink  && { { check_header DeckLinkAPI.h || die "ERROR: 
DeckLinkAPI.h header not found"; } &&
+enabled decklink  && { require_header DeckLinkAPI.h &&
{ check_cpp_condition DeckLinkAPIVersion.h 
"BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API 
version must be >= 10.6.1."; } }
-enabled libndi_newtek && { check_header Processing.NDI.Lib.h || die 
"ERROR: Processing.NDI.Lib.h header not found"; }
-enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
+enabled libndi_newtek && require_header Processing.NDI.Lib.h
+enabled frei0r&& require_header frei0r.h
 enabled gmp   && require gmp gmp.h mpz_export -lgmp
 enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled jni   && { [ $target_os = "android" ] && check_header 
jni.h && enabled pthreads || die "ERROR: jni not found"; }
-enabled ladspa&& { check_header ladspa.h || die "ERROR: ladspa.h 
header not found"; }
+enabled ladspa&& require_header ladspa.h
 enabled libiec61883   && require libiec61883 libiec61883/iec61883.h 
iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass&& require_pkg_config libass ass/ass.h 
ass_library_init
 enabled libbluray && require_pkg_config libbluray libbluray/bluray.h 
bd_open
@@ -6053,7 +6060,7 @@ enabled opengl&& { check_lib opengl GL/glx.h 
glXGetProcAddress "-lGL
 enabled omx_rpi   && { check_header OMX_Core.h ||
{ ! enabled cross_compile && add_cflags 
-isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
die "ERROR: OpenMAX IL headers not found"; }
-enabled omx   && { check_header OMX_Core.h || die "ERROR: OpenMAX 
IL headers not found"; }
+enabled omx   && require_header OMX_Core.h
 enabled openssl   && { use_pkg_config openssl openssl/ssl.h 
OPENSSL_init_ssl ||
use_pkg_config openssl openssl/ssl.h 
SSL_library_init ||
check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto ||


==

diff --cc configure
index b07cef182c,30f053954b..035e16ec14
--- a/configure
+++ b/configure
@@@ -1364,18 -1117,18 +1364,25 @@@ require()
  check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not 
found"
  }
  
 +require_cpp(){
 +name="$1"
 +headers="$2"
 +classes="$3"
 +shift 3
 +check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
 +}
 +
+ require_header(){
+ log require "$@"
+ header="$1"
+ shift
 -check_header "$header" "$@" || die "ERROR: $header not found"
++check_header "$header" "$@" || die "ERROR: $header header not found"
+ }
+ 
 -require_pkg_config(){
 -log require_pkg_config "$@"
 -pkg_version="$1"
 -pkg="${1%% *}"
 -check_pkg_config "$@" || die "ERROR: $pkg_version not found"
 +use_pkg_config(){
 +log use_pkg_config "$@"
 +pkg="$1"
 +check_pkg_config "$@" || return 1
  add_cflags$(get_safe "${pkg}_cflags")
  add_extralibs $(get_safe "${pkg}_extralibs")
  }
@@@ -5875,44 -4642,19 +5882,44 @@@ for func in $MATH_FUNCS; d
  eval check_mathfunc $func \${${func}_args:-1} $LIBM
  done
  
 +for func in $COMPLEX_FUNCS; do
 +eval check_complexfunc $func \${${func}_args:-1}
 +done
 +
  # these are off by default, so fail if requested and not available
 -enabled avisynth  && 

[FFmpeg-cvslog] configure: Add require_header() convenience function

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Sun Jan 22 
16:04:09 2017 +0100| [aba7fdcc8baaed35e804c7882b70a848a0e566c7] | committer: 
Diego Biurrun

configure: Add require_header() convenience function

Simplifies checking for external library headers and aborting if
the external library support was requested, but is not available.

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

 configure | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 070edcae1e..30f053954b 100755
--- a/configure
+++ b/configure
@@ -1117,6 +1117,13 @@ require(){
 check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not 
found"
 }
 
+require_header(){
+log require "$@"
+header="$1"
+shift
+check_header "$header" "$@" || die "ERROR: $header not found"
+}
+
 require_pkg_config(){
 log require_pkg_config "$@"
 pkg_version="$1"
@@ -4636,10 +4643,10 @@ for func in $MATH_FUNCS; do
 done
 
 # these are off by default, so fail if requested and not available
-enabled avisynth  && { check_header avisynth/avisynth_c.h || die 
"ERROR: avisynth/avisynth_c.h header not found"; }
+enabled avisynth  && require_header avisynth/avisynth_c.h
 enabled avxsynth  && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" 
dlopen -ldl
 enabled cuda  && require cuda cuda.h cuInit -lcuda
-enabled frei0r&& { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
+enabled frei0r&& require_header frei0r.h
 enabled gnutls&& require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled libbs2b   && require_pkg_config libbs2b bs2b.h bs2b_open
 enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h 
dc1394_new
@@ -4717,7 +4724,7 @@ enabled mmal  && { check_lib mmal 
interface/mmal/mmal.h mmal_port_co
 enabled omx_rpi   && { check_header OMX_Core.h ||
{ ! enabled cross_compile && add_cflags 
-isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
die "ERROR: OpenMAX IL headers not found"; }
-enabled omx   && { check_header OMX_Core.h || die "ERROR: OpenMAX 
IL headers not found"; }
+enabled omx   && require_header OMX_Core.h
 enabled openssl   && { { check_pkg_config openssl openssl/ssl.h 
OPENSSL_init_ssl ||
  check_pkg_config openssl openssl/ssl.h 
SSL_library_init; } && {
add_cflags $openssl_cflags && add_extralibs 
$openssl_extralibs; } ||
@@ -4729,7 +4736,7 @@ enabled openssl   && { { check_pkg_config openssl 
openssl/ssl.h OPENSSL_
 enabled gnutls&& check_lib gmp gmp.h mpz_export -lgmp
 
 if enabled nvenc; then
-check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
+require_header nvEncodeAPI.h
 check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
 die "ERROR: NVENC API version 5 or older is not supported"
 fi

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


[FFmpeg-cvslog] Merge commit 'a97563c889fefd81ad6b3758471434d8c2e2e550'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:23:16 
2017 -0300| [1985071e41f4df8fc693a564e25758676bba164a] | committer: James Almer

Merge commit 'a97563c889fefd81ad6b3758471434d8c2e2e550'

* commit 'a97563c889fefd81ad6b3758471434d8c2e2e550':
  configure: Simplify libxcb check

Merged-by: James Almer 

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index b2d87bed5e..b07cef182c 100755
--- a/configure
+++ b/configure
@@ -3088,6 +3088,7 @@ v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
 vfwcap_indev_deps="vfw32 vfwcap_defines"
 xcbgrab_indev_deps="libxcb"
+xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
 xv_outdev_extralibs="-lXv -lX11 -lXext"
 


==

diff --cc configure
index b2d87bed5e,070edcae1e..b07cef182c
--- a/configure
+++ b/configure
@@@ -3085,17 -2399,13 +3085,18 @@@ sdl2_outdev_deps="sdl2
  sndio_indev_deps="sndio"
  sndio_outdev_deps="sndio"
  v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 +v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
  vfwcap_indev_deps="vfw32 vfwcap_defines"
  xcbgrab_indev_deps="libxcb"
 -xcbgrab_indev_suggest="libxcb_shm libxcb_xfixes"
++xcbgrab_indev_suggest="libxcb_shm libxcb_shape libxcb_xfixes"
 +xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
 +xv_outdev_extralibs="-lXv -lX11 -lXext"
  
  # protocols
 +async_protocol_deps="threads"
 +bluray_protocol_deps="libbluray"
  ffrtmpcrypt_protocol_deps="!librtmp_protocol"
 -ffrtmpcrypt_protocol_deps_any="gmp openssl"
 +ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
  ffrtmpcrypt_protocol_select="tcp_protocol"
  ffrtmphttp_protocol_deps="!librtmp_protocol"
  ffrtmphttp_protocol_select="http_protocol"

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


[FFmpeg-cvslog] svq3: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Thu Mar 
17 14:21:24 2016 +0100| [c29da01ac95ea2c8c5c4b3a312a338fb7068] | committer: 
Diego Biurrun

svq3: Convert to the new bitstream reader

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

 libavcodec/svq3.c | 132 +++---
 1 file changed, 66 insertions(+), 66 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 8bbd331de3..20c8f89e76 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -44,7 +44,8 @@
 
 #include "libavutil/attributes.h"
 
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "internal.h"
 #include "avcodec.h"
 #include "mpegutils.h"
@@ -92,8 +93,8 @@ typedef struct SVQ3Context {
 SVQ3Frame *cur_pic;
 SVQ3Frame *next_pic;
 SVQ3Frame *last_pic;
-GetBitContext gb;
-GetBitContext gb_slice;
+BitstreamContext bc;
+BitstreamContext bc_slice;
 uint8_t *slice_buf;
 int slice_size;
 int halfpel_flag;
@@ -292,7 +293,7 @@ static void svq3_add_idct_c(uint8_t *dst, int16_t *block,
 memset(block, 0, 16 * sizeof(int16_t));
 }
 
-static inline int svq3_decode_block(GetBitContext *gb, int16_t *block,
+static inline int svq3_decode_block(BitstreamContext *bc, int16_t *block,
 int index, const int type)
 {
 static const uint8_t *const scan_patterns[4] = {
@@ -305,7 +306,7 @@ static inline int svq3_decode_block(GetBitContext *gb, 
int16_t *block,
 const uint8_t *const scan = scan_patterns[type];
 
 for (limit = (16 >> intra); index < 16; index = limit, limit += 8) {
-for (; (vlc = get_interleaved_ue_golomb(gb)) != 0; index++) {
+for (; (vlc = get_interleaved_ue_golomb(bc)) != 0; index++) {
 int sign = (vlc & 1) ? 0 : -1;
 vlc  = vlc + 1 >> 1;
 
@@ -542,8 +543,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int 
mode,
 if (mode == PREDICT_MODE) {
 dx = dy = 0;
 } else {
-dy = get_interleaved_se_golomb(>gb_slice);
-dx = get_interleaved_se_golomb(>gb_slice);
+dy = get_interleaved_se_golomb(>bc_slice);
+dx = get_interleaved_se_golomb(>bc_slice);
 
 if (dx == INVALID_VLC || dy == INVALID_VLC) {
 av_log(s->avctx, AV_LOG_ERROR, "invalid MV vlc\n");
@@ -744,10 +745,10 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 mb_type = MB_TYPE_16x16;
 }
 } else if (mb_type < 8) { /* INTER */
-if (s->thirdpel_flag && s->halfpel_flag == !get_bits1(>gb_slice))
+if (s->thirdpel_flag && s->halfpel_flag == 
!bitstream_read_bit(>bc_slice))
 mode = THIRDPEL_MODE;
 else if (s->halfpel_flag &&
- s->thirdpel_flag == !get_bits1(>gb_slice))
+ s->thirdpel_flag == !bitstream_read_bit(>bc_slice))
 mode = HALFPEL_MODE;
 else
 mode = FULLPEL_MODE;
@@ -849,7 +850,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 
 /* decode prediction codes for luma blocks */
 for (i = 0; i < 16; i += 2) {
-vlc = get_interleaved_ue_golomb(>gb_slice);
+vlc = get_interleaved_ue_golomb(>bc_slice);
 
 if (vlc >= 25) {
 av_log(s->avctx, AV_LOG_ERROR,
@@ -927,7 +928,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 
 if (!IS_INTRA16x16(mb_type) &&
 (!IS_SKIP(mb_type) || s->pict_type == AV_PICTURE_TYPE_B)) {
-if ((vlc = get_interleaved_ue_golomb(>gb_slice)) >= 48) {
+if ((vlc = get_interleaved_ue_golomb(>bc_slice)) >= 48) {
 av_log(s->avctx, AV_LOG_ERROR, "cbp_vlc=%"PRIu32"\n", vlc);
 return -1;
 }
@@ -937,7 +938,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 }
 if (IS_INTRA16x16(mb_type) ||
 (s->pict_type != AV_PICTURE_TYPE_I && s->adaptive_quant && cbp)) {
-s->qscale += get_interleaved_se_golomb(>gb_slice);
+s->qscale += get_interleaved_se_golomb(>bc_slice);
 
 if (s->qscale > 31u) {
 av_log(s->avctx, AV_LOG_ERROR, "qscale:%d\n", s->qscale);
@@ -947,7 +948,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
 if (IS_INTRA16x16(mb_type)) {
 AV_ZERO128(s->mb_luma_dc[0] + 0);
 AV_ZERO128(s->mb_luma_dc[0] + 8);
-if (svq3_decode_block(>gb_slice, s->mb_luma_dc[0], 0, 1)) {
+if (svq3_decode_block(>bc_slice, s->mb_luma_dc[0], 0, 1)) {
 av_log(s->avctx, AV_LOG_ERROR,
"error while decoding intra luma dc\n");
 return -1;
@@ -966,7 +967,7 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int 
mb_type)
   : (4 * i + j);
   

[FFmpeg-cvslog] Merge commit 'c29da01ac95ea2c8c5c4b3a312a33aaaa8fb7068'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:13:46 
2017 -0300| [a901869c19ed14c7d3647901468bd1297c9f98c0] | committer: James Almer

Merge commit 'c29da01ac95ea2c8c5c4b3a312a338fb7068'

* commit 'c29da01ac95ea2c8c5c4b3a312a338fb7068':
  svq3: Convert to the new bitstream reader

This commit is a noop, see
http://ffmpeg.org/pipermail/ffmpeg-devel/2017-April/209609.html

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] configure: Drop weak dependencies on external libraries for webm muxer

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Mon Jan 23 
13:17:24 2017 +0100| [acfa7a2178f08fd81b66279959cd55ec3ae237e2] | committer: 
Diego Biurrun

configure: Drop weak dependencies on external libraries for webm muxer

Weak dependencies on external libraries do not obviate having to
explicitly enable these libraries, so the weak dependency does not
simplify the configure command line nor have any real effect.

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

 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index e3f1a91235..d77eb3d0bb 100755
--- a/configure
+++ b/configure
@@ -2376,7 +2376,6 @@ w64_demuxer_select="wav_demuxer"
 wav_demuxer_select="riffdec"
 wav_muxer_select="riffenc"
 webm_muxer_select="iso_media riffenc"
-webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder 
libvpx_vp9_encoder"
 wtv_demuxer_select="mpegts_demuxer riffdec"
 xmv_demuxer_select="riffdec"
 xwma_demuxer_select="riffdec"

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


[FFmpeg-cvslog] Merge commit 'acfa7a2178f08fd81b66279959cd55ec3ae237e2'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:11:48 
2017 -0300| [3f9e7ddd90d324a2876f96d5e19a403f78995f70] | committer: James Almer

Merge commit 'acfa7a2178f08fd81b66279959cd55ec3ae237e2'

* commit 'acfa7a2178f08fd81b66279959cd55ec3ae237e2':
  configure: Drop weak dependencies on external libraries for webm muxer

This commit is a noop.

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] Merge commit '66988320794a107f2a460eaa71dbd9fab8056842'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:08:29 
2017 -0300| [740e557d6eac3b579dfed53ed92ae70e2089c77c] | committer: James Almer

Merge commit '66988320794a107f2a460eaa71dbd9fab8056842'

* commit '66988320794a107f2a460eaa71dbd9fab8056842':
  configure: Add proper weak dependency of drawtext filter on libfontconfig

Merged-by: James Almer 

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 3bd9e7a342..b2d87bed5e 100755
--- a/configure
+++ b/configure
@@ -3167,6 +3167,7 @@ deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
 deshake_filter_select="pixelutils"
 drawtext_filter_deps="libfreetype"
+drawtext_filter_suggest="libfontconfig"
 elbg_filter_deps="avcodec"
 eq_filter_deps="gpl"
 fftfilt_filter_deps="avcodec"


==

diff --cc configure
index 3bd9e7a342,e3f1a91235..b2d87bed5e
--- a/configure
+++ b/configure
@@@ -3165,83 -2452,20 +3165,84 @@@ cropdetect_filter_deps="gpl
  deinterlace_qsv_filter_deps="libmfx"
  deinterlace_vaapi_filter_deps="vaapi"
  delogo_filter_deps="gpl"
 +deshake_filter_select="pixelutils"
  drawtext_filter_deps="libfreetype"
+ drawtext_filter_suggest="libfontconfig"
 +elbg_filter_deps="avcodec"
 +eq_filter_deps="gpl"
 +fftfilt_filter_deps="avcodec"
 +fftfilt_filter_select="rdft"
 +find_rect_filter_deps="avcodec avformat gpl"
 +firequalizer_filter_deps="avcodec"
 +firequalizer_filter_select="rdft"
 +flite_filter_deps="libflite"
 +framerate_filter_select="pixelutils"
  frei0r_filter_deps="frei0r dlopen"
 -frei0r_filter_extralibs='$ldl'
  frei0r_src_filter_deps="frei0r dlopen"
 -frei0r_src_filter_extralibs='$ldl'
 -hdcd_filter_deps="libhdcd"
 +fspp_filter_deps="gpl"
 +geq_filter_deps="gpl"
 +histeq_filter_deps="gpl"
  hqdn3d_filter_deps="gpl"
  interlace_filter_deps="gpl"
 +kerndeint_filter_deps="gpl"
 +ladspa_filter_deps="ladspa dlopen"
 +mcdeint_filter_deps="avcodec gpl"
  movie_filter_deps="avcodec avformat"
 +mpdecimate_filter_deps="gpl"
 +mpdecimate_filter_select="pixelutils"
 +mptestsrc_filter_deps="gpl"
 +negate_filter_deps="lut_filter"
 +nnedi_filter_deps="gpl"
 +ocr_filter_deps="libtesseract"
  ocv_filter_deps="libopencv"
 +owdenoise_filter_deps="gpl"
 +pan_filter_deps="swresample"
 +perspective_filter_deps="gpl"
 +phase_filter_deps="gpl"
 +pp7_filter_deps="gpl"
 +pp_filter_deps="gpl postproc"
 +pullup_filter_deps="gpl"
 +removelogo_filter_deps="avcodec avformat swscale"
 +repeatfields_filter_deps="gpl"
  resample_filter_deps="avresample"
 +rubberband_filter_deps="librubberband"
 +sab_filter_deps="gpl swscale"
 +scale2ref_filter_deps="swscale"
  scale_filter_deps="swscale"
  scale_qsv_filter_deps="libmfx"
 +select_filter_select="pixelutils"
 +showcqt_filter_deps="avcodec avformat swscale"
 +showcqt_filter_select="fft"
 +showfreqs_filter_deps="avcodec"
 +showfreqs_filter_select="fft"
 +showspectrum_filter_deps="avcodec"
 +showspectrum_filter_select="fft"
 +showspectrumpic_filter_deps="avcodec"
 +showspectrumpic_filter_select="fft"
 +signature_filter_deps="gpl avcodec avformat"
 +smartblur_filter_deps="gpl swscale"
 +sofalizer_filter_deps="libmysofa avcodec"
 +sofalizer_filter_select="fft"
 +spectrumsynth_filter_deps="avcodec"
 +spectrumsynth_filter_select="fft"
 +spp_filter_deps="gpl avcodec"
 +spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
 +stereo3d_filter_deps="gpl"
 +subtitles_filter_deps="avformat avcodec libass"
 +super2xsai_filter_deps="gpl"
 +pixfmts_super2xsai_test_deps="super2xsai_filter"
 +tinterlace_filter_deps="gpl"
 +tinterlace_merge_test_deps="tinterlace_filter"
 +tinterlace_pad_test_deps="tinterlace_filter"
 +tonemap_filter_deps="const_nan"
 +uspp_filter_deps="gpl avcodec"
 +vaguedenoiser_filter_deps="gpl"
 +vidstabdetect_filter_deps="libvidstab"
 +vidstabtransform_filter_deps="libvidstab"
 +libvmaf_filter_deps="libvmaf"
 +zmq_filter_deps="libzmq"
 +zoompan_filter_deps="swscale"
 +zscale_filter_deps="libzimg const_nan"
  scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
  
  # examples

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


[FFmpeg-cvslog] configure: Add proper weak dependency of drawtext filter on libfontconfig

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Mon Jan 23 
17:59:56 2017 +0100| [66988320794a107f2a460eaa71dbd9fab8056842] | committer: 
Diego Biurrun

configure: Add proper weak dependency of drawtext filter on libfontconfig

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 4a8d04d210..e3f1a91235 100755
--- a/configure
+++ b/configure
@@ -2453,6 +2453,7 @@ deinterlace_qsv_filter_deps="libmfx"
 deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
 drawtext_filter_deps="libfreetype"
+drawtext_filter_suggest="libfontconfig"
 frei0r_filter_deps="frei0r dlopen"
 frei0r_filter_extralibs='$ldl'
 frei0r_src_filter_deps="frei0r dlopen"

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


[FFmpeg-cvslog] Merge commit '24d5680bbc01fc124709d522d348572ad4672563'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 17:01:21 
2017 -0300| [932e28b13e9ae29262dfd28419b700e03716e85e] | committer: James Almer

Merge commit '24d5680bbc01fc124709d522d348572ad4672563'

* commit '24d5680bbc01fc124709d522d348572ad4672563':
  configure: Simplify inline asm check with appropriate helper function

Merged-by: James Almer 

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

 configure | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure b/configure
index 74c754d91a..3bd9e7a342 100755
--- a/configure
+++ b/configure
@@ -5308,9 +5308,7 @@ EOF
 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ 
\t]*ff_extern/)) }')
 extern_prefix=${sym%%ff_extern*}
 
-check_cc 

[FFmpeg-cvslog] configure: Simplify inline asm check with appropriate helper function

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Fri Jan 20 
15:30:36 2017 +0100| [24d5680bbc01fc124709d522d348572ad4672563] | committer: 
Diego Biurrun

configure: Simplify inline asm check with appropriate helper function

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

 configure | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure b/configure
index 79898184c2..4a8d04d210 100755
--- a/configure
+++ b/configure
@@ -4183,9 +4183,7 @@ EOF
 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ 
\t]*ff_extern/)) }')
 extern_prefix=${sym%%ff_extern*}
 
-check_cc 

[FFmpeg-cvslog] Merge commit 'b3825723dceffc64240da7b0e562bd1fd024da26'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 16:49:59 
2017 -0300| [f9445760289d104a3e9d2d25844b08f999a41946] | committer: James Almer

Merge commit 'b3825723dceffc64240da7b0e562bd1fd024da26'

* commit 'b3825723dceffc64240da7b0e562bd1fd024da26':
  configure: Merge compiler/libc/os hacks sections

Merged-by: James Almer 

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

 configure | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index 70b7677983..74c754d91a 100755
--- a/configure
+++ b/configure
@@ -5236,26 +5236,25 @@ test -n "$libc_type" && enable libc_$libc_type
 probe_libc host_
 test -n "$host_libc_type" && enable host_libc_$host_libc_type
 
+# hacks for compiler/libc/os combinations
+
 case $libc_type in
 bionic)
 add_compat strtod.o strtod=avpriv_strtod
 ;;
+glibc)
+if enabled tms470; then
+CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
+add_cppflags -D__USER_LABEL_PREFIX__=
+add_cppflags -D__builtin_memset=memset
+add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
+add_cflags   -pds=48# incompatible redefinition of macro
+elif enabled ccc; then
+add_ldflags -Wl,-z,now  # calls to libots crash without this
+fi
+;;
 esac
 
-# hacks for compiler/libc/os combinations
-
-if enabled_all tms470 libc_glibc; then
-CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
-add_cppflags -D__USER_LABEL_PREFIX__=
-add_cppflags -D__builtin_memset=memset
-add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
-add_cflags   -pds=48# incompatible redefinition of macro
-fi
-
-if enabled_all ccc libc_glibc; then
-add_ldflags -Wl,-z,now  # calls to libots crash without this
-fi
-
 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
 add_cppflags '-I\$(SRC_PATH)/compat/float'
 


==


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


[FFmpeg-cvslog] configure: Merge compiler/libc/os hacks sections

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Fri Jan 20 
15:29:57 2017 +0100| [b3825723dceffc64240da7b0e562bd1fd024da26] | committer: 
Diego Biurrun

configure: Merge compiler/libc/os hacks sections

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

 configure | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index 64c077465d..79898184c2 100755
--- a/configure
+++ b/configure
@@ -4115,26 +4115,25 @@ test -n "$libc_type" && enable libc_$libc_type
 probe_libc host_
 test -n "$host_libc_type" && enable host_libc_$host_libc_type
 
+# hacks for compiler/libc/os combinations
+
 case $libc_type in
 bionic)
 add_compat strtod.o strtod=avpriv_strtod
 ;;
+glibc)
+if enabled tms470; then
+CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
+add_cppflags -D__USER_LABEL_PREFIX__=
+add_cppflags -D__builtin_memset=memset
+add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
+add_cflags   -pds=48# incompatible redefinition of macro
+elif enabled ccc; then
+add_ldflags -Wl,-z,now  # calls to libots crash without this
+fi
+;;
 esac
 
-# hacks for compiler/libc/os combinations
-
-if enabled_all tms470 libc_glibc; then
-CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
-add_cppflags -D__USER_LABEL_PREFIX__=
-add_cppflags -D__builtin_memset=memset
-add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
-add_cflags   -pds=48# incompatible redefinition of macro
-fi
-
-if enabled_all ccc libc_glibc; then
-add_ldflags -Wl,-z,now  # calls to libots crash without this
-fi
-
 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
 add_cppflags '-I\$(SRC_PATH)/compat/float'
 

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


[FFmpeg-cvslog] Merge commit '577326d430593a25456393a75212b95d1cd94131'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 16:38:55 
2017 -0300| [b1cf151c4dfdbd049cd41863b4e0cde927585e17] | committer: James Almer

Merge commit '577326d430593a25456393a75212b95d1cd94131'

* commit '577326d430593a25456393a75212b95d1cd94131':
  lavc: deprecate refcounted_frames field

Merged-by: James Almer 

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

 doc/APIchanges   | 6 ++
 libavcodec/avcodec.h | 1 +
 libavcodec/version.h | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index d06144f1e9..52336d1dec 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,12 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-09-26 - xxx - lavc 57.106.102 - avcodec.h
+  Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
+  API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
+  (avcodec_send_packet/avcodec_receive_frame) always work with reference
+  counted frames.
+
 2017-xx-xx - xxx - lavu 55.76.100 / 56.6.0 - pixdesc.h
   Add av_color_range_from_name(), av_color_primaries_from_name(),
   av_color_transfer_from_name(), av_color_space_from_name(), and
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 07d9f3e255..b5bbc591ac 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2683,6 +2683,7 @@ typedef struct AVCodecContext {
  * - encoding: unused
  * - decoding: set by the caller before avcodec_open2().
  */
+attribute_deprecated
 int refcounted_frames;
 
 /* - encoding parameters */
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e1224752bd..3008460b93 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR  57
 #define LIBAVCODEC_VERSION_MINOR 106
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \


==

diff --cc doc/APIchanges
index d06144f1e9,c161618d92..52336d1dec
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@@ -15,77 -13,13 +15,83 @@@ libavutil: 2015-08-2
  
  API changes, most recent first:
  
 -2017-02-01 - xxx - lavc - avcodec.h
++2017-09-26 - xxx - lavc 57.106.102 - avcodec.h
+   Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
+   API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
+   (avcodec_send_packet/avcodec_receive_frame) always work with reference
+   counted frames.
+ 
 -2016-xx-xx - xxx - lavc 57.31.0 - avcodec.h
 +2017-xx-xx - xxx - lavu 55.76.100 / 56.6.0 - pixdesc.h
 +  Add av_color_range_from_name(), av_color_primaries_from_name(),
 +  av_color_transfer_from_name(), av_color_space_from_name(), and
 +  av_chroma_location_from_name().
 +
 +2017-09-13 - xxx - lavc 57.106.100 - avcodec.h
 +  Add AV_PKT_FLAG_TRUSTED.
 +
 +2017-09-13 - xxx - lavu 55.75.100 - hwcontext.h hwcontext_drm.h
 +  Add AV_HWDEVICE_TYPE_DRM and implementation.
 +
 +2017-09-08 - xxx - lavfi 6.103.100 - buffersrc.h
 +  Add av_buffersrc_close().
 +
 +2017-09-04 - xxx - lavc 57.105.100 - avcodec.h
 +  Add AV_HWACCEL_CODEC_CAP_EXPERIMENTAL, replacing the deprecated
 +  HWACCEL_CODEC_CAP_EXPERIMENTAL flag.
 +
 +2017-09-01 - xxx - lavf 57.81.100 - avio.h
 +  Add avio_read_partial().
 +
 +2017-09-01 - xxx - lavf 57.80.100 / 57.11.0 - avio.h
 +  Add avio_context_free(). From now on it must be used for freeing 
AVIOContext.
 +
 +2017-08-08 - xxx - lavu 55.74.100 - pixdesc.h
 +  Add AV_PIX_FMT_FLAG_FLOAT pixel format flag.
 +
 +2017-08-08 - xxx - lavu 55.72.100 - imgutils.h
 +  Add av_image_fill_black().
 +
 +2017-08-08 - xxx - lavu 55.71.100 - frame.h
 +  Add av_frame_apply_cropping().
 +
 +2017-07-25 - 24de4fddca - lavu 55.69.100 - frame.h
 +  Add AV_FRAME_DATA_ICC_PROFILE side data type.
 +
 +2017-xx-xx - xxx - lavc 57.100.100 - avcodec.h
 +  DXVA2 and D3D11 hardware accelerated decoding now supports the new hwaccel 
API,
 +  which can create the decoder context and allocate hardware frame 
automatically.
 +  See AVCodecContext.hw_device_ctx and AVCodecContext.hw_frames_ctx. For 
D3D11,
 +  the new AV_PIX_FMT_D3D11 pixfmt must be used with the new API.
 +
 +2017-xx-xx - xxx - lavu 56.67.100 - hwcontext.h
 +  Add AV_HWDEVICE_TYPE_D3D11VA and AV_PIX_FMT_D3D11.
 +
 +2017-06-24 - xxx - lavf 57.75.100 - avio.h
 +  Add AVIO_DATA_MARKER_FLUSH_POINT to signal preferred flush points to 
aviobuf.
 +
 +2017-06-14 - xxx - lavu 55.66.100 - hwcontext.h
 +  av_hwframe_ctx_create_derived() now takes some AV_HWFRAME_MAP_* combination
 +  as its flags argument (which was previously unused).
 +
 +2017-06-14 - xxx - lavc 

[FFmpeg-cvslog] lavc: deprecate refcounted_frames field

2017-09-26 Thread wm4
ffmpeg | branch: master | wm4  | Mon Jan 16 17:32:18 
2017 +0100| [577326d430593a25456393a75212b95d1cd94131] | committer: Anton 
Khirnov

lavc: deprecate refcounted_frames field

No deprecation guards, because the old decode API (for which this field
is needed) doesn't have any either.

This field should be removed together with the old decode calls.

Signed-off-by: Anton Khirnov 

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

 doc/APIchanges   | 6 ++
 libavcodec/avcodec.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index c8c2a219f6..c161618d92 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,12 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2017-02-01 - xxx - lavc - avcodec.h
+  Deprecate AVCodecContext.refcounted_frames. This was useful for deprecated
+  API only (avcodec_decode_video2/avcodec_decode_audio4). The new decode APIs
+  (avcodec_send_packet/avcodec_receive_frame) always work with reference
+  counted frames.
+
 2016-xx-xx - xxx - lavc 57.31.0 - avcodec.h
   Add AVCodecContext.apply_cropping to control whether cropping
   is handled by libavcodec or the caller.
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 18721561d5..8d8fa594aa 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2327,7 +2327,7 @@ typedef struct AVCodecContext {
  * - encoding: unused
  * - decoding: set by the caller before avcodec_open2().
  */
-int refcounted_frames;
+attribute_deprecated int refcounted_frames;
 
 /* - encoding parameters */
 float qcompress;  ///< amount of qscale change between easy & hard scenes 
(0.0-1.0)

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


[FFmpeg-cvslog] Merge commit '3ad825793a43253154bed05827f27425fc0757df'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 16:27:43 
2017 -0300| [e7c91850531aae4c2e1bf1afc62fc1d910f8736c] | committer: James Almer

Merge commit '3ad825793a43253154bed05827f27425fc0757df'

* commit '3ad825793a43253154bed05827f27425fc0757df':
  hwcontext_cuda: implement frames_get_constraints

This commit is a noop, c16fe1432d88f87a96be9e943e0f1229543ad61d

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] hwcontext_cuda: implement frames_get_constraints

2017-09-26 Thread wm4
ffmpeg | branch: master | wm4  | Mon Jan 16 16:42:17 
2017 +0100| [3ad825793a43253154bed05827f27425fc0757df] | committer: Anton 
Khirnov

hwcontext_cuda: implement frames_get_constraints

Copied and modified from hwcontext_qsv.c.

Signed-off-by: Anton Khirnov 

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

 libavutil/hwcontext_cuda.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index 260783426a..fc9b8b4298 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -37,6 +37,31 @@ static const enum AVPixelFormat supported_formats[] = {
 AV_PIX_FMT_YUV444P16,
 };
 
+static int cuda_frames_get_constraints(AVHWDeviceContext *ctx,
+   const void *hwconfig,
+   AVHWFramesConstraints *constraints)
+{
+int i;
+
+constraints->valid_sw_formats = 
av_malloc_array(FF_ARRAY_ELEMS(supported_formats) + 1,
+
sizeof(*constraints->valid_sw_formats));
+if (!constraints->valid_sw_formats)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < FF_ARRAY_ELEMS(supported_formats); i++)
+constraints->valid_sw_formats[i] = supported_formats[i];
+constraints->valid_sw_formats[FF_ARRAY_ELEMS(supported_formats)] = 
AV_PIX_FMT_NONE;
+
+constraints->valid_hw_formats = av_malloc_array(2, 
sizeof(*constraints->valid_hw_formats));
+if (!constraints->valid_hw_formats)
+return AVERROR(ENOMEM);
+
+constraints->valid_hw_formats[0] = AV_PIX_FMT_CUDA;
+constraints->valid_hw_formats[1] = AV_PIX_FMT_NONE;
+
+return 0;
+}
+
 static void cuda_buffer_free(void *opaque, uint8_t *data)
 {
 AVHWFramesContext *ctx = opaque;
@@ -326,6 +351,7 @@ const HWContextType ff_hwcontext_type_cuda = {
 .frames_priv_size = sizeof(CUDAFramesContext),
 
 .device_create= cuda_device_create,
+.frames_get_constraints = cuda_frames_get_constraints,
 .frames_init  = cuda_frames_init,
 .frames_get_buffer= cuda_get_buffer,
 .transfer_get_formats = cuda_transfer_get_formats,

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


[FFmpeg-cvslog] Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 15:58:40 
2017 -0300| [318778de9ebec276cb9dfc65509231ca56590d13] | committer: James Almer

Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'

* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3':
  Mark some arrays that never change as const.

Merged-by: James Almer 

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

 configure   |  2 +-
 libavcodec/aaccoder.c   |  2 +-
 libavcodec/aacenc.h |  4 ++--
 libavcodec/amrwbdata.h  |  2 +-
 libavcodec/atrac3plus.c |  4 ++--
 libavcodec/dfa.c|  2 +-
 libavcodec/g722dec.c|  4 ++--
 libavcodec/on2avcdata.c | 16 
 libavcodec/on2avcdata.h | 20 ++--
 libavcodec/opus_silk.c  |  6 +++---
 libavcodec/qsvdec_h2645.c   |  4 ++--
 libavcodec/qsvenc_hevc.c|  4 ++--
 libavcodec/tscc2data.h  |  6 +++---
 libavcodec/vaapi_encode.c   |  2 +-
 libavcodec/vaapi_encode_mjpeg.c |  2 +-
 libavcodec/vp8.c|  8 
 libavcodec/vp9block.c   |  2 +-
 libavcodec/x86/mlpdsp_init.c| 12 ++--
 libavformat/hls.c   |  4 ++--
 libavformat/id3v2.c |  2 +-
 libavformat/id3v2.h |  2 +-
 libavformat/mxfdec.c|  2 +-
 libavutil/hwcontext.c   |  2 +-
 libavutil/hwcontext_vaapi.c |  2 +-
 libavutil/pixdesc.c | 10 +-
 libavutil/stereo3d.c|  2 +-
 26 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/configure b/configure
index f0c114e9e3..70b7677983 100755
--- a/configure
+++ b/configure
@@ -7034,7 +7034,7 @@ print_enabled_components(){
 struct_name=$2
 name=$3
 shift 3
-echo "static const $struct_name *$name[] = {" > $TMPH
+echo "static const $struct_name * const $name[] = {" > $TMPH
 for c in $*; do
 enabled $c && printf "_%s,\n" $c >> $TMPH
 done
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index abd0b9c636..baa82489b1 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -894,7 +894,7 @@ static void search_for_ms(AACEncContext *s, ChannelElement 
*cpe)
 }
 }
 
-AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
+const AACCoefficientsEncoder ff_aac_coders[AAC_CODER_NB] = {
 [AAC_CODER_ANMR] = {
 search_for_quantizers_anmr,
 encode_window_bands_info,
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 9d244fd1f5..ea2d3b9628 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -78,7 +78,7 @@ typedef struct AACCoefficientsEncoder {
 void (*search_for_pred)(struct AACEncContext *s, SingleChannelElement 
*sce);
 } AACCoefficientsEncoder;
 
-extern AACCoefficientsEncoder ff_aac_coders[];
+extern const AACCoefficientsEncoder ff_aac_coders[];
 
 typedef struct AACQuantizeBandCostCacheEntry {
 float rd;
@@ -110,7 +110,7 @@ typedef struct AACEncContext {
 ChannelElement *cpe; ///< channel elements
 FFPsyContext psy;
 struct FFPsyPreprocessContext* psypp;
-AACCoefficientsEncoder *coder;
+const AACCoefficientsEncoder *coder;
 int cur_channel; ///< current channel for 
coder context
 int random_state;
 float lambda;
diff --git a/libavcodec/amrwbdata.h b/libavcodec/amrwbdata.h
index e0152a651e..8a8cbfdddf 100644
--- a/libavcodec/amrwbdata.h
+++ b/libavcodec/amrwbdata.h
@@ -673,7 +673,7 @@ static const uint16_t order_MODE_23k85[] = {
 };
 
 /** Reordering array addresses for each mode */
-static const uint16_t* amr_bit_orderings_by_mode[] = {
+static const uint16_t * const amr_bit_orderings_by_mode[] = {
 order_MODE_6k60,
 order_MODE_8k85,
 order_MODE_12k65,
diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c
index 46e0beafc2..3e3bba801b 100644
--- a/libavcodec/atrac3plus.c
+++ b/libavcodec/atrac3plus.c
@@ -109,8 +109,8 @@ av_cold void ff_atrac3p_init_vlcs(void)
 NULL, NULL, atrac3p_ct_huff_xlat1, NULL
 };
 
-static const  int sf_nb_bits[8]  = {  9,  9,  9,  9,  6,  6,  7,  7 };
-static const  int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 };
+static const int sf_nb_bits[8]  = {  9,  9,  9,  9,  6,  6,  7,  7 };
+static const int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 };
 static const uint8_t  * const sf_bits[8]  = {
 atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits2,
 atrac3p_sf_huff_bits3, atrac3p_sf_huff_bits4, atrac3p_sf_huff_bits4,
diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c
index 8067ac94e5..43dba2c8e9 100644
--- a/libavcodec/dfa.c
+++ b/libavcodec/dfa.c
@@ -330,7 +330,7 @@ static const chunk_decoder decoder[8] = {
 decode_tdlt, decode_dsw1, decode_blck, decode_dds1,
 };
 
-static const char* chunk_name[8] = {
+static const char * const 

[FFmpeg-cvslog] Mark some arrays that never change as const.

2017-09-26 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Sun Jul  3 
10:09:36 2016 +0200| [fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3] | committer: 
Anton Khirnov

Mark some arrays that never change as const.

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

 configure   |  2 +-
 libavcodec/aaccoder.c   |  4 ++--
 libavcodec/aacenc.c |  4 ++--
 libavcodec/aacenc.h |  4 ++--
 libavcodec/aic.c|  2 +-
 libavcodec/amrnbdata.h  |  4 ++--
 libavcodec/amrwbdata.h  |  4 ++--
 libavcodec/atrac3plus.c | 38 +++---
 libavcodec/dfa.c|  2 +-
 libavcodec/g722dec.c|  6 +++---
 libavcodec/h263data.c   |  4 ++--
 libavcodec/h263data.h   |  4 ++--
 libavcodec/indeo3.c |  4 ++--
 libavcodec/indeo4data.h |  2 +-
 libavcodec/mpeg4videodec.c  |  2 +-
 libavcodec/on2avc.c |  4 ++--
 libavcodec/on2avcdata.c | 20 ++--
 libavcodec/on2avcdata.h | 20 ++--
 libavcodec/opus_silk.c  |  6 +++---
 libavcodec/qsvdec_h2645.c   |  4 ++--
 libavcodec/qsvenc_hevc.c|  4 ++--
 libavcodec/sipr.c   |  2 +-
 libavcodec/sipr16k.c|  2 +-
 libavcodec/sipr16kdata.h|  2 +-
 libavcodec/siprdata.h   |  2 +-
 libavcodec/tscc2data.h  |  6 +++---
 libavcodec/vaapi_encode.c   |  2 +-
 libavcodec/vaapi_encode_mjpeg.c |  2 +-
 libavcodec/vp8.c|  8 
 libavcodec/vp9block.c   |  4 ++--
 libavcodec/vp9data.c|  4 ++--
 libavcodec/vp9data.h|  4 ++--
 libavcodec/x86/fdct.c   |  4 ++--
 libavcodec/x86/mlpdsp.c | 16 
 libavcodec/x86/videodsp_init.c  | 12 ++--
 libavfilter/af_volume.c |  2 +-
 libavfilter/vf_drawtext.c   |  2 +-
 libavfilter/vf_libopencv.c  |  4 ++--
 libavfilter/vf_overlay.c|  2 +-
 libavformat/hls.c   |  4 ++--
 libavformat/id3v2.c |  2 +-
 libavformat/id3v2.h |  2 +-
 libavformat/mov_chan.c  |  2 +-
 libavformat/movenc.c|  2 +-
 libavformat/mxfdec.c|  2 +-
 libavresample/audio_mix.c   |  2 +-
 libavutil/hwcontext.c   |  2 +-
 libavutil/hwcontext_vaapi.c |  2 +-
 libavutil/parseutils.c  |  2 +-
 libavutil/pixdesc.c | 10 +-
 libavutil/stereo3d.c|  2 +-
 51 files changed, 129 insertions(+), 129 deletions(-)

diff --git a/configure b/configure
index a2223022cb..64c077465d 100755
--- a/configure
+++ b/configure
@@ -5414,7 +5414,7 @@ print_enabled_components(){
 struct_name=$2
 name=$3
 shift 3
-echo "static const $struct_name *$name[] = {" > $TMPH
+echo "static const $struct_name * const $name[] = {" > $TMPH
 for c in $*; do
 enabled $c && printf "_%s,\n" $c >> $TMPH
 done
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index ee89148ef4..a654844cd0 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -53,7 +53,7 @@ static const uint8_t run_value_bits_short[16] = {
 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 9
 };
 
-static const uint8_t *run_value_bits[2] = {
+static const uint8_t * const run_value_bits[2] = {
 run_value_bits_long, run_value_bits_short
 };
 
@@ -1112,7 +1112,7 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe,
 }
 }
 
-AACCoefficientsEncoder ff_aac_coders[] = {
+const AACCoefficientsEncoder ff_aac_coders[] = {
 {
 search_for_quantizers_faac,
 encode_window_bands_info,
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index c247c5b390..9b0e99b28d 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -98,7 +98,7 @@ static const uint8_t swb_size_1024_8[] = {
 32, 36, 36, 40, 44, 48, 52, 56, 60, 64, 80
 };
 
-static const uint8_t *swb_size_1024[] = {
+static const uint8_t * const swb_size_1024[] = {
 swb_size_1024_96, swb_size_1024_96, swb_size_1024_64,
 swb_size_1024_48, swb_size_1024_48, swb_size_1024_32,
 swb_size_1024_24, swb_size_1024_24, swb_size_1024_16,
@@ -125,7 +125,7 @@ static const uint8_t swb_size_128_8[] = {
 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 12, 16, 20, 20
 };
 
-static const uint8_t *swb_size_128[] = {
+static const uint8_t * const swb_size_128[] = {
 /* the last entry on the following row is swb_size_128_64 but is a
duplicate of swb_size_128_96 */
 swb_size_128_96, swb_size_128_96, swb_size_128_96,
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index dec445ce34..f77b2002e4 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -46,7 +46,7 @@ typedef struct AACCoefficientsEncoder {
 void (*search_for_ms)(struct AACEncContext *s, ChannelElement *cpe, const 
float lambda);
 } AACCoefficientsEncoder;
 
-extern AACCoefficientsEncoder 

[FFmpeg-cvslog] avconv: allow -b to be used with streamcopy

2017-09-26 Thread Anton Khirnov
ffmpeg | branch: master | Anton Khirnov  | Mon Jan 30 
21:35:42 2017 +0100| [b420a27e74750b60d2e064236afb10be06a38ace] | committer: 
Anton Khirnov

avconv: allow -b to be used with streamcopy

In this mode it tells the muxer about the bitrate of the input stream.

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

 avconv.c|  3 +++
 avconv.h|  5 +
 avconv_opt.c| 11 +++
 doc/avconv.texi |  7 +++
 4 files changed, 26 insertions(+)

diff --git a/avconv.c b/avconv.c
index fe606250fe..94b6da2a8b 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1852,6 +1852,9 @@ static int init_output_stream_streamcopy(OutputStream 
*ost)
 
 ost->st->time_base = ist->st->time_base;
 
+if (ost->bitrate_override)
+par_dst->bit_rate = ost->bitrate_override;
+
 if (ist->st->nb_side_data) {
 ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
   sizeof(*ist->st->side_data));
diff --git a/avconv.h b/avconv.h
index 6360f76c0b..3c3f0ef659 100644
--- a/avconv.h
+++ b/avconv.h
@@ -162,6 +162,8 @@ typedef struct OptionsContext {
 intnb_sample_fmts;
 SpecifierOpt *qscale;
 intnb_qscale;
+SpecifierOpt *bitrates;
+intnb_bitrates;
 SpecifierOpt *forced_key_frames;
 intnb_forced_key_frames;
 SpecifierOpt *force_fps;
@@ -382,6 +384,9 @@ typedef struct OutputStream {
 int forced_kf_index;
 char *forced_keyframes;
 
+// the bitrate to send to the muxer for streamcopy
+int bitrate_override;
+
 char *logfile_prefix;
 FILE *logfile;
 
diff --git a/avconv_opt.c b/avconv_opt.c
index 8b43f0f4e2..e078a0b89d 100644
--- a/avconv_opt.c
+++ b/avconv_opt.c
@@ -952,6 +952,7 @@ static OutputStream *new_output_stream(OptionsContext *o, 
AVFormatContext *oc, e
 const char *bsfs = NULL;
 char *next, *codec_tag = NULL;
 double qscale = -1;
+int bitrate = 0;
 
 if (!st) {
 av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
@@ -1091,6 +1092,14 @@ static OutputStream *new_output_stream(OptionsContext 
*o, AVFormatContext *oc, e
 ost->enc_ctx->global_quality = FF_QP2LAMBDA * qscale;
 }
 
+MATCH_PER_STREAM_OPT(bitrates, i, bitrate, oc, st);
+if (bitrate > 0) {
+if (ost->stream_copy)
+ost->bitrate_override = bitrate;
+else
+ost->enc_ctx->bit_rate = bitrate;
+}
+
 ost->max_muxing_queue_size = 128;
 MATCH_PER_STREAM_OPT(max_muxing_queue_size, i, ost->max_muxing_queue_size, 
oc, st);
 ost->max_muxing_queue_size *= sizeof(AVPacket);
@@ -2570,6 +2579,8 @@ const OptionDef options[] = {
 { "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE |
 OPT_SPEC | OPT_OUTPUT,   { .off = 
OFFSET(qscale) },
 "use fixed quality scale (VBR)", "q" },
+{ "b",  HAS_ARG | OPT_INT | OPT_SPEC | OPT_OUTPUT,{ .off = 
OFFSET(bitrates) },
+"set stream bitrate in bits/second", "bitrate" },
 { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = 
OFFSET(filters) },
 "set stream filterchain", "filter_list" },
 { "filter_script",  HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = 
OFFSET(filter_scripts) },
diff --git a/doc/avconv.texi b/doc/avconv.texi
index 002dba3184..6f1fbc79b2 100644
--- a/doc/avconv.texi
+++ b/doc/avconv.texi
@@ -354,6 +354,13 @@ Stop writing to the stream after @var{framecount} frames.
 Use fixed quality scale (VBR). The meaning of @var{q} is
 codec-dependent.
 
+@item -b[:@var{stream_specifier}] @var{bitrate} (@emph{output,per-stream})
+Set the stream bitrate in bits per second. When transcoding, this tells the
+encoder to use the specified bitrate for the encoded stream.
+
+For streamcopy, this provides a hint to the muxer about the bitrate of the 
input
+stream.
+
 @item -filter[:@var{stream_specifier}] @var{filter_graph} 
(@emph{output,per-stream})
 @var{filter_graph} is a description of the filter graph to apply to
 the stream. Use @code{-filters} to show all the available filters

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


[FFmpeg-cvslog] Merge commit 'b420a27e74750b60d2e064236afb10be06a38ace'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 15:44:19 
2017 -0300| [2508e606fba86f2e460eebb045e29e1f069a4d72] | committer: James Almer

Merge commit 'b420a27e74750b60d2e064236afb10be06a38ace'

* commit 'b420a27e74750b60d2e064236afb10be06a38ace':
  avconv: allow -b to be used with streamcopy

This commit is a noop. We already have this functionality.

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] ralf: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Tue Mar 
22 10:26:03 2016 +0100| [5a6da49dd0c078b7d20e130ab74f326abc4678a1] | committer: 
Diego Biurrun

ralf: Convert to the new bitstream reader

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

 libavcodec/ralf.c | 68 ---
 1 file changed, 35 insertions(+), 33 deletions(-)

diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c
index 6bc0f3fa0d..1003b10c11 100644
--- a/libavcodec/ralf.c
+++ b/libavcodec/ralf.c
@@ -28,11 +28,13 @@
 
 #include "libavutil/attributes.h"
 #include "libavutil/channel_layout.h"
+
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "internal.h"
-#include "unary_legacy.h"
+#include "unary.h"
+#include "vlc.h"
 #include "ralfdata.h"
 
 #define FILTER_NONE 0
@@ -210,21 +212,21 @@ static av_cold int decode_init(AVCodecContext *avctx)
 return 0;
 }
 
-static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
+static inline int extend_code(BitstreamContext *bc, int val, int range, int 
bits)
 {
 if (val == 0) {
-val = -range - get_ue_golomb(gb);
+val = -range - get_ue_golomb(bc);
 } else if (val == range * 2) {
-val =  range + get_ue_golomb(gb);
+val =  range + get_ue_golomb(bc);
 } else {
 val -= range;
 }
 if (bits)
-val = (val << bits) | get_bits(gb, bits);
+val = (val << bits) | bitstream_read(bc, bits);
 return val;
 }
 
-static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch,
+static int decode_channel(RALFContext *ctx, BitstreamContext *bc, int ch,
   int length, int mode, int bits)
 {
 int i, t;
@@ -233,19 +235,19 @@ static int decode_channel(RALFContext *ctx, GetBitContext 
*gb, int ch,
 VLC *code_vlc; int range, range2, add_bits;
 int *dst = ctx->channel_data[ch];
 
-ctx->filter_params = get_vlc2(gb, set->filter_params.table, 9, 2);
+ctx->filter_params = bitstream_read_vlc(bc, set->filter_params.table, 9, 
2);
 ctx->filter_bits   = (ctx->filter_params - 2) >> 6;
 ctx->filter_length = ctx->filter_params - (ctx->filter_bits << 6) - 1;
 
 if (ctx->filter_params == FILTER_RAW) {
 for (i = 0; i < length; i++)
-dst[i] = get_bits(gb, bits);
+dst[i] = bitstream_read(bc, bits);
 ctx->bias[ch] = 0;
 return 0;
 }
 
-ctx->bias[ch] = get_vlc2(gb, set->bias.table, 9, 2);
-ctx->bias[ch] = extend_code(gb, ctx->bias[ch], 127, 4);
+ctx->bias[ch] = bitstream_read_vlc(bc, set->bias.table, 9, 2);
+ctx->bias[ch] = extend_code(bc, ctx->bias[ch], 127, 4);
 
 if (ctx->filter_params == FILTER_NONE) {
 memset(dst, 0, sizeof(*dst) * length);
@@ -259,8 +261,8 @@ static int decode_channel(RALFContext *ctx, GetBitContext 
*gb, int ch,
 add_bits = ctx->filter_bits;
 
 for (i = 0; i < ctx->filter_length; i++) {
-t = get_vlc2(gb, vlc[cmode].table, vlc[cmode].bits, 2);
-t = extend_code(gb, t, 21, add_bits);
+t = bitstream_read_vlc(bc, vlc[cmode].table, vlc[cmode].bits, 2);
+t = extend_code(bc, t, 21, add_bits);
 if (!cmode)
 coeff -= 12 << add_bits;
 coeff = t - coeff;
@@ -279,7 +281,7 @@ static int decode_channel(RALFContext *ctx, GetBitContext 
*gb, int ch,
 }
 }
 
-code_params = get_vlc2(gb, set->coding_mode.table, set->coding_mode.bits, 
2);
+code_params = bitstream_read_vlc(bc, set->coding_mode.table, 
set->coding_mode.bits, 2);
 if (code_params >= 15) {
 add_bits = av_clip((code_params / 5 - 3) / 2, 0, 10);
 if (add_bits > 9 && (code_params % 5) != 2)
@@ -297,14 +299,14 @@ static int decode_channel(RALFContext *ctx, GetBitContext 
*gb, int ch,
 for (i = 0; i < length; i += 2) {
 int code1, code2;
 
-t = get_vlc2(gb, code_vlc->table, code_vlc->bits, 2);
+t = bitstream_read_vlc(bc, code_vlc->table, code_vlc->bits, 2);
 code1 = t / range2;
 code2 = t % range2;
-dst[i] = extend_code(gb, code1, range, 0) << add_bits;
-dst[i + 1] = extend_code(gb, code2, range, 0) << add_bits;
+dst[i] = extend_code(bc, code1, range, 0) << add_bits;
+dst[i + 1] = extend_code(bc, code2, range, 0) << add_bits;
 if (add_bits) {
-dst[i] |= get_bits(gb, add_bits);
-dst[i + 1] |= get_bits(gb, add_bits);
+dst[i] |= bitstream_read(bc, add_bits);
+dst[i + 1] |= bitstream_read(bc, add_bits);
 }
 }
 
@@ -335,7 +337,7 @@ static void apply_lpc(RALFContext *ctx, int ch, int length, 
int bits)
 }
 }
 
-static int decode_block(AVCodecContext *avctx, GetBitContext *gb,
+static int decode_block(AVCodecContext *avctx, BitstreamContext *bc,
  

[FFmpeg-cvslog] dirac: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Mar 
19 15:39:03 2016 +0100| [6b1f559f9a0667390259374c738132ad9475fd39] | committer: 
Diego Biurrun

dirac: Convert to the new bitstream reader

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

 libavcodec/dirac.c | 89 +++---
 1 file changed, 45 insertions(+), 44 deletions(-)

diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index cce9439d44..5faf0a384d 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -28,8 +28,9 @@
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
+#include "bitstream.h"
 #include "dirac.h"
-#include "golomb_legacy.h"
+#include "golomb.h"
 #include "internal.h"
 #include "mpeg12data.h"
 
@@ -138,7 +139,7 @@ static const enum AVPixelFormat dirac_pix_fmt[2][3] = {
 
 /* [DIRAC_STD] 10.3 Parse Source Parameters.
  * source_parameters(base_video_format) */
-static int parse_source_parameters(AVDiracSeqHeader *dsh, GetBitContext *gb,
+static int parse_source_parameters(AVDiracSeqHeader *dsh, BitstreamContext *bc,
void *log_ctx)
 {
 AVRational frame_rate = { 0, 0 };
@@ -147,17 +148,17 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
GetBitContext *gb,
 
 /* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */
 /* [DIRAC_STD] custom_dimensions_flag */
-if (get_bits1(gb)) {
-dsh->width  = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] 
FRAME_WIDTH  */
-dsh->height = get_interleaved_ue_golomb(gb); /* [DIRAC_STD] 
FRAME_HEIGHT */
+if (bitstream_read_bit(bc)) {
+dsh->width  = get_interleaved_ue_golomb(bc); /* [DIRAC_STD] 
FRAME_WIDTH  */
+dsh->height = get_interleaved_ue_golomb(bc); /* [DIRAC_STD] 
FRAME_HEIGHT */
 }
 
 /* [DIRAC_STD] 10.3.3 Chroma Sampling Format.
  *  chroma_sampling_format(video_params) */
 /* [DIRAC_STD] custom_chroma_format_flag */
-if (get_bits1(gb))
+if (bitstream_read_bit(bc))
 /* [DIRAC_STD] CHROMA_FORMAT_INDEX */
-dsh->chroma_format = get_interleaved_ue_golomb(gb);
+dsh->chroma_format = get_interleaved_ue_golomb(bc);
 if (dsh->chroma_format > 2) {
 if (log_ctx)
 av_log(log_ctx, AV_LOG_ERROR, "Unknown chroma format %d\n",
@@ -167,24 +168,24 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
GetBitContext *gb,
 
 /* [DIRAC_STD] 10.3.4 Scan Format. scan_format(video_params) */
 /* [DIRAC_STD] custom_scan_format_flag */
-if (get_bits1(gb))
+if (bitstream_read_bit(bc))
 /* [DIRAC_STD] SOURCE_SAMPLING */
-dsh->interlaced = get_interleaved_ue_golomb(gb);
+dsh->interlaced = get_interleaved_ue_golomb(bc);
 if (dsh->interlaced > 1)
 return AVERROR_INVALIDDATA;
 
 /* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */
-if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */
-dsh->frame_rate_index = get_interleaved_ue_golomb(gb);
+if (bitstream_read_bit(bc)) { /* [DIRAC_STD] custom_frame_rate_flag */
+dsh->frame_rate_index = get_interleaved_ue_golomb(bc);
 
 if (dsh->frame_rate_index > 10)
 return AVERROR_INVALIDDATA;
 
 if (!dsh->frame_rate_index) {
 /* [DIRAC_STD] FRAME_RATE_NUMER */
-frame_rate.num = get_interleaved_ue_golomb(gb);
+frame_rate.num = get_interleaved_ue_golomb(bc);
 /* [DIRAC_STD] FRAME_RATE_DENOM */
-frame_rate.den = get_interleaved_ue_golomb(gb);
+frame_rate.den = get_interleaved_ue_golomb(bc);
 }
 }
 /* [DIRAC_STD] preset_frame_rate(video_params, index) */
@@ -199,16 +200,16 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
GetBitContext *gb,
 
 /* [DIRAC_STD] 10.3.6 Pixel Aspect Ratio.
  * pixel_aspect_ratio(video_params) */
-if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */
+if (bitstream_read_bit(bc)) { /* [DIRAC_STD] 
custom_pixel_aspect_ratio_flag */
 /* [DIRAC_STD] index */
-dsh->aspect_ratio_index = get_interleaved_ue_golomb(gb);
+dsh->aspect_ratio_index = get_interleaved_ue_golomb(bc);
 
 if (dsh->aspect_ratio_index > 6)
 return AVERROR_INVALIDDATA;
 
 if (!dsh->aspect_ratio_index) {
-dsh->sample_aspect_ratio.num = get_interleaved_ue_golomb(gb);
-dsh->sample_aspect_ratio.den = get_interleaved_ue_golomb(gb);
+dsh->sample_aspect_ratio.num = get_interleaved_ue_golomb(bc);
+dsh->sample_aspect_ratio.den = get_interleaved_ue_golomb(bc);
 }
 }
 /* [DIRAC_STD] Take value from Table 10.4 Available preset pixel
@@ -218,33 +219,33 @@ static int parse_source_parameters(AVDiracSeqHeader *dsh, 
GetBitContext *gb,
 dirac_preset_aspect_ratios[dsh->aspect_ratio_index - 1];
 
 /* [DIRAC_STD] 10.3.7 Clean area. 

[FFmpeg-cvslog] shorten: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Tue Mar 
22 16:09:39 2016 +0100| [2b94ed12de7b6b7f444ed67e1a7068141af3d4ff] | committer: 
Diego Biurrun

shorten: Convert to the new bitstream reader

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

 libavcodec/shorten.c | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 82fa2ab943..e040b9cfed 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -26,10 +26,11 @@
  */
 
 #include 
+
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bytestream.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "golomb.h"
 #include "internal.h"
 
 #define MAX_CHANNELS 8
@@ -79,7 +80,7 @@ static const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 
0, 0, 1, 1, 0 };
 
 typedef struct ShortenContext {
 AVCodecContext *avctx;
-GetBitContext gb;
+BitstreamContext bc;
 
 int min_framesize, max_framesize;
 unsigned channels;
@@ -154,8 +155,8 @@ static int allocate_buffers(ShortenContext *s)
 static inline unsigned int get_uint(ShortenContext *s, int k)
 {
 if (s->version != 0)
-k = get_ur_golomb_shorten(>gb, ULONGSIZE);
-return get_ur_golomb_shorten(>gb, k);
+k = get_ur_golomb_shorten(>bc, ULONGSIZE);
+return get_ur_golomb_shorten(>bc, k);
 }
 
 static void fix_bitshift(ShortenContext *s, int32_t *buffer)
@@ -280,7 +281,7 @@ static int decode_subframe_lpc(ShortenContext *s, int 
command, int channel,
 
 if (command == FN_QLPC) {
 /* read/validate prediction order */
-pred_order = get_ur_golomb_shorten(>gb, LPCQSIZE);
+pred_order = get_ur_golomb_shorten(>bc, LPCQSIZE);
 if (pred_order > s->nwrap) {
 av_log(s->avctx, AV_LOG_ERROR, "invalid pred_order %d\n",
pred_order);
@@ -288,7 +289,7 @@ static int decode_subframe_lpc(ShortenContext *s, int 
command, int channel,
 }
 /* read LPC coefficients */
 for (i = 0; i < pred_order; i++)
-s->coeffs[i] = get_sr_golomb_shorten(>gb, LPCQUANT);
+s->coeffs[i] = get_sr_golomb_shorten(>bc, LPCQUANT);
 coeffs = s->coeffs;
 
 qshift = LPCQUANT;
@@ -315,7 +316,7 @@ static int decode_subframe_lpc(ShortenContext *s, int 
command, int channel,
 sum = init_sum;
 for (j = 0; j < pred_order; j++)
 sum += coeffs[j] * s->decoded[channel][i - j - 1];
-s->decoded[channel][i] = get_sr_golomb_shorten(>gb, residual_size) +
+s->decoded[channel][i] = get_sr_golomb_shorten(>bc, residual_size) +
  (sum >> qshift);
 }
 
@@ -332,7 +333,7 @@ static int read_header(ShortenContext *s)
 int i, ret;
 int maxnlpc = 0;
 /* shorten signature */
-if (get_bits_long(>gb, 32) != AV_RB32("ajkg")) {
+if (bitstream_read(>bc, 32) != AV_RB32("ajkg")) {
 av_log(s->avctx, AV_LOG_ERROR, "missing shorten magic 'ajkg'\n");
 return AVERROR_INVALIDDATA;
 }
@@ -340,7 +341,7 @@ static int read_header(ShortenContext *s)
 s->lpcqoffset = 0;
 s->blocksize  = DEFAULT_BLOCK_SIZE;
 s->nmean  = -1;
-s->version= get_bits(>gb, 8);
+s->version= bitstream_read(>bc, 8);
 s->internal_ftype = get_uint(s, TYPESIZE);
 
 s->channels = get_uint(s, CHANSIZE);
@@ -374,7 +375,7 @@ static int read_header(ShortenContext *s)
 
 skip_bytes = get_uint(s, NSKIPSIZE);
 for (i = 0; i < skip_bytes; i++)
-skip_bits(>gb, 8);
+bitstream_skip(>bc, 8);
 }
 s->nwrap = FFMAX(NWRAP, maxnlpc);
 
@@ -387,13 +388,13 @@ static int read_header(ShortenContext *s)
 if (s->version > 1)
 s->lpcqoffset = V2LPCQOFFSET;
 
-if (get_ur_golomb_shorten(>gb, FNSIZE) != FN_VERBATIM) {
+if (get_ur_golomb_shorten(>bc, FNSIZE) != FN_VERBATIM) {
 av_log(s->avctx, AV_LOG_ERROR,
"missing verbatim section at beginning of stream\n");
 return AVERROR_INVALIDDATA;
 }
 
-s->header_size = get_ur_golomb_shorten(>gb, VERBATIM_CKSIZE_SIZE);
+s->header_size = get_ur_golomb_shorten(>bc, VERBATIM_CKSIZE_SIZE);
 if (s->header_size >= OUT_BUFFER_SIZE ||
 s->header_size < CANONICAL_HEADER_SIZE) {
 av_log(s->avctx, AV_LOG_ERROR, "header is wrong size: %d\n",
@@ -402,7 +403,7 @@ static int read_header(ShortenContext *s)
 }
 
 for (i = 0; i < s->header_size; i++)
-s->header[i] = (char)get_ur_golomb_shorten(>gb, VERBATIM_BYTE_SIZE);
+s->header[i] = (char)get_ur_golomb_shorten(>bc, VERBATIM_BYTE_SIZE);
 
 if ((ret = decode_wave_header(s->avctx, s->header, s->header_size)) < 0)
 return ret;
@@ -464,8 +465,8 @@ static int shorten_decode_frame(AVCodecContext *avctx, void 
*data,
 }
 }
 /* init and position bitstream 

[FFmpeg-cvslog] loco: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Mon Mar 
21 20:23:36 2016 +0100| [d85b37a955317f176f3443a40859a21c15d7c3bc] | committer: 
Diego Biurrun

loco: Convert to the new bitstream reader

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

 libavcodec/loco.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavcodec/loco.c b/libavcodec/loco.c
index 8624ea86ad..fa4c5edb40 100644
--- a/libavcodec/loco.c
+++ b/libavcodec/loco.c
@@ -25,8 +25,8 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "internal.h"
 #include "mathops.h"
 
@@ -50,7 +50,7 @@ typedef struct LOCOContext {
 } LOCOContext;
 
 typedef struct RICEContext {
-GetBitContext gb;
+BitstreamContext bc;
 int save, run, run2; /* internal rice decoder state */
 int sum, count; /* sum and count for getting rice parameter */
 int lossy;
@@ -88,11 +88,11 @@ static inline int loco_get_rice(RICEContext *r)
 loco_update_rice_param(r, 0);
 return 0;
 }
-v = get_ur_golomb_jpegls(>gb, loco_get_rice_param(r), INT_MAX, 0);
+v = get_ur_golomb_jpegls(>bc, loco_get_rice_param(r), INT_MAX, 0);
 loco_update_rice_param(r, (v + 1) >> 1);
 if (!v) {
 if (r->save >= 0) {
-r->run = get_ur_golomb_jpegls(>gb, 2, INT_MAX, 0);
+r->run = get_ur_golomb_jpegls(>bc, 2, INT_MAX, 0);
 if (r->run > 1)
 r->save += r->run + 1;
 else
@@ -132,7 +132,7 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, 
int width, int heigh
 int val;
 int i, j;
 
-init_get_bits(, buf, buf_size*8);
+bitstream_init8(, buf, buf_size);
 rc.save  = 0;
 rc.run   = 0;
 rc.run2  = 0;
@@ -162,7 +162,7 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, 
int width, int heigh
 data += stride;
 }
 
-return (get_bits_count() + 7) >> 3;
+return (bitstream_tell() + 7) >> 3;
 }
 
 static int decode_frame(AVCodecContext *avctx,

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


[FFmpeg-cvslog] h261dec: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sun Apr 
10 11:44:20 2016 +0200| [2d72219554adb09bc3ba044ac3e579a84550067b] | committer: 
Diego Biurrun

h261dec: Convert to the new bitstream reader

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

 libavcodec/h261dec.c   | 92 ++
 libavcodec/mpegvideo.h |  3 ++
 libavformat/h261dec.c  | 11 +++---
 3 files changed, 56 insertions(+), 50 deletions(-)

diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 9a323ec7d1..b08598ec99 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -26,12 +26,14 @@
  */
 
 #include "avcodec.h"
+#include "bitstream.h"
 #include "mpeg_er.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "h263.h"
 #include "h261.h"
 #include "internal.h"
+#include "vlc.h"
 
 #define H261_MBA_VLC_BITS 9
 #define H261_MTYPE_VLC_BITS 6
@@ -103,18 +105,18 @@ static int h261_decode_gob_header(H261Context *h)
 
 if (!h->gob_start_code_skipped) {
 /* Check for GOB Start Code */
-val = show_bits(>gb, 15);
+val = bitstream_peek(>bc, 15);
 if (val)
 return -1;
 
 /* We have a GBSC */
-skip_bits(>gb, 16);
+bitstream_skip(>bc, 16);
 }
 
 h->gob_start_code_skipped = 0;
 
-h->gob_number = get_bits(>gb, 4); /* GN */
-s->qscale = get_bits(>gb, 5); /* GQUANT */
+h->gob_number = bitstream_read(>bc, 4); /* GN */
+s->qscale = bitstream_read(>bc, 5); /* GQUANT */
 
 /* Check if gob_number is valid */
 if (s->mb_height == 18) { // CIF
@@ -127,8 +129,8 @@ static int h261_decode_gob_header(H261Context *h)
 }
 
 /* GEI */
-while (get_bits1(>gb) != 0)
-skip_bits(>gb, 8);
+while (bitstream_read_bit(>bc) != 0)
+bitstream_skip(>bc, 8);
 
 if (s->qscale == 0) {
 av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n");
@@ -160,27 +162,27 @@ static int h261_resync(H261Context *h)
 if (ret >= 0)
 return 0;
 } else {
-if (show_bits(>gb, 15) == 0) {
+if (bitstream_peek(>bc, 15) == 0) {
 ret = h261_decode_gob_header(h);
 if (ret >= 0)
 return 0;
 }
 // OK, it is not where it is supposed to be ...
-s->gb = s->last_resync_gb;
-align_get_bits(>gb);
-left = get_bits_left(>gb);
+s->bc = s->last_resync_bc;
+bitstream_align(>bc);
+left = bitstream_bits_left(>bc);
 
 for (; left > 15 + 1 + 4 + 5; left -= 8) {
-if (show_bits(>gb, 15) == 0) {
-GetBitContext bak = s->gb;
+if (bitstream_peek(>bc, 15) == 0) {
+BitstreamContext bak = s->bc;
 
 ret = h261_decode_gob_header(h);
 if (ret >= 0)
 return 0;
 
-s->gb = bak;
+s->bc = bak;
 }
-skip_bits(>gb, 8);
+bitstream_skip(>bc, 8);
 }
 }
 
@@ -228,9 +230,9 @@ static const int mvmap[17] = {
 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16
 };
 
-static int decode_mv_component(GetBitContext *gb, int v)
+static int decode_mv_component(BitstreamContext *bc, int v)
 {
-int mv_diff = get_vlc2(gb, h261_mv_vlc.table, H261_MV_VLC_BITS, 2);
+int mv_diff = bitstream_read_vlc(bc, h261_mv_vlc.table, H261_MV_VLC_BITS, 
2);
 
 /* check if mv_diff is valid */
 if (mv_diff < 0)
@@ -238,7 +240,7 @@ static int decode_mv_component(GetBitContext *gb, int v)
 
 mv_diff = mvmap[mv_diff];
 
-if (mv_diff && !get_bits1(gb))
+if (mv_diff && !bitstream_read_bit(bc))
 mv_diff = -mv_diff;
 
 v += mv_diff;
@@ -270,7 +272,7 @@ static int h261_decode_block(H261Context *h, int16_t 
*block, int n, int coded)
 scan_table = s->intra_scantable.permutated;
 if (s->mb_intra) {
 /* DC coef */
-level = get_bits(>gb, 8);
+level = bitstream_read(>bc, 8);
 // 0 (b) and -128 (1000b) are FORBIDDEN
 if ((level & 0x7F) == 0) {
 av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n",
@@ -288,10 +290,10 @@ static int h261_decode_block(H261Context *h, int16_t 
*block, int n, int coded)
 // EOB  Not possible for first level when cbp is available 
(that's why the table is different)
 // 01   1s
 // **   0*
-int check = show_bits(>gb, 2);
+int check = bitstream_peek(>bc, 2);
 i = 0;
 if (check & 0x2) {
-skip_bits(>gb, 2);
+bitstream_skip(>bc, 2);
 block[0] = (check & 0x1) ? -1 : 1;
 i= 1;
 }
@@ -303,7 +305,7 @@ static int h261_decode_block(H261Context *h, int16_t 
*block, int n, int coded)
 return 0;
 }
 for (;;) {
-code = get_vlc2(>gb, 

[FFmpeg-cvslog] ffv1: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Mar 
19 17:32:04 2016 +0100| [ab2539bd374fe7ddbc6e2f058b62645cd5076192] | committer: 
Diego Biurrun

ffv1: Convert to the new bitstream reader

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

 libavcodec/ffv1.h|  4 ++--
 libavcodec/ffv1dec.c | 24 
 libavcodec/ffv1enc.c |  2 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
index 34370fa143..7e0465abaa 100644
--- a/libavcodec/ffv1.h
+++ b/libavcodec/ffv1.h
@@ -26,7 +26,7 @@
 #include 
 
 #include "avcodec.h"
-#include "get_bits.h"
+#include "bitstream.h"
 #include "put_bits.h"
 #include "rangecoder.h"
 
@@ -70,7 +70,7 @@ typedef struct FFV1Context {
 AVClass *class;
 AVCodecContext *avctx;
 RangeCoder c;
-GetBitContext gb;
+BitstreamContext bc;
 PutBitContext pb;
 uint64_t rc_stat[256][2];
 uint64_t (*rc_stat2[MAX_QUANT_TABLES])[32][2];
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 2ebd6864a1..07e66b9dbb 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -33,9 +33,9 @@
 #include "libavutil/timer.h"
 
 #include "avcodec.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "internal.h"
-#include "get_bits.h"
 #include "put_bits.h"
 #include "rangecoder.h"
 #include "mathops.h"
@@ -66,7 +66,7 @@ static av_noinline int get_symbol(RangeCoder *c, uint8_t 
*state, int is_signed)
 return get_symbol_inline(c, state, is_signed);
 }
 
-static inline int get_vlc_symbol(GetBitContext *gb, VlcState *const state,
+static inline int get_vlc_symbol(BitstreamContext *bc, VlcState *const state,
  int bits)
 {
 int k, i, v, ret;
@@ -80,7 +80,7 @@ static inline int get_vlc_symbol(GetBitContext *gb, VlcState 
*const state,
 
 assert(k <= 8);
 
-v = get_sr_golomb(gb, k, 12, bits);
+v = get_sr_golomb(bc, k, 12, bits);
 ff_dlog(NULL, "v:%d bias:%d error:%d drift:%d count:%d k:%d",
 v, state->bias, state->error_sum, state->drift, state->count, k);
 
@@ -124,13 +124,13 @@ static av_always_inline void decode_line(FFV1Context *s, 
int w,
 
 if (run_mode) {
 if (run_count == 0 && run_mode == 1) {
-if (get_bits1(>gb)) {
+if (bitstream_read_bit(>bc)) {
 run_count = 1 << ff_log2_run[run_index];
 if (x + run_count <= w)
 run_index++;
 } else {
 if (ff_log2_run[run_index])
-run_count = get_bits(>gb, 
ff_log2_run[run_index]);
+run_count = bitstream_read(>bc, 
ff_log2_run[run_index]);
 else
 run_count = 0;
 if (run_index)
@@ -142,17 +142,17 @@ static av_always_inline void decode_line(FFV1Context *s, 
int w,
 if (run_count < 0) {
 run_mode  = 0;
 run_count = 0;
-diff  = get_vlc_symbol(>gb, >vlc_state[context],
+diff  = get_vlc_symbol(>bc, >vlc_state[context],
bits);
 if (diff >= 0)
 diff++;
 } else
 diff = 0;
 } else
-diff = get_vlc_symbol(>gb, >vlc_state[context], bits);
+diff = get_vlc_symbol(>bc, >vlc_state[context], bits);
 
 ff_dlog(s->avctx, "count:%d index:%d, mode:%d, x:%d pos:%d\n",
-run_count, run_index, run_mode, x, get_bits_count(>gb));
+run_count, run_index, run_mode, x, bitstream_tell(>bc));
 }
 
 if (sign)
@@ -364,9 +364,9 @@ static int decode_slice(AVCodecContext *c, void *arg)
 if (f->version == 3 && f->minor_version > 1 || f->version > 3)
 get_rac(>c, (uint8_t[]) { 129 });
 fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - 
fs->c.bytestream_start - 1 : 0;
-init_get_bits(>gb, fs->c.bytestream_start + fs->ac_byte_count,
-  (fs->c.bytestream_end - fs->c.bytestream_start -
-   fs->ac_byte_count) * 8);
+bitstream_init8(>bc, fs->c.bytestream_start + fs->ac_byte_count,
+(fs->c.bytestream_end - fs->c.bytestream_start -
+ fs->ac_byte_count));
 }
 
 av_assert1(width && height);
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index adf70d8a6b..c5088bb545 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -33,7 +33,7 @@
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
-#include "golomb_legacy.h"
+#include "golomb.h"
 #include "internal.h"
 #include "put_bits.h"
 #include 

[FFmpeg-cvslog] aic: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Apr 
23 15:19:08 2016 +0200| [0c89ff82e9ddc68ec92316d786cd8ddc7b6c2b8c] | committer: 
Diego Biurrun

aic: Convert to the new bitstream reader

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

 libavcodec/aic.c | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 405ebf12d5..368b3bcf23 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -23,13 +23,13 @@
 #include 
 
 #include "avcodec.h"
+#include "bitstream.h"
 #include "bytestream.h"
+#include "golomb.h"
 #include "internal.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
 #include "idctdsp.h"
 #include "thread.h"
-#include "unary_legacy.h"
+#include "unary.h"
 
 #define AIC_HDR_SIZE24
 #define AIC_BAND_COEFFS (64 + 32 + 192 + 96)
@@ -191,14 +191,14 @@ static int aic_decode_header(AICContext *ctx, const 
uint8_t *src, int size)
 #define GET_CODE(val, type, add_bits) \
 do {  \
 if (type) \
-val = get_ue_golomb(gb);  \
+val = get_ue_golomb(bc);  \
 else  \
-val = get_unary(gb, 1, 31);   \
+val = get_unary(bc, 1, 31);   \
 if (add_bits) \
-val = (val << add_bits) + get_bits(gb, add_bits); \
+val = (val << add_bits) + bitstream_read(bc, add_bits); \
 } while (0)
 
-static int aic_decode_coeffs(GetBitContext *gb, int16_t *dst,
+static int aic_decode_coeffs(BitstreamContext *bc, int16_t *dst,
  int band, int slice_width, int force_chroma)
 {
 int has_skips, coeff_type, coeff_bits, skip_type, skip_bits;
@@ -206,13 +206,13 @@ static int aic_decode_coeffs(GetBitContext *gb, int16_t 
*dst,
 const uint8_t *scan = aic_scan[band | force_chroma];
 int mb, idx, val;
 
-has_skips  = get_bits1(gb);
-coeff_type = get_bits1(gb);
-coeff_bits = get_bits(gb, 3);
+has_skips  = bitstream_read_bit(bc);
+coeff_type = bitstream_read_bit(bc);
+coeff_bits = bitstream_read(bc, 3);
 
 if (has_skips) {
-skip_type = get_bits1(gb);
-skip_bits = get_bits(gb, 3);
+skip_type = bitstream_read_bit(bc);
+skip_bits = bitstream_read(bc, 3);
 
 for (mb = 0; mb < slice_width; mb++) {
 idx = -1;
@@ -303,7 +303,7 @@ static void unquant_block(int16_t *block, int q)
 static int aic_decode_slice(AICContext *ctx, int mb_x, int mb_y,
 const uint8_t *src, int src_size)
 {
-GetBitContext gb;
+BitstreamContext bc;
 int ret, i, mb, blk;
 int slice_width = FFMIN(ctx->slice_width, ctx->mb_width - mb_x);
 uint8_t *Y, *C[2];
@@ -318,12 +318,12 @@ static int aic_decode_slice(AICContext *ctx, int mb_x, 
int mb_y,
 for (i = 0; i < 2; i++)
 C[i] = ctx->frame->data[i + 1] + mb_x * 8
+ mb_y * 8 * ctx->frame->linesize[i + 1];
-init_get_bits(, src, src_size * 8);
+bitstream_init8(, src, src_size);
 
 memset(ctx->slice_data, 0,
sizeof(*ctx->slice_data) * slice_width * AIC_BAND_COEFFS);
 for (i = 0; i < NUM_BANDS; i++)
-if ((ret = aic_decode_coeffs(, ctx->data_ptr[i],
+if ((ret = aic_decode_coeffs(, ctx->data_ptr[i],
  i, slice_width,
  !ctx->interlaced)) < 0)
 return ret;

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


[FFmpeg-cvslog] fic: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Mar 
19 17:40:55 2016 +0100| [0f94de8a092b1a9f1fe45f830c0f134699c16de1] | committer: 
Diego Biurrun

fic: Convert to the new bitstream reader

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

 libavcodec/fic.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index 1804104916..a038af6e60 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -24,9 +24,9 @@
 #include "libavutil/common.h"
 
 #include "avcodec.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "internal.h"
-#include "get_bits.h"
 
 typedef struct FICThreadContext {
 DECLARE_ALIGNED(16, int16_t, block)[64];
@@ -129,13 +129,13 @@ static void fic_idct_put(uint8_t *dst, int stride, 
int16_t *block)
 ptr += 8;
 }
 }
-static int fic_decode_block(FICContext *ctx, GetBitContext *gb,
+static int fic_decode_block(FICContext *ctx, BitstreamContext *bc,
 uint8_t *dst, int stride, int16_t *block)
 {
 int i, num_coeff;
 
 /* Is it a skip block? */
-if (get_bits1(gb)) {
+if (bitstream_read_bit(bc)) {
 /* This is a P-frame. */
 ctx->frame->key_frame = 0;
 ctx->frame->pict_type = AV_PICTURE_TYPE_P;
@@ -145,12 +145,12 @@ static int fic_decode_block(FICContext *ctx, 
GetBitContext *gb,
 
 memset(block, 0, sizeof(*block) * 64);
 
-num_coeff = get_bits(gb, 7);
+num_coeff = bitstream_read(bc, 7);
 if (num_coeff > 64)
 return AVERROR_INVALIDDATA;
 
 for (i = 0; i < num_coeff; i++)
-block[ff_zigzag_direct[i]] = get_se_golomb(gb) *
+block[ff_zigzag_direct[i]] = get_se_golomb(bc) *
  ctx->qmat[ff_zigzag_direct[i]];
 
 fic_idct_put(dst, stride, block);
@@ -162,14 +162,14 @@ static int fic_decode_slice(AVCodecContext *avctx, void 
*tdata)
 {
 FICContext *ctx= avctx->priv_data;
 FICThreadContext *tctx = tdata;
-GetBitContext gb;
+BitstreamContext bc;
 uint8_t *src = tctx->src;
 int slice_h  = tctx->slice_h;
 int src_size = tctx->src_size;
 int y_off= tctx->y_off;
 int x, y, p;
 
-init_get_bits(, src, src_size * 8);
+bitstream_init8(, src, src_size);
 
 for (p = 0; p < 3; p++) {
 int stride   = ctx->frame->linesize[p];
@@ -179,7 +179,7 @@ static int fic_decode_slice(AVCodecContext *avctx, void 
*tdata)
 for (x = 0; x < (ctx->aligned_width >> !!p); x += 8) {
 int ret;
 
-if ((ret = fic_decode_block(ctx, , dst + x, stride, 
tctx->block)) != 0)
+if ((ret = fic_decode_block(ctx, , dst + x, stride, 
tctx->block)) != 0)
 return ret;
 }
 

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


[FFmpeg-cvslog] cavs: Convert to the new bitstream reader

2017-09-26 Thread Alexandra Hájková
ffmpeg | branch: master | Alexandra Hájková  | Sat Mar 
19 12:39:03 2016 +0100| [ffc00df0a61b656b3c2ba199c9d153b7787caefa] | committer: 
Diego Biurrun

cavs: Convert to the new bitstream reader

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

 libavcodec/cavs.c|   8 +--
 libavcodec/cavs.h|   4 +-
 libavcodec/cavsdec.c | 178 +--
 3 files changed, 95 insertions(+), 95 deletions(-)

diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index bf1a59a6f0..6959f54404 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -26,8 +26,8 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
+#include "golomb.h"
 #include "h264chroma.h"
 #include "idctdsp.h"
 #include "internal.h"
@@ -603,8 +603,8 @@ void ff_cavs_mv(AVSContext *h, enum cavs_mv_loc nP, enum 
cavs_mv_loc nC,
 mv_pred_median(h, mvP, mvA, mvB, mvC);
 
 if (mode < MV_PRED_PSKIP) {
-mvP->x += get_se_golomb(>gb);
-mvP->y += get_se_golomb(>gb);
+mvP->x += get_se_golomb(>bc);
+mvP->y += get_se_golomb(>bc);
 }
 set_mvs(mvP, size);
 }
diff --git a/libavcodec/cavs.h b/libavcodec/cavs.h
index e8729d50cd..cb549f161e 100644
--- a/libavcodec/cavs.h
+++ b/libavcodec/cavs.h
@@ -22,11 +22,11 @@
 #ifndef AVCODEC_CAVS_H
 #define AVCODEC_CAVS_H
 
+#include "bitstream.h"
 #include "cavsdsp.h"
 #include "blockdsp.h"
 #include "h264chroma.h"
 #include "idctdsp.h"
-#include "get_bits.h"
 #include "videodsp.h"
 
 #define SLICE_MAX_START_CODE0x01af
@@ -167,7 +167,7 @@ typedef struct AVSContext {
 IDCTDSPContext idsp;
 VideoDSPContext vdsp;
 CAVSDSPContext  cdsp;
-GetBitContext gb;
+BitstreamContext bc;
 AVSFrame cur; ///< currently decoded frame
 AVSFrame DPB[2];  ///< reference frames
 int dist[2]; ///< temporal distances from current frame to ref frames
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 5a28fc04ed..7f584ac1c0 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -26,9 +26,9 @@
  */
 
 #include "avcodec.h"
-#include "get_bits.h"
-#include "golomb_legacy.h"
+#include "bitstream.h"
 #include "cavs.h"
+#include "golomb.h"
 #include "internal.h"
 #include "mpeg12data.h"
 
@@ -506,13 +506,13 @@ static inline void mv_pred_sym(AVSContext *h, cavs_vector 
*src,
  /
 
 /** kth-order exponential golomb code */
-static inline int get_ue_code(GetBitContext *gb, int order)
+static inline int get_ue_code(BitstreamContext *bc, int order)
 {
 if (order) {
-int ret = get_ue_golomb(gb) << order;
-return ret + get_bits(gb, order);
+int ret = get_ue_golomb(bc) << order;
+return ret + bitstream_read(bc, order);
 }
-return get_ue_golomb(gb);
+return get_ue_golomb(bc);
 }
 
 static inline int dequant(AVSContext *h, int16_t *level_buf, uint8_t *run_buf,
@@ -545,7 +545,7 @@ static inline int dequant(AVSContext *h, int16_t 
*level_buf, uint8_t *run_buf,
  * @param dst location of sample block
  * @param stride line stride in frame buffer
  */
-static int decode_residual_block(AVSContext *h, GetBitContext *gb,
+static int decode_residual_block(AVSContext *h, BitstreamContext *bc,
  const struct dec_2dvlc *r, int 
esc_golomb_order,
  int qp, uint8_t *dst, ptrdiff_t stride)
 {
@@ -555,10 +555,10 @@ static int decode_residual_block(AVSContext *h, 
GetBitContext *gb,
 int16_t *block = h->block;
 
 for (i = 0;i < 65; i++) {
-level_code = get_ue_code(gb, r->golomb_order);
+level_code = get_ue_code(bc, r->golomb_order);
 if (level_code >= ESCAPE_CODE) {
 run  = ((level_code - ESCAPE_CODE) >> 1) + 1;
-esc_code = get_ue_code(gb, esc_golomb_order);
+esc_code = get_ue_code(bc, esc_golomb_order);
 level= esc_code + (run > r->max_run ? 1 : r->level_add[run]);
 while (level > r->inc_limit)
 r++;
@@ -588,10 +588,10 @@ static int decode_residual_block(AVSContext *h, 
GetBitContext *gb,
 static inline void decode_residual_chroma(AVSContext *h)
 {
 if (h->cbp & (1 << 4))
-decode_residual_block(h, >gb, chroma_dec, 0,
+decode_residual_block(h, >bc, chroma_dec, 0,
   cavs_chroma_qp[h->qp], h->cu, h->c_stride);
 if (h->cbp & (1 << 5))
-decode_residual_block(h, >gb, chroma_dec, 0,
+decode_residual_block(h, >bc, chroma_dec, 0,
   cavs_chroma_qp[h->qp], h->cv, h->c_stride);
 }
 
@@ -600,7 +600,7 @@ static inline int decode_residual_inter(AVSContext *h)
 int block;
 
 /* get coded block pattern */
-int cbp = get_ue_golomb(>gb);
+int cbp = get_ue_golomb(>bc);
 if (cbp > 63 || cbp < 0) {
 

[FFmpeg-cvslog] golomb: Convert to the new bitstream reader

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Mon Jan 30 
20:24:38 2017 +0100| [d4c2103bd30ff6ceea70c3696ae88a7d2ea72493] | committer: 
Diego Biurrun

golomb: Convert to the new bitstream reader

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

 libavcodec/aic.c   |   2 +-
 libavcodec/cavs.c  |   2 +-
 libavcodec/cavsdec.c   |   2 +-
 libavcodec/dirac.c |   2 +-
 libavcodec/ffv1dec.c   |   3 +-
 libavcodec/ffv1enc.c   |   2 +-
 libavcodec/fic.c   |   3 +-
 libavcodec/flacdec.c   |   2 +-
 libavcodec/flacenc.c   |   2 +-
 libavcodec/golomb.h| 190 ++-
 libavcodec/golomb_legacy.h | 573 +
 libavcodec/h264_cavlc.c|   2 +-
 libavcodec/h264_parse.c|   2 +-
 libavcodec/h264_parser.c   |   2 +-
 libavcodec/h264_ps.c   |   3 +-
 libavcodec/h264_refs.c |   2 +-
 libavcodec/h264_sei.c  |   2 +-
 libavcodec/h264_slice.c|   2 +-
 libavcodec/h264dec.c   |   2 +-
 libavcodec/hevc_parser.c   |   2 +-
 libavcodec/hevc_ps.c   |   2 +-
 libavcodec/hevc_ps_enc.c   |   2 +-
 libavcodec/hevc_sei.c  |   2 +-
 libavcodec/hevcdec.c   |   2 +-
 libavcodec/jpeglsdec.c |   2 +-
 libavcodec/jpeglsenc.c |   2 +-
 libavcodec/loco.c  |   2 +-
 libavcodec/ralf.c  |   2 +-
 libavcodec/rv30.c  |   2 +-
 libavcodec/rv34.c  |   2 +-
 libavcodec/rv40.c  |   2 +-
 libavcodec/shorten.c   |   2 +-
 libavcodec/svq3.c  |   3 +-
 libavcodec/tests/golomb.c  |  22 +-
 libavformat/hevc.c |   2 +-
 35 files changed, 693 insertions(+), 160 deletions(-)

diff --git a/libavcodec/aic.c b/libavcodec/aic.c
index 2c9b6f8098..405ebf12d5 100644
--- a/libavcodec/aic.c
+++ b/libavcodec/aic.c
@@ -26,7 +26,7 @@
 #include "bytestream.h"
 #include "internal.h"
 #include "get_bits.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "idctdsp.h"
 #include "thread.h"
 #include "unary_legacy.h"
diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c
index cf66629ffd..bf1a59a6f0 100644
--- a/libavcodec/cavs.c
+++ b/libavcodec/cavs.c
@@ -27,7 +27,7 @@
 
 #include "avcodec.h"
 #include "get_bits.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "h264chroma.h"
 #include "idctdsp.h"
 #include "internal.h"
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 1c4f276373..5a28fc04ed 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -27,7 +27,7 @@
 
 #include "avcodec.h"
 #include "get_bits.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "cavs.h"
 #include "internal.h"
 #include "mpeg12data.h"
diff --git a/libavcodec/dirac.c b/libavcodec/dirac.c
index 142af20579..cce9439d44 100644
--- a/libavcodec/dirac.c
+++ b/libavcodec/dirac.c
@@ -29,7 +29,7 @@
 
 #include "avcodec.h"
 #include "dirac.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "internal.h"
 #include "mpeg12data.h"
 
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d3169ec7c5..2ebd6864a1 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -31,12 +31,13 @@
 #include "libavutil/opt.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/timer.h"
+
 #include "avcodec.h"
+#include "golomb_legacy.h"
 #include "internal.h"
 #include "get_bits.h"
 #include "put_bits.h"
 #include "rangecoder.h"
-#include "golomb.h"
 #include "mathops.h"
 #include "ffv1.h"
 
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 0eeccfffb4..adf70d8a6b 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -33,10 +33,10 @@
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
+#include "golomb_legacy.h"
 #include "internal.h"
 #include "put_bits.h"
 #include "rangecoder.h"
-#include "golomb.h"
 #include "mathops.h"
 #include "ffv1.h"
 
diff --git a/libavcodec/fic.c b/libavcodec/fic.c
index b1286ebe65..1804104916 100644
--- a/libavcodec/fic.c
+++ b/libavcodec/fic.c
@@ -22,10 +22,11 @@
  */
 
 #include "libavutil/common.h"
+
 #include "avcodec.h"
+#include "golomb_legacy.h"
 #include "internal.h"
 #include "get_bits.h"
-#include "golomb.h"
 
 typedef struct FICThreadContext {
 DECLARE_ALIGNED(16, int16_t, block)[64];
diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c
index 7af71f3c0c..78be2adab3 100644
--- a/libavcodec/flacdec.c
+++ b/libavcodec/flacdec.c
@@ -37,7 +37,7 @@
 #include "internal.h"
 #include "get_bits.h"
 #include "bytestream.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "flac.h"
 #include "flacdata.h"
 #include "flacdsp.h"
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 67f899f712..0c1e6b7673 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -26,7 +26,7 @@
 
 #include "avcodec.h"
 #include "bswapdsp.h"
-#include "golomb.h"
+#include "golomb_legacy.h"
 #include "internal.h"
 #include "lpc.h"
 #include "flac.h"
diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 

[FFmpeg-cvslog] Merge commit 'ab87af41636b081dd3562423999351b5444fa09e'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 15:03:21 
2017 -0300| [7289c7658a1ae32a59b26fac6b93791524f00dcb] | committer: James Almer

Merge commit 'ab87af41636b081dd3562423999351b5444fa09e'

* commit 'ab87af41636b081dd3562423999351b5444fa09e':
  configure: Add proper weak dependency of avformat on network

Merged-by: James Almer 

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 16fc2bd074..f0c114e9e3 100755
--- a/configure
+++ b/configure
@@ -3273,6 +3273,7 @@ avcodec_select="null_bsf"
 avdevice_deps="avformat avcodec avutil"
 avfilter_deps="avutil"
 avformat_deps="avcodec avutil"
+avformat_suggest="network"
 avresample_deps="avutil"
 postproc_deps="avutil gpl"
 swresample_deps="avutil"


==

diff --cc configure
index 16fc2bd074,a2223022cb..f0c114e9e3
--- a/configure
+++ b/configure
@@@ -3273,9 -2484,8 +3273,10 @@@ avcodec_select="null_bsf
  avdevice_deps="avformat avcodec avutil"
  avfilter_deps="avutil"
  avformat_deps="avcodec avutil"
+ avformat_suggest="network"
  avresample_deps="avutil"
 +postproc_deps="avutil gpl"
 +swresample_deps="avutil"
  swscale_deps="avutil"
  
  # programs

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


[FFmpeg-cvslog] configure: Add proper weak dependency of avformat on network

2017-09-26 Thread Diego Biurrun
ffmpeg | branch: master | Diego Biurrun  | Wed Jan 25 
19:11:24 2017 +0100| [ab87af41636b081dd3562423999351b5444fa09e] | committer: 
Diego Biurrun

configure: Add proper weak dependency of avformat on network

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

 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 3904b41e36..a2223022cb 100755
--- a/configure
+++ b/configure
@@ -2484,6 +2484,7 @@ avcodec_select="null_bsf"
 avdevice_deps="avformat avcodec avutil"
 avfilter_deps="avutil"
 avformat_deps="avcodec avutil"
+avformat_suggest="network"
 avresample_deps="avutil"
 swscale_deps="avutil"
 

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


[FFmpeg-cvslog] Merge commit '612cc0712836af2f025b0c68b11da29b9f259d5a'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 14:59:58 
2017 -0300| [4c359200b142da0f57f050ae25c75f467939ecc1] | committer: James Almer

Merge commit '612cc0712836af2f025b0c68b11da29b9f259d5a'

* commit '612cc0712836af2f025b0c68b11da29b9f259d5a':
  pgssubdec: reset rle_data_len/rle_remaining_len on allocation error

This commit is a noop, see 842e98b4d83d8cf297e2bc2761f1f47eb89e49e4

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] pgssubdec: reset rle_data_len/rle_remaining_len on allocation error

2017-09-26 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Tue Jan 31 01:59:38 2017 +0100| [612cc0712836af2f025b0c68b11da29b9f259d5a] | 
committer: Diego Biurrun

pgssubdec: reset rle_data_len/rle_remaining_len on allocation error

The code relies on their validity and otherwise can try to access a NULL
object->rle pointer, causing segmentation faults.

Signed-off-by: Andreas Cadhalpun 
Signed-off-by: Diego Biurrun 

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

 libavcodec/pgssubdec.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 886685b4b5..a6a43ae32b 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -297,8 +297,11 @@ static int parse_object_segment(AVCodecContext *avctx,
 
 av_fast_malloc(>rle, >rle_buffer_size, rle_bitmap_len);
 
-if (!object->rle)
+if (!object->rle) {
+object->rle_data_len  = 0;
+object->rle_remaining_len = 0;
 return AVERROR(ENOMEM);
+}
 
 memcpy(object->rle, buf, buf_size);
 object->rle_data_len = buf_size;

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


[FFmpeg-cvslog] Merge commit '708e84cda1bdbffb92847f3d6ccf6fbeb26d9948'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 14:48:22 
2017 -0300| [a6596831a03d4b56a485436f7c328a039509b8dd] | committer: James Almer

Merge commit '708e84cda1bdbffb92847f3d6ccf6fbeb26d9948'

* commit '708e84cda1bdbffb92847f3d6ccf6fbeb26d9948':
  mov: Avoid memcmp of uninitialised data

Merged-by: James Almer 

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 2519707345..2de60b2159 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1890,14 +1890,14 @@ static void mov_parse_stsd_video(MOVContext *c, 
AVIOContext *pb,
 av_dict_set(>metadata, "encoder", codec_name, 0);
 
 /* codec_tag YV12 triggers an UV swap in rawdec.c */
-if (!memcmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) {
+if (!strncmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) {
 st->codecpar->codec_tag = MKTAG('I', '4', '2', '0');
 st->codecpar->width &= ~1;
 st->codecpar->height &= ~1;
 }
 /* Flash Media Server uses tag H.263 with Sorenson Spark */
 if (st->codecpar->codec_tag == MKTAG('H','2','6','3') &&
-!memcmp(codec_name, "Sorenson H263", 13))
+!strncmp(codec_name, "Sorenson H263", 13))
 st->codecpar->codec_id = AV_CODEC_ID_FLV1;
 
 st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* depth */


==

diff --cc libavformat/mov.c
index 2519707345,9afd0202ca..2de60b2159
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@@ -1890,14 -1455,11 +1890,14 @@@ static void mov_parse_stsd_video(MOVCon
  av_dict_set(>metadata, "encoder", codec_name, 0);
  
  /* codec_tag YV12 triggers an UV swap in rawdec.c */
- if (!memcmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) {
 -if (!strncmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
++if (!strncmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) {
  st->codecpar->codec_tag = MKTAG('I', '4', '2', '0');
 +st->codecpar->width &= ~1;
 +st->codecpar->height &= ~1;
 +}
  /* Flash Media Server uses tag H.263 with Sorenson Spark */
  if (st->codecpar->codec_tag == MKTAG('H','2','6','3') &&
- !memcmp(codec_name, "Sorenson H263", 13))
+ !strncmp(codec_name, "Sorenson H263", 13))
  st->codecpar->codec_id = AV_CODEC_ID_FLV1;
  
  st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* depth */

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


[FFmpeg-cvslog] mov: Avoid memcmp of uninitialised data

2017-09-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Jan 29 19:45:59 
2017 +| [708e84cda1bdbffb92847f3d6ccf6fbeb26d9948] | committer: Mark 
Thompson

mov: Avoid memcmp of uninitialised data

The string codec name need not be as long as the value we are
comparing it to, so memcmp may make decisions derived from
uninitialised data that valgrind then complains about (though the
overall result of the function will always be the same).  Use
strncmp instead, which will stop at the first zero byte and
therefore not encounter this issue.

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 37afe79df0..9afd0202ca 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1455,11 +1455,11 @@ static void mov_parse_stsd_video(MOVContext *c, 
AVIOContext *pb,
 av_dict_set(>metadata, "encoder", codec_name, 0);
 
 /* codec_tag YV12 triggers an UV swap in rawdec.c */
-if (!memcmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
+if (!strncmp(codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
 st->codecpar->codec_tag = MKTAG('I', '4', '2', '0');
 /* Flash Media Server uses tag H.263 with Sorenson Spark */
 if (st->codecpar->codec_tag == MKTAG('H','2','6','3') &&
-!memcmp(codec_name, "Sorenson H263", 13))
+!strncmp(codec_name, "Sorenson H263", 13))
 st->codecpar->codec_id = AV_CODEC_ID_FLV1;
 
 st->codecpar->bits_per_coded_sample = avio_rb16(pb); /* depth */

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


[FFmpeg-cvslog] Merge commit 'ca62236a89f47bd871eaf69d8d9e837c93c55a6c'

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 14:43:29 
2017 -0300| [efc4b3e9d702a5960affd0d65abe02405715d5c5] | committer: James Almer

Merge commit 'ca62236a89f47bd871eaf69d8d9e837c93c55a6c'

* commit 'ca62236a89f47bd871eaf69d8d9e837c93c55a6c':
  vaapi_encode: Add VP8 support
  vaapi_encode: Pass framerate parameters to driver
  vaapi_h264: Enable VBR mode
  vaapi_encode: Support VBR mode

This commit is a noop, see
ceb28c3cc4c7921935b48904db3c559eed1597fe
2201c02e6dc9f9652a8e27dec194915f05954ad0
be6546a4ff592785d039df6cbdd7659781d30b2c
d1acab8293054151157910eb081d5edcc7496e13

Merged-by: James Almer 

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



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


[FFmpeg-cvslog] vaapi_encode: Pass framerate parameters to driver

2017-09-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Tue Nov 29 22:12:46 
2016 +| [ff35aa8ca4069bf1543adeec4c28e51e4a012eee] | committer: Mark 
Thompson

vaapi_encode: Pass framerate parameters to driver

Only do this when building for a recent VAAPI version - initial
driver implementations were confused about the interpretation of the
framerate field, but hopefully this will be consistent everywhere
once 0.40.0 is released.

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

 libavcodec/vaapi_encode.c | 18 ++
 libavcodec/vaapi_encode.h |  4 
 2 files changed, 22 insertions(+)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index e9aa48606a..8238952543 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1116,6 +1116,7 @@ static av_cold int 
vaapi_encode_init_rate_control(AVCodecContext *avctx)
 int rc_window_size;
 int hrd_buffer_size;
 int hrd_initial_buffer_fullness;
+int fr_num, fr_den;
 
 if (avctx->rc_buffer_size)
 hrd_buffer_size = avctx->rc_buffer_size;
@@ -1166,6 +1167,23 @@ static av_cold int 
vaapi_encode_init_rate_control(AVCodecContext *avctx)
 ctx->global_params_size[ctx->nb_global_params++] =
 sizeof(ctx->hrd_params);
 
+if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
+av_reduce(_num, _den,
+  avctx->framerate.num, avctx->framerate.den, 65535);
+else
+av_reduce(_num, _den,
+  avctx->time_base.den, avctx->time_base.num, 65535);
+
+ctx->fr_params.misc.type = VAEncMiscParameterTypeFrameRate;
+ctx->fr_params.fr.framerate = (unsigned int)fr_den << 16 | fr_num;
+
+#if VA_CHECK_VERSION(0, 40, 0)
+ctx->global_params[ctx->nb_global_params] =
+>fr_params.misc;
+ctx->global_params_size[ctx->nb_global_params++] =
+sizeof(ctx->fr_params);
+#endif
+
 return 0;
 }
 
diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h
index 3954999f19..fc62365148 100644
--- a/libavcodec/vaapi_encode.h
+++ b/libavcodec/vaapi_encode.h
@@ -155,6 +155,10 @@ typedef struct VAAPIEncodeContext {
 VAEncMiscParameterBuffer misc;
 VAEncMiscParameterHRD hrd;
 } hrd_params;
+struct {
+VAEncMiscParameterBuffer misc;
+VAEncMiscParameterFrameRate fr;
+} fr_params;
 
 // Per-sequence parameter structure (VAEncSequenceParameterBuffer*).
 void   *codec_sequence_params;

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


[FFmpeg-cvslog] vaapi_h264: Enable VBR mode

2017-09-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Jan 29 14:12:20 
2017 +| [eddfb57210298a0a94472794485400a3a6c76196] | committer: Mark 
Thompson

vaapi_h264: Enable VBR mode

Default to using VBR when a target bitrate is set, unless the max rate
is also set and matches the target.  Changes to the Intel driver mean
that min_qp is also respected in this case, so set a codec default to
unset the value rather than using the current default inherited from
the MPEG-4 part 2 encoder.

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

 libavcodec/vaapi_encode_h264.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 74e7cb1c16..b918e0d75e 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1126,13 +1126,15 @@ static av_cold int 
vaapi_encode_h264_configure(AVCodecContext *avctx)
"%d / %d / %d for IDR- / P- / B-frames.\n",
priv->fixed_qp_idr, priv->fixed_qp_p, priv->fixed_qp_b);
 
-} else if (ctx->va_rc_mode == VA_RC_CBR) {
+} else if (ctx->va_rc_mode == VA_RC_CBR ||
+   ctx->va_rc_mode == VA_RC_VBR) {
 // These still need to be  set for pic_init_qp/slice_qp_delta.
 priv->fixed_qp_idr = 26;
 priv->fixed_qp_p   = 26;
 priv->fixed_qp_b   = 26;
 
-av_log(avctx, AV_LOG_DEBUG, "Using constant-bitrate = %d bps.\n",
+av_log(avctx, AV_LOG_DEBUG, "Using %s-bitrate = %d bps.\n",
+   ctx->va_rc_mode == VA_RC_CBR ? "constant" : "variable",
avctx->bit_rate);
 
 } else {
@@ -1241,9 +1243,12 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext 
*avctx)
 // Only 8-bit encode is supported.
 ctx->va_rt_format = VA_RT_FORMAT_YUV420;
 
-if (avctx->bit_rate > 0)
-ctx->va_rc_mode = VA_RC_CBR;
-else
+if (avctx->bit_rate > 0) {
+if (avctx->rc_max_rate == avctx->bit_rate)
+ctx->va_rc_mode = VA_RC_CBR;
+else
+ctx->va_rc_mode = VA_RC_VBR;
+} else
 ctx->va_rc_mode = VA_RC_CQP;
 
 ctx->va_packed_headers =
@@ -1281,6 +1286,7 @@ static const AVCodecDefault vaapi_encode_h264_defaults[] 
= {
 { "i_qoffset",  "0.0" },
 { "b_qfactor",  "1.2" },
 { "b_qoffset",  "0.0" },
+{ "qmin",   "0"   },
 { NULL },
 };
 

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


[FFmpeg-cvslog] vaapi_encode: Support VBR mode

2017-09-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Sun Jan 29 14:11:03 
2017 +| [f033ba470fbab1ff6838666d4d86411effa97b27] | committer: Mark 
Thompson

vaapi_encode: Support VBR mode

This includes a backward-compatibility hack to choose CBR anyway on
old drivers which have no CBR support, so that existing programs will
continue to work their options now map to VBR.

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

 libavcodec/vaapi_encode.c | 42 +-
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 9895c5a311..e9aa48606a 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1034,6 +1034,19 @@ static av_cold int 
vaapi_encode_config_attributes(AVCodecContext *avctx)
 };
 break;
 case VAConfigAttribRateControl:
+// Hack for backward compatibility: CBR was the only
+// usable RC mode for a long time, so old drivers will
+// only have it.  Normal default options may now choose
+// VBR and then fail, however, so override it here with
+// CBR if that is the only supported mode.
+if (ctx->va_rc_mode == VA_RC_VBR &&
+!(attr[i].value & VA_RC_VBR) &&
+(attr[i].value & VA_RC_CBR)) {
+av_log(avctx, AV_LOG_WARNING, "VBR rate control is "
+   "not supported with this driver version; "
+   "using CBR instead.\n");
+ctx->va_rc_mode = VA_RC_CBR;
+}
 if (!(ctx->va_rc_mode & attr[i].value)) {
 av_log(avctx, AV_LOG_ERROR, "Rate control mode %#x "
"is not supported (mask: %#x).\n",
@@ -1098,6 +,9 @@ fail:
 static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
 {
 VAAPIEncodeContext *ctx = avctx->priv_data;
+int rc_bits_per_second;
+int rc_target_percentage;
+int rc_window_size;
 int hrd_buffer_size;
 int hrd_initial_buffer_fullness;
 
@@ -1110,13 +1126,29 @@ static av_cold int 
vaapi_encode_init_rate_control(AVCodecContext *avctx)
 else
 hrd_initial_buffer_fullness = hrd_buffer_size * 3 / 4;
 
+if (ctx->va_rc_mode == VA_RC_CBR) {
+rc_bits_per_second   = avctx->bit_rate;
+rc_target_percentage = 100;
+rc_window_size   = 1000;
+} else {
+if (avctx->rc_max_rate < avctx->bit_rate) {
+// Max rate is unset or invalid, just use the normal bitrate.
+rc_bits_per_second   = avctx->bit_rate;
+rc_target_percentage = 100;
+} else {
+rc_bits_per_second   = avctx->rc_max_rate;
+rc_target_percentage = (avctx->bit_rate * 100) / 
rc_bits_per_second;
+}
+rc_window_size = (hrd_buffer_size * 1000) / avctx->bit_rate;
+}
+
 ctx->rc_params.misc.type = VAEncMiscParameterTypeRateControl;
 ctx->rc_params.rc = (VAEncMiscParameterRateControl) {
-.bits_per_second   = avctx->bit_rate,
-.target_percentage = 66,
-.window_size   = 1000,
-.initial_qp= (avctx->qmax >= 0 ? avctx->qmax : 40),
-.min_qp= (avctx->qmin >= 0 ? avctx->qmin : 18),
+.bits_per_second   = rc_bits_per_second,
+.target_percentage = rc_target_percentage,
+.window_size   = rc_window_size,
+.initial_qp= 0,
+.min_qp= (avctx->qmin > 0 ? avctx->qmin : 0),
 .basic_unit_size   = 0,
 };
 ctx->global_params[ctx->nb_global_params] =

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


[FFmpeg-cvslog] vaapi_encode: Add VP8 support

2017-09-26 Thread Mark Thompson
ffmpeg | branch: master | Mark Thompson  | Tue Nov 29 20:38:29 
2016 +| [ca62236a89f47bd871eaf69d8d9e837c93c55a6c] | committer: Mark 
Thompson

vaapi_encode: Add VP8 support

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

 Changelog |   2 +-
 configure |   3 +
 libavcodec/Makefile   |   1 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/vaapi_encode_vp8.c | 268 ++
 libavcodec/version.h  |   2 +-
 6 files changed, 275 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index be90b36aa1..713883d5f5 100644
--- a/Changelog
+++ b/Changelog
@@ -7,7 +7,7 @@ version :
 - VAAPI-accelerated VP8 and HEVC decoding
 - VAAPI-accelerated deinterlacing
 - config.log and other configuration files moved into avbuild/ directory
-- VAAPI-accelerated MPEG-2 encoding
+- VAAPI-accelerated MPEG-2 and VP8 encoding
 
 
 version 12:
diff --git a/configure b/configure
index 9c277fa3c2..3904b41e36 100755
--- a/configure
+++ b/configure
@@ -2243,6 +2243,8 @@ vc1_qsv_decoder_deps="libmfx"
 vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser"
 vp8_qsv_decoder_deps="libmfx"
 vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
+vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
+vp8_vaapi_encoder_select="vaapi_encode"
 
 nvenc_h264_encoder_select="h264_nvenc_encoder"
 nvenc_hevc_encoder_select="hevc_nvenc_encoder"
@@ -4594,6 +4596,7 @@ check_type "va/va.h va/va_enc_h264.h" 
"VAEncPictureParameterBufferH264"
 check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
 check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
+check_type "va/va.h va/va_enc_vp8.h"  "VAEncPictureParameterBufferVP8"
 
 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
 
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 19489fa7a9..7d28d6685e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -482,6 +482,7 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o 
vp56data.o \
 OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
 OBJS-$(CONFIG_VP8_QSV_DECODER) += qsvdec_other.o
+OBJS-$(CONFIG_VP8_VAAPI_ENCODER)   += vaapi_encode_vp8.o
 OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o \
   vp9block.o vp9prob.o vp9mvs.o 
vp56rac.o
 OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 92b9ce18c5..46c42c578a 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -511,6 +511,7 @@ void avcodec_register_all(void)
 REGISTER_ENCODER(NVENC_H264,nvenc_h264);
 REGISTER_ENCODER(NVENC_HEVC,nvenc_hevc);
 #endif
+REGISTER_ENCODER(VP8_VAAPI, vp8_vaapi);
 
 /* parsers */
 REGISTER_PARSER(AAC,aac);
diff --git a/libavcodec/vaapi_encode_vp8.c b/libavcodec/vaapi_encode_vp8.c
new file mode 100644
index 00..d1a8087b82
--- /dev/null
+++ b/libavcodec/vaapi_encode_vp8.c
@@ -0,0 +1,268 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav 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.
+ *
+ * Libav 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 Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
+#include "libavutil/internal.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixfmt.h"
+
+#include "avcodec.h"
+#include "internal.h"
+#include "vaapi_encode.h"
+
+
+typedef struct VAAPIEncodeVP8Context {
+int q_index_i;
+int q_index_p;
+} VAAPIEncodeVP8Context;
+
+typedef struct VAAPIEncodeVP8Options {
+int loop_filter_level;
+int loop_filter_sharpness;
+} VAAPIEncodeVP8Options;
+
+
+#define vseq_var(name) vseq->name, name
+#define vseq_field(name)   vseq->seq_fields.bits.name, name
+#define vpic_var(name) vpic->name, name
+#define vpic_field(name)   vpic->pic_fields.bits.name, name
+
+
+static int vaapi_encode_vp8_init_sequence_params(AVCodecContext *avctx)
+{
+VAAPIEncodeContext   *ctx = avctx->priv_data;
+VAEncSequenceParameterBufferVP8 *vseq = ctx->codec_sequence_params;
+
+vseq->frame_width  = 

[FFmpeg-cvslog] Merge commit 'c5c663541739cb813a2a5668ee8339b535b35d7d'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:13:54 2017 -0300| [3eb1d05ef719cbb0793f6bd82d7227f9093f6fc3] | committer: 
James Almer

Merge commit 'c5c663541739cb813a2a5668ee8339b535b35d7d'

* commit 'c5c663541739cb813a2a5668ee8339b535b35d7d':
  doc: add dash muxer

Merged-by: Rodger Combs 

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

 doc/muxers.texi | 62 +
 1 file changed, 62 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 36769b8c1a..38d93919e7 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -194,6 +194,68 @@ Used to facilitate seeking; particularly for HTTP pseudo 
streaming.
 @end table
 @end table
 
+@anchor{dash}
+@section dash
+
+Dynamic Adaptive Streaming over HTTP (DASH) muxer that creates segments
+and manifest files according to the MPEG-DASH standard ISO/IEC 23009-1:2014.
+
+For more information see:
+
+@itemize @bullet
+@item
+ISO DASH Specification: 
@url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}
+@item
+WebM DASH Specification: 
@url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
+@end itemize
+
+It creates a MPD manifest file and segment files for each stream.
+
+The segment filename might contain pre-defined identifiers used with 
SegmentTemplate
+as defined in section 5.3.9.4.4 of the standard. Available identifiers are 
"$RepresentationID$",
+"$Number$", "$Bandwidth$" and "$Time$".
+
+@example
+ffmpeg -re -i  -map 0 -map 0 -c:a libfdk_aac -c:v libx264
+-b:v:0 800k -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline
+-profile:v:0 main -bf 1 -keyint_min 120 -g 120 -sc_threshold 0
+-b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1
+-window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a"
+-f dash /path/to/out.mpd
+@end example
+
+@table @option
+@item -min_seg_duration @var{microseconds}
+Set the segment length in microseconds.
+@item -window_size @var{size}
+Set the maximum number of segments kept in the manifest.
+@item -extra_window_size @var{size}
+Set the maximum number of segments kept outside of the manifest before 
removing from disk.
+@item -remove_at_exit @var{remove}
+Enable (1) or disable (0) removal of all segments when finished.
+@item -use_template @var{template}
+Enable (1) or disable (0) use of SegmentTemplate instead of SegmentList.
+@item -use_timeline @var{timeline}
+Enable (1) or disable (0) use of SegmentTimeline in SegmentTemplate.
+@item -single_file @var{single_file}
+Enable (1) or disable (0) storing all segments in one file, accessed using 
byte ranges.
+@item -single_file_name @var{file_name}
+DASH-templated name to be used for baseURL. Implies @var{single_file} set to 
"1".
+@item -init_seg_name @var{init_name}
+DASH-templated name to used for the initialization segment. Default is 
"init-stream$RepresentationID$.m4s"
+@item -media_seg_name @var{segment_name}
+DASH-templated name to used for the media segments. Default is 
"chunk-stream$RepresentationID$-$Number%05d$.m4s"
+@item -utc_timing_url @var{utc_url}
+URL of the page that will return the UTC timestamp in ISO format. Example: 
"https://time.akamai.com/?iso;
+@item -adaptation_sets @var{adaptation_sets}
+Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
id=y,streams=d,e" with x and y being the IDs
+of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
+
+To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be 
used as stream identifier instead of IDs.
+
+When no assignment is defined, this defaults to an AdaptationSet for each 
stream.
+@end table
+
 @anchor{framecrc}
 @section framecrc
 


==

diff --cc doc/muxers.texi
index 36769b8c1a,62cd8d025b..38d93919e7
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@@ -160,40 -48,73 +160,102 @@@ specifying the audio and video codec an
  compute the CRC of the input audio converted to PCM unsigned 8-bit
  and the input video converted to MPEG-2 video, use the command:
  @example
 -avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
 +ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
  @end example
  
 -See also the @ref{framecrc} muxer.
 +@section flv
 +
 +Adobe Flash Video Format muxer.
 +
 +This muxer accepts the following options:
 +
 +@table @option
 +
 +@item flvflags @var{flags}
 +Possible values:
 +
 +@table @samp
 +
 +@item aac_seq_header_detect
 +Place AAC sequence header based on audio stream data.
 +
 +@item no_sequence_end
 +Disable sequence end tag.
 +
 +@item no_metadata
 +Disable metadata tag.
 +
 +@item no_duration_filesize
 +Disable duration and filesize in metadata when they are equal to zero
 +at the end of stream. (Be used to non-seekable living stream).
 +
 +@item add_keyframe_index
 +Used to facilitate 

[FFmpeg-cvslog] Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:12:19 2017 -0300| [a9f51d19d6b58f9e75451d891a85a3617ab1fa56] | committer: 
James Almer

Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7'

* commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7':
  dashenc: use avio_dynbuf instead of packet_write callback

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 61 +++
 1 file changed, 37 insertions(+), 24 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index ab6bf21dbd..bde938f587 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -60,11 +60,10 @@ typedef struct AdaptationSet {
 typedef struct OutputStream {
 AVFormatContext *ctx;
 int ctx_inited, as_idx;
-uint8_t iobuf[32768];
 AVIOContext *out;
 int packets_written;
 char initfile[1024];
-int64_t init_start_pos;
+int64_t init_start_pos, pos;
 int init_range_length;
 int nb_segments, segments_size, segment_index;
 Segment **segments;
@@ -102,14 +101,6 @@ typedef struct DASHContext {
 const char *utc_timing_url;
 } DASHContext;
 
-static int dash_write(void *opaque, uint8_t *buf, int buf_size)
-{
-OutputStream *os = opaque;
-if (os->out)
-avio_write(os->out, buf, buf_size);
-return buf_size;
-}
-
 // RFC 6381
 static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
   char *str, int size)
@@ -176,6 +167,28 @@ static void set_codec_str(AVFormatContext *s, 
AVCodecParameters *par,
 }
 }
 
+static int flush_dynbuf(OutputStream *os, int *range_length)
+{
+uint8_t *buffer;
+
+if (!os->ctx->pb) {
+return AVERROR(EINVAL);
+}
+
+// flush
+av_write_frame(os->ctx, NULL);
+avio_flush(os->ctx->pb);
+
+// write out to file
+*range_length = avio_close_dyn_buf(os->ctx->pb, );
+os->ctx->pb = NULL;
+avio_write(os->out, buffer, *range_length);
+av_free(buffer);
+
+// re-open buffer
+return avio_open_dyn_buf(>ctx->pb);
+}
+
 static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -195,7 +208,7 @@ static void dash_free(AVFormatContext *s)
 if (os->ctx && os->ctx_inited)
 av_write_trailer(os->ctx);
 if (os->ctx && os->ctx->pb)
-av_free(os->ctx->pb);
+ffio_free_dyn_buf(>ctx->pb);
 ff_format_io_close(s, >out);
 if (os->ctx)
 avformat_free_context(os->ctx);
@@ -696,9 +709,8 @@ static int dash_init(AVFormatContext *s)
 ctx->avoid_negative_ts = s->avoid_negative_ts;
 ctx->flags = s->flags;
 
-ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), 
AVIO_FLAG_WRITE, os, NULL, dash_write, NULL);
-if (!ctx->pb)
-return AVERROR(ENOMEM);
+if ((ret = avio_open_dyn_buf(>pb)) < 0)
+return ret;
 
 if (c->single_file) {
 if (c->single_file_name)
@@ -877,7 +889,6 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
 char filename[1024] = "", full_path[1024], temp_path[1024];
-int64_t start_pos;
 int range_length, index_length = 0;
 
 if (!os->packets_written)
@@ -896,14 +907,14 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 }
 
 if (!os->init_range_length) {
-av_write_frame(os->ctx, NULL);
-os->init_range_length = avio_tell(os->ctx->pb);
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+break;
+os->pos = os->init_range_length = range_length;
 if (!c->single_file)
 ff_format_io_close(s, >out);
 }
 
-start_pos = avio_tell(os->ctx->pb);
-
 if (!c->single_file) {
 ff_dash_fill_tmpl_params(filename, sizeof(filename), 
c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts);
 snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
filename);
@@ -916,13 +927,13 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
os->initfile);
 }
 
-av_write_frame(os->ctx, NULL);
-avio_flush(os->ctx->pb);
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+break;
 os->packets_written = 0;
 
-range_length = avio_tell(os->ctx->pb) - start_pos;
 if (c->single_file) {
-find_index_range(s, full_path, start_pos, _length);
+find_index_range(s, full_path, os->pos, _length);
 } else {
 ff_format_io_close(s, >out);
 
@@ -942,8 +953,10 @@ static int dash_flush(AVFormatContext *s, int final, 

[FFmpeg-cvslog] Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:13:09 2017 -0300| [1b8ef01f04ab2210a26b59d3a1a62daed52ce88a] | committer: 
James Almer

Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad'

* commit '7295b7373862ee54903b33d6ef3335531dfa93ad':
  dashenc: add webm support

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 101 --
 libavformat/version.h |   2 +-
 2 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index bde938f587..240ff41380 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -61,6 +61,7 @@ typedef struct OutputStream {
 AVFormatContext *ctx;
 int ctx_inited, as_idx;
 AVIOContext *out;
+char format_name[8];
 int packets_written;
 char initfile[1024];
 int64_t init_start_pos, pos;
@@ -101,12 +102,32 @@ typedef struct DASHContext {
 const char *utc_timing_url;
 } DASHContext;
 
-// RFC 6381
+static struct codec_string {
+int id;
+const char *str;
+} codecs[] = {
+{ AV_CODEC_ID_VP8, "vp8" },
+{ AV_CODEC_ID_VP9, "vp9" },
+{ AV_CODEC_ID_VORBIS, "vorbis" },
+{ AV_CODEC_ID_OPUS, "opus" },
+{ 0, NULL }
+};
+
 static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
   char *str, int size)
 {
 const AVCodecTag *tags[2] = { NULL, NULL };
 uint32_t tag;
+int i;
+
+// common Webm codecs are not part of RFC 6381
+for (i = 0; codecs[i].id; i++)
+if (codecs[i].id == par->codec_id) {
+av_strlcpy(str, codecs[i].str, size);
+return;
+}
+
+// for codecs part of RFC 6381
 if (par->codec_type == AVMEDIA_TYPE_VIDEO)
 tags[0] = ff_codec_movvideo_tags;
 else if (par->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -189,6 +210,21 @@ static int flush_dynbuf(OutputStream *os, int 
*range_length)
 return avio_open_dyn_buf(>ctx->pb);
 }
 
+static int flush_init_segment(AVFormatContext *s, OutputStream *os)
+{
+DASHContext *c = s->priv_data;
+int ret, range_length;
+
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+return ret;
+
+os->pos = os->init_range_length = range_length;
+if (!c->single_file)
+ff_format_io_close(s, >out);
+return 0;
+}
+
 static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -376,14 +412,14 @@ static int write_adaptation_set(AVFormatContext *s, 
AVIOContext *out, int as_ind
 
 if (as->media_type == AVMEDIA_TYPE_VIDEO) {
 AVStream *st = s->streams[i];
-avio_printf(out, "\t\t\tcodec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
+avio_printf(out, "\t\t\tformat_name, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
 if (st->avg_frame_rate.num)
 avio_printf(out, " frameRate=\"%d/%d\"", 
st->avg_frame_rate.num, st->avg_frame_rate.den);
 avio_printf(out, ">\n");
 } else {
-avio_printf(out, "\t\t\t\n",
-i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
+avio_printf(out, "\t\t\t\n",
+i, os->format_name, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
 avio_printf(out, "\t\t\t\t\n",
 s->streams[i]->codecpar->channels);
 }
@@ -628,11 +664,18 @@ static int dict_copy_entry(AVDictionary **dst, const 
AVDictionary *src, const ch
 return 0;
 }
 
+static int dict_set_int(AVDictionary **pm, const char *key, int64_t value, int 
flags)
+{
+char valuestr[22];
+snprintf(valuestr, sizeof(valuestr), "%"PRId64, value);
+flags &= ~AV_DICT_DONT_STRDUP_VAL;
+return av_dict_set(pm, key, valuestr, flags);
+}
+
 static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int ret = 0, i;
-AVOutputFormat *oformat;
 char *ptr;
 char basename[1024];
 
@@ -656,10 +699,6 @@ static int dash_init(AVFormatContext *s)
 if (ptr)
 *ptr = '\0';
 
-oformat = av_guess_format("mp4", NULL, NULL);
-if (!oformat)
-return AVERROR_MUXER_NOT_FOUND;
-
 c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
 if (!c->streams)
 return AVERROR(ENOMEM);
@@ -694,8 +733,22 @@ static int dash_init(AVFormatContext *s)
 ctx = avformat_alloc_context();
 if (!ctx)
 return AVERROR(ENOMEM);
+
+// choose muxer based on codec: webm for VP8/9 and opus, mp4 otherwise
+// note: os->format_name is also used as part of the mimetype of the
+//   representation, e.g. video/
+if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_VP8 ||
+

[FFmpeg-cvslog] Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:11:25 2017 -0300| [3f7a8bb67b27bd3c32f3932096033a1787405601] | committer: 
James Almer

Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115'

* commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115':
  dashenc: default to one AdaptationSet per stream

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 7b0f6714a8..5a966fe3ad 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -413,26 +413,15 @@ static int parse_adaptation_sets(AVFormatContext *s)
 enum { new_set, parse_id, parsing_streams } state;
 AdaptationSet *as;
 int i, n, ret;
-enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, 
AVMEDIA_TYPE_UNKNOWN };
 
-// default: one AdaptationSet for each media type
+// default: one AdaptationSet for each stream
 if (!p) {
-for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) {
-int as_idx = 0;
-
-for (i = 0; i < s->nb_streams; i++) {
-if (s->streams[i]->codecpar->codec_type != types[n])
-continue;
-
-if (!as_idx) {
-if ((ret = add_adaptation_set(s, , types[n])) < 0)
-return ret;
-as_idx = c->nb_as;
+for (i = 0; i < s->nb_streams; i++) {
+if ((ret = add_adaptation_set(s, , 
s->streams[i]->codecpar->codec_type)) < 0)
+return ret;
+snprintf(as->id, sizeof(as->id), "%d", i);
 
-snprintf(as->id, sizeof(as->id), "%d", i);
-}
-c->streams[i].as_idx = as_idx;
-}
+c->streams[i].as_idx = c->nb_as;
 }
 goto end;
 }


==


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


[FFmpeg-cvslog] Merge commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:11:50 2017 -0300| [5c9373385d1a1d940b84f71fb583dc5519b17b8a] | committer: 
James Almer

Merge commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e'

* commit 'dce2929efa8e82b0832a828f7e8cb81ff8c20a4e':
  dashenc: copy language and role metadata from streams assigned to sets

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 5a966fe3ad..ab6bf21dbd 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -54,6 +54,7 @@ typedef struct Segment {
 typedef struct AdaptationSet {
 char id[10];
 enum AVMediaType media_type;
+AVDictionary *metadata;
 } AdaptationSet;
 
 typedef struct OutputStream {
@@ -181,6 +182,8 @@ static void dash_free(AVFormatContext *s)
 int i, j;
 
 if (c->as) {
+for (i = 0; i < c->nb_as; i++)
+av_dict_free(>as[i].metadata);
 av_freep(>as);
 c->nb_as = 0;
 }
@@ -336,14 +339,22 @@ static int write_adaptation_set(AVFormatContext *s, 
AVIOContext *out, int as_ind
 {
 DASHContext *c = s->priv_data;
 AdaptationSet *as = >as[as_index];
+AVDictionaryEntry *lang, *role;
 int i;
 
 avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : 
"audio");
 if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && 
!c->ambiguous_frame_rate)
 avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, 
c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, 
c->max_frame_rate.den);
+lang = av_dict_get(as->metadata, "language", NULL, 0);
+if (lang)
+avio_printf(out, " lang=\"%s\"", lang->value);
 avio_printf(out, ">\n");
 
+role = av_dict_get(as->metadata, "role", NULL, 0);
+if (role)
+avio_printf(out, "\t\t\t\n", role->value);
+
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
 
@@ -596,6 +607,14 @@ static int write_manifest(AVFormatContext *s, int final)
 return 0;
 }
 
+static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const 
char *key)
+{
+AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0);
+if (entry)
+av_dict_set(dst, key, entry->value, AV_DICT_DONT_OVERWRITE);
+return 0;
+}
+
 static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -637,6 +656,7 @@ static int dash_init(AVFormatContext *s)
 
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
+AdaptationSet *as = >as[os->as_idx - 1];
 AVFormatContext *ctx;
 AVStream *st;
 AVDictionary *opts = NULL;
@@ -654,6 +674,10 @@ static int dash_init(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
+// copy AdaptationSet language and role from stream metadata
+dict_copy_entry(>metadata, s->streams[i]->metadata, "language");
+dict_copy_entry(>metadata, s->streams[i]->metadata, "role");
+
 ctx = avformat_alloc_context();
 if (!ctx)
 return AVERROR(ENOMEM);


==

diff --cc libavformat/dashenc.c
index 5a966fe3ad,8b70278b39..ab6bf21dbd
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@@ -340,10 -462,15 +344,17 @@@ static int write_adaptation_set(AVForma
  
  avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : 
"audio");
 +if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && 
!c->ambiguous_frame_rate)
 +avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, 
c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, 
c->max_frame_rate.den);
+ lang = av_dict_get(as->metadata, "language", NULL, 0);
+ if (lang)
+ avio_printf(out, " lang=\"%s\"", lang->value);
  avio_printf(out, ">\n");
  
+ role = av_dict_get(as->metadata, "role", NULL, 0);
+ if (role)
+ avio_printf(out, "\t\t\t\n", role->value);
+ 
  for (i = 0; i < s->nb_streams; i++) {
  OutputStream *os = >streams[i];
  
@@@ -589,14 -706,18 +600,22 @@@ static int write_manifest(AVFormatConte
  avio_printf(out, "\n");
  avio_flush(out);
  ff_format_io_close(s, );
 -return ff_rename(temp_filename, s->filename);
 +
 +if (use_rename)
 +return avpriv_io_move(temp_filename, s->filename);
 +
 +return 0;
  }
  
+ static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const 
char *key)
+ {
+ AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0);
+ if (entry)
+ av_dict_set(dst, key, entry->value, AV_DICT_DONT_OVERWRITE);
+ return 0;
+ }
+ 
 -static int 

[FFmpeg-cvslog] Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:11:02 2017 -0300| [c0fae3ff902e772d1c98a192d982893b2e8f1105] | committer: 
James Almer

Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99'

* commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99':
  dashenc: allow assigning all streams of a media type to an AdaptationSet

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 61 +--
 1 file changed, 45 insertions(+), 16 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 3719a1ea01..7b0f6714a8 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -388,6 +388,24 @@ static int add_adaptation_set(AVFormatContext *s, 
AdaptationSet **as, enum AVMed
 return 0;
 }
 
+static int adaptation_set_add_stream(AVFormatContext *s, int as_idx, int i)
+{
+DASHContext *c = s->priv_data;
+AdaptationSet *as = >as[as_idx - 1];
+OutputStream *os = >streams[i];
+
+if (as->media_type != s->streams[i]->codecpar->codec_type) {
+av_log(s, AV_LOG_ERROR, "Codec type of stream %d doesn't match 
AdaptationSet's media type\n", i);
+return AVERROR(EINVAL);
+} else if (os->as_idx) {
+av_log(s, AV_LOG_ERROR, "Stream %d is already assigned to an 
AdaptationSet\n", i);
+return AVERROR(EINVAL);
+}
+os->as_idx = as_idx;
+
+return 0;
+}
+
 static int parse_adaptation_sets(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -441,30 +459,41 @@ static int parse_adaptation_sets(AVFormatContext *s)
 state = parsing_streams;
 } else if (state == parsing_streams) {
 AdaptationSet *as = >as[c->nb_as - 1];
-OutputStream *os;
 char idx_str[8], *end_str;
 
 n = strcspn(p, " ,");
 snprintf(idx_str, sizeof(idx_str), "%.*s", n, p);
 p += n;
 
-i = strtol(idx_str, _str, 10);
-if (idx_str == end_str || i < 0 || i >= s->nb_streams) {
-av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not found!\n", 
idx_str);
-return AVERROR(EINVAL);
-}
+// if value is "a" or "v", map all streams of that type
+if (as->media_type == AVMEDIA_TYPE_UNKNOWN && (idx_str[0] == 'v' 
|| idx_str[0] == 'a')) {
+enum AVMediaType type = (idx_str[0] == 'v') ? 
AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO;
+av_log(s, AV_LOG_DEBUG, "Map all streams of type %s\n", 
idx_str);
 
-os = >streams[i];
-if (as->media_type == AVMEDIA_TYPE_UNKNOWN) {
-as->media_type = s->streams[i]->codecpar->codec_type;
-} else if (as->media_type != s->streams[i]->codecpar->codec_type) {
-av_log(s, AV_LOG_ERROR, "Mixing codec types within an 
AdaptationSet is not allowed\n");
-return AVERROR(EINVAL);
-} else if (os->as_idx) {
-av_log(s, AV_LOG_ERROR, "Assigning a stream to more than one 
AdaptationSet is not allowed\n");
-return AVERROR(EINVAL);
+for (i = 0; i < s->nb_streams; i++) {
+if (s->streams[i]->codecpar->codec_type != type)
+continue;
+
+as->media_type = s->streams[i]->codecpar->codec_type;
+
+if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0)
+return ret;
+}
+} else { // select single stream
+i = strtol(idx_str, _str, 10);
+if (idx_str == end_str || i < 0 || i >= s->nb_streams) {
+av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not 
found!\n", idx_str);
+return AVERROR(EINVAL);
+}
+av_log(s, AV_LOG_DEBUG, "Map stream %d\n", i);
+
+if (as->media_type == AVMEDIA_TYPE_UNKNOWN) {
+as->media_type = s->streams[i]->codecpar->codec_type;
+}
+
+if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0)
+return ret;
 }
-os->as_idx = c->nb_as;
 
 if (*p == ' ')
 state = new_set;


==


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


[FFmpeg-cvslog] Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:02:44 2017 -0300| [3b9ef13588360b16c22ece7521ebd9b11f9ffb17] | committer: 
James Almer

Merge commit '9df9309d233f59d9706444a1e24ac24139f2640d'

* commit '9df9309d233f59d9706444a1e24ac24139f2640d':
  dashenc: calculate stream bitrate from first segment if not available

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index ca24015115..089a3e7b01 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -754,6 +754,16 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 break;
 }
 }
+
+if (!os->bit_rate) {
+// calculate average bitrate of first segment
+int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
(os->max_pts - os->start_pts);
+if (bitrate >= 0) {
+os->bit_rate = bitrate;
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+ " bandwidth=\"%d\"", os->bit_rate);
+}
+}
 add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, 
start_pos, range_length, index_length);
 av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written 
to: %s\n", i, os->segment_index, full_path);
 }


==

diff --cc libavformat/dashenc.c
index ca24015115,21acb9006c..089a3e7b01
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@@ -747,13 -830,20 +747,23 @@@ static int dash_flush(AVFormatContext *
  find_index_range(s, full_path, start_pos, _length);
  } else {
  ff_format_io_close(s, >out);
 -ret = ff_rename(temp_path, full_path);
 -if (ret < 0)
 -break;
 +
 +if (use_rename) {
 +ret = avpriv_io_move(temp_path, full_path);
 +if (ret < 0)
 +break;
 +}
  }
+ 
+ if (!os->bit_rate) {
+ // calculate average bitrate of first segment
+ int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
(os->max_pts - os->start_pts);
+ if (bitrate >= 0) {
+ os->bit_rate = bitrate;
+ snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+  " bandwidth=\"%d\"", os->bit_rate);
+ }
+ }
  add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, 
start_pos, range_length, index_length);
  av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written 
to: %s\n", i, os->segment_index, full_path);
  }

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


[FFmpeg-cvslog] doc: add dash muxer

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:33 
2017 +0100| [c5c663541739cb813a2a5668ee8339b535b35d7d] | committer: Martin 
Storsjö

doc: add dash muxer

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 doc/muxers.texi | 62 +
 1 file changed, 62 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 5430da7850..62cd8d025b 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -53,6 +53,68 @@ avconv -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
 
 See also the @ref{framecrc} muxer.
 
+@anchor{dash}
+@section dash
+
+Dynamic Adaptive Streaming over HTTP (DASH) muxer that creates segments
+and manifest files according to the MPEG-DASH standard ISO/IEC 23009-1:2014.
+
+For more information see:
+
+@itemize @bullet
+@item
+ISO DASH Specification: 
@url{http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip}
+@item
+WebM DASH Specification: 
@url{https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification}
+@end itemize
+
+It creates a MPD manifest file and segment files for each stream.
+
+The segment filename might contain pre-defined identifiers used with 
SegmentTemplate
+as defined in section 5.3.9.4.4 of the standard. Available identifiers are 
"$RepresentationID$",
+"$Number$", "$Bandwidth$" and "$Time$".
+
+@example
+avconv -re -i  -map 0 -map 0 -c:a libfdk_aac -c:v libx264
+-b:v:0 800k -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline
+-profile:v:0 main -bf 1 -keyint_min 120 -g 120 -sc_threshold 0
+-b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1
+-window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a"
+-f dash /path/to/out.mpd
+@end example
+
+@table @option
+@item -min_seg_duration @var{microseconds}
+Set the segment length in microseconds.
+@item -window_size @var{size}
+Set the maximum number of segments kept in the manifest.
+@item -extra_window_size @var{size}
+Set the maximum number of segments kept outside of the manifest before 
removing from disk.
+@item -remove_at_exit @var{remove}
+Enable (1) or disable (0) removal of all segments when finished.
+@item -use_template @var{template}
+Enable (1) or disable (0) use of SegmentTemplate instead of SegmentList.
+@item -use_timeline @var{timeline}
+Enable (1) or disable (0) use of SegmentTimeline in SegmentTemplate.
+@item -single_file @var{single_file}
+Enable (1) or disable (0) storing all segments in one file, accessed using 
byte ranges.
+@item -single_file_name @var{file_name}
+DASH-templated name to be used for baseURL. Implies @var{single_file} set to 
"1".
+@item -init_seg_name @var{init_name}
+DASH-templated name to used for the initialization segment. Default is 
"init-stream$RepresentationID$.m4s"
+@item -media_seg_name @var{segment_name}
+DASH-templated name to used for the media segments. Default is 
"chunk-stream$RepresentationID$-$Number%05d$.m4s"
+@item -utc_timing_url @var{utc_url}
+URL of the page that will return the UTC timestamp in ISO format. Example: 
"https://time.akamai.com/?iso;
+@item -adaptation_sets @var{adaptation_sets}
+Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c 
id=y,streams=d,e" with x and y being the IDs
+of the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
+
+To map all video (or audio) streams to an AdaptationSet, "v" (or "a") can be 
used as stream identifier instead of IDs.
+
+When no assignment is defined, this defaults to an AdaptationSet for each 
stream.
+@end table
+
 @anchor{framecrc}
 @section framecrc
 

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


[FFmpeg-cvslog] Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Sep 26 
14:10:30 2017 -0300| [777d53c793a2f19b9f87d935fcb16f07ceae0dca] | committer: 
James Almer

Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61'

* commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61':
  dashenc: add support for assigning streams to AdaptationSets

Merged-by: Rodger Combs 

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

 libavformat/dashenc.c | 223 --
 1 file changed, 180 insertions(+), 43 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 089a3e7b01..3719a1ea01 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -25,6 +25,7 @@
 #endif
 
 #include "libavutil/avassert.h"
+#include "libavutil/avutil.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
@@ -50,9 +51,14 @@ typedef struct Segment {
 int n;
 } Segment;
 
+typedef struct AdaptationSet {
+char id[10];
+enum AVMediaType media_type;
+} AdaptationSet;
+
 typedef struct OutputStream {
 AVFormatContext *ctx;
-int ctx_inited;
+int ctx_inited, as_idx;
 uint8_t iobuf[32768];
 AVIOContext *out;
 int packets_written;
@@ -71,6 +77,9 @@ typedef struct OutputStream {
 
 typedef struct DASHContext {
 const AVClass *class;  /* Class for private options. */
+char *adaptation_sets;
+AdaptationSet *as;
+int nb_as;
 int window_size;
 int extra_window_size;
 int min_seg_duration;
@@ -79,7 +88,7 @@ typedef struct DASHContext {
 int use_timeline;
 int single_file;
 OutputStream *streams;
-int has_video, has_audio;
+int has_video;
 int64_t last_duration;
 int64_t total_duration;
 char availability_start_time[100];
@@ -170,6 +179,12 @@ static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int i, j;
+
+if (c->as) {
+av_freep(>as);
+c->nb_as = 0;
+}
+
 if (!c->streams)
 return;
 for (i = 0; i < s->nb_streams; i++) {
@@ -317,12 +332,167 @@ static void format_date_now(char *buf, int size)
 }
 }
 
+static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int 
as_index)
+{
+DASHContext *c = s->priv_data;
+AdaptationSet *as = >as[as_index];
+int i;
+
+avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : 
"audio");
+if (as->media_type == AVMEDIA_TYPE_VIDEO && c->max_frame_rate.num && 
!c->ambiguous_frame_rate)
+avio_printf(out, " %s=\"%d/%d\"", (av_cmp_q(c->min_frame_rate, 
c->max_frame_rate) < 0) ? "maxFrameRate" : "frameRate", c->max_frame_rate.num, 
c->max_frame_rate.den);
+avio_printf(out, ">\n");
+
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = >streams[i];
+
+if (os->as_idx - 1 != as_index)
+continue;
+
+if (as->media_type == AVMEDIA_TYPE_VIDEO) {
+AVStream *st = s->streams[i];
+avio_printf(out, "\t\t\tcodec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
+if (st->avg_frame_rate.num)
+avio_printf(out, " frameRate=\"%d/%d\"", 
st->avg_frame_rate.num, st->avg_frame_rate.den);
+avio_printf(out, ">\n");
+} else {
+avio_printf(out, "\t\t\t\n",
+i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
+avio_printf(out, "\t\t\t\t\n",
+s->streams[i]->codecpar->channels);
+}
+output_segment_list(os, out, c);
+avio_printf(out, "\t\t\t\n");
+}
+avio_printf(out, "\t\t\n");
+
+return 0;
+}
+
+static int add_adaptation_set(AVFormatContext *s, AdaptationSet **as, enum 
AVMediaType type)
+{
+DASHContext *c = s->priv_data;
+
+void *mem = av_realloc(c->as, sizeof(*c->as) * (c->nb_as + 1));
+if (!mem)
+return AVERROR(ENOMEM);
+c->as = mem;
+++c->nb_as;
+
+*as = >as[c->nb_as - 1];
+memset(*as, 0, sizeof(**as));
+(*as)->media_type = type;
+
+return 0;
+}
+
+static int parse_adaptation_sets(AVFormatContext *s)
+{
+DASHContext *c = s->priv_data;
+const char *p = c->adaptation_sets;
+enum { new_set, parse_id, parsing_streams } state;
+AdaptationSet *as;
+int i, n, ret;
+enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, 
AVMEDIA_TYPE_UNKNOWN };
+
+// default: one AdaptationSet for each media type
+if (!p) {
+for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) {
+int as_idx = 0;
+
+for (i = 0; i < s->nb_streams; i++) {
+if (s->streams[i]->codecpar->codec_type != types[n])
+continue;
+
+if (!as_idx) {
+if ((ret = add_adaptation_set(s, , types[n])) < 0)
+

[FFmpeg-cvslog] Revert "lavf/dashenc: update bitrates on dash_write_trailer"

2017-09-26 Thread James Almer
ffmpeg | branch: master | James Almer  | Tue Sep 26 13:59:56 
2017 -0300| [52223ffe44614738499ea6c0068810e250fb7b26] | committer: James Almer

Revert "lavf/dashenc: update bitrates on dash_write_trailer"

This reverts commit 89c0fda5f43d8a3d3a1c538ff8d72e6737bc7d8e.

A different solution will be committed instead.

Signed-off-by: James Almer 

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

 libavformat/dashenc.c | 42 --
 1 file changed, 12 insertions(+), 30 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 6471649eb7..ca24015115 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -443,30 +443,6 @@ static int write_manifest(AVFormatContext *s, int final)
 return 0;
 }
 
-static int set_bitrate(AVFormatContext *s)
-{
-DASHContext *c = s->priv_data;
-int i;
-
-for (i = 0; i < s->nb_streams; i++) {
-OutputStream *os = >streams[i];
-
-os->bit_rate = s->streams[i]->codecpar->bit_rate;
-if (os->bit_rate) {
-snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
- " bandwidth=\"%d\"", os->bit_rate);
-} else {
-int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
-AV_LOG_ERROR : AV_LOG_WARNING;
-av_log(s, level, "No bit rate set for stream %d\n", i);
-if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
-return AVERROR(EINVAL);
-}
-}
-
-return 0;
-}
-
 static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -503,10 +479,6 @@ static int dash_init(AVFormatContext *s)
 if (!c->streams)
 return AVERROR(ENOMEM);
 
-ret = set_bitrate(s);
-if (ret < 0)
-return ret;
-
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
 AVFormatContext *ctx;
@@ -514,6 +486,18 @@ static int dash_init(AVFormatContext *s)
 AVDictionary *opts = NULL;
 char filename[1024];
 
+os->bit_rate = s->streams[i]->codecpar->bit_rate;
+if (os->bit_rate) {
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+ " bandwidth=\"%d\"", os->bit_rate);
+} else {
+int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
+AV_LOG_ERROR : AV_LOG_WARNING;
+av_log(s, level, "No bit rate set for stream %d\n", i);
+if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
+return AVERROR(EINVAL);
+}
+
 ctx = avformat_alloc_context();
 if (!ctx)
 return AVERROR(ENOMEM);
@@ -878,8 +862,6 @@ static int dash_write_trailer(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 
-set_bitrate(s);
-
 if (s->nb_streams > 0) {
 OutputStream *os = >streams[0];
 // If no segments have been written so far, try to do a crude

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


[FFmpeg-cvslog] dashenc: add webm support

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:32 
2017 +0100| [7295b7373862ee54903b33d6ef3335531dfa93ad] | committer: Martin 
Storsjö

dashenc: add webm support

Use webm muxer for VP8, VP9 and Opus codec, mp4 muxer otherwise.

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 103 --
 libavformat/version.h |   2 +-
 2 files changed, 83 insertions(+), 22 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 78ebc0628a..7134af4978 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -68,6 +68,7 @@ typedef struct OutputStream {
 AVFormatContext *ctx;
 int ctx_inited, as_idx;
 AVIOContext *out;
+char format_name[8];
 int packets_written;
 char initfile[1024];
 int64_t init_start_pos, pos;
@@ -106,12 +107,32 @@ typedef struct DASHContext {
 const char *utc_timing_url;
 } DASHContext;
 
-// RFC 6381
+static struct codec_string {
+int id;
+const char *str;
+} codecs[] = {
+{ AV_CODEC_ID_VP8, "vp8" },
+{ AV_CODEC_ID_VP9, "vp9" },
+{ AV_CODEC_ID_VORBIS, "vorbis" },
+{ AV_CODEC_ID_OPUS, "opus" },
+{ 0, NULL }
+};
+
 static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
   char *str, int size)
 {
 const AVCodecTag *tags[2] = { NULL, NULL };
 uint32_t tag;
+int i;
+
+// common Webm codecs are not part of RFC 6381
+for (i = 0; codecs[i].id; i++)
+if (codecs[i].id == par->codec_id) {
+av_strlcpy(str, codecs[i].str, size);
+return;
+}
+
+// for codecs part of RFC 6381
 if (par->codec_type == AVMEDIA_TYPE_VIDEO)
 tags[0] = ff_codec_movvideo_tags;
 else if (par->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -194,6 +215,21 @@ static int flush_dynbuf(OutputStream *os, int 
*range_length)
 return avio_open_dyn_buf(>ctx->pb);
 }
 
+static int flush_init_segment(AVFormatContext *s, OutputStream *os)
+{
+DASHContext *c = s->priv_data;
+int ret, range_length;
+
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+return ret;
+
+os->pos = os->init_range_length = range_length;
+if (!c->single_file)
+ff_format_io_close(s, >out);
+return 0;
+}
+
 static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -491,11 +527,11 @@ static int write_adaptation_set(AVFormatContext *s, 
AVIOContext *out, int as_ind
 continue;
 
 if (as->media_type == AVMEDIA_TYPE_VIDEO) {
-avio_printf(out, "\t\t\t\n",
-i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
+avio_printf(out, "\t\t\t\n",
+i, os->format_name, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
 } else {
-avio_printf(out, "\t\t\t\n",
-i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
+avio_printf(out, "\t\t\t\n",
+i, os->format_name, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
 avio_printf(out, "\t\t\t\t\n",
 s->streams[i]->codecpar->channels);
 }
@@ -730,11 +766,18 @@ static int dict_copy_entry(AVDictionary **dst, const 
AVDictionary *src, const ch
 return 0;
 }
 
+static int dict_set_int(AVDictionary **pm, const char *key, int64_t value, int 
flags)
+{
+char valuestr[22];
+snprintf(valuestr, sizeof(valuestr), "%"PRId64, value);
+flags &= ~AV_DICT_DONT_STRDUP_VAL;
+return av_dict_set(pm, key, valuestr, flags);
+}
+
 static int dash_write_header(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int ret = 0, i;
-AVOutputFormat *oformat;
 char *ptr;
 char basename[1024];
 
@@ -757,12 +800,6 @@ static int dash_write_header(AVFormatContext *s)
 if (ptr)
 *ptr = '\0';
 
-oformat = av_guess_format("mp4", NULL, NULL);
-if (!oformat) {
-ret = AVERROR_MUXER_NOT_FOUND;
-goto fail;
-}
-
 c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
 if (!c->streams) {
 ret = AVERROR(ENOMEM);
@@ -803,8 +840,24 @@ static int dash_write_header(AVFormatContext *s)
 ret = AVERROR(ENOMEM);
 goto fail;
 }
+
+// choose muxer based on codec: webm for VP8/9 and opus, mp4 otherwise
+// note: os->format_name is also used as part of the mimetype of the
+//   representation, e.g. video/
+if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_VP8 ||
+s->streams[i]->codecpar->codec_id == AV_CODEC_ID_VP9 ||
+s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS ||
+   

[FFmpeg-cvslog] dashenc: use avio_dynbuf instead of packet_write callback

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:31 
2017 +0100| [01f1f017d831cf14617aaaeafcec3ae3a81efce7] | committer: Martin 
Storsjö

dashenc: use avio_dynbuf instead of packet_write callback

The dash_write function drops data, if no IOContext is initialized.

Since the mp4 muxer is used in "frag_custom" mode, data is only
written when calling av_write_frame(NULL) explicitly and thus
there will be no data loss.

To add support for webm as subordinate muxer, which doesn't have
such a mode, a dynamic buffer is required to provide an always
initialized IOContext.

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 61 ++-
 1 file changed, 36 insertions(+), 25 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 8b70278b39..78ebc0628a 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -67,11 +67,10 @@ typedef struct AdaptationSet {
 typedef struct OutputStream {
 AVFormatContext *ctx;
 int ctx_inited, as_idx;
-uint8_t iobuf[32768];
 AVIOContext *out;
 int packets_written;
 char initfile[1024];
-int64_t init_start_pos;
+int64_t init_start_pos, pos;
 int init_range_length;
 int nb_segments, segments_size, segment_index;
 Segment **segments;
@@ -107,14 +106,6 @@ typedef struct DASHContext {
 const char *utc_timing_url;
 } DASHContext;
 
-static int dash_write(void *opaque, uint8_t *buf, int buf_size)
-{
-OutputStream *os = opaque;
-if (os->out)
-avio_write(os->out, buf, buf_size);
-return buf_size;
-}
-
 // RFC 6381
 static void set_codec_str(AVFormatContext *s, AVCodecParameters *par,
   char *str, int size)
@@ -181,6 +172,28 @@ static void set_codec_str(AVFormatContext *s, 
AVCodecParameters *par,
 }
 }
 
+static int flush_dynbuf(OutputStream *os, int *range_length)
+{
+uint8_t *buffer;
+
+if (!os->ctx->pb) {
+return AVERROR(EINVAL);
+}
+
+// flush
+av_write_frame(os->ctx, NULL);
+avio_flush(os->ctx->pb);
+
+// write out to file
+*range_length = avio_close_dyn_buf(os->ctx->pb, );
+os->ctx->pb = NULL;
+avio_write(os->out, buffer, *range_length);
+av_free(buffer);
+
+// re-open buffer
+return avio_open_dyn_buf(>ctx->pb);
+}
+
 static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -200,7 +213,7 @@ static void dash_free(AVFormatContext *s)
 if (os->ctx && os->ctx_inited)
 av_write_trailer(os->ctx);
 if (os->ctx && os->ctx->pb)
-av_free(os->ctx->pb);
+ffio_free_dyn_buf(>ctx->pb);
 ff_format_io_close(s, >out);
 if (os->ctx)
 avformat_free_context(os->ctx);
@@ -806,11 +819,8 @@ static int dash_write_header(AVFormatContext *s)
 st->time_base = s->streams[i]->time_base;
 ctx->avoid_negative_ts = s->avoid_negative_ts;
 
-ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), 
AVIO_FLAG_WRITE, os, NULL, dash_write, NULL);
-if (!ctx->pb) {
-ret = AVERROR(ENOMEM);
+if ((ret = avio_open_dyn_buf(>pb)) < 0)
 goto fail;
-}
 
 if (c->single_file) {
 if (c->single_file_name)
@@ -966,7 +976,6 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
 char filename[1024] = "", full_path[1024], temp_path[1024];
-int64_t start_pos;
 int range_length, index_length = 0;
 
 if (!os->packets_written)
@@ -985,14 +994,14 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 }
 
 if (!os->init_range_length) {
-av_write_frame(os->ctx, NULL);
-os->init_range_length = avio_tell(os->ctx->pb);
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+break;
+os->pos = os->init_range_length = range_length;
 if (!c->single_file)
 ff_format_io_close(s, >out);
 }
 
-start_pos = avio_tell(os->ctx->pb);
-
 if (!c->single_file) {
 dash_fill_tmpl_params(filename, sizeof(filename), 
c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts);
 snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
filename);
@@ -1005,13 +1014,13 @@ static int dash_flush(AVFormatContext *s, int final, 
int stream)
 snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, 
os->initfile);
 }
 
-av_write_frame(os->ctx, NULL);
-avio_flush(os->ctx->pb);
+ret = flush_dynbuf(os, _length);
+if (ret < 0)
+break;
 os->packets_written = 0;
 
-

[FFmpeg-cvslog] dashenc: copy language and role metadata from streams assigned to sets

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:30 
2017 +0100| [dce2929efa8e82b0832a828f7e8cb81ff8c20a4e] | committer: Martin 
Storsjö

dashenc: copy language and role metadata from streams assigned to sets

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 286b24def3..8b70278b39 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -61,6 +61,7 @@ typedef struct Segment {
 typedef struct AdaptationSet {
 char id[10];
 enum AVMediaType media_type;
+AVDictionary *metadata;
 } AdaptationSet;
 
 typedef struct OutputStream {
@@ -186,6 +187,8 @@ static void dash_free(AVFormatContext *s)
 int i, j;
 
 if (c->as) {
+for (i = 0; i < c->nb_as; i++)
+av_dict_free(>as[i].metadata);
 av_freep(>as);
 c->nb_as = 0;
 }
@@ -454,10 +457,19 @@ static int write_adaptation_set(AVFormatContext *s, 
AVIOContext *out, int as_ind
 {
 DASHContext *c = s->priv_data;
 AdaptationSet *as = >as[as_index];
+AVDictionaryEntry *lang, *role;
 int i;
 
-avio_printf(out, "\t\t\n",
+avio_printf(out, "\t\tid, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : 
"audio");
+lang = av_dict_get(as->metadata, "language", NULL, 0);
+if (lang)
+avio_printf(out, " lang=\"%s\"", lang->value);
+avio_printf(out, ">\n");
+
+role = av_dict_get(as->metadata, "role", NULL, 0);
+if (role)
+avio_printf(out, "\t\t\t\n", role->value);
 
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
@@ -697,6 +709,14 @@ static int write_manifest(AVFormatContext *s, int final)
 return ff_rename(temp_filename, s->filename);
 }
 
+static int dict_copy_entry(AVDictionary **dst, const AVDictionary *src, const 
char *key)
+{
+AVDictionaryEntry *entry = av_dict_get(src, key, NULL, 0);
+if (entry)
+av_dict_set(dst, key, entry->value, AV_DICT_DONT_OVERWRITE);
+return 0;
+}
+
 static int dash_write_header(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -741,6 +761,7 @@ static int dash_write_header(AVFormatContext *s)
 
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
+AdaptationSet *as = >as[os->as_idx - 1];
 AVFormatContext *ctx;
 AVStream *st;
 AVDictionary *opts = NULL;
@@ -760,6 +781,10 @@ static int dash_write_header(AVFormatContext *s)
 }
 }
 
+// copy AdaptationSet language and role from stream metadata
+dict_copy_entry(>metadata, s->streams[i]->metadata, "language");
+dict_copy_entry(>metadata, s->streams[i]->metadata, "role");
+
 ctx = avformat_alloc_context();
 if (!ctx) {
 ret = AVERROR(ENOMEM);

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


[FFmpeg-cvslog] dashenc: default to one AdaptationSet per stream

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:29 
2017 +0100| [ca9bc9de690258d4761a19b0df6e9c9113b80115] | committer: Martin 
Storsjö

dashenc: default to one AdaptationSet per stream

Previously all mapped streams of a media type (video, audio) where assigned
to a single AdaptationSet. Using the DASH live profile it is mandatory, that
the segments of all representations are aligned, which is currently not
enforced. This leads to problems when using video streams with different
key frame intervals. So to play safe, default to one AdaptationSet per stream,
unless overwritten by explicit assignment.

To get the old assignment scheme, use

  -adaptation_sets "id=0,streams=v id=1,streams=a"

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 23 ++-
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 12e6f9b5d9..286b24def3 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -524,26 +524,15 @@ static int parse_adaptation_sets(AVFormatContext *s)
 enum { new_set, parse_id, parsing_streams } state;
 AdaptationSet *as;
 int i, n, ret;
-enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, 
AVMEDIA_TYPE_UNKNOWN };
 
-// default: one AdaptationSet for each media type
+// default: one AdaptationSet for each stream
 if (!p) {
-for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) {
-int as_idx = 0;
-
-for (i = 0; i < s->nb_streams; i++) {
-if (s->streams[i]->codecpar->codec_type != types[n])
-continue;
-
-if (!as_idx) {
-if ((ret = add_adaptation_set(s, , types[n])) < 0)
-return ret;
-as_idx = c->nb_as;
+for (i = 0; i < s->nb_streams; i++) {
+if ((ret = add_adaptation_set(s, , 
s->streams[i]->codecpar->codec_type)) < 0)
+return ret;
+snprintf(as->id, sizeof(as->id), "%d", i);
 
-snprintf(as->id, sizeof(as->id), "%d", i);
-}
-c->streams[i].as_idx = as_idx;
-}
+c->streams[i].as_idx = c->nb_as;
 }
 goto end;
 }

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


[FFmpeg-cvslog] dashenc: allow assigning all streams of a media type to an AdaptationSet

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:28 
2017 +0100| [efd2fc41b3f0749f9715d50b581f22bbaa8c5b99] | committer: Martin 
Storsjö

dashenc: allow assigning all streams of a media type to an AdaptationSet

Using the characters "v" or "a" instead of stream index numbers for assigning
streams in the adaption_set option, all streams matching that given type will
be added to the AdaptationSet.

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 61 +--
 1 file changed, 45 insertions(+), 16 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index e69e63e9ab..12e6f9b5d9 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -499,6 +499,24 @@ static int add_adaptation_set(AVFormatContext *s, 
AdaptationSet **as, enum AVMed
 return 0;
 }
 
+static int adaptation_set_add_stream(AVFormatContext *s, int as_idx, int i)
+{
+DASHContext *c = s->priv_data;
+AdaptationSet *as = >as[as_idx - 1];
+OutputStream *os = >streams[i];
+
+if (as->media_type != s->streams[i]->codecpar->codec_type) {
+av_log(s, AV_LOG_ERROR, "Codec type of stream %d doesn't match 
AdaptationSet's media type\n", i);
+return AVERROR(EINVAL);
+} else if (os->as_idx) {
+av_log(s, AV_LOG_ERROR, "Stream %d is already assigned to an 
AdaptationSet\n", i);
+return AVERROR(EINVAL);
+}
+os->as_idx = as_idx;
+
+return 0;
+}
+
 static int parse_adaptation_sets(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
@@ -552,30 +570,41 @@ static int parse_adaptation_sets(AVFormatContext *s)
 state = parsing_streams;
 } else if (state == parsing_streams) {
 AdaptationSet *as = >as[c->nb_as - 1];
-OutputStream *os;
 char idx_str[8], *end_str;
 
 n = strcspn(p, " ,");
 snprintf(idx_str, sizeof(idx_str), "%.*s", n, p);
 p += n;
 
-i = strtol(idx_str, _str, 10);
-if (idx_str == end_str || i < 0 || i >= s->nb_streams) {
-av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not found!\n", 
idx_str);
-return AVERROR(EINVAL);
-}
+// if value is "a" or "v", map all streams of that type
+if (as->media_type == AVMEDIA_TYPE_UNKNOWN && (idx_str[0] == 'v' 
|| idx_str[0] == 'a')) {
+enum AVMediaType type = (idx_str[0] == 'v') ? 
AVMEDIA_TYPE_VIDEO : AVMEDIA_TYPE_AUDIO;
+av_log(s, AV_LOG_DEBUG, "Map all streams of type %s\n", 
idx_str);
+
+for (i = 0; i < s->nb_streams; i++) {
+if (s->streams[i]->codecpar->codec_type != type)
+continue;
+
+as->media_type = s->streams[i]->codecpar->codec_type;
+
+if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0)
+return ret;
+}
+} else { // select single stream
+i = strtol(idx_str, _str, 10);
+if (idx_str == end_str || i < 0 || i >= s->nb_streams) {
+av_log(s, AV_LOG_ERROR, "Selected stream \"%s\" not 
found!\n", idx_str);
+return AVERROR(EINVAL);
+}
+av_log(s, AV_LOG_DEBUG, "Map stream %d\n", i);
+
+if (as->media_type == AVMEDIA_TYPE_UNKNOWN) {
+as->media_type = s->streams[i]->codecpar->codec_type;
+}
 
-os = >streams[i];
-if (as->media_type == AVMEDIA_TYPE_UNKNOWN) {
-as->media_type = s->streams[i]->codecpar->codec_type;
-} else if (as->media_type != s->streams[i]->codecpar->codec_type) {
-av_log(s, AV_LOG_ERROR, "Mixing codec types within an 
AdaptationSet is not allowed\n");
-return AVERROR(EINVAL);
-} else if (os->as_idx) {
-av_log(s, AV_LOG_ERROR, "Assigning a stream to more than one 
AdaptationSet is not allowed\n");
-return AVERROR(EINVAL);
+if ((ret = adaptation_set_add_stream(s, c->nb_as, i)) < 0)
+return ret;
 }
-os->as_idx = c->nb_as;
 
 if (*p == ' ')
 state = new_set;

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


[FFmpeg-cvslog] dashenc: add support for assigning streams to AdaptationSets

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Sun Jan 29 15:26:27 
2017 +0100| [3d23a5f96ad72961c14ba3a0c2add8f2ab374b61] | committer: Martin 
Storsjö

dashenc: add support for assigning streams to AdaptationSets

Also makes sure all streams are assigned to exactly one AdaptationSet.

This patch is originally based partially on code by Vignesh Venkatasubramanian.

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 204 ++
 1 file changed, 173 insertions(+), 31 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 21acb9006c..e69e63e9ab 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -24,6 +24,7 @@
 #include 
 #endif
 
+#include "libavutil/avutil.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/mathematics.h"
@@ -57,9 +58,14 @@ typedef struct Segment {
 int n;
 } Segment;
 
+typedef struct AdaptationSet {
+char id[10];
+enum AVMediaType media_type;
+} AdaptationSet;
+
 typedef struct OutputStream {
 AVFormatContext *ctx;
-int ctx_inited;
+int ctx_inited, as_idx;
 uint8_t iobuf[32768];
 AVIOContext *out;
 int packets_written;
@@ -78,6 +84,9 @@ typedef struct OutputStream {
 
 typedef struct DASHContext {
 const AVClass *class;  /* Class for private options. */
+char *adaptation_sets;
+AdaptationSet *as;
+int nb_as;
 int window_size;
 int extra_window_size;
 int min_seg_duration;
@@ -86,7 +95,7 @@ typedef struct DASHContext {
 int use_timeline;
 int single_file;
 OutputStream *streams;
-int has_video, has_audio;
+int has_video;
 int64_t last_duration;
 int64_t total_duration;
 char availability_start_time[100];
@@ -175,6 +184,12 @@ static void dash_free(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int i, j;
+
+if (c->as) {
+av_freep(>as);
+c->nb_as = 0;
+}
+
 if (!c->streams)
 return;
 for (i = 0; i < s->nb_streams; i++) {
@@ -435,12 +450,160 @@ static void format_date_now(char *buf, int size)
 }
 }
 
+static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int 
as_index)
+{
+DASHContext *c = s->priv_data;
+AdaptationSet *as = >as[as_index];
+int i;
+
+avio_printf(out, "\t\t\n",
+as->id, as->media_type == AVMEDIA_TYPE_VIDEO ? "video" : 
"audio");
+
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = >streams[i];
+
+if (os->as_idx - 1 != as_index)
+continue;
+
+if (as->media_type == AVMEDIA_TYPE_VIDEO) {
+avio_printf(out, "\t\t\t\n",
+i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->width, s->streams[i]->codecpar->height);
+} else {
+avio_printf(out, "\t\t\t\n",
+i, os->codec_str, os->bandwidth_str, 
s->streams[i]->codecpar->sample_rate);
+avio_printf(out, "\t\t\t\t\n",
+s->streams[i]->codecpar->channels);
+}
+output_segment_list(os, out, c);
+avio_printf(out, "\t\t\t\n");
+}
+avio_printf(out, "\t\t\n");
+
+return 0;
+}
+
+static int add_adaptation_set(AVFormatContext *s, AdaptationSet **as, enum 
AVMediaType type)
+{
+DASHContext *c = s->priv_data;
+
+void *mem = av_realloc(c->as, sizeof(*c->as) * (c->nb_as + 1));
+if (!mem)
+return AVERROR(ENOMEM);
+c->as = mem;
+++c->nb_as;
+
+*as = >as[c->nb_as - 1];
+memset(*as, 0, sizeof(**as));
+(*as)->media_type = type;
+
+return 0;
+}
+
+static int parse_adaptation_sets(AVFormatContext *s)
+{
+DASHContext *c = s->priv_data;
+const char *p = c->adaptation_sets;
+enum { new_set, parse_id, parsing_streams } state;
+AdaptationSet *as;
+int i, n, ret;
+enum AVMediaType types[] = { AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, 
AVMEDIA_TYPE_UNKNOWN };
+
+// default: one AdaptationSet for each media type
+if (!p) {
+for (n = 0; types[n] != AVMEDIA_TYPE_UNKNOWN; n++) {
+int as_idx = 0;
+
+for (i = 0; i < s->nb_streams; i++) {
+if (s->streams[i]->codecpar->codec_type != types[n])
+continue;
+
+if (!as_idx) {
+if ((ret = add_adaptation_set(s, , types[n])) < 0)
+return ret;
+as_idx = c->nb_as;
+
+snprintf(as->id, sizeof(as->id), "%d", i);
+}
+c->streams[i].as_idx = as_idx;
+}
+}
+goto end;
+}
+
+// syntax id=0,streams=0,1,2 id=1,streams=3,4 and so on
+state = new_set;
+while (*p) {
+if (*p == ' ') {
+p++;
+continue;
+} else if 

[FFmpeg-cvslog] dashenc: calculate stream bitrate from first segment if not available

2017-09-26 Thread Peter Große
ffmpeg | branch: master | Peter Große  | Mon Jan 30 13:49:44 
2017 +0100| [9df9309d233f59d9706444a1e24ac24139f2640d] | committer: Martin 
Storsjö

dashenc: calculate stream bitrate from first segment if not available

Bandwidth information is required in the manifest, but not always
provided by the demuxer. In that case calculate the bandwith based
on the size and duration of the first segment.

Signed-off-by: Peter Große 
Signed-off-by: Martin Storsjö 

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

 libavformat/dashenc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 98722cd24e..21acb9006c 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -834,6 +834,16 @@ static int dash_flush(AVFormatContext *s, int final, int 
stream)
 if (ret < 0)
 break;
 }
+
+if (!os->bit_rate) {
+// calculate average bitrate of first segment
+int64_t bitrate = (int64_t) range_length * 8 * AV_TIME_BASE / 
(os->max_pts - os->start_pts);
+if (bitrate >= 0) {
+os->bit_rate = bitrate;
+snprintf(os->bandwidth_str, sizeof(os->bandwidth_str),
+ " bandwidth=\"%d\"", os->bit_rate);
+}
+}
 add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, 
start_pos, range_length, index_length);
 av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written 
to: %s\n", i, os->segment_index, full_path);
 }

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


[FFmpeg-cvslog] lavf/tls_gnutls: fix warnings from version check

2017-09-26 Thread Moritz Barsnick
ffmpeg | branch: master | Moritz Barsnick  | Tue Sep 26 
13:25:54 2017 +0200| [6bf48c4805cbb9754aa5a7bcb5f46df6bda95447] | committer: 
Carl Eugen Hoyos

lavf/tls_gnutls: fix warnings from version check

The GnuTLS version is checked through the macro GNUTLS_VERSION_NUMBER,
but this wasn't introduced before 2.7.2. Building with older versions
of GnuTLS (using icc) warns:

src/libavformat/tls_gnutls.c(38): warning #193: zero used for undefined 
preprocessing identifier "GNUTLS_VERSION_NUMBER"
  #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00

This adds a fallback to the older, deprecated LIBGNUTLS_VERSION_NUMBER
macro.

Signed-off-by: Moritz Barsnick 

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

 libavformat/tls_gnutls.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 7174dfd3fc..5ce6c3d448 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -35,6 +35,10 @@
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 
+#ifndef GNUTLS_VERSION_NUMBER
+#define GNUTLS_VERSION_NUMBER LIBGNUTLS_VERSION_NUMBER
+#endif
+
 #if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
 #include 
 #include "libavutil/thread.h"

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


[FFmpeg-cvslog] lavf/tls_gnutls: fix compilation with GnuTLS 2.x

2017-09-26 Thread Moritz Barsnick
ffmpeg | branch: master | Moritz Barsnick  | Tue Sep 26 
13:25:53 2017 +0200| [16c8a9feeab36239bb7cf5f87fa8cad4dc50ae8c] | committer: 
Carl Eugen Hoyos

lavf/tls_gnutls: fix compilation with GnuTLS 2.x

Commit 598e41684066feba701d19ca7443d24b9e5efa77 added use of
GNUTLS_E_PREMATURE_TERMINATION, which wasn't introduced to GnuTLS
before 2.99.x / 3.x. This fixes compilation with older versions.

Signed-off-by: Moritz Barsnick 

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

 libavformat/tls_gnutls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 38f8ea4804..7174dfd3fc 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -72,7 +72,9 @@ static int print_tls_error(URLContext *h, int ret)
 switch (ret) {
 case GNUTLS_E_AGAIN:
 case GNUTLS_E_INTERRUPTED:
+#ifdef GNUTLS_E_PREMATURE_TERMINATION
 case GNUTLS_E_PREMATURE_TERMINATION:
+#endif
 break;
 case GNUTLS_E_WARNING_ALERT_RECEIVED:
 av_log(h, AV_LOG_WARNING, "%s\n", gnutls_strerror(ret));

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


[FFmpeg-cvslog] avcodec/dnxhdenc: fix DNxHR 444 encoding crashes

2017-09-26 Thread Frédéric Devernay
ffmpeg | branch: master | Frédéric Devernay  | Tue 
Sep 12 15:26:15 2017 +0200| [eec67f25224a48047da57be18b610b11b0fd0bfe] | 
committer: Paul B Mahol

avcodec/dnxhdenc: fix DNxHR 444 encoding crashes

Fixes #6649.

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

 libavcodec/dnxhdenc.c | 16 
 libavcodec/dnxhdenc.h |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 5a0e6de6a5..0d80381a2d 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -749,14 +749,14 @@ void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int 
mb_y)
 ptr_y = >edge_buf_y[0];
 ptr_u = >edge_buf_uv[0][0];
 ptr_v = >edge_buf_uv[1][0];
-} else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 3) 
+ 8 > ctx->m.avctx->width ||
-  (mb_y << 3) 
+ 8 > ctx->m.avctx->height)) {
-int y_w = ctx->m.avctx->width  - (mb_x << 3);
-int y_h = ctx->m.avctx->height - (mb_y << 3);
+} else if (ctx->bit_depth == 10 && vdsp->emulated_edge_mc && ((mb_x << 4) 
+ 16 > ctx->m.avctx->width ||
+  (mb_y << 4) 
+ 16 > ctx->m.avctx->height)) {
+int y_w = ctx->m.avctx->width  - (mb_x << 4);
+int y_h = ctx->m.avctx->height - (mb_y << 4);
 int uv_w = ctx->is_444 ? y_w : (y_w + 1) / 2;
 int uv_h = y_h;
-linesize = 16;
-uvlinesize = 8 + 8 * ctx->is_444;
+linesize = 32;
+uvlinesize = 16 + 16 * ctx->is_444;
 
 vdsp->emulated_edge_mc(>edge_buf_y[0], ptr_y,
linesize, ctx->m.linesize,
@@ -771,8 +771,8 @@ void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int 
mb_y)
uvlinesize / 2, 16,
0, 0, uv_w, uv_h);
 
-dct_y_offset =  bw * linesize;
-dct_uv_offset = bw * uvlinesize;
+dct_y_offset =  bw * linesize / 2;
+dct_uv_offset = bw * uvlinesize / 2;
 ptr_y = >edge_buf_y[0];
 ptr_u = >edge_buf_uv[0][0];
 ptr_v = >edge_buf_uv[1][0];
diff --git a/libavcodec/dnxhdenc.h b/libavcodec/dnxhdenc.h
index 9b43f6e9c6..26c3eec695 100644
--- a/libavcodec/dnxhdenc.h
+++ b/libavcodec/dnxhdenc.h
@@ -75,8 +75,8 @@ typedef struct DNXHDEncContext {
 int intra_quant_bias;
 
 DECLARE_ALIGNED(16, int16_t, blocks)[12][64];
-DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[256];
-DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][256];
+DECLARE_ALIGNED(16, uint8_t, edge_buf_y)[512]; // has to hold 16x16 uint16 
when depth=10
+DECLARE_ALIGNED(16, uint8_t, edge_buf_uv)[2][512]; // has to hold 16x16 
uint16_t when depth=10
 
 int  (*qmatrix_c) [64];
 int  (*qmatrix_l) [64];

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