| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008 Vitor Sessak | 2 * Copyright (c) 2008 Vitor Sessak |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * FFmpeg is distributed in the hope that it will be useful, | 11 * FFmpeg is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Lesser General Public License for more details. | 14 * Lesser General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Lesser General Public | 16 * You should have received a copy of the GNU Lesser General Public |
| 17 * License along with FFmpeg; if not, write to the Free Software | 17 * License along with FFmpeg; if not, write to the Free Software |
| 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * @file | 22 * @file |
| 23 * memory buffer source filter | 23 * memory buffer source filter |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "avfilter.h" | 26 #include "avfilter.h" |
| 27 #include "vsrc_buffer.h" | 27 #include "vsrc_buffer.h" |
| 28 #include "libavutil/pixdesc.h" | 28 #include "libavcore/imgutils.h" |
| 29 | 29 |
| 30 typedef struct { | 30 typedef struct { |
| 31 int64_t pts; | 31 int64_t pts; |
| 32 AVFrame frame; | 32 AVFrame frame; |
| 33 int has_frame; | 33 int has_frame; |
| 34 int h, w; | 34 int h, w; |
| 35 enum PixelFormat pix_fmt; | 35 enum PixelFormat pix_fmt; |
| 36 AVRational pixel_aspect; | 36 AVRational pixel_aspect; |
| 37 } BufferSourceContext; | 37 } BufferSourceContext; |
| 38 | 38 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 "request_frame() called with no available frame!\n"); | 112 "request_frame() called with no available frame!\n"); |
| 113 //return -1; | 113 //return -1; |
| 114 } | 114 } |
| 115 | 115 |
| 116 /* This picture will be needed unmodified later for decoding the next | 116 /* This picture will be needed unmodified later for decoding the next |
| 117 * frame */ | 117 * frame */ |
| 118 picref = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | | 118 picref = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | |
| 119 AV_PERM_REUSE2, | 119 AV_PERM_REUSE2, |
| 120 link->w, link->h); | 120 link->w, link->h); |
| 121 | 121 |
| 122 av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame, | 122 av_image_copy(picref->data, picref->linesize, |
| 123 picref->format, link->w, link->h); | 123 c->frame.data, c->frame.linesize, |
| 124 picref->format, link->w, link->h); |
| 124 | 125 |
| 125 picref->pts = c->pts; | 126 picref->pts = c->pts; |
| 126 picref->pixel_aspect = c->pixel_aspect; | 127 picref->video->pixel_aspect = c->pixel_aspect; |
| 127 picref->interlaced = c->frame.interlaced_frame; | 128 picref->video->interlaced = c->frame.interlaced_frame; |
| 128 picref->top_field_first = c->frame.top_field_first; | 129 picref->video->top_field_first = c->frame.top_field_first; |
| 129 avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); | 130 avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); |
| 130 avfilter_draw_slice(link, 0, link->h, 1); | 131 avfilter_draw_slice(link, 0, link->h, 1); |
| 131 avfilter_end_frame(link); | 132 avfilter_end_frame(link); |
| 132 avfilter_unref_buffer(picref); | 133 avfilter_unref_buffer(picref); |
| 133 | 134 |
| 134 c->has_frame = 0; | 135 c->has_frame = 0; |
| 135 | 136 |
| 136 return 0; | 137 return 0; |
| 137 } | 138 } |
| 138 | 139 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 151 .init = init, | 152 .init = init, |
| 152 | 153 |
| 153 .inputs = (AVFilterPad[]) {{ .name = NULL }}, | 154 .inputs = (AVFilterPad[]) {{ .name = NULL }}, |
| 154 .outputs = (AVFilterPad[]) {{ .name = "default", | 155 .outputs = (AVFilterPad[]) {{ .name = "default", |
| 155 .type = AVMEDIA_TYPE_VIDEO, | 156 .type = AVMEDIA_TYPE_VIDEO, |
| 156 .request_frame = request_frame, | 157 .request_frame = request_frame, |
| 157 .poll_frame = poll_frame, | 158 .poll_frame = poll_frame, |
| 158 .config_props = config_props, }, | 159 .config_props = config_props, }, |
| 159 { .name = NULL}}, | 160 { .name = NULL}}, |
| 160 }; | 161 }; |
| OLD | NEW |