[FFmpeg-cvslog] fftools/ffmpeg_filter: make OutputFile.width,height private

Anton Khirnov git at videolan.org
Tue Jul 11 20:29:07 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul  6 17:09:59 2023 +0200| [a3ab5bf80d9edf15465d0c1fea349bb3cc76b013] | committer: Anton Khirnov

fftools/ffmpeg_filter: make OutputFile.width,height private

They are not used outside of the filtering code.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3ab5bf80d9edf15465d0c1fea349bb3cc76b013
---

 fftools/ffmpeg.h        |  3 ---
 fftools/ffmpeg_filter.c | 14 ++++++++------
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index b789233a08..79f3f35b3a 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -294,9 +294,6 @@ typedef struct OutputFilter {
 
     enum AVMediaType     type;
 
-    /* desired output stream properties */
-    int width, height;
-
     // those are only set if no format is specified and the encoder gives us multiple options
     // They point directly to the relevant lists of the encoder.
     const int *formats;
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 0272b0a96b..0874187f3e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -138,6 +138,7 @@ typedef struct OutputFilterPriv {
 
     /* desired output stream properties */
     int format;
+    int width, height;
     int sample_rate;
     AVChannelLayout ch_layout;
 } OutputFilterPriv;
@@ -683,8 +684,8 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost)
 
     switch (ost->enc_ctx->codec_type) {
     case AVMEDIA_TYPE_VIDEO:
-        ofilter->width      = ost->enc_ctx->width;
-        ofilter->height     = ost->enc_ctx->height;
+        ofp->width      = ost->enc_ctx->width;
+        ofp->height     = ost->enc_ctx->height;
         if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) {
             ofp->format = ost->enc_ctx->pix_fmt;
         } else {
@@ -1068,6 +1069,7 @@ static int insert_filter(AVFilterContext **last_filter, int *pad_idx,
 
 static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out)
 {
+    OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
     OutputStream *ost = ofilter->ost;
     OutputFile    *of = output_files[ost->file_index];
     AVFilterContext *last_filter = out->filter_ctx;
@@ -1085,13 +1087,13 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
     if (ret < 0)
         return ret;
 
-    if ((ofilter->width || ofilter->height) && ofilter->ost->autoscale) {
+    if ((ofp->width || ofp->height) && ofilter->ost->autoscale) {
         char args[255];
         AVFilterContext *filter;
         const AVDictionaryEntry *e = NULL;
 
         snprintf(args, sizeof(args), "%d:%d",
-                 ofilter->width, ofilter->height);
+                 ofp->width, ofp->height);
 
         while ((e = av_dict_iterate(ost->sws_dict, e))) {
             av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
@@ -1596,8 +1598,8 @@ static int configure_filtergraph(FilterGraph *fg)
 
         ofp->format = av_buffersink_get_format(sink);
 
-        ofilter->width  = av_buffersink_get_w(sink);
-        ofilter->height = av_buffersink_get_h(sink);
+        ofp->width  = av_buffersink_get_w(sink);
+        ofp->height = av_buffersink_get_h(sink);
 
         ofp->sample_rate    = av_buffersink_get_sample_rate(sink);
         av_channel_layout_uninit(&ofp->ch_layout);



More information about the ffmpeg-cvslog mailing list