Re: [FFmpeg-devel] [PATCH 4/4] avfilter/vf_derain.c: put all the calculation in model file.

2020-03-22 Thread Steven Liu


> 2020年3月23日 下午12:08,Guo, Yejun  写道:
> 
> currently, the model outputs the rain, and so need a subtraction
> in filter c code to get the final derain result.
> 
> I've sent a PR to update the model file and accepted, see at
> https://github.com/XueweiMeng/derain_filter/pull/3
> 
> Signed-off-by: Guo, Yejun 
> ---
> doc/filters.texi| 7 +--
> libavfilter/vf_derain.c | 6 +-
> 2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 328e984..3dc7715 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -8878,6 +8878,7 @@ delogo=x=0:y=0:w=100:h=77:band=10
> 
> @end itemize
> 
> +@anchor{derain}
> @section derain
> 
> Remove the rain in the input image/video by applying the derain methods based 
> on
> @@ -8932,6 +8933,8 @@ Note that different backends use different file 
> formats. TensorFlow and native
> backend can load files for only its format.
> @end table
> 
> +It can also be finished with @ref{dnn_processing} filter.
> +
> @section deshake
> 
> Attempt to fix small changes in horizontal and/or vertical shift. This
> @@ -9201,9 +9204,9 @@ Set the output name of the dnn network.
> 
> @itemize
> @item
> -Halve the red channle of the frame with format rgb24:
> +Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
> @example
> -ffmpeg -i input.jpg -vf 
> format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native
>  out.native.png
> +./ffmpeg -i rain.jpg -vf 
> format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y
>  derain.jpg
> @end example
> 
> @item
> diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c
> index 89f9d5a..7432260 100644
> --- a/libavfilter/vf_derain.c
> +++ b/libavfilter/vf_derain.c
> @@ -100,7 +100,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
> AVFilterLink *outlink = ctx->outputs[0];
> DRContext *dr_context = ctx->priv;
> DNNReturnType dnn_result;
> -int pad_size;
> 
> AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> if (!out) {
> @@ -129,15 +128,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
> *in)
> out->width  = dr_context->output.width;
> outlink->h  = dr_context->output.height;
> outlink->w  = dr_context->output.width;
> -pad_size= (in->height - out->height) >> 1;
> 
> for (int i = 0; i < out->height; i++){
> for(int j = 0; j < out->width * 3; j++){
> int k = i * out->linesize[0] + j;
> int t = i * out->width * 3 + j;
> -
> -int t_in =  (i + pad_size) * in->width * 3 + j + pad_size * 3;
> -out->data[0][k] = CLIP((int)float 
> *)dr_context->input.data)[t_in] - ((float *)dr_context->output.data)[t]) * 
> 255), 0, 255);
> +out->data[0][k] = CLIP((int)float 
> *)dr_context->output.data)[t]) * 255), 0, 255);
> }
> }
> 
> -- 
> 2.7.4
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

LGTM

Thanks

Steven Liu



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

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

[FFmpeg-devel] [PATCH 1/4] avfilter/vf_dnn_processing.c: fix typo for the linesize of dnn data

2020-03-22 Thread Guo, Yejun
Signed-off-by: Guo, Yejun 
---
 libavfilter/vf_dnn_processing.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index fabe4f1..cf589ac 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -329,7 +329,7 @@ static int copy_from_frame_to_dnn(DnnProcessingContext 
*ctx, const AVFrame *fram
 if (dnn_input->dt == DNN_FLOAT) {
 sws_scale(ctx->sws_gray8_to_grayf32, (const uint8_t 
**)frame->data, frame->linesize,
   0, frame->height, (uint8_t * const*)(&dnn_input->data),
-  (const int [4]){frame->linesize[0] * sizeof(float), 0, 
0, 0});
+  (const int [4]){frame->width * 3 * sizeof(float), 0, 0, 
0});
 } else {
 av_assert0(dnn_input->dt == DNN_UINT8);
 av_image_copy_plane(dnn_input->data, bytewidth,
@@ -369,7 +369,7 @@ static int copy_from_dnn_to_frame(DnnProcessingContext 
*ctx, AVFrame *frame)
 case AV_PIX_FMT_BGR24:
 if (dnn_output->dt == DNN_FLOAT) {
 sws_scale(ctx->sws_grayf32_to_gray8, (const uint8_t *[4]){(const 
uint8_t *)dnn_output->data, 0, 0, 0},
-  (const int[4]){frame->linesize[0] * sizeof(float), 0, 0, 
0},
+  (const int[4]){frame->width * 3 * sizeof(float), 0, 0, 
0},
   0, frame->height, (uint8_t * const*)frame->data, 
frame->linesize);
 
 } else {
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 4/4] avfilter/vf_derain.c: put all the calculation in model file.

2020-03-22 Thread Guo, Yejun
currently, the model outputs the rain, and so need a subtraction
in filter c code to get the final derain result.

I've sent a PR to update the model file and accepted, see at
https://github.com/XueweiMeng/derain_filter/pull/3

Signed-off-by: Guo, Yejun 
---
 doc/filters.texi| 7 +--
 libavfilter/vf_derain.c | 6 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 328e984..3dc7715 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8878,6 +8878,7 @@ delogo=x=0:y=0:w=100:h=77:band=10
 
 @end itemize
 
+@anchor{derain}
 @section derain
 
 Remove the rain in the input image/video by applying the derain methods based 
on
@@ -8932,6 +8933,8 @@ Note that different backends use different file formats. 
TensorFlow and native
 backend can load files for only its format.
 @end table
 
+It can also be finished with @ref{dnn_processing} filter.
+
 @section deshake
 
 Attempt to fix small changes in horizontal and/or vertical shift. This
@@ -9201,9 +9204,9 @@ Set the output name of the dnn network.
 
 @itemize
 @item
-Halve the red channle of the frame with format rgb24:
+Remove rain in rgb24 frame with can.pb (see @ref{derain} filter):
 @example
-ffmpeg -i input.jpg -vf 
format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native
 out.native.png
+./ffmpeg -i rain.jpg -vf 
format=rgb24,dnn_processing=dnn_backend=tensorflow:model=can.pb:input=x:output=y
 derain.jpg
 @end example
 
 @item
diff --git a/libavfilter/vf_derain.c b/libavfilter/vf_derain.c
index 89f9d5a..7432260 100644
--- a/libavfilter/vf_derain.c
+++ b/libavfilter/vf_derain.c
@@ -100,7 +100,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 AVFilterLink *outlink = ctx->outputs[0];
 DRContext *dr_context = ctx->priv;
 DNNReturnType dnn_result;
-int pad_size;
 
 AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
 if (!out) {
@@ -129,15 +128,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 out->width  = dr_context->output.width;
 outlink->h  = dr_context->output.height;
 outlink->w  = dr_context->output.width;
-pad_size= (in->height - out->height) >> 1;
 
 for (int i = 0; i < out->height; i++){
 for(int j = 0; j < out->width * 3; j++){
 int k = i * out->linesize[0] + j;
 int t = i * out->width * 3 + j;
-
-int t_in =  (i + pad_size) * in->width * 3 + j + pad_size * 3;
-out->data[0][k] = CLIP((int)float 
*)dr_context->input.data)[t_in] - ((float *)dr_context->output.data)[t]) * 
255), 0, 255);
+out->data[0][k] = CLIP((int)float 
*)dr_context->output.data)[t]) * 255), 0, 255);
 }
 }
 
-- 
2.7.4

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

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

[FFmpeg-devel] [PATCH 3/4] dnn-layer-mathbinary-test: add unit test for subtraction

2020-03-22 Thread Guo, Yejun
Signed-off-by: Guo, Yejun 
---
 tests/dnn/.gitignore  |   1 +
 tests/dnn/Makefile|   1 +
 tests/dnn/dnn-layer-mathbinary-test.c | 173 ++
 tests/fate/dnn.mak|   5 +
 4 files changed, 180 insertions(+)
 create mode 100644 tests/dnn/dnn-layer-mathbinary-test.c

diff --git a/tests/dnn/.gitignore b/tests/dnn/.gitignore
index 5eedaaa..d78c5c1 100644
--- a/tests/dnn/.gitignore
+++ b/tests/dnn/.gitignore
@@ -2,3 +2,4 @@
 /dnn-layer-depth2space-test
 /dnn-layer-maximum-test
 /dnn-layer-pad-test
+/dnn-layer-mathbinary-test
diff --git a/tests/dnn/Makefile b/tests/dnn/Makefile
index e1bfe3f..1f96710 100644
--- a/tests/dnn/Makefile
+++ b/tests/dnn/Makefile
@@ -1,6 +1,7 @@
 DNNTESTPROGS += dnn-layer-pad
 DNNTESTPROGS += dnn-layer-conv2d
 DNNTESTPROGS += dnn-layer-depth2space
+DNNTESTPROGS += dnn-layer-mathbinary
 DNNTESTPROGS += dnn-layer-maximum
 
 DNNTESTOBJS  := $(DNNTESTOBJS:%=$(DNNTESTSDIR)%) 
