[FFmpeg-cvslog] lavc/videotoolboxdec: fix crop handling when multithreaded

2019-09-15 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Fri Sep  6 
22:31:06 2019 -0500| [77937a42e7127271bd50d7f8035c3ebd5a1047c5] | committer: 
Aman Gupta

lavc/videotoolboxdec: fix crop handling when multithreaded

This was partially fixed by 233cd89, but it made changes to AVFrame fields
from within end_frame, which doesn't work consistently when multithreading
is enabled. This is what the post_process function is for.

Signed-off-by: Aman Gupta 

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

 libavcodec/videotoolbox.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 67e5b54932..e9b3370169 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -91,6 +91,11 @@ static int videotoolbox_postproc_frame(void *avctx, AVFrame 
*frame)
 return AVERROR_EXTERNAL;
 }
 
+frame->crop_right = 0;
+frame->crop_left = 0;
+frame->crop_top = 0;
+frame->crop_bottom = 0;
+
 frame->data[3] = (uint8_t*)ref->pixbuf;
 
 if (ref->hw_frames_ctx) {
@@ -898,11 +903,6 @@ static int videotoolbox_common_end_frame(AVCodecContext 
*avctx, AVFrame *frame)
 AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 
-frame->crop_right = 0;
-frame->crop_left = 0;
-frame->crop_top = 0;
-frame->crop_bottom = 0;
-
 if (vtctx->reconfig_needed == true) {
 vtctx->reconfig_needed = false;
 av_log(avctx, AV_LOG_VERBOSE, "VideoToolbox decoder needs reconfig, 
restarting..\n");

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

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] build: add support for building CUDA files with clang

2019-08-04 Thread Rodger Combs
ffmpeg | branch: release/4.2 | Rodger Combs  | Tue Jul 
30 02:51:42 2019 -0500| [86de65fbf0743b3159f9c7b3af97203f8ec9743e] | committer: 
Timo Rothenpieler

build: add support for building CUDA files with clang

This avoids using the CUDA SDK at all; instead, we provide a minimal
reimplementation of the basic functionality that lavfi actually uses.
It generates very similar code to what NVCC produces.

The header contains no implementation code derived from the SDK.
The function and type declarations are derived from the SDK only to the
extent required to build a compatible implementation. This is generally
accepted to qualify as fair use.

Because this option does not require the proprietary SDK, it does not require
the "--enable-nonfree" flag in configure.

Signed-off-by: Timo Rothenpieler 

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

 Changelog  |   1 +
 compat/cuda/cuda_runtime.h | 131 +
 configure  |  67 +++
 ffbuild/common.mak |   3 +-
 4 files changed, 178 insertions(+), 24 deletions(-)

diff --git a/Changelog b/Changelog
index beb2d2615d..389ca6c4db 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ version 4.2:
 - derain filter
 - deesser filter
 - mov muxer writes tracks with unspecified language instead of English by 
default
+- add support for using clang to compile CUDA kernels
 
 
 version 4.1:
diff --git a/compat/cuda/cuda_runtime.h b/compat/cuda/cuda_runtime.h
new file mode 100644
index 00..dbe50f8711
--- /dev/null
+++ b/compat/cuda/cuda_runtime.h
@@ -0,0 +1,131 @@
+/*
+ * Minimum CUDA compatibility definitions header
+ *
+ * Copyright (c) 2019 Rodger Combs
+ *
+ * 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
+ */
+
+#ifndef AV_COMPAT_CUDA_CUDA_RUNTIME_H
+#define AV_COMPAT_CUDA_CUDA_RUNTIME_H
+
+// Common macros
+#define __global__ __attribute__((global))
+#define __device__ __attribute__((device))
+#define __device_builtin__ __attribute__((device_builtin))
+#define __align__(N) __attribute__((aligned(N)))
+#define __inline__ __inline__ __attribute__((always_inline))
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define abs(x) ((x) < 0 ? -(x) : (x))
+
+#define atomicAdd(a, b) (__atomic_fetch_add(a, b, __ATOMIC_SEQ_CST))
+
+// Basic typedefs
+typedef __device_builtin__ unsigned long long cudaTextureObject_t;
+
+typedef struct __device_builtin__ __align__(2) uchar2
+{
+unsigned char x, y;
+} uchar2;
+
+typedef struct __device_builtin__ __align__(4) ushort2
+{
+unsigned short x, y;
+} ushort2;
+
+typedef struct __device_builtin__ uint3
+{
+unsigned int x, y, z;
+} uint3;
+
+typedef struct uint3 dim3;
+
+typedef struct __device_builtin__ __align__(8) int2
+{
+int x, y;
+} int2;
+
+typedef struct __device_builtin__ __align__(4) uchar4
+{
+unsigned char x, y, z, w;
+} uchar4;
+
+typedef struct __device_builtin__ __align__(8) ushort4
+{
+unsigned char x, y, z, w;
+} ushort4;
+
+typedef struct __device_builtin__ __align__(16) int4
+{
+int x, y, z, w;
+} int4;
+
+// Accessors for special registers
+#define GETCOMP(reg, comp) \
+asm("mov.u32 %0, %%" #reg "." #comp ";" : "=r"(tmp)); \
+ret.comp = tmp;
+
+#define GET(name, reg) static inline __device__ uint3 name() {\
+uint3 ret; \
+unsigned tmp; \
+GETCOMP(reg, x) \
+GETCOMP(reg, y) \
+GETCOMP(reg, z) \
+return ret; \
+}
+
+GET(getBlockIdx, ctaid)
+GET(getBlockDim, ntid)
+GET(getThreadIdx, tid)
+
+// Instead of externs for these registers, we turn access to them into calls 
into trivial ASM
+#define blockIdx (getBlockIdx())
+#define blockDim (getBlockDim())
+#define threadIdx (getThreadIdx())
+
+// Basic initializers (simple macros rather than inline functions)
+#define make_uchar2(a, b) ((uchar2){.x = a, .y = b})
+#define make_ushort2(a, b) ((ushort2){.x = a, .y = b})
+#define make_uchar4(a, b, c, d) ((uchar4){.x = a, .y = b, .z = c, .w = d})
+#define make_ushort4(a, b, c, d) ((ushort4){.x = a, .y = b, .z = c, .w = d})
+
+// Conversions from the tex instruction's 4-register output to various types
+#d

[FFmpeg-cvslog] build: add support for building CUDA files with clang

2019-08-04 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Jul 30 
02:51:42 2019 -0500| [01994c93db43e50c01349203a76c0b7111d1d2f3] | committer: 
Timo Rothenpieler

build: add support for building CUDA files with clang

This avoids using the CUDA SDK at all; instead, we provide a minimal
reimplementation of the basic functionality that lavfi actually uses.
It generates very similar code to what NVCC produces.

The header contains no implementation code derived from the SDK.
The function and type declarations are derived from the SDK only to the
extent required to build a compatible implementation. This is generally
accepted to qualify as fair use.

Because this option does not require the proprietary SDK, it does not require
the "--enable-nonfree" flag in configure.

Signed-off-by: Timo Rothenpieler 

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

 Changelog  |   1 +
 compat/cuda/cuda_runtime.h | 131 +
 configure  |  67 +++
 ffbuild/common.mak |   3 +-
 4 files changed, 178 insertions(+), 24 deletions(-)

diff --git a/Changelog b/Changelog
index beb2d2615d..389ca6c4db 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ version 4.2:
 - derain filter
 - deesser filter
 - mov muxer writes tracks with unspecified language instead of English by 
default
+- add support for using clang to compile CUDA kernels
 
 
 version 4.1:
diff --git a/compat/cuda/cuda_runtime.h b/compat/cuda/cuda_runtime.h
new file mode 100644
index 00..dbe50f8711
--- /dev/null
+++ b/compat/cuda/cuda_runtime.h
@@ -0,0 +1,131 @@
+/*
+ * Minimum CUDA compatibility definitions header
+ *
+ * Copyright (c) 2019 Rodger Combs
+ *
+ * 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
+ */
+
+#ifndef AV_COMPAT_CUDA_CUDA_RUNTIME_H
+#define AV_COMPAT_CUDA_CUDA_RUNTIME_H
+
+// Common macros
+#define __global__ __attribute__((global))
+#define __device__ __attribute__((device))
+#define __device_builtin__ __attribute__((device_builtin))
+#define __align__(N) __attribute__((aligned(N)))
+#define __inline__ __inline__ __attribute__((always_inline))
+
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define abs(x) ((x) < 0 ? -(x) : (x))
+
+#define atomicAdd(a, b) (__atomic_fetch_add(a, b, __ATOMIC_SEQ_CST))
+
+// Basic typedefs
+typedef __device_builtin__ unsigned long long cudaTextureObject_t;
+
+typedef struct __device_builtin__ __align__(2) uchar2
+{
+unsigned char x, y;
+} uchar2;
+
+typedef struct __device_builtin__ __align__(4) ushort2
+{
+unsigned short x, y;
+} ushort2;
+
+typedef struct __device_builtin__ uint3
+{
+unsigned int x, y, z;
+} uint3;
+
+typedef struct uint3 dim3;
+
+typedef struct __device_builtin__ __align__(8) int2
+{
+int x, y;
+} int2;
+
+typedef struct __device_builtin__ __align__(4) uchar4
+{
+unsigned char x, y, z, w;
+} uchar4;
+
+typedef struct __device_builtin__ __align__(8) ushort4
+{
+unsigned char x, y, z, w;
+} ushort4;
+
+typedef struct __device_builtin__ __align__(16) int4
+{
+int x, y, z, w;
+} int4;
+
+// Accessors for special registers
+#define GETCOMP(reg, comp) \
+asm("mov.u32 %0, %%" #reg "." #comp ";" : "=r"(tmp)); \
+ret.comp = tmp;
+
+#define GET(name, reg) static inline __device__ uint3 name() {\
+uint3 ret; \
+unsigned tmp; \
+GETCOMP(reg, x) \
+GETCOMP(reg, y) \
+GETCOMP(reg, z) \
+return ret; \
+}
+
+GET(getBlockIdx, ctaid)
+GET(getBlockDim, ntid)
+GET(getThreadIdx, tid)
+
+// Instead of externs for these registers, we turn access to them into calls 
into trivial ASM
+#define blockIdx (getBlockIdx())
+#define blockDim (getBlockDim())
+#define threadIdx (getThreadIdx())
+
+// Basic initializers (simple macros rather than inline functions)
+#define make_uchar2(a, b) ((uchar2){.x = a, .y = b})
+#define make_ushort2(a, b) ((ushort2){.x = a, .y = b})
+#define make_uchar4(a, b, c, d) ((uchar4){.x = a, .y = b, .z = c, .w = d})
+#define make_ushort4(a, b, c, d) ((ushort4){.x = a, .y = b, .z = c, .w = d})
+
+// Conversions from the tex instruction's 4-register output to various types
+#define

[FFmpeg-cvslog] lavfi/vf_thumbnail_cuda: fix operator precedence bug

2019-07-30 Thread Rodger Combs
ffmpeg | branch: release/4.2 | Rodger Combs  | Tue Jul 
30 02:51:43 2019 -0500| [6a5ed71d36f700219f6f8cc69d767343f2fb8cb7] | committer: 
Timo Rothenpieler

lavfi/vf_thumbnail_cuda: fix operator precedence bug

Discovered via a warning when building with clang

Signed-off-by: Timo Rothenpieler 

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

 libavfilter/vf_thumbnail_cuda.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_thumbnail_cuda.cu b/libavfilter/vf_thumbnail_cuda.cu
index c73e49fbc6..d4d4d791f6 100644
--- a/libavfilter/vf_thumbnail_cuda.cu
+++ b/libavfilter/vf_thumbnail_cuda.cu
@@ -71,7 +71,7 @@ __global__ void Thumbnail_ushort2(cudaTextureObject_t 
ushort2_tex,
 {
 ushort2 pixel = tex2D(ushort2_tex, x, y);
 atomicAdd([(pixel.x + 128) >> 8], 1);
-atomicAdd([256 + (pixel.y + 128) >> 8], 1);
+atomicAdd([256 + ((pixel.y + 128) >> 8)], 1);
 }
 }
 

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

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] lavfi/vf_thumbnail_cuda: fix operator precedence bug

2019-07-30 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Tue Jul 30 
02:51:43 2019 -0500| [a0c19707811cb5b4e6df089317dda65dd6a0240b] | committer: 
Timo Rothenpieler

lavfi/vf_thumbnail_cuda: fix operator precedence bug

Discovered via a warning when building with clang

Signed-off-by: Timo Rothenpieler 

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

 libavfilter/vf_thumbnail_cuda.cu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/vf_thumbnail_cuda.cu b/libavfilter/vf_thumbnail_cuda.cu
index c73e49fbc6..d4d4d791f6 100644
--- a/libavfilter/vf_thumbnail_cuda.cu
+++ b/libavfilter/vf_thumbnail_cuda.cu
@@ -71,7 +71,7 @@ __global__ void Thumbnail_ushort2(cudaTextureObject_t 
ushort2_tex,
 {
 ushort2 pixel = tex2D(ushort2_tex, x, y);
 atomicAdd([(pixel.x + 128) >> 8], 1);
-atomicAdd([256 + (pixel.y + 128) >> 8], 1);
+atomicAdd([256 + ((pixel.y + 128) >> 8)], 1);
 }
 }
 

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

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avcodec/vt_hevc: fix crash if vps_list[0] or sps_list[0] are null

2019-03-19 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Wed Jan  9 
21:26:41 2019 -0500| [ce6301a46fae4858218c7435f9e7fc94d9dd39b2] | committer: 
Aman Gupta

avcodec/vt_hevc: fix crash if vps_list[0] or sps_list[0] are null

Instead of assuming id 0 is used, use the same logic as used for PPS,
where all available entries in the list are emitted.

Signed-off-by: Aman Gupta 

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

 libavcodec/videotoolbox.c | 86 ++-
 1 file changed, 40 insertions(+), 46 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index da7236f100..fb3501f413 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -176,26 +176,31 @@ CFDataRef 
ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
 CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
 {
 HEVCContext *h = avctx->priv_data;
-const HEVCVPS *vps = (const HEVCVPS *)h->ps.vps_list[0]->data;
-const HEVCSPS *sps = (const HEVCSPS *)h->ps.sps_list[0]->data;
-int i, num_pps = 0;
+int i, num_vps = 0, num_sps = 0, num_pps = 0;
+const HEVCVPS *vps = h->ps.vps;
+const HEVCSPS *sps = h->ps.sps;
 const HEVCPPS *pps = h->ps.pps;
 PTLCommon ptlc = vps->ptl.general_ptl;
 VUI vui = sps->vui;
 uint8_t parallelismType;
 CFDataRef data = NULL;
 uint8_t *p;
-int vt_extradata_size = 23 + 5 + vps->data_size + 5 + sps->data_size + 3;
+int vt_extradata_size = 23 + 3 + 3 + 3;
 uint8_t *vt_extradata;
 
-for (i = 0; i < HEVC_MAX_PPS_COUNT; i++) {
-if (h->ps.pps_list[i]) {
-const HEVCPPS *pps = (const HEVCPPS *)h->ps.pps_list[i]->data;
-vt_extradata_size += 2 + pps->data_size;
-num_pps++;
-}
+#define COUNT_SIZE_PS(T, t) \
+for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
+if (h->ps.t##ps_list[i]) { \
+const HEVC##T##PS *lps = (const HEVC##T##PS 
*)h->ps.t##ps_list[i]->data; \
+vt_extradata_size += 2 + lps->data_size; \
+num_##t##ps++; \
+} \
 }
 
+COUNT_SIZE_PS(V, v)
+COUNT_SIZE_PS(S, s)
+COUNT_SIZE_PS(P, p)
+
 vt_extradata = av_malloc(vt_extradata_size);
 if (!vt_extradata)
 return NULL;
@@ -286,44 +291,33 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
 AV_W8(p + 22, 3);
 
 p += 23;
-/* vps */
-/*
- * bit(1) array_completeness;
- * unsigned int(1) reserved = 0;
- * unsigned int(6) NAL_unit_type;
- */
-AV_W8(p, 1 << 7 |
- HEVC_NAL_VPS & 0x3f);
-/* unsigned int(16) numNalus; */
-AV_WB16(p + 1, 1);
-/* unsigned int(16) nalUnitLength; */
-AV_WB16(p + 3, vps->data_size);
-/* bit(8*nalUnitLength) nalUnit; */
-memcpy(p + 5, vps->data, vps->data_size);
-p += 5 + vps->data_size;
-
-/* sps */
-AV_W8(p, 1 << 7 |
- HEVC_NAL_SPS & 0x3f);
-AV_WB16(p + 1, 1);
-AV_WB16(p + 3, sps->data_size);
-memcpy(p + 5, sps->data, sps->data_size);
-p += 5 + sps->data_size;
-
-/* pps */
-AV_W8(p, 1 << 7 |
- HEVC_NAL_PPS & 0x3f);
-AV_WB16(p + 1, num_pps);
-p += 3;
-for (i = 0; i < HEVC_MAX_PPS_COUNT; i++) {
-if (h->ps.pps_list[i]) {
-const HEVCPPS *pps = (const HEVCPPS *)h->ps.pps_list[i]->data;
-AV_WB16(p, pps->data_size);
-memcpy(p + 2, pps->data, pps->data_size);
-p += 2 + pps->data_size;
-}
+
+#define APPEND_PS(T, t) \
+/* \
+ * bit(1) array_completeness; \
+ * unsigned int(1) reserved = 0; \
+ * unsigned int(6) NAL_unit_type; \
+ */ \
+AV_W8(p, 1 << 7 | \
+ HEVC_NAL_##T##PS & 0x3f); \
+/* unsigned int(16) numNalus; */ \
+AV_WB16(p + 1, num_##t##ps); \
+p += 3; \
+for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
+if (h->ps.t##ps_list[i]) { \
+const HEVC##T##PS *lps = (const HEVC##T##PS 
*)h->ps.t##ps_list[i]->data; \
+/* unsigned int(16) nalUnitLength; */ \
+AV_WB16(p, lps->data_size); \
+/* bit(8*nalUnitLength) nalUnit; */ \
+memcpy(p + 2, lps->data, lps->data_size); \
+p += 2 + lps->data_size; \
+} \
 }
 
+APPEND_PS(V, v)
+APPEND_PS(S, s)
+APPEND_PS(P, p)
+
 av_assert0(p - vt_extradata == vt_extradata_size);
 
 data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size);

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


[FFmpeg-cvslog] lavf/isom: add Dolby Vision sample entry codes for HEVC and H.264

2018-12-17 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs  | Mon Nov  5 
10:26:24 2018 -0600| [6ebe88f3a4c427511eba7495896f4a57a2b4b529] | committer: 
Jan Ekström

lavf/isom: add Dolby Vision sample entry codes for HEVC and H.264

These are registered identifiers at the MPEG-4 RA, which are
defined as to be utilized for Dolby Vision AVC/HEVC streams that
are not correctly presentable by standards-compliant AVC/HEVC players.

According to the Dolby Vision specification for ISOBMFF, these sample
entry codes are specified to have the standard AVC or HEVC decoder
configuration box in addition to the Dolby custom DOVIConfigurationBox.
This is what enables us to decode the streams without custom parsing.

For correct presentation information from the DOVIConfigurationBox
is required (YCbCr or modified ICtCP, SDR or HDR, base or enhancement
layer).

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

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

diff --git a/libavformat/isom.c b/libavformat/isom.c
index ca9d22e4f7..0a4d901be5 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -163,6 +163,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 
 { AV_CODEC_ID_HEVC, MKTAG('h', 'e', 'v', '1') }, /* HEVC/H.265 which 
indicates parameter sets may be in ES */
 { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which 
indicates parameter sets shall not be in ES */
+{ AV_CODEC_ID_HEVC, MKTAG('d', 'v', 'h', 'e') }, /* HEVC-based Dolby 
Vision derived from hev1 */
+ /* dvh1 is handled within 
mov.c */
 
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '2') },
@@ -185,6 +187,8 @@ const AVCodecTag ff_codec_movvideo_tags[] = {
 { AV_CODEC_ID_H264, MKTAG('r', 'v', '6', '4') }, /* X-Com Radvision */
 { AV_CODEC_ID_H264, MKTAG('x', 'a', 'l', 'g') }, /* XAVC-L HD422 produced 
by FCP */
 { AV_CODEC_ID_H264, MKTAG('a', 'v', 'l', 'g') }, /* Panasonic P2 AVC-LongG 
*/
+{ AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', '1') }, /* AVC-based Dolby Vision 
derived from avc1 */
+{ AV_CODEC_ID_H264, MKTAG('d', 'v', 'a', 'v') }, /* AVC-based Dolby Vision 
derived from avc3 */
 
 { AV_CODEC_ID_VP8,  MKTAG('v', 'p', '0', '8') }, /* VP8 */
 { AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */

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


[FFmpeg-cvslog] lavf/dashenc: don't call flush_init_segment before avformat_write_header

2018-05-04 Thread Rodger Combs
ffmpeg | branch: release/4.0 | Rodger Combs <rodger.co...@gmail.com> | Fri Apr 
27 03:51:35 2018 +0300| [b32f8659695303bc816a44ca9aefc3a839d69dca] | committer: 
Karthick Jeyapal

lavf/dashenc: don't call flush_init_segment before avformat_write_header

Fixes crash when muxing MKV-in-DASH

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index bdf8c8d560..7b43612f2b 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -988,13 +988,6 @@ static int dash_init(AVFormatContext *s)
 
 av_log(s, AV_LOG_VERBOSE, "Representation %d init segment will be 
written to: %s\n", i, filename);
 
-// Flush init segment
-// except for mp4, since delay_moov is set and the init segment
-// is then flushed after the first packets
-if (strcmp(os->format_name, "mp4")) {
-flush_init_segment(s, os);
-}
-
 s->streams[i]->time_base = st->time_base;
 // If the muxer wants to shift timestamps, request to have them shifted
 // already before being handed to this muxer, so we don't have 
mismatches
@@ -1035,6 +1028,12 @@ static int dash_write_header(AVFormatContext *s)
 OutputStream *os = >streams[i];
 if ((ret = avformat_write_header(os->ctx, NULL)) < 0)
 return ret;
+// Flush init segment
+// Only for WebM segment, since for mp4 delay_moov is set and
+// the init segment is thus flushed after the first packets.
+if (strcmp(os->format_name, "mp4") &&
+(ret = flush_init_segment(s, os)) < 0)
+return ret;
 }
 ret = write_manifest(s, 0);
 if (!ret)

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


[FFmpeg-cvslog] avformat/flacenc: support writing attached pictures

2018-04-16 Thread Rodger Combs
ffmpeg | branch: release/4.0 | Rodger Combs <rodger.co...@gmail.com> | Wed Apr  
4 01:17:24 2018 -0300| [9ef90ff0a2bf1684752ac81e527981f4a2219c13] | committer: 
James Almer

avformat/flacenc: support writing attached pictures

Usage of packet queueing API and some cleaning done by the committer.

Signed-off-by: James Almer <jamr...@gmail.com>
(cherry picked from commit 00d8598eba2e8dce31af250d6ecaec37254475aa)

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

 libavformat/flacenc.c | 278 +++---
 1 file changed, 242 insertions(+), 36 deletions(-)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b894f9ef61..3179f259e5 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -21,10 +21,13 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
 #include "avio_internal.h"
 #include "flacenc.h"
+#include "id3v2.h"
+#include "internal.h"
 #include "vorbiscomment.h"
 #include "libavcodec/bytestream.h"
 
@@ -33,8 +36,15 @@ typedef struct FlacMuxerContext {
 const AVClass *class;
 int write_header;
 
+int audio_stream_idx;
+int waiting_pics;
+/* audio packets are queued here until we get all the attached pictures */
+AVPacketList *queue, *queue_end;
+
 /* updated streaminfo sent by the encoder at the end */
 uint8_t *streaminfo;
+
+unsigned attached_types;
 } FlacMuxerContext;
 
 static int flac_write_block_padding(AVIOContext *pb, unsigned int 
n_padding_bytes,
@@ -74,31 +84,163 @@ static int flac_write_block_comment(AVIOContext *pb, 
AVDictionary **m,
 return 0;
 }
 
-static int flac_write_header(struct AVFormatContext *s)
+static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
 {
-int ret;
-int padding = s->metadata_header_padding;
-AVCodecParameters *par = s->streams[0]->codecpar;
-FlacMuxerContext *c   = s->priv_data;
-
-if (!c->write_header)
+FlacMuxerContext *c = s->priv_data;
+AVIOContext *pb = s->pb;
+const AVPixFmtDescriptor *pixdesc;
+const CodecMime *mime = ff_id3v2_mime_tags;
+AVDictionaryEntry *e;
+const char *mimetype = NULL, *desc = "";
+const AVStream *st = s->streams[pkt->stream_index];
+int i, mimelen, desclen, type = 0;
+
+if (!pkt->data)
 return 0;
 
-if (s->nb_streams > 1) {
-av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
+while (mime->id != AV_CODEC_ID_NONE) {
+if (mime->id == st->codecpar->codec_id) {
+mimetype = mime->str;
+break;
+}
+mime++;
+}
+if (!mimetype) {
+av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
+   "write an attached picture.\n", st->index);
+return AVERROR(EINVAL);
+}
+mimelen = strlen(mimetype);
+
+/* get the picture type */
+e = av_dict_get(st->metadata, "comment", NULL, 0);
+for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) {
+if (!av_strcasecmp(e->value, ff_id3v2_picture_types[i])) {
+type = i;
+break;
+}
+}
+
+if ((c->attached_types & (1 << type)) & 0x6) {
+av_log(s, AV_LOG_ERROR, "Duplicate attachment for type '%s'\n", 
ff_id3v2_picture_types[type]);
 return AVERROR(EINVAL);
 }
-if (par->codec_id != AV_CODEC_ID_FLAC) {
-av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+
+if (type == 1 && (st->codecpar->codec_id != AV_CODEC_ID_PNG ||
+  st->codecpar->width != 32 ||
+  st->codecpar->height != 32)) {
+av_log(s, AV_LOG_ERROR, "File icon attachment must be a 32x32 PNG");
 return AVERROR(EINVAL);
 }
 
+c->attached_types |= (1 << type);
+
+/* get the description */
+if ((e = av_dict_get(st->metadata, "title", NULL, 0)))
+desc = e->value;
+desclen = strlen(desc);
+
+avio_w8(pb, 0x06);
+avio_wb24(pb, 4 + 4 + mimelen + 4 + desclen + 4 + 4 + 4 + 4 + 4 + 
pkt->size);
+
+avio_wb32(pb, type);
+
+avio_wb32(pb, mimelen);
+avio_write(pb, mimetype, mimelen);
+
+avio_wb32(pb, desclen);
+avio_write(pb, desc, desclen);
+
+avio_wb32(pb, st->codecpar->width);
+avio_wb32(pb, st->codecpar->height);
+if ((pixdesc = av_pix_fmt_desc_get(st->codecpar->format)))
+avio_wb32(pb, av_get_bits_per_pixel(pixdesc));
+else
+avio_wb32(pb, 0);
+avio_wb32(pb, 0);
+
+avio_wb32(pb, pkt->size);
+

[FFmpeg-cvslog] avformat/flacenc: support writing attached pictures

2018-04-16 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Apr  4 
01:17:24 2018 -0300| [00d8598eba2e8dce31af250d6ecaec37254475aa] | committer: 
James Almer

avformat/flacenc: support writing attached pictures

Usage of packet queueing API and some cleaning done by the committer.

Signed-off-by: James Almer <jamr...@gmail.com>

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

 libavformat/flacenc.c | 278 +++---
 1 file changed, 242 insertions(+), 36 deletions(-)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index b894f9ef61..3179f259e5 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -21,10 +21,13 @@
 
 #include "libavutil/channel_layout.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 #include "libavcodec/flac.h"
 #include "avformat.h"
 #include "avio_internal.h"
 #include "flacenc.h"
+#include "id3v2.h"
+#include "internal.h"
 #include "vorbiscomment.h"
 #include "libavcodec/bytestream.h"
 
@@ -33,8 +36,15 @@ typedef struct FlacMuxerContext {
 const AVClass *class;
 int write_header;
 
+int audio_stream_idx;
+int waiting_pics;
+/* audio packets are queued here until we get all the attached pictures */
+AVPacketList *queue, *queue_end;
+
 /* updated streaminfo sent by the encoder at the end */
 uint8_t *streaminfo;
+
+unsigned attached_types;
 } FlacMuxerContext;
 
 static int flac_write_block_padding(AVIOContext *pb, unsigned int 
n_padding_bytes,
@@ -74,31 +84,163 @@ static int flac_write_block_comment(AVIOContext *pb, 
AVDictionary **m,
 return 0;
 }
 
-static int flac_write_header(struct AVFormatContext *s)
+static int flac_write_picture(struct AVFormatContext *s, AVPacket *pkt)
 {
-int ret;
-int padding = s->metadata_header_padding;
-AVCodecParameters *par = s->streams[0]->codecpar;
-FlacMuxerContext *c   = s->priv_data;
-
-if (!c->write_header)
+FlacMuxerContext *c = s->priv_data;
+AVIOContext *pb = s->pb;
+const AVPixFmtDescriptor *pixdesc;
+const CodecMime *mime = ff_id3v2_mime_tags;
+AVDictionaryEntry *e;
+const char *mimetype = NULL, *desc = "";
+const AVStream *st = s->streams[pkt->stream_index];
+int i, mimelen, desclen, type = 0;
+
+if (!pkt->data)
 return 0;
 
-if (s->nb_streams > 1) {
-av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
+while (mime->id != AV_CODEC_ID_NONE) {
+if (mime->id == st->codecpar->codec_id) {
+mimetype = mime->str;
+break;
+}
+mime++;
+}
+if (!mimetype) {
+av_log(s, AV_LOG_ERROR, "No mimetype is known for stream %d, cannot "
+   "write an attached picture.\n", st->index);
+return AVERROR(EINVAL);
+}
+mimelen = strlen(mimetype);
+
+/* get the picture type */
+e = av_dict_get(st->metadata, "comment", NULL, 0);
+for (i = 0; e && i < FF_ARRAY_ELEMS(ff_id3v2_picture_types); i++) {
+if (!av_strcasecmp(e->value, ff_id3v2_picture_types[i])) {
+type = i;
+break;
+}
+}
+
+if ((c->attached_types & (1 << type)) & 0x6) {
+av_log(s, AV_LOG_ERROR, "Duplicate attachment for type '%s'\n", 
ff_id3v2_picture_types[type]);
 return AVERROR(EINVAL);
 }
-if (par->codec_id != AV_CODEC_ID_FLAC) {
-av_log(s, AV_LOG_ERROR, "unsupported codec\n");
+
+if (type == 1 && (st->codecpar->codec_id != AV_CODEC_ID_PNG ||
+  st->codecpar->width != 32 ||
+  st->codecpar->height != 32)) {
+av_log(s, AV_LOG_ERROR, "File icon attachment must be a 32x32 PNG");
 return AVERROR(EINVAL);
 }
 
+c->attached_types |= (1 << type);
+
+/* get the description */
+if ((e = av_dict_get(st->metadata, "title", NULL, 0)))
+desc = e->value;
+desclen = strlen(desc);
+
+avio_w8(pb, 0x06);
+avio_wb24(pb, 4 + 4 + mimelen + 4 + desclen + 4 + 4 + 4 + 4 + 4 + 
pkt->size);
+
+avio_wb32(pb, type);
+
+avio_wb32(pb, mimelen);
+avio_write(pb, mimetype, mimelen);
+
+avio_wb32(pb, desclen);
+avio_write(pb, desc, desclen);
+
+avio_wb32(pb, st->codecpar->width);
+avio_wb32(pb, st->codecpar->height);
+if ((pixdesc = av_pix_fmt_desc_get(st->codecpar->format)))
+avio_wb32(pb, av_get_bits_per_pixel(pixdesc));
+else
+avio_wb32(pb, 0);
+avio_wb32(pb, 0);
+
+avio_wb32(pb, pkt->size);
+avio_write(pb, pkt->data, pkt->size);
+return 0;
+}
+
+stat

[FFmpeg-cvslog] lavc/videotoolbox: fix failure to decode PAFF

2018-04-10 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 28 
23:19:28 2018 -0500| [4c0798578cab410b4ad9c27bc47b5e09c9a66aba] | committer: 
Aman Gupta

lavc/videotoolbox: fix failure to decode PAFF

Signed-off-by: Aman Gupta <a...@tmm1.net>

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

 libavcodec/videotoolbox.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index f82c31c5df..57b6698e1b 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -326,11 +326,8 @@ static int videotoolbox_set_frame(AVCodecContext *avctx, 
AVFrame *frame)
 
 CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data;
 
-if (*ref) {
-av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n");
-av_frame_unref(frame);
-return AVERROR_EXTERNAL;
-}
+if (*ref)
+CVPixelBufferRelease(*ref);
 
 *ref = vtctx->frame;
 vtctx->frame = NULL;

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


[FFmpeg-cvslog] lavf/dashenc: remove unneeded call to dash_free

2018-03-18 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 14 
01:24:39 2018 -0500| [08e0f45cc88903967da5a76e18be45d7406397f7] | committer: 
Karthick Jeyapal

lavf/dashenc: remove unneeded call to dash_free

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 9feb4f1afb..bdf8c8d560 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1033,10 +1033,8 @@ static int dash_write_header(AVFormatContext *s)
 int i, ret;
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
-if ((ret = avformat_write_header(os->ctx, NULL)) < 0) {
-dash_free(s);
+if ((ret = avformat_write_header(os->ctx, NULL)) < 0)
 return ret;
-}
 }
 ret = write_manifest(s, 0);
 if (!ret)

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


[FFmpeg-cvslog] lavc/videotoolbox: fix threaded decoding

2018-03-08 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Feb  2 
20:50:13 2018 -0600| [63d875772d265a885808532889f094f80afaac7a] | committer: 
Aman Gupta

lavc/videotoolbox: fix threaded decoding

AVHWAccel.end_frame can run on a worker thread. The assumption of the
frame threading code is that the worker thread will change the AVFrame
image data, not the AVFrame fields. So the AVFrame fields are not synced
back to the main thread. But this breaks videotoolbox due to its special
requirements (everything else is fine). It actually wants to update
AVFrame fields.

The actual videotoolbox frame is now stored in the dummy AVBufferRef, so
it mimics what happens in non-videotoolbox cases. (Changing the
AVBufferRef contents is a bit like changing the image data.) The
post_process callback copies that reference to the proper AVFrame field.

Based on a patch by wm4.

Signed-off-by: Aman Gupta <a...@tmm1.net>

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

 libavcodec/h264dec.c  |  3 ---
 libavcodec/videotoolbox.c | 68 +++
 libavcodec/vt_internal.h  |  1 -
 3 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 8c9c6d9f3b..7494c7a8f2 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -838,9 +838,6 @@ static int output_frame(H264Context *h, AVFrame *dst, 
H264Picture *srcp)
 AVFrame *src = srcp->f;
 int ret;
 
-if (src->format == AV_PIX_FMT_VIDEOTOOLBOX && src->buf[0]->size == 1)
-return AVERROR_INVALIDDATA;
-
 ret = av_frame_ref(dst, src);
 if (ret < 0)
 return ret;
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index afec1edf3f..f82c31c5df 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -45,8 +45,10 @@ enum { kCMVideoCodecType_HEVC = 'hvc1' };
 
 static void videotoolbox_buffer_release(void *opaque, uint8_t *data)
 {
-CVPixelBufferRef cv_buffer = (CVImageBufferRef)data;
+CVPixelBufferRef cv_buffer = *(CVPixelBufferRef *)data;
 CVPixelBufferRelease(cv_buffer);
+
+av_free(data);
 }
 
 static int videotoolbox_buffer_copy(VTContext *vtctx,
@@ -69,19 +71,47 @@ static int videotoolbox_buffer_copy(VTContext *vtctx,
 return 0;
 }
 
+static int videotoolbox_postproc_frame(void *avctx, AVFrame *frame)
+{
+CVPixelBufferRef ref = *(CVPixelBufferRef *)frame->buf[0]->data;
+
+if (!ref) {
+av_log(avctx, AV_LOG_ERROR, "No frame decoded?\n");
+av_frame_unref(frame);
+return AVERROR_EXTERNAL;
+}
+
+frame->data[3] = (uint8_t*)ref;
+
+return 0;
+}
+
 int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
 {
+size_t  size = sizeof(CVPixelBufferRef);
+uint8_t*data = NULL;
+AVBufferRef *buf = NULL;
 int ret = ff_attach_decode_data(frame);
+FrameDecodeData *fdd;
 if (ret < 0)
 return ret;
 
+data = av_mallocz(size);
+if (!data)
+return AVERROR(ENOMEM);
+buf = av_buffer_create(data, size, videotoolbox_buffer_release, NULL, 0);
+if (!buf) {
+av_freep();
+return AVERROR(ENOMEM);
+}
+frame->buf[0] = buf;
+
+fdd = (FrameDecodeData*)frame->private_ref->data;
+fdd->post_process = videotoolbox_postproc_frame;
+
 frame->width  = avctx->width;
 frame->height = avctx->height;
 frame->format = avctx->pix_fmt;
-frame->buf[0] = av_buffer_alloc(1);
-
-if (!frame->buf[0])
-return AVERROR(ENOMEM);
 
 return 0;
 }
@@ -285,20 +315,24 @@ CFDataRef 
ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
 return data;
 }
 
-int ff_videotoolbox_buffer_create(VTContext *vtctx, AVFrame *frame)
+static int videotoolbox_set_frame(AVCodecContext *avctx, AVFrame *frame)
 {
-av_buffer_unref(>buf[0]);
-
-frame->buf[0] = av_buffer_create((uint8_t*)vtctx->frame,
- sizeof(vtctx->frame),
- videotoolbox_buffer_release,
- NULL,
- AV_BUFFER_FLAG_READONLY);
-if (!frame->buf[0]) {
-return AVERROR(ENOMEM);
+VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+if (!frame->buf[0] || frame->data[3]) {
+av_log(avctx, AV_LOG_ERROR, "videotoolbox: invalid state\n");
+av_frame_unref(frame);
+return AVERROR_EXTERNAL;
+}
+
+CVPixelBufferRef *ref = (CVPixelBufferRef *)frame->buf[0]->data;
+
+if (*ref) {
+av_log(avctx, AV_LOG_ERROR, "videotoolbox: frame already set?\n");
+av_frame_unref(frame);
+return AVERROR_EXTERNAL;
 }
 
-frame->data[3] = (uint8_t*)vtctx->frame;
+*ref = vtctx->frame;
 vtctx->frame

[FFmpeg-cvslog] lavfi/vf_transpose: fix regression with semiplanar formats

2018-02-23 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Feb 21 
22:01:51 2018 -0600| [0419623cdca948cdd1fa3f9269e14881385a6796] | committer: 
Rodger Combs

lavfi/vf_transpose: fix regression with semiplanar formats

(e.g. nv12)

Regression since 7b19e76aeb0ace57b99aaef156bbfe592e43e65e

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

 libavfilter/vf_transpose.c  | 50 +++--
 tests/ref/fate/filter-pixfmts-transpose |  8 +++---
 2 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index 3ff4cb4249..74a4bbcf58 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -52,6 +52,14 @@ enum TransposeDir {
 TRANSPOSE_CLOCK_FLIP,
 };
 
+typedef struct TransVtable {
+void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize,
+  uint8_t *dst, ptrdiff_t dst_linesize);
+void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize,
+uint8_t *dst, ptrdiff_t dst_linesize,
+int w, int h);
+} TransVtable;
+
 typedef struct TransContext {
 const AVClass *class;
 int hsub, vsub;
@@ -61,11 +69,7 @@ typedef struct TransContext {
 int passthrough;///< PassthroughType, landscape passthrough mode 
enabled
 int dir;///< TransposeDir
 
-void (*transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize,
-  uint8_t *dst, ptrdiff_t dst_linesize);
-void (*transpose_block)(uint8_t *src, ptrdiff_t src_linesize,
-uint8_t *dst, ptrdiff_t dst_linesize,
-int w, int h);
+TransVtable vtables[4];
 } TransContext;
 
 static int query_formats(AVFilterContext *ctx)
@@ -233,19 +237,22 @@ static int config_props_output(AVFilterLink *outlink)
 else
 outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
 
-switch (s->pixsteps[0]) {
-case 1: s->transpose_block = transpose_block_8_c;
-s->transpose_8x8   = transpose_8x8_8_c;  break;
-case 2: s->transpose_block = transpose_block_16_c;
-s->transpose_8x8   = transpose_8x8_16_c; break;
-case 3: s->transpose_block = transpose_block_24_c;
-s->transpose_8x8   = transpose_8x8_24_c; break;
-case 4: s->transpose_block = transpose_block_32_c;
-s->transpose_8x8   = transpose_8x8_32_c; break;
-case 6: s->transpose_block = transpose_block_48_c;
-s->transpose_8x8   = transpose_8x8_48_c; break;
-case 8: s->transpose_block = transpose_block_64_c;
-s->transpose_8x8   = transpose_8x8_64_c; break;
+for (int i = 0; i < 4; i++) {
+TransVtable *v = >vtables[i];
+switch (s->pixsteps[i]) {
+case 1: v->transpose_block = transpose_block_8_c;
+v->transpose_8x8   = transpose_8x8_8_c;  break;
+case 2: v->transpose_block = transpose_block_16_c;
+v->transpose_8x8   = transpose_8x8_16_c; break;
+case 3: v->transpose_block = transpose_block_24_c;
+v->transpose_8x8   = transpose_8x8_24_c; break;
+case 4: v->transpose_block = transpose_block_32_c;
+v->transpose_8x8   = transpose_8x8_32_c; break;
+case 6: v->transpose_block = transpose_block_48_c;
+v->transpose_8x8   = transpose_8x8_48_c; break;
+case 8: v->transpose_block = transpose_block_64_c;
+v->transpose_8x8   = transpose_8x8_64_c; break;
+}
 }
 
 av_log(ctx, AV_LOG_VERBOSE,
@@ -290,6 +297,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr,
 uint8_t *dst, *src;
 int dstlinesize, srclinesize;
 int x, y;
+TransVtable *v = >vtables[plane];
 
 dstlinesize = out->linesize[plane];
 dst = out->data[plane] + start * dstlinesize;
@@ -308,20 +316,20 @@ static int filter_slice(AVFilterContext *ctx, void *arg, 
int jobnr,
 
 for (y = start; y < end - 7; y += 8) {
 for (x = 0; x < outw - 7; x += 8) {
-s->transpose_8x8(src + x * srclinesize + y * pixstep,
+v->transpose_8x8(src + x * srclinesize + y * pixstep,
  srclinesize,
  dst + (y - start) * dstlinesize + x * pixstep,
  dstlinesize);
 }
 if (outw - x > 0 && end - y > 0)
-s->transpose_block(src + x * srclinesize + y * pixstep,
+v->transpose_block(src + x * srclinesize + y * pixstep,
srclinesize,
dst + (y - start) * dstlinesize + x * 
pixstep,
   

[FFmpeg-cvslog] lavc/aarch64/sbrdsp_neon: fix build on old binutils

2018-01-26 Thread Rodger Combs
ffmpeg | branch: release/3.4 | Rodger Combs <rodger.co...@gmail.com> | Thu Jan 
25 20:53:59 2018 -0600| [ad85d9af13dbca29e4377a53c957ed97b8442fdd] | committer: 
James Almer

lavc/aarch64/sbrdsp_neon: fix build on old binutils

(cherry picked from commit 77237504757b97c068796a4e9ef81b9653618616)

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

 libavcodec/aarch64/sbrdsp_neon.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aarch64/sbrdsp_neon.S b/libavcodec/aarch64/sbrdsp_neon.S
index d1d79b749c..d23717e760 100644
--- a/libavcodec/aarch64/sbrdsp_neon.S
+++ b/libavcodec/aarch64/sbrdsp_neon.S
@@ -287,7 +287,7 @@ endfunc
 zip1v4.4S, v4.4S, v4.4S
 fmlav6.4S, v1.4S, v3.4S
 fmlav2.4S, v5.4S, v4.4S
-fcmeq   v7.4S, v3.4S, #0.0
+fcmeq   v7.4S, v3.4S, #0
 bif v2.16B, v6.16B, v7.16B
 st1 {v2.4S}, [x0], #16
 subsx5, x5, #2

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


[FFmpeg-cvslog] lavc/aarch64/sbrdsp_neon: fix build on old binutils

2018-01-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Jan 25 
20:53:59 2018 -0600| [77237504757b97c068796a4e9ef81b9653618616] | committer: 
Rodger Combs

lavc/aarch64/sbrdsp_neon: fix build on old binutils

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

 libavcodec/aarch64/sbrdsp_neon.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aarch64/sbrdsp_neon.S b/libavcodec/aarch64/sbrdsp_neon.S
index d1d79b749c..d23717e760 100644
--- a/libavcodec/aarch64/sbrdsp_neon.S
+++ b/libavcodec/aarch64/sbrdsp_neon.S
@@ -287,7 +287,7 @@ endfunc
 zip1v4.4S, v4.4S, v4.4S
 fmlav6.4S, v1.4S, v3.4S
 fmlav2.4S, v5.4S, v4.4S
-fcmeq   v7.4S, v3.4S, #0.0
+fcmeq   v7.4S, v3.4S, #0
 bif v2.16B, v6.16B, v7.16B
 st1 {v2.4S}, [x0], #16
 subsx5, x5, #2

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


[FFmpeg-cvslog] lavfi/vf_scale_vaapi: set output SAR

2018-01-18 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Jan 12 
19:08:27 2018 -0600| [381a4820c64ba2d1b3ddc3a50147961f1d8c5848] | committer: 
Rodger Combs

lavfi/vf_scale_vaapi: set output SAR

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

 libavfilter/vf_scale_vaapi.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavfilter/vf_scale_vaapi.c b/libavfilter/vf_scale_vaapi.c
index 22e928c098..4bead5aaf4 100644
--- a/libavfilter/vf_scale_vaapi.c
+++ b/libavfilter/vf_scale_vaapi.c
@@ -240,6 +240,11 @@ static int scale_vaapi_config_output(AVFilterLink *outlink)
 goto fail;
 }
 
+if (inlink->sample_aspect_ratio.num)
+outlink->sample_aspect_ratio = av_mul_q((AVRational){outlink->h * 
inlink->w, outlink->w * inlink->h}, inlink->sample_aspect_ratio);
+else
+outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
+
 av_freep();
 av_hwframe_constraints_free();
 return 0;

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


[FFmpeg-cvslog] lavc/libx265: support all color parameters that x265 does

2018-01-12 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Dec 18 
06:18:57 2017 -0600| [1eb7c1d49d67fe0f21c71fb87d6c1fa8542f8cef] | committer: 
Rodger Combs

lavc/libx265: support all color parameters that x265 does

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

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

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 52ad2312a3..3c97800ccb 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -115,11 +115,11 @@ static av_cold int libx265_encode_init(AVCodecContext 
*avctx)
 ctx->params->sourceHeight= avctx->height;
 ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR);
 
-if ((avctx->color_primaries <= AVCOL_PRI_BT2020 &&
+if ((avctx->color_primaries <= AVCOL_PRI_SMPTE432 &&
  avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) ||
-(avctx->color_trc <= AVCOL_TRC_BT2020_12 &&
+(avctx->color_trc <= AVCOL_TRC_ARIB_STD_B67 &&
  avctx->color_trc != AVCOL_TRC_UNSPECIFIED) ||
-(avctx->colorspace <= AVCOL_SPC_BT2020_CL &&
+(avctx->colorspace <= AVCOL_SPC_ICTCP &&
  avctx->colorspace != AVCOL_SPC_UNSPECIFIED)) {
 
 ctx->params->vui.bEnableVideoSignalTypePresentFlag  = 1;

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


[FFmpeg-cvslog] lavf/mpegts: mark packets with TEI flag as corrupted

2017-12-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Oct 19 
01:58:10 2017 -0500| [2e391a576c1fc2e8816990924c6e4c21ccf75a82] | committer: 
Rodger Combs

lavf/mpegts: mark packets with TEI flag as corrupted

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

 libavformat/mpegts.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 53cbcfb543..0a3ad05726 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2296,6 +2296,14 @@ static int handle_packet(MpegTSContext *ts, const 
uint8_t *packet)
 }
 }
 
+if (packet[1] & 0x80) {
+av_log(ts->stream, AV_LOG_DEBUG, "Packet had TEI flag set; marking as 
corrupt\n");
+if (tss->type == MPEGTS_PES) {
+PESContext *pc = tss->u.pes_filter.opaque;
+pc->flags |= AV_PKT_FLAG_CORRUPT;
+}
+}
+
 p = packet + 4;
 if (has_adaptation) {
 int64_t pcr_h;

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


[FFmpeg-cvslog] lavu/hwcontext_opencl.h: fix build on macOS

2017-11-27 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Nov 27 
23:38:46 2017 -0600| [1204ce0b6371f5b51efdfe84d1b5aa5925809186] | committer: 
Rodger Combs

lavu/hwcontext_opencl.h: fix build on macOS

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

 libavutil/hwcontext_opencl.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavutil/hwcontext_opencl.h b/libavutil/hwcontext_opencl.h
index 8e34df44cd..ef54486c95 100644
--- a/libavutil/hwcontext_opencl.h
+++ b/libavutil/hwcontext_opencl.h
@@ -19,7 +19,11 @@
 #ifndef AVUTIL_HWCONTEXT_OPENCL_H
 #define AVUTIL_HWCONTEXT_OPENCL_H
 
+#ifdef __APPLE__
+#include 
+#else
 #include 
+#endif
 
 #include "frame.h"
 

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


[FFmpeg-cvslog] lavf/tls_securetransport: handle incomplete reads gracefully

2017-11-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Nov 13 
14:46:17 2017 -0600| [a36a3d7fecdfc50691f01eef984cad6cedb6fb3a] | committer: 
Rodger Combs

lavf/tls_securetransport: handle incomplete reads gracefully

Signed-off-by: Aman Gupta 

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

 libavformat/tls_securetransport.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/libavformat/tls_securetransport.c 
b/libavformat/tls_securetransport.c
index b862e0003a..dc32eb1fa8 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -54,7 +54,7 @@ static int print_tls_error(URLContext *h, int ret)
 TLSContext *c = h->priv_data;
 switch (ret) {
 case errSSLWouldBlock:
-break;
+return AVERROR(EAGAIN);
 case errSSLXCertChainInvalid:
 av_log(h, AV_LOG_ERROR, "Invalid certificate chain\n");
 return AVERROR(EIO);
@@ -197,7 +197,8 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, 
void *data, size_t *dat
 {
 URLContext *h = (URLContext*)connection;
 TLSContext *c = h->priv_data;
-int read = ffurl_read_complete(c->tls_shared.tcp, data, *dataLength);
+size_t requested = *dataLength;
+int read = ffurl_read(c->tls_shared.tcp, data, requested);
 if (read <= 0) {
 *dataLength = 0;
 switch(AVUNERROR(read)) {
@@ -214,7 +215,10 @@ static OSStatus tls_read_cb(SSLConnectionRef connection, 
void *data, size_t *dat
 }
 } else {
 *dataLength = read;
-return noErr;
+if (read < requested)
+return errSSLWouldBlock;
+else
+return noErr;
 }
 }
 
@@ -326,12 +330,13 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 if (peerTrust)
 CFRelease(peerTrust);
 }
-if (status == noErr)
+if (status == noErr) {
 break;
-
-av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session: %i\n", 
(int)status);
-ret = AVERROR(EIO);
-goto fail;
+} else if (status != errSSLWouldBlock) {
+av_log(h, AV_LOG_ERROR, "Unable to negotiate TLS/SSL session: 
%i\n", (int)status);
+ret = AVERROR(EIO);
+goto fail;
+}
 }
 
 return 0;
@@ -348,6 +353,9 @@ static int map_ssl_error(OSStatus status, size_t processed)
 case errSSLClosedGraceful:
 case errSSLClosedNoNotify:
 return 0;
+case errSSLWouldBlock:
+if (processed > 0)
+return processed;
 default:
 return (int)status;
 }

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


[FFmpeg-cvslog] Merge commit 'c5c663541739cb813a2a5668ee8339b535b35d7d'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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

[FFmpeg-cvslog] Merge commit '01f1f017d831cf14617aaaeafcec3ae3a81efce7'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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->

[FFmpeg-cvslog] Merge commit '7295b7373862ee54903b33d6ef3335531dfa93ad'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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 A

[FFmpeg-cvslog] Merge commit 'ca9bc9de690258d4761a19b0df6e9c9113b80115'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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 <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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);
 

[FFmpeg-cvslog] Merge commit 'efd2fc41b3f0749f9715d50b581f22bbaa8c5b99'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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 <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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] Merge commit '3d23a5f96ad72961c14ba3a0c2add8f2ab374b61'

2017-09-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | 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 <rodger.co...@gmail.com>

> 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 Ad

[FFmpeg-cvslog] lavf/segment: fix autobsf

2016-11-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Oct 26 
22:03:02 2016 -0500| [8e6478b723affe4d44f94d34b98e0c47f6a0b411] | committer: 
Rodger Combs

lavf/segment: fix autobsf

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

 libavformat/segment.c | 40 +++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 868f0a8..9b3dc17 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -798,9 +798,26 @@ static int seg_write_header(AVFormatContext *s)
 {
 SegmentContext *seg = s->priv_data;
 AVFormatContext *oc = seg->avf;
-int ret;
+int ret, i;
 
 if (!seg->header_written) {
+for (i = 0; i < s->nb_streams; i++) {
+AVStream *st = oc->streams[i];
+AVCodecParameters *ipar, *opar;
+
+ipar = s->streams[i]->codecpar;
+opar = oc->streams[i]->codecpar;
+avcodec_parameters_copy(opar, ipar);
+if (!oc->oformat->codec_tag ||
+av_codec_get_id (oc->oformat->codec_tag, ipar->codec_tag) == 
opar->codec_id ||
+av_codec_get_tag(oc->oformat->codec_tag, ipar->codec_id) <= 0) 
{
+opar->codec_tag = ipar->codec_tag;
+} else {
+opar->codec_tag = 0;
+}
+st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
+st->time_base = s->streams[i]->time_base;
+}
 ret = avformat_write_header(oc, NULL);
 if (ret < 0)
 return ret;
@@ -978,6 +995,25 @@ fail:
 return ret;
 }
 
+static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+SegmentContext *seg = s->priv_data;
+AVFormatContext *oc = seg->avf;
+if (oc->oformat->check_bitstream) {
+int ret = oc->oformat->check_bitstream(oc, pkt);
+if (ret == 1) {
+AVStream *st = s->streams[pkt->stream_index];
+AVStream *ost = oc->streams[pkt->stream_index];
+st->internal->bsfcs = ost->internal->bsfcs;
+st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
+ost->internal->bsfcs = NULL;
+ost->internal->nb_bsfcs = 0;
+}
+return ret;
+}
+return 1;
+}
+
 #define OFFSET(x) offsetof(SegmentContext, x)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
@@ -1041,6 +1077,7 @@ AVOutputFormat ff_segment_muxer = {
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,
+.check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };
 
@@ -1061,5 +1098,6 @@ AVOutputFormat ff_stream_segment_muxer = {
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,
+.check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };

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


[FFmpeg-cvslog] tests/fate/avformat: add segment.c tests

2016-11-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Oct 27 
01:16:08 2016 -0500| [d401c37ef5036a12c03d4cbdbbde561d9a7ba4b3] | committer: 
Rodger Combs

tests/fate/avformat: add segment.c tests

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

 tests/fate/avformat.mak   |  56 +++
 tests/ref/fate/segment-adts-to-mkv-header-000 |  21 
 tests/ref/fate/segment-adts-to-mkv-header-001 |  22 +
 tests/ref/fate/segment-adts-to-mkv-header-002 |   9 ++
 tests/ref/fate/segment-adts-to-mkv-header-all |  40 
 tests/ref/fate/segment-mp4-to-ts  | 132 ++
 6 files changed, 280 insertions(+)

diff --git a/tests/fate/avformat.mak b/tests/fate/avformat.mak
index bbb1f98..0a3800b 100644
--- a/tests/fate/avformat.mak
+++ b/tests/fate/avformat.mak
@@ -81,3 +81,59 @@ $(FATE_LAVF_FATE): CMD = lavffatetest
 
 FATE_SAMPLES_FFMPEG += $(FATE_LAVF_FATE)
 fate-lavf-fate:$(FATE_LAVF_FATE)
+
+tests/data/mp4-to-ts.m3u8: TAG = GEN
+tests/data/mp4-to-ts.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+-i $(TARGET_SAMPLES)/h264/interlaced_crop.mp4 \
+-f ssegment -segment_time 1 -map 0 -flags +bitexact -codec copy \
+-segment_list $(TARGET_PATH)/$@ -y 
$(TARGET_PATH)/tests/data/mp4-to-ts-%03d.ts 2>/dev/null
+
+tests/data/adts-to-mkv.m3u8: TAG = GEN
+tests/data/adts-to-mkv.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts 
\
+-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy 
-segment_format_options live=1 \
+-segment_list $(TARGET_PATH)/$@ -y 
$(TARGET_PATH)/tests/data/adts-to-mkv-%03d.mkv 2>/dev/null
+
+tests/data/adts-to-mkv-header.mkv: TAG = GEN
+tests/data/adts-to-mkv-header.mkv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+-i $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts 
\
+-f segment -segment_time 1 -map 0 -flags +bitexact -codec copy 
-segment_format_options live=1 \
+-segment_header_filename 
$(TARGET_PATH)/tests/data/adts-to-mkv-header.mkv \
+-y $(TARGET_PATH)/tests/data/adts-to-mkv-header-%03d.mkv 2>/dev/null
+
+tests/data/adts-to-mkv-header-%.mkv: tests/data/adts-to-mkv-header.mkv ;
+
+FATE_SEGMENT_PARTS += 000 001 002
+
+tests/data/adts-to-mkv-cated-all.mkv: TAG = GEN
+tests/data/adts-to-mkv-cated-all.mkv: tests/data/adts-to-mkv-header.mkv 
$(FATE_SEGMENT_PARTS:%=tests/data/adts-to-mkv-header-%.mkv) | tests/data
+   $(M)cat $^ >$@
+
+tests/data/adts-to-mkv-cated-%.mkv: TAG = GEN
+tests/data/adts-to-mkv-cated-%.mkv: tests/data/adts-to-mkv-header.mkv 
tests/data/adts-to-mkv-header-%.mkv | tests/data
+   $(M)cat $^ >$@
+
+FATE_SEGMENT += fate-segment-mp4-to-ts
+fate-segment-mp4-to-ts: tests/data/mp4-to-ts.m3u8
+fate-segment-mp4-to-ts: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/mp4-to-ts.m3u8 -c copy
+FATE_SEGMENT-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF MPEGTS_MUXER 
MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-mp4-to-ts
+
+FATE_SEGMENT += fate-segment-adts-to-mkv
+fate-segment-adts-to-mkv: tests/data/adts-to-mkv.m3u8
+fate-segment-adts-to-mkv: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/adts-to-mkv.m3u8 -c copy
+fate-segment-adts-to-mkv: REF = 
$(SRC_PATH)/tests/ref/fate/segment-adts-to-mkv-header-all
+FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER 
MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += fate-segment-adts-to-mkv
+
+FATE_SEGMENT_ALLPARTS = $(FATE_SEGMENT_PARTS)
+FATE_SEGMENT_ALLPARTS += all
+FATE_SEGMENT_SPLIT += 
$(FATE_SEGMENT_ALLPARTS:%=fate-segment-adts-to-mkv-header-%)
+$(foreach N,$(FATE_SEGMENT_ALLPARTS),$(eval 
$(N:%=fate-segment-adts-to-mkv-header-%): 
tests/data/adts-to-mkv-cated-$(N).mkv))
+fate-segment-adts-to-mkv-header-%: CMD = framecrc -flags +bitexact -i 
$(TARGET_PATH)/tests/data/$(@:fate-segment-adts-to-mkv-header-%=adts-to-mkv-cated-%).mkv
 -c copy
+FATE_SEGMENT-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER 
MATROSKA_DEMUXER SEGMENT_MUXER HLS_DEMUXER) += $(FATE_SEGMENT_SPLIT)
+
+FATE_SAMPLES_FFMPEG += $(FATE_SEGMENT-yes)
+
+fate-segment: $(FATE_SEGMENT-yes)
diff --git a/tests/ref/fate/segment-adts-to-mkv-header-000 
b/tests/ref/fate/segment-adts-to-mkv-header-000
new file mode 100644
index 000..d00e886
--- /dev/null
+++ b/tests/ref/fate/segment-adts-to-mkv-header-000
@@ -0,0 +1,21 @@
+#extradata 0:2, 0x0030001c
+#tb 0: 1/1000
+#media_type 0: audio
+#codec_id 0: aac
+#sample_rate 0: 16000
+#channel_layout 0: 4
+0,  0,  0,   64,4, 0x02f70117
+0, 64, 64,   64,  163, 0xd5f85007
+0,128,128,   64,  127, 0x66484065
+0,

[FFmpeg-cvslog] lavf/matroskaenc: don't try to modify the header when live-streaming

2016-11-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Oct 27 
01:10:47 2016 -0500| [1a958f4eb0984fada564a5648d211b408ebb8c3d] | committer: 
Rodger Combs

lavf/matroskaenc: don't try to modify the header when live-streaming

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

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 56174ff..78540fb 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1783,7 +1783,7 @@ static int mkv_write_header(AVFormatContext *s)
 put_ebml_void(pb, 11);  // assumes double-precision 
float to be written
 }
 }
-if (s->pb->seekable)
+if (s->pb->seekable && !mkv->is_live)
 put_ebml_void(s->pb, avio_tell(pb));
 else
 end_ebml_master_crc32(s->pb, >info_bc, mkv, mkv->info);
@@ -2274,7 +2274,7 @@ static int mkv_write_trailer(AVFormatContext *s)
 return ret;
 }
 
-if (pb->seekable) {
+if (pb->seekable && !mkv->is_live) {
 if (mkv->cues->num_entries) {
 if (mkv->reserve_cues_space) {
 int64_t cues_end;

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


[FFmpeg-cvslog] lavf/matroskaenc: fix uninitialized read

2016-11-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Oct 27 
01:09:23 2016 -0500| [be28ce210d5674603838e67509fc597f30c1bb1c] | committer: 
Rodger Combs

lavf/matroskaenc: fix uninitialized read

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

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 5704119..56174ff 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1547,7 +1547,7 @@ static int mkv_write_attachments(AVFormatContext *s)
 
 mkv->attachments = av_mallocz(sizeof(*mkv->attachments));
 if (!mkv->attachments)
-return ret;
+return AVERROR(ENOMEM);
 
 av_lfg_init(, av_get_random_seed());
 

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


[FFmpeg-cvslog] lavfi/vf_overlay: support NV12 and NV21

2016-10-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Oct 25 
01:28:43 2016 -0500| [f53c26c694c94bb93fb49d72b6439b792b125fe8] | committer: 
Rodger Combs

lavfi/vf_overlay: support NV12 and NV21

Tested-by: Michael on x86-32/64 linux, mingw, mips/arm qemu linux

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

 libavfilter/vf_overlay.c| 22 +-
 tests/fate/filter-video.mak | 10 ++
 tests/filtergraphs/overlay_nv12 |  5 +
 tests/filtergraphs/overlay_nv21 |  5 +
 4 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index c592dca..b249ad7 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -125,6 +125,7 @@ typedef struct OverlayContext {
 int main_pix_step[4];   ///< steps per pixel for each plane of the 
main output
 int overlay_pix_step[4];///< steps per pixel for each plane of the 
overlay
 int hsub, vsub; ///< chroma subsampling values
+const AVPixFmtDescriptor *main_desc; ///< format descriptor for main input
 
 double var_values[VAR_VARS_NB];
 char *x_expr, *y_expr;
@@ -215,7 +216,9 @@ static int query_formats(AVFilterContext *ctx)
 
 /* overlay formats contains alpha, for avoiding conversion with alpha 
information loss */
 static const enum AVPixelFormat main_pix_fmts_yuv420[] = {
-AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVA420P, 
AV_PIX_FMT_NONE
+AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVA420P,
+AV_PIX_FMT_NV12, AV_PIX_FMT_NV21,
+AV_PIX_FMT_NONE
 };
 static const enum AVPixelFormat overlay_pix_fmts_yuv420[] = {
 AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE
@@ -470,6 +473,7 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
  int x, int y,
  int main_has_alpha)
 {
+OverlayContext *ol = ctx->priv;
 int src_wp = AV_CEIL_RSHIFT(src_w, hsub);
 int src_hp = AV_CEIL_RSHIFT(src_h, vsub);
 int dst_wp = AV_CEIL_RSHIFT(dst_w, hsub);
@@ -479,14 +483,20 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
 uint8_t *s, *sp, *d, *dp, *a, *ap;
 int jmax, j, k, kmax;
 
+int dst_plane  = ol->main_desc->comp[i].plane;
+int dst_offset = ol->main_desc->comp[i].offset;
+int dst_step   = ol->main_desc->comp[i].step;
+
 j = FFMAX(-yp, 0);
 sp = src->data[i] + j * src->linesize[i];
-dp = dst->data[i] + (yp+j)* dst->linesize[i];
+dp = dst->data[dst_plane]
+  + (yp+j)* dst->linesize[dst_plane]
+  + dst_offset;
 ap = src->data[3] + (j<<vsub) * src->linesize[3];
 
 for (jmax = FFMIN(-yp + dst_hp, src_hp); j < jmax; j++) {
 k = FFMAX(-xp, 0);
-d = dp + xp+k;
+d = dp + (xp+k) * dst_step;
 s = sp + k;
 a = ap + (k<<hsub);
 
@@ -525,10 +535,10 @@ static av_always_inline void blend_plane(AVFilterContext 
*ctx,
 }
 *d = FAST_DIV255(*d * (255 - alpha) + *s * alpha);
 s++;
-d++;
+d += dst_step;
 a += 1 << hsub;
 }
-dp += dst->linesize[i];
+dp += dst->linesize[dst_plane];
 sp += src->linesize[i];
 ap += (1 << vsub) * src->linesize[3];
 }
@@ -626,6 +636,8 @@ static int config_input_main(AVFilterLink *inlink)
 s->hsub = pix_desc->log2_chroma_w;
 s->vsub = pix_desc->log2_chroma_h;
 
+s->main_desc = pix_desc;
+
 s->main_is_packed_rgb =
 ff_fill_rgba_map(s->main_rgba_map, inlink->format) >= 0;
 s->main_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index e2513f5..ec22d25 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -172,6 +172,16 @@ FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER 
SCALE_FILTER PAD_FILTER OVERLAY_F
 fate-filter-overlay_yuv420: tests/data/filtergraphs/overlay_yuv420
 fate-filter-overlay_yuv420: CMD = framecrc -c:v pgmyuv -i $(SRC) 
-filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_yuv420
 
+FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER 
OVERLAY_FILTER) += fate-filter-overlay_nv12
+fate-filter-overlay_nv12: tests/data/filtergraphs/overlay_nv12
+fate-filter-overlay_nv12: CMD = framecrc -c:v pgmyuv -i $(SRC) 
-filter_complex_script $(TARGET_PATH)/tests/data/filtergraphs/overlay_nv12
+fate-filter-overlay_nv12: REF = 
$(SRC_PATH)/tests/ref/fate/filter-overlay_yuv420
+
+FATE_FILTER_VSYNTH-$(call ALLYES, SPLIT_FILTER SCALE_FILTER PAD_FILTER 
OVERLAY_FILTER) += fate-filter-overlay_nv21
+fate-filter-overlay_nv21: tests/data/f

[FFmpeg-cvslog] lavf: add AV_DISPOSITION_TIMED_THUMBNAILS

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Oct 24 
05:47:05 2016 -0500| [73ead477ddd9dbfbe6f7e8d3fc90ebfd21b271b0] | committer: 
Rodger Combs

lavf: add AV_DISPOSITION_TIMED_THUMBNAILS

Reviewed-By: Michael Niedermayer <mich...@niedermayer.cc>

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

 doc/APIchanges  |  3 +++
 doc/ffprobe.xsd |  1 +
 ffprobe.c   |  1 +
 libavformat/avformat.h  | 12 +---
 libavformat/version.h   |  2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf |  2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf  |  4 ++--
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  |  4 ++--
 tests/ref/fate/concat-demuxer-simple2-lavf-ts   |  4 ++--
 tests/ref/fate/ffprobe_compact  |  6 +++---
 tests/ref/fate/ffprobe_csv  |  6 +++---
 tests/ref/fate/ffprobe_default  |  3 +++
 tests/ref/fate/ffprobe_flat |  3 +++
 tests/ref/fate/ffprobe_ini  |  3 +++
 tests/ref/fate/ffprobe_json |  9 ++---
 tests/ref/fate/ffprobe_xml  |  6 +++---
 17 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5017eb4..eaa6e56 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-10-24 - xxx - lavf 57.55.100 - avformat.h
+  Add AV_DISPOSITION_TIMED_THUMBNAILS
+
 2016-10-24 - xxx - lavf 57.54.100 - avformat.h
   Add avformat_init_output() and AVSTREAM_INIT_IN_ macros
 
diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index ac0347f..f64656a 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -166,6 +166,7 @@
   
   
   
+  
 
 
 
diff --git a/ffprobe.c b/ffprobe.c
index 7cd0034..a2980b3 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2383,6 +2383,7 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 PRINT_DISPOSITION(VISUAL_IMPAIRED,  "visual_impaired");
 PRINT_DISPOSITION(CLEAN_EFFECTS,"clean_effects");
 PRINT_DISPOSITION(ATTACHED_PIC, "attached_pic");
+PRINT_DISPOSITION(TIMED_THUMBNAILS, "timed_thumbnails");
 writer_print_section_footer(w);
 }
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 82ca727..f9f4d72 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -842,11 +842,17 @@ typedef struct AVIndexEntry {
 #define AV_DISPOSITION_CLEAN_EFFECTS 0x0200  /**< stream without voice */
 /**
  * The stream is stored in the file as an attached picture/"cover art" (e.g.
- * APIC frame in ID3v2). The single packet associated with it will be returned
- * among the first few packets read from the file unless seeking takes place.
- * It can also be accessed at any time in AVStream.attached_pic.
+ * APIC frame in ID3v2). The first (usually only) packet associated with it
+ * will be returned among the first few packets read from the file unless
+ * seeking takes place. It can also be accessed at any time in
+ * AVStream.attached_pic.
  */
 #define AV_DISPOSITION_ATTACHED_PIC  0x0400
+/**
+ * The stream is sparse, and contains thumbnail images, often corresponding
+ * to chapter markers. Only ever used with AV_DISPOSITION_ATTACHED_PIC.
+ */
+#define AV_DISPOSITION_TIMED_THUMBNAILS  0x0800
 
 typedef struct AVStreamInternal AVStreamInternal;
 
diff --git a/libavformat/version.h b/libavformat/version.h
index addff03..c4db5a5 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  57
-#define LIBAVFORMAT_VERSION_MINOR  54
+#define LIBAVFORMAT_VERSION_MINOR  55
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index 8bb2fb0..f6b1010 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-a277e04c23cf764abe692ca07e87b82e 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+32fe9ae5b89c7802c804ac51f62d89cb 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index e294538..6d84589 100644
--- a/tests/ref/fate/concat-demuxer-ext

[FFmpeg-cvslog] lavf/mov: improve `tref/chap` chapter handling

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Jan  7 
17:14:08 2016 -0600| [697400eac07c0614f6b9f2e7615563982dbcbe4a] | committer: 
Rodger Combs

lavf/mov: improve `tref/chap` chapter handling

3 parts:
- Supports multiple chapter streams
- Exports regular text chapter streams as opaque data. This prevents consumers
  from showing chapters as if they were regular subtitle streams.
- Exports video chapter streams as thumbnails, and provides the first one as
  an attached_pic.

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

 libavformat/isom.h |  3 ++-
 libavformat/mov.c  | 54 +++---
 2 files changed, 49 insertions(+), 8 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 2246fed..9038057 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -210,7 +210,8 @@ typedef struct MOVContext {
 unsigned trex_count;
 int itunes_metadata;  ///< metadata are itunes style
 int handbrake_version;
-int chapter_track;
+int *chapter_tracks;
+unsigned int nb_chapter_tracks;
 int use_absolute_path;
 int ignore_editlist;
 int ignore_chapters;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index dada1e0..bf25db9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3992,7 +3992,20 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
 static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-c->chapter_track = avio_rb32(pb);
+unsigned i, num;
+void *new_tracks;
+
+num = atom.size / 4;
+if (!(new_tracks = av_malloc_array(num, sizeof(int
+return AVERROR(ENOMEM);
+
+av_free(c->chapter_tracks);
+c->chapter_tracks = new_tracks;
+c->nb_chapter_tracks = num;
+
+for (i = 0; i < num && !pb->eof_reached; i++)
+c->chapter_tracks[i] = avio_rb32(pb);
+
 return 0;
 }
 
@@ -5055,25 +5068,50 @@ static int mov_probe(AVProbeData *p)
 static void mov_read_chapters(AVFormatContext *s)
 {
 MOVContext *mov = s->priv_data;
-AVStream *st = NULL;
+AVStream *st;
 MOVStreamContext *sc;
 int64_t cur_pos;
-int i;
+int i, j;
+int chapter_track;
 
+for (j = 0; j < mov->nb_chapter_tracks; j++) {
+chapter_track = mov->chapter_tracks[j];
+st = NULL;
 for (i = 0; i < s->nb_streams; i++)
-if (s->streams[i]->id == mov->chapter_track) {
+if (s->streams[i]->id == chapter_track) {
 st = s->streams[i];
 break;
 }
 if (!st) {
 av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
-return;
+continue;
 }
 
-st->discard = AVDISCARD_ALL;
 sc = st->priv_data;
 cur_pos = avio_tell(sc->pb);
 
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
+if (st->nb_index_entries) {
+// Retrieve the first frame, if possible
+AVPacket pkt;
+AVIndexEntry *sample = >index_entries[0];
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n");
+goto finish;
+}
+
+if (av_get_packet(sc->pb, , sample->size) < 0)
+goto finish;
+
+st->attached_pic  = pkt;
+st->attached_pic.stream_index = st->index;
+st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
+}
+} else {
+st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
+st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA;
+st->discard = AVDISCARD_ALL;
 for (i = 0; i < st->nb_index_entries; i++) {
 AVIndexEntry *sample = >index_entries[i];
 int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
@@ -5122,8 +5160,10 @@ static void mov_read_chapters(AVFormatContext *s)
 avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title);
 av_freep();
 }
+}
 finish:
 avio_seek(sc->pb, cur_pos, SEEK_SET);
+}
 }
 
 static int parse_timecode_in_framenum_format(AVFormatContext *s, AVStream *st,
@@ -5446,7 +5486,7 @@ static int mov_read_header(AVFormatContext *s)
 av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", 
avio_tell(pb));
 
 if (pb->seekable) {
-if (mov->chapter_track > 0 && !mov->ignore_chapters)
+if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters)
 mov_read_chapters(s);
 for (i = 0; i < s->nb_streams; i++)
 if (s->streams[i]->codecpar->codec_tag == AV_RL32("tmcd")) {

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


[FFmpeg-cvslog] lavf/mov: reindent

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Jan  7 
19:04:00 2016 -0600| [490c6bda0e35498a24936fd1524317aeebed026b] | committer: 
Rodger Combs

lavf/mov: reindent

Reviewed-By: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index bf25db9..357d800 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5075,94 +5075,94 @@ static void mov_read_chapters(AVFormatContext *s)
 int chapter_track;
 
 for (j = 0; j < mov->nb_chapter_tracks; j++) {
-chapter_track = mov->chapter_tracks[j];
-st = NULL;
-for (i = 0; i < s->nb_streams; i++)
-if (s->streams[i]->id == chapter_track) {
-st = s->streams[i];
-break;
+chapter_track = mov->chapter_tracks[j];
+st = NULL;
+for (i = 0; i < s->nb_streams; i++)
+if (s->streams[i]->id == chapter_track) {
+st = s->streams[i];
+break;
+}
+if (!st) {
+av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
+continue;
 }
-if (!st) {
-av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n");
-continue;
-}
 
-sc = st->priv_data;
-cur_pos = avio_tell(sc->pb);
+sc = st->priv_data;
+cur_pos = avio_tell(sc->pb);
+
+if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
+if (st->nb_index_entries) {
+// Retrieve the first frame, if possible
+AVPacket pkt;
+AVIndexEntry *sample = >index_entries[0];
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
+av_log(s, AV_LOG_ERROR, "Failed to retrieve first 
frame\n");
+goto finish;
+}
 
-if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
-st->disposition |= AV_DISPOSITION_ATTACHED_PIC | 
AV_DISPOSITION_TIMED_THUMBNAILS;
-if (st->nb_index_entries) {
-// Retrieve the first frame, if possible
-AVPacket pkt;
-AVIndexEntry *sample = >index_entries[0];
-if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
-av_log(s, AV_LOG_ERROR, "Failed to retrieve first frame\n");
-goto finish;
-}
+if (av_get_packet(sc->pb, , sample->size) < 0)
+goto finish;
 
-if (av_get_packet(sc->pb, , sample->size) < 0)
-goto finish;
+st->attached_pic  = pkt;
+st->attached_pic.stream_index = st->index;
+st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
+}
+} else {
+st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
+st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA;
+st->discard = AVDISCARD_ALL;
+for (i = 0; i < st->nb_index_entries; i++) {
+AVIndexEntry *sample = >index_entries[i];
+int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
+uint8_t *title;
+uint16_t ch;
+int len, title_len;
+
+if (end < sample->timestamp) {
+av_log(s, AV_LOG_WARNING, "ignoring stream duration which 
is shorter than chapters\n");
+end = AV_NOPTS_VALUE;
+}
 
-st->attached_pic  = pkt;
-st->attached_pic.stream_index = st->index;
-st->attached_pic.flags   |= AV_PKT_FLAG_KEY;
-}
-} else {
-st->codecpar->codec_type = AVMEDIA_TYPE_DATA;
-st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA;
-st->discard = AVDISCARD_ALL;
-for (i = 0; i < st->nb_index_entries; i++) {
-AVIndexEntry *sample = >index_entries[i];
-int64_t end = i+1 < st->nb_index_entries ? 
st->index_entries[i+1].timestamp : st->duration;
-uint8_t *title;
-uint16_t ch;
-int len, title_len;
-
-if (end < sample->timestamp) {
-av_log(s, AV_LOG_WARNING, "ignoring stream duration which is 
shorter than chapters\n");
-end = AV_NOPTS_VALUE;
-}
+if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) 

[FFmpeg-cvslog] lavf/segment: add deinit function

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
19:18:19 2016 -0500| [c7cd6ad8509c7382664f5bfb7112df69b44f41e4] | committer: 
Rodger Combs

lavf/segment: add deinit function

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

 libavformat/segment.c | 47 ---
 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 55dcaf0..a0beda2 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -627,8 +627,9 @@ static int select_reference_stream(AVFormatContext *s)
 return 0;
 }
 
-static void seg_free_context(SegmentContext *seg)
+static void seg_free(AVFormatContext *s)
 {
+SegmentContext *seg = s->priv_data;
 ff_format_io_close(seg->avf, >list_pb);
 avformat_free_context(seg->avf);
 seg->avf = NULL;
@@ -693,7 +694,7 @@ static int seg_init(AVFormatContext *s)
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Could not parse format options list 
'%s'\n",
seg->format_options_str);
-goto fail;
+return ret;
 }
 }
 
@@ -707,7 +708,7 @@ static int seg_init(AVFormatContext *s)
 }
 if (!seg->list_size && seg->list_type != LIST_TYPE_M3U8) {
 if ((ret = segment_list_open(s)) < 0)
-goto fail;
+return ret;
 } else {
 const char *proto = avio_find_protocol_name(seg->list);
 seg->use_rename = proto && !strcmp(proto, "file");
@@ -718,29 +719,26 @@ static int seg_init(AVFormatContext *s)
 av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in 
favor of 'csv'\n");
 
 if ((ret = select_reference_stream(s)) < 0)
-goto fail;
+return ret;
 av_log(s, AV_LOG_VERBOSE, "Selected stream id:%d type:%s\n",
seg->reference_stream_index,

av_get_media_type_string(s->streams[seg->reference_stream_index]->codecpar->codec_type));
 
 seg->oformat = av_guess_format(seg->format, s->filename, NULL);
 
-if (!seg->oformat) {
-ret = AVERROR_MUXER_NOT_FOUND;
-goto fail;
-}
+if (!seg->oformat)
+return AVERROR_MUXER_NOT_FOUND;
 if (seg->oformat->flags & AVFMT_NOFILE) {
 av_log(s, AV_LOG_ERROR, "format %s not supported.\n",
seg->oformat->name);
-ret = AVERROR(EINVAL);
-goto fail;
+return AVERROR(EINVAL);
 }
 
 if ((ret = segment_mux_init(s)) < 0)
-goto fail;
+return ret;
 
 if ((ret = set_segment_filename(s)) < 0)
-goto fail;
+return ret;
 oc = seg->avf;
 
 if (seg->write_header_trailer) {
@@ -748,13 +746,13 @@ static int seg_init(AVFormatContext *s)
   seg->header_filename ? seg->header_filename : 
oc->filename,
   AVIO_FLAG_WRITE, NULL)) < 0) {
 av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", 
oc->filename);
-goto fail;
+return ret;
 }
 if (!seg->individual_header_trailer)
 oc->pb->seekable = 0;
 } else {
 if ((ret = open_null_ctx(>pb)) < 0)
-goto fail;
+return ret;
 }
 
 av_dict_copy(, seg->format_options, 0);
@@ -762,13 +760,14 @@ static int seg_init(AVFormatContext *s)
 if (av_dict_count(options)) {
 av_log(s, AV_LOG_ERROR,
"Some of the provided format options in '%s' are not 
recognized\n", seg->format_options_str);
-ret = AVERROR(EINVAL);
-goto fail;
+av_dict_free();
+return AVERROR(EINVAL);
 }
+av_dict_free();
 
 if (ret < 0) {
 ff_format_io_close(oc, >pb);
-goto fail;
+return ret;
 }
 seg->segment_frame_count = 0;
 
@@ -790,17 +789,12 @@ static int seg_init(AVFormatContext *s)
 close_null_ctxp(>pb);
 }
 if ((ret = oc->io_open(oc, >pb, oc->filename, AVIO_FLAG_WRITE, 
NULL)) < 0)
-goto fail;
+return ret;
 if (!seg->individual_header_trailer)
 oc->pb->seekable = 0;
 }
 
-fail:
-av_dict_free();
-if (ret < 0)
-seg_free_context(seg);
-
-return ret;
+return 0;
 }
 
 static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
@@ -913,9 +907,6 @@ fail:
 seg->segment_frame_count++;
 }
 
-if (ret < 0)
-seg_free_context(seg);
-
 return ret;
 }
 
@@ -1023,6 +1014,7 @@ AVOutputFormat ff_segment_muxer = {
 .init   = seg_init,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_tr

[FFmpeg-cvslog] lavf/dashenc: add deinit function

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
19:36:15 2016 -0500| [c972a28fc3defe7cacee281fe1a30b9a026737ed] | committer: 
Rodger Combs

lavf/dashenc: add deinit function

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

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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 519f9c4..0848052 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -580,16 +580,12 @@ static int dash_write_header(AVFormatContext *s)
 *ptr = '\0';
 
 oformat = av_guess_format("mp4", NULL, NULL);
-if (!oformat) {
-ret = AVERROR_MUXER_NOT_FOUND;
-goto fail;
-}
+if (!oformat)
+return AVERROR_MUXER_NOT_FOUND;
 
 c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
-if (!c->streams) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!c->streams)
+return AVERROR(ENOMEM);
 
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
@@ -606,17 +602,13 @@ static int dash_write_header(AVFormatContext *s)
 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) {
-ret = AVERROR(EINVAL);
-goto fail;
-}
+if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
+return AVERROR(EINVAL);
 }
 
 ctx = avformat_alloc_context();
-if (!ctx) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!ctx)
+return AVERROR(ENOMEM);
 os->ctx = ctx;
 ctx->oformat = oformat;
 ctx->interrupt_callback = s->interrupt_callback;
@@ -624,10 +616,8 @@ static int dash_write_header(AVFormatContext *s)
 ctx->io_close   = s->io_close;
 ctx->io_open= s->io_open;
 
-if (!(st = avformat_new_stream(ctx, NULL))) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!(st = avformat_new_stream(ctx, NULL)))
+return AVERROR(ENOMEM);
 avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar);
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
 st->time_base = s->streams[i]->time_base;
@@ -635,10 +625,8 @@ static int dash_write_header(AVFormatContext *s)
 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) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!ctx->pb)
+return AVERROR(ENOMEM);
 
 if (c->single_file) {
 if (c->single_file_name)
@@ -651,13 +639,12 @@ static int dash_write_header(AVFormatContext *s)
 snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
 ret = s->io_open(s, >out, filename, AVIO_FLAG_WRITE, NULL);
 if (ret < 0)
-goto fail;
+return ret;
 os->init_start_pos = 0;
 
 av_dict_set(, "movflags", "frag_custom+dash+delay_moov", 0);
-if ((ret = avformat_write_header(ctx, )) < 0) {
- goto fail;
-}
+if ((ret = avformat_write_header(ctx, )) < 0)
+return ret;
 os->ctx_inited = 1;
 avio_flush(ctx->pb);
 av_dict_free();
@@ -693,15 +680,11 @@ static int dash_write_header(AVFormatContext *s)
 
 if (!c->has_video && c->min_seg_duration <= 0) {
 av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration 
set\n");
-ret = AVERROR(EINVAL);
+return AVERROR(EINVAL);
 }
 ret = write_manifest(s, 0);
 if (!ret)
 av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename);
-
-fail:
-if (ret)
-dash_free(s);
 return ret;
 }
 
@@ -992,7 +975,6 @@ static int dash_write_trailer(AVFormatContext *s)
 unlink(s->filename);
 }
 
-dash_free(s);
 return 0;
 }
 
@@ -1029,6 +1011,7 @@ AVOutputFormat ff_dash_muxer = {
 .write_header   = dash_write_header,
 .write_packet   = dash_write_packet,
 .write_trailer  = dash_write_trailer,
+.deinit = dash_free,
 .codec_tag  = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
 .priv_class = _class,
 };

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


[FFmpeg-cvslog] lavf/mux: add avformat_init_output

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Jun 24 
22:02:50 2016 -0500| [a246fef163387c0d79830a9bdf408443a9aba1c1] | committer: 
Rodger Combs

lavf/mux: add avformat_init_output

This allows a consumer to run the muxer's init function without actually
writing the header, which is useful in chained muxers that support
automatic bitstream filtering.

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

 doc/APIchanges |  3 +++
 libavformat/avformat.h | 34 +++--
 libavformat/internal.h | 10 
 libavformat/mux.c  | 68 +++---
 libavformat/version.h  |  2 +-
 5 files changed, 100 insertions(+), 17 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 502ab3f..5017eb4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2015-08-28
 
 API changes, most recent first:
 
+2016-10-24 - xxx - lavf 57.54.100 - avformat.h
+  Add avformat_init_output() and AVSTREAM_INIT_IN_ macros
+
 2016-10-22 - xxx - lavu 55.33.100 - avassert.h
   Add av_assert0_fpu() / av_assert2_fpu()
 
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 057f8c5..82ca727 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -618,6 +618,8 @@ typedef struct AVOutputFormat {
  * AVStream parameters that need to be set before packets are sent.
  * This method must not write output.
  *
+ * Return 0 if streams were fully configured, 1 if not, negative AVERROR 
on failure
+ *
  * Any allocations made here must be freed in deinit().
  */
 int (*init)(struct AVFormatContext *);
@@ -2374,6 +2376,10 @@ void avformat_close_input(AVFormatContext **s);
  * @addtogroup lavf_encoding
  * @{
  */
+
+#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in 
avformat_write_header
+#define AVSTREAM_INIT_IN_INIT_OUTPUT  1 ///< stream parameters initialized in 
avformat_init_output
+
 /**
  * Allocate the stream private data and write the stream header to
  * an output media file.
@@ -2385,14 +2391,38 @@ void avformat_close_input(AVFormatContext **s);
  * On return this parameter will be destroyed and replaced 
with a dict containing
  * options that were not found. May be NULL.
  *
- * @return 0 on success, negative AVERROR on failure.
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not 
already been fully initialized in avformat_init,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT  on success if the codec had already 
been fully initialized in avformat_init,
+ * negative AVERROR on failure.
  *
- * @see av_opt_find, av_dict_set, avio_open, av_oformat_next.
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, 
avformat_init_output.
  */
 av_warn_unused_result
 int avformat_write_header(AVFormatContext *s, AVDictionary **options);
 
 /**
+ * Allocate the stream private data and initialize the codec, but do not write 
the header.
+ * May optionally be used before avformat_write_header to initialize stream 
parameters
+ * before actually writing the header.
+ * If using this function, do not pass the same options to 
avformat_write_header.
+ *
+ * @param s Media file handle, must be allocated with avformat_alloc_context().
+ *  Its oformat field must be set to the desired output format;
+ *  Its pb field must be set to an already opened AVIOContext.
+ * @param options  An AVDictionary filled with AVFormatContext and 
muxer-private options.
+ * On return this parameter will be destroyed and replaced 
with a dict containing
+ * options that were not found. May be NULL.
+ *
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires 
avformat_write_header to fully initialize,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT  on success if the codec has been 
fully initialized,
+ * negative AVERROR on failure.
+ *
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, 
avformat_write_header.
+ */
+av_warn_unused_result
+int avformat_init_output(AVFormatContext *s, AVDictionary **options);
+
+/**
  * Write a packet to an output media file.
  *
  * This function passes the packet directly to the muxer, without any buffering
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 95776a0..da64c64 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -130,6 +130,16 @@ struct AVFormatInternal {
  * Timestamp of the end of the shortest stream.
  */
 int64_t shortest_end;
+
+/**
+ * Whether or not avformat_init_output has already been called
+ */
+int initialized;
+
+/**
+ * Whether or not avformat_init_output fully initialized streams
+ */
+int streams_initialized;
 };
 
 struct AVStreamInternal {
diff --git a/libavformat/mux.c b/libavformat/mux.c
index bbfc0fc.

[FFmpeg-cvslog] lavf/rawenc: add automatic bitstream filtering for H264+HEVC

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Sep  9 
23:27:54 2016 -0500| [d99d7cbdfc70023cd9692c19376772215d3a15b5] | committer: 
Rodger Combs

lavf/rawenc: add automatic bitstream filtering for H264+HEVC

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

 libavformat/rawenc.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c
index c4d7a90..730e99a 100644
--- a/libavformat/rawenc.c
+++ b/libavformat/rawenc.c
@@ -20,8 +20,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/intreadwrite.h"
+
 #include "avformat.h"
 #include "rawenc.h"
+#include "internal.h"
 
 int ff_raw_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
@@ -236,6 +239,15 @@ AVOutputFormat ff_h263_muxer = {
 #endif
 
 #if CONFIG_H264_MUXER
+static int h264_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+AVStream *st = s->streams[0];
+if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
+  AV_RB24(pkt->data) != 0x01)
+return ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
+return 1;
+}
+
 AVOutputFormat ff_h264_muxer = {
 .name  = "h264",
 .long_name = NULL_IF_CONFIG_SMALL("raw H.264 video"),
@@ -244,11 +256,21 @@ AVOutputFormat ff_h264_muxer = {
 .video_codec   = AV_CODEC_ID_H264,
 .write_header  = force_one_stream,
 .write_packet  = ff_raw_write_packet,
+.check_bitstream   = h264_check_bitstream,
 .flags = AVFMT_NOTIMESTAMPS,
 };
 #endif
 
 #if CONFIG_HEVC_MUXER
+static int hevc_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+AVStream *st = s->streams[0];
+if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
+  AV_RB24(pkt->data) != 0x01)
+return ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
+return 1;
+}
+
 AVOutputFormat ff_hevc_muxer = {
 .name  = "hevc",
 .long_name = NULL_IF_CONFIG_SMALL("raw HEVC video"),
@@ -257,6 +279,7 @@ AVOutputFormat ff_hevc_muxer = {
 .video_codec   = AV_CODEC_ID_HEVC,
 .write_header  = force_one_stream,
 .write_packet  = ff_raw_write_packet,
+.check_bitstream   = hevc_check_bitstream,
 .flags = AVFMT_NOTIMESTAMPS,
 };
 #endif

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


[FFmpeg-cvslog] lavf/segment: fix writing separate header with auto BSF

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
19:18:45 2016 -0500| [45f5c5573203a48acb2dd6fbf18f4b0c25b7aff0] | committer: 
Rodger Combs

lavf/segment: fix writing separate header with auto BSF

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

 libavformat/segment.c | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index a0beda2..868f0a8 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -89,6 +89,7 @@ typedef struct SegmentContext {
 int64_t last_val;  ///< remember last time for wrap around detection
 int64_t last_cut;  ///< remember last cut
 int cut_pending;
+int header_written;///< whether we've already called 
avformat_write_header
 
 char *entry_prefix;///< prefix to add to list entry filenames
 int list_type; ///< set the list type
@@ -260,6 +261,7 @@ static int segment_start(AVFormatContext *s, int 
write_header)
 if (write_header) {
 AVDictionary *options = NULL;
 av_dict_copy(, seg->format_options, 0);
+av_dict_set(, "fflags", "-autobsf", 0);
 err = avformat_write_header(oc, );
 av_dict_free();
 if (err < 0)
@@ -756,7 +758,8 @@ static int seg_init(AVFormatContext *s)
 }
 
 av_dict_copy(, seg->format_options, 0);
-ret = avformat_write_header(oc, );
+av_dict_set(, "fflags", "-autobsf", 0);
+ret = avformat_init_output(oc, );
 if (av_dict_count(options)) {
 av_log(s, AV_LOG_ERROR,
"Some of the provided format options in '%s' are not 
recognized\n", seg->format_options_str);
@@ -772,6 +775,13 @@ static int seg_init(AVFormatContext *s)
 seg->segment_frame_count = 0;
 
 av_assert0(s->nb_streams == oc->nb_streams);
+if (ret == AVSTREAM_INIT_IN_WRITE_HEADER) {
+ret = avformat_write_header(oc, NULL);
+if (ret < 0)
+return ret;
+seg->header_written = 1;
+}
+
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *inner_st  = oc->streams[i];
 AVStream *outer_st = s->streams[i];
@@ -781,6 +791,21 @@ static int seg_init(AVFormatContext *s)
 if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
 s->avoid_negative_ts = 1;
 
+return ret;
+}
+
+static int seg_write_header(AVFormatContext *s)
+{
+SegmentContext *seg = s->priv_data;
+AVFormatContext *oc = seg->avf;
+int ret;
+
+if (!seg->header_written) {
+ret = avformat_write_header(oc, NULL);
+if (ret < 0)
+return ret;
+}
+
 if (!seg->write_header_trailer || seg->header_filename) {
 if (seg->header_filename) {
 av_write_frame(oc, NULL);
@@ -1012,6 +1037,7 @@ AVOutputFormat ff_segment_muxer = {
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE|AVFMT_GLOBALHEADER,
 .init   = seg_init,
+.write_header   = seg_write_header,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,
@@ -1031,6 +1057,7 @@ AVOutputFormat ff_stream_segment_muxer = {
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE,
 .init   = seg_init,
+.write_header   = seg_write_header,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,

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


[FFmpeg-cvslog] fate/aac: add automatic bsf test

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Apr 15 
03:18:01 2016 -0500| [ed4e081a362d24b878201c2a3a289f9a5ec40a15] | committer: 
Rodger Combs

fate/aac: add automatic bsf test

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

 tests/fate/aac.mak | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 3d64031..9ce8efb 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -241,6 +241,10 @@ FATE_AAC_LATM += fate-aac-latm_stereo_to_51
 fate-aac-latm_stereo_to_51: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
 fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
 
+fate-aac-autobsf-adtstoasc: CMD = md5 -i 
$(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec 
copy -fflags +bitexact -f matroska
+fate-aac-autobsf-adtstoasc: CMP = oneline
+fate-aac-autobsf-adtstoasc: REF = 8c6fbebb64ebbe9e01b345d77844d7cd
+
 FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
 FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
 FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
@@ -253,7 +257,9 @@ $(FATE_AAC_ALL): FUZZ = 2
 
 FATE_AAC_ENCODE-$(call ENCMUX, AAC, ADTS) += $(FATE_AAC_ENCODE)
 
-FATE_SAMPLES_FFMPEG += $(FATE_AAC_ALL) $(FATE_AAC_ENCODE-yes)
+FATE_AAC_BSF-$(call ALLYES, AAC_DEMUXER AAC_ADTSTOASC_BSF MATROSKA_MUXER) += 
fate-aac-autobsf-adtstoasc
+
+FATE_SAMPLES_FFMPEG += $(FATE_AAC_ALL) $(FATE_AAC_ENCODE-yes) 
$(FATE_AAC_BSF-yes)
 
-fate-aac: $(FATE_AAC_ALL) $(FATE_AAC_ENCODE)
+fate-aac: $(FATE_AAC_ALL) $(FATE_AAC_ENCODE) $(FATE_AAC_BSF-yes)
 fate-aac-latm: $(FATE_AAC_LATM-yes)

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


[FFmpeg-cvslog] fate/h264: make mp4toannexb test use auto-BSF

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Apr 15 
03:01:46 2016 -0500| [a6da754ef9a74fe09368491053e0b66611890f7f] | committer: 
Rodger Combs

fate/h264: make mp4toannexb test use auto-BSF

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

 tests/fate/h264.mak | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index 472895f..b4d7f7a 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -205,7 +205,7 @@ FATE_H264-$(call DEMDEC,  MOV, H264) += 
fate-h264-invalid-ref-mod
 # this sample has invalid extradata that is not escaped
 FATE_H264-$(call DEMDEC,  MOV, H264) += fate-h264-unescaped-extradata
 
-FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += 
fate-h264-bsf-mp4toannexb
+FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF H264_MUXER) += 
fate-h264-bsf-mp4toannexb
 FATE_H264-$(call DEMDEC, MATROSKA, H264) += fate-h264-direct-bff
 FATE_H264-$(call DEMDEC, FLV, H264) += fate-h264-brokensps-2580
 FATE_H264-$(call DEMDEC, MXF, H264) += fate-h264-xavc-4389
@@ -405,7 +405,8 @@ fate-h264-conformance-sva_fm1_e:  CMD = 
framecrc -vsync drop -i
 fate-h264-conformance-sva_nl1_b:  CMD = framecrc -vsync drop 
-i $(TARGET_SAMPLES)/h264-conformance/SVA_NL1_B.264
 fate-h264-conformance-sva_nl2_e:  CMD = framecrc -vsync drop 
-i $(TARGET_SAMPLES)/h264-conformance/SVA_NL2_E.264
 
-fate-h264-bsf-mp4toannexb:CMD = md5 -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb 
-f h264
+fate-h264-bsf-mp4toannexb:CMD = md5 -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -f h264
+
 fate-h264-crop-to-container:  CMD = framemd5 -i 
$(TARGET_SAMPLES)/h264/crop-to-container-dims-canon.mov
 fate-h264-extreme-plane-pred: CMD = framemd5 -i 
$(TARGET_SAMPLES)/h264/extreme-plane-pred.h264
 fate-h264-interlace-crop: CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vframes 3

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


[FFmpeg-cvslog] lavf/movenc: add deinit function

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
19:24:04 2016 -0500| [e83d5d7e58fff5f059dfdbe80e07ae7e49cdc2e9] | committer: 
Rodger Combs

lavf/movenc: add deinit function

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

 libavformat/movenc.c | 76 ++--
 1 file changed, 32 insertions(+), 44 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 50be8ff..4b6aa76 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5612,21 +5612,18 @@ static int mov_write_header(AVFormatContext *s)
 if (mov->encryption_key_len != AES_CTR_KEY_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d 
expected %d\n",
 mov->encryption_key_len, AES_CTR_KEY_SIZE);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 
 if (mov->encryption_kid_len != CENC_KID_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d 
expected %d\n",
 mov->encryption_kid_len, CENC_KID_SIZE);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 } else {
 av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n",
 mov->encryption_scheme_str);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 }
 
@@ -5646,8 +5643,7 @@ static int mov_write_header(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream 
#%d, "
"codec not currently supported in container\n",
avcodec_get_name(st->codecpar->codec_id), i);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 /* If hinting of this track is enabled by a later hint track,
  * this is updated. */
@@ -5661,8 +5657,7 @@ static int mov_write_header(AVFormatContext *s)
 track->tag == MKTAG('m','x','5','p') || track->tag == 
MKTAG('m','x','5','n')) {
 if (st->codecpar->width != 720 || (st->codecpar->height != 608 
&& st->codecpar->height != 512)) {
 av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 
720x512 video resolution\n");
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 track->height = track->tag >> 24 == 'n' ? 486 : 576;
 }
@@ -5675,8 +5670,7 @@ static int mov_write_header(AVFormatContext *s)
 }
 if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
 av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for 
mov/mp4\n", st->codecpar->width, st->codecpar->height);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 if (track->mode == MODE_MOV && track->timescale > 10)
 av_log(s, AV_LOG_WARNING,
@@ -5704,8 +5698,7 @@ static int mov_write_header(AVFormatContext *s)
"VP9 in MP4 support is experimental, add "
"'-strict %d' if you want to use it.\n",
FF_COMPLIANCE_EXPERIMENTAL);
-ret = AVERROR_EXPERIMENTAL;
-goto error;
+return AVERROR_EXPERIMENTAL;
 }
 }
 } else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
@@ -5718,8 +5711,7 @@ static int mov_write_header(AVFormatContext *s)
  st->codecpar->codec_id == AV_CODEC_ID_ILBC){
 if (!st->codecpar->block_align) {
 av_log(s, AV_LOG_ERROR, "track %d: codec block align is 
not set for adpcm\n", i);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 track->sample_size = st->codecpar->block_align;
 }else if (st->codecpar->frame_size > 1){ /* assume compressed 
audio */
@@ -5736,8 +5728,7 @@ static int mov_write_header(AVFormatContext *s)
 if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
 av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is 
not standard, to mux anyway set strict to -1\n",
 i, track->par->sample_rate);
-ret = AVERROR(EINVAL);
-  

[FFmpeg-cvslog] fate/hevc: add automatic bsf test

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr 28 
17:00:43 2016 -0500| [3b3f979894a0aca01245fcaa2e4ff06f5f839e54] | committer: 
Rodger Combs

fate/hevc: add automatic bsf test

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

 tests/fate/hevc.mak | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 05266cd..bd09ab3 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -225,6 +225,17 @@ $(foreach N,$(HEVC_SAMPLES_444_12BIT),$(eval $(call 
FATE_HEVC_TEST_444_12BIT,$(N
 fate-hevc-paramchange-yuv420p-yuv420p10: CMD = framecrc -vsync 0 -i 
$(TARGET_SAMPLES)/hevc/paramchange_yuv420p_yuv420p10.hevc -sws_flags 
area+accurate_rnd+bitexact
 FATE_HEVC += fate-hevc-paramchange-yuv420p-yuv420p10
 
+tests/data/hevc-mp4.mov: TAG = GEN
+tests/data/hevc-mp4.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+   $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+   -i $(TARGET_SAMPLES)/hevc-conformance/WPP_A_ericsson_MAIN10_2.bit -c 
copy -flags +bitexact $(TARGET_PATH)/$@ -y 2>/dev/null
+
+FATE_HEVC-$(call ALLYES, HEVC_DEMUXER MOV_DEMUXER HEVC_MP4TOANNEXB_BSF 
MOV_MUXER HEVC_MUXER) += fate-hevc-bsf-mp4toannexb
+fate-hevc-bsf-mp4toannexb: tests/data/hevc-mp4.mov
+fate-hevc-bsf-mp4toannexb: CMD = md5 -i $(TARGET_PATH)/tests/data/hevc-mp4.mov 
-vcodec copy -fflags +bitexact -f hevc
+fate-hevc-bsf-mp4toannexb: CMP = oneline
+fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9
+
 FATE_HEVC-$(call DEMDEC, HEVC, HEVC) += $(FATE_HEVC)
 
 FATE_SAMPLES_AVCONV += $(FATE_HEVC-yes)

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


[FFmpeg-cvslog] lavf/movenc+dashenc: add automatic bitstream filtering

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
19:36:39 2016 -0500| [42cb050a05020e9da18136b8cd65944b378b74eb] | committer: 
Rodger Combs

lavf/movenc+dashenc: add automatic bitstream filtering

This is disabled by default when the empty_moov flag is enabled

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

 libavformat/dashenc.c |  43 +++-
 libavformat/movenc.c  | 107 +++---
 2 files changed, 124 insertions(+), 26 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 0848052..534fa75 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -551,7 +551,7 @@ static int write_manifest(AVFormatContext *s, int final)
 return avpriv_io_move(temp_filename, s->filename);
 }
 
-static int dash_write_header(AVFormatContext *s)
+static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int ret = 0, i;
@@ -643,7 +643,7 @@ static int dash_write_header(AVFormatContext *s)
 os->init_start_pos = 0;
 
 av_dict_set(, "movflags", "frag_custom+dash+delay_moov", 0);
-if ((ret = avformat_write_header(ctx, )) < 0)
+if ((ret = avformat_init_output(ctx, )) < 0)
 return ret;
 os->ctx_inited = 1;
 avio_flush(ctx->pb);
@@ -682,6 +682,20 @@ static int dash_write_header(AVFormatContext *s)
 av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration 
set\n");
 return AVERROR(EINVAL);
 }
+return 0;
+}
+
+static int dash_write_header(AVFormatContext *s)
+{
+DASHContext *c = s->priv_data;
+int i, ret;
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = >streams[i];
+if ((ret = avformat_write_header(os->ctx, NULL)) < 0) {
+dash_free(s);
+return ret;
+}
+}
 ret = write_manifest(s, 0);
 if (!ret)
 av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename);
@@ -978,6 +992,29 @@ static int dash_write_trailer(AVFormatContext *s)
 return 0;
 }
 
+static int dash_check_bitstream(struct AVFormatContext *s, const AVPacket 
*avpkt)
+{
+DASHContext *c = s->priv_data;
+OutputStream *os = >streams[avpkt->stream_index];
+AVFormatContext *oc = os->ctx;
+if (oc->oformat->check_bitstream) {
+int ret;
+AVPacket pkt = *avpkt;
+pkt.stream_index = 0;
+ret = oc->oformat->check_bitstream(oc, );
+if (ret == 1) {
+AVStream *st = s->streams[avpkt->stream_index];
+AVStream *ost = oc->streams[0];
+st->internal->bsfcs = ost->internal->bsfcs;
+st->internal->nb_bsfcs = ost->internal->nb_bsfcs;
+ost->internal->bsfcs = NULL;
+ost->internal->nb_bsfcs = 0;
+}
+return ret;
+}
+return 1;
+}
+
 #define OFFSET(x) offsetof(DASHContext, x)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
@@ -1008,10 +1045,12 @@ AVOutputFormat ff_dash_muxer = {
 .audio_codec= AV_CODEC_ID_AAC,
 .video_codec= AV_CODEC_ID_H264,
 .flags  = AVFMT_GLOBALHEADER | AVFMT_NOFILE | AVFMT_TS_NEGATIVE,
+.init   = dash_init,
 .write_header   = dash_write_header,
 .write_packet   = dash_write_packet,
 .write_trailer  = dash_write_trailer,
 .deinit = dash_free,
 .codec_tag  = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+.check_bitstream = dash_check_bitstream,
 .priv_class = _class,
 };
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 4b6aa76..6228192 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5459,11 +5459,10 @@ static int 
mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
 return 0;
 }
 
-static int mov_write_header(AVFormatContext *s)
+static int mov_init(AVFormatContext *s)
 {
-AVIOContext *pb = s->pb;
 MOVMuxContext *mov = s->priv_data;
-AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, "timecode", 
NULL, 0);
+AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 
0);
 int i, ret, hint_track = 0, tmcd_track = 0;
 
 mov->fc = s;
@@ -5500,6 +5499,11 @@ static int mov_write_header(AVFormatContext *s)
 mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV |
   FF_MOV_FLAG_DEFAULT_BASE_MOOF;
 
+if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) 
{
+av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic 
bitstream filtering\n");
+s->flags &= ~AVFMT_FLAG_AUTO_BSF;
+}
+
 if (mov->flags & FF_MOV_F

[FFmpeg-cvslog] lavc/utils: avcodec_string: dump field order when known

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Oct  3 
21:46:53 2016 -0500| [ba53504e57b6dc92726086d0b8f50fc26069f327] | committer: 
Rodger Combs

lavc/utils: avcodec_string: dump field order when known

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

 libavcodec/utils.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 7c26485..87de15f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -3254,6 +3254,20 @@ void avcodec_string(char *buf, int buf_size, 
AVCodecContext *enc, int encode)
 av_get_colorspace_name(enc->colorspace));
 }
 
