Change filtergraph init for FFmpeg 8 compatibility#442
Open
stronk-dev wants to merge 1 commit intolivepeer:masterfrom
Open
Change filtergraph init for FFmpeg 8 compatibility#442stronk-dev wants to merge 1 commit intolivepeer:masterfrom
stronk-dev wants to merge 1 commit intolivepeer:masterfrom
Conversation
Collaborator
|
Looks like I was able to get things to compile with the following (but haven't actually tested it) diff --git a/ffmpeg/filter.c b/ffmpeg/filter.c
index bb0cf93f4a..deba5cd86d 100644
--- a/ffmpeg/filter.c
+++ b/ffmpeg/filter.c
@@ -57,6 +57,7 @@ int init_video_filters(struct input_ctx *ictx, struct output_ctx *octx, AVFrame
AVFilterInOut *inputs = NULL;
AVRational time_base = ictx->ic->streams[ictx->vi]->time_base;
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; // XXX ensure the encoder allows this
+ int nb_pix_fmts = sizeof(pix_fmts) / sizeof(pix_fmts[0]);
struct filter_ctx *vf = &octx->vf;
char *filters_descr = octx->vfilters;
enum AVPixelFormat in_pix_fmt = ictx->vc->pix_fmt;
@@ -104,8 +105,8 @@ int init_video_filters(struct input_ctx *ictx, struct output_ctx *octx, AVFrame
"out", NULL, NULL, vf->graph);
if (ret < 0) LPMS_ERR(vf_init_cleanup, "Cannot create video buffer sink");
- ret = av_opt_set_int_list(vf->sink_ctx, "pix_fmts", pix_fmts,
- AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
+ ret = av_opt_set_array(vf->sink_ctx, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
+ 0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts);
if (ret < 0) LPMS_ERR(vf_init_cleanup, "Cannot set output pixel format");
ret = filtergraph_parser(vf, filters_descr, &inputs, &outputs);
@@ -211,6 +212,7 @@ int init_signature_filters(struct output_ctx *octx, AVFrame *inf)
AVFilterInOut *inputs = NULL;
AVRational time_base = octx->oc->streams[0]->time_base;
enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; // XXX ensure the encoder allows this
+ int nb_pix_fmts = sizeof(pix_fmts) / sizeof(pix_fmts[0]);
struct filter_ctx *sf = &octx->sf;
char *filters_descr = octx->sfilters;
enum AVPixelFormat in_pix_fmt = octx->vc->pix_fmt;
@@ -260,8 +262,8 @@ int init_signature_filters(struct output_ctx *octx, AVFrame *inf)
"out", NULL, NULL, sf->graph);
if (ret < 0) LPMS_ERR(sf_init_cleanup, "Cannot create video buffer sink");
- ret = av_opt_set_int_list(sf->sink_ctx, "pix_fmts", pix_fmts,
- AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
+ ret = av_opt_set_array(sf->sink_ctx, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
+ 0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts);
if (ret < 0) LPMS_ERR(sf_init_cleanup, "Cannot set output pixel format");
ret = filtergraph_parser(sf, filters_descr, &inputs, &outputs);BTW, for the ffmpeg8 bump: we can probably remove the signature stuff from LPMS / go-livepeer since I don't believe we are using it anymore. I just haven't gotten around to the surgery that's required to cleanly remove all signature references in both codebases. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Minor change - splits up the
avfilter_graph_create_filtercommand into a separate alloc & init. AFAIK this is the correct order of operations (withav_opt_set_int_listin between).