$(DNNTESTPROGS:%=$(DNNTESTSDIR)/%-test.o)
diff --git a/tests/dnn/dnn-layer-mathbinary-test.c 
b/tests/dnn/dnn-layer-mathbinary-test.c
new file mode 100644
index 000..1243784
--- /dev/null
+++ b/tests/dnn/dnn-layer-mathbinary-test.c
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2020
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include 
+#include 
+#include "libavfilter/dnn/dnn_backend_native_layer_mathbinary.h"
+
+#define EPSON 0.1
+
+static int test_sub_broadcast_input0(void)
+{
+DnnLayerMathBinaryParams params;
+DnnOperand operands[2];
+int32_t input_indexes[1];
+float input[1*1*2*3] = {
+-3, 2.5, 2, -2.1, 7.8, 100
+};
+float *output;
+
+params.bin_op = DMBO_SUB;
+params.input0_broadcast = 1;
+params.input1_broadcast = 0;
+params.v = 7.28;
+
+operands[0].data = input;
+operands[0].dims[0] = 1;
+operands[0].dims[1] = 1;
+operands[0].dims[2] = 2;
+operands[0].dims[3] = 3;
+operands[1].data = NULL;
+
+input_indexes[0] = 0;
+dnn_execute_layer_math_binary(operands, input_indexes, 1, ¶ms);
+
+output = operands[1].data;
+for (int i = 0; i < sizeof(input) / sizeof(float); i++) {
+float expected_output = params.v - input[i];
+if (fabs(output[i] - expected_output) > EPSON) {
+printf("at index %d, output: %f, expected_output: %f\n", i, 
output[i], expected_output);
+av_freep(&output);
+return 1;
+}
+}
+
+av_freep(&output);
+return 0;
+}
+
+static int test_sub_broadcast_input1(void)
+{
+DnnLayerMathBinaryParams params;
+DnnOperand operands[2];
+int32_t input_indexes[1];
+float input[1*1*2*3] = {
+-3, 2.5, 2, -2.1, 7.8, 100
+};
+float *output;
+
+params.bin_op = DMBO_SUB;
+params.input0_broadcast = 0;
+params.input1_broadcast = 1;
+params.v = 7.28;
+
+operands[0].data = input;
+operands[0].dims[0] = 1;
+operands[0].dims[1] = 1;
+operands[0].dims[2] = 2;
+operands[0].dims[3] = 3;
+operands[1].data = NULL;
+
+input_indexes[0] = 0;
+dnn_execute_layer_math_binary(operands, input_indexes, 1, ¶ms);
+
+output = operands[1].data;
+for (int i = 0; i < sizeof(input) / sizeof(float); i++) {
+float expected_output = input[i] - params.v;
+if (fabs(output[i] - expected_output) > EPSON) {
+printf("at index %d, output: %f, expected_output: %f\n", i, 
output[i], expected_output);
+av_freep(&output);
+return 1;
+}
+}
+
+av_freep(&output);
+return 0;
+}
+
+static int test_sub_no_broadcast(void)
+{
+DnnLayerMathBinaryParams params;
+DnnOperand operands[3];
+int32_t input_indexes[2];
+float input0[1*1*2*3] = {
+-3, 2.5, 2, -2.1, 7.8, 100
+};
+float input1[1*1*2*3] = {
+-1, 2, 3, -21, 8, 10.0
+};
+float *output;
+
+params.bin_op = DMBO_SUB;
+params.input0_broadcast = 0;
+params.input1_broadcast = 0;
+
+operands[0].data = input0;
+operands[0].dims[0] = 1;
+operands[0].dims[1] = 1;
+operands[0].dims[2] = 2;
+operands[0].dims[3] = 3;
+operands[1].data = input1;
+operands[1].dims[0] = 1;
+operands[1].dims[1] = 1;
+operands[1].dims[

[FFmpeg-devel] [PATCH 2/4] dnn_backend_native_layer_mathbinary: add sub support

2020-03-22 Thread Guo, Yejun
more math binary operations will be added here

Signed-off-by: Guo, Yejun 
---
 libavfilter/dnn/Makefile   |   1 +
 libavfilter/dnn/dnn_backend_native.h   |   1 +
 .../dnn/dnn_backend_native_layer_mathbinary.c  | 113 +
 .../dnn/dnn_backend_native_layer_mathbinary.h  |  49 +
 libavfilter/dnn/dnn_backend_native_layers.c|   2 +
 tools/python/convert_from_tensorflow.py|  55 +-
 tools/python/convert_header.py |   2 +-
 7 files changed, 219 insertions(+), 4 deletions(-)
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
 create mode 100644 libavfilter/dnn/dnn_backend_native_layer_mathbinary.h

diff --git a/libavfilter/dnn/Makefile b/libavfilter/dnn/Makefile
index 171f00e..ce52958 100644
--- a/libavfilter/dnn/Makefile
+++ b/libavfilter/dnn/Makefile
@@ -5,6 +5,7 @@ OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_pad
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_conv2d.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_depth2space.o
 OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_maximum.o
+OBJS-$(CONFIG_DNN)   += 
dnn/dnn_backend_native_layer_mathbinary.o
 
 DNN-OBJS-$(CONFIG_LIBTENSORFLOW) += dnn/dnn_backend_tf.o
 
diff --git a/libavfilter/dnn/dnn_backend_native.h 
b/libavfilter/dnn/dnn_backend_native.h
index 53ed22c..5d76d87 100644
--- a/libavfilter/dnn/dnn_backend_native.h
+++ b/libavfilter/dnn/dnn_backend_native.h
@@ -41,6 +41,7 @@ typedef enum {
 DLT_DEPTH_TO_SPACE = 2,
 DLT_MIRROR_PAD = 3,
 DLT_MAXIMUM = 4,
+DLT_MATH_BINARY = 5,
 DLT_COUNT
 } DNNLayerType;
 
diff --git a/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c 
b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
new file mode 100644
index 000..3b8bab8
--- /dev/null
+++ b/libavfilter/dnn/dnn_backend_native_layer_mathbinary.c
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2020
+ *
+ * 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
+ */
+
+/**
+ * @file
+ * DNN native backend implementation.
+ */
+
+#include "dnn_backend_native.h"
+#include "libavutil/avassert.h"
+#include "dnn_backend_native_layer_mathbinary.h"
+
+int dnn_load_layer_math_binary(Layer *layer, AVIOContext *model_file_context, 
int file_size)
+{
+DnnLayerMathBinaryParams *params;
+int dnn_size = 0;
+int input_index = 0;
+params = av_malloc(sizeof(*params));
+if (!params)
+return 0;
+
+params->bin_op = (int32_t)avio_rl32(model_file_context);
+dnn_size += 4;
+
+params->input0_broadcast = (int32_t)avio_rl32(model_file_context);
+dnn_size += 4;
+if (params->input0_broadcast) {
+params->v = av_int2float(avio_rl32(model_file_context));
+} else {
+layer->input_operand_indexes[input_index] = 
(int32_t)avio_rl32(model_file_context);
+input_index++;
+}
+dnn_size += 4;
+
+params->input1_broadcast = (int32_t)avio_rl32(model_file_context);
+dnn_size += 4;
+if (params->input1_broadcast) {
+params->v = av_int2float(avio_rl32(model_file_context));
+} else {
+layer->input_operand_indexes[input_index] = 
(int32_t)avio_rl32(model_file_context);
+input_index++;
+}
+dnn_size += 4;
+
+layer->output_operand_index = (int32_t)avio_rl32(model_file_context);
+dnn_size += 4;
+layer->params = params;
+
+return dnn_size;
+}
+
+int dnn_execute_layer_math_binary(DnnOperand *operands, const int32_t 
*input_operand_indexes,
+ int32_t output_operand_index, const void 
*parameters)
+{
+const DnnOperand *input = &operands[input_operand_indexes[0]];
+DnnOperand *output = &operands[output_operand_index];
+const DnnLayerMathBinaryParams *params = (const DnnLayerMathBinaryParams 
*)parameters;
+int dims_count;
+const float *src;
+float *dst;
+
+for (int i = 0; i < 4; ++i)
+output->dims[i] = input->dims[i];
+
+output->data_type = input->data_type;
+output->length = calculate_operand_data_length(output);
+output->data = av_realloc(output->data, output->length);
+if (!output

Re: [FFmpeg-devel] [PATCH] avcodec/cbs_h264_syntax_template: fix off by 1 error with slice_group_change_cycle

2020-03-22 Thread James Almer
On 3/22/2020 8:00 PM, Michael Niedermayer wrote:
> Fixes: assertion failure
> Fixes: 
> 20390/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5683400772157440
> 
> Found-by: continuous fuzzing process 
> https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/cbs_h264_syntax_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_h264_syntax_template.c 
> b/libavcodec/cbs_h264_syntax_template.c
> index 878d348b94..b7e796e9a8 100644
> --- a/libavcodec/cbs_h264_syntax_template.c
> +++ b/libavcodec/cbs_h264_syntax_template.c
> @@ -1365,7 +1365,7 @@ static int FUNC(slice_header)(CodedBitstreamContext 
> *ctx, RWContext *rw,
>  pic_size = (sps->pic_width_in_mbs_minus1 + 1) *
> (sps->pic_height_in_map_units_minus1 + 1);
>  max = (pic_size + pps->slice_group_change_rate_minus1) /
> -  (pps->slice_group_change_rate_minus1 + 1);
> +  (pps->slice_group_change_rate_minus1 + 1) + 1;

The spec says

"The value of slice_group_change_cycle is represented in the bitstream
by the following number of bits Ceil( Log2( PicSizeInMapUnits ÷
SliceGroupChangeRate + 1 ) )

The value of slice_group_change_cycle shall be in the range of 0 to
Ceil( PicSizeInMapUnits ÷ SliceGroupChangeRate ), inclusive."

Are you trying to change the amount of bits read, the max allowed value,
or both?

>  bits = av_log2(2 * max - 1);

This should use av_ceil_log2() IMO, so it's clear what it's trying to do.

>  
>  u(bits, slice_group_change_cycle, 0, max);
> 

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

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

[FFmpeg-devel] [PATCH] MAINTAINERS: add my gpg fingerprint

2020-03-22 Thread Ramiro Polla
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f9810d5594..9238a1a762 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -614,6 +614,7 @@ Nikolay Aleksandrov   8978 1D8C FB71 588E 4B27 EAA8 
C4F0 B5FC E011 13B1
 Panagiotis Issaris6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
 Peter RossA907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
 Philip Langdale   5DC5 8D66 5FBA 3A43 18EC 045E F8D6 B194 6A75 682E
+Ramiro Polla  1E0D 3820 ACCB 36AF 97B4 F18C 648E 2B0A E905 E26A
 Reimar Doeffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
 Reinhard Tartler  9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
 Reynaldo H. Verdejo Pinochet  6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
-- 
2.11.0

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

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

Re: [FFmpeg-devel] [PATCH] configure: Do not abort when cross-compiling to the native CPU

2020-03-22 Thread David Michael
On Mon, Mar 16, 2020 at 9:16 AM David Michael  wrote:
> On Sat, Mar 7, 2020 at 10:32 AM David Michael  wrote:
> > Using a compiler with a different host triplet is considered
> > cross-compiling, even when it is for the same architecture as the
> > build system.  With such a cross-compiler, it is still valid to
> > optimize builds with --cpu=host.  Drop the condition that aborts in
> > this case, since a cross-compiler for an incompatible architecture
> > will fail with -mtune=native anyway.
> >
> > Signed-off-by: David Michael 
> > ---
> >
> > Hi,
> >
> > I am building software in a ChromeOS-style environment where the native
> > build system creates a cross-compiler with a different vendor string for
> > each supported architecture, and cross-compiled packages are installed
> > into their own root directory.  The build system's architecture is not
> > handled any differently, so packages compatible with the native
> > architecture are still technically being cross-compiled.
> >
> > When I changed settings to tune for the native CPU so I can produce an
> > installation optimized to run on the build system hardware, FFmpeg fails
> > from this seemingly redundant test.  Can it just be dropped?
> >
> > Thanks.
> >
> > David
> >
> >  configure | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 06e3a7b2a8..69ffdeb3ed 100755
> > --- a/configure
> > +++ b/configure
> > @@ -4785,9 +4785,6 @@ if test -n "$sysroot"; then
> >  fi
> >
> >  if test "$cpu" = host; then
> > -enabled cross_compile &&
> > -die "--cpu=host makes no sense when cross-compiling."
> > -
> >  case "$cc_type" in
> >  gcc|llvm_gcc)
> >  check_native(){
> > --
> > 2.21.1
>
> Ping.

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

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

[FFmpeg-devel] [PATCH] doc/developer.texi: Add variadic macros to allowed C language features

2020-03-22 Thread Andreas Rheinhardt
They are used in several places like CBS.

Signed-off-by: Andreas Rheinhardt 
---
 doc/developer.texi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/developer.texi b/doc/developer.texi
index 5c342c9106..51e7299b1d 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -131,6 +131,9 @@ compound literals (@samp{x = (struct s) @{ 17, 23 @};}).
 @item
 for loops with variable definition (@samp{for (int i = 0; i < 8; i++)});
 
+@item
+Variadic macros (@samp{#define ARRAY(nb, ...) (int[nb + 1])@{ nb, __VA_ARGS__ 
@}});
+
 @item
 Implementation defined behavior for signed integers is assumed to match the
 expected behavior for two's complement. Non representable values in integer
-- 
2.20.1

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

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

[FFmpeg-devel] [PATCH] avcodec/cbs: Avoid leaving the ... out in calls to variadic macros

2020-03-22 Thread Andreas Rheinhardt
According to C99, there has to be at least one argument for every ...
in a variadic function-like macro. In practice most (all?) compilers also
allow to leave it completely out, but it is nevertheless required: In a
variadic macro "there shall be more arguments in the invocation than there
are parameters in the macro definition (excluding the ...)." (C99,
6.10.3.4).

CBS (not the framework itself, but the macros used in the
cbs_*_syntax_template.c files) relies on the compiler allowing to leave
a variadic macro argument out. This leads to warnings when compiling in
-pedantic mode, e.g. "warning: must specify at least one argument for
'...' parameter of variadic macro [-Wgnu-zero-variadic-macro-arguments]"
from Clang.

Most of these warnings can be easily avoided: The syntax_templates
mostly contain helper macros that expand to more complex variadic macros
and these helper macros often omit an argument for the  Modifying
them to always expand to complex macros with an empty argument for the
... at the end fixes most of these warnings: The number of warnings went
down from 400 to 0 for cbs_av1, from 1114 to 32 for cbs_h2645, from 38 to
0 for cbs_jpeg, from 166 to 0 for cbs_mpeg2 and from 110 to 8 for cbs_vp9.

These eight remaining warnings for cbs_vp9 have been fixed by switching
to another macro in cbs_vp9_syntax_template: The fixed values for the
sync bytes as well as the trailing bits for byte-alignment are now read
via the fixed() macro (this also adds a check to ensure that trailing
bits are indeed zero as they have to be).

Signed-off-by: Andreas Rheinhardt 
---
There are two ways to fix the remaining 32 warnings from cbs_h2645:

Simply add ", " to all macro calls that make use of the complex macros;
this has the drawback of adding uglyness to cbs_h26x_syntax_template.c.

Or add new macros for these macro calls: The places that produce
warnings use the complex macros directly, because they use names
different from the default names that the helper macros use, but they do
not use subscripts and therefore leave the variadic argument (designed
for subscripts) out. I would have implemented the second solution if it
were not for the problem of the naming of the new macros.

(There is of course also the possibility not to care about the remaining
ones.)

 libavcodec/cbs_av1.c | 16 
 libavcodec/cbs_h2645.c   | 14 +++---
 libavcodec/cbs_jpeg.c|  2 +-
 libavcodec/cbs_mpeg2.c   |  6 +++---
 libavcodec/cbs_vp9.c | 13 ++---
 libavcodec/cbs_vp9_syntax_template.c | 21 -
 6 files changed, 29 insertions(+), 43 deletions(-)

diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c
index 16eb7143b6..fc228086c2 100644
--- a/libavcodec/cbs_av1.c
+++ b/libavcodec/cbs_av1.c
@@ -550,12 +550,12 @@ static size_t 
cbs_av1_get_payload_bytes_left(GetBitContext *gbc)
 #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ 
}) : NULL)
 
 #define fb(width, name) \
-xf(width, name, current->name, 0, MAX_UINT_BITS(width), 0)
+xf(width, name, current->name, 0, MAX_UINT_BITS(width), 0, )
 #define fc(width, name, range_min, range_max) \
-xf(width, name, current->name, range_min, range_max, 0)
+xf(width, name, current->name, range_min, range_max, 0, )
 #define flag(name) fb(1, name)
 #define su(width, name) \
-xsu(width, name, current->name, 0)
+xsu(width, name, current->name, 0, )
 
 #define fbs(width, name, subs, ...) \
 xf(width, name, current->name, 0, MAX_UINT_BITS(width), subs, 
__VA_ARGS__)
@@ -568,7 +568,7 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext 
*gbc)
 
 #define fixed(width, name, value) do { \
 av_unused uint32_t fixed_value = value; \
-xf(width, name, fixed_value, value, value, 0); \
+xf(width, name, fixed_value, value, value, 0, ); \
 } while (0)
 
 
@@ -623,9 +623,9 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext 
*gbc)
 #define delta_q(name) do { \
 uint8_t delta_coded; \
 int8_t delta_q; \
-xf(1, name.delta_coded, delta_coded, 0, 1, 0); \
+xf(1, name.delta_coded, delta_coded, 0, 1, 0, ); \
 if (delta_coded) \
-xsu(1 + 6, name.delta_q, delta_q, 0); \
+xsu(1 + 6, name.delta_q, delta_q, 0, ); \
 else \
 delta_q = 0; \
 current->name = delta_q; \
@@ -700,9 +700,9 @@ static size_t cbs_av1_get_payload_bytes_left(GetBitContext 
*gbc)
 } while (0)
 
 #define delta_q(name) do { \
-xf(1, name.delta_coded, current->name != 0, 0, 1, 0); \
+xf(1, name.delta_coded, current->name != 0, 0, 1, 0, ); \
 if (current->name) \
-xsu(1 + 6, name.delta_q, current->name, 0); \
+xsu(1 + 6, name.delta_q, current->name, 0, ); \
 } while (0)
 
 #define leb128(name) do { \
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 7a

[FFmpeg-devel] [PATCH] avcodec/cbs_h264_syntax_template: fix off by 1 error with slice_group_change_cycle

2020-03-22 Thread Michael Niedermayer
Fixes: assertion failure
Fixes: 
20390/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_REDUNDANT_PPS_fuzzer-5683400772157440

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer 
---
 libavcodec/cbs_h264_syntax_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h264_syntax_template.c 
b/libavcodec/cbs_h264_syntax_template.c
index 878d348b94..b7e796e9a8 100644
--- a/libavcodec/cbs_h264_syntax_template.c
+++ b/libavcodec/cbs_h264_syntax_template.c
@@ -1365,7 +1365,7 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, 
RWContext *rw,
 pic_size = (sps->pic_width_in_mbs_minus1 + 1) *