+if (enc->field_order != AV_FIELD_UNKNOWN) {
+const char *field_order = "progressive";
+if (enc->field_order == AV_FIELD_TT)
+field_order = "top first";
+else if (enc->field_order == AV_FIELD_BB)
+field_order = "bottom first";
+else if (enc->field_order == AV_FIELD_TB)
+field_order = "top coded first (swapped)";
+else if (enc->field_order == AV_FIELD_BT)
+field_order = "bottom coded first (swapped)";
+
+av_strlcatf(detail, sizeof(detail), "%s, ", field_order);
+}
+
 if (av_log_get_level() >= AV_LOG_VERBOSE &&
 enc->chroma_sample_location != AVCHROMA_LOC_UNSPECIFIED)
 av_strlcatf(detail, sizeof(detail), "%s, ",

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


[FFmpeg-cvslog] ffprobe: report field order for video streams

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Oct  3 
23:49:09 2016 -0500| [54350f06e11727f255e3d1829cb1afde49931d8b] | committer: 
Rodger Combs

ffprobe: report field order for video streams

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

 doc/ffprobe.xsd |  1 +
 ffprobe.c   | 13 +
 tests/ref/fate/concat-demuxer-extended-lavf-mxf |  2 +-
 tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf  |  2 +-
 tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10  |  2 +-
 tests/ref/fate/concat-demuxer-simple2-lavf-ts   |  2 +-
 tests/ref/fate/ffprobe_compact  |  4 ++--
 tests/ref/fate/ffprobe_csv  |  4 ++--
 tests/ref/fate/ffprobe_default  |  2 ++
 tests/ref/fate/ffprobe_flat |  2 ++
 tests/ref/fate/ffprobe_ini  |  2 ++
 12 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/doc/ffprobe.xsd b/doc/ffprobe.xsd
index 757de12..ac0347f 100644
--- a/doc/ffprobe.xsd
+++ b/doc/ffprobe.xsd
@@ -201,6 +201,7 @@
   
   
   
+  
   
   
 
diff --git a/ffprobe.c b/ffprobe.c
index 662137c..7cd0034 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -2268,6 +2268,19 @@ static int show_stream(WriterContext *w, AVFormatContext 
*fmt_ctx, int stream_id
 else
 print_str_opt("chroma_location", 
av_chroma_location_name(par->chroma_location));
 
+if (par->field_order == AV_FIELD_PROGRESSIVE)
+print_str("field_order", "progressive");
+else if (par->field_order == AV_FIELD_TT)
+print_str("field_order", "tt");
+else if (par->field_order == AV_FIELD_BB)
+print_str("field_order", "bb");
+else if (par->field_order == AV_FIELD_TB)
+print_str("field_order", "tb");
+else if (par->field_order == AV_FIELD_BT)
+print_str("field_order", "bt");
+else
+print_str_opt("field_order", "unknown");
+
 #if FF_API_PRIVATE_OPT
 if (dec_ctx && dec_ctx->timecode_frame_start >= 0) {
 char tcbuf[AV_TIMECODE_STR_SIZE];
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
index f7905aa..8bb2fb0 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf
@@ -1 +1 @@
-21eb3a629ff504b55c93a66879a31362 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
+a277e04c23cf764abe692ca07e87b82e 
*tests/data/fate/concat-demuxer-extended-lavf-mxf.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
index 0c49f1f..e294538 100644
--- a/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-extended-lavf-mxf_d10
@@ -1 +1 @@
-67a03ad49f1bd17131f751313639b61e 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
+026045a43aa2dde1723d7331c2252b01 
*tests/data/fate/concat-demuxer-extended-lavf-mxf_d10.ffprobe
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
index 6bba76a..c899754 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf
@@ -120,5 +120,5 @@ 
audio|1|65280|1.36|65280|1.36|1920|0.04|N/A|N/A|3840|206848|K_|1
 Strings Metadata|8
 video|0|37|1.48|34|1.36|1|0.04|N/A|N/A|24786|211456|K_|1
 Strings Metadata|8
-0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
+0|mpeg2video|4|video|1/25|[0][0][0][0]|0x|352|288|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|N/A|1|N/A|25/1|25/1|1/25|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|51|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
 
1|pcm_s16le|unknown|audio|1/48000|[0][0][0][0]|0x|s16|48000|1|unknown|16|N/A|0/0|0/0|1/48000|0|0.00|N/A|N/A|768000|N/A|N/A|N/A|N/A|50|0|0|0|0|0|0|0|0|0|0|0|0x060A2B340101010501010D001301
diff --git a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 
b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
index 75cac84..2ba3a2e 100644
--- a/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
+++ b/tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10
@@ -78,5 +78,5 @@ 
video|0|34|1.36|34|1.36|1|0.04|N/A|N/A|15|1923072|K_|1
 Str

[FFmpeg-cvslog] lavc/parser: export field order if not already set

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Sep 20 
05:57:39 2016 -0500| [d13740f3a207668f53ce167cf96f353379ac2c14] | committer: 
Rodger Combs

lavc/parser: export field order if not already set

Some codecs set this in the parser, but not the decoder

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

 libavcodec/parser.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 2c8fc69..30cfc55 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -182,6 +182,11 @@ int av_parser_parse2(AVCodecParserContext *s, 
AVCodecContext *avctx,
 index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
 poutbuf_size, buf, buf_size);
 av_assert0(index > -0x2000); // The API does not allow returning 
AVERROR codes
+#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
+if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+FILL(field_order);
+}
+
 /* update the file pointer */
 if (*poutbuf_size) {
 /* fill the data for the current frame */

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


[FFmpeg-cvslog] MAINTAINERS: add myself for audiotoolbox

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Oct 24 
01:47:52 2016 -0500| [8a24e03684cad4b8207a0317123ca2bd544d012e] | committer: 
Rodger Combs

MAINTAINERS: add myself for audiotoolbox

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

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

diff --git a/MAINTAINERS b/MAINTAINERS
index 3570253..d0457a6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -141,6 +141,7 @@ Codecs:
   ass*  Aurelien Jacobs
   asv*  Michael Niedermayer
   atrac3plus*   Maxim Poliakovski
+  audiotoolbox*     Rodger Combs
   bgmc.c, bgmc.hThilo Borgmann
   binkaudio.c   Peter Ross
   cavs* Stefan Gehrer

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


[FFmpeg-cvslog] lavc/h264_parser: export field order in more cases

2016-10-24 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Oct  3 
21:45:56 2016 -0500| [f271a9bd991be4ce8d230b7dc6a0e56ca64b195c] | committer: 
Rodger Combs

lavc/h264_parser: export field order in more cases

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

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

diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 3ed7d77..bca0071 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -61,6 +61,7 @@ typedef struct H264ParseContext {
 int parse_history_count;
 int parse_last_mb;
 int64_t reference_dts;
+int last_frame_num, last_picture_structure;
 } H264ParseContext;
 
 
@@ -528,7 +529,19 @@ static inline int parse_nal_units(AVCodecParserContext *s,
 s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD;
 else
 s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;
-s->field_order = AV_FIELD_UNKNOWN;
+if (p->poc.frame_num == p->last_frame_num &&
+p->last_picture_structure != AV_PICTURE_STRUCTURE_UNKNOWN 
&&
+p->last_picture_structure != AV_PICTURE_STRUCTURE_FRAME &&
+p->last_picture_structure != s->picture_structure) {
+if (p->last_picture_structure == 
AV_PICTURE_STRUCTURE_TOP_FIELD)
+s->field_order = AV_FIELD_TT;
+else
+s->field_order = AV_FIELD_BB;
+} else {
+s->field_order = AV_FIELD_UNKNOWN;
+}
+p->last_picture_structure = s->picture_structure;
+p->last_frame_num = p->poc.frame_num;
 }
 
 av_freep(_buffer);
@@ -677,6 +690,7 @@ static av_cold int init(AVCodecParserContext *s)
 H264ParseContext *p = s->priv_data;
 
 p->reference_dts = AV_NOPTS_VALUE;
+p->last_frame_num = INT_MAX;
 ff_h264dsp_init(>h264dsp, 8, 1);
 return 0;
 }

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


[FFmpeg-cvslog] lavf/segment: decide whether to rename based on list URI

2016-10-21 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Oct  6 
02:00:25 2016 -0500| [ecb53e11014bf9d45a995390c6241c71d3e49ff9] | committer: 
Rodger Combs

lavf/segment: decide whether to rename based on list URI

This fixes the case of writing segments to local files, but the list
over a network protocol.

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

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

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 33a5cf0..55dcaf0 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -709,7 +709,7 @@ static int seg_init(AVFormatContext *s)
 if ((ret = segment_list_open(s)) < 0)
 goto fail;
 } else {
-const char *proto = avio_find_protocol_name(s->filename);
+const char *proto = avio_find_protocol_name(seg->list);
 seg->use_rename = proto && !strcmp(proto, "file");
 }
 }

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


[FFmpeg-cvslog] ffmpeg: don't reconfigure terminal if we're not taking input from stdin

2016-10-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Sep  7 
19:16:27 2016 -0500| [1f7d5860525ad9b7540502ce01b2f239eada8e87] | committer: 
Rodger Combs

ffmpeg: don't reconfigure terminal if we're not taking input from stdin

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

 ffmpeg.c | 4 +---
 ffmpeg_opt.c | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index ee5a768..44371f0b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -366,7 +366,7 @@ static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
 void term_init(void)
 {
 #if HAVE_TERMIOS_H
-if(!run_as_daemon){
+if (!run_as_daemon && stdin_interaction) {
 struct termios tty;
 if (tcgetattr (0, ) == 0) {
 oldtty = tty;
@@ -4493,8 +4493,6 @@ int main(int argc, char **argv)
 
 show_banner(argc, argv, options);
 
-term_init();
-
 /* parse options and open all input/output files */
 ret = ffmpeg_parse_options(argc, argv);
 if (ret < 0)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index d202f43..bea2829 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -3160,6 +3160,9 @@ int ffmpeg_parse_options(int argc, char **argv)
 goto fail;
 }
 
+/* configure terminal and setup signal handlers */
+term_init();
+
 /* open input files */
 ret = open_files([GROUP_INFILE], "input", open_input_file);
 if (ret < 0) {

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


[FFmpeg-cvslog] tests: add -nostdin flag when calling ffmpeg

2016-10-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Sep  7 
19:16:34 2016 -0500| [021286720248e9753d8cf4626a55e329e21708aa] | committer: 
Rodger Combs

tests: add -nostdin flag when calling ffmpeg

This fixes a long-standing issue where running FATE in parallel could result
in the terminal being left misconfigured, particularly if a test failed or
was canceled wtih ^C.

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

 tests/fate/vpx.mak| 10 +-
 tests/regression-funcs.sh |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/fate/vpx.mak b/tests/fate/vpx.mak
index 3750561..46658ec 100644
--- a/tests/fate/vpx.mak
+++ b/tests/fate/vpx.mak
@@ -56,19 +56,19 @@ FATE_VP8-$(CONFIG_MATROSKA_DEMUXER) += fate-vp8-alpha
 fate-vp8-alpha: CMD = framecrc -i 
$(TARGET_SAMPLES)/vp8_alpha/vp8_video_with_alpha.webm -vcodec copy
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest
-fate-webm-dash-manifest: CMD = run $(FFMPEG) -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f 
webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" -
+fate-webm-dash-manifest: CMD = run $(FFMPEG) -nostdin -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_video2.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio1.webm -f webm_dash_manifest -i 
$(TARGET_SAMPLES)/vp8/dash_audio2.webm -c copy -map 0 -map 1 -map 2 -map 3 -f 
webm_dash_manifest -adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" -
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-unaligned-video-streams
-fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
+fate-webm-dash-manifest-unaligned-video-streams: CMD = run $(FFMPEG) -nostdin 
-f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-unaligned-audio-streams
-fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
+fate-webm-dash-manifest-unaligned-audio-streams: CMD = run $(FFMPEG) -nostdin 
-f webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_audio3.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += 
fate-webm-dash-manifest-representations
-fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
+fate-webm-dash-manifest-representations: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video1.webm -f 
webm_dash_manifest -i $(TARGET_SAMPLES)/vp8/dash_video4.webm -c copy -map 0 
-map 1 -f webm_dash_manifest -adaptation_sets "id=0,streams=0,1" -
 
 FATE_VP8-$(CONFIG_WEBM_DASH_MANIFEST_DEMUXER) += fate-webm-dash-manifest-live
-fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -f webm_dash_manifest -live 
1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f webm_dash_manifest -live 
1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c copy -map 0 -map 1 -f 
webm_dash_manifest -live 1 -adaptation_sets "id=0,streams=0 id=1,streams=1" 
-chunk_start_index 1 -chunk_duration_ms 5000 -time_shift_buffer_depth 7200 
-minimum_update_period 60 -debug_mode 1 -
+fate-webm-dash-manifest-live: CMD = run $(FFMPEG) -nostdin -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_video_360.hdr -f 
webm_dash_manifest -live 1 -i $(TARGET_SAMPLES)/vp8/dash_live_audio_171.hdr -c 
copy -map 0 -map 1 -f webm_dash_manifest -live 1 -adaptation_sets 
"id=0,streams=0 id=1,streams=1" -chunk_start_index 1 -chunk_duration_ms 5000 
-time_shift_buffer_depth 7200 -minimum_update_period 60 -debug_mode 1 -
 
 FATE_VP8-$(call DEMDEC, MATROSKA, VP8) += fate-vp8-2451
 fate-vp

[FFmpeg-cvslog] lavf/utils: avoid using programs for duration when there's only one

2016-10-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Oct  5 
06:38:24 2016 -0500| [a6bce3ca90de81eb48db3a70df0b1c309d7d5cf9] | committer: 
Rodger Combs

lavf/utils: avoid using programs for duration when there's only one

This allows us to be more selective about the streams we derive durations from
(specifically, ignoring text streams with outlier end times) in the common case

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d19cc5e..1aa3b50 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2582,7 +2582,7 @@ static void update_stream_timings(AVFormatContext *ic)
 if (start_time != INT64_MAX) {
 ic->start_time = start_time;
 if (end_time != INT64_MIN) {
-if (ic->nb_programs) {
+if (ic->nb_programs > 1) {
 for (i = 0; i < ic->nb_programs; i++) {
 p = ic->programs[i];
 if (p->start_time != AV_NOPTS_VALUE && p->end_time > 
p->start_time)

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


[FFmpeg-cvslog] lavf/utils: ignore outlier subtitle and data stream end times as well

2016-10-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Oct  5 
06:37:57 2016 -0500| [4c9c4fe8b21b22e83cde22b5fbaa947ebe5e66d9] | committer: 
Rodger Combs

lavf/utils: ignore outlier subtitle and data stream end times as well

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

 libavformat/utils.c | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3acb260..d19cc5e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2524,7 +2524,7 @@ static int has_duration(AVFormatContext *ic)
  */
 static void update_stream_timings(AVFormatContext *ic)
 {
-int64_t start_time, start_time1, start_time_text, end_time, end_time1;
+int64_t start_time, start_time1, start_time_text, end_time, end_time1, 
end_time_text;
 int64_t duration, duration1, filesize;
 int i;
 AVStream *st;
@@ -2533,6 +2533,7 @@ static void update_stream_timings(AVFormatContext *ic)
 start_time = INT64_MAX;
 start_time_text = INT64_MAX;
 end_time   = INT64_MIN;
+end_time_text   = INT64_MIN;
 duration   = INT64_MIN;
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
@@ -2549,7 +2550,10 @@ static void update_stream_timings(AVFormatContext *ic)
  
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
 if (end_time1 != AV_NOPTS_VALUE && (end_time1 > 0 ? start_time1 <= 
INT64_MAX - end_time1 : start_time1 >= INT64_MIN - end_time1)) {
 end_time1 += start_time1;
-end_time = FFMAX(end_time, end_time1);
+if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || 
st->codecpar->codec_type == AVMEDIA_TYPE_DATA)
+end_time_text = FFMAX(end_time_text, end_time1);
+else
+end_time = FFMAX(end_time, end_time1);
 }
 for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) {
 if (p->start_time == AV_NOPTS_VALUE || p->start_time > 
start_time1)
@@ -2569,6 +2573,12 @@ static void update_stream_timings(AVFormatContext *ic)
 else if (start_time > start_time_text)
 av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
starttime %f\n", start_time_text / (float)AV_TIME_BASE);
 
+if (end_time == INT64_MIN || (end_time < end_time_text && end_time_text - 
end_time < AV_TIME_BASE)) {
+end_time = end_time_text;
+} else if (end_time < end_time_text) {
+av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream 
endtime %f\n", end_time_text / (float)AV_TIME_BASE);
+}
+
 if (start_time != INT64_MAX) {
 ic->start_time = start_time;
 if (end_time != INT64_MIN) {

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


[FFmpeg-cvslog] lavf/mpegtsenc: fix autobsf when the first NAL is 0x1 bytes

2016-10-04 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sun Sep 25 
14:43:42 2016 -0500| [14fe54bbfb988f4f5a6acb358282640a13162311] | committer: 
Rodger Combs

lavf/mpegtsenc: fix autobsf when the first NAL is 0x1 bytes

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

 libavformat/mpegtsenc.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index c10a3bf..3ad3de7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1790,11 +1790,15 @@ static int mpegts_check_bitstream(struct 
AVFormatContext *s, const AVPacket *pkt
 
 if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
 if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
-  AV_RB24(pkt->data) != 0x01)
+ (AV_RB24(pkt->data) != 0x01 ||
+  (st->codecpar->extradata_size > 0 &&
+   st->codecpar->extradata[0] == 1)))
 ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
 } else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
 if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x001 &&
-  AV_RB24(pkt->data) != 0x01)
+ (AV_RB24(pkt->data) != 0x01 ||
+  (st->codecpar->extradata_size > 0 &&
+   st->codecpar->extradata[0] == 1)))
 ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);
 }
 

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


[FFmpeg-cvslog] configure: add linker export script support on Darwin

2016-10-04 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Sep  9 
18:12:34 2016 -0500| [63fbeebf6ecb40b21db84d42f9f18867b3f89dca] | committer: 
Rodger Combs

configure: add linker export script support on Darwin

This isn't a "version script" in the usual sense, since it doesn't set symbol
versions directly. Instead, the version for the whole .dylib is set in the
linker flags, and we generate a list of symbol patterns to export. This allows
us to keep our local symbols (e.g. ff_*) local on the platform.

The Darwin linker's exported_symbols_list format is a bit different than the
one used by the GNU linker. It doesn't handle local symbols at all, since when
a list is provided, all unlisted symbols are local by default; thus, we remove
local sections. It doesn't handle per-version sections, so we remove the
headers and brackets. It expects symbols to be prefixed with an underscore.
It errors if a listed symbol with no wildcards is not present in the output,
so we append an asterisk to any symbol that doesn't already end in one.

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

 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index 2b141fb..ee7e852 100755
--- a/configure
+++ b/configure
@@ -4705,6 +4705,8 @@ case $target_os in
 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
 check_header dispatch/dispatch.h &&
 add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
+version_script='-exported_symbols_list'
+VERSION_SCRIPT_POSTPROCESS_CMD='tr " " "\n" | sed -n 
/global:/,/local:/p | grep ";" | tr ";" "\n" | sed -E "s/(.+)/_\1/g" | sed -E 
"s/(.+[^*])/\1*/"'
 ;;
 msys*)
 die "Native MSYS builds are discouraged, please use the MINGW 
environment."

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


[FFmpeg-cvslog] lavf: add a flag to enable/disable automatic bitstream filtering

2016-09-12 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
02:59:39 2016 -0500| [1f6d7eb47070afc4394348721cd149f940ad2386] | committer: 
Rodger Combs

lavf: add a flag to enable/disable automatic bitstream filtering

This is mostly useful for muxers that wrap other muxers, such as dashenc
and segment. The actual duplicated bitstream filtering is largely harmless,
but delaying the header can cause problems when the muxer intended the header
to be written to a separate file.

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

 libavformat/avformat.h  | 1 +
 libavformat/mux.c   | 5 -
 libavformat/options_table.h | 3 ++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 74915a1..43b225b 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1449,6 +1449,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep 
it separate.
 #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
 #define AVFMT_FLAG_SHORTEST   0x10 ///< Stop muxing when the shortest 
stream stops.
+#define AVFMT_FLAG_AUTO_BSF   0x20 ///< Wait for packet data before 
writing a header, and add bitstream filters as requested by the muxer
 
 /**
  * Maximum size of the data read from input for determining
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 176af59..bbfc0fc 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -500,7 +500,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary 
**options)
 if ((ret = init_muxer(s, options)) < 0)
 return ret;
 
-if (!s->oformat->check_bitstream) {
+if (!(s->oformat->check_bitstream && s->flags & AVFMT_FLAG_AUTO_BSF)) {
 ret = write_header_internal(s);
 if (ret < 0)
 goto fail;
@@ -830,6 +830,9 @@ static int do_packet_auto_bsf(AVFormatContext *s, AVPacket 
*pkt) {
 AVStream *st = s->streams[pkt->stream_index];
 int i, ret;
 
+if (!(s->flags & AVFMT_FLAG_AUTO_BSF))
+return 1;
+
 if (s->oformat->check_bitstream) {
 if (!st->internal->bitstream_checked) {
 if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 699809a..9d61d5a 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -39,7 +39,7 @@ static const AVOption avformat_options[] = {
 {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 
= 500 }, 32, INT64_MAX, D},
 {"formatprobesize", "number of bytes to probe file format", 
OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, 
INT_MAX-1, D},
 {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 
= DEFAULT }, 0, INT_MAX, E},
-{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 
AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"},
+{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 
AVFMT_FLAG_FLUSH_PACKETS | AVFMT_FLAG_AUTO_BSF }, INT_MIN, INT_MAX, D|E, 
"fflags"},
 {"flush_packets", "reduce the latency by flushing out packets immediately", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, E, 
"fflags"},
 {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, 
INT_MIN, INT_MAX, D, "fflags"},
 {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, 
INT_MIN, INT_MAX, D, "fflags"},
@@ -55,6 +55,7 @@ static const AVOption avformat_options[] = {
 {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D},
 {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 
= AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
 {"shortest", "stop muxing with the shortest stream", 0, AV_OPT_TYPE_CONST, { 
.i64 = AVFMT_FLAG_SHORTEST }, 0, 0, E, "fflags" },
+{"autobsf", "add needed bsfs automatically (delays header until each stream's 
first packet is written)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_AUTO_BSF 
}, 0, 0, E, "fflags" },
 {"analyzeduration", "specify how many microseconds are analyzed to probe the 
input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 
0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", 
OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},

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


[FFmpeg-cvslog] ass_split: reindent

2016-09-12 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sat Sep 10 
00:29:50 2016 -0500| [dca03ec5f4d5ca28efc8a80c591412fab5821d81] | committer: 
Rodger Combs

ass_split: reindent

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

 libavcodec/ass_split.c | 34 +-
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index cdb1aa2..d3e8a8d 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -276,23 +276,23 @@ static const char *ass_split_section(ASSSplitContext 
*ctx, const char *buf)
 if (section->format_header && !order) {
 len = strlen(section->format_header);
 if (buf[len] == ':' && !strncmp(buf, section->format_header, len)) 
{
-buf += len + 1;
-while (!is_eol(*buf)) {
-buf = skip_space(buf);
-len = strcspn(buf, ", \r\n");
-if (!(tmp = av_realloc_array(order, (*number + 1), 
sizeof(*order
-return NULL;
-order = tmp;
-order[*number] = -1;
-for (i=0; section->fields[i].name; i++)
-if (!strncmp(buf, section->fields[i].name, len)) {
-order[*number] = i;
-break;
-}
-(*number)++;
-buf = skip_space(buf + len + (buf[len] == ','));
-}
-ctx->field_order[ctx->current_section] = order;
+buf += len + 1;
+while (!is_eol(*buf)) {
+buf = skip_space(buf);
+len = strcspn(buf, ", \r\n");
+if (!(tmp = av_realloc_array(order, (*number + 1), 
sizeof(*order
+return NULL;
+order = tmp;
+order[*number] = -1;
+for (i=0; section->fields[i].name; i++)
+if (!strncmp(buf, section->fields[i].name, len)) {
+order[*number] = i;
+break;
+}
+(*number)++;
+buf = skip_space(buf + len + (buf[len] == ','));
+}
+ctx->field_order[ctx->current_section] = order;
 goto next_line;
 }
 }

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


[FFmpeg-cvslog] ass_split: fix handling of streams with no [Events] or Format: line

2016-09-12 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Fri Dec  4 
06:42:48 2015 -0600| [3b32e1313c6d68aa10bc7d97ad505382def833b0] | committer: 
Rodger Combs

ass_split: fix handling of streams with no [Events] or Format: line

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

 libavcodec/ass_split.c | 36 +++-
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c
index beaba7e..cdb1aa2 100644
--- a/libavcodec/ass_split.c
+++ b/libavcodec/ass_split.c
@@ -229,7 +229,7 @@ static inline const char *skip_space(const char *buf)
 return buf;
 }
 
-static int *get_default_field_orders(const ASSSection *section)
+static int *get_default_field_orders(const ASSSection *section, int *number)
 {
 int i;
 int *order = av_malloc_array(FF_ARRAY_ELEMS(section->fields), 
sizeof(*order));
@@ -238,8 +238,9 @@ static int *get_default_field_orders(const ASSSection 
*section)
 return NULL;
 for (i = 0; section->fields[i].name; i++)
 order[i] = i;
+*number = i;
 while (i < FF_ARRAY_ELEMS(section->fields))
-order[i] = -1;
+order[i++] = -1;
 return order;
 }
 
@@ -255,12 +256,26 @@ static const char *ass_split_section(ASSSplitContext 
*ctx, const char *buf)
 ctx->current_section = -1;
 break;
 }
-if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':')) {
-/* skip comments */
-} else if (section->format_header && !order) {
+if (buf[0] == ';' || (buf[0] == '!' && buf[1] == ':'))
+goto next_line; // skip comments
+
+len = strcspn(buf, ":\r\n");
+if (buf[len] == ':' &&
+(!section->fields_header || strncmp(buf, section->fields_header, 
len))) {
+for (i = 0; i < FF_ARRAY_ELEMS(ass_sections); i++) {
+if (ass_sections[i].fields_header &&
+!strncmp(buf, ass_sections[i].fields_header, len)) {
+ctx->current_section = i;
+section = _sections[ctx->current_section];
+number = >field_number[ctx->current_section];
+order = ctx->field_order[ctx->current_section];
+break;
+}
+}
+}
+if (section->format_header && !order) {
 len = strlen(section->format_header);
-if (strncmp(buf, section->format_header, len) || buf[len] != ':')
-goto next_line;
+if (buf[len] == ':' && !strncmp(buf, section->format_header, len)) 
{
 buf += len + 1;
 while (!is_eol(*buf)) {
 buf = skip_space(buf);
@@ -278,7 +293,10 @@ static const char *ass_split_section(ASSSplitContext *ctx, 
const char *buf)
 buf = skip_space(buf + len + (buf[len] == ','));
 }
 ctx->field_order[ctx->current_section] = order;
-} else if (section->fields_header) {
+goto next_line;
+}
+}
+if (section->fields_header) {
 len = strlen(section->fields_header);
 if (!strncmp(buf, section->fields_header, len) && buf[len] == ':') 
{
 uint8_t *ptr, *struct_ptr = realloc_section_array(ctx);
@@ -286,7 +304,7 @@ static const char *ass_split_section(ASSSplitContext *ctx, 
const char *buf)
 
 /* No format header line found so far, assume default */
 if (!order) {
-order = get_default_field_orders(section);
+order = get_default_field_orders(section, number);
 if (!order)
 return NULL;
 ctx->field_order[ctx->current_section] = order;

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


[FFmpeg-cvslog] lavc/Makefile: add missing ADPCM_THP_LE objs

2016-09-09 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Feb  3 
08:21:27 2016 -0600| [7c5fed15a8dfb6192960a14e876afa913d4f86fd] | committer: 
Rodger Combs

lavc/Makefile: add missing ADPCM_THP_LE objs

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

 libavcodec/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index fa2318a..9c7302a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -753,6 +753,7 @@ OBJS-$(CONFIG_ADPCM_SBPRO_4_DECODER)  += adpcm.o 
adpcm_data.o
 OBJS-$(CONFIG_ADPCM_SWF_DECODER)  += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_SWF_ENCODER)  += adpcmenc.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_THP_DECODER)  += adpcm.o adpcm_data.o
+OBJS-$(CONFIG_ADPCM_THP_LE_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_XA_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER)   += adpcm.o adpcm_data.o

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


[FFmpeg-cvslog] lavc/Makefile: g729dec: fix missing file

2016-09-09 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Feb  3 
07:14:33 2016 -0600| [1177e42121360a50fa864bab1897468b2e0d1d22] | committer: 
Rodger Combs

lavc/Makefile: g729dec: fix missing file

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

 libavcodec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 7396468..fa2318a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -297,7 +297,7 @@ OBJS-$(CONFIG_G723_1_DECODER)  += g723_1dec.o 
g723_1.o \
   acelp_vectors.o celp_filters.o 
celp_math.o
 OBJS-$(CONFIG_G723_1_ENCODER)  += g723_1enc.o g723_1.o \
   acelp_vectors.o celp_filters.o 
celp_math.o
-OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o 
acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
+OBJS-$(CONFIG_G729_DECODER)+= g729dec.o lsp.o celp_math.o 
celp_filters.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o 
g729postfilter.o
 OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
 OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
 OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o

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


[FFmpeg-cvslog] lavf/matroskaenc: skip writing "duration" tags

2016-09-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Sep  5 
21:43:18 2016 -0500| [3829a02738c16cfc84f41fd4b55a34c03386a65b] | committer: 
Rodger Combs

lavf/matroskaenc: skip writing "duration" tags

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

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index decb66d..7deccaa 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1314,6 +1314,7 @@ static int mkv_check_tag_name(const char *name, unsigned 
int elementid)
av_strcasecmp(name, "stereo_mode") &&
av_strcasecmp(name, "creation_time") &&
av_strcasecmp(name, "encoding_tool") &&
+   av_strcasecmp(name, "duration") &&
(elementid != MATROSKA_ID_TAGTARGETS_TRACKUID ||
 av_strcasecmp(name, "language"));
 }

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


[FFmpeg-cvslog] lavf/matroskaenc: use mkv_check_tag_name consistently

2016-09-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Sep  5 
22:26:16 2016 -0500| [843e72ea5542845a0a9fed743517c14a92279885] | committer: 
Rodger Combs

lavf/matroskaenc: use mkv_check_tag_name consistently

Previously, we used a different list of checks when deciding whether to
write a set of tags at all than we did when deciding whether to write an
individual tag in the set. This resulted in sometimes writing an empty
tag master and seekhead. Now we use mkv_check_tag_name everywhere, so
if a dictionary is entirely composed of tags we skip, we don't write a
tag master at all.

This affected the test file, since "language" was on one list but not
the other, so we were writing an empty tag master there. The test hash
is updated to reflect that change.

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

 libavformat/matroskaenc.c | 10 +-
 tests/fate/matroska.mak   |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 7deccaa..3eeb09b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1342,12 +1342,12 @@ static int mkv_write_tag(AVFormatContext *s, 
AVDictionary *m, unsigned int eleme
 return 0;
 }
 
-static int mkv_check_tag(AVDictionary *m)
+static int mkv_check_tag(AVDictionary *m, unsigned int elementid)
 {
 AVDictionaryEntry *t = NULL;
 
 while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX)))
-if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, 
"stereo_mode"))
+if (mkv_check_tag_name(t->key, elementid))
 return 1;
 
 return 0;
