You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Avoid usage of avcodec_get_pix_fmt_name() and
avcodec_get_chroma_sub_sample(), directly access av_pix_fmt_descriptors instead. Remove some of the dependancies of lavfi on lavc. Originally committed as revision 21575 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		| @@ -22,6 +22,7 @@ | ||||
| /* #define DEBUG */ | ||||
|  | ||||
| #include "libavcodec/imgconvert.h" | ||||
| #include "libavutil/pixdesc.h" | ||||
| #include "avfilter.h" | ||||
|  | ||||
| unsigned avfilter_version(void) { | ||||
| @@ -183,7 +184,7 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end) | ||||
|     dprintf(ctx, | ||||
|             "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", | ||||
|             link, link->w, link->h, | ||||
|             avcodec_get_pix_fmt_name(link->format), | ||||
|             av_pix_fmt_descriptors[link->format].name, | ||||
|             link->src ? link->src->filter->name : "", | ||||
|             link->dst ? link->dst->filter->name : "", | ||||
|             end ? "\n" : ""); | ||||
| @@ -298,7 +299,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) | ||||
|  | ||||
|     /* copy the slice if needed for permission reasons */ | ||||
|     if(link->srcpic) { | ||||
|         avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); | ||||
|         hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; | ||||
|         vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; | ||||
|  | ||||
|         for(i = 0; i < 4; i ++) { | ||||
|             if(link->srcpic->data[i]) { | ||||
|   | ||||
| @@ -24,6 +24,7 @@ | ||||
|  */ | ||||
|  | ||||
| #include "avfilter.h" | ||||
| #include "libavutil/pixdesc.h" | ||||
| #include "libswscale/swscale.h" | ||||
|  | ||||
| typedef struct { | ||||
| @@ -126,7 +127,7 @@ static int config_props(AVFilterLink *outlink) | ||||
|                                 SWS_BILINEAR, NULL, NULL, NULL); | ||||
|  | ||||
|     av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n", | ||||
|            outlink->w, outlink->h, avcodec_get_pix_fmt_name(outlink->format)); | ||||
|            outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name); | ||||
|  | ||||
|     scale->input_is_pal = inlink->format == PIX_FMT_PAL8      || | ||||
|                           inlink->format == PIX_FMT_BGR4_BYTE || | ||||
| @@ -143,7 +144,8 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) | ||||
|     AVFilterLink *outlink = link->dst->outputs[0]; | ||||
|     AVFilterPicRef *outpicref; | ||||
|  | ||||
|     avcodec_get_chroma_sub_sample(link->format, &scale->hsub, &scale->vsub); | ||||
|     scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; | ||||
|     scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; | ||||
|  | ||||
|     outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | ||||
|     outpicref->pts = picref->pts; | ||||
|   | ||||
| @@ -24,6 +24,7 @@ | ||||
|  */ | ||||
|  | ||||
| #include "avfilter.h" | ||||
| #include "libavutil/pixdesc.h" | ||||
|  | ||||
| typedef struct { | ||||
|     int h;          ///< output slice height | ||||
| @@ -44,9 +45,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) | ||||
| static int config_props(AVFilterLink *link) | ||||
| { | ||||
|     SliceContext *slice = link->dst->priv; | ||||
|     int tmp; | ||||
|  | ||||
|     avcodec_get_chroma_sub_sample(link->format, &tmp, &slice->vshift); | ||||
|     slice->vshift = av_pix_fmt_descriptors[link->format].log2_chroma_h; | ||||
|  | ||||
|     /* ensure that slices play nice with chroma subsampling, and enforce | ||||
|      * a reasonable minimum size for the slices */ | ||||
|   | ||||
| @@ -23,6 +23,7 @@ | ||||
|  * video vertical flip filter | ||||
|  */ | ||||
|  | ||||
| #include "libavutil/pixdesc.h" | ||||
| #include "avfilter.h" | ||||
|  | ||||
| typedef struct { | ||||
| @@ -32,9 +33,8 @@ typedef struct { | ||||
| static int config_input(AVFilterLink *link) | ||||
| { | ||||
|     FlipContext *flip = link->dst->priv; | ||||
|     int tmp; | ||||
|  | ||||
|     avcodec_get_chroma_sub_sample(link->format, &tmp, &flip->vsub); | ||||
|     flip->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user