• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavfilter/avcodec.c

Go to the documentation of this file.
00001 /*
00002  * This file is part of FFmpeg.
00003  *
00004  * FFmpeg is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * FFmpeg is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with FFmpeg; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00017  */
00018 
00024 #include "avcodec.h"
00025 
00026 void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
00027 {
00028     dst->pts    = src->pts;
00029     dst->pos    = src->pkt_pos;
00030     dst->format = src->format;
00031 
00032     switch (dst->type) {
00033     case AVMEDIA_TYPE_VIDEO:
00034         dst->video->w                   = src->width;
00035         dst->video->h                   = src->height;
00036         dst->video->sample_aspect_ratio = src->sample_aspect_ratio;
00037         dst->video->interlaced          = src->interlaced_frame;
00038         dst->video->top_field_first     = src->top_field_first;
00039         dst->video->key_frame           = src->key_frame;
00040         dst->video->pict_type           = src->pict_type;
00041     }
00042 }
00043 
00044 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame,
00045                                                             int perms)
00046 {
00047     AVFilterBufferRef *picref =
00048         avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, perms,
00049                                                   frame->width, frame->height,
00050                                                   frame->format);
00051     if (!picref)
00052         return NULL;
00053     avfilter_copy_frame_props(picref, frame);
00054     return picref;
00055 }
00056 
00057 int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
00058                                               const AVFilterBufferRef *picref)
00059 {
00060     if (!picref || !picref->video || !frame)
00061         return AVERROR(EINVAL);
00062 
00063     memcpy(frame->data,     picref->data,     sizeof(frame->data));
00064     memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
00065     frame->pkt_pos          = picref->pos;
00066     frame->interlaced_frame = picref->video->interlaced;
00067     frame->top_field_first  = picref->video->top_field_first;
00068     frame->key_frame        = picref->video->key_frame;
00069     frame->pict_type        = picref->video->pict_type;
00070     frame->sample_aspect_ratio = picref->video->sample_aspect_ratio;
00071 
00072     return 0;
00073 }

Generated on Fri Feb 22 2013 07:24:30 for FFmpeg by  doxygen 1.7.1