History

lavfi: factor copy_video_props() out

Michael Niedermayer committed 14 years ago

Commit a33b4bc1 parent c9a0f9b1 file · +11 −12Browse files

Showing the changes to libavfilter/buffer.c (1 of 1 file). Show all

Unified · Split

libavfilter/buffer.c+11−12
@@ -39,6 +39,15 @@ void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr) · 38 unmodified lines
3939 av_free(ptr);
4040 }
4141
42+static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *src) {
43+ *dst = *src;
44+ if (src->qp_table) {
45+ int qsize = src->qp_table_linesize ? (src->qp_table_linesize * (src->h+15)/16) : (src->w+15)/16;
46+ dst->qp_table = av_malloc(qsize);
47+ memcpy(dst->qp_table, src->qp_table, qsize);
48+ }
49+}
50+
4251 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
4352 {
4453 AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
@@ -51,12 +60,7 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) · 6 unmodified lines
5160 av_free(ret);
5261 return NULL;
5362 }
54− *ret->video = *ref->video;
55− if (ref->video->qp_table) {
56− int qsize = ref->video->qp_table_linesize ? ref->video->qp_table_linesize * ((ref->video->h+15)/16) : (ref->video->w+15)/16;
57− ret->video->qp_table = av_malloc(qsize);
58− memcpy(ret->video->qp_table, ref->video->qp_table, qsize);
59− }
63+ copy_video_props(ret->video, ref->video);
6064 ret->extended_data = ret->data;
6165 } else if (ref->type == AVMEDIA_TYPE_AUDIO) {
6266 ret->audio = av_malloc(sizeof(AVFilterBufferRefAudioProps));
@@ -187,12 +191,7 @@ void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *s · 124 unmodified lines
187191 case AVMEDIA_TYPE_VIDEO: {
188192 if (dst->video->qp_table)
189193 av_freep(&dst->video->qp_table);
190− *dst->video = *src->video;
191− if (src->video->qp_table) {
192− int qsize = src->video->qp_table_linesize ? src->video->qp_table_linesize * ((src->video->h+15)/16) : (src->video->w+15)/16;
193− dst->video->qp_table = av_malloc(qsize);
194− memcpy(dst->video->qp_table, src->video->qp_table, qsize);
195− }
194+ copy_video_props(dst->video, src->video);
196195 break;
197196 }
198197 case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t