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

libavformat/rawvideodec.c

Go to the documentation of this file.
00001 /*
00002  * RAW video demuxer
00003  * Copyright (c) 2001 Fabrice Bellard
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #include "avformat.h"
00023 #include "rawdec.h"
00024 
00025 static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
00026 {
00027     int packet_size, ret, width, height;
00028     AVStream *st = s->streams[0];
00029 
00030     width = st->codec->width;
00031     height = st->codec->height;
00032 
00033     packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
00034     if (packet_size < 0)
00035         return -1;
00036 
00037     ret= av_get_packet(s->pb, pkt, packet_size);
00038     pkt->pts=
00039     pkt->dts= pkt->pos / packet_size;
00040 
00041     pkt->stream_index = 0;
00042     if (ret < 0)
00043         return ret;
00044     return 0;
00045 }
00046 
00047 AVInputFormat ff_rawvideo_demuxer = {
00048     "rawvideo",
00049     NULL_IF_CONFIG_SMALL("raw video format"),
00050     sizeof(FFRawVideoDemuxerContext),
00051     NULL,
00052     ff_raw_read_header,
00053     rawvideo_read_packet,
00054     .flags= AVFMT_GENERIC_INDEX,
00055     .extensions = "yuv,cif,qcif,rgb",
00056     .value = CODEC_ID_RAWVIDEO,
00057     .priv_class = &ff_rawvideo_demuxer_class,
00058 };

Generated on Wed Apr 11 2012 07:31:36 for FFmpeg by  doxygen 1.7.1