(sps->pic_height_in_map_units_minus1 + 1);
 max = (pic_size + pps->slice_group_change_rate_minus1) /
-  (pps->slice_group_change_rate_minus1 + 1);
+  (pps->slice_group_change_rate_minus1 + 1) + 1;
 bits = av_log2(2 * max - 1);
 
 u(bits, slice_group_change_cycle, 0, max);
-- 
2.17.1

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

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

Re: [FFmpeg-devel] [PATCH] avformat: Add Dynacolor MVC Demuxer

2020-03-22 Thread Carl Eugen Hoyos
Am So., 22. März 2020 um 18:29 Uhr schrieb Tom Needham <06needh...@gmail.com>:
>
> This demuxer adds support for demuxing files in the Dynacolor format
> such as the sample located at:
>
> http://samples.ffmpeg.org/camera-dvr/dynacolor/dynacolor-camera-sample
>
> However, some decode errors are showing on the resulting MPEG4 stream.
> I don't know whether this is a bug with the demuxer or the file as there is
> only one sample
> but the output results in a 1 second mp4 file that is playable in VLC media
> player.

I don't know but a demuxer that produces some useful output is better
than no demuxer.

> +static int dyna_read_probe(const AVProbeData *p)
> +{
> +unsigned char* bytes = av_malloc(p->buf_size);
> +
> +for (int i = 0; i < p->buf_size; i++) {
> +bytes[i] = p->buf[i];
> +}

This is not useful, please look at other probe functions.

> +if(bytes[0] == 0x40 && bytes[1] == 0x32 && bytes[2] == 0x10 &&
> bytes[3] == 0x20)
> +return AVPROBE_SCORE_MAX;

This should return MAX/2 for 32 bit.

> +
> +return 0;
> +}

Your patch has many style issues, please run tools/patcheck
and look at other files.
This includes comments, camel-case variable names and
strange "{" "}" placement.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] JPEG2000 Decoder/Encoder Enhancements

2020-03-22 Thread Carl Eugen Hoyos
Am So., 22. März 2020 um 18:27 Uhr schrieb Gautam Ramakrishnan
:

> I saw the list of unmentored projects for GSoC and enhancements to the
> JPEG2000 decoder and encoder were there. I am finding it very
> difficult to make a proposal as the specifications are not available
> for free. However, I am willing to work on improving the JPEG2000
> features even if it is not through GSoC if someone can guide me
> through it.
>
> I will basically need some guidance on the specifications and some
> advice on how to go about implementing the missing features. Could I
> take this up even if it is not a part of GSoC?

Google can find an (old but probably usable) version of the standard.

You can only work on this task if you find a mentor;-(

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat: Add Dynacolor MVC Demuxer

2020-03-22 Thread Lou Logan
On Sun, Mar 22, 2020, at 9:54 AM, Lou Logan wrote:
>
> Fails to apply.

Forgot to mention it looks like your mail client broke/wrapped lines.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH] avformat: Add Dynacolor MVC Demuxer

2020-03-22 Thread Lou Logan
On Sun, Mar 22, 2020, at 9:28 AM, Tom Needham wrote:
> This demuxer adds support for demuxing files in the Dynacolor format
> such as the sample located at:
> 
> http://samples.ffmpeg.org/camera-dvr/dynacolor/dynacolor-camera-sample
> 
> However, some decode errors are showing on the resulting MPEG4 stream.
> I don't know whether this is a bug with the demuxer or the file as there is
> only one sample
> but the output results in a 1 second mp4 file that is playable in VLC media
> player.
> 
> Signed-off-by: Tom Needham <06needh...@gmail.com>
> ---
>  Changelog|   1 +
>  doc/general.texi |   1 +
>  libavformat/Makefile |   1 +
>  libavformat/allformats.c |   1 +
>  libavformat/dynacolor.c  | 560 +++
>  libavformat/dynacolor.h  | 308 +
>  libavformat/version.h|   2 +-
>  7 files changed, 873 insertions(+), 1 deletion(-)
>  create mode 100644 libavformat/dynacolor.c
>  create mode 100644 libavformat/dynacolor.h

Fails to apply.

Applying: avformat: Add Dynacolor MVC Demuxer
error: corrupt patch at line 89
Patch failed at 0001 avformat: Add Dynacolor MVC Demuxer
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 07/14] avformat/matroskadec: fix the type of the TrackLanguage

2020-03-22 Thread Andreas Rheinhardt
Steve Lhomme:
> From: Steve Lhomme 
> 
> It's an ASCII string, not a UTF-8 string.
> ---
>  libavformat/matroskadec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
> index 4d7fdab99f..383869bced 100644
> --- a/libavformat/matroskadec.c
> +++ b/libavformat/matroskadec.c
> @@ -554,7 +554,7 @@ static EbmlSyntax matroska_track[] = {
>  { MATROSKA_ID_CODECID,   EBML_STR,   0, 
> offsetof(MatroskaTrack, codec_id) },
>  { MATROSKA_ID_CODECPRIVATE,  EBML_BIN,   0, 
> offsetof(MatroskaTrack, codec_priv) },
>  { MATROSKA_ID_CODECDELAY,EBML_UINT,  0, 
> offsetof(MatroskaTrack, codec_delay) },
> -{ MATROSKA_ID_TRACKLANGUAGE, EBML_UTF8,  0, 
> offsetof(MatroskaTrack, language), { .s = "eng" } },
> +{ MATROSKA_ID_TRACKLANGUAGE, EBML_STR,   0, 
> offsetof(MatroskaTrack, language), { .s = "eng" } },
>  { MATROSKA_ID_TRACKDEFAULTDURATION,  EBML_UINT,  0, 
> offsetof(MatroskaTrack, default_duration) },
>  { MATROSKA_ID_TRACKTIMECODESCALE,EBML_FLOAT, 0, 
> offsetof(MatroskaTrack, time_scale),   { .f = 1.0 } },
>  { MATROSKA_ID_TRACKFLAGDEFAULT,  EBML_UINT,  0, 
> offsetof(MatroskaTrack, flag_default), { .u = 1 } },
> 
LGTM.

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

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

[FFmpeg-devel] [PATCH] avformat: Add Dynacolor MVC Demuxer

2020-03-22 Thread Tom Needham
This demuxer adds support for demuxing files in the Dynacolor format
such as the sample located at:

http://samples.ffmpeg.org/camera-dvr/dynacolor/dynacolor-camera-sample

However, some decode errors are showing on the resulting MPEG4 stream.
I don't know whether this is a bug with the demuxer or the file as there is
only one sample
but the output results in a 1 second mp4 file that is playable in VLC media
player.

Signed-off-by: Tom Needham <06needh...@gmail.com>
---
 Changelog|   1 +
 doc/general.texi |   1 +
 libavformat/Makefile |   1 +
 libavformat/allformats.c |   1 +
 libavformat/dynacolor.c  | 560 +++
 libavformat/dynacolor.h  | 308 +
 libavformat/version.h|   2 +-
 7 files changed, 873 insertions(+), 1 deletion(-)
 create mode 100644 libavformat/dynacolor.c
 create mode 100644 libavformat/dynacolor.h

diff --git a/Changelog b/Changelog
index 711861bda9..79d39494c9 100644
--- a/Changelog
+++ b/Changelog
@@ -54,6 +54,7 @@ version :
 - DERF demuxer
 - CRI HCA decoder
 - CRI HCA demuxer
+- Dynacolor MVC Demuxer


 version 4.2:
diff --git a/doc/general.texi b/doc/general.texi
index 752618a00b..4eb4716d87 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -452,6 +452,7 @@ library:
 @item DXA   @tab   @tab X
 @tab This format is used in the non-Windows version of the Feeble Files
  game and different game cutscenes repacked for use with ScummVM.
+@item Dynacolor MVC @tab   @tab X
 @item Electronic Arts cdata  @tab@tab X
 @item Electronic Arts Multimedia  @tab@tab X
 @tab Used in various EA games; files have extensions like WVE and UV2.
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8fd0d43721..4d1ca8b7ed 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -169,6 +169,7 @@ OBJS-$(CONFIG_DV_MUXER)  += dvenc.o
 OBJS-$(CONFIG_DVBSUB_DEMUXER)+= dvbsub.o rawdec.o
 OBJS-$(CONFIG_DVBTXT_DEMUXER)+= dvbtxt.o rawdec.o
 OBJS-$(CONFIG_DXA_DEMUXER)   += dxa.o
+OBJS-$(CONFIG_DYNACOLOR_DEMUXER) += dynacolor.o
 OBJS-$(CONFIG_EA_CDATA_DEMUXER)  += eacdata.o
 OBJS-$(CONFIG_EA_DEMUXER)+= electronicarts.o
 OBJS-$(CONFIG_EAC3_DEMUXER)  += ac3dec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 39d2c352f5..50f3926b05 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -131,6 +131,7 @@ extern AVOutputFormat ff_dv_muxer;
 extern AVInputFormat  ff_dvbsub_demuxer;
 extern AVInputFormat  ff_dvbtxt_demuxer;
 extern AVInputFormat  ff_dxa_demuxer;
+extern AVInputFormat  ff_dynacolor_demuxer;
 extern AVInputFormat  ff_ea_demuxer;
 extern AVInputFormat  ff_ea_cdata_demuxer;
 extern AVInputFormat  ff_eac3_demuxer;
diff --git a/libavformat/dynacolor.c b/libavformat/dynacolor.c
new file mode 100644
index 00..059323e9f3
--- /dev/null
+++ b/libavformat/dynacolor.c
@@ -0,0 +1,560 @@
+/*
+ * Dynacolor MVC Demuxer
+ * Copyright (c) 2020 Tom Needham
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
+ */
+
+#include 
+#include "avformat.h"
+#include "internal.h"
+#include "dynacolor.h"
+#include "libavutil/channel_layout.h"
+#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/timecode.h"
+#include "libavutil/avassert.h"
+
+//max total
size=sizeof(tHeader)+sizeof(tSuperExtraIdx1)+PENTAMICRO_PES_HEADER_SIZE+frame
size
+inline unsigned char dyna_callback_checksum(tBasicIdx *header)
+{
+int i;
+unsigned char chksum = 0, *pHeader;
+pHeader = (unsigned char *)header;
+if (*pHeader == '@' && *(pHeader + 1) == '2')
+for (i = 0; i < sizeof(tBasicIdx) - 1; ++i)
+{
+chksum ^= *(pHeader + i);
+}
+return chksum;
+}
+
+inline unsigned char dyna_extra_checksum(tBasicIdx *header)
+{
+int i;
+unsigned char chksum = 0, *pHeader;
+pHeader = (unsigned char *)header;
+if (*pHeader == '@' && *(pHeader + 1) == '2')
+for (i = 0; i < sizeof(tBasicIdx) - 1; ++i)
+{
+chksum ^= *(pHeader + i) & 0xFF;
+}
+return chksum;
+}
+
+void dyna_make_drv_header(tHeader *pHdr, int serno, unsigne

[FFmpeg-devel] JPEG2000 Decoder/Encoder Enhancements

2020-03-22 Thread Gautam Ramakrishnan
Hi,

I saw the list of unmentored projects for GSoC and enhancements to the
JPEG2000 decoder and encoder were there. I am finding it very
difficult to make a proposal as the specifications are not available
for free. However, I am willing to work on improving the JPEG2000
features even if it is not through GSoC if someone can guide me
through it.

I will basically need some guidance on the specifications and some
advice on how to go about implementing the missing features. Could I
take this up even if it is not a part of GSoC?

-- 
-
Gautam |
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/get_bits: cosmetics

2020-03-22 Thread Carl Eugen Hoyos
Am So., 22. März 2020 um 15:54 Uhr schrieb Ramiro Polla
:
>
> On Tue, Nov 5, 2019 at 2:35 PM Michael Niedermayer
>  wrote:
> > On Tue, Nov 05, 2019 at 11:13:49AM +0100, Ramiro Polla wrote:
> > >  libavcodec/get_bits.h | 8 
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > LGTM
>
> ping

If you lost your git key, please send a new public key to Michael.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 1/2] avcodec/mpegvideo_enc: fix multi-threaded motion estimation rounding for mpeg4

2020-03-22 Thread Ramiro Polla
ff_init_me() was being called after ff_update_duplicate_context(),
which caused the propagation of the initialization to other thread
contexts to be delayed by one frame.

In the case of mpeg4 (or flipflop_rounding), this would make the
hpel_put functions differ between the first thread (which would be
correctly initialized) and the other threads (which would be stale
from the previous frame).
---
 libavcodec/mpegvideo_enc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index b2eb9cf318..8c2672f76a 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -3699,6 +3699,9 @@ static int encode_picture(MpegEncContext *s, int 
picture_number)
 s->q_chroma_intra_matrix16 = s->q_intra_matrix16;
 }
 
+if(ff_init_me(s)<0)
+return -1;
+
 s->mb_intra=0; //for the rate distortion & bit compare functions
 for(i=1; ithread_context[i], s);
@@ -3706,9 +3709,6 @@ static int encode_picture(MpegEncContext *s, int 
picture_number)
 return ret;
 }
 
