[FFmpeg-devel] [PATCH v2 2/2] avformat/dashdec: rename variable name for more readable
Rename is_init_section_common_audio to is_init_section_common_subtitle for is_common_init_section_exist(c->subtitles, c->n_subtitles). Because it is checked to subtitles, not audio. Signed-off-by: liuqi05 --- libavformat/dashdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 9262e9c0a4..3fd657c06b 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -155,6 +155,7 @@ typedef struct DASHContext { /* Flags for init section*/ int is_init_section_common_video; int is_init_section_common_audio; +int is_init_section_common_subtitle; } DASHContext; @@ -2084,11 +2085,11 @@ static int dash_read_header(AVFormatContext *s) } if (c->n_subtitles) -c->is_init_section_common_audio = is_common_init_section_exist(c->subtitles, c->n_subtitles); +c->is_init_section_common_subtitle = is_common_init_section_exist(c->subtitles, c->n_subtitles); for (i = 0; i < c->n_subtitles; i++) { rep = c->subtitles[i]; -if (i > 0 && c->is_init_section_common_audio) { +if (i > 0 && c->is_init_section_common_subtitle) { ret = copy_init_section(rep, c->subtitles[0]); if (ret < 0) goto fail; -- 2.25.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 v2 1/2] avformat/dashdec: check init_section before use it.
because there have no Initialization in SegmentTemplate, so it will have no init_section for init segment file. but in the is_common_init_section_exist function it will be used for check to url, url_offset and size, so check init_section before use init_section. And fix code style in is_common_init_section_exist, make the code block short when it too long. fix ticket: 9062 Signed-off-by: liuqi05 --- libavformat/dashdec.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 693fc7372b..9262e9c0a4 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1992,7 +1992,12 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) url_offset = first_init_section->url_offset; size = pls[0]->init_section->size; for (i=0;iinit_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) { +if (!pls[i]->init_section) +continue; + +if (av_strcasecmp(pls[i]->init_section->url, url) || +pls[i]->init_section->url_offset != url_offset || +pls[i]->init_section->size != size) { return 0; } } -- 2.25.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 V3 3/3] dnn/openvino: support model input resize
> -Original Message- > From: ffmpeg-devel On Behalf Of Ting Fu > Sent: 2021年1月18日 11:42 > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH V3 3/3] dnn/openvino: support model input > resize > > OpenVINO APIs require specify input size to run the model, while some > OpenVINO model does accept different input size. To enable this feature > adding input_resizable option here for easier use. > Setting bool variable input_resizable to specify if the input can be > resizable or > not. > input_resizable = 1 means support input resize, aka accept different input > size. > input_resizable = 0 (default) means do not support input resize. > Please make sure the inference model does accept different input size before > use this option, otherwise the inference engine may report error(s). > eg: ./ffmpeg -i video_name.mp4 -vf dnn_processing=dnn_backend=openvino:\ > model=model_name.xml:input=input_name:output=output_name:\ > options=device=CPU\&input_resizable=1 -y output_video_name.mp4 > > Signed-off-by: Ting Fu > --- > V3: > rebase to latest code and add missing code > > libavfilter/dnn/dnn_backend_openvino.c | 21 +++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > this patch set looks good to me, will push soon, thanks. ___ 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 2/3] dnn/openvino: refine code for better model initialization
> -Original Message- > From: ffmpeg-devel On Behalf Of Guo, > Yejun > Sent: Monday, January 18, 2021 08:50 AM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] [PATCH V2 2/3] dnn/openvino: refine code for > better model initialization > > > > > -Original Message- > > From: ffmpeg-devel On Behalf Of Ting > > Fu > > Sent: 2021年1月15日 16:43 > > To: ffmpeg-devel@ffmpeg.org > > Subject: [FFmpeg-devel] [PATCH V2 2/3] dnn/openvino: refine code for > > better model initialization > > > > Move openvino model/inference request creation and initialization > > steps from ff_dnn_load_model_ov to new function init_model_ov, for > > later input resize support. > > > > Signed-off-by: Ting Fu > > --- > > libavfilter/dnn/dnn_backend_openvino.c | 196 > > ++--- > > 1 file changed, 111 insertions(+), 85 deletions(-) > > > > - > > -item->tasks = av_malloc_array(ctx->options.batch_size, > > sizeof(*item->tasks)); > > -if (!item->tasks) { > > -av_freep(&item); > > -goto err; > > -} > > -item->task_count = 0; > > these code are missed in the new added function init_model_ov with rebase Hi Yejun, Thank you for your review. These codes have been fixed in PATCH V3. > > ___ > 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".
[FFmpeg-devel] [PATCH V3 3/3] dnn/openvino: support model input resize
OpenVINO APIs require specify input size to run the model, while some OpenVINO model does accept different input size. To enable this feature adding input_resizable option here for easier use. Setting bool variable input_resizable to specify if the input can be resizable or not. input_resizable = 1 means support input resize, aka accept different input size. input_resizable = 0 (default) means do not support input resize. Please make sure the inference model does accept different input size before use this option, otherwise the inference engine may report error(s). eg: ./ffmpeg -i video_name.mp4 -vf dnn_processing=dnn_backend=openvino:\ model=model_name.xml:input=input_name:output=output_name:\ options=device=CPU\&input_resizable=1 -y output_video_name.mp4 Signed-off-by: Ting Fu --- V3: rebase to latest code and add missing code libavfilter/dnn/dnn_backend_openvino.c | 21 +++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index ecfd2b3f36..8a7abb33f0 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -38,6 +38,7 @@ typedef struct OVOptions{ char *device_type; int nireq; int batch_size; +int input_resizable; } OVOptions; typedef struct OVContext { @@ -86,6 +87,7 @@ static const AVOption dnn_openvino_options[] = { { "device", "device to run model", OFFSET(options.device_type), AV_OPT_TYPE_STRING, { .str = "CPU" }, 0, 0, FLAGS }, { "nireq", "number of request", OFFSET(options.nireq), AV_OPT_TYPE_INT,{ .i64 = 0 }, 0, INT_MAX, FLAGS }, { "batch_size", "batch size per request", OFFSET(options.batch_size), AV_OPT_TYPE_INT,{ .i64 = 1 }, 1, 1000, FLAGS}, +{ "input_resizable", "can input be resizable or not", OFFSET(options.input_resizable), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, FLAGS }, { NULL } }; @@ -400,6 +402,7 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input size_t model_input_count = 0; dimensions_t dims; precision_e precision; +int input_resizable = ctx->options.input_resizable; status = ie_network_get_inputs_number(ov_model->network, &model_input_count); if (status != OK) { @@ -423,8 +426,8 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input } input->channels = dims.dims[1]; -input->height = dims.dims[2]; -input->width= dims.dims[3]; +input->height = input_resizable ? -1 : dims.dims[2]; +input->width= input_resizable ? -1 : dims.dims[3]; input->dt = precision_to_datatype(precision); return DNN_SUCCESS; } else { @@ -450,6 +453,8 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu AVFrame *in_frame = av_frame_alloc(); AVFrame *out_frame = NULL; TaskItem *ptask = &task; +IEStatusCode status; +input_shapes_t input_shapes; if (!in_frame) { av_log(ctx, AV_LOG_ERROR, "Failed to allocate memory for input frame\n"); @@ -464,6 +469,18 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu in_frame->width = input_width; in_frame->height = input_height; +if (ctx->options.input_resizable) { +status = ie_network_get_input_shapes(ov_model->network, &input_shapes); +input_shapes.shapes->shape.dims[2] = input_height; +input_shapes.shapes->shape.dims[3] = input_width; +status |= ie_network_reshape(ov_model->network, input_shapes); +ie_network_input_shapes_free(&input_shapes); +if (status != OK) { +av_log(ctx, AV_LOG_ERROR, "Failed to reshape input size for %s\n", input_name); +return DNN_ERROR; +} +} + if (!ov_model->exe_network) { if (init_model_ov(ov_model) != DNN_SUCCESS) { av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n"); -- 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".
[FFmpeg-devel] [PATCH V3 2/3] dnn/openvino: refine code for better model initialization
Move openvino model/inference request creation and initialization steps from ff_dnn_load_model_ov to new function init_model_ov, for later input resize support. Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_openvino.c | 203 ++--- 1 file changed, 118 insertions(+), 85 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 8476f4fb38..ecfd2b3f36 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -248,6 +248,103 @@ static void infer_completion_callback(void *args) } } +static DNNReturnType init_model_ov(OVModel *ov_model) +{ +OVContext *ctx = &ov_model->ctx; +IEStatusCode status; +ie_available_devices_t a_dev; +ie_config_t config = {NULL, NULL, NULL}; +char *all_dev_names = NULL; + +// batch size +if (ctx->options.batch_size <= 0) { +ctx->options.batch_size = 1; +} + +if (ctx->options.batch_size > 1) { +input_shapes_t input_shapes; +status = ie_network_get_input_shapes(ov_model->network, &input_shapes); +if (status != OK) +goto err; +for (int i = 0; i < input_shapes.shape_num; i++) +input_shapes.shapes[i].shape.dims[0] = ctx->options.batch_size; +status = ie_network_reshape(ov_model->network, input_shapes); +ie_network_input_shapes_free(&input_shapes); +if (status != OK) +goto err; +} + +status = ie_core_load_network(ov_model->core, ov_model->network, ctx->options.device_type, &config, &ov_model->exe_network); +if (status != OK) { +av_log(ctx, AV_LOG_ERROR, "Failed to load OpenVINO model network\n"); +status = ie_core_get_available_devices(ov_model->core, &a_dev); +if (status != OK) { +av_log(ctx, AV_LOG_ERROR, "Failed to get available devices\n"); +goto err; +} +for (int i = 0; i < a_dev.num_devices; i++) { +APPEND_STRING(all_dev_names, a_dev.devices[i]) +} +av_log(ctx, AV_LOG_ERROR,"device %s may not be supported, all available devices are: \"%s\"\n", + ctx->options.device_type, all_dev_names); +goto err; +} + +// create infer_request for sync execution +status = ie_exec_network_create_infer_request(ov_model->exe_network, &ov_model->infer_request); +if (status != OK) +goto err; + +// create infer_requests for async execution +if (ctx->options.nireq <= 0) { +// the default value is a rough estimation +ctx->options.nireq = av_cpu_count() / 2 + 1; +} + +ov_model->request_queue = ff_safe_queue_create(); +if (!ov_model->request_queue) { +goto err; +} + +for (int i = 0; i < ctx->options.nireq; i++) { +RequestItem *item = av_mallocz(sizeof(*item)); +if (!item) { +goto err; +} + +status = ie_exec_network_create_infer_request(ov_model->exe_network, &item->infer_request); +if (status != OK) { +av_freep(&item); +goto err; +} + +item->tasks = av_malloc_array(ctx->options.batch_size, sizeof(*item->tasks)); +if (!item->tasks) { +av_freep(&item); +goto err; +} +item->task_count = 0; + +item->callback.completeCallBackFunc = infer_completion_callback; +item->callback.args = item; +if (ff_safe_queue_push_back(ov_model->request_queue, item) < 0) { +av_freep(&item); +goto err; +} +} + +ov_model->task_queue = ff_queue_create(); +if (!ov_model->task_queue) { +goto err; +} + +return DNN_SUCCESS; + +err: +ff_dnn_free_model_ov(&ov_model->model); +return DNN_ERROR; +} + static DNNReturnType execute_model_ov(RequestItem *request) { IEStatusCode status; @@ -367,6 +464,13 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu in_frame->width = input_width; in_frame->height = input_height; +if (!ov_model->exe_network) { +if (init_model_ov(ov_model) != DNN_SUCCESS) { +av_log(ctx, AV_LOG_ERROR, "Failed init OpenVINO exectuable network or inference request\n"); +return DNN_ERROR; +}; +} + task.done = 0; task.do_ioproc = 0; task.async = 0; @@ -391,13 +495,10 @@ static DNNReturnType get_output_ov(void *model, const char *input_name, int inpu DNNModel *ff_dnn_load_model_ov(const char *model_filename, const char *options, AVFilterContext *filter_ctx) { -char *all_dev_names = NULL; DNNModel *model = NULL; OVModel *ov_model = NULL; OVContext *ctx = NULL; IEStatusCode status; -ie_config_t config = {NULL, NULL, NULL}; -ie_available_devices_t a_dev; model = av_mallocz(sizeof(DNNModel)); if (!model){ @@ -429,88 +530,6 @@ DNNModel *ff_dnn_load_model_ov(const char *model_filename,
[FFmpeg-devel] [PATCH V3 1/3] dnn/openvino: remove unnecessary code
Signed-off-by: Ting Fu --- libavfilter/dnn/dnn_backend_openvino.c | 8 1 file changed, 8 deletions(-) diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c index 5271d1caa5..8476f4fb38 100644 --- a/libavfilter/dnn/dnn_backend_openvino.c +++ b/libavfilter/dnn/dnn_backend_openvino.c @@ -325,14 +325,6 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input return DNN_ERROR; } -// The order of dims in the openvino is fixed and it is always NCHW for 4-D data. -// while we pass NHWC data from FFmpeg to openvino -status = ie_network_set_input_layout(ov_model->network, input_name, NHWC); -if (status != OK) { -av_log(ctx, AV_LOG_ERROR, "Input \"%s\" does not match layout NHWC\n", input_name); -return DNN_ERROR; -} - input->channels = dims.dims[1]; input->height = dims.dims[2]; input->width= dims.dims[3]; -- 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/rtsp: don't overwrite session control uri
On Sun, 17. Jan 19:55, Andriy Gelman wrote: > On Mon, 18. Jan 00:49, Carl Eugen Hoyos wrote: > > Am So., 11. Okt. 2020 um 01:54 Uhr schrieb Andriy Gelman > > : > > > > > > From: Andriy Gelman > > > > > > Fixes #1941 > > > > > > Currently the session control uri gets overwritten by the media's uri > > > when mpegts is signalled in the media description. This happens because > > > s->nb_streams doesn't count mpegts which is instead part of the private > > > context in RTSPStream. > > > > > > Instead use rt->nb_rtsp_streams which counts all of the media streams > > > signalled in the sdp. > > > > > > This solution was originally proposed by user "tpol" on trac: > > > https://trac.ffmpeg.org/ticket/1941 > > > > > > Signed-off-by: Andriy Gelman > > > --- > > > libavformat/rtsp.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > > > index e9fca034b4..4d5459ac41 100644 > > > --- a/libavformat/rtsp.c > > > +++ b/libavformat/rtsp.c > > > @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, > > > SDPParseState *s1, > > > break; > > > case 'a': > > > if (av_strstart(p, "control:", &p)) { > > > -if (s->nb_streams == 0) { > > > +if (rt->nb_rtsp_streams == 0) { > > > if (!strncmp(p, "rtsp://", 7)) > > > av_strlcpy(rt->control_uri, p, > > > sizeof(rt->control_uri)); > > > > > Wasn't this patch written by tpol? > > I did say in the commit message that it was proposed by tpol from trac. > Afaik the patch wasn't sent to the ML, so there's no email for author. > > What do you suggest? > I saw there are other commits with empty emails. I changed the author to tpol and pushed. -- Andriy ___ 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/rtsp: don't overwrite session control uri
On Mon, 18. Jan 00:49, Carl Eugen Hoyos wrote: > Am So., 11. Okt. 2020 um 01:54 Uhr schrieb Andriy Gelman > : > > > > From: Andriy Gelman > > > > Fixes #1941 > > > > Currently the session control uri gets overwritten by the media's uri > > when mpegts is signalled in the media description. This happens because > > s->nb_streams doesn't count mpegts which is instead part of the private > > context in RTSPStream. > > > > Instead use rt->nb_rtsp_streams which counts all of the media streams > > signalled in the sdp. > > > > This solution was originally proposed by user "tpol" on trac: > > https://trac.ffmpeg.org/ticket/1941 > > > > Signed-off-by: Andriy Gelman > > --- > > libavformat/rtsp.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > > index e9fca034b4..4d5459ac41 100644 > > --- a/libavformat/rtsp.c > > +++ b/libavformat/rtsp.c > > @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, > > SDPParseState *s1, > > break; > > case 'a': > > if (av_strstart(p, "control:", &p)) { > > -if (s->nb_streams == 0) { > > +if (rt->nb_rtsp_streams == 0) { > > if (!strncmp(p, "rtsp://", 7)) > > av_strlcpy(rt->control_uri, p, > > sizeof(rt->control_uri)); > > Wasn't this patch written by tpol? I did say in the commit message that it was proposed by tpol from trac. Afaik the patch wasn't sent to the ML, so there's no email for author. What do you suggest? btw the updated first part of the commit message is: "Currently the session control uri gets overwritten by the media's uri when mpegts is signalled in the media description. This happens because s->nb_streams doesn't count mpegts (AVStreams are added when parsing mpegts packets). Instead use rt->nb_rtsp_streams, which also counts mpegts." -- Andriy ___ 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 2/3] dnn/openvino: refine code for better model initialization
> -Original Message- > From: ffmpeg-devel On Behalf Of Ting Fu > Sent: 2021年1月15日 16:43 > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH V2 2/3] dnn/openvino: refine code for better > model initialization > > Move openvino model/inference request creation and initialization steps from > ff_dnn_load_model_ov to new function init_model_ov, for later input resize > support. > > Signed-off-by: Ting Fu > --- > libavfilter/dnn/dnn_backend_openvino.c | 196 ++--- > 1 file changed, 111 insertions(+), 85 deletions(-) > > - > -item->tasks = av_malloc_array(ctx->options.batch_size, > sizeof(*item->tasks)); > -if (!item->tasks) { > -av_freep(&item); > -goto err; > -} > -item->task_count = 0; these code are missed in the new added function init_model_ov with rebase ___ 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/rtsp: don't overwrite session control uri
Am So., 11. Okt. 2020 um 01:54 Uhr schrieb Andriy Gelman : > > From: Andriy Gelman > > Fixes #1941 > > Currently the session control uri gets overwritten by the media's uri > when mpegts is signalled in the media description. This happens because > s->nb_streams doesn't count mpegts which is instead part of the private > context in RTSPStream. > > Instead use rt->nb_rtsp_streams which counts all of the media streams > signalled in the sdp. > > This solution was originally proposed by user "tpol" on trac: > https://trac.ffmpeg.org/ticket/1941 > > Signed-off-by: Andriy Gelman > --- > libavformat/rtsp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > index e9fca034b4..4d5459ac41 100644 > --- a/libavformat/rtsp.c > +++ b/libavformat/rtsp.c > @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, > SDPParseState *s1, > break; > case 'a': > if (av_strstart(p, "control:", &p)) { > -if (s->nb_streams == 0) { > +if (rt->nb_rtsp_streams == 0) { > if (!strncmp(p, "rtsp://", 7)) > av_strlcpy(rt->control_uri, p, > sizeof(rt->control_uri)); Wasn't this patch written by tpol? 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/rtsp: don't overwrite session control uri
On Sat, 31. Oct 10:16, Andriy Gelman wrote: > On Wed, 21. Oct 13:39, Andriy Gelman wrote: > > On Sat, 10. Oct 19:22, Andriy Gelman wrote: > > > From: Andriy Gelman > > > > > > Fixes #1941 > > > > > > Currently the session control uri gets overwritten by the media's uri > > > when mpegts is signalled in the media description. This happens because > > > s->nb_streams doesn't count mpegts which is instead part of the private > > > context in RTSPStream. > > > > > > Instead use rt->nb_rtsp_streams which counts all of the media streams > > > signalled in the sdp. > > > > > > This solution was originally proposed by user "tpol" on trac: > > > https://trac.ffmpeg.org/ticket/1941 > > > > > > Signed-off-by: Andriy Gelman > > > --- > > > libavformat/rtsp.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c > > > index e9fca034b4..4d5459ac41 100644 > > > --- a/libavformat/rtsp.c > > > +++ b/libavformat/rtsp.c > > > @@ -542,7 +542,7 @@ static void sdp_parse_line(AVFormatContext *s, > > > SDPParseState *s1, > > > break; > > > case 'a': > > > if (av_strstart(p, "control:", &p)) { > > > -if (s->nb_streams == 0) { > > > +if (rt->nb_rtsp_streams == 0) { > > > if (!strncmp(p, "rtsp://", 7)) > > > av_strlcpy(rt->control_uri, p, > > > sizeof(rt->control_uri)); > > > -- > > > 2.28.0 > > > > > > > ping > > > > ping > Will apply this Monday if no one objects. I haven't applied this patch yet because I had some problems testing with vlc. vlc would close the socket connection after ~10 seconds, even though a 60second timeout was advertised. This was fairly recently fixed in vlc: 38d214bc4f2ef68dfe6859383e12a20ae91e62de ce3269d4a20aba2f87fc3e512131cb31b9561b3e So I'll go ahead and push. -- Andriy ___ 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/5] avformat/smacker: Check for too small pts_inc
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SMACKER_fuzzer-6705429132476416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/smacker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 9966a67055..61209e7038 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -105,8 +105,8 @@ static int smacker_read_header(AVFormatContext *s) height = avio_rl32(pb); smk->frames = avio_rl32(pb); pts_inc = avio_rl32(pb); -if (pts_inc > INT_MAX / 100) { -av_log(s, AV_LOG_ERROR, "pts_inc %d is too large\n", pts_inc); +if (pts_inc > INT_MAX / 100 || pts_inc == INT_MIN) { +av_log(s, AV_LOG_ERROR, "pts_inc %d is invalid\n", pts_inc); return AVERROR_INVALIDDATA; } -- 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".
[FFmpeg-devel] [PATCH 1/5] avformat/sccdec: Use larger intermediate for ts/next_ts computation
Fixes: signed integer overflow: 92237203 * 33 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SCC_fuzzer-6603769487949824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/sccdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/sccdec.c b/libavformat/sccdec.c index 751dee7c6c..1786520944 100644 --- a/libavformat/sccdec.c +++ b/libavformat/sccdec.c @@ -93,7 +93,7 @@ static int scc_read_header(AVFormatContext *s) break; } -ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33; +ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33LL; while (!ff_text_eof(&tr)) { len = ff_subtitles_read_line(&tr, line2, sizeof(line2)); @@ -117,7 +117,7 @@ static int scc_read_header(AVFormatContext *s) } } -next_ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33; +next_ts = (hh * 3600LL + mm * 60LL + ss) * 1000LL + fs * 33LL; pos = ff_text_pos(&tr); lline = (char *)&line; -- 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".
[FFmpeg-devel] [PATCH 5/5] avformat/wavdec: Check block_align vs. channels before combining them
Fixes: signed integer overflow: 65535 * 65312 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6606935226974208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/wavdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index 3da4150f05..d6ec6ca250 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -643,7 +643,8 @@ break_loop: } else if (st->codecpar->codec_id == AV_CODEC_ID_XMA1 || st->codecpar->codec_id == AV_CODEC_ID_XMA2) { st->codecpar->block_align = 2048; -} else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2) { +} else if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_MS && st->codecpar->channels > 2 && + st->codecpar->block_align < INT_MAX / st->codecpar->channels) { st->codecpar->block_align *= st->codecpar->channels; } -- 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".
[FFmpeg-devel] [PATCH 4/5] avformat/tta: Use 64bit intermediate for index
Fixes: signed integer overflow: 42032 * 51092 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-6679539648430080 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/tta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tta.c b/libavformat/tta.c index 70e98b2937..46c2508bce 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -119,7 +119,7 @@ static int tta_read_header(AVFormatContext *s) for (i = 0; i < c->totalframes; i++) { uint32_t size = avio_rl32(s->pb); int r; -if ((r = av_add_index_entry(st, framepos, i * c->frame_size, size, 0, +if ((r = av_add_index_entry(st, framepos, i * (int64_t)c->frame_size, size, 0, AVINDEX_KEYFRAME)) < 0) return r; framepos += size; -- 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".
[FFmpeg-devel] [PATCH 3/5] avformat/soxdec: Check channels to be positive
Fixes: signed integer overflow: 32 * -1795162112 cannot be represented in type 'int' Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SOX_fuzzer-6724151473340416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/soxdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index d3f709f9a6..35e11feec6 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -90,7 +90,7 @@ static int sox_read_header(AVFormatContext *s) sample_rate_frac); if ((header_size + 4) & 7 || header_size < SOX_FIXED_HDR + comment_size -|| st->codecpar->channels > 65535) /* Reserve top 16 bits */ { +|| st->codecpar->channels > 65535 || st->codecpar->channels <= 0) /* Reserve top 16 bits */ { av_log(s, AV_LOG_ERROR, "invalid header\n"); return AVERROR_INVALIDDATA; } -- 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] Populate field order returned by avs script, Trac Ticket 8757
On 2021-01-17 09:02, wrote Stephen Hutchinson: Going into detail about GetParity wouldn't be necessary if it's not used (and there aren't any other invoke-parsed functions aside from checking with Import() whether the script actually returns a clip), so the comment could be shortened. Also, since this is the avisynth demuxer, 'in the avs' would be better rendered as 'in the script', and simply refer to 'source plugins' rather than 'avisynth source plugins'. Comment bikeshedding aside, LGTM, but the avs_is* API usage added here needs to be reflected in the AVSC_DECLARE_FUNC and LOAD_AVS_FUNC blocks. If those parts of the API are present in 2.5, the LOAD_AVS_FUNC can be a 0. If they were added in 2.6 (or Plus, but I know these would have to be from classic AviSynth), then it should be 1. Thanks for the very quick reply, i shortened the comment but as the whole comment is basically just there to explain why i decided to not involve getparity, i believe it is worth to mention in order to save some time for possible future committers. What i am not able to do is to add the used convenience functions avs_is_tff and bff to AVSC_DECLARE_FUNC and LOAD_AVS_FUNC, it refuses to compile when i do so. IMHO this is because it is just convenience functions that's function body is defined in the linked avisynth_c.h file instead of being exported by the avisynth api lib. The existing code in avisynth.c also uses such convenience functions without adding them to the declaration, examples: avs_has_video, line 524 avs_is_clip, line 571 Also, i found it safe to use the convenience functions avs_is_tff and bff because the minimum required version is 2.6 and Plus or above, so i hoped the functions will be always available.From 0725b04b8855723309662a9b663b346d98117ff1 Mon Sep 17 00:00:00 2001 From: emcodem Date: Sun, 17 Jan 2021 18:59:41 +0100 Subject: [PATCH] Populate field order returned by avs script, Trac Ticket 8757 --- libavformat/avisynth.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..75c7b18c22 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -241,6 +241,21 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->nb_frames = avs->vi->num_frames; avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); +av_log(s, AV_LOG_TRACE, "avs_is_field_based: %d\n", avs_is_field_based(avs->vi)); +av_log(s, AV_LOG_TRACE, "avs_is_parity_known: %d\n", avs_is_parity_known(avs->vi)); + +/* The following typically only works when assumetff (-bff) and assumefieldbased is used in the source avs script. +Additional logic using GetParity() could deliver more accurate results but also decodes a frame which we want to avoid. */ +st->codecpar->field_order = AV_FIELD_UNKNOWN; +if (avs_is_field_based(avs->vi)) { +if (avs_is_tff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_TT; +} +else if (avs_is_bff(avs->vi)) { +st->codecpar->field_order = AV_FIELD_BB; +} +} + switch (avs->vi->pixel_type) { /* 10~16-bit YUV pix_fmts (AviSynth+) */ case AVS_CS_YUV444P10: -- 2.25.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 16/16] avfilter/vsrc_testsrc: Deduplicate options
Quoting James Almer (2021-01-04 20:35:30) > On 1/4/2021 4:29 PM, Nicolas George wrote: > > Andreas Rheinhardt (12021-01-04): > >> What enumerating code? It is actually commonplace that options are > >> shared (you can find examples in libavfilter by using 'git grep -e > >> define --and -e options'); pointing into other options and thereby > >> reusing only a part of other options is not common, but I don't really > >> see why it shouldn't work. > > > > Using #define to de-duplicate the source is fine, of course. > > > > But IIRC pointing to the same array, i.e. de-duplicating in the binary, > > will lead to the code that enumerate options to loop in some way. I do > > not remember the details, and I cannot find a commit that talks about > > it, sorry. Maybe somebody here remembers better? > > > > Regards, > > I recall issues with modules sharing a common AVClass, but different > AVClasses sharing a common array of AVOptions seems to be ok. > See rawdec.h in libavformat, and how ff_raw_options is used in several > different demuxer AVClasses. child_class_next() implementation for AVFormatContext and others assumes a one-to-one mapping between objects and their AVClasses. But that is now deprecated and there should be no issues when it's removed. -- Anton Khirnov ___ 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 7/7] avformat/sbgdec: Reduce the amount of floating point in str_to_time()
Michael Niedermayer (12021-01-17): > Fixes: 1e+75 is outside the range of representable values of type 'long' > Fixes: > 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6626834808700928 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/sbgdec.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Should be ok. Regards, -- Nicolas George 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 v3] avcodec/librav1e: Pass through timestamps as opaque user data
On 17/01/2021 13:40, James Almer wrote: > LGTM. Pushed. - Derek ___ 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] avfilter/vsrc_testsrc: add planar support to rgbtestsrc
On 1/16/2021 11:55 AM, Paul B Mahol wrote: Signed-off-by: Paul B Mahol --- libavfilter/vsrc_testsrc.c | 33 ++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c index 7001f9ba16..c047fe8e86 100644 --- a/libavfilter/vsrc_testsrc.c +++ b/libavfilter/vsrc_testsrc.c @@ -77,6 +77,7 @@ typedef struct TestSourceContext { /* only used by rgbtest */ uint8_t rgba_map[4]; +int depth; /* only used by haldclut */ int level; @@ -970,12 +971,15 @@ AVFILTER_DEFINE_CLASS(rgbtestsrc); #define B 2 #define A 3 -static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize, +static void rgbtest_put_pixel(uint8_t *dstp[4], int dst_linesizep[4], int x, int y, unsigned r, unsigned g, unsigned b, enum AVPixelFormat fmt, uint8_t rgba_map[4]) { +uint8_t *dst = dstp[0]; +int dst_linesize = dst_linesizep[0]; uint32_t v; uint8_t *p; +uint16_t *p16; switch (fmt) { case AV_PIX_FMT_BGR444: ((uint16_t*)(dst + y*dst_linesize))[x] = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4); break; @@ -998,6 +1002,25 @@ static void rgbtest_put_pixel(uint8_t *dst, int dst_linesize, p = dst + 4*x + y*dst_linesize; AV_WL32(p, v); break; +case AV_PIX_FMT_GBRP: +p = dstp[0] + x + y * dst_linesizep[0]; +p[0] = g; +p = dstp[1] + x + y * dst_linesizep[1]; +p[0] = b; +p = dstp[2] + x + y * dst_linesizep[2]; +p[0] = r; Missing a break;? +case AV_PIX_FMT_GBRP9: +case AV_PIX_FMT_GBRP10: +case AV_PIX_FMT_GBRP12: +case AV_PIX_FMT_GBRP14: +case AV_PIX_FMT_GBRP16: +p16 = (uint16_t *)(dstp[0] + x*2 + y * dst_linesizep[0]); +p16[0] = g; +p16 = (uint16_t *)(dstp[1] + x*2 + y * dst_linesizep[1]); +p16[0] = b; +p16 = (uint16_t *)(dstp[2] + x*2 + y * dst_linesizep[2]); +p16[0] = r; +break; } } @@ -1008,14 +1031,14 @@ static void rgbtest_fill_picture(AVFilterContext *ctx, AVFrame *frame) for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - int c = 256*x/w; + int c = (1 << FFMAX(test->depth, 8))*x/w; int r = 0, g = 0, b = 0; if (3*y < h ) r = c; else if (3*y < 2*h) g = c; elseb = c; - rgbtest_put_pixel(frame->data[0], frame->linesize[0], x, y, r, g, b, + rgbtest_put_pixel(frame->data, frame->linesize, x, y, r, g, b, ctx->outputs[0]->format, test->rgba_map); } } @@ -1038,6 +1061,8 @@ static int rgbtest_query_formats(AVFilterContext *ctx) AV_PIX_FMT_RGB444, AV_PIX_FMT_BGR444, AV_PIX_FMT_RGB565, AV_PIX_FMT_BGR565, AV_PIX_FMT_RGB555, AV_PIX_FMT_BGR555, +AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, +AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, AV_PIX_FMT_NONE }; @@ -1050,7 +1075,9 @@ static int rgbtest_query_formats(AVFilterContext *ctx) static int rgbtest_config_props(AVFilterLink *outlink) { TestSourceContext *test = outlink->src->priv; +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(outlink->format); +test->depth = desc->comp[0].depth; ff_fill_rgba_map(test->rgba_map, outlink->format); return config_props(outlink); } ___ 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 v3] avcodec/librav1e: Pass through timestamps as opaque user data
On 1/17/2021 9:43 AM, Derek Buitenhuis wrote: avcodec has no facilities to generate timestamps properly from output frame numbers (and it would be wrong for VFR anyway), so pass through the timestamps using rav1e's opaque user data feature, which was added in v0.4.0. This bumps the minimum librav1e version to 0.4.0. Signed-off-by: Derek Buitenhuis --- configure | 2 +- libavcodec/librav1e.c | 12 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 900505756b..54fbbd6b5f 100755 --- a/configure +++ b/configure @@ -6408,7 +6408,7 @@ enabled libopus && { } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection -enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 46071bcdac..2d5acc7d8e 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -445,10 +445,18 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (frame->buf[0]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); +int64_t *pts = av_malloc(sizeof(int64_t)); +if (!pts) { +av_log(avctx, AV_LOG_ERROR, "Could not allocate PTS buffer.\n"); +return AVERROR(ENOMEM); +} +*pts = frame->pts; + rframe = rav1e_frame_new(ctx->ctx); if (!rframe) { av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n"); av_frame_unref(frame); +av_freep(&pts); return AVERROR(ENOMEM); } @@ -460,6 +468,7 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) frame->linesize[i], bytes); } av_frame_unref(frame); +rav1e_frame_set_opaque(rframe, pts, av_free); } } @@ -535,7 +544,8 @@ retry: if (rpkt->frame_type == RA_FRAME_TYPE_KEY) pkt->flags |= AV_PKT_FLAG_KEY; -pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; +pkt->pts = pkt->dts = *((int64_t *) rpkt->opaque); +av_free(rpkt->opaque); rav1e_packet_unref(rpkt); if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { LGTM. ___ 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 v2] avcodec/librav1e: Pass through timestamps as opaque user data
avcodec has no facilities to generate timestamps properly from output frame numbers (and it would be wrong for VFR anyway), so pass through the timestamps using rav1e's opaque user data feature, which was added in v0.4.0. This bumps the minimum librav1e version to 0.4.0. Signed-off-by: Derek Buitenhuis --- configure | 2 +- libavcodec/av1dec.c | 2 +- libavcodec/librav1e.c | 12 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 900505756b..54fbbd6b5f 100755 --- a/configure +++ b/configure @@ -6408,7 +6408,7 @@ enabled libopus && { } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection -enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index a75d6744d3..385f8bfaca 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -929,7 +929,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void *frame, s->operating_point_idc = s->raw_seq->operating_point_idc[s->operating_point]; -if (s->pix_fmt == AV_PIX_FMT_NONE) { +if (avctx->pix_fmt == AV_PIX_FMT_NONE) { ret = get_pixel_format(avctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 46071bcdac..2d5acc7d8e 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -445,10 +445,18 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (frame->buf[0]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); +int64_t *pts = av_malloc(sizeof(int64_t)); +if (!pts) { +av_log(avctx, AV_LOG_ERROR, "Could not allocate PTS buffer.\n"); +return AVERROR(ENOMEM); +} +*pts = frame->pts; + rframe = rav1e_frame_new(ctx->ctx); if (!rframe) { av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n"); av_frame_unref(frame); +av_freep(&pts); return AVERROR(ENOMEM); } @@ -460,6 +468,7 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) frame->linesize[i], bytes); } av_frame_unref(frame); +rav1e_frame_set_opaque(rframe, pts, av_free); } } @@ -535,7 +544,8 @@ retry: if (rpkt->frame_type == RA_FRAME_TYPE_KEY) pkt->flags |= AV_PKT_FLAG_KEY; -pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; +pkt->pts = pkt->dts = *((int64_t *) rpkt->opaque); +av_free(rpkt->opaque); rav1e_packet_unref(rpkt); if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { -- 2.30.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 2/2 v2] avcodec/librav1e: Pass through timestamps as opaque user data
On 17/01/2021 12:38, Derek Buitenhuis wrote: > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -929,7 +929,7 @@ static int av1_decode_frame(AVCodecContext *avctx, void > *frame, > > s->operating_point_idc = > s->raw_seq->operating_point_idc[s->operating_point]; > > -if (s->pix_fmt == AV_PIX_FMT_NONE) { > +if (avctx->pix_fmt == AV_PIX_FMT_NONE) { > ret = get_pixel_format(avctx); > if (ret < 0) { Eugh, I amended too hard. v3 sent. - Derek ___ 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 v3] avcodec/librav1e: Pass through timestamps as opaque user data
avcodec has no facilities to generate timestamps properly from output frame numbers (and it would be wrong for VFR anyway), so pass through the timestamps using rav1e's opaque user data feature, which was added in v0.4.0. This bumps the minimum librav1e version to 0.4.0. Signed-off-by: Derek Buitenhuis --- configure | 2 +- libavcodec/librav1e.c | 12 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 900505756b..54fbbd6b5f 100755 --- a/configure +++ b/configure @@ -6408,7 +6408,7 @@ enabled libopus && { } enabled libpulse && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new enabled librabbitmq && require_pkg_config librabbitmq "librabbitmq >= 0.7.1" amqp.h amqp_new_connection -enabled librav1e && require_pkg_config librav1e "rav1e >= 0.1.0" rav1e.h rav1e_context_new +enabled librav1e && require_pkg_config librav1e "rav1e >= 0.4.0" rav1e.h rav1e_context_new enabled librsvg && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++" diff --git a/libavcodec/librav1e.c b/libavcodec/librav1e.c index 46071bcdac..2d5acc7d8e 100644 --- a/libavcodec/librav1e.c +++ b/libavcodec/librav1e.c @@ -445,10 +445,18 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) if (frame->buf[0]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); +int64_t *pts = av_malloc(sizeof(int64_t)); +if (!pts) { +av_log(avctx, AV_LOG_ERROR, "Could not allocate PTS buffer.\n"); +return AVERROR(ENOMEM); +} +*pts = frame->pts; + rframe = rav1e_frame_new(ctx->ctx); if (!rframe) { av_log(avctx, AV_LOG_ERROR, "Could not allocate new rav1e frame.\n"); av_frame_unref(frame); +av_freep(&pts); return AVERROR(ENOMEM); } @@ -460,6 +468,7 @@ static int librav1e_receive_packet(AVCodecContext *avctx, AVPacket *pkt) frame->linesize[i], bytes); } av_frame_unref(frame); +rav1e_frame_set_opaque(rframe, pts, av_free); } } @@ -535,7 +544,8 @@ retry: if (rpkt->frame_type == RA_FRAME_TYPE_KEY) pkt->flags |= AV_PKT_FLAG_KEY; -pkt->pts = pkt->dts = rpkt->input_frameno * avctx->ticks_per_frame; +pkt->pts = pkt->dts = *((int64_t *) rpkt->opaque); +av_free(rpkt->opaque); rav1e_packet_unref(rpkt); if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { -- 2.30.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 2/2] avcodec/librav1e: Pass through timestamps as opaque user data
On 16/01/2021 16:53, James Almer wrote: > pts was declared inside the if (frame->buf[0]) block, so compilation > fails. You need to move this line inside that block. Guess who forgot to git commit --amend before sending his patch? This guy. Woops - I had already fixed this locally before sending the set but didn't amend it. v2 sent. I've pushed patch 1/2 since it's just cosmetic, in the meantime. - Derek ___ 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] Revert "avutil/timecode: fix sscanf format string with garbage at the end"
On Sun, Jan 17, 2021 at 03:30:15AM +0100, Marton Balint wrote: > > On Sun, 17 Jan 2021, lance.lmw...@gmail.com wrote: > > > On Sat, Jan 16, 2021 at 09:49:42AM +0100, Marton Balint wrote: > > > This reverts commit 6696a07ac62bfec49dd488510a719367918b9f7a. > > > > > > It is wrong to restrict timecodes to always contain leading zeros or for > > > hours > > > or frames to be 2 chars only. > > Sorry, I think I was misunderstood by the following syntax description: > > syntax: hh:mm:ss[:;.]ff > > > > maybe it's better to change it to hour:minute:second[:;.]frame? > > That would better reflect on what the code did before the patch. > > > > > After revisiting the code, I think we may support more valid syntax for the > > timecode > > string: > > ss > > ss[:;.]ff > > mm:ss > > mm:ss[:;.]ff > > hh:mm:ss > > hh:mm:ss[:;.]ff > > I don't like this idea much, it is good if we are strict about the timecode > format (e.g request all components to be present and no garbage after the > parsed string), the main reasons I suggested the revert are because timecode > has to support > 100 fps and >= 100 hours because our timecode API also has > support for such timecodes. Sure, please revert it anyway. > > Regards, > Marton > > > > > > > > > > > Signed-off-by: Marton Balint > > > --- > > > libavutil/timecode.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavutil/timecode.c b/libavutil/timecode.c > > > index 5106f642b9..c1fa445d31 100644 > > > --- a/libavutil/timecode.c > > > +++ b/libavutil/timecode.c > > > @@ -252,7 +252,7 @@ int av_timecode_init_from_string(AVTimecode *tc, > > > AVRational rate, const char *st > > > char c; > > > int hh, mm, ss, ff, flags; > > > > > > -if (sscanf(str, "%02u:%02u:%02u%c%02u", &hh, &mm, &ss, &c, &ff) != > > > 5) { > > > +if (sscanf(str, "%d:%d:%d%c%d", &hh, &mm, &ss, &c, &ff) != 5) { > > > av_log(log_ctx, AV_LOG_ERROR, "Unable to parse timecode, " > > >"syntax: hh:mm:ss[:;.]ff\n"); > > > return AVERROR_INVALIDDATA; > > > -- > > > 2.26.2 > > > > > > ___ > > > 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". > > > > -- > > Thanks, > > Limin Wang > > ___ > > 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". -- Thanks, Limin Wang ___ 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] Populate field order returned by avs script, Trac Ticket 8757
On 1/16/21 7:26 PM, emco...@ffastrans.com wrote: The purpose of this is to tell ffmpeg which field order the returned clip of the avisynth .avs script decided to finally deliver, which is handy in an automated environment. Interlacing is generally a very hard topic in avisynth, the huge comment is neccessary to explain my reasons. Additionally to the comment in the patch, i can tell that i set unknown instead of progressive for backward compatibility. (i was struggeling with this, maybe i should have even left it unset in case it is not clearly tff or bff interlaced. /* Set interlacing type. http://avisynth.nl/index.php/Interlaced_fieldbased * The following typically only works when assumetff (-bff) and assumefieldbased is used in the avs. * This is because most avisynth source plugins do not set the parity info in the clip properties. * We could use GetParity() to be more accurate but it decodes a frame which is * expensive and can potentially lead to unforeseen behaviour when seeking later. * In case Parity is not known, we still cannot guarantee that */ Going into detail about GetParity wouldn't be necessary if it's not used (and there aren't any other invoke-parsed functions aside from checking with Import() whether the script actually returns a clip), so the comment could be shortened. Also, since this is the avisynth demuxer, 'in the avs' would be better rendered as 'in the script', and simply refer to 'source plugins' rather than 'avisynth source plugins'. Comment bikeshedding aside, LGTM, but the avs_is* API usage added here needs to be reflected in the AVSC_DECLARE_FUNC and LOAD_AVS_FUNC blocks. If those parts of the API are present in 2.5, the LOAD_AVS_FUNC can be a 0. If they were added in 2.6 (or Plus, but I know these would have to be from classic AviSynth), then it should be 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] avisynth: more intelligent RGB flipping
On 6/9/20 7:56 PM, Stephen Hutchinson wrote: avs_is_color_space provides a generic way of checking whether the video is RGB, and has been available since 2.6. This means that GetProcAddress doesn't have to run on every frame. --- Also should probably be applied to the 4.3 branch as well. libavformat/avisynth.c | 27 +-- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 2c08ace8db..f029a0e842 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -57,6 +57,7 @@ typedef struct AviSynthLibrary { AVSC_DECLARE_FUNC(avs_get_version); AVSC_DECLARE_FUNC(avs_get_video_info); AVSC_DECLARE_FUNC(avs_invoke); +AVSC_DECLARE_FUNC(avs_is_color_space); AVSC_DECLARE_FUNC(avs_release_clip); AVSC_DECLARE_FUNC(avs_release_value); AVSC_DECLARE_FUNC(avs_release_video_frame); @@ -133,6 +134,7 @@ static av_cold int avisynth_load_library(void) LOAD_AVS_FUNC(avs_get_version, 0); LOAD_AVS_FUNC(avs_get_video_info, 0); LOAD_AVS_FUNC(avs_invoke, 0); +LOAD_AVS_FUNC(avs_is_color_space, 0); LOAD_AVS_FUNC(avs_release_clip, 0); LOAD_AVS_FUNC(avs_release_value, 0); LOAD_AVS_FUNC(avs_release_video_frame, 0); @@ -628,7 +630,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, const unsigned char *src_p; int n, i, plane, rowsize, planeheight, pitch, bits, ret; const char *error; -int avsplus av_unused; if (avs->curr_frame >= avs->vi->num_frames) return AVERROR_EOF; @@ -638,19 +639,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, if (discard) return 0; -#ifdef _WIN32 -/* Detect whether we're using AviSynth 2.6 or AviSynth+ by - * looking for whether avs_is_planar_rgb exists. */ -if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL) -avsplus = 0; -else -avsplus = 1; -#else -/* AviSynth+ is now the only variant of AviSynth we support - * on Linux and macOS. */ -avsplus = 1; -#endif - bits = avs_library.avs_bits_per_pixel(avs->vi); /* Without the cast to int64_t, calculation overflows at about 9k x 9k @@ -687,14 +675,9 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, planeheight = avs_library.avs_get_height_p(frame, plane); /* Flip RGB video. */ -if (avs_is_rgb24(avs->vi) || avs_is_rgb(avs->vi)) { -src_p = src_p + (planeheight - 1) * pitch; -pitch = -pitch; -} - -/* Flip Planar RGB video */ -if (avsplus && (avs_library.avs_is_planar_rgb(avs->vi) || -avs_library.avs_is_planar_rgba(avs->vi))) { +if (avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR48) || +avs_library.avs_is_color_space(avs->vi, AVS_CS_BGR64)) { src_p = src_p + (planeheight - 1) * pitch; pitch = -pitch; } 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".