@@ -1361,7 +1361,7 @@ static int mkv_write_tags(AVFormatContext *s)
 
 ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL);
 
-if (mkv_check_tag(s->metadata)) {
+if (mkv_check_tag(s->metadata, 0)) {
 ret = mkv_write_tag(s, s->metadata, 0, 0, );
 if (ret < 0) return ret;
 }
@@ -1369,7 +1369,7 @@ static int mkv_write_tags(AVFormatContext *s)
 for (i = 0; i < s->nb_streams; i++) {
 AVStream *st = s->streams[i];
 
-if (!mkv_check_tag(st->metadata))
+if (!mkv_check_tag(st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID))
 continue;
 
 ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, 
i + 1, );
@@ -1398,7 +1398,7 @@ static int mkv_write_tags(AVFormatContext *s)
 for (i = 0; i < s->nb_chapters; i++) {
 AVChapter *ch = s->chapters[i];
 
-if (!mkv_check_tag(ch->metadata))
+if (!mkv_check_tag(ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID))
 continue;
 
 ret = mkv_write_tag(s, ch->metadata, 
MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id + mkv->chapter_id_offset, );
diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 8cf1734..8e4a1e8 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -4,6 +4,6 @@
 FATE_MATROSKA-$(call DEMMUX, MATROSKA, MATROSKA) += fate-matroska-remux
 fate-matroska-remux: CMD = md5 -i 
$(TARGET_SAMPLES)/vp9-test-vectors/vp90-2-2pass-akiyo.webm -color_trc 4 -c:v 
copy -fflags +bitexact -strict -2 -f matroska
 fate-matroska-remux: CMP = oneline
-fate-matroska-remux: REF = 5ebcfaa8e3d534f8a800a58fd2b0aca6
+fate-matroska-remux: REF = f08b20b90f158a4de5a02a52c25596b9
 
 FATE_SAMPLES_AVCONV += $(FATE_MATROSKA-yes)

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


[FFmpeg-cvslog] lavf/matroskaenc: move skipped metadata keys to separate function

2016-09-06 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Sep  5 
21:42:24 2016 -0500| [6ede4e93ca0468dc1645677ad540f575c941ff7a] | committer: 
Rodger Combs

lavf/matroskaenc: move skipped metadata keys to separate function

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

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

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2a2877f..decb66d 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1308,6 +1308,16 @@ static int mkv_write_tag_targets(AVFormatContext *s,
 return 0;
 }
 
+static int mkv_check_tag_name(const char *name, unsigned int elementid)
+{
+return av_strcasecmp(name, "title") &&
+   av_strcasecmp(name, "stereo_mode") &&
+   av_strcasecmp(name, "creation_time") &&
+   av_strcasecmp(name, "encoding_tool") &&
+   (elementid != MATROSKA_ID_TAGTARGETS_TRACKUID ||
+av_strcasecmp(name, "language"));
+}
+
 static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int 
elementid,
  unsigned int uid, ebml_master *tags)
 {
@@ -1320,12 +1330,7 @@ static int mkv_write_tag(AVFormatContext *s, 
AVDictionary *m, unsigned int eleme
 return ret;
 
 while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) {
-if (av_strcasecmp(t->key, "title") &&
-av_strcasecmp(t->key, "stereo_mode") &&
-av_strcasecmp(t->key, "creation_time") &&
-av_strcasecmp(t->key, "encoding_tool") &&
-(elementid != MATROSKA_ID_TAGTARGETS_TRACKUID ||
- av_strcasecmp(t->key, "language"))) {
+if (mkv_check_tag_name(t->key, elementid)) {
 ret = mkv_write_simpletag(s->pb, t);
 if (ret < 0)
 return ret;

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


[FFmpeg-cvslog] lavf/srtdec: fix indent

2016-06-25 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sat Jun 25 
15:53:11 2016 -0500| [6ee7adb881e4513ebacf76ba97d413fcbd6cf3e3] | committer: 
Rodger Combs

lavf/srtdec: fix indent

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

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

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 9ab7a4e..067db63 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -54,7 +54,7 @@ static int srt_probe(AVProbeData *p)
 return 0;
 pbuf = buf;
 if (buf[0] == '-')
-  pbuf++;
+pbuf++;
 if (pbuf[0] >= '0' && pbuf[0] <= '9' && strstr(buf, " --> ")
 && sscanf(buf, "%*d:%*d:%*d%*1[,.]%*d --> %*d:%*d:%*d%*1[,.]%d", ) 
== 1)
 return AVPROBE_SCORE_MAX;

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


[FFmpeg-cvslog] lavf/srtdec: fix probing files with negative first timestamps

2016-06-25 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon Jun  6 
13:26:36 2016 -0500| [1df401505c6d209961016ba881d18bedf6af61eb] | committer: 
Rodger Combs

lavf/srtdec: fix probing files with negative first timestamps

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

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

diff --git a/libavformat/srtdec.c b/libavformat/srtdec.c
index 585aa6a..9ab7a4e 100644
--- a/libavformat/srtdec.c
+++ b/libavformat/srtdec.c
@@ -52,7 +52,10 @@ static int srt_probe(AVProbeData *p)
 /* Check if the next line matches a SRT timestamp */
 if (ff_subtitles_read_line(, buf, sizeof(buf)) < 0)
 return 0;
-if (buf[0] >= '0' && buf[0] <= '9' && strstr(buf, " --> ")
+pbuf = buf;
+if (buf[0] == '-')
+  pbuf++;
+if (pbuf[0] >= '0' && pbuf[0] <= '9' && strstr(buf, " --> ")
 && sscanf(buf, "%*d:%*d:%*d%*1[,.]%*d --> %*d:%*d:%*d%*1[,.]%d", ) 
== 1)
 return AVPROBE_SCORE_MAX;
 

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


[FFmpeg-cvslog] lavf: deprecate av_apply_bitstream_filters

2016-06-25 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Apr 20 
01:11:59 2016 -0500| [150e5e13b1fae125fd7ec2d91fa56b5be958668e] | committer: 
Rodger Combs

lavf: deprecate av_apply_bitstream_filters

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

 libavformat/avformat.h |3 +++
 libavformat/utils.c|4 
 2 files changed, 7 insertions(+)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4eb1140..c881808 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2873,8 +2873,11 @@ int avformat_queue_attached_pictures(AVFormatContext *s);
  * @return  >=0 on success;
  *  AVERROR code on failure
  */
+#if FF_API_OLD_BSF
+attribute_deprecated
 int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
AVBitStreamFilterContext *bsfc);
+#endif
 
 /**
  * @}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1d73b25..866dfb5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -5006,6 +5006,8 @@ int ff_stream_add_bitstream_filter(AVStream *st, const 
char *name, const char *a
 return 1;
 }
 
+#if FF_API_OLD_BSF
+FF_DISABLE_DEPRECATION_WARNINGS
 int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt,
AVBitStreamFilterContext *bsfc)
 {
@@ -5059,6 +5061,8 @@ int av_apply_bitstream_filters(AVCodecContext *codec, 
AVPacket *pkt,
 }
 return ret;
 }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
 
 void ff_format_io_close(AVFormatContext *s, AVIOContext **pb)
 {

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


[FFmpeg-cvslog] lavf: update auto-bsf to new BSF API

2016-06-25 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Apr 20 
01:15:35 2016 -0500| [af7e2734b9c1cd5b09208e343154ffc89a64d2c4] | committer: 
Rodger Combs

lavf: update auto-bsf to new BSF API

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

 libavformat/internal.h |5 ++--
 libavformat/mux.c  |   45 
 libavformat/segment.c  |6 +++--
 libavformat/utils.c|   59 
 4 files changed, 91 insertions(+), 24 deletions(-)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 8c2740b..647ad65 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -135,11 +135,12 @@ struct AVStreamInternal {
 int reorder;
 
 /**
- * bitstream filter to run on stream
+ * bitstream filters to run on stream
  * - encoding: Set by muxer using ff_stream_add_bitstream_filter
  * - decoding: unused
  */
-AVBitStreamFilterContext *bsfc;
+AVBSFContext **bsfcs;
+int nb_bsfcs;
 
 /**
  * Whether or not check_bitstream should still be run on each packet
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 105d762..a447645 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1082,7 +1082,7 @@ static int interleave_packet(AVFormatContext *s, AVPacket 
*out, AVPacket *in, in
 
 int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt)
 {
-int ret, flush = 0;
+int ret, flush = 0, i;
 
 ret = prepare_input_packet(s, pkt);
 if (ret < 0)
@@ -1100,15 +1100,40 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 }
 }
 
-av_apply_bitstream_filters(st->internal->avctx, pkt, 
st->internal->bsfc);
-if (pkt->size == 0 && pkt->side_data_elems == 0)
-return 0;
-if (!st->codecpar->extradata && st->internal->avctx->extradata) {
-int eret = ff_alloc_extradata(st->codecpar, 
st->internal->avctx->extradata_size);
-if (eret < 0)
-return AVERROR(ENOMEM);
-st->codecpar->extradata_size = st->internal->avctx->extradata_size;
-memcpy(st->codecpar->extradata, st->internal->avctx->extradata, 
st->internal->avctx->extradata_size);
+for (i = 0; i < st->internal->nb_bsfcs; i++) {
+AVBSFContext *ctx = st->internal->bsfcs[i];
+if (i > 0) {
+AVBSFContext* prev_ctx = st->internal->bsfcs[i - 1];
+if (prev_ctx->par_out->extradata_size != 
ctx->par_in->extradata_size) {
+if ((ret = avcodec_parameters_copy(ctx->par_in, 
prev_ctx->par_out)) < 0)
+goto fail;
+}
+}
+// TODO: when any bitstream filter requires flushing at EOF, we'll 
need to
+// flush each stream's BSF chain on write_trailer.
+if ((ret = av_bsf_send_packet(ctx, pkt)) < 0) {
+av_log(ctx, AV_LOG_ERROR,
+   "Failed to send packet to filter %s for stream %d",
+   ctx->filter->name, pkt->stream_index);
+goto fail;
+}
+// TODO: when any automatically-added bitstream filter is 
generating multiple
+// output packets for a single input one, we'll need to call this 
in a loop
+// and write each output packet.
+if ((ret = av_bsf_receive_packet(ctx, pkt)) < 0) {
+if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+return 0;
+av_log(ctx, AV_LOG_ERROR,
+   "Failed to send packet to filter %s for stream %d",
+   ctx->filter->name, pkt->stream_index);
+goto fail;
+}
+if (i == st->internal->nb_bsfcs - 1) {
+if (ctx->par_out->extradata_size != 
st->codecpar->extradata_size) {
+if ((ret = avcodec_parameters_copy(st->codecpar, 
ctx->par_out)) < 0)
+goto fail;
+}
+}
 }
 
 if (s->debug & FF_FDEBUG_TS)
diff --git a/libavformat/segment.c b/libavformat/segment.c
index df6f4b5..4c6c6d4 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -966,8 +966,10 @@ static int seg_check_bitstream(struct AVFormatContext *s, 
const AVPacket *pkt)
 if (ret == 1) {
 AVStream *st = s->streams[pkt->stream_index];
 AVStream *ost = oc->streams[pkt->stream_index];
-st->internal->bsfc = ost->internal->bsfc;
-ost->internal->bsfc = NULL;
+st->internal->bsfcs = ost->internal-&

[FFmpeg-cvslog] lavfi/drawutils: support NV12 and NV21

2016-05-10 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Mon May  9 
20:52:06 2016 -0500| [d645182227e8830de4de59a7b9ebec1b7e714d12] | committer: 
Rodger Combs

lavfi/drawutils: support NV12 and NV21

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

 libavfilter/drawutils.c   |   33 -
 tests/ref/fate/filter-pixfmts-pad |2 ++
 2 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/libavfilter/drawutils.c b/libavfilter/drawutils.c
index d37c83e..3146bfa 100644
--- a/libavfilter/drawutils.c
+++ b/libavfilter/drawutils.c
@@ -205,8 +205,6 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat 
format, unsigned flags)
 return AVERROR(ENOSYS);
 nb_planes = FFMAX(nb_planes, c->plane + 1);
 }
-if ((desc->log2_chroma_w || desc->log2_chroma_h) && nb_planes < 3)
-return AVERROR(ENOSYS); /* exclude NV12 and NV21 */
 memset(draw, 0, sizeof(*draw));
 draw->desc  = desc;
 draw->format= format;
@@ -214,7 +212,7 @@ int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat 
format, unsigned flags)
 memcpy(draw->pixelstep, pixelstep, sizeof(draw->pixelstep));
 draw->hsub[1] = draw->hsub[2] = draw->hsub_max = desc->log2_chroma_w;
 draw->vsub[1] = draw->vsub[2] = draw->vsub_max = desc->log2_chroma_h;
-for (i = 0; i < ((desc->nb_components - 1) | 1); i++)
+for (i = 0; i < (desc->nb_components - !!(desc->flags & 
AV_PIX_FMT_FLAG_ALPHA)); i++)
 draw->comp_mask[desc->comp[i].plane] |=
 1 << desc->comp[i].offset;
 return 0;
@@ -243,20 +241,21 @@ void ff_draw_color(FFDrawContext *draw, FFDrawColor 
*color, const uint8_t rgba[4
 color->comp[rgba_map[i]].u16[0] = 
color->comp[rgba_map[i]].u8[0] << (draw->desc->comp[rgba_map[i]].depth - 8);
 }
 }
-} else if (draw->nb_planes == 3 || draw->nb_planes == 4) {
+} else if (draw->nb_planes >= 2) {
 /* assume YUV */
-color->comp[0].u8[0] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]);
-color->comp[1].u8[0] = RGB_TO_U_CCIR(rgba[0], rgba[1], rgba[2], 0);
-color->comp[2].u8[0] = RGB_TO_V_CCIR(rgba[0], rgba[1], rgba[2], 0);
+const AVPixFmtDescriptor *desc = draw->desc;
+color->comp[desc->comp[0].plane].u8[desc->comp[0].offset] = 
RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]);
+color->comp[desc->comp[1].plane].u8[desc->comp[1].offset] = 
RGB_TO_U_CCIR(rgba[0], rgba[1], rgba[2], 0);
+color->comp[desc->comp[2].plane].u8[desc->comp[2].offset] = 
RGB_TO_V_CCIR(rgba[0], rgba[1], rgba[2], 0);
 color->comp[3].u8[0] = rgba[3];