-if(ff_init_me(s)<0)
-return -1;
-
 /* Estimate motion for every MB */
 if(s->pict_type != AV_PICTURE_TYPE_I){
 s->lambda  = (s->lambda  * s->me_penalty_compensation + 128) >> 8;
-- 
2.11.0

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

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

[FFmpeg-devel] [PATCH v1] avformat/mxfdec: use av_asprintf()

2020-03-22 Thread lance . lmwang
From: Limin Wang 

Signed-off-by: Limin Wang 
---
 libavformat/mxfdec.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 9113e2a09c..3374f36a88 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2017,7 +2017,7 @@ static MXFStructuralComponent* 
mxf_resolve_sourceclip(MXFContext *mxf, UID *stro
 static int mxf_parse_package_comments(MXFContext *mxf, AVDictionary **pm, 
MXFPackage *package)
 {
 MXFTaggedValue *tag;
-int size, i;
+int i;
 char *key = NULL;
 
 for (i = 0; i < package->comment_count; i++) {
@@ -2025,12 +2025,10 @@ static int mxf_parse_package_comments(MXFContext *mxf, 
AVDictionary **pm, MXFPac
 if (!tag || !tag->name || !tag->value)
 continue;
 
-size = strlen(tag->name) + 8 + 1;
-key = av_mallocz(size);
+key = av_asprintf("comment_%s", tag->name);
 if (!key)
 return AVERROR(ENOMEM);
 
-snprintf(key, size, "comment_%s", tag->name);
 av_dict_set(pm, key, tag->value, AV_DICT_DONT_STRDUP_KEY);
 }
 return 0;
-- 
2.21.0

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

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

[FFmpeg-devel] [PATCH 2/2] avcodec/motion_est: fix penalty_factor for b frames

2020-03-22 Thread Ramiro Polla
In ff_estimate_b_frame_motion(), penalty_factor would be used before
being initialized in estimate_motion_b(). Also, the initialization
would happen more than once unnecessarily.
---
 libavcodec/motion_est.c  | 15 ---
 tests/ref/vsynth/vsynth2-mpeg2-422   |  6 +++---
 tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd |  6 +++---
 tests/ref/vsynth/vsynth2-mpeg4-adap  |  6 +++---
 4 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 02c75fd470..1feb46cec3 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1123,9 +1123,6 @@ static int estimate_motion_b(MpegEncContext *s, int mb_x, 
int mb_y,
 uint8_t * const mv_penalty= c->mv_penalty[f_code] + MAX_DMV;
 int mv_scale;
 
-c->penalty_factor= get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->me_cmp);
-c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->me_sub_cmp);
-c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->mb_cmp);
 c->current_mv_penalty= mv_penalty;
 
 get_limits(s, 16*mb_x, 16*mb_y);
@@ -1491,7 +1488,6 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
  int mb_x, int mb_y)
 {
 MotionEstContext * const c= &s->me;
-const int penalty_factor= c->mb_penalty_factor;
 int fmin, bmin, dmin, fbmin, bimin, fimin;
 int type=0;
 const int xy = mb_y*s->mb_stride + mb_x;
@@ -1517,18 +1513,23 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
 dmin= direct_search(s, mb_x, mb_y);
 else
 dmin= INT_MAX;
+
+c->penalty_factor= get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->me_cmp);
+c->sub_penalty_factor= get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->me_sub_cmp);
+c->mb_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, 
c->avctx->mb_cmp);
+
 // FIXME penalty stuff for non-MPEG-4
 c->skip=0;
 fmin = estimate_motion_b(s, mb_x, mb_y, s->b_forw_mv_table, 0, s->f_code) +
-   3 * penalty_factor;
+   3 * c->mb_penalty_factor;
 
 c->skip=0;
 bmin = estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) +
-   2 * penalty_factor;
+   2 * c->mb_penalty_factor;
 ff_dlog(s, " %d %d ", s->b_forw_mv_table[xy][0], 
s->b_forw_mv_table[xy][1]);
 
 c->skip=0;
-fbmin= bidir_refine(s, mb_x, mb_y) + penalty_factor;
+fbmin= bidir_refine(s, mb_x, mb_y) + c->mb_penalty_factor;
 ff_dlog(s, "%d %d %d %d\n", dmin, fmin, bmin, fbmin);
 
 if (s->avctx->flags & AV_CODEC_FLAG_INTERLACED_ME) {
diff --git a/tests/ref/vsynth/vsynth2-mpeg2-422 
b/tests/ref/vsynth/vsynth2-mpeg2-422
index ec7244f9f9..e945a4cc0e 100644
--- a/tests/ref/vsynth/vsynth2-mpeg2-422
+++ b/tests/ref/vsynth/vsynth2-mpeg2-422
@@ -1,4 +1,4 @@
-b2fa9b73c3547191ecc01b8163abd4e5 *tests/data/fate/vsynth2-mpeg2-422.mpeg2video
-379164 tests/data/fate/vsynth2-mpeg2-422.mpeg2video
-704f6a96f93c2409219bd48b74169041 
*tests/data/fate/vsynth2-mpeg2-422.out.rawvideo
+6fc8dc1d76379e459051ca393101c090 *tests/data/fate/vsynth2-mpeg2-422.mpeg2video
+379173 tests/data/fate/vsynth2-mpeg2-422.mpeg2video
+9199d5aaa1709d2584e21e58d76d44fb 
*tests/data/fate/vsynth2-mpeg2-422.out.rawvideo
 stddev:4.17 PSNR: 35.73 MAXDIFF:   70 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd 
b/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd
index 16de39edfc..f5bbecfcb2 100644
--- a/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd
+++ b/tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd
@@ -1,4 +1,4 @@
-907a30295ed8323780eee08e606af0ab 
*tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
-269722 tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
-d2d9793bf8f3427b5cc17a1be78ddd64 
*tests/data/fate/vsynth2-mpeg2-ivlc-qprd.out.rawvideo
+f612ea89aa79a7f7b93a8acf332705c4 
*tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
+269723 tests/data/fate/vsynth2-mpeg2-ivlc-qprd.mpeg2video
+88e17886e6383755829d7da519fd5e79 
*tests/data/fate/vsynth2-mpeg2-ivlc-qprd.out.rawvideo
 stddev:5.54 PSNR: 33.25 MAXDIFF:   94 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth/vsynth2-mpeg4-adap 
b/tests/ref/vsynth/vsynth2-mpeg4-adap
index a3223f6363..1ae0a65e4f 100644
--- a/tests/ref/vsynth/vsynth2-mpeg4-adap
+++ b/tests/ref/vsynth/vsynth2-mpeg4-adap
@@ -1,4 +1,4 @@
-4bff98da2342836476da817428594403 *tests/data/fate/vsynth2-mpeg4-adap.avi
-213508 tests/data/fate/vsynth2-mpeg4-adap.avi
-0c709f2b81f4593eaa29490332c2cb39 
*tests/data/fate/vsynth2-mpeg4-adap.out.rawvideo
+fcb79c0dcc00b306b79c354e589b6b69 *tests/data/fate/vsynth2-mpeg4-adap.avi
+213526 tests/data/fate/vsynth2-mpeg4-adap.avi
+71a34a48a81485f938d2c60a3d34ed39 
*tests/data/fate/vsynth2-mpeg4-adap.out.rawvideo
 stddev:4.87 PSNR: 34.36 MAXDIFF:   86 bytes:  7603200/  7603200
-- 
2.11.0

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/wmadec: cosmetics

2020-03-22 Thread James Almer
On 3/22/2020 11:46 AM, Ramiro Polla wrote:
> On Tue, Nov 5, 2019 at 2:35 PM Michael Niedermayer
>  wrote:
>> On Tue, Nov 05, 2019 at 11:13:50AM +0100, Ramiro Polla wrote:
>>>  libavcodec/wmadec.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> LGTM
> 
> ping

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/get_bits: cosmetics

2020-03-22 Thread James Almer
On 3/22/2020 11:45 AM, Ramiro Polla wrote:
> On Tue, Nov 5, 2019 at 2:35 PM Michael Niedermayer
>  wrote:
>> On Tue, Nov 05, 2019 at 11:13:49AM +0100, Ramiro Polla wrote:
>>>  libavcodec/get_bits.h | 8 
>>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> LGTM
> 
> ping

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

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

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/get_bits: cosmetics

2020-03-22 Thread Ramiro Polla
On Tue, Nov 5, 2019 at 2:35 PM Michael Niedermayer
 wrote:
> On Tue, Nov 05, 2019 at 11:13:49AM +0100, Ramiro Polla wrote:
> >  libavcodec/get_bits.h | 8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
>
> LGTM

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

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

Re: [FFmpeg-devel] [PATCH 2/2] avcodec/wmadec: cosmetics

2020-03-22 Thread Ramiro Polla
On Tue, Nov 5, 2019 at 2:35 PM Michael Niedermayer
 wrote:
> On Tue, Nov 05, 2019 at 11:13:50AM +0100, Ramiro Polla wrote:
> >  libavcodec/wmadec.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> LGTM

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

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

Re: [FFmpeg-devel] [PATCH 04/21] avformat: Redo cleanup of demuxer upon read_header() failure

2020-03-22 Thread Michael Niedermayer
On Sun, Mar 22, 2020 at 04:47:39AM +0100, Andreas Rheinhardt wrote:
> If reading the header fails, the demuxer's read_close() function (if
> existing) is not called automatically; instead several demuxers call it
> via "goto fail" in read_header().
> 
> This commit intends to change this by adding a flag to AVInputFormat
> that can be used to set on a per-AVInputFormat basis whether read_close()
> should be called generically after an error during read_header().
> 
> The flag controlling this behaviour has been added because it might be
> unsafe to call read_close() generally (e.g. this might lead to
> read_close() being called twice and this might e.g. lead to double-frees
> if av_free() instead of av_freep() is used; or a size field has not
> been reset after freeing the elements (see the mov demuxer for an
> example of this)). Yet the intention is to check and fix all demuxers
> and make the flag redundant in the medium run.
> 
> The flag has been added to a new internal field of AVInputFormat,
> flags_internal. When it has become redundant, it can be removed again
> at the next major version bump.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/avformat.h |  7 +++
>  libavformat/utils.c| 11 +--
>  2 files changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 9b9b634ec3..50b90788b1 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -780,6 +780,13 @@ typedef struct AVInputFormat {
>   * @see avdevice_capabilities_free() for more details.
>   */
>  int (*free_device_capabilities)(struct AVFormatContext *s, struct 
> AVDeviceCapabilitiesQuery *caps);
> +
> +#define FF_INPUTFORMAT_HEADER_CLEANUP 0x0001 /**< read_close() should be 
> called
> +  on read_header() failure */
> +/**
> + * Can use flags: FF_INPUTFORMAT_HEADER_CLEANUP
> + */
> +int flags_internal;
>  } AVInputFormat;
>  /**
>   * @}

This feature is a good idea.

thx

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

Observe your enemies, for they first find out your faults. -- Antisthenes


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

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

Re: [FFmpeg-devel] [PATCH 13/14] tools: add XLSTs script to generate matroska semantic files

2020-03-22 Thread Steve Lhomme


> On 22 Mar 2020, at 11:34, Carl Eugen Hoyos  wrote:
> 
> Am So., 22. März 2020 um 10:02 Uhr schrieb Steve Lhomme :
>> 
>> From: Steve Lhomme 
>> 
>> Usage:
>> xsltproc -o matroska_ids.h schema_2_lavf_h.xsl ebml_matroska.xml
>> xsltproc -o matroskasem.c schema_2_lavf_sem_c.xsl ebml_matroska.xml
>> 
>> The ebml_matroska.xml file comes from
>> https://github.com/cellar-wg/matroska-specification/blob/master/ebml_matroska.xml
>> With an extra TagDefault_Bug element to parse an old invalid tag ID.
> 
>> tools/ebml_matroska.xml   | 1344 +
> 
> I would have expected that this file is not part of the FFmpeg source code.

I'm ok with that, although the original file is modified to add a bogus element 
still supported by lavf. If at some point the files are generated (before 
building or making a source package) the file should be down and patched to 
generate the files.

It seems FFmpeg doesn't have generated source files yet so I'm not sure what is 
the best/recommended way.

> 
>> tools/schema_2_lavf_h.xsl |  741 ++
>> tools/schema_2_lavf_sem_c.xsl | 1163 
>> 3 files changed, 3248 insertions(+)
>> create mode 100644 tools/ebml_matroska.xml
>> create mode 100644 tools/schema_2_lavf_h.xsl
>> create mode 100644 tools/schema_2_lavf_sem_c.xsl
> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

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

Re: [FFmpeg-devel] [PATCH v2] avformat/bethsoftvid: Avoid allocations and frees for palettes

2020-03-22 Thread Michael Niedermayer
On Sat, Mar 21, 2020 at 10:22:08AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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

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

Re: [FFmpeg-devel] [PATCH 2/2] avformat/bethsoftvid: Fix potential memleak upon reallocation failure

2020-03-22 Thread Michael Niedermayer
On Sat, Mar 21, 2020 at 10:29:26AM +0100, Paul B Mahol wrote:
> LGTM

will apply

thx

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

What does censorship reveal? It reveals fear. -- Julian Assange


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

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

Re: [FFmpeg-devel] [PATCH 1/2] avformat/hnm: Check for extradata allocation failure

2020-03-22 Thread Michael Niedermayer
On Sat, Mar 21, 2020 at 10:21:02AM +0100, Paul B Mahol wrote:
> lgtm

will apply

thx

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

Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.


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

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

Re: [FFmpeg-devel] [PATCH] avformat/subtitles: Don't increment packet counter prematurely

2020-03-22 Thread Michael Niedermayer
On Sat, Mar 21, 2020 at 04:50:20AM +0100, Andreas Rheinhardt wrote:
> Do it only if the packet has been successfully allocated in
> av_new_packet() -- otherwise on error a completely uninitialized packet
> would be unreferenced later.
> 
> Signed-off-by: Andreas Rheinhardt 
> ---
>  libavformat/subtitles.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

will apply

thx

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

Never trust a computer, one day, it may think you are the virus. -- Compn


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

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

Re: [FFmpeg-devel] [PATCH v1] avcodec/decode: increase nb_bsfs after av_bsf_alloc in case alloc failed

2020-03-22 Thread Michael Niedermayer
On Tue, Dec 24, 2019 at 09:06:18AM +0800, lance.lmw...@gmail.com wrote:
> From: Limin Wang 
> 
> Signed-off-by: Limin Wang 
> ---
>  libavcodec/decode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

thx


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety -- Benjamin Franklin


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

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

Re: [FFmpeg-devel] [PATCH 13/14] tools: add XLSTs script to generate matroska semantic files

2020-03-22 Thread Carl Eugen Hoyos
Am So., 22. März 2020 um 10:02 Uhr schrieb Steve Lhomme :
>
> From: Steve Lhomme 
>
> Usage:
> xsltproc -o matroska_ids.h schema_2_lavf_h.xsl ebml_matroska.xml
> xsltproc -o matroskasem.c schema_2_lavf_sem_c.xsl ebml_matroska.xml
>
> The ebml_matroska.xml file comes from
> https://github.com/cellar-wg/matroska-specification/blob/master/ebml_matroska.xml
> With an extra TagDefault_Bug element to parse an old invalid tag ID.

>  tools/ebml_matroska.xml   | 1344 +

I would have expected that this file is not part of the FFmpeg source code.

>  tools/schema_2_lavf_h.xsl |  741 ++
>  tools/schema_2_lavf_sem_c.xsl | 1163 
>  3 files changed, 3248 insertions(+)
>  create mode 100644 tools/ebml_matroska.xml
>  create mode 100644 tools/schema_2_lavf_h.xsl
>  create mode 100644 tools/schema_2_lavf_sem_c.xsl

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

[FFmpeg-devel] [PATCH 10/14] avformat/matroskadec: move the elements semantic in a separate file

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

So the file can be generated from the Matroska Schema.

The EbmlSyntax structures are not shared between files.
matroska_segments and matroska_cluster_enter also have their size predefined.

No functional changes.
---
 libavformat/Makefile  |   2 +-
 libavformat/matroskadec.c | 668 +-
 libavformat/matroskasem.c | 384 ++
 libavformat/matroskasem.h | 362 +
 4 files changed, 748 insertions(+), 668 deletions(-)
 create mode 100644 libavformat/matroskasem.c
 create mode 100644 libavformat/matroskasem.h

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 8fd0d43721..09cd0d49ce 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -294,7 +294,7 @@ OBJS-$(CONFIG_LVF_DEMUXER)   += lvfdec.o
 OBJS-$(CONFIG_LXF_DEMUXER)   += lxfdec.o
 OBJS-$(CONFIG_M4V_DEMUXER)   += m4vdec.o rawdec.o
 OBJS-$(CONFIG_M4V_MUXER) += rawenc.o
-OBJS-$(CONFIG_MATROSKA_DEMUXER)  += matroskadec.o matroska.o  \
+OBJS-$(CONFIG_MATROSKA_DEMUXER)  += matroskadec.o matroskasem.o 
matroska.o \
 rmsipr.o flac_picture.o \
 oggparsevorbis.o vorbiscomment.o \
 flac_picture.o replaygain.o
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index b021a4cce0..8aa2cbda61 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -54,6 +54,7 @@
 #include "internal.h"
 #include "isom.h"
 #include "matroska.h"
+#include "matroskasem.h"
 #include "oggdec.h"
 /* For ff_codec_get_id(). */
 #include "riff.h"
