* [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name
@ 2023-08-01 15:04 Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static Andreas Rheinhardt
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-01 15:04 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Otherwise the var_names and the corresponding enum will be off
and e.g. the array holding the variable values will be too small.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavfilter/avfilter.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 04887b6ee5..b8e1523bdb 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -478,7 +478,9 @@ static int ff_request_frame_to_filter(AVFilterLink *link)
static const char *const var_names[] = {
"t",
"n",
+#if FF_API_FRAME_PKT
"pos",
+#endif
"w",
"h",
NULL
--
2.34.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
@ 2023-08-01 15:06 ` Andreas Rheinhardt
2023-08-01 21:47 ` Hendrik Leppkes
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 3/3] avcodec/nvdec_(mjpeg|vp8): Constify AVHWAccels Andreas Rheinhardt
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-01 15:06 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavfilter/avfilter.c | 44 +++++++++++++++++++++++-------------------
libavfilter/internal.h | 8 --------
2 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index b8e1523bdb..df6f1ab3de 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -201,6 +201,17 @@ void avfilter_link_free(AVFilterLink **link)
av_freep(link);
}
+static void update_link_current_pts(AVFilterLink *link, int64_t pts)
+{
+ if (pts == AV_NOPTS_VALUE)
+ return;
+ link->current_pts = pts;
+ link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
+ /* TODO use duration */
+ if (link->graph && link->age_index >= 0)
+ ff_avfilter_graph_update_heap(link->graph, link);
+}
+
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
{
filter->ready = FFMAX(filter->ready, priority);
@@ -232,13 +243,17 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
ff_filter_set_ready(link->dst, 200);
}
-void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
+/**
+ * Set the status field of a link from the destination filter.
+ * The pts should probably be left unset (AV_NOPTS_VALUE).
+ */
+static void avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
{
av_assert0(!link->frame_wanted_out);
av_assert0(!link->status_out);
link->status_out = status;
if (pts != AV_NOPTS_VALUE)
- ff_update_link_current_pts(link, pts);
+ update_link_current_pts(link, pts);
filter_unblock(link->dst);
ff_filter_set_ready(link->src, 200);
}
@@ -428,7 +443,7 @@ int ff_request_frame(AVFilterLink *link)
/* Acknowledge status change. Filters using ff_request_frame() will
handle the change automatically. Filters can also check the
status directly but none do yet. */
- ff_avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
+ avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
return link->status_out;
}
}
@@ -537,17 +552,6 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr)
return 0;
}
-void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
-{
- if (pts == AV_NOPTS_VALUE)
- return;
- link->current_pts = pts;
- link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
- /* TODO use duration */
- if (link->graph && link->age_index >= 0)
- ff_avfilter_graph_update_heap(link->graph, link);
-}
-
int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
{
if(!strcmp(cmd, "ping")){
@@ -1117,7 +1121,7 @@ static int ff_filter_frame_to_filter(AVFilterLink *link)
link->frame_count_out--;
ret = ff_filter_frame_framed(link, frame);
if (ret < 0 && ret != link->status_out) {
- ff_avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
+ avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
} else {
/* Run once again, to see if several frames were available, or if
the input status has also changed, or any other reason. */
@@ -1147,7 +1151,7 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in)
if (!progress) {
/* Every output already closed: input no longer interesting
(example: overlay in shortest mode, other input closed). */
- ff_avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
+ avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
return 0;
}
progress = 0;
@@ -1249,7 +1253,7 @@ static int ff_filter_activate_default(AVFilterContext *filter)
change is considered having already happened.
It is set by the destination filter using
- ff_avfilter_link_set_out_status().
+ avfilter_link_set_out_status().
Filters are activated according to the ready field, set using the
ff_filter_set_ready(). Eventually, a priority queue will be used.
@@ -1339,7 +1343,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
if (!link->status_in)
return *rstatus = 0;
*rstatus = link->status_out = link->status_in;
- ff_update_link_current_pts(link, link->status_in_pts);
+ update_link_current_pts(link, link->status_in_pts);
*rpts = link->current_pts;
return 1;
}
@@ -1368,7 +1372,7 @@ int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
static void consume_update(AVFilterLink *link, const AVFrame *frame)
{
- ff_update_link_current_pts(link, frame->pts);
+ update_link_current_pts(link, frame->pts);
ff_inlink_process_commands(link, frame);
link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
link->frame_count_out++;
@@ -1512,7 +1516,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status)
return;
link->frame_wanted_out = 0;
link->frame_blocked_in = 0;
- ff_avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
+ avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
while (ff_framequeue_queued_frames(&link->fifo)) {
AVFrame *frame = ff_framequeue_take(&link->fifo);
av_frame_free(&frame);
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 8b232a8d8f..58665ff086 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -243,8 +243,6 @@ av_warn_unused_result
int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg,
void *log_ctx);
-void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
-
/**
* Set the status field of a link from the source filter.
* The pts should reflect the timestamp of the status change,
@@ -254,12 +252,6 @@ void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
*/
void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts);
-/**
- * Set the status field of a link from the destination filter.
- * The pts should probably be left unset (AV_NOPTS_VALUE).
- */
-void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts);
-
#define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
--
2.34.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 3/3] avcodec/nvdec_(mjpeg|vp8): Constify AVHWAccels
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static Andreas Rheinhardt
@ 2023-08-01 15:06 ` Andreas Rheinhardt
2023-08-01 15:40 ` [FFmpeg-devel] [PATCH 4/4] avcodec/error_resilience: Remove always-true checks Andreas Rheinhardt
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-01 15:06 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
The discrepancy between the actual definition and the declarations
in hwaccels.h is actually UB.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/nvdec_mjpeg.c | 2 +-
libavcodec/nvdec_vp8.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c
index fce464c1f8..daaf0072ed 100644
--- a/libavcodec/nvdec_mjpeg.c
+++ b/libavcodec/nvdec_mjpeg.c
@@ -69,7 +69,7 @@ static int nvdec_mjpeg_frame_params(AVCodecContext *avctx,
return ff_nvdec_frame_params(avctx, hw_frames_ctx, 1, 0);
}
-AVHWAccel ff_mjpeg_nvdec_hwaccel = {
+const AVHWAccel ff_mjpeg_nvdec_hwaccel = {
.name = "mjpeg_nvdec",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_MJPEG,
diff --git a/libavcodec/nvdec_vp8.c b/libavcodec/nvdec_vp8.c
index f174ca430f..3812ef3e1a 100644
--- a/libavcodec/nvdec_vp8.c
+++ b/libavcodec/nvdec_vp8.c
@@ -90,7 +90,7 @@ static int nvdec_vp8_frame_params(AVCodecContext *avctx,
return ff_nvdec_frame_params(avctx, hw_frames_ctx, 3, 0);
}
-AVHWAccel ff_vp8_nvdec_hwaccel = {
+const AVHWAccel ff_vp8_nvdec_hwaccel = {
.name = "vp8_nvdec",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP8,
--
2.34.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avcodec/error_resilience: Remove always-true checks
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 3/3] avcodec/nvdec_(mjpeg|vp8): Constify AVHWAccels Andreas Rheinhardt
@ 2023-08-01 15:40 ` Andreas Rheinhardt
2023-08-01 16:27 ` [FFmpeg-devel] [PATCH v2 4/4] avcodec/error_resilience, mpeg12dec: " Andreas Rheinhardt
2023-08-03 15:39 ` [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
4 siblings, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-01 15:40 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Having a decode_slice callback is mandatory for HWAccels;
the only exception to this (and the reason why these checks
were added) was XvMC, but it is no more since commit
be95df12bb06b183c8d2aea3b0831fdf05466cf3.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/error_resilience.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2aa6f1d864..68e20925e0 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -804,7 +804,7 @@ void ff_er_frame_start(ERContext *s)
static int er_supported(ERContext *s)
{
- if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice ||
+ if (s->avctx->hwaccel ||
!s->cur_pic.f ||
s->cur_pic.field_picture
)
@@ -828,7 +828,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
const int end_xy = s->mb_index2xy[end_i];
int mask = -1;
- if (s->avctx->hwaccel && s->avctx->hwaccel->decode_slice)
+ if (s->avctx->hwaccel)
return;
if (start_i > end_i || start_xy > end_xy) {
--
2.34.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/4] avcodec/error_resilience, mpeg12dec: Remove always-true checks
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
` (2 preceding siblings ...)
2023-08-01 15:40 ` [FFmpeg-devel] [PATCH 4/4] avcodec/error_resilience: Remove always-true checks Andreas Rheinhardt
@ 2023-08-01 16:27 ` Andreas Rheinhardt
2023-08-03 15:39 ` [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
4 siblings, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-01 16:27 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Having a decode_slice callback is mandatory for HWAccels;
the only exception to this (and the reason why these checks
were added) was XvMC, but it is no more since commit
be95df12bb06b183c8d2aea3b0831fdf05466cf3.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/error_resilience.c | 4 ++--
libavcodec/mpeg12dec.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2aa6f1d864..68e20925e0 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -804,7 +804,7 @@ void ff_er_frame_start(ERContext *s)
static int er_supported(ERContext *s)
{
- if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice ||
+ if (s->avctx->hwaccel ||
!s->cur_pic.f ||
s->cur_pic.field_picture
)
@@ -828,7 +828,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
const int end_xy = s->mb_index2xy[end_i];
int mask = -1;
- if (s->avctx->hwaccel && s->avctx->hwaccel->decode_slice)
+ if (s->avctx->hwaccel)
return;
if (start_i > end_i || start_xy > end_xy) {
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 27b45c6fc4..3737d77eca 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1750,7 +1750,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
return AVERROR_INVALIDDATA;
}
- if (avctx->hwaccel && avctx->hwaccel->decode_slice) {
+ if (avctx->hwaccel) {
const uint8_t *buf_end, *buf_start = *buf - 4; /* include start_code */
int start_code = -1;
buf_end = avpriv_find_start_code(buf_start + 2, *buf + buf_size, &start_code);
--
2.34.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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static Andreas Rheinhardt
@ 2023-08-01 21:47 ` Hendrik Leppkes
2023-08-02 5:16 ` Andreas Rheinhardt
0 siblings, 1 reply; 8+ messages in thread
From: Hendrik Leppkes @ 2023-08-01 21:47 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, Aug 1, 2023 at 5:05 PM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavfilter/avfilter.c | 44 +++++++++++++++++++++++-------------------
> libavfilter/internal.h | 8 --------
> 2 files changed, 24 insertions(+), 28 deletions(-)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index b8e1523bdb..df6f1ab3de 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -201,6 +201,17 @@ void avfilter_link_free(AVFilterLink **link)
> av_freep(link);
> }
>
> +static void update_link_current_pts(AVFilterLink *link, int64_t pts)
> +{
> + if (pts == AV_NOPTS_VALUE)
> + return;
> + link->current_pts = pts;
> + link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
> + /* TODO use duration */
> + if (link->graph && link->age_index >= 0)
> + ff_avfilter_graph_update_heap(link->graph, link);
> +}
> +
> void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
> {
> filter->ready = FFMAX(filter->ready, priority);
> @@ -232,13 +243,17 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
> ff_filter_set_ready(link->dst, 200);
> }
>
> -void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
> +/**
> + * Set the status field of a link from the destination filter.
> + * The pts should probably be left unset (AV_NOPTS_VALUE).
> + */
> +static void avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
Having the function named avfilter_* seems slightly confusing, as
thats the public namespace of exported avfilter functions.
Its of course not going to show up in other files, being static and
all, but in the functions below that use it, a reader might get the
wrong idea about a function call.
Maybe just remove the avfilter prefix? It seems unnecessary here.
> {
> av_assert0(!link->frame_wanted_out);
> av_assert0(!link->status_out);
> link->status_out = status;
> if (pts != AV_NOPTS_VALUE)
> - ff_update_link_current_pts(link, pts);
> + update_link_current_pts(link, pts);
> filter_unblock(link->dst);
> ff_filter_set_ready(link->src, 200);
> }
> @@ -428,7 +443,7 @@ int ff_request_frame(AVFilterLink *link)
> /* Acknowledge status change. Filters using ff_request_frame() will
> handle the change automatically. Filters can also check the
> status directly but none do yet. */
> - ff_avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
> + avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
> return link->status_out;
> }
> }
> @@ -537,17 +552,6 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr)
> return 0;
> }
>
> -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
> -{
> - if (pts == AV_NOPTS_VALUE)
> - return;
> - link->current_pts = pts;
> - link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
> - /* TODO use duration */
> - if (link->graph && link->age_index >= 0)
> - ff_avfilter_graph_update_heap(link->graph, link);
> -}
> -
> int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
> {
> if(!strcmp(cmd, "ping")){
> @@ -1117,7 +1121,7 @@ static int ff_filter_frame_to_filter(AVFilterLink *link)
> link->frame_count_out--;
> ret = ff_filter_frame_framed(link, frame);
> if (ret < 0 && ret != link->status_out) {
> - ff_avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
> + avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
> } else {
> /* Run once again, to see if several frames were available, or if
> the input status has also changed, or any other reason. */
> @@ -1147,7 +1151,7 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in)
> if (!progress) {
> /* Every output already closed: input no longer interesting
> (example: overlay in shortest mode, other input closed). */
> - ff_avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
> + avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
> return 0;
> }
> progress = 0;
> @@ -1249,7 +1253,7 @@ static int ff_filter_activate_default(AVFilterContext *filter)
> change is considered having already happened.
>
> It is set by the destination filter using
> - ff_avfilter_link_set_out_status().
> + avfilter_link_set_out_status().
>
> Filters are activated according to the ready field, set using the
> ff_filter_set_ready(). Eventually, a priority queue will be used.
> @@ -1339,7 +1343,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
> if (!link->status_in)
> return *rstatus = 0;
> *rstatus = link->status_out = link->status_in;
> - ff_update_link_current_pts(link, link->status_in_pts);
> + update_link_current_pts(link, link->status_in_pts);
> *rpts = link->current_pts;
> return 1;
> }
> @@ -1368,7 +1372,7 @@ int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
>
> static void consume_update(AVFilterLink *link, const AVFrame *frame)
> {
> - ff_update_link_current_pts(link, frame->pts);
> + update_link_current_pts(link, frame->pts);
> ff_inlink_process_commands(link, frame);
> link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
> link->frame_count_out++;
> @@ -1512,7 +1516,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status)
> return;
> link->frame_wanted_out = 0;
> link->frame_blocked_in = 0;
> - ff_avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
> + avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
> while (ff_framequeue_queued_frames(&link->fifo)) {
> AVFrame *frame = ff_framequeue_take(&link->fifo);
> av_frame_free(&frame);
> diff --git a/libavfilter/internal.h b/libavfilter/internal.h
> index 8b232a8d8f..58665ff086 100644
> --- a/libavfilter/internal.h
> +++ b/libavfilter/internal.h
> @@ -243,8 +243,6 @@ av_warn_unused_result
> int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg,
> void *log_ctx);
>
> -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
> -
> /**
> * Set the status field of a link from the source filter.
> * The pts should reflect the timestamp of the status change,
> @@ -254,12 +252,6 @@ void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
> */
> void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts);
>
> -/**
> - * Set the status field of a link from the destination filter.
> - * The pts should probably be left unset (AV_NOPTS_VALUE).
> - */
> -void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts);
> -
> #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
> #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
> #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
> --
> 2.34.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-request@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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static
2023-08-01 21:47 ` Hendrik Leppkes
@ 2023-08-02 5:16 ` Andreas Rheinhardt
0 siblings, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-02 5:16 UTC (permalink / raw)
To: ffmpeg-devel
Hendrik Leppkes:
> On Tue, Aug 1, 2023 at 5:05 PM Andreas Rheinhardt
> <andreas.rheinhardt@outlook.com> wrote:
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> libavfilter/avfilter.c | 44 +++++++++++++++++++++++-------------------
>> libavfilter/internal.h | 8 --------
>> 2 files changed, 24 insertions(+), 28 deletions(-)
>>
>> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
>> index b8e1523bdb..df6f1ab3de 100644
>> --- a/libavfilter/avfilter.c
>> +++ b/libavfilter/avfilter.c
>> @@ -201,6 +201,17 @@ void avfilter_link_free(AVFilterLink **link)
>> av_freep(link);
>> }
>>
>> +static void update_link_current_pts(AVFilterLink *link, int64_t pts)
>> +{
>> + if (pts == AV_NOPTS_VALUE)
>> + return;
>> + link->current_pts = pts;
>> + link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
>> + /* TODO use duration */
>> + if (link->graph && link->age_index >= 0)
>> + ff_avfilter_graph_update_heap(link->graph, link);
>> +}
>> +
>> void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
>> {
>> filter->ready = FFMAX(filter->ready, priority);
>> @@ -232,13 +243,17 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts)
>> ff_filter_set_ready(link->dst, 200);
>> }
>>
>> -void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
>> +/**
>> + * Set the status field of a link from the destination filter.
>> + * The pts should probably be left unset (AV_NOPTS_VALUE).
>> + */
>> +static void avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts)
>
> Having the function named avfilter_* seems slightly confusing, as
> thats the public namespace of exported avfilter functions.
> Its of course not going to show up in other files, being static and
> all, but in the functions below that use it, a reader might get the
> wrong idea about a function call.
>
> Maybe just remove the avfilter prefix? It seems unnecessary here.
>
Ok, will do.
>> {
>> av_assert0(!link->frame_wanted_out);
>> av_assert0(!link->status_out);
>> link->status_out = status;
>> if (pts != AV_NOPTS_VALUE)
>> - ff_update_link_current_pts(link, pts);
>> + update_link_current_pts(link, pts);
>> filter_unblock(link->dst);
>> ff_filter_set_ready(link->src, 200);
>> }
>> @@ -428,7 +443,7 @@ int ff_request_frame(AVFilterLink *link)
>> /* Acknowledge status change. Filters using ff_request_frame() will
>> handle the change automatically. Filters can also check the
>> status directly but none do yet. */
>> - ff_avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
>> + avfilter_link_set_out_status(link, link->status_in, link->status_in_pts);
>> return link->status_out;
>> }
>> }
>> @@ -537,17 +552,6 @@ static int set_enable_expr(AVFilterContext *ctx, const char *expr)
>> return 0;
>> }
>>
>> -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts)
>> -{
>> - if (pts == AV_NOPTS_VALUE)
>> - return;
>> - link->current_pts = pts;
>> - link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
>> - /* TODO use duration */
>> - if (link->graph && link->age_index >= 0)
>> - ff_avfilter_graph_update_heap(link->graph, link);
>> -}
>> -
>> int avfilter_process_command(AVFilterContext *filter, const char *cmd, const char *arg, char *res, int res_len, int flags)
>> {
>> if(!strcmp(cmd, "ping")){
>> @@ -1117,7 +1121,7 @@ static int ff_filter_frame_to_filter(AVFilterLink *link)
>> link->frame_count_out--;
>> ret = ff_filter_frame_framed(link, frame);
>> if (ret < 0 && ret != link->status_out) {
>> - ff_avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
>> + avfilter_link_set_out_status(link, ret, AV_NOPTS_VALUE);
>> } else {
>> /* Run once again, to see if several frames were available, or if
>> the input status has also changed, or any other reason. */
>> @@ -1147,7 +1151,7 @@ static int forward_status_change(AVFilterContext *filter, AVFilterLink *in)
>> if (!progress) {
>> /* Every output already closed: input no longer interesting
>> (example: overlay in shortest mode, other input closed). */
>> - ff_avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
>> + avfilter_link_set_out_status(in, in->status_in, in->status_in_pts);
>> return 0;
>> }
>> progress = 0;
>> @@ -1249,7 +1253,7 @@ static int ff_filter_activate_default(AVFilterContext *filter)
>> change is considered having already happened.
>>
>> It is set by the destination filter using
>> - ff_avfilter_link_set_out_status().
>> + avfilter_link_set_out_status().
>>
>> Filters are activated according to the ready field, set using the
>> ff_filter_set_ready(). Eventually, a priority queue will be used.
>> @@ -1339,7 +1343,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
>> if (!link->status_in)
>> return *rstatus = 0;
>> *rstatus = link->status_out = link->status_in;
>> - ff_update_link_current_pts(link, link->status_in_pts);
>> + update_link_current_pts(link, link->status_in_pts);
>> *rpts = link->current_pts;
>> return 1;
>> }
>> @@ -1368,7 +1372,7 @@ int ff_inlink_check_available_samples(AVFilterLink *link, unsigned min)
>>
>> static void consume_update(AVFilterLink *link, const AVFrame *frame)
>> {
>> - ff_update_link_current_pts(link, frame->pts);
>> + update_link_current_pts(link, frame->pts);
>> ff_inlink_process_commands(link, frame);
>> link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
>> link->frame_count_out++;
>> @@ -1512,7 +1516,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status)
>> return;
>> link->frame_wanted_out = 0;
>> link->frame_blocked_in = 0;
>> - ff_avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
>> + avfilter_link_set_out_status(link, status, AV_NOPTS_VALUE);
>> while (ff_framequeue_queued_frames(&link->fifo)) {
>> AVFrame *frame = ff_framequeue_take(&link->fifo);
>> av_frame_free(&frame);
>> diff --git a/libavfilter/internal.h b/libavfilter/internal.h
>> index 8b232a8d8f..58665ff086 100644
>> --- a/libavfilter/internal.h
>> +++ b/libavfilter/internal.h
>> @@ -243,8 +243,6 @@ av_warn_unused_result
>> int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg,
>> void *log_ctx);
>>
>> -void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
>> -
>> /**
>> * Set the status field of a link from the source filter.
>> * The pts should reflect the timestamp of the status change,
>> @@ -254,12 +252,6 @@ void ff_update_link_current_pts(AVFilterLink *link, int64_t pts);
>> */
>> void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts);
>>
>> -/**
>> - * Set the status field of a link from the destination filter.
>> - * The pts should probably be left unset (AV_NOPTS_VALUE).
>> - */
>> -void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts);
>> -
>> #define D2TS(d) (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
>> #define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
>> #define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
>> --
>> 2.34.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-request@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-request@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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
` (3 preceding siblings ...)
2023-08-01 16:27 ` [FFmpeg-devel] [PATCH v2 4/4] avcodec/error_resilience, mpeg12dec: " Andreas Rheinhardt
@ 2023-08-03 15:39 ` Andreas Rheinhardt
4 siblings, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2023-08-03 15:39 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Otherwise the var_names and the corresponding enum will be off
> and e.g. the array holding the variable values will be too small.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavfilter/avfilter.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index 04887b6ee5..b8e1523bdb 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -478,7 +478,9 @@ static int ff_request_frame_to_filter(AVFilterLink *link)
> static const char *const var_names[] = {
> "t",
> "n",
> +#if FF_API_FRAME_PKT
> "pos",
> +#endif
> "w",
> "h",
> NULL
Will apply this patchset tomorrow unless there are objections.
- 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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-08-03 15:38 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-01 15:04 [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 2/3] avfilter/avfilter: Make functions only used here static Andreas Rheinhardt
2023-08-01 21:47 ` Hendrik Leppkes
2023-08-02 5:16 ` Andreas Rheinhardt
2023-08-01 15:06 ` [FFmpeg-devel] [PATCH 3/3] avcodec/nvdec_(mjpeg|vp8): Constify AVHWAccels Andreas Rheinhardt
2023-08-01 15:40 ` [FFmpeg-devel] [PATCH 4/4] avcodec/error_resilience: Remove always-true checks Andreas Rheinhardt
2023-08-01 16:27 ` [FFmpeg-devel] [PATCH v2 4/4] avcodec/error_resilience, mpeg12dec: " Andreas Rheinhardt
2023-08-03 15:39 ` [FFmpeg-devel] [PATCH 1/3] avfilter/avfilter: Also deprecate variable name Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git