The new location is more suited, as it is where the lavfi/lavc glue is defined.
Unified · Split
| @@ -26,6 +26,33 @@ · 25 unmodified lines | |||
| 26 | #include "avcodec.h" | 26 | #include "avcodec.h" |
| 27 | #include "libavutil/opt.h" | 27 | #include "libavutil/opt.h" |
| 28 | 28 | ||
| 29 | int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) | ||
| 30 | { | ||
| 31 | dst->pts = src->pts; | ||
| 32 | dst->pos = av_frame_get_pkt_pos(src); | ||
| 33 | dst->format = src->format; | ||
| 34 | |||
| 35 | switch (dst->type) { | ||
| 36 | case AVMEDIA_TYPE_VIDEO: | ||
| 37 | dst->video->w = src->width; | ||
| 38 | dst->video->h = src->height; | ||
| 39 | dst->video->sample_aspect_ratio = src->sample_aspect_ratio; | ||
| 40 | dst->video->interlaced = src->interlaced_frame; | ||
| 41 | dst->video->top_field_first = src->top_field_first; | ||
| 42 | dst->video->key_frame = src->key_frame; | ||
| 43 | dst->video->pict_type = src->pict_type; | ||
| 44 | break; | ||
| 45 | case AVMEDIA_TYPE_AUDIO: | ||
| 46 | dst->audio->sample_rate = src->sample_rate; | ||
| 47 | dst->audio->channel_layout = src->channel_layout; | ||
| 48 | break; | ||
| 49 | default: | ||
| 50 | return AVERROR(EINVAL); | ||
| 51 | } | ||
| 52 | |||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 29 | AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, | 56 | AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, |
| 30 | int perms) | 57 | int perms) |
| 31 | { | 58 | { |
| @@ -163,33 +163,6 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref) · 162 unmodified lines | |||
| 163 | *ref = NULL; | 163 | *ref = NULL; |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) | ||
| 167 | { | ||
| 168 | dst->pts = src->pts; | ||
| 169 | dst->pos = av_frame_get_pkt_pos(src); | ||
| 170 | dst->format = src->format; | ||
| 171 | |||
| 172 | switch (dst->type) { | ||
| 173 | case AVMEDIA_TYPE_VIDEO: | ||
| 174 | dst->video->w = src->width; | ||
| 175 | dst->video->h = src->height; | ||
| 176 | dst->video->sample_aspect_ratio = src->sample_aspect_ratio; | ||
| 177 | dst->video->interlaced = src->interlaced_frame; | ||
| 178 | dst->video->top_field_first = src->top_field_first; | ||
| 179 | dst->video->key_frame = src->key_frame; | ||
| 180 | dst->video->pict_type = src->pict_type; | ||
| 181 | break; | ||
| 182 | case AVMEDIA_TYPE_AUDIO: | ||
| 183 | dst->audio->sample_rate = src->sample_rate; | ||
| 184 | dst->audio->channel_layout = src->channel_layout; | ||
| 185 | break; | ||
| 186 | default: | ||
| 187 | return AVERROR(EINVAL); | ||
| 188 | } | ||
| 189 | |||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) | 166 | int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) |
| 194 | { | 167 | { |
| 195 | int planes, nb_channels; | 168 | int planes, nb_channels; |