@@ -80,673 +81,6 @@
  * to this many bytes of unknown data 
for the
  * SKIP_THRESHOLD check. */
 
-typedef enum {
-EBML_NONE,
-EBML_UINT,
-EBML_SINT,
-EBML_FLOAT,
-EBML_STR,
-EBML_UTF8,
-EBML_BIN,
-EBML_NEST,
-EBML_LEVEL1,
-EBML_STOP,
-EBML_TYPE_COUNT
-} EbmlType;
-
-typedef const struct EbmlSyntax {
-uint32_t id;
-EbmlType type;
-size_t list_elem_size;
-size_t data_offset;
-union {
-int64_t i;
-uint64_tu;
-double  f;
-const char *s;
-const struct EbmlSyntax *n;
-} def;
-} EbmlSyntax;
-
-typedef struct EbmlList {
-int nb_elem;
-unsigned int alloc_elem_size;
-void *elem;
-} EbmlList;
-
-typedef struct EbmlBin {
-int  size;
-AVBufferRef *buf;
-uint8_t *data;
-int64_t  pos;
-} EbmlBin;
-
-typedef struct Ebml {
-uint64_t version;
-uint64_t max_size;
-uint64_t id_length;
-char*doctype;
-uint64_t doctype_version;
-} Ebml;
-
-typedef struct MatroskaTrackCompression {
-uint64_t algo;
-EbmlBin  settings;
-} MatroskaTrackCompression;
-
-typedef struct MatroskaTrackEncryption {
-uint64_t algo;
-EbmlBin  key_id;
-} MatroskaTrackEncryption;
-
-typedef struct MatroskaTrackEncoding {
-uint64_t scope;
-uint64_t type;
-MatroskaTrackCompression compression;
-MatroskaTrackEncryption encryption;
-} MatroskaTrackEncoding;
-
-typedef struct MatroskaMasteringMeta {
-double r_x;
-double r_y;
-double g_x;
-double g_y;
-double b_x;
-double b_y;
-double white_x;
-double white_y;
-double max_luminance;
-double min_luminance;
-} MatroskaMasteringMeta;
-
-typedef struct MatroskaTrackVideoColor {
-uint64_t matrix_coefficients;
-uint64_t bits_per_channel;
-uint64_t chroma_sub_horz;
-uint64_t chroma_sub_vert;
-uint64_t cb_sub_horz;
-uint64_t cb_sub_vert;
-uint64_t chroma_siting_horz;
-uint64_t chroma_siting_vert;
-uint64_t range;
-uint64_t transfer_characteristics;
-uint64_t primaries;
-uint64_t max_cll;
-uint64_t max_fall;
-MatroskaMasteringMeta mastering_meta;
-} MatroskaTrackVideoColor;
-
-typedef struct MatroskaTrackVideoProjection {
-uint64_t type;
-EbmlBin private;
-double yaw;
-double pitch;
-double roll;
-} MatroskaTrackVideoProjection;
-
-typedef struct MatroskaTrackVideo {
-double   frame_rate;
-uint64_t display_width;
-uint64_t display_height;
-uint64_t pixel_width;
-uint64_t pixel_height;
-EbmlBin  color_space;
-uint64_t display_unit;
-uint64_t interlaced;
-uint64_t field_order;
-uint64_t stereo_mode;
-uint64_t alpha_mode;
-EbmlList color;
-MatroskaTrackVideoProjection projection;
-} MatroskaTrackVideo;
-
-typedef struct MatroskaTrackAudio {
-double   samplerate;
-double   out_samplerate;
-uint64_t bitdepth;
-uint64_t channels;
-
-/* real audio header (extracted from extradata) */
-int  coded_framesize;
-int  sub_packet_h;
-int  frame_size;
-int  sub_packet_size;
-int  sub_packet_cnt;
-int  pkt_cnt;
-uint64_t buf_ti

[FFmpeg-devel] [PATCH 12/14] avformat/matroskasem: reorder some EbmlSyntax elements

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

So it's easier to match with the XSLT ordering which has limited possibilities
(15 max criteria for all the syntax tables).

No functional changes.
---
 libavformat/matroskasem.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/libavformat/matroskasem.c b/libavformat/matroskasem.c
index 27aa6d9c4e..aca506b943 100644
--- a/libavformat/matroskasem.c
+++ b/libavformat/matroskasem.c
@@ -101,10 +101,6 @@ EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEODISPLAYHEIGHT,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_height), { .u=-1 } },
 { MATROSKA_ID_VIDEOPIXELWIDTH, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_width) },
 { MATROSKA_ID_VIDEOPIXELHEIGHT,EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, pixel_height) },
-{ MATROSKA_ID_VIDEOCOLORSPACE, EBML_BIN,   0, 
offsetof(MatroskaTrackVideo, color_space) },
-{ MATROSKA_ID_VIDEOALPHAMODE,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, alpha_mode) },
-{ MATROSKA_ID_VIDEOCOLOR,  EBML_NEST,  
sizeof(MatroskaTrackVideoColor), offsetof(MatroskaTrackVideo, color), { .n = 
matroska_track_video_color } },
-{ MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
 { MATROSKA_ID_VIDEOPIXELCROPB, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPT, EBML_NONE },
 { MATROSKA_ID_VIDEOPIXELCROPL, EBML_NONE },
@@ -112,6 +108,10 @@ EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEODISPLAYUNIT,EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_unit), { .u= 
MATROSKA_VIDEO_DISPLAYUNIT_PIXELS } },
 { MATROSKA_ID_VIDEOFLAGINTERLACED, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, interlaced),  { .u = 
MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED } },
 { MATROSKA_ID_VIDEOFIELDORDER, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, field_order), { .u = 
MATROSKA_VIDEO_FIELDORDER_UNDETERMINED } },
+{ MATROSKA_ID_VIDEOALPHAMODE,  EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, alpha_mode) },
+{ MATROSKA_ID_VIDEOCOLORSPACE, EBML_BIN,   0, 
offsetof(MatroskaTrackVideo, color_space) },
+{ MATROSKA_ID_VIDEOCOLOR,  EBML_NEST,  
sizeof(MatroskaTrackVideoColor), offsetof(MatroskaTrackVideo, color), { .n = 
matroska_track_video_color } },
+{ MATROSKA_ID_VIDEOPROJECTION, EBML_NEST,  0, 
offsetof(MatroskaTrackVideo, projection), { .n = 
matroska_track_video_projection } },
 { MATROSKA_ID_VIDEOSTEREOMODE, EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, stereo_mode), { .u = 
MATROSKA_VIDEO_STEREOMODE_TYPE_NB } },
 { MATROSKA_ID_VIDEOASPECTRATIO,EBML_NONE },
 CHILD_OF(matroska_track)
@@ -187,18 +187,18 @@ EbmlSyntax matroska_track[] = {
 { MATROSKA_ID_TRACKFLAGFORCED,   EBML_UINT,  0, 
offsetof(MatroskaTrack, flag_forced) },
 { MATROSKA_ID_TRACKVIDEO,EBML_NEST,  0, 
offsetof(MatroskaTrack, video),{ .n = matroska_track_video } },
 { MATROSKA_ID_TRACKAUDIO,EBML_NEST,  0, 
offsetof(MatroskaTrack, audio),{ .n = matroska_track_audio } },
-{ MATROSKA_ID_TRACKOPERATION,EBML_NEST,  0, 
offsetof(MatroskaTrack, operation),{ .n = matroska_track_operation } },
-{ MATROSKA_ID_TRACKCONTENTENCODINGS, EBML_NEST,  0, 0, 
{ .n = matroska_track_encodings } },
-{ MATROSKA_ID_TRACKMAXBLKADDID,  EBML_UINT,  0, 
offsetof(MatroskaTrack, max_block_additional_id) },
-{ MATROSKA_ID_SEEKPREROLL,   EBML_UINT,  0, 
offsetof(MatroskaTrack, seek_preroll) },
 { MATROSKA_ID_TRACKFLAGENABLED,  EBML_NONE },
 { MATROSKA_ID_TRACKFLAGLACING,   EBML_NONE },
+{ MATROSKA_ID_TRACKMINCACHE, EBML_NONE },
+{ MATROSKA_ID_TRACKMAXCACHE, EBML_NONE },
+{ MATROSKA_ID_TRACKMAXBLKADDID,  EBML_UINT,  0, 
offsetof(MatroskaTrack, max_block_additional_id) },
 { MATROSKA_ID_CODECNAME, EBML_NONE },
-{ MATROSKA_ID_CODECDECODEALL,EBML_NONE },
 { MATROSKA_ID_CODECINFOURL,  EBML_NONE },
 { MATROSKA_ID_CODECDOWNLOADURL,  EBML_NONE },
-{ MATROSKA_ID_TRACKMINCACHE, EBML_NONE },
-{ MATROSKA_ID_TRACKMAXCACHE, EBML_NONE },
+{ MATROSKA_ID_CODECDECODEALL,EBML_NONE },
+{ MATROSKA_ID_SEEKPREROLL,   EBML_UINT,  0, 
offsetof(MatroskaTrack, seek_preroll) },
+{ MATROSKA_ID_TRACKOPERATION,EBML_NEST,  0, 
offsetof(MatroskaTrack, operation),{ .n = matroska_track_operation } },
+{ MATROSKA_ID_TRACKCONTENTENCODINGS, EBML_NEST,  0, 0, 
{ .n = matroska_track_encodings } },
 CHILD_OF(matroska_tracks)
 };
 
