Skip to content

Instantly share code, notes, and snippets.

@aleksas
Last active December 23, 2019 14:08
Show Gist options
  • Save aleksas/12ed788c486e64c99e1ff70b15fd821f to your computer and use it in GitHub Desktop.
Save aleksas/12ed788c486e64c99e1ff70b15fd821f to your computer and use it in GitHub Desktop.
Patch for FFMPEG build as explained in https://github.com/m-ab-s/media-autobuild_suite#custom-patches to expose some internal functions for custom filter building
libavfilter/avfilter.c | 5 +++++
libavfilter/avfilter.h | 3 +++
libavfilter/formats.c | 14 ++++++++++++--
libavfilter/formats.h | 6 ++++++
libavfilter/video.c | 5 +++++
libavfilter/video.h | 1 +
6 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index baafd029e9..03e8f3f674 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -1123,6 +1123,11 @@ error:
return AVERROR_PATCHWELCOME;
}
+int av_ff_filter_frame(AVFilterLink *link, AVFrame *frame)
+{
+ return ff_filter_frame(link, frame);
+}
+
static int samples_ready(AVFilterLink *link, unsigned min)
{
return ff_framequeue_queued_frames(&link->fifo) &&
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 3eaa8a4089..fb8515668a 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -1161,6 +1161,9 @@ char *avfilter_graph_dump(AVFilterGraph *graph, const char *options);
*/
int avfilter_graph_request_oldest(AVFilterGraph *graph);
+
+int av_ff_filter_frame(AVFilterLink *link, AVFrame *frame);
+
/**
* @}
*/
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 33c64668a0..0982b4f642 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -289,6 +289,11 @@ AVFilterFormats *ff_make_format_list(const int *fmts)
return formats;
}
+AVFilterFormats *av_ff_make_format_list(const int *fmts)
+{
+ return ff_make_format_list(fmts);
+}
+
AVFilterChannelLayouts *ff_make_formatu64_list(const uint64_t *fmts)
{
MAKE_FORMAT_LIST(AVFilterChannelLayouts,
@@ -568,8 +573,13 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
*/
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
{
- SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
- ff_formats_ref, ff_formats_unref, formats);
+ SET_COMMON_FORMATS(ctx, formats, in_formats, out_formats,
+ ff_formats_ref, ff_formats_unref, formats);
+}
+
+int av_ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
+{
+ return ff_set_common_formats(ctx, formats);
}
static int default_query_formats_common(AVFilterContext *ctx,
diff --git a/libavfilter/formats.h b/libavfilter/formats.h
index 870809b5a0..b4aa4fb83b 100644
--- a/libavfilter/formats.h
+++ b/libavfilter/formats.h
@@ -165,6 +165,9 @@ int ff_set_common_samplerates(AVFilterContext *ctx,
av_warn_unused_result
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
+av_warn_unused_result
+int av_ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
+
av_warn_unused_result
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout);
@@ -204,6 +207,9 @@ int ff_query_formats_all_layouts(AVFilterContext *ctx);
av_warn_unused_result
AVFilterFormats *ff_make_format_list(const int *fmts);
+av_warn_unused_result
+AVFilterFormats *av_ff_make_format_list(const int *fmts);
+
/**
* Add fmt to the list of media formats contained in *avff.
* If *avff is NULL the function allocates the filter formats struct
diff --git a/libavfilter/video.c b/libavfilter/video.c
index 7a8e587798..a2eb051bd0 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -110,3 +110,8 @@ AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
return ret;
}
+
+AVFrame *av_ff_get_video_buffer(AVFilterLink *link, int w, int h)
+{
+ return ff_get_video_buffer(link, w, h);
+}
diff --git a/libavfilter/video.h b/libavfilter/video.h
index 56c58d6766..7fbfcb8c3a 100644
--- a/libavfilter/video.h
+++ b/libavfilter/video.h
@@ -37,5 +37,6 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h);
* avfilter_unref_buffer when you are finished with it.
*/
AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h);
+AVFrame *av_ff_get_video_buffer(AVFilterLink *link, int w, int h);
#endif /* AVFILTER_VIDEO_H */
#!/bin/bash
# Force to the suite to think the package has updates to recompile.
# Alternatively, you can use "touch recompile" for a similar effect.
touch custom_updated
_pre_configure(){
#
# Apply a patch from this gist exposing ff_set_common_formats ff_get_video_buffer ff_filter_frame ff_make_format_list functions by addibd wrapper functions with the same name preveeded by av_ prefix.
do_patch "https://gist.githubusercontent.com/aleksas/12ed788c486e64c99e1ff70b15fd821f/raw/c9ce6e1f5fbc6c1531ff03e74d21009137ac492e/ffmpeg-0001-expose_internal_fns.patch" am
#
# Apply a local patch inside the directory where is "ffmpeg_extra.sh"
#patch -p1 -i "$LOCALBUILDDIR/ffmpeg-0001-expose_internal_fns.patch"
}
_post_make(){
# Don't run configure again.
touch "$(get_first_subdir)/do_not_reconfigure"
# Don't clean the build folder on each successive run.
# This is for if you want to keep the current build folder as is and just recompile only.
touch "$(get_first_subdir)/do_not_clean"
}
[compiler list]
msys2Arch=2
arch=3
license2=4
standalone=2
vpx2=2
aom=2
rav1e=1
dav1d=2
x2643=2
x2652=2
other265=1
svthevc=1
xvc=2
vvc=1
svtav1=1
svtvp9=1
flac=1
fdkaac=1
faac=2
mediainfo=2
soxB=2
ffmpegB2=3
ffmpegUpdate=1
ffmpegChoice=2
mp4box=2
rtmpdump=2
mplayer2=2
mpv=1
bmx=2
curl=1
ffmbc=2
cyanrip2=2
redshift=2
ripgrep=2
jq=2
dssim=2
avs2=1
cores=4
deleteSource=2
strip=2
pack=2
logging=1
updateSuite=1
timeStamp=1
ccache=2
noMintty=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment