Define a new struct AVFilterBufferRefVideoProps and add a type field to AVFilterBufferRef. Video specific properties in AVFilterBufferRefVideoProps are now referred to by *video pointer in AVFilterBufferRef. Patch by S.N. Hemanth Meenakshisundaram smeenaks->ucsd.edu. Originally committed as revision 24763 to svn://svn.ffmpeg.org/ffmpeg/trunk
Showing the changes to libavfilter/avfilter.c (1 of 10 files). Show all
Unified · Split
| @@ -49,6 +49,10 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) · 48 unmodified lines | ||
| 49 | 49 | { |
| 50 | 50 | AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); |
| 51 | 51 | *ret = *ref; |
| 52 | + if (ref->type == AVMEDIA_TYPE_VIDEO) { | |
| 53 | + ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); | |
| 54 | + *ret->video = *ref->video; | |
| 55 | + } | |
| 52 | 56 | ret->perms &= pmask; |
| 53 | 57 | ret->buf->refcount ++; |
| 54 | 58 | return ret; |
| @@ -58,6 +62,7 @@ void avfilter_unref_buffer(AVFilterBufferRef *ref) · 3 unmodified lines | ||
| 58 | 62 | { |
| 59 | 63 | if(!(--ref->buf->refcount)) |
| 60 | 64 | ref->buf->free(ref->buf); |
| 65 | + av_free(ref->video); | |
| 61 | 66 | av_free(ref); |
| 62 | 67 | } |
| 63 | 68 | |
| @@ -179,7 +184,7 @@ void ff_dprintf_picref(void *ctx, AVFilterBufferRef *picref, int end) · 115 unmodified lines | ||
| 179 | 184 | picref->data [0], picref->data [1], picref->data [2], picref->data [3], |
| 180 | 185 | picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3], |
| 181 | 186 | picref->pts, picref->pos, |
| 182 | − picref->pixel_aspect.num, picref->pixel_aspect.den, picref->w, picref->h, | |
| 187 | + picref->video->pixel_aspect.num, picref->video->pixel_aspect.den, picref->video->w, picref->video->h, | |
| 183 | 188 | end ? "\n" : ""); |
| 184 | 189 | } |
| 185 | 190 | |
| @@ -314,7 +319,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 128 unmodified lines | ||
| 314 | 319 | |
| 315 | 320 | for(i = 0; i < 4; i ++) { |
| 316 | 321 | int planew = |
| 317 | − ff_get_plane_bytewidth(link->format, link->cur_buf->w, i); | |
| 322 | + ff_get_plane_bytewidth(link->format, link->cur_buf->video->w, i); | |
| 318 | 323 | |
| 319 | 324 | if(!src[i]) continue; |
| 320 | 325 | |