-if (draw->desc->comp[0].depth > 8)
-color->comp[0].u16[0] = color->comp[0].u8[0] << 
(draw->desc->comp[0].depth - 8);
-if (draw->desc->comp[1].depth > 8)
-color->comp[1].u16[0] = color->comp[1].u8[0] << 
(draw->desc->comp[1].depth - 8);
-if (draw->desc->comp[2].depth > 8)
-color->comp[2].u16[0] = color->comp[2].u8[0] << 
(draw->desc->comp[2].depth - 8);
-if (draw->desc->comp[3].depth > 8)
-color->comp[3].u16[0] = color->comp[3].u8[0] << 
(draw->desc->comp[3].depth - 8);
+#define EXPAND(compn) \
+if (desc->comp[compn].depth > 8) \
+color->comp[desc->comp[compn].plane].u16[desc->comp[compn].offset] 
= \
+color->comp[desc->comp[compn].plane].u8[desc->comp[compn].offset] 
<< (draw->desc->comp[compn].depth - 8)
+EXPAND(3);
+EXPAND(2);
+EXPAND(1);
+EXPAND(0);
 } else if (draw->format == AV_PIX_FMT_GRAY8 || draw->format == 
AV_PIX_FMT_GRAY8A) {
 color->comp[0].u8[0] = RGB_TO_Y_CCIR(rgba[0], rgba[1], rgba[2]);
 color->comp[1].u8[0] = rgba[3];
@@ -450,7 +449,7 @@ void ff_blend_rectangle(FFDrawContext *draw, FFDrawColor 
*color,
 /* 0x101 * alpha is in the [ 2 ; 0x1001] range */
 alpha = 0x101 * color->rgba[3] + 0x2;
 }
-nb_planes = (draw->nb_planes - 1) | 1; /* eliminate alpha */
+nb_planes = draw->nb_planes - !!(draw->desc->flags & 
AV_PIX_FMT_FLAG_ALPHA);
 for (plane = 0; plane < nb_planes; plane++) {
 nb_comp = draw->pixelstep[plane];
 p0 = pointer_at(draw, dst, dst_linesize, plane, x0, y0);
@@ -627,7 +626,7 @@ void ff_blend_mask(FFDrawContext *draw, FFDrawColor *color,
 } else {
 alpha = (0x101 * color->rgba[3] + 0x2) >> 8;
 }
-nb_planes = (draw->nb_planes - 1) | 1; /* eliminate alpha */
+nb_planes = draw->nb_planes - !!(draw->desc->flags & 
AV_PIX_FMT_FLAG

[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-04-30 Thread Rodger Combs
ffmpeg | branch: release/2.5 | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 
18 12:57:37 2016 -0600| [b42ade51eb5b103950eb0ea8089c13cf04c9f792] | committer: 
Michael Niedermayer

lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a518846..cebd0b8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3078,7 +3078,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-04-29 Thread Rodger Combs
ffmpeg | branch: release/2.6 | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 
18 12:57:37 2016 -0600| [578e4998641cb6272e300a70c881d66f5dd414e0] | committer: 
Michael Niedermayer

lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f9921b7..032e364 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3216,7 +3216,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-04-27 Thread Rodger Combs
ffmpeg | branch: release/2.7 | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 
18 12:57:37 2016 -0600| [46e4028e6949e13c6d6403c4a23de61884e0ace7] | committer: 
Michael Niedermayer

lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1f122b4..2d37d49 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3321,7 +3321,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-04-26 Thread Rodger Combs
ffmpeg | branch: release/2.8 | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 
18 12:57:37 2016 -0600| [36e5854801a8c81c09aa3600db861794090b4fd8] | committer: 
Michael Niedermayer

lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index cd692a3..1057279 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3522,7 +3522,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216

2016-04-26 Thread Rodger Combs
ffmpeg | branch: release/2.8 | Rodger Combs <rodger.co...@gmail.com> | Mon Feb 
22 18:34:01 2016 -0600| [7aaab36874293e6b06a07fa53306a01c42e665bc] | committer: 
Michael Niedermayer

lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216
(cherry picked from commit 22dbc1caaf13e4bb17c9e0164a5b1ccaf490e428)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1057279..3351ae2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3579,7 +3579,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 version = avio_r8(pb);
 if (version > 1) {
 avpriv_request_sample(c->fc, "sidx version %u", version);
-return AVERROR_PATCHWELCOME;
+return 0;
 }
 
 avio_rb24(pb); // flags
@@ -3592,8 +3592,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 }
 if (!st) {
-av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id 
%d\n", track_id);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id 
%d\n", track_id);
+return 0;
 }
 
 sc = st->priv_data;

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


[FFmpeg-cvslog] lavc/audiotoolboxdec: fix memory leak

2016-04-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Apr 19 
03:44:17 2016 -0500| [95116bf35f1bbc15a41be67f70f31b8de6075b8f] | committer: 
Rodger Combs

lavc/audiotoolboxdec: fix memory leak

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

 libavcodec/audiotoolboxdec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 31e14d4..58d05f8 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -414,6 +414,7 @@ static OSStatus ffat_decode_callback(AudioConverterRef 
converter, UInt32 *nb_pac
 return 0;
 }
 
+av_packet_unref(>in_pkt);
 av_packet_move_ref(>in_pkt, >new_in_pkt);
 at->new_in_pkt.data = 0;
 at->new_in_pkt.size = 0;

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


[FFmpeg-cvslog] lavc/audiotoolboxdec: move to new BSF API

2016-04-26 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Apr 19 
03:50:28 2016 -0500| [e1c20485c1d47ae54d94f4e7f86a96ec85467dd1] | committer: 
Rodger Combs

lavc/audiotoolboxdec: move to new BSF API

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

 libavcodec/audiotoolboxdec.c |   82 +++---
 1 file changed, 54 insertions(+), 28 deletions(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 58d05f8..2748e8d 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -43,10 +43,13 @@ typedef struct ATDecodeContext {
 AudioStreamPacketDescription pkt_desc;
 AVPacket in_pkt;
 AVPacket new_in_pkt;
-AVBitStreamFilterContext *bsf;
+AVBSFContext *bsf;
 char *decoded_data;
 int channel_map[64];
 
+uint8_t *extradata;
+int extradata_size;
+
 int64_t last_pts;
 int eof;
 } ATDecodeContext;
@@ -224,22 +227,23 @@ static void put_descr(PutByteContext *pb, int tag, 
unsigned int size)
 
 static uint8_t* ffat_get_magic_cookie(AVCodecContext *avctx, UInt32 
*cookie_size)
 {
+ATDecodeContext *at = avctx->priv_data;
 if (avctx->codec_id == AV_CODEC_ID_AAC) {
 char *extradata;
 PutByteContext pb;
-*cookie_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
+*cookie_size = 5 + 3 + 5+13 + 5+at->extradata_size;
 if (!(extradata = av_malloc(*cookie_size)))
 return NULL;
 
 bytestream2_init_writer(, extradata, *cookie_size);
 
 // ES descriptor
-put_descr(, 0x03, 3 + 5+13 + 5+avctx->extradata_size);
+put_descr(, 0x03, 3 + 5+13 + 5+at->extradata_size);
 bytestream2_put_be16(, 0);
 bytestream2_put_byte(, 0x00); // flags (= no flags)
 
 // DecoderConfig descriptor
-put_descr(, 0x04, 13 + 5+avctx->extradata_size);
+put_descr(, 0x04, 13 + 5+at->extradata_size);
 
 // Object type indication
 bytestream2_put_byte(, 0x40);
@@ -252,18 +256,19 @@ static uint8_t* ffat_get_magic_cookie(AVCodecContext 
*avctx, UInt32 *cookie_size
 bytestream2_put_be32(, 0); // avgbitrate
 
 // DecoderSpecific info descriptor
-put_descr(, 0x05, avctx->extradata_size);
-bytestream2_put_buffer(, avctx->extradata, avctx->extradata_size);
+put_descr(, 0x05, at->extradata_size);
+bytestream2_put_buffer(, at->extradata, at->extradata_size);
 return extradata;
 } else {
-*cookie_size = avctx->extradata_size;
-return avctx->extradata;
+*cookie_size = at->extradata_size;
+return at->extradata;
 }
 }
 
 static av_cold int ffat_usable_extradata(AVCodecContext *avctx)
 {
-return avctx->extradata_size &&
+ATDecodeContext *at = avctx->priv_data;
+return at->extradata_size &&
(avctx->codec_id == AV_CODEC_ID_ALAC ||
 avctx->codec_id == AV_CODEC_ID_AAC);
 }
@@ -284,7 +289,7 @@ static int ffat_set_extradata(AVCodecContext *avctx)
 if (status != 0)
 av_log(avctx, AV_LOG_WARNING, "AudioToolbox cookie error: %i\n", 
(int)status);
 
-if (cookie != avctx->extradata)
+if (cookie != at->extradata)
 av_free(cookie);
 }
 return 0;
@@ -320,7 +325,7 @@ static av_cold int ffat_create_decoder(AVCodecContext 
*avctx, AVPacket *pkt)
 return AVERROR(ENOMEM);
 status = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
 cookie_size, cookie, _size, 
_format);
-if (cookie != avctx->extradata)
+if (cookie != at->extradata)
 av_free(cookie);
 if (status != 0) {
 av_log(avctx, AV_LOG_ERROR, "AudioToolbox header-parse error: 
%i\n", (int)status);
@@ -391,6 +396,10 @@ static av_cold int ffat_create_decoder(AVCodecContext 
*avctx, AVPacket *pkt)
 
 static av_cold int ffat_init_decoder(AVCodecContext *avctx)
 {
+ATDecodeContext *at = avctx->priv_data;
+at->extradata = avctx->extradata;
+at->extradata_size = avctx->extradata_size;
+
 if ((avctx->channels && avctx->sample_rate) || 
ffat_usable_extradata(avctx))
 return ffat_create_decoder(avctx, NULL);
 else
@@ -416,8 +425,6 @@ static OSStatus ffat_decode_callback(AudioConverterRef 
converter, UInt32 *nb_pac
 
 av_packet_unref(>in_pkt);
 av_packet_move_ref(>in_pkt, >new_in_pkt);
-at->new_in_pkt.data = 0;
-at->new_in_pkt.size = 0;
 
 if (!at->in_pkt.data) {
 *nb_packets = 0;
@@ -464,32 +471,48 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
 ATDecodeContext *at = avctx->priv_data;
 AVFrame *frame = data;
 int pkt_size = avpkt->size;
-AVPacket filtered_packet;
+ 

[FFmpeg-cvslog] lavc/audiotoolboxdec: avoid relying on consumer-provided params when possible

2016-04-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
20:43:37 2016 -0500| [b20d3bf4a45d4efdb5729cf0849e649dff16d02f] | committer: 
Rodger Combs

lavc/audiotoolboxdec: avoid relying on consumer-provided params when possible

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

 configure|2 +
 libavcodec/Makefile  |6 +--
 libavcodec/audiotoolboxdec.c |  103 +-
 3 files changed, 86 insertions(+), 25 deletions(-)

diff --git a/configure b/configure
index 94a66d8..f8ff5ca 100755
--- a/configure
+++ b/configure
@@ -2647,10 +2647,12 @@ mjpeg2jpeg_bsf_select="jpegtables"
 # external libraries
 aac_at_decoder_deps="audiotoolbox"
 ac3_at_decoder_deps="audiotoolbox"
+ac3_at_decoder_select="ac3_parser"
 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
 alac_at_decoder_deps="audiotoolbox"
 amr_nb_at_decoder_deps="audiotoolbox"
 eac3_at_decoder_deps="audiotoolbox"
+eac3_at_decoder_select="ac3_parser"
 gsm_ms_at_decoder_deps="audiotoolbox"
 ilbc_at_decoder_deps="audiotoolbox"
 mp1_at_decoder_deps="audiotoolbox"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8e6563c..ec41446 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -810,9 +810,9 @@ OBJS-$(CONFIG_AMR_NB_AT_DECODER)  += 
audiotoolboxdec.o
 OBJS-$(CONFIG_EAC3_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_GSM_MS_AT_DECODER)  += audiotoolboxdec.o
 OBJS-$(CONFIG_ILBC_AT_DECODER)+= audiotoolboxdec.o
-OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o
-OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o
-OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o 
mpegaudiodecheader.o
+OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o 
mpegaudiodecheader.o
+OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o 
mpegaudiodecheader.o
 OBJS-$(CONFIG_PCM_MULAW_AT_DECODER)   += audiotoolboxdec.o
 OBJS-$(CONFIG_PCM_ALAW_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_QDMC_AT_DECODER)+= audiotoolboxdec.o
diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index f840a6b..9db1ad9 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -24,8 +24,10 @@
 
 #include "config.h"
 #include "avcodec.h"
+#include "ac3_parser.h"
 #include "bytestream.h"
 #include "internal.h"
+#include "mpegaudiodecheader.h"
 #include "libavutil/avassert.h"
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
@@ -220,20 +222,16 @@ static void put_descr(PutByteContext *pb, int tag, 
unsigned int size)
 bytestream2_put_byte(pb, size & 0x7F);
 }
 
-static int ffat_set_extradata(AVCodecContext *avctx)
+static uint8_t* ffat_get_magic_cookie(AVCodecContext *avctx, UInt32 
*cookie_size)
 {
-ATDecodeContext *at = avctx->priv_data;
-if (avctx->extradata_size) {
-OSStatus status;
-char *extradata = avctx->extradata;
-int extradata_size = avctx->extradata_size;
 if (avctx->codec_id == AV_CODEC_ID_AAC) {
+char *extradata;
 PutByteContext pb;
-extradata_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
-if (!(extradata = av_malloc(extradata_size)))
-return AVERROR(ENOMEM);
+*cookie_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
+if (!(extradata = av_malloc(*cookie_size)))
+return NULL;
 
-bytestream2_init_writer(, extradata, extradata_size);
+bytestream2_init_writer(, extradata, *cookie_size);
 
 // ES descriptor
 put_descr(, 0x03, 3 + 5+13 + 5+avctx->extradata_size);
@@ -256,21 +254,36 @@ static int ffat_set_extradata(AVCodecContext *avctx)
 // DecoderSpecific info descriptor
 put_descr(, 0x05, avctx->extradata_size);
 bytestream2_put_buffer(, avctx->extradata, 
avctx->extradata_size);
-}
+return extradata;
+} else {
+*cookie_size = avctx->extradata_size;
+return avctx->extradata;
+}
+}
+
+static int ffat_set_extradata(AVCodecContext *avctx)
+{
+ATDecodeContext *at = avctx->priv_data;
+if (avctx->extradata_size) {
+OSStatus status;
+UInt32 cookie_size;
+uint8_t *cookie = ffat_get_magic_cookie(avctx, _size);
+if (!cookie)
+return AVERROR(ENOMEM);
 
 status = AudioConverterSetProperty(at->converter,

kAudioConverterDecompressionMagicCookie,
-  

[FFmpeg-cvslog] lavf/audiotoolboxdec: only send extradata for formats that use it

2016-04-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
20:27:03 2016 -0500| [c11157c09a11ad3f80ace4dc6832eef7067db72a] | committer: 
Rodger Combs

lavf/audiotoolboxdec: only send extradata for formats that use it

Fixes initialization errors for some AVI files

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

 libavcodec/audiotoolboxdec.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 2740648..80b1f33 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -261,10 +261,17 @@ static uint8_t* ffat_get_magic_cookie(AVCodecContext 
*avctx, UInt32 *cookie_size
 }
 }
 
+static av_cold int ffat_usable_extradata(AVCodecContext *avctx)
+{
+return avctx->extradata_size &&
+   (avctx->codec_id == AV_CODEC_ID_ALAC ||
+avctx->codec_id == AV_CODEC_ID_AAC);
+}
+
 static int ffat_set_extradata(AVCodecContext *avctx)
 {
 ATDecodeContext *at = avctx->priv_data;
-if (avctx->extradata_size) {
+if (ffat_usable_extradata(avctx)) {
 OSStatus status;
 UInt32 cookie_size;
 uint8_t *cookie = ffat_get_magic_cookie(avctx, _size);
@@ -305,7 +312,7 @@ static av_cold int ffat_create_decoder(AVCodecContext 
*avctx, AVPacket *pkt)
 
 avctx->sample_fmt = sample_fmt;
 
-if (avctx->extradata) {
+if (ffat_usable_extradata(avctx)) {
 UInt32 format_size = sizeof(in_format);
 UInt32 cookie_size;
 uint8_t *cookie = ffat_get_magic_cookie(avctx, _size);
@@ -384,7 +391,7 @@ static av_cold int ffat_create_decoder(AVCodecContext 
*avctx, AVPacket *pkt)
 
 static av_cold int ffat_init_decoder(AVCodecContext *avctx)
 {
-if ((avctx->channels && avctx->sample_rate) || avctx->extradata_size)
+if ((avctx->channels && avctx->sample_rate) || 
ffat_usable_extradata(avctx))
 return ffat_create_decoder(avctx, NULL);
 else
 return 0;

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


[FFmpeg-cvslog] lavf/audiotoolboxdec: only provide block alignment for ILBC

2016-04-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
20:28:32 2016 -0500| [c890bcbacf321ebd135b952e748f546c9723ec2e] | committer: 
Rodger Combs

lavf/audiotoolboxdec: only provide block alignment for ILBC

Fixes decode errors for some AVI files

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

 libavcodec/audiotoolboxdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 80b1f33..31e14d4 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -301,7 +301,7 @@ static av_cold int ffat_create_decoder(AVCodecContext 
*avctx, AVPacket *pkt)
 
 AudioStreamBasicDescription in_format = {
 .mFormatID = ffat_get_format_id(avctx->codec_id, avctx->profile),
-.mBytesPerPacket = avctx->block_align,
+.mBytesPerPacket = (avctx->codec_id == AV_CODEC_ID_ILBC) ? 
avctx->block_align : 0,
 };
 AudioStreamBasicDescription out_format = {
 .mFormatID = kAudioFormatLinearPCM,

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


[FFmpeg-cvslog] lavc/audiotoolboxdec: reindent

2016-04-13 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Apr  7 
20:44:47 2016 -0500| [acd5910e39be56ea0486b71148626881bf7056a8] | committer: 
Rodger Combs

lavc/audiotoolboxdec: reindent

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

 libavcodec/audiotoolboxdec.c |   46 +-
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 9db1ad9..2740648 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -224,37 +224,37 @@ static void put_descr(PutByteContext *pb, int tag, 
unsigned int size)
 
 static uint8_t* ffat_get_magic_cookie(AVCodecContext *avctx, UInt32 
*cookie_size)
 {
-if (avctx->codec_id == AV_CODEC_ID_AAC) {
-char *extradata;
-PutByteContext pb;
-*cookie_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
-if (!(extradata = av_malloc(*cookie_size)))
-return NULL;
+if (avctx->codec_id == AV_CODEC_ID_AAC) {
+char *extradata;
+PutByteContext pb;
+*cookie_size = 5 + 3 + 5+13 + 5+avctx->extradata_size;
+if (!(extradata = av_malloc(*cookie_size)))
+return NULL;
 
-bytestream2_init_writer(, extradata, *cookie_size);
+bytestream2_init_writer(, extradata, *cookie_size);
 
-// ES descriptor
-put_descr(, 0x03, 3 + 5+13 + 5+avctx->extradata_size);
-bytestream2_put_be16(, 0);
-bytestream2_put_byte(, 0x00); // flags (= no flags)
+// ES descriptor
+put_descr(, 0x03, 3 + 5+13 + 5+avctx->extradata_size);
+bytestream2_put_be16(, 0);
+bytestream2_put_byte(, 0x00); // flags (= no flags)
 
-// DecoderConfig descriptor
-put_descr(, 0x04, 13 + 5+avctx->extradata_size);
+// DecoderConfig descriptor
+put_descr(, 0x04, 13 + 5+avctx->extradata_size);
 
-// Object type indication
-bytestream2_put_byte(, 0x40);
+// Object type indication
+bytestream2_put_byte(, 0x40);
 
-bytestream2_put_byte(, 0x15); // flags (= Audiostream)
+bytestream2_put_byte(, 0x15); // flags (= Audiostream)
 
-bytestream2_put_be24(, 0); // Buffersize DB
+bytestream2_put_be24(, 0); // Buffersize DB
 
-bytestream2_put_be32(, 0); // maxbitrate
-bytestream2_put_be32(, 0); // avgbitrate
+bytestream2_put_be32(, 0); // maxbitrate
+bytestream2_put_be32(, 0); // avgbitrate
 
-// DecoderSpecific info descriptor
-put_descr(, 0x05, avctx->extradata_size);
-bytestream2_put_buffer(, avctx->extradata, 
avctx->extradata_size);
-return extradata;
+// DecoderSpecific info descriptor
+put_descr(, 0x05, avctx->extradata_size);
+bytestream2_put_buffer(, avctx->extradata, avctx->extradata_size);
+return extradata;
 } else {
 *cookie_size = avctx->extradata_size;
 return avctx->extradata;

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


[FFmpeg-cvslog] lavf/segment: slight refactor to seg_write_packet

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sun Mar  6 
20:43:37 2016 -0600| [5b4f44f66ae3c42b7497929b6ef5f67e8b1ff0ad] | committer: 
Rodger Combs

lavf/segment: slight refactor to seg_write_packet

This reduces some code duplication, and ensures that cur_entry.last_duration is
always set.

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

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

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 4c1e115..d6473f4 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -860,11 +860,13 @@ static int seg_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 seg->cur_entry.index = seg->segment_idx + seg->segment_idx_wrap * 
seg->segment_idx_wrap_nb;
 seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base);
 seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, 
AV_TIME_BASE_Q);
-seg->cur_entry.end_time = seg->cur_entry.start_time +
-pkt->pts != AV_NOPTS_VALUE ? (double)(pkt->pts + pkt->duration) * 
av_q2d(st->time_base) : 0;
-} else if (pkt->pts != AV_NOPTS_VALUE && pkt->stream_index == 
seg->reference_stream_index) {
-seg->cur_entry.end_time =
-FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + pkt->duration) 
* av_q2d(st->time_base));
+seg->cur_entry.end_time = seg->cur_entry.start_time;
+}
+
+if (pkt->stream_index == seg->reference_stream_index) {
+if (pkt->pts != AV_NOPTS_VALUE)
+seg->cur_entry.end_time =
+FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + 
pkt->duration) * av_q2d(st->time_base));
 seg->cur_entry.last_duration = pkt->duration;
 }
 

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


[FFmpeg-cvslog] lavf/segment: add option to write empty filler segments as needed

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sun Mar  6 
20:48:57 2016 -0600| [4b150fbe1f3905f8245f63d74ff72f2ef92d9717] | committer: 
Rodger Combs

lavf/segment: add option to write empty filler segments as needed

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

 doc/muxers.texi   |5 +
 libavformat/segment.c |8 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index c36c72c..2aafbad 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1238,6 +1238,11 @@ muxers/codecs. It is set to @code{0} by default.
 @item initial_offset @var{offset}
 Specify timestamp offset to apply to the output packet timestamps. The
 argument must be a time duration specification, and defaults to 0.
+
+@item write_empty_segments @var{1|0}
+If enabled, write an empty segment if there are no packets during the period a
+segment would usually span. Otherwise, the segment will be filled with the next
+packet written. Defaults to @code{0}.
 @end table
 
 @subsection Examples
diff --git a/libavformat/segment.c b/libavformat/segment.c
index d6473f4..9527c87 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -118,6 +118,7 @@ typedef struct SegmentContext {
 char *reference_stream_specifier; ///< reference stream specifier
 int   reference_stream_index;
 int   break_non_keyframes;
+int   write_empty;
 
 int use_rename;
 char temp_list_filename[1024];
@@ -810,6 +811,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 if (!seg->avf)
 return AVERROR(EINVAL);
 
+calc_times:
 if (seg->times) {
 end_pts = seg->segment_count < seg->nb_times ?
 seg->times[seg->segment_count] : INT64_MAX;
@@ -841,7 +843,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 
 if (pkt->stream_index == seg->reference_stream_index &&
 (pkt->flags & AV_PKT_FLAG_KEY || seg->break_non_keyframes) &&
-seg->segment_frame_count > 0 &&
+(seg->segment_frame_count > 0 || seg->write_empty) &&
 (seg->cut_pending || seg->frame_count >= start_frame ||
  (pkt->pts != AV_NOPTS_VALUE &&
   av_compare_ts(pkt->pts, st->time_base,
@@ -861,6 +863,9 @@ static int seg_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base);
 seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, 
AV_TIME_BASE_Q);
 seg->cur_entry.end_time = seg->cur_entry.start_time;
+
+if (seg->times || (!seg->frames && !seg->use_clocktime) && 
seg->write_empty)
+goto calc_times;
 }
 
 if (pkt->stream_index == seg->reference_stream_index) {
@@ -1010,6 +1015,7 @@ static const AVOption options[] = {
 { "write_header_trailer", "write a header to the first segment and a 
trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_BOOL, {.i64 
= 1}, 0, 1, E },
 { "reset_timestamps", "reset timestamps at the begin of each segment", 
OFFSET(reset_timestamps), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, E },
 { "initial_offset", "set initial timestamp offset", 
OFFSET(initial_offset), AV_OPT_TYPE_DURATION, {.i64 = 0}, -INT64_MAX, 
INT64_MAX, E },
+{ "write_empty_segments", "allow writing empty 'filler' segments", 
OFFSET(write_empty), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, E },
 { NULL },
 };
 

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


[FFmpeg-cvslog] lavc/audiotoolboxenc: remove unneeded packet metadata

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 23 
16:29:50 2016 -0500| [7524b678175e69504c9360c884cfe9116cb8bb11] | committer: 
Rodger Combs

lavc/audiotoolboxenc: remove unneeded packet metadata

This isn't necessary here, and for some reason broke only multichannel
AAC encoding when a channel layout tag was set.

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

 libavcodec/audiotoolboxenc.c |   16 +++-
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index c4d36f5..4797b2a 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -38,7 +38,6 @@ typedef struct ATDecodeContext {
 int quality;
 
 AudioConverterRef converter;
-AudioStreamPacketDescription pkt_desc;
 AVFrame in_frame;
 AVFrame new_in_frame;
 
@@ -312,10 +311,6 @@ static OSStatus ffat_encode_callback(AudioConverterRef 
converter, UInt32 *nb_pac
 
 if (at->eof) {
 *nb_packets = 0;
-if (packets) {
-*packets = >pkt_desc;
-at->pkt_desc.mDataByteSize = 0;
-}
 return 0;
 }
 
@@ -328,18 +323,13 @@ static OSStatus ffat_encode_callback(AudioConverterRef 
converter, UInt32 *nb_pac
 }
 
 data->mNumberBuffers  = 1;
-data->mBuffers[0].mNumberChannels = 0;
+data->mBuffers[0].mNumberChannels = avctx->channels;
 data->mBuffers[0].mDataByteSize   = at->in_frame.nb_samples *
 
av_get_bytes_per_sample(avctx->sample_fmt) *
 avctx->channels;
 data->mBuffers[0].mData   = at->in_frame.data[0];
-*nb_packets = (at->in_frame.nb_samples + (at->frame_size - 1)) / 
at->frame_size;
-
-if (packets) {
-*packets = >pkt_desc;
-at->pkt_desc.mDataByteSize = data->mBuffers[0].mDataByteSize;
-at->pkt_desc.mVariableFramesInPacket = at->in_frame.nb_samples;
-}
+if (*nb_packets > at->in_frame.nb_samples)
+*nb_packets = at->in_frame.nb_samples;
 
 return 0;
 }

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


[FFmpeg-cvslog] lavc/audiotoolboxdec: support ADTS AAC input

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 23 
21:50:41 2016 -0500| [59a44923711b867015af3ba7fad92f9fa66964eb] | committer: 
Rodger Combs

lavc/audiotoolboxdec: support ADTS AAC input

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

 libavcodec/audiotoolboxdec.c |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 270e07f..1fa6f16 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -37,6 +37,7 @@ typedef struct ATDecodeContext {
 AudioStreamPacketDescription pkt_desc;
 AVPacket in_pkt;
 AVPacket new_in_pkt;
+AVBitStreamFilterContext *bsf;
 
 unsigned pkt_size;
 int64_t last_pts;
@@ -233,6 +234,8 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
 {
 ATDecodeContext *at = avctx->priv_data;
 AVFrame *frame = data;
+int pkt_size = avpkt->size;
+AVPacket filtered_packet;
 OSStatus ret;
 
 AudioBufferList out_buffers = {
@@ -245,11 +248,41 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
 }
 };
 
+if (avctx->codec_id == AV_CODEC_ID_AAC && avpkt->size > 2 &&
+(AV_RB16(avpkt->data) & 0xfff0) == 0xfff0) {
+int first = 0;
+uint8_t *p_filtered = NULL;
+int  n_filtered = 0;
+if (!at->bsf) {
+first = 1;
+if(!(at->bsf = av_bitstream_filter_init("aac_adtstoasc")))
+return AVERROR(ENOMEM);
+}
+
+ret = av_bitstream_filter_filter(at->bsf, avctx, NULL, _filtered, 
_filtered,
+ avpkt->data, avpkt->size, 0);
+if (ret >= 0 && p_filtered != avpkt->data) {
+filtered_packet = *avpkt;
+avpkt = _packet;
+avpkt->data = p_filtered;
+avpkt->size = n_filtered;
+}
+
+if (first) {
+if ((ret = ffat_set_extradata(avctx)) < 0)
+return ret;
+ffat_update_ctx(avctx);
+out_buffers.mBuffers[0].mNumberChannels = avctx->channels;
+out_buffers.mBuffers[0].mDataByteSize = 
av_get_bytes_per_sample(avctx->sample_fmt) * at->pkt_size * avctx->channels;
+}
+}
+
 av_packet_unref(>new_in_pkt);
 
 if (avpkt->size) {
 if ((ret = av_packet_ref(>new_in_pkt, avpkt)) < 0)
 return ret;
+at->new_in_pkt.data = avpkt->data;
 } else {
 at->eof = 1;
 }
@@ -275,7 +308,7 @@ static int ffat_decode(AVCodecContext *avctx, void *data,
 at->last_pts = avpkt->pts;
 }
 
-return avpkt->size;
+return pkt_size;
 }
 
 static av_cold void ffat_decode_flush(AVCodecContext *avctx)

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


[FFmpeg-cvslog] lavf/segment: support automatic bitstream filtering

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 23 
09:24:22 2016 -0500| [d38fe9f4930cba9379c1309c2433420a360f40ab] | committer: 
Rodger Combs

lavf/segment: support automatic bitstream filtering

Most useful for MPEG-TS. Works by having the underlying muxer configure the
bitstream filters, then moving them to our own AVStreams.

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

 libavformat/segment.c |   30 +-
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 9ed1987..2931905 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -632,10 +632,10 @@ static void seg_free_context(SegmentContext *seg)
 seg->avf = NULL;
 }
 
-static int seg_write_header(AVFormatContext *s)
+static int seg_init(AVFormatContext *s)
 {
 SegmentContext *seg = s->priv_data;
-AVFormatContext *oc = NULL;
+AVFormatContext *oc = seg->avf;
 AVDictionary *options = NULL;
 int ret;
 int i;
@@ -706,6 +706,7 @@ static int seg_write_header(AVFormatContext *s)
 seg->use_rename = proto && !strcmp(proto, "file");
 }
 }
+
 if (seg->list_type == LIST_TYPE_EXT)
 av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in 
favor of 'csv'\n");
 
@@ -730,10 +731,10 @@ static int seg_write_header(AVFormatContext *s)
 
 if ((ret = segment_mux_init(s)) < 0)
 goto fail;
-oc = seg->avf;
 
 if ((ret = set_segment_filename(s)) < 0)
 goto fail;
+oc = seg->avf;
 
 if (seg->write_header_trailer) {
 if ((ret = s->io_open(s, >pb,
@@ -948,6 +949,23 @@ fail:
 return ret;
 }
 
+static int seg_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
+{
+SegmentContext *seg = s->priv_data;
+AVFormatContext *oc = seg->avf;
+if (oc->oformat->check_bitstream) {
+int ret = oc->oformat->check_bitstream(oc, pkt);
+if (ret == 1) {
+AVStream *st = s->streams[pkt->stream_index];
+AVStream *ost = oc->streams[pkt->stream_index];
+st->internal->bsfc = ost->internal->bsfc;
+ost->internal->bsfc = NULL;
+}
+return ret;
+}
+return 1;
+}
+
 #define OFFSET(x) offsetof(SegmentContext, x)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
@@ -1005,9 +1023,10 @@ AVOutputFormat ff_segment_muxer = {
 .long_name  = NULL_IF_CONFIG_SMALL("segment"),
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE|AVFMT_GLOBALHEADER,
-.write_header   = seg_write_header,
+.init   = seg_init,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
+.check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };
 
@@ -1023,8 +1042,9 @@ AVOutputFormat ff_stream_segment_muxer = {
 .long_name  = NULL_IF_CONFIG_SMALL("streaming segment muxer"),
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE,
-.write_header   = seg_write_header,
+.init   = seg_init,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
+.check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };

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


[FFmpeg-cvslog] lavc/audiotoolboxenc: fix a number of config issues

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 23 
16:46:39 2016 -0500| [c820e600eac44ae722760b69ae920f14a79ec3eb] | committer: 
Rodger Combs

lavc/audiotoolboxenc: fix a number of config issues

- size variables were used in a confusing way
- incorrect size var use led to channel layouts not being set properly
- channel layouts were incorrectly mapped for >2-channel AAC
- bitrates not accepted by the encoder were discarded instead of being clamped
- some minor style/indentation fixes

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

 libavcodec/audiotoolboxenc.c |  198 +-
 1 file changed, 176 insertions(+), 22 deletions(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index 4797b2a..22352da 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -146,6 +146,86 @@ static int get_ilbc_mode(AVCodecContext *avctx)
 return 30;
 }
 
+static av_cold int get_channel_label(int channel)
+{
+uint64_t map = 1 << channel;
+if (map <= AV_CH_LOW_FREQUENCY)
+return channel + 1;
+else if (map <= AV_CH_BACK_RIGHT)
+return channel + 29;
+else if (map <= AV_CH_BACK_CENTER)
+return channel - 1;
+else if (map <= AV_CH_SIDE_RIGHT)
+return channel - 4;
+else if (map <= AV_CH_TOP_BACK_RIGHT)
+return channel + 1;
+else if (map <= AV_CH_STEREO_RIGHT)
+return -1;
+else if (map <= AV_CH_WIDE_RIGHT)
+return channel + 4;
+else if (map <= AV_CH_SURROUND_DIRECT_RIGHT)
+return channel - 23;
+else if (map == AV_CH_LOW_FREQUENCY_2)
+return kAudioChannelLabel_LFE2;
+else
+return -1;
+}
+
+static int remap_layout(AudioChannelLayout *layout, uint64_t in_layout, int 
count)
+{
+int i;
+int c = 0;
+layout->mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelDescriptions;
+layout->mNumberChannelDescriptions = count;
+for (i = 0; i < count; i++) {
+int label;
+while (!(in_layout & (1 << c)) && c < 64)
+c++;
+if (c == 64)
+return AVERROR(EINVAL); // This should never happen
+label = get_channel_label(c);
+layout->mChannelDescriptions[i].mChannelLabel = label;
+if (label < 0)
+return AVERROR(EINVAL);
+c++;
+}
+return 0;
+}
+
+static int get_aac_tag(uint64_t in_layout)
+{
+switch (in_layout) {
+case AV_CH_LAYOUT_MONO:
+return kAudioChannelLayoutTag_Mono;
+case AV_CH_LAYOUT_STEREO:
+return kAudioChannelLayoutTag_Stereo;
+case AV_CH_LAYOUT_QUAD:
+return kAudioChannelLayoutTag_AAC_Quadraphonic;
+case AV_CH_LAYOUT_OCTAGONAL:
+return kAudioChannelLayoutTag_AAC_Octagonal;
+case AV_CH_LAYOUT_SURROUND:
+return kAudioChannelLayoutTag_AAC_3_0;
+case AV_CH_LAYOUT_4POINT0:
+return kAudioChannelLayoutTag_AAC_4_0;
+case AV_CH_LAYOUT_5POINT0:
+return kAudioChannelLayoutTag_AAC_5_0;
+case AV_CH_LAYOUT_5POINT1:
+return kAudioChannelLayoutTag_AAC_5_1;
+case AV_CH_LAYOUT_6POINT0:
+return kAudioChannelLayoutTag_AAC_6_0;
+case AV_CH_LAYOUT_6POINT1:
+return kAudioChannelLayoutTag_AAC_6_1;
+case AV_CH_LAYOUT_7POINT0:
+return kAudioChannelLayoutTag_AAC_7_0;
+case AV_CH_LAYOUT_7POINT1_WIDE_BACK:
+return kAudioChannelLayoutTag_AAC_7_1;
+case AV_CH_LAYOUT_7POINT1:
+return kAudioChannelLayoutTag_MPEG_7_1_C;
+default:
+return 0;
+}
+}
+
 static av_cold int ffat_init_encoder(AVCodecContext *avctx)
 {
 ATDecodeContext *at = avctx->priv_data;
@@ -170,11 +250,12 @@ static av_cold int ffat_init_encoder(AVCodecContext 
*avctx)
 .mFormatID = ffat_get_format_id(avctx->codec_id, avctx->profile),
 .mChannelsPerFrame = in_format.mChannelsPerFrame,
 };
-AudioChannelLayout channel_layout = {
-.mChannelLayoutTag = kAudioChannelLayoutTag_UseChannelBitmap,
-.mChannelBitmap = avctx->channel_layout,
-};
-UInt32 size = sizeof(channel_layout);
+UInt32 layout_size = sizeof(AudioChannelLayout) +
+ sizeof(AudioChannelDescription) * avctx->channels;
+AudioChannelLayout *channel_layout = av_malloc(layout_size);
+
+if (!channel_layout)
+return AVERROR(ENOMEM);
 
 if (avctx->codec_id == AV_CODEC_ID_ILBC) {
 int mode = get_ilbc_mode(avctx);
@@ -186,22 +267,45 @@ static av_cold int ffat_init_encoder(AVCodecContext 
*avctx)
 
 if (status != 0) {
 av_log(avctx, AV_LOG_ERROR, "AudioToolbox init error: %i\n", 
(int)status);
+av_free(channel_layout);
 return AVERROR_UNKNOWN;
 }
 
-size = sizeof(UInt32);
+if (!avctx->channel_layout)
+avctx->channel_

[FFmpeg-cvslog] lavc/audiotoolboxdec: add eac3 decoder

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar 30 
20:55:32 2016 -0500| [b4daa2c40fb77974af6814cc0baaeec6a7481101] | committer: 
Rodger Combs

lavc/audiotoolboxdec: add eac3 decoder

This is added in 10.11, so we add a #define when building against older SDKs.

The decoder actually supports 7.1-channel eac3, but since the parser only
reports 6 channels, we end up decoding the 5.1 downmix (same as the internal
decoder) for now.

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

 configure|1 +
 libavcodec/Makefile  |1 +
 libavcodec/allcodecs.c   |1 +
 libavcodec/audiotoolboxdec.c |7 +++
 4 files changed, 10 insertions(+)

diff --git a/configure b/configure
index e8c4a7b..94a66d8 100755
--- a/configure
+++ b/configure
@@ -2650,6 +2650,7 @@ ac3_at_decoder_deps="audiotoolbox"
 adpcm_ima_qt_at_decoder_deps="audiotoolbox"
 alac_at_decoder_deps="audiotoolbox"
 amr_nb_at_decoder_deps="audiotoolbox"
+eac3_at_decoder_deps="audiotoolbox"
 gsm_ms_at_decoder_deps="audiotoolbox"
 ilbc_at_decoder_deps="audiotoolbox"
 mp1_at_decoder_deps="audiotoolbox"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 8c14268..801cccd 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -806,6 +806,7 @@ OBJS-$(CONFIG_AC3_AT_DECODER) += 
audiotoolboxdec.o
 OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_ALAC_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_AMR_NB_AT_DECODER)  += audiotoolboxdec.o
+OBJS-$(CONFIG_EAC3_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_GSM_MS_AT_DECODER)  += audiotoolboxdec.o
 OBJS-$(CONFIG_ILBC_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index f498041..0bbf7d3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -568,6 +568,7 @@ void avcodec_register_all(void)
 REGISTER_DECODER(ADPCM_IMA_QT_AT,   adpcm_ima_qt_at);
 REGISTER_ENCDEC (ALAC_AT,   alac_at);
 REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
+REGISTER_DECODER(EAC3_AT,   eac3_at);
 REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
 REGISTER_ENCDEC (ILBC_AT,   ilbc_at);
 REGISTER_DECODER(MP1_AT,mp1_at);
diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 4ff46ea..f840a6b 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -30,6 +30,10 @@
 #include "libavutil/opt.h"
 #include "libavutil/log.h"
 
+#ifndef __MAC_10_11
+#define kAudioFormatEnhancedAC3 'ec-3'
+#endif
+
 typedef struct ATDecodeContext {
 AVClass *av_class;
 
@@ -58,6 +62,8 @@ static UInt32 ffat_get_format_id(enum AVCodecID codec, int 
profile)
 return kAudioFormatAppleLossless;
 case AV_CODEC_ID_AMR_NB:
 return kAudioFormatAMR;
+case AV_CODEC_ID_EAC3:
+return kAudioFormatEnhancedAC3;
 case AV_CODEC_ID_GSM_MS:
 return kAudioFormatMicrosoftGSM;
 case AV_CODEC_ID_ILBC:
@@ -512,6 +518,7 @@ FFAT_DEC(ac3,  AV_CODEC_ID_AC3)
 FFAT_DEC(adpcm_ima_qt, AV_CODEC_ID_ADPCM_IMA_QT)
 FFAT_DEC(alac, AV_CODEC_ID_ALAC)
 FFAT_DEC(amr_nb,   AV_CODEC_ID_AMR_NB)
+FFAT_DEC(eac3, AV_CODEC_ID_EAC3)
 FFAT_DEC(gsm_ms,   AV_CODEC_ID_GSM_MS)
 FFAT_DEC(ilbc, AV_CODEC_ID_ILBC)
 FFAT_DEC(mp1,  AV_CODEC_ID_MP1)

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


[FFmpeg-cvslog] lavc/audiotoolboxenc: fix iOS build

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Mar 24 
10:17:42 2016 -0500| [0667327f3fc7cad854712fcdbe13b7d15c791426] | committer: 
Rodger Combs

lavc/audiotoolboxenc: fix iOS build

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

 libavcodec/audiotoolboxenc.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index 22352da..2fca15b 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -307,6 +307,7 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
   sizeof(avctx->bits_per_raw_sample),
   >bits_per_raw_sample);
 
+#if !TARGET_OS_IPHONE
 if (at->mode == -1)
 at->mode = (avctx->flags & AV_CODEC_FLAG_QSCALE) ?
kAudioCodecBitRateControlMode_Variable :
@@ -325,7 +326,9 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
 q = 127 - q * 9;
 AudioConverterSetProperty(at->converter, 
kAudioCodecPropertySoundQualityForVBR,
   sizeof(q), );
-} else if (avctx->bit_rate > 0) {
+} else
+#endif
+if (avctx->bit_rate > 0) {
 UInt32 rate = avctx->bit_rate;
 UInt32 size;
 status = AudioConverterGetPropertyInfo(at->converter,
@@ -553,12 +556,14 @@ static const AVProfile aac_profiles[] = {
 
 #define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
+#if !TARGET_OS_IPHONE
 {"aac_at_mode", "ratecontrol mode", offsetof(ATDecodeContext, mode), 
AV_OPT_TYPE_INT, {.i64 = -1}, -1, kAudioCodecBitRateControlMode_Variable, AE, 
"mode"},
 {"auto", "VBR if global quality is given; CBR otherwise", 0, 
AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, AE, "mode"},
 {"cbr",  "constant bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = 
kAudioCodecBitRateControlMode_Constant}, INT_MIN, INT_MAX, AE, "mode"},
 {"abr",  "long-term average bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = 
kAudioCodecBitRateControlMode_LongTermAverage}, INT_MIN, INT_MAX, AE, "mode"},
 {"cvbr", "constrained variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = 
kAudioCodecBitRateControlMode_VariableConstrained}, INT_MIN, INT_MAX, AE, 
"mode"},
 {"vbr" , "variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = 
kAudioCodecBitRateControlMode_Variable}, INT_MIN, INT_MAX, AE, "mode"},
+#endif
 {"aac_at_quality", "quality vs speed control", offsetof(ATDecodeContext, 
quality), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 2, AE},
 { NULL },
 };

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


[FFmpeg-cvslog] lavc/audiotoolboxdec: fix a number of config and timestamp issues

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Mar 24 
00:49:51 2016 -0500| [1b9e90ee80be92c8e14349a8fc74b4560a46e648] | committer: 
Rodger Combs

lavc/audiotoolboxdec: fix a number of config and timestamp issues

- ADTS-formatted AAC didn't work
- Channel layouts were never exported
- Channel mappings were incorrect beyond stereo
- Channel counts weren't updated after packets were decoded
- Timestamps were exported incorrectly

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

 libavcodec/audiotoolboxdec.c |  286 --
 1 file changed, 221 insertions(+), 65 deletions(-)

diff --git a/libavcodec/audiotoolboxdec.c b/libavcodec/audiotoolboxdec.c
index 1fa6f16..4ff46ea 100644
--- a/libavcodec/audiotoolboxdec.c
+++ b/libavcodec/audiotoolboxdec.c
@@ -38,8 +38,9 @@ typedef struct ATDecodeContext {
 AVPacket in_pkt;
 AVPacket new_in_pkt;
 AVBitStreamFilterContext *bsf;
+char *decoded_data;
+int channel_map[64];
 
-unsigned pkt_size;
 int64_t last_pts;
 int eof;
 } ATDecodeContext;
@@ -81,20 +82,127 @@ static UInt32 ffat_get_format_id(enum AVCodecID codec, int 
profile)
 }
 }
 
-static void ffat_update_ctx(AVCodecContext *avctx)
+static int ffat_get_channel_id(AudioChannelLabel label)
+{
+if (label == 0)
+return -1;
+else if (label <= kAudioChannelLabel_LFEScreen)
+return label - 1;
+else if (label <= kAudioChannelLabel_RightSurround)
+return label + 4;
+else if (label <= kAudioChannelLabel_CenterSurround)
+return label + 1;
+else if (label <= kAudioChannelLabel_RightSurroundDirect)
+return label + 23;
+else if (label <= kAudioChannelLabel_TopBackRight)
+return label - 1;
+else if (label < kAudioChannelLabel_RearSurroundLeft)
+return -1;
+else if (label <= kAudioChannelLabel_RearSurroundRight)
+return label - 29;
+else if (label <= kAudioChannelLabel_RightWide)
+return label - 4;
+else if (label == kAudioChannelLabel_LFE2)
+return ff_ctzll(AV_CH_LOW_FREQUENCY_2);
+else if (label == kAudioChannelLabel_Mono)
+return ff_ctzll(AV_CH_FRONT_CENTER);
+else
+return -1;
+}
+
+static int ffat_compare_channel_descriptions(const void* a, const void* b)
+{
+const AudioChannelDescription* da = a;
+const AudioChannelDescription* db = b;
+return ffat_get_channel_id(da->mChannelLabel) - 
ffat_get_channel_id(db->mChannelLabel);
+}
+
+static AudioChannelLayout *ffat_convert_layout(AudioChannelLayout *layout, 
UInt32* size)
+{
+AudioChannelLayoutTag tag = layout->mChannelLayoutTag;
+AudioChannelLayout *new_layout;
+if (tag == kAudioChannelLayoutTag_UseChannelDescriptions)
+return layout;
+else if (tag == kAudioChannelLayoutTag_UseChannelBitmap)
+AudioFormatGetPropertyInfo(kAudioFormatProperty_ChannelLayoutForBitmap,
+   sizeof(UInt32), >mChannelBitmap, 
size);
+else
+AudioFormatGetPropertyInfo(kAudioFormatProperty_ChannelLayoutForTag,
+   sizeof(AudioChannelLayoutTag), , size);
+new_layout = av_malloc(*size);
+if (!new_layout) {
+av_free(layout);
+return NULL;
+}
+if (tag == kAudioChannelLayoutTag_UseChannelBitmap)
+AudioFormatGetProperty(kAudioFormatProperty_ChannelLayoutForBitmap,
+   sizeof(UInt32), >mChannelBitmap, size, 
new_layout);
+else
+AudioFormatGetProperty(kAudioFormatProperty_ChannelLayoutForTag,
+   sizeof(AudioChannelLayoutTag), , size, 
new_layout);
+new_layout->mChannelLayoutTag = 
kAudioChannelLayoutTag_UseChannelDescriptions;
+av_free(layout);
+return new_layout;
+}
+
+static int ffat_update_ctx(AVCodecContext *avctx)
 {
 ATDecodeContext *at = avctx->priv_data;
-AudioStreamBasicDescription in_format;
-UInt32 size = sizeof(in_format);
+AudioStreamBasicDescription format;
+UInt32 size = sizeof(format);
 if (!AudioConverterGetProperty(at->converter,

kAudioConverterCurrentInputStreamDescription,
-   , _format)) {
-avctx->channels = in_format.mChannelsPerFrame;
-at->pkt_size = in_format.mFramesPerPacket;
+   , )) {
+if (format.mSampleRate)
+avctx->sample_rate = format.mSampleRate;
+avctx->channels = format.mChannelsPerFrame;
+avctx->channel_layout = av_get_default_channel_layout(avctx->channels);
+avctx->frame_size = format.mFramesPerPacket;
+}
+
+if (!AudioConverterGetProperty(at->converter,
+   
kAudioConverterCurrentOutputStreamDescription,
+   , )) {
+ 

[FFmpeg-cvslog] lavc/audiotoolboxenc: allow setting maxrate with pre-10.9 deployment targets

2016-04-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Sun Mar 27 
12:17:25 2016 -0500| [36770d876937db538179f6c87b57e3b5b609013c] | committer: 
Rodger Combs

lavc/audiotoolboxenc: allow setting maxrate with pre-10.9 deployment targets

The build failure here is caused by the enum value not being defined, but
as long as we're on a newer SDK that has it, it's safe to use it even
when our deployment target is older. Setting the property will error, but
we're not failing on errors there.

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

 libavcodec/audiotoolboxenc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
index 2fca15b..855df0c 100644
--- a/libavcodec/audiotoolboxenc.c
+++ b/libavcodec/audiotoolboxenc.c
@@ -428,7 +428,7 @@ static av_cold int ffat_init_encoder(AVCodecContext *avctx)
 
 ffat_update_ctx(avctx);
 
-#if !TARGET_OS_IPHONE && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if !TARGET_OS_IPHONE && defined(__MAC_10_9)
 if (at->mode == kAudioCodecBitRateControlMode_Variable && 
avctx->rc_max_rate) {
 UInt32 max_size = avctx->rc_max_rate * avctx->frame_size / 
avctx->sample_rate;
 if (max_size)

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


[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-03-26 Thread Rodger Combs
ffmpeg | branch: release/3.0 | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 
18 12:57:37 2016 -0600| [bf8f2fae2ad8498496e21de82299c5d777b03d04] | committer: 
Michael Niedermayer

lavf/mov: fix sidx with edit lists
(cherry picked from commit 3617e69d50dd9dd07b5011dfb9477a9d1a630354)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 149e3b4..c5e0a1e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3609,7 +3609,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216

2016-03-26 Thread Rodger Combs
ffmpeg | branch: release/3.0 | Rodger Combs <rodger.co...@gmail.com> | Mon Feb 
22 18:34:01 2016 -0600| [3b179b630253466b325b44fd6355a4c8d3548b62] | committer: 
Michael Niedermayer

lavf/mov: downgrade sidx errors to non-fatal warnings; fixes trac #5216
(cherry picked from commit 22dbc1caaf13e4bb17c9e0164a5b1ccaf490e428)

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c5e0a1e..0408ad1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3666,7 +3666,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 version = avio_r8(pb);
 if (version > 1) {
 avpriv_request_sample(c->fc, "sidx version %u", version);
-return AVERROR_PATCHWELCOME;
+return 0;
 }
 
 avio_rb24(pb); // flags
@@ -3679,8 +3679,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 }
 if (!st) {
-av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id 
%d\n", track_id);
-return AVERROR_INVALIDDATA;
+av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id 
%d\n", track_id);
+return 0;
 }
 
 sc = st->priv_data;

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


[FFmpeg-cvslog] lavc: add AudioToolbox decoders

2016-03-22 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 18 
21:38:37 2016 -0600| [d5d328059e5195b67f7264faa431301ec584648b] | committer: 
Rodger Combs

lavc: add AudioToolbox decoders

Part of trac #4828

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

 Changelog|1 +
 configure|   24 +++
 libavcodec/Makefile  |   14 ++
 libavcodec/allcodecs.c   |   14 ++
 libavcodec/audiotoolboxdec.c |  334 ++
 libavcodec/version.h |4 +-
 6 files changed, 389 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 20f98ed..29d2290 100644
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@ version :
 - protocol blacklisting API
 - MediaCodec H264 decoding
 - VC-2 HQ RTP payload format (draft v1) depacketizer
+- AudioToolbox audio decoders
 
 
 version 3.0:
diff --git a/configure b/configure
index 764377c..cde3096 100755
--- a/configure
+++ b/configure
@@ -194,6 +194,7 @@ Individual component options:
   --disable-filtersdisable all filters
 
 External library support:
+  --disable-audiotoolbox   enable AudioToolbox decoders and encoders 
[autodetect]
   --enable-avisynthenable reading of AviSynth script files [no]
   --disable-bzlib  disable bzlib [autodetect]
   --enable-cudaenable dynamically linked CUDA [no]
@@ -1446,6 +1447,7 @@ EXAMPLE_LIST="
 "
 
 EXTERNAL_LIBRARY_LIST="
+audiotoolbox
 avisynth
 bzlib
 chromaprint
@@ -2506,6 +2508,10 @@ zlib_encoder_select="zlib"
 zmbv_decoder_select="zlib"
 zmbv_encoder_select="zlib"
 
+# platform codecs
+audiotoolbox_deps="AudioToolbox_AudioToolbox_h"
+audiotoolbox_extralibs="-framework CoreFoundation -framework AudioToolbox 
-framework CoreMedia"
+
 # hardware accelerators
 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
@@ -2641,6 +2647,20 @@ vc1_parser_select="vc1dsp"
 mjpeg2jpeg_bsf_select="jpegtables"
 
 # external libraries
+aac_at_decoder_deps="audiotoolbox"
+ac3_at_decoder_deps="audiotoolbox"
+adpcm_ima_qt_at_decoder_deps="audiotoolbox"
+alac_at_decoder_deps="audiotoolbox"
+amr_nb_at_decoder_deps="audiotoolbox"
+gsm_ms_at_decoder_deps="audiotoolbox"
+ilbc_at_decoder_deps="audiotoolbox"
+mp1_at_decoder_deps="audiotoolbox"
+mp2_at_decoder_deps="audiotoolbox"
+mp3_at_decoder_deps="audiotoolbox"
+pcm_alaw_at_decoder_deps="audiotoolbox"
+pcm_mulaw_at_decoder_deps="audiotoolbox"
+qdmc_at_decoder_deps="audiotoolbox"
+qdm2_at_decoder_deps="audiotoolbox"
 chromaprint_muxer_deps="chromaprint"
 h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
 libcelt_decoder_deps="libcelt"
@@ -3087,6 +3107,9 @@ enable valgrind_backtrace
 sws_max_filter_size_default=256
 set_default sws_max_filter_size
 
+# Enable platform codecs by default.
+enable audiotoolbox
+
 # Enable hwaccels by default.
 enable d3d11va dxva2 vaapi vda vdpau videotoolbox_hwaccel xvmc
 enable xlib
@@ -5365,6 +5388,7 @@ check_func_headers glob.h glob
 enabled xlib &&
 check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute 
-lXv -lX11 -lXext
 
+check_header AudioToolbox/AudioToolbox.h
 check_header direct.h
 check_header dirent.h
 check_header dlfcn.h
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6bb1af1..53d3f0d 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -801,6 +801,20 @@ OBJS-$(CONFIG_WEBM_MUXER)  += mpeg4audio.o 
mpegaudiodata.o  \
 OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
 
 # external codec libraries
+OBJS-$(CONFIG_AAC_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_AC3_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_ADPCM_IMA_QT_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_ALAC_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_AMR_NB_AT_DECODER)  += audiotoolboxdec.o
+OBJS-$(CONFIG_GSM_MS_AT_DECODER)  += audiotoolboxdec.o
+OBJS-$(CONFIG_ILBC_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_MP1_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_MP2_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_MP3_AT_DECODER) += audiotoolboxdec.o
+OBJS-$(CONFIG_PCM_MULAW_AT_DECODER)   += audiotoolboxdec.o
+OBJS-$(CONFIG_PCM_ALAW_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_QDMC_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_QDM2_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBDCADEC_DECODER)  += libdcadec.o dca.o
 OBJS-$(CONFIG_LIBFAAC

[FFmpeg-cvslog] lavc: add AudioToolbox encoders

2016-03-22 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Feb 23 
21:01:24 2016 -0600| [65cff814534cec948f255b48098ad9e543993132] | committer: 
Rodger Combs

lavc: add AudioToolbox encoders

Fixes trac #4828

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

 Changelog|1 +
 configure|   10 +
 libavcodec/Makefile  |5 +
 libavcodec/allcodecs.c   |   10 +-
 libavcodec/audiotoolboxenc.c |  471 ++
 libavcodec/version.h |2 +-
 6 files changed, 493 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index 29d2290..d70f6f0 100644
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,7 @@ version :
 - MediaCodec H264 decoding
 - VC-2 HQ RTP payload format (draft v1) depacketizer
 - AudioToolbox audio decoders
+- AudioToolbox audio encoders
 
 
 version 3.0:
diff --git a/configure b/configure
index cde3096..0987bcd 100755
--- a/configure
+++ b/configure
@@ -2661,6 +2661,16 @@ pcm_alaw_at_decoder_deps="audiotoolbox"
 pcm_mulaw_at_decoder_deps="audiotoolbox"
 qdmc_at_decoder_deps="audiotoolbox"
 qdm2_at_decoder_deps="audiotoolbox"
+aac_at_encoder_deps="audiotoolbox"
+aac_at_encoder_select="audio_frame_queue"
+alac_at_encoder_deps="audiotoolbox"
+alac_at_encoder_select="audio_frame_queue"
+ilbc_at_encoder_deps="audiotoolbox"
+ilbc_at_encoder_select="audio_frame_queue"
+pcm_alaw_at_encoder_deps="audiotoolbox"
+pcm_alaw_at_encoder_select="audio_frame_queue"
+pcm_mulaw_at_encoder_deps="audiotoolbox"
+pcm_mulaw_at_encoder_select="audio_frame_queue"
 chromaprint_muxer_deps="chromaprint"
 h264_videotoolbox_encoder_deps="videotoolbox_encoder pthreads"
 libcelt_decoder_deps="libcelt"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 53d3f0d..ef9eb98 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -815,6 +815,11 @@ OBJS-$(CONFIG_PCM_MULAW_AT_DECODER)   += 
audiotoolboxdec.o
 OBJS-$(CONFIG_PCM_ALAW_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_QDMC_AT_DECODER)+= audiotoolboxdec.o
 OBJS-$(CONFIG_QDM2_AT_DECODER)+= audiotoolboxdec.o
+OBJS-$(CONFIG_AAC_AT_ENCODER) += audiotoolboxenc.o
+OBJS-$(CONFIG_ALAC_AT_ENCODER)+= audiotoolboxenc.o
+OBJS-$(CONFIG_ILBC_AT_ENCODER)+= audiotoolboxenc.o
+OBJS-$(CONFIG_PCM_ALAW_AT_ENCODER)+= audiotoolboxenc.o
+OBJS-$(CONFIG_PCM_MULAW_AT_ENCODER)   += audiotoolboxenc.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBDCADEC_DECODER)  += libdcadec.o dca.o
 OBJS-$(CONFIG_LIBFAAC_ENCODER)+= libfaac.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index e9f971b..a953a16 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -563,18 +563,18 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (XSUB,  xsub);
 
 /* external libraries */
-REGISTER_DECODER(AAC_AT,aac_at);
+REGISTER_ENCDEC (AAC_AT,aac_at);
 REGISTER_DECODER(AC3_AT,ac3_at);
 REGISTER_DECODER(ADPCM_IMA_QT_AT,   adpcm_ima_qt_at);
-REGISTER_DECODER(ALAC_AT,   alac_at);
+REGISTER_ENCDEC (ALAC_AT,   alac_at);
 REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
 REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
-REGISTER_DECODER(ILBC_AT,   ilbc_at);
+REGISTER_ENCDEC (ILBC_AT,   ilbc_at);
 REGISTER_DECODER(MP1_AT,mp1_at);
 REGISTER_DECODER(MP2_AT,mp2_at);
 REGISTER_DECODER(MP3_AT,mp3_at);
-REGISTER_DECODER(PCM_ALAW_AT,   pcm_alaw_at);
-REGISTER_DECODER(PCM_MULAW_AT,  pcm_mulaw_at);
+REGISTER_ENCDEC (PCM_ALAW_AT,   pcm_alaw_at);
+REGISTER_ENCDEC (PCM_MULAW_AT,  pcm_mulaw_at);
 REGISTER_DECODER(QDMC_AT,   qdmc_at);
 REGISTER_DECODER(QDM2_AT,   qdm2_at);
 REGISTER_DECODER(LIBCELT,   libcelt);
diff --git a/libavcodec/audiotoolboxenc.c b/libavcodec/audiotoolboxenc.c
new file mode 100644
index 000..cb53f2a
--- /dev/null
+++ b/libavcodec/audiotoolboxenc.c
@@ -0,0 +1,471 @@
+/*
+ * Audio Toolbox system codecs
+ *
+ * copyright (c) 2016 Rodger Combs
+ *
+ * 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 fo

[FFmpeg-cvslog] lavc/videotoolboxenc: remove *_NULLABLE annotations; fixes pre-10.11 build

2016-03-02 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Wed Mar  2 
21:44:28 2016 -0600| [ecba35bbe305c022d59da2d7bf066e3325693c26] | committer: 
Rodger Combs

lavc/videotoolboxenc: remove *_NULLABLE annotations; fixes pre-10.11 build

These macros were added in OS X 10.11, and the file compiles without warnings
on both 10.10 and 10.11 with them removed.

Thanks to mark4o on IRC for pointing out the failure and testing the patch.

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

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

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index bbecb24..3ed1f64 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -317,11 +317,11 @@ static int set_extradata(AVCodecContext *avctx, 
CMSampleBufferRef sample_buffer)
 }
 
 static void vtenc_output_callback(
-void *CM_NULLABLE ctx,
+void *ctx,
 void *sourceFrameCtx,
 OSStatus status,
 VTEncodeInfoFlags flags,
-CM_NULLABLE CMSampleBufferRef sample_buffer)
+CMSampleBufferRef sample_buffer)
 {
 AVCodecContext *avctx = ctx;
 VTEncContext   *vtctx = avctx->priv_data;
@@ -975,11 +975,11 @@ static int get_cv_pixel_info(
 #if !TARGET_OS_IPHONE
 //Not used on iOS - frame is always copied.
 static void free_avframe(
-void   *CV_NULLABLE release_ctx,
-const void *CV_NULLABLE data,
-size_t  size,
-size_t  plane_count,
-const void *CV_NULLABLE plane_addresses[])
+void   *release_ctx,
+const void *data,
+size_t  size,
+size_t  plane_count,
+const void *plane_addresses[])
 {
 AVFrame *frame = release_ctx;
 av_frame_free();

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


[FFmpeg-cvslog] lavf/mov: fix sidx with edit lists

2016-02-28 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Thu Feb 18 
12:57:37 2016 -0600| [3617e69d50dd9dd07b5011dfb9477a9d1a630354] | committer: 
Rodger Combs

lavf/mov: fix sidx with edit lists

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index b1a2ea7..dd7890a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3610,7 +3610,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 }
 av_log(c->fc, AV_LOG_DEBUG, "calculated into dts %"PRId64"\n", 
dts);
 } else {
-dts = frag->time;
+dts = frag->time - sc->time_offset;
 av_log(c->fc, AV_LOG_DEBUG, "found frag time %"PRId64
 ", using it for dts\n", dts);
 }

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


[FFmpeg-cvslog] lavc/aac_ac3_parser: avoid zeroing codec parameters if we haven' t read a frame

2016-02-27 Thread Rodger Combs
ffmpeg | branch: master | Rodger Combs <rodger.co...@gmail.com> | Tue Nov 24 
03:20:09 2015 -0600| [9f5baf90856f8afa0d94c2bf1dc31f485ef72a13] | committer: 
Rodger Combs

lavc/aac_ac3_parser: avoid zeroing codec parameters if we haven't read a frame

This caused issues when seeking in some unusual MPEGTS files

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

 libavcodec/aac_ac3_parser.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 2f7d568..6a76eb8 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -34,6 +34,7 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
 ParseContext *pc = >pc;
 int len, i;
 int new_frame_start;
+int got_frame = 0;
 
 get_next:
 i=END_NOT_FOUND;
@@ -51,6 +52,7 @@ get_next:
 if(len<=0){
 i=END_NOT_FOUND;
 }else{
+got_frame = 1;
 s->state=0;
 i-= s->header_size -1;
 s->remaining_size = len;
@@ -76,6 +78,7 @@ get_next:
 if(s->codec_id)
 avctx->codec_id = s->codec_id;
 
+if (got_frame) {
 /* Due to backwards compatible HE-AAC the sample rate, channel count,
and total number of samples found in an AAC ADTS header are not
reliable. Bit rate is still accurate because the total frame duration in
@@ -101,6 +104,7 @@ get_next:
 }
 
 avctx->bit_rate = s->bit_rate;
+}
 
 return i;
 }

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


  1   2   >