@@ -307,10 +307,10 @@ EbmlSyntax matroska_cluster_parsing[] = {
 { MATROSKA_ID_SIMPLEBLOCK, EBML_BIN,  0, offsetof(MatroskaBlock, bin) 
},
 { MATROSKA_ID_BLOCKGROUP,  EBML_NEST, 0, 0, { .n = matroska_blockgroup 
} },
 { MATROSKA_I

[FFmpeg-devel] [PATCH 14/14] avformat/matroska: use the generated semantic files

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

No functional value/added removed, only more regular spacing.
---
 libavformat/matroska_ids.h | 290 +++---
 libavformat/matroskasem.c  | 356 +++--
 2 files changed, 326 insertions(+), 320 deletions(-)

diff --git a/libavformat/matroska_ids.h b/libavformat/matroska_ids.h
index 321e555bec..f8e7cc927e 100644
--- a/libavformat/matroska_ids.h
+++ b/libavformat/matroska_ids.h
@@ -1,5 +1,7 @@
 /*
  * Matroska Semantic constants
+ *  DO NOT EDIT, GENERATED WITH schema_2_lavf_h.xsl
+ *
  * Copyright (c) 2003-2020 The FFmpeg Project
  *
  * This file is part of FFmpeg.
@@ -30,162 +32,164 @@
 #define MATROSKA_ID_SEGMENT0x18538067
 
 /* Matroska top-level master IDs */
-#define MATROSKA_ID_INFO   0x1549A966
-#define MATROSKA_ID_TRACKS 0x1654AE6B
-#define MATROSKA_ID_CUES   0x1C53BB6B
-#define MATROSKA_ID_TAGS   0x1254C367
-#define MATROSKA_ID_SEEKHEAD   0x114D9B74
-#define MATROSKA_ID_ATTACHMENTS 0x1941A469
-#define MATROSKA_ID_CLUSTER0x1F43B675
-#define MATROSKA_ID_CHAPTERS   0x1043A770
+#define MATROSKA_ID_INFO0x1549A966
+#define MATROSKA_ID_TRACKS  0x1654AE6B
+#define MATROSKA_ID_CUES0x1C53BB6B
+#define MATROSKA_ID_TAGS0x1254C367
+#define MATROSKA_ID_SEEKHEAD0x114D9B74
+#define MATROSKA_ID_ATTACHMENTS 0x1941A469
+#define MATROSKA_ID_CLUSTER 0x1F43B675
+#define MATROSKA_ID_CHAPTERS0x1043A770
 
 /* IDs in the info master */
-#define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
-#define MATROSKA_ID_DURATION   0x4489
-#define MATROSKA_ID_TITLE  0x7BA9
-#define MATROSKA_ID_WRITINGAPP 0x5741
-#define MATROSKA_ID_MUXINGAPP  0x4D80
-#define MATROSKA_ID_DATEUTC0x4461
-#define MATROSKA_ID_SEGMENTUID 0x73A4
+#define MATROSKA_ID_TIMECODESCALE   0x2AD7B1
+#define MATROSKA_ID_DURATION0x4489
+#define MATROSKA_ID_TITLE   0x7BA9
+#define MATROSKA_ID_WRITINGAPP  0x5741
+#define MATROSKA_ID_MUXINGAPP   0x4D80
+#define MATROSKA_ID_DATEUTC 0x4461
+#define MATROSKA_ID_SEGMENTUID  0x73A4
 
-/* ID in the tracks master */
-#define MATROSKA_ID_TRACKENTRY 0xAE
+/* IDs in the tracks master */
+#define MATROSKA_ID_TRACKENTRY  0xAE
 
 /* IDs in the trackentry master */
-#define MATROSKA_ID_TRACKNUMBER 0xD7
-#define MATROSKA_ID_TRACKUID   0x73C5
-#define MATROSKA_ID_TRACKTYPE  0x83
-#define MATROSKA_ID_TRACKVIDEO 0xE0
-#define MATROSKA_ID_TRACKAUDIO 0xE1
-#define MATROSKA_ID_TRACKOPERATION 0xE2
-#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
-#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
-#define MATROSKA_ID_TRACKNAME  0x536E
-#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
-#define MATROSKA_ID_CODECID0x86
-#define MATROSKA_ID_CODECPRIVATE 0x63A2
-#define MATROSKA_ID_CODECNAME  0x258688
-#define MATROSKA_ID_CODECINFOURL 0x3B4040
-#define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
-#define MATROSKA_ID_CODECDECODEALL 0xAA
-#define MATROSKA_ID_CODECDELAY 0x56AA
-#define MATROSKA_ID_SEEKPREROLL 0x56BB
-#define MATROSKA_ID_TRACKFLAGENABLED 0xB9
-#define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
-#define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
-#define MATROSKA_ID_TRACKFLAGLACING 0x9C
-#define MATROSKA_ID_TRACKMINCACHE 0x6DE7
-#define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
-#define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
-#define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80
+#define MATROSKA_ID_TRACKNUMBER 0xD7
+#define MATROSKA_ID_TRACKUID0x73C5
+#define MATROSKA_ID_TRACKTYPE   0x83
+#define MATROSKA_ID_TRACKVIDEO  0xE0
+#define MATROSKA_ID_TRACKAUDIO  0xE1
+#define MATROSKA_ID_TRACKOPERATION  0xE2
+#define MATROSKA_ID_TRACKTIMECODESCALE  0x23314F
+#define MATROSKA_ID_TRACKMAXBLKADDID0x55EE
+#define MATROSKA_ID_TRACKNAME   0x536E
+#define MATROSKA_ID_TRACKLANGUAGE   0x22B59C
+#define MATROSKA_ID_CODECID 0x86
+#define MATROSKA_ID_CODECPRIVATE0x63A2
+#define MATROSKA_ID_CODECNAME   0x258688
+#define MATROSKA_ID_CODECINFOURL0x3B4040
+#define MATROSKA_ID_CODECDOWNLOADURL0x26B240
+#define MATROSKA_ID_CODECDECODEALL  0xAA
+#define MATROSKA_ID_CODECDELAY  0x56AA
+#define MATROSKA_ID_SEEKPREROLL 0x56BB
+#define MATROSKA_ID_TRACKFLAGENABLED0xB9
+#define MATROSKA_ID_TRACKFLAGDEFAULT0x88
+#define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
+#define MATROSKA_ID_TRACKFLAGLACING 0x9C
+#define MATROSKA_ID_TRACKMINCACHE   0x6DE7
+#define MATROSKA_ID_TRACKMAXCACHE   0x6DF8
+#define MATROSKA_ID_TRACKDEFAULTDURATION  0x23E383
+#define MATROSKA_ID_TRACKCONTENTENCODINGS  0x6D80
 
 /* IDs in the contentencodings master */
-#define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
+#define MATROSKA_ID_TRACKCONTENTENCODING  0x6240
 
 /* IDs in the content encoding master */
-#define MATROSKA_ID_ENCODINGORDER 0x5031
-#define MATROSKA_ID_ENCODINGSCOPE 0x5032
-#define MATROSKA_ID_ENCODINGTYPE 0x5033

[FFmpeg-devel] [PATCH 11/14] avformat/matroskasem: reorder EbmlSyntax tables

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

So they are sorted by their EBML path, in reverse order so we don't extra
declarations.

No functional changes.
---
 libavformat/matroskasem.c | 256 +++---
 1 file changed, 128 insertions(+), 128 deletions(-)

diff --git a/libavformat/matroskasem.c b/libavformat/matroskasem.c
index ce9331e044..27aa6d9c4e 100644
--- a/libavformat/matroskasem.c
+++ b/libavformat/matroskasem.c
@@ -54,15 +54,13 @@ EbmlSyntax ebml_syntax[] = {
 { 0 }
 };
 
-static EbmlSyntax matroska_info[] = {
-{ MATROSKA_ID_TIMECODESCALE, EBML_UINT,  0, offsetof(MatroskaDemuxContext, 
time_scale), { .u = 100 } },
-{ MATROSKA_ID_DURATION,  EBML_FLOAT, 0, offsetof(MatroskaDemuxContext, 
duration) },
-{ MATROSKA_ID_TITLE, EBML_UTF8,  0, offsetof(MatroskaDemuxContext, 
title) },
-{ MATROSKA_ID_WRITINGAPP,EBML_NONE },
-{ MATROSKA_ID_MUXINGAPP, EBML_UTF8, 0, offsetof(MatroskaDemuxContext, 
muxingapp) },
-{ MATROSKA_ID_DATEUTC,   EBML_BIN,  0, offsetof(MatroskaDemuxContext, 
date_utc) },
-{ MATROSKA_ID_SEGMENTUID,EBML_NONE },
-CHILD_OF(matroska_segment)
+static EbmlSyntax matroska_track_video_projection[] = {
+{ MATROSKA_ID_VIDEOPROJECTIONTYPE,EBML_UINT,  0, 
offsetof(MatroskaTrackVideoProjection, type), { .u = 
MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR } },
+{ MATROSKA_ID_VIDEOPROJECTIONPRIVATE, EBML_BIN,   0, 
offsetof(MatroskaTrackVideoProjection, private) },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEYAW, EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, yaw), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH,   EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, pitch), { .f=0.0 } },
+{ MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, roll), { .f=0.0 } },
+CHILD_OF(matroska_track_video)
 };
 
 static EbmlSyntax matroska_mastering_meta[] = {
@@ -97,15 +95,6 @@ EbmlSyntax matroska_track_video_color[] = {
 CHILD_OF(matroska_track_video)
 };
 
-static EbmlSyntax matroska_track_video_projection[] = {
-{ MATROSKA_ID_VIDEOPROJECTIONTYPE,EBML_UINT,  0, 
offsetof(MatroskaTrackVideoProjection, type), { .u = 
MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR } },
-{ MATROSKA_ID_VIDEOPROJECTIONPRIVATE, EBML_BIN,   0, 
offsetof(MatroskaTrackVideoProjection, private) },
-{ MATROSKA_ID_VIDEOPROJECTIONPOSEYAW, EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, yaw), { .f=0.0 } },
-{ MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH,   EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, pitch), { .f=0.0 } },
-{ MATROSKA_ID_VIDEOPROJECTIONPOSEROLL,EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideoProjection, roll), { .f=0.0 } },
-CHILD_OF(matroska_track_video)
-};
-
 EbmlSyntax matroska_track_video[] = {
 { MATROSKA_ID_VIDEOFRAMERATE,  EBML_FLOAT, 0, 
offsetof(MatroskaTrackVideo, frame_rate) },
 { MATROSKA_ID_VIDEODISPLAYWIDTH,   EBML_UINT,  0, 
offsetof(MatroskaTrackVideo, display_width), { .u=-1 } },
@@ -128,18 +117,20 @@ EbmlSyntax matroska_track_video[] = {
 CHILD_OF(matroska_track)
 };
 
-static EbmlSyntax matroska_track_audio[] = {
-{ MATROSKA_ID_AUDIOSAMPLINGFREQ,EBML_FLOAT, 0, 
offsetof(MatroskaTrackAudio, samplerate), { .f = 8000.0 } },
-{ MATROSKA_ID_AUDIOOUTSAMPLINGFREQ, EBML_FLOAT, 0, 
offsetof(MatroskaTrackAudio, out_samplerate) },
-{ MATROSKA_ID_AUDIOBITDEPTH,EBML_UINT,  0, 
offsetof(MatroskaTrackAudio, bitdepth) },
-{ MATROSKA_ID_AUDIOCHANNELS,EBML_UINT,  0, 
offsetof(MatroskaTrackAudio, channels),   { .u = 1 } },
-CHILD_OF(matroska_track)
+EbmlSyntax matroska_track_plane[] = {
+{ MATROSKA_ID_TRACKPLANEUID,  EBML_UINT, 0, 
offsetof(MatroskaTrackPlane,uid) },
+{ MATROSKA_ID_TRACKPLANETYPE, EBML_UINT, 0, 
offsetof(MatroskaTrackPlane,type) },
+CHILD_OF(matroska_track_combine_planes)
 };
 
-static EbmlSyntax matroska_track_encoding_compression[] = {
-{ MATROSKA_ID_ENCODINGCOMPALGO, EBML_UINT, 0, 
offsetof(MatroskaTrackCompression, algo) },
-{ MATROSKA_ID_ENCODINGCOMPSETTINGS, EBML_BIN,  0, 
offsetof(MatroskaTrackCompression, settings) },
-CHILD_OF(matroska_track_encoding)
+EbmlSyntax matroska_track_combine_planes[] = {
+{ MATROSKA_ID_TRACKPLANE, EBML_NEST, sizeof(MatroskaTrackPlane), 
offsetof(MatroskaTrackOperation,combine_planes), {.n = matroska_track_plane} },
+CHILD_OF(matroska_track_operation)
+};
+
+EbmlSyntax matroska_track_operation[] = {
+{ MATROSKA_ID_TRACKCOMBINEPLANES, EBML_NEST, 0, 0, {.n = 
matroska_track_combine_planes} },
+CHILD_OF(matroska_track)
 };
 
 static EbmlSyntax matroska_track_encoding_encryption[] = {
@@ -153,6 +144,12 @@ static EbmlSyntax matroska_track_encoding_encryption[] = {
 CHILD_OF(matroska_track_encoding)
 };
 
+static EbmlSyntax matroska_track_encoding_compression[] = {
+{ MATROSKA_ID_ENCODINGCOMPALGO, EBML_UINT, 0, 
offsetof(MatroskaTrackCompression, algo) },
+{ MAT

[FFmpeg-devel] [PATCH 09/14] avformat/matroskadec: remove some implicit default value

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

All integers should be initialized to 0. Make the tables more consistent by
only setting non zero values.
---
 libavformat/matroskadec.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 3640dd76d9..b021a4cce0 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -445,18 +445,18 @@ static EbmlSyntax matroska_mastering_meta[] = {
 
 static EbmlSyntax matroska_track_video_color[] = {
 { MATROSKA_ID_VIDEOCOLORMATRIXCOEFF,  EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, matrix_coefficients), { .u = 
AVCOL_SPC_UNSPECIFIED } },
-{ MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL,   EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, bits_per_channel), { .u=0 } },
-{ MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_sub_horz), { .u=0 } },
-{ MATROSKA_ID_VIDEOCOLORCHROMASUBVERT,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_sub_vert), { .u=0 } },
-{ MATROSKA_ID_VIDEOCOLORCBSUBHORZ,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, cb_sub_horz), { .u=0 } },
-{ MATROSKA_ID_VIDEOCOLORCBSUBVERT,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, cb_sub_vert), { .u=0 } },
+{ MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL,   EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, bits_per_channel) },
+{ MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_sub_horz) },
+{ MATROSKA_ID_VIDEOCOLORCHROMASUBVERT,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_sub_vert) },
+{ MATROSKA_ID_VIDEOCOLORCBSUBHORZ,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, cb_sub_horz) },
+{ MATROSKA_ID_VIDEOCOLORCBSUBVERT,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, cb_sub_vert) },
 { MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_siting_horz), { .u = 
MATROSKA_COLOUR_CHROMASITINGHORZ_UNDETERMINED } },
 { MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, chroma_siting_vert), { .u = 
MATROSKA_COLOUR_CHROMASITINGVERT_UNDETERMINED } },
 { MATROSKA_ID_VIDEOCOLORRANGE,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, range), { .u = AVCOL_RANGE_UNSPECIFIED } },
 { MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS, EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, transfer_characteristics), { .u = 
AVCOL_TRC_UNSPECIFIED } },
 { MATROSKA_ID_VIDEOCOLORPRIMARIES,EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, primaries), { .u = AVCOL_PRI_UNSPECIFIED } },
-{ MATROSKA_ID_VIDEOCOLORMAXCLL,   EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, max_cll), { .u=0 } },
-{ MATROSKA_ID_VIDEOCOLORMAXFALL,  EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, max_fall), { .u=0 } },
+{ MATROSKA_ID_VIDEOCOLORMAXCLL,   EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, max_cll) },
+{ MATROSKA_ID_VIDEOCOLORMAXFALL,  EBML_UINT, 0, 
offsetof(MatroskaTrackVideoColor, max_fall) },
 { MATROSKA_ID_VIDEOCOLORMASTERINGMETA,EBML_NEST, 0, 
offsetof(MatroskaTrackVideoColor, mastering_meta), { .n = 
matroska_mastering_meta } },
 CHILD_OF(matroska_track_video)
 };
