Revision 92aa28d2

View differences:

libavformat/Makefile
204 204
OBJS-$(CONFIG_PVA_DEMUXER)               += pva.o
205 205
OBJS-$(CONFIG_QCP_DEMUXER)               += qcp.o
206 206
OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o
207
OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += raw.o
207
OBJS-$(CONFIG_RAWVIDEO_DEMUXER)          += rawvideodec.o raw.o
208 208
OBJS-$(CONFIG_RAWVIDEO_MUXER)            += raw.o
209 209
OBJS-$(CONFIG_RL2_DEMUXER)               += rl2.o
210 210
OBJS-$(CONFIG_RM_DEMUXER)                += rmdec.o rm.o
libavformat/raw.c
101 101
    pkt->size = ret;
102 102
    return ret;
103 103
}
104
#endif
105

  
106
#if CONFIG_RAWVIDEO_DEMUXER
107
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
108
{
109
    int packet_size, ret, width, height;
110
    AVStream *st = s->streams[0];
111

  
112
    width = st->codec->width;
113
    height = st->codec->height;
114

  
115
    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
116
    if (packet_size < 0)
117
        return -1;
118

  
119
    ret= av_get_packet(s->pb, pkt, packet_size);
120
    pkt->pts=
121
    pkt->dts= pkt->pos / packet_size;
122 104

  
123
    pkt->stream_index = 0;
124
    if (ret < 0)
125
        return ret;
126
    return 0;
127
}
128
#endif
129

  
130
#if CONFIG_DEMUXERS
131 105
int ff_raw_audio_read_header(AVFormatContext *s,
132 106
                             AVFormatParameters *ap)
133 107
{
......
469 443
};
470 444
#endif
471 445

  
472
#if CONFIG_RAWVIDEO_DEMUXER
473
AVInputFormat rawvideo_demuxer = {
474
    "rawvideo",
475
    NULL_IF_CONFIG_SMALL("raw video format"),
476
    0,
477
    NULL,
478
    ff_raw_read_header,
479
    rawvideo_read_packet,
480
    .flags= AVFMT_GENERIC_INDEX,
481
    .extensions = "yuv,cif,qcif,rgb",
482
    .value = CODEC_ID_RAWVIDEO,
483
};
484
#endif
485

  
486 446
#if CONFIG_RAWVIDEO_MUXER
487 447
AVOutputFormat rawvideo_muxer = {
488 448
    "rawvideo",
libavformat/rawvideodec.c
1
/*
2
 * RAW video demuxer
3
 * Copyright (c) 2001 Fabrice Bellard
4
 *
5
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * FFmpeg is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with FFmpeg; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
 */
21

  
22
#include "avformat.h"
23
#include "raw.h"
24

  
25
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
26
{
27
    int packet_size, ret, width, height;
28
    AVStream *st = s->streams[0];
29

  
30
    width = st->codec->width;
31
    height = st->codec->height;
32

  
33
    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
34
    if (packet_size < 0)
35
        return -1;
36

  
37
    ret= av_get_packet(s->pb, pkt, packet_size);
38
    pkt->pts=
39
    pkt->dts= pkt->pos / packet_size;
40

  
41
    pkt->stream_index = 0;
42
    if (ret < 0)
43
        return ret;
44
    return 0;
45
}
46

  
47
AVInputFormat rawvideo_demuxer = {
48
    "rawvideo",
49
    NULL_IF_CONFIG_SMALL("raw video format"),
50
    0,
51
    NULL,
52
    ff_raw_read_header,
53
    rawvideo_read_packet,
54
    .flags= AVFMT_GENERIC_INDEX,
55
    .extensions = "yuv,cif,qcif,rgb",
56
    .value = CODEC_ID_RAWVIDEO,
57
};

Also available in: Unified diff