@@ -159,7 +159,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
159
159
src -> outputs [srcpad ] || dst -> inputs [dstpad ])
160
160
return AVERROR (EINVAL );
161
161
162
- if (!src -> internal -> initialized || !dst -> internal -> initialized ) {
162
+ if (!fffilterctx ( src ) -> initialized || !fffilterctx ( dst ) -> initialized ) {
163
163
av_log (src , AV_LOG_ERROR , "Filters must be initialized before linking.\n" );
164
164
return AVERROR (EINVAL );
165
165
}
@@ -668,15 +668,17 @@ static int default_execute(AVFilterContext *ctx, avfilter_action_func *func, voi
668
668
669
669
AVFilterContext * ff_filter_alloc (const AVFilter * filter , const char * inst_name )
670
670
{
671
+ FFFilterContext * ctx ;
671
672
AVFilterContext * ret ;
672
673
int preinited = 0 ;
673
674
674
675
if (!filter )
675
676
return NULL ;
676
677
677
- ret = av_mallocz (sizeof (AVFilterContext ));
678
- if (!ret )
678
+ ctx = av_mallocz (sizeof (* ctx ));
679
+ if (!ctx )
679
680
return NULL ;
681
+ ret = & ctx -> p ;
680
682
681
683
ret -> av_class = & avfilter_class ;
682
684
ret -> filter = filter ;
@@ -698,10 +700,7 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
698
700
av_opt_set_defaults (ret -> priv );
699
701
}
700
702
701
- ret -> internal = av_mallocz (sizeof (* ret -> internal ));
702
- if (!ret -> internal )
703
- goto err ;
704
- ret -> internal -> execute = default_execute ;
703
+ ctx -> execute = default_execute ;
705
704
706
705
ret -> nb_inputs = filter -> nb_inputs ;
707
706
if (ret -> nb_inputs ) {
@@ -735,7 +734,6 @@ AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
735
734
av_freep (& ret -> output_pads );
736
735
ret -> nb_outputs = 0 ;
737
736
av_freep (& ret -> priv );
738
- av_freep (& ret -> internal );
739
737
av_free (ret );
740
738
return NULL ;
741
739
}
@@ -807,7 +805,6 @@ void avfilter_free(AVFilterContext *filter)
807
805
av_expr_free (filter -> enable );
808
806
filter -> enable = NULL ;
809
807
av_freep (& filter -> var_values );
810
- av_freep (& filter -> internal );
811
808
av_free (filter );
812
809
}
813
810
@@ -891,9 +888,10 @@ int ff_filter_process_command(AVFilterContext *ctx, const char *cmd,
891
888
892
889
int avfilter_init_dict (AVFilterContext * ctx , AVDictionary * * options )
893
890
{
891
+ FFFilterContext * ctxi = fffilterctx (ctx );
894
892
int ret = 0 ;
895
893
896
- if (ctx -> internal -> initialized ) {
894
+ if (ctxi -> initialized ) {
897
895
av_log (ctx , AV_LOG_ERROR , "Filter already initialized\n" );
898
896
return AVERROR (EINVAL );
899
897
}
@@ -908,7 +906,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
908
906
ctx -> thread_type & ctx -> graph -> thread_type & AVFILTER_THREAD_SLICE &&
909
907
ctx -> graph -> internal -> thread_execute ) {
910
908
ctx -> thread_type = AVFILTER_THREAD_SLICE ;
911
- ctx -> internal -> execute = ctx -> graph -> internal -> thread_execute ;
909
+ ctxi -> execute = ctx -> graph -> internal -> thread_execute ;
912
910
} else {
913
911
ctx -> thread_type = 0 ;
914
912
}
@@ -924,7 +922,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
924
922
return ret ;
925
923
}
926
924
927
- ctx -> internal -> initialized = 1 ;
925
+ ctxi -> initialized = 1 ;
928
926
929
927
return 0 ;
930
928
}
0 commit comments