@@ -501,13 +501,13 @@ static EbmlSyntax matroska_track_audio[] = {
 };
 
 static EbmlSyntax matroska_track_encoding_compression[] = {
-{ MATROSKA_ID_ENCODINGCOMPALGO, EBML_UINT, 0, 
offsetof(MatroskaTrackCompression, algo), { .u = 0 } },
+{ MATROSKA_ID_ENCODINGCOMPALGO, EBML_UINT, 0, 
offsetof(MatroskaTrackCompression, algo) },
 { MATROSKA_ID_ENCODINGCOMPSETTINGS, EBML_BIN,  0, 
offsetof(MatroskaTrackCompression, settings) },
 CHILD_OF(matroska_track_encoding)
 };
 
 static EbmlSyntax matroska_track_encoding_encryption[] = {
-{ MATROSKA_ID_ENCODINGENCALGO,EBML_UINT, 0, 
offsetof(MatroskaTrackEncryption,algo), {.u = 0} },
+{ MATROSKA_ID_ENCODINGENCALGO,EBML_UINT, 0, 
offsetof(MatroskaTrackEncryption,algo) },
 { MATROSKA_ID_ENCODINGENCKEYID,   EBML_BIN, 0, 
offsetof(MatroskaTrackEncryption,key_id) },
 { MATROSKA_ID_ENCODINGENCAESSETTINGS, EBML_NONE },
 { MATROSKA_ID_ENCODINGSIGALGO,EBML_NONE },
@@ -518,7 +518,7 @@ static EbmlSyntax matroska_track_encoding_encryption[] = {
 };
 static EbmlSyntax matroska_track_encoding[] = {
 { MATROSKA_ID_ENCODINGSCOPE,   EBML_UINT, 0, 
offsetof(MatroskaTrackEncoding, scope),   { .u = 1 } },
-{ MATROSKA_ID_ENCODINGTYPE,EBML_UINT, 0, 
offsetof(MatroskaTrackEncoding, type),{ .u = 0 } },
+{ MATROSKA_ID_ENCODINGTYPE,EBML_UINT, 0, 
offsetof(MatroskaTrackEncoding, type) },
 { MATROSKA_ID_ENCODINGCOMPRESSION, EBML_NEST, 0, 
offsetof(MatroskaTrackEncoding, compression), { .n = 
matroska_track_encoding_compression } },
 { MATROSKA_ID_ENCODINGENCRYPTION,  EBML_NEST, 0, 
offsetof(MatroskaTrackEncoding, encry

[FFmpeg-devel] [PATCH 05/14] avformat:matroska_ids: move some IDs in separate sections

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

According grouped with their parent's elements.

No value added/removed.
---
 libavformat/matroska_ids.h | 78 ++
 1 file changed, 54 insertions(+), 24 deletions(-)

diff --git a/libavformat/matroska_ids.h b/libavformat/matroska_ids.h
index 063dae5f94..ab77228da5 100644
--- a/libavformat/matroska_ids.h
+++ b/libavformat/matroska_ids.h
@@ -58,10 +58,8 @@
 #define MATROSKA_ID_TRACKVIDEO 0xE0
 #define MATROSKA_ID_TRACKAUDIO 0xE1
 #define MATROSKA_ID_TRACKOPERATION 0xE2
-#define MATROSKA_ID_TRACKCOMBINEPLANES 0xE3
-#define MATROSKA_ID_TRACKPLANE 0xE4
-#define MATROSKA_ID_TRACKPLANEUID  0xE5
-#define MATROSKA_ID_TRACKPLANETYPE 0xE6
+#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
+#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
 #define MATROSKA_ID_CODECID0x86
 #define MATROSKA_ID_CODECPRIVATE 0x63A2
 #define MATROSKA_ID_CODECNAME  0x258688
@@ -80,9 +78,19 @@
 #define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
 #define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
 #define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80
+
+/* IDs in the contentencodings master */
 #define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
-#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
-#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
+
+/* IDs in the trackoperation master */
+#define MATROSKA_ID_TRACKCOMBINEPLANES 0xE3
+
+/* IDs in the trackcombineplanes master */
+#define MATROSKA_ID_TRACKPLANE 0xE4
+
+/* IDs in the trackplane master */
+#define MATROSKA_ID_TRACKPLANEUID  0xE5
+#define MATROSKA_ID_TRACKPLANETYPE 0xE6
 
 /* IDs in the trackvideo master */
 #define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
@@ -102,7 +110,9 @@
 #define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
 #define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
 #define MATROSKA_ID_VIDEOCOLOR 0x55B0
+#define MATROSKA_ID_VIDEOPROJECTION 0x7670
 
+/* IDs in the colour master */
 #define MATROSKA_ID_VIDEOCOLORMATRIXCOEFF 0x55B1
 #define MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL 0x55B2
 #define MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ 0x55B3
@@ -113,12 +123,12 @@
 #define MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT 0x55B8
 #define MATROSKA_ID_VIDEOCOLORRANGE 0x55B9
 #define MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS 0x55BA
-
 #define MATROSKA_ID_VIDEOCOLORPRIMARIES 0x55BB
 #define MATROSKA_ID_VIDEOCOLORMAXCLL 0x55BC
 #define MATROSKA_ID_VIDEOCOLORMAXFALL 0x55BD
-
 #define MATROSKA_ID_VIDEOCOLORMASTERINGMETA 0x55D0
+
+/* IDs in the masteringmetadata master */
 #define MATROSKA_ID_VIDEOCOLOR_RX 0x55D1
 #define MATROSKA_ID_VIDEOCOLOR_RY 0x55D2
 #define MATROSKA_ID_VIDEOCOLOR_GX 0x55D3
@@ -130,7 +140,7 @@
 #define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMAX 0x55D9
 #define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN 0x55DA
 
-#define MATROSKA_ID_VIDEOPROJECTION 0x7670
+/* IDs in the projection master */
 #define MATROSKA_ID_VIDEOPROJECTIONTYPE 0x7671
 #define MATROSKA_ID_VIDEOPROJECTIONPRIVATE 0x7672
 #define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW 0x7673
@@ -140,7 +150,6 @@
 /* IDs in the trackaudio master */
 #define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
 #define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ 0x78B5
-
 #define MATROSKA_ID_AUDIOBITDEPTH 0x6264
 #define MATROSKA_ID_AUDIOCHANNELS 0x9F
 
@@ -149,10 +158,13 @@
 #define MATROSKA_ID_ENCODINGSCOPE 0x5032
 #define MATROSKA_ID_ENCODINGTYPE 0x5033
 #define MATROSKA_ID_ENCODINGCOMPRESSION 0x5034
+#define MATROSKA_ID_ENCODINGENCRYPTION 0x5035
+
+/* IDs in the contentcompression master */
 #define MATROSKA_ID_ENCODINGCOMPALGO 0x4254
 #define MATROSKA_ID_ENCODINGCOMPSETTINGS 0x4255
 
-#define MATROSKA_ID_ENCODINGENCRYPTION 0x5035
+/* IDs in the contentencryption master */
 #define MATROSKA_ID_ENCODINGENCAESSETTINGS 0x47E7
 #define MATROSKA_ID_ENCODINGENCALGO 0x47E1
 #define MATROSKA_ID_ENCODINGENCKEYID 0x47E2
@@ -177,13 +189,19 @@
 
 /* IDs in the tags master */
 #define MATROSKA_ID_TAG 0x7373
+
+/* IDs in the tag master */
 #define MATROSKA_ID_SIMPLETAG   0x67C8
-#define MATROSKA_ID_TAGNAME 0x45A3
-#define MATROSKA_ID_TAGSTRING   0x4487
+#define MATROSKA_ID_TAGTARGETS  0x63C0
+
+/* IDs in the simpletag master */
 #define MATROSKA_ID_TAGLANG 0x447A
 #define MATROSKA_ID_TAGDEFAULT  0x4484
+#define MATROSKA_ID_TAGSTRING   0x4487
 #define MATROSKA_ID_TAGDEFAULT_BUG  0x44B4
-#define MATROSKA_ID_TAGTARGETS  0x63C0
+#define MATROSKA_ID_TAGNAME 0x45A3
+
+/* IDs in the targets master */
 #define MATROSKA_ID_TAGTARGETS_TYPE   0x63CA
 #define MATROSKA_ID_TAGTARGETS_TYPEVALUE  0x68CA
 #define MATROSKA_ID_TAGTARGETS_TRACKUID   0x63C5
@@ -202,21 +220,27 @@
 #define MATROSKA_ID_CLUSTERPOSITION 0xA7
 #define MATROSKA_ID_CLUSTERPREVSIZE 0xAB
 #define MATROSKA_ID_BLOCKGROUP 0xA0
-#define MATROSKA_ID_BLOCKADDITIONS 0x75A1
-#define MATROSKA_ID_BLOCKMORE 0xA6
-#define MATROSKA_ID_BLOCKADDID 0xEE
-#define MATROSKA_ID_BLOCKADDITIONAL 0xA5
 #define MATROSKA_ID_SIMPLEBLOCK 0xA3
 
 /* IDs in the blockgroup master */
 #define MATROSKA_ID_BLOCK

[FFmpeg-devel] [PATCH 08/14] avformat/matroskadec: fix the default of the TagDefault element

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

By default a tag is the default one.
---
 libavformat/matroskadec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 383869bced..3640dd76d9 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -652,8 +652,8 @@ static EbmlSyntax matroska_simpletag[] = {
 { MATROSKA_ID_TAGNAME,EBML_UTF8, 0,   
offsetof(MatroskaTag, name) },
 { MATROSKA_ID_TAGSTRING,  EBML_UTF8, 0,   
offsetof(MatroskaTag, string) },
 { MATROSKA_ID_TAGLANG,EBML_STR,  0,   
offsetof(MatroskaTag, lang), { .s = "und" } },
-{ MATROSKA_ID_TAGDEFAULT, EBML_UINT, 0,   
offsetof(MatroskaTag, def) },
-{ MATROSKA_ID_TAGDEFAULT_BUG, EBML_UINT, 0,   
offsetof(MatroskaTag, def) },
+{ MATROSKA_ID_TAGDEFAULT, EBML_UINT, 0,   
offsetof(MatroskaTag, def), { .u = 1 } },
+{ MATROSKA_ID_TAGDEFAULT_BUG, EBML_UINT, 0,   
offsetof(MatroskaTag, def), { .u = 1 } },
 { MATROSKA_ID_SIMPLETAG,  EBML_NEST, sizeof(MatroskaTag), 
offsetof(MatroskaTag, sub),  { .n = matroska_simpletag } },
 CHILD_OF(matroska_tag)
 };
-- 
2.18.0

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

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

[FFmpeg-devel] [PATCH 07/14] avformat/matroskadec: fix the type of the TrackLanguage

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

It's an ASCII string, not a UTF-8 string.
---
 libavformat/matroskadec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4d7fdab99f..383869bced 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -554,7 +554,7 @@ static EbmlSyntax matroska_track[] = {
 { MATROSKA_ID_CODECID,   EBML_STR,   0, 
offsetof(MatroskaTrack, codec_id) },
 { MATROSKA_ID_CODECPRIVATE,  EBML_BIN,   0, 
offsetof(MatroskaTrack, codec_priv) },
 { MATROSKA_ID_CODECDELAY,EBML_UINT,  0, 
offsetof(MatroskaTrack, codec_delay) },
-{ MATROSKA_ID_TRACKLANGUAGE, EBML_UTF8,  0, 
offsetof(MatroskaTrack, language), { .s = "eng" } },
+{ MATROSKA_ID_TRACKLANGUAGE, EBML_STR,   0, 
offsetof(MatroskaTrack, language), { .s = "eng" } },
 { MATROSKA_ID_TRACKDEFAULTDURATION,  EBML_UINT,  0, 
offsetof(MatroskaTrack, default_duration) },
 { MATROSKA_ID_TRACKTIMECODESCALE,EBML_FLOAT, 0, 
offsetof(MatroskaTrack, time_scale),   { .f = 1.0 } },
 { MATROSKA_ID_TRACKFLAGDEFAULT,  EBML_UINT,  0, 
offsetof(MatroskaTrack, flag_default), { .u = 1 } },
-- 
2.18.0

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

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

[FFmpeg-devel] [PATCH 04/14] avformat/matroska: move Matroska IDs and enums in a separate header

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

So the file can be generated from the EBML Schema.

No functional change.
---
 libavformat/matroska.h | 302 +-
 libavformat/matroska_ids.h | 327 +
 2 files changed, 328 insertions(+), 301 deletions(-)
 create mode 100644 libavformat/matroska_ids.h

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 5520e9ce8f..10140dea48 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -23,6 +23,7 @@
 #define AVFORMAT_MATROSKA_H
 
 #include "libavcodec/avcodec.h"
+#include "matroska_ids.h"
 #include "metadata.h"
 #include "internal.h"
 
@@ -45,307 +46,6 @@
 #define EBML_ID_VOID   0xEC
 #define EBML_ID_CRC32  0xBF
 
-/*
- * Matroska element IDs, max. 32 bits
- */
-
-/* toplevel segment */
-#define MATROSKA_ID_SEGMENT0x18538067
-
-/* Matroska top-level master IDs */
-#define MATROSKA_ID_INFO   0x1549A966
-#define MATROSKA_ID_TRACKS 0x1654AE6B
-#define MATROSKA_ID_CUES   0x1C53BB6B
-#define MATROSKA_ID_TAGS   0x1254C367
-#define MATROSKA_ID_SEEKHEAD   0x114D9B74
-#define MATROSKA_ID_ATTACHMENTS 0x1941A469
-#define MATROSKA_ID_CLUSTER0x1F43B675
-#define MATROSKA_ID_CHAPTERS   0x1043A770
-
-/* IDs in the info master */
-#define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
-#define MATROSKA_ID_DURATION   0x4489
-#define MATROSKA_ID_TITLE  0x7BA9
-#define MATROSKA_ID_WRITINGAPP 0x5741
-#define MATROSKA_ID_MUXINGAPP  0x4D80
-#define MATROSKA_ID_DATEUTC0x4461
-#define MATROSKA_ID_SEGMENTUID 0x73A4
-
-/* ID in the tracks master */
-#define MATROSKA_ID_TRACKENTRY 0xAE
-
-/* IDs in the trackentry master */
-#define MATROSKA_ID_TRACKNUMBER 0xD7
-#define MATROSKA_ID_TRACKUID   0x73C5
-#define MATROSKA_ID_TRACKTYPE  0x83
-#define MATROSKA_ID_TRACKVIDEO 0xE0
-#define MATROSKA_ID_TRACKAUDIO 0xE1
-#define MATROSKA_ID_TRACKOPERATION 0xE2
-#define MATROSKA_ID_TRACKCOMBINEPLANES 0xE3
-#define MATROSKA_ID_TRACKPLANE 0xE4
-#define MATROSKA_ID_TRACKPLANEUID  0xE5
-#define MATROSKA_ID_TRACKPLANETYPE 0xE6
-#define MATROSKA_ID_CODECID0x86
-#define MATROSKA_ID_CODECPRIVATE 0x63A2
-#define MATROSKA_ID_CODECNAME  0x258688
-#define MATROSKA_ID_CODECINFOURL 0x3B4040
-#define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
-#define MATROSKA_ID_CODECDECODEALL 0xAA
-#define MATROSKA_ID_CODECDELAY 0x56AA
-#define MATROSKA_ID_SEEKPREROLL 0x56BB
-#define MATROSKA_ID_TRACKNAME  0x536E
-#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
-#define MATROSKA_ID_TRACKFLAGENABLED 0xB9
-#define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
-#define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
-#define MATROSKA_ID_TRACKFLAGLACING 0x9C
-#define MATROSKA_ID_TRACKMINCACHE 0x6DE7
-#define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
-#define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
-#define MATROSKA_ID_TRACKCONTENTENCODINGS 0x6D80
-#define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
-#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
-#define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
-
-/* IDs in the trackvideo master */
-#define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
-#define MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
-#define MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
-#define MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
-#define MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
-#define MATROSKA_ID_VIDEOPIXELCROPB 0x54AA
-#define MATROSKA_ID_VIDEOPIXELCROPT 0x54BB
-#define MATROSKA_ID_VIDEOPIXELCROPL 0x54CC
-#define MATROSKA_ID_VIDEOPIXELCROPR 0x54DD
-#define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
-#define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
-#define MATROSKA_ID_VIDEOFIELDORDER 0x9D
-#define MATROSKA_ID_VIDEOSTEREOMODE 0x53B8
-#define MATROSKA_ID_VIDEOALPHAMODE 0x53C0
-#define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
-#define MATROSKA_ID_VIDEOCOLORSPACE 0x2EB524
-#define MATROSKA_ID_VIDEOCOLOR 0x55B0
-
-#define MATROSKA_ID_VIDEOCOLORMATRIXCOEFF 0x55B1
-#define MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL 0x55B2
-#define MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ 0x55B3
-#define MATROSKA_ID_VIDEOCOLORCHROMASUBVERT 0x55B4
-#define MATROSKA_ID_VIDEOCOLORCBSUBHORZ 0x55B5
-#define MATROSKA_ID_VIDEOCOLORCBSUBVERT 0x55B6
-#define MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ 0x55B7
-#define MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT 0x55B8
-#define MATROSKA_ID_VIDEOCOLORRANGE 0x55B9
-#define MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS 0x55BA
-
-#define MATROSKA_ID_VIDEOCOLORPRIMARIES 0x55BB
-#define MATROSKA_ID_VIDEOCOLORMAXCLL 0x55BC
-#define MATROSKA_ID_VIDEOCOLORMAXFALL 0x55BD
-
-#define MATROSKA_ID_VIDEOCOLORMASTERINGMETA 0x55D0
-#define MATROSKA_ID_VIDEOCOLOR_RX 0x55D1
-#define MATROSKA_ID_VIDEOCOLOR_RY 0x55D2
-#define MATROSKA_ID_VIDEOCOLOR_GX 0x55D3
-#define MATROSKA_ID_VIDEOCOLOR_GY 0x55D4
-#define MATROSKA_ID_VIDEOCOLOR_BX 0x55D5
-#define MATROSKA_ID_VIDEOCOLOR_BY 0x55D6
-#define MATROSKA_ID_VIDEOCOLOR_WHITEX 0x55D7
-#define MATROSKA_ID_VIDEOCOLOR_WHITEY 0x55D8
-#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMAX 0x55D9
-#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN 0x55DA
-
-#define MATROSKA_ID_VIDEOPROJECTION 0x7

[FFmpeg-devel] [PATCH 06/14] avformat:matroska_ids: reorder some IDs to match the generated order

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

The XSLT scripts produces a similar file to this one, minus some spacing
differences.

No value added/removed.
---
 libavformat/matroska_ids.h | 70 +++---
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/libavformat/matroska_ids.h b/libavformat/matroska_ids.h
index ab77228da5..321e555bec 100644
--- a/libavformat/matroska_ids.h
+++ b/libavformat/matroska_ids.h
@@ -60,6 +60,8 @@
 #define MATROSKA_ID_TRACKOPERATION 0xE2
 #define MATROSKA_ID_TRACKTIMECODESCALE 0x23314F
 #define MATROSKA_ID_TRACKMAXBLKADDID 0x55EE
+#define MATROSKA_ID_TRACKNAME  0x536E
+#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
 #define MATROSKA_ID_CODECID0x86
 #define MATROSKA_ID_CODECPRIVATE 0x63A2
 #define MATROSKA_ID_CODECNAME  0x258688
@@ -68,8 +70,6 @@
 #define MATROSKA_ID_CODECDECODEALL 0xAA
 #define MATROSKA_ID_CODECDELAY 0x56AA
 #define MATROSKA_ID_SEEKPREROLL 0x56BB
-#define MATROSKA_ID_TRACKNAME  0x536E
-#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
 #define MATROSKA_ID_TRACKFLAGENABLED 0xB9
 #define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
 #define MATROSKA_ID_TRACKFLAGFORCED 0x55AA
@@ -82,6 +82,26 @@
 /* IDs in the contentencodings master */
 #define MATROSKA_ID_TRACKCONTENTENCODING 0x6240
 
+/* IDs in the content encoding master */
+#define MATROSKA_ID_ENCODINGORDER 0x5031
+#define MATROSKA_ID_ENCODINGSCOPE 0x5032
+#define MATROSKA_ID_ENCODINGTYPE 0x5033
+#define MATROSKA_ID_ENCODINGCOMPRESSION 0x5034
+#define MATROSKA_ID_ENCODINGENCRYPTION 0x5035
+
+/* IDs in the contentcompression master */
+#define MATROSKA_ID_ENCODINGCOMPALGO 0x4254
+#define MATROSKA_ID_ENCODINGCOMPSETTINGS 0x4255
+
+/* IDs in the contentencryption master */
+#define MATROSKA_ID_ENCODINGENCAESSETTINGS 0x47E7
+#define MATROSKA_ID_ENCODINGENCALGO 0x47E1
+#define MATROSKA_ID_ENCODINGENCKEYID 0x47E2
+#define MATROSKA_ID_ENCODINGSIGALGO 0x47E5
+#define MATROSKA_ID_ENCODINGSIGHASHALGO 0x47E6
+#define MATROSKA_ID_ENCODINGSIGKEYID 0x47E4
+#define MATROSKA_ID_ENCODINGSIGNATURE 0x47E3
+
 /* IDs in the trackoperation master */
 #define MATROSKA_ID_TRACKCOMBINEPLANES 0xE3
 
@@ -153,26 +173,6 @@
 #define MATROSKA_ID_AUDIOBITDEPTH 0x6264
 #define MATROSKA_ID_AUDIOCHANNELS 0x9F
 
-/* IDs in the content encoding master */
-#define MATROSKA_ID_ENCODINGORDER 0x5031
-#define MATROSKA_ID_ENCODINGSCOPE 0x5032
-#define MATROSKA_ID_ENCODINGTYPE 0x5033
-#define MATROSKA_ID_ENCODINGCOMPRESSION 0x5034
-#define MATROSKA_ID_ENCODINGENCRYPTION 0x5035
-
-/* IDs in the contentcompression master */
-#define MATROSKA_ID_ENCODINGCOMPALGO 0x4254
-#define MATROSKA_ID_ENCODINGCOMPSETTINGS 0x4255
-
-/* IDs in the contentencryption master */
-#define MATROSKA_ID_ENCODINGENCAESSETTINGS 0x47E7
-#define MATROSKA_ID_ENCODINGENCALGO 0x47E1
-#define MATROSKA_ID_ENCODINGENCKEYID 0x47E2
-#define MATROSKA_ID_ENCODINGSIGALGO 0x47E5
-#define MATROSKA_ID_ENCODINGSIGHASHALGO 0x47E6
-#define MATROSKA_ID_ENCODINGSIGKEYID 0x47E4
-#define MATROSKA_ID_ENCODINGSIGNATURE 0x47E3
-
 /* ID in the cues master */
 #define MATROSKA_ID_POINTENTRY 0xBB
 
@@ -208,12 +208,15 @@
 #define MATROSKA_ID_TAGTARGETS_CHAPTERUID 0x63C4
 #define MATROSKA_ID_TAGTARGETS_ATTACHUID  0x63C6
 
-/* IDs in the seekhead master */
-#define MATROSKA_ID_SEEKENTRY  0x4DBB
+/* IDs in the attachments master */
+#define MATROSKA_ID_ATTACHEDFILE0x61A7
 
-/* IDs in the seekpoint master */
-#define MATROSKA_ID_SEEKID 0x53AB
-#define MATROSKA_ID_SEEKPOSITION 0x53AC
+/* IDs in the attachedfile master */
+#define MATROSKA_ID_FILEDESC0x467E
+#define MATROSKA_ID_FILENAME0x466E
+#define MATROSKA_ID_FILEMIMETYPE0x4660
+#define MATROSKA_ID_FILEDATA0x465C
+#define MATROSKA_ID_FILEUID 0x46AE
 
 /* IDs in the cluster master */
 #define MATROSKA_ID_CLUSTERTIMECODE 0xE7
@@ -237,15 +240,12 @@
 #define MATROSKA_ID_BLOCKADDID 0xEE
 #define MATROSKA_ID_BLOCKADDITIONAL 0xA5
 
-/* IDs in the attachments master */
-#define MATROSKA_ID_ATTACHEDFILE0x61A7
+/* IDs in the seekhead master */
+#define MATROSKA_ID_SEEKENTRY  0x4DBB
 
-/* IDs in the attachedfile master */
-#define MATROSKA_ID_FILEDESC0x467E
-#define MATROSKA_ID_FILENAME0x466E
-#define MATROSKA_ID_FILEMIMETYPE0x4660
-#define MATROSKA_ID_FILEDATA0x465C
-#define MATROSKA_ID_FILEUID 0x46AE
+/* IDs in the seekpoint master */
+#define MATROSKA_ID_SEEKID 0x53AB
+#define MATROSKA_ID_SEEKPOSITION 0x53AC
 
 /* IDs in the chapters master */
 #define MATROSKA_ID_EDITIONENTRY0x45B9
-- 
2.18.0

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

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

[FFmpeg-devel] [PATCH 02/14] avformat/matroska: clean the structure formatting

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

Always use a comma at the end, order elements by value.
---
 libavformat/matroska.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 9e33e51c94..e177cd027f 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -286,13 +286,13 @@ typedef enum {
 typedef enum {
 MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
 MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
-MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2
+MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
 } MatroskaVideoInterlaceFlag;
 
 typedef enum {
 MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
-MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
 MATROSKA_VIDEO_FIELDORDER_TT   = 1,
+MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
 MATROSKA_VIDEO_FIELDORDER_BB   = 6,
 MATROSKA_VIDEO_FIELDORDER_TB   = 9,
 MATROSKA_VIDEO_FIELDORDER_BT   = 14,
-- 
2.18.0

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

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

[FFmpeg-devel] [PATCH 03/14] avformat/matroska: use more consistent spacing in enums

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

---
 libavformat/matroska.h | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index e177cd027f..5520e9ce8f 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -284,18 +284,18 @@ typedef enum {
 } MatroskaTrackEncodingCompAlgo;
 
 typedef enum {
-MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
-MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
-MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
+  MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED = 0,
+  MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED   = 1,
+  MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE  = 2,
 } MatroskaVideoInterlaceFlag;
 
 typedef enum {
-MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
-MATROSKA_VIDEO_FIELDORDER_TT   = 1,
-MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
-MATROSKA_VIDEO_FIELDORDER_BB   = 6,
-MATROSKA_VIDEO_FIELDORDER_TB   = 9,
-MATROSKA_VIDEO_FIELDORDER_BT   = 14,
+  MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE  = 0,
+  MATROSKA_VIDEO_FIELDORDER_TT   = 1,
+  MATROSKA_VIDEO_FIELDORDER_UNDETERMINED = 2,
+  MATROSKA_VIDEO_FIELDORDER_BB   = 6,
+  MATROSKA_VIDEO_FIELDORDER_TB   = 9,
+  MATROSKA_VIDEO_FIELDORDER_BT   = 14,
 } MatroskaVideoFieldOrder;
 
 typedef enum {
-- 
2.18.0

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

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

[FFmpeg-devel] [PATCH 01/14] avformat/matroska: add missing Buttons track type

2020-03-22 Thread Steve Lhomme
From: Steve Lhomme 

---
 libavformat/matroska.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/matroska.h b/libavformat/matroska.h
index 86968a8de1..9e33e51c94 100644
--- a/libavformat/matroska.h
+++ b/libavformat/matroska.h
@@ -271,6 +271,7 @@ typedef enum {
   MATROSKA_TRACK_TYPE_COMPLEX  = 0x3,
   MATROSKA_TRACK_TYPE_LOGO = 0x10,
   MATROSKA_TRACK_TYPE_SUBTITLE = 0x11,
+  MATROSKA_TRACK_TYPE_BUTTONS  = 0x12,
   MATROSKA_TRACK_TYPE_CONTROL  = 0x20,
   MATROSKA_TRACK_TYPE_METADATA = 0x21,
 } MatroskaTrackType;
-- 
2.18.0

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

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