annotate raw.c @ 122:013a7a0f2a1f libavformat

* keeping compiler happy and quiet
author kabi
date Wed, 23 Apr 2003 18:38:34 +0000
parents fa3ebf0d0270
children 7500e14259a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
2 * RAW encoder and decoder
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 * Copyright (c) 2001 Fabrice Bellard.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
5 * This library is free software; you can redistribute it and/or
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
6 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
7 * License as published by the Free Software Foundation; either
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * version 2 of the License, or (at your option) any later version.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
10 * This library is distributed in the hope that it will be useful,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * You should have received a copy of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 * License along with this library; if not, write to the Free Software
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
18 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
19 #include "avformat.h"
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21 /* simple formats */
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
22 static int raw_write_header(struct AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
25 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
26
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
27 static int raw_write_packet(struct AVFormatContext *s, int stream_index,
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
28 unsigned char *buf, int size, int force_pts)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30 put_buffer(&s->pb, buf, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
31 put_flush_packet(&s->pb);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
32 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
33 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
34
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
35 static int raw_write_trailer(struct AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40 /* raw input */
65
a58a8a53eb46 * UINTX -> uintx_t INTX -> intx_t
kabi
parents: 64
diff changeset
41 static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
43 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
44 int id;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
45
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
46 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
47 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
48 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
49 if (ap) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
50 id = s->iformat->value;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
51 if (id == CODEC_ID_RAWVIDEO) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
52 st->codec.codec_type = CODEC_TYPE_VIDEO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
53 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
54 st->codec.codec_type = CODEC_TYPE_AUDIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
55 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
56 st->codec.codec_id = id;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
57
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
58 switch(st->codec.codec_type) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
59 case CODEC_TYPE_AUDIO:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
60 st->codec.sample_rate = ap->sample_rate;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
61 st->codec.channels = ap->channels;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
62 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
63 case CODEC_TYPE_VIDEO:
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
64 st->codec.frame_rate = ap->frame_rate;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
65 st->codec.frame_rate_base = ap->frame_rate_base;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
66 st->codec.width = ap->width;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
67 st->codec.height = ap->height;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
68 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
69 default:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
70 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
71 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
72 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
73 return -1;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
74 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
75 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
76 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
77
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
78 #define RAW_PACKET_SIZE 1024
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
79
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
80 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
81 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
82 int ret, size;
28
64678c053566 removed warnings
bellard
parents: 0
diff changeset
83 // AVStream *st = s->streams[0];
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
84
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
85 size= RAW_PACKET_SIZE;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
86
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
87 if (av_new_packet(pkt, size) < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
88 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
89
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
90 pkt->stream_index = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
91 ret = get_buffer(&s->pb, pkt->data, size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
92 if (ret <= 0) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
93 av_free_packet(pkt);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
94 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
95 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
96 /* note: we need to modify the packet size here to handle the last
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
97 packet */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
98 pkt->size = ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
99 return ret;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
100 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
101
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
102 static int raw_read_close(AVFormatContext *s)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
103 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
104 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
105 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
106
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
107 /* mp3 read */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
108 static int mp3_read_header(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
109 AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
110 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
111 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
112
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
113 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
114 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
115 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
116
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
117 st->codec.codec_type = CODEC_TYPE_AUDIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
118 st->codec.codec_id = CODEC_ID_MP2;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
119 /* the parameters will be extracted from the compressed bitstream */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
120 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
121 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
122
63
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
123 /* ac3 read */
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
124 static int ac3_read_header(AVFormatContext *s,
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
125 AVFormatParameters *ap)
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
126 {
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
127 AVStream *st;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
128
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
129 st = av_new_stream(s, 0);
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
130 if (!st)
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
131 return AVERROR_NOMEM;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
132
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
133 st->codec.codec_type = CODEC_TYPE_AUDIO;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
134 st->codec.codec_id = CODEC_ID_AC3;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
135 /* the parameters will be extracted from the compressed bitstream */
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
136 return 0;
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
137 }
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
138
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
139 /* mpeg1/h263 input */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
140 static int video_read_header(AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
141 AVFormatParameters *ap)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
142 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
143 AVStream *st;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
144
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
145 st = av_new_stream(s, 0);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
146 if (!st)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
147 return AVERROR_NOMEM;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
148
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
149 st->codec.codec_type = CODEC_TYPE_VIDEO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
150 st->codec.codec_id = s->iformat->value;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
151 /* for mjpeg, specify frame rate */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
152 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
153 if (st->codec.codec_id == CODEC_ID_MJPEG || st->codec.codec_id == CODEC_ID_MPEG4) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
154 if (ap) {
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
155 st->codec.frame_rate = ap->frame_rate;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
156 st->codec.frame_rate_base = ap->frame_rate_base;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
157 } else {
85
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
158 st->codec.frame_rate = 25;
25062c9b1f86 per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents: 65
diff changeset
159 st->codec.frame_rate_base = 1;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
160 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
161 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
162 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
163 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
164
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
165 #define SEQ_START_CODE 0x000001b3
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
166 #define GOP_START_CODE 0x000001b8
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
167 #define PICTURE_START_CODE 0x00000100
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
168
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
169 /* XXX: improve that by looking at several start codes */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
170 static int mpegvideo_probe(AVProbeData *p)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
171 {
49
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
172 int code;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
173 const uint8_t *d;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
174
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
175 /* we search the first start code. If it is a sequence, gop or
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
176 picture start code then we decide it is an mpeg video
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
177 stream. We do not send highest value to give a chance to mpegts */
49
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
178 /* NOTE: the search range was restricted to avoid too many false
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
179 detections */
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
180
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
181 if (p->buf_size < 6)
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
182 return 0;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
183 d = p->buf;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
184 code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
185 if ((code & 0xffffff00) == 0x100) {
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
186 if (code == SEQ_START_CODE ||
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
187 code == GOP_START_CODE ||
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
188 code == PICTURE_START_CODE)
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
189 return 50 - 1;
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
190 else
3e7e13e08b27 avoid too many false detections
bellard
parents: 28
diff changeset
191 return 0;
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
192 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
193 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
194 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
195
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
196 AVInputFormat mp3_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
197 "mp3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
198 "MPEG audio",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
199 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
200 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
201 mp3_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
202 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
203 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
204 .extensions = "mp2,mp3", /* XXX: use probe */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
205 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
206
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
207 AVOutputFormat mp2_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
208 "mp2",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
209 "MPEG audio layer 2",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
210 "audio/x-mpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
211 "mp2,mp3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
212 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
213 CODEC_ID_MP2,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
214 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
215 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
216 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
217 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
218 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
219
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
220
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
221 AVInputFormat ac3_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
222 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
223 "raw ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
224 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
225 NULL,
63
8329ba7cbd01 raw ac3 auto detects parameters
bellard
parents: 49
diff changeset
226 ac3_read_header,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
227 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
228 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
229 .extensions = "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
230 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
231
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
232 AVOutputFormat ac3_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
233 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
234 "raw ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
235 "audio/x-ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
236 "ac3",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
237 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
238 CODEC_ID_AC3,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
239 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
240 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
241 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
242 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
243 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
244
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
245 AVOutputFormat h263_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
246 "h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
247 "raw h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
248 "video/x-h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
249 "h263",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
250 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
251 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
252 CODEC_ID_H263,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
253 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
254 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
255 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
256 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
257
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
258 AVInputFormat m4v_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
259 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
260 "raw MPEG4 video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
261 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
262 NULL /*mpegvideo_probe*/,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
263 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
264 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
265 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
266 .extensions = "m4v", //FIXME remove after writing mpeg4_probe
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
267 .value = CODEC_ID_MPEG4,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
268 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
269
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
270 AVOutputFormat m4v_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
271 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
272 "raw MPEG4 video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
273 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
274 "m4v",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
275 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
276 CODEC_ID_NONE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
277 CODEC_ID_MPEG4,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
278 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
279 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
280 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
281 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
282
100
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
283 AVInputFormat h264_iformat = {
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
284 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
285 "raw H264 video format",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
286 0,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
287 NULL /*mpegvideo_probe*/,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
288 video_read_header,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
289 raw_read_packet,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
290 raw_read_close,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
291 .extensions = "h26l,h264", //FIXME remove after writing mpeg4_probe
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
292 .value = CODEC_ID_H264,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
293 };
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
294
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
295 AVOutputFormat h264_oformat = {
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
296 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
297 "raw H264 video format",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
298 NULL,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
299 "h264",
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
300 0,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
301 CODEC_ID_NONE,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
302 CODEC_ID_H264,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
303 raw_write_header,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
304 raw_write_packet,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
305 raw_write_trailer,
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
306 };
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
307
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
308 AVInputFormat mpegvideo_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
309 "mpegvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
310 "MPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
311 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
312 mpegvideo_probe,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
313 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
314 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
315 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
316 .value = CODEC_ID_MPEG1VIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
317 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
318
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
319 AVOutputFormat mpeg1video_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
320 "mpeg1video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
321 "MPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
322 "video/x-mpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
323 "mpg,mpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
324 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
325 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
326 CODEC_ID_MPEG1VIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
327 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
328 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
329 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
330 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
331
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
332 AVInputFormat mjpeg_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
333 "mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
334 "MJPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
335 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
336 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
337 video_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
338 raw_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
339 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
340 .extensions = "mjpg,mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
341 .value = CODEC_ID_MJPEG,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
342 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
343
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
344 AVOutputFormat mjpeg_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
345 "mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
346 "MJPEG video",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
347 "video/x-mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
348 "mjpg,mjpeg",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
349 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
350 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
351 CODEC_ID_MJPEG,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
352 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
353 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
354 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
355 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
356
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
357 /* pcm formats */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
358
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
359 #define PCMDEF(name, long_name, ext, codec) \
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
360 AVInputFormat pcm_ ## name ## _iformat = {\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
361 #name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
362 long_name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
363 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
364 NULL,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
365 raw_read_header,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
366 raw_read_packet,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
367 raw_read_close,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
368 .extensions = ext,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
369 .value = codec,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
370 };\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
371 \
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
372 AVOutputFormat pcm_ ## name ## _oformat = {\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
373 #name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
374 long_name,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
375 NULL,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
376 ext,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
377 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
378 codec,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
379 0,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
380 raw_write_header,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
381 raw_write_packet,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
382 raw_write_trailer,\
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
383 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
384
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
385 #ifdef WORDS_BIGENDIAN
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
386 #define BE_DEF(s) s
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
387 #define LE_DEF(s) NULL
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
388 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
389 #define BE_DEF(s) NULL
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
390 #define LE_DEF(s) s
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
391 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
392
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
393
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
394 PCMDEF(s16le, "pcm signed 16 bit little endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
395 LE_DEF("sw"), CODEC_ID_PCM_S16LE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
396
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
397 PCMDEF(s16be, "pcm signed 16 bit big endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
398 BE_DEF("sw"), CODEC_ID_PCM_S16BE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
399
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
400 PCMDEF(u16le, "pcm unsigned 16 bit little endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
401 LE_DEF("uw"), CODEC_ID_PCM_U16LE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
402
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
403 PCMDEF(u16be, "pcm unsigned 16 bit big endian format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
404 BE_DEF("uw"), CODEC_ID_PCM_U16BE)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
405
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
406 PCMDEF(s8, "pcm signed 8 bit format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
407 "sb", CODEC_ID_PCM_S8)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
408
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
409 PCMDEF(u8, "pcm unsigned 8 bit format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
410 "ub", CODEC_ID_PCM_U8)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
411
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
412 PCMDEF(mulaw, "pcm mu law format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
413 "ul", CODEC_ID_PCM_MULAW)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
414
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
415 PCMDEF(alaw, "pcm A law format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
416 "al", CODEC_ID_PCM_ALAW)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
417
64
b0e0eb595e29 * static,const,compiler warning cleanup
kabi
parents: 63
diff changeset
418 static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
419 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
420 int packet_size, ret, width, height;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
421 AVStream *st = s->streams[0];
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
422
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
423 width = st->codec.width;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
424 height = st->codec.height;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
425
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
426 switch(st->codec.pix_fmt) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
427 case PIX_FMT_YUV420P:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
428 packet_size = (width * height * 3) / 2;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
429 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
430 case PIX_FMT_YUV422:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
431 packet_size = (width * height * 2);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
432 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
433 case PIX_FMT_BGR24:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
434 case PIX_FMT_RGB24:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
435 packet_size = (width * height * 3);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
436 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
437 default:
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
438 av_abort();
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
439 break;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
440 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
441
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
442 if (av_new_packet(pkt, packet_size) < 0)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
443 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
444
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
445 pkt->stream_index = 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
446 #if 0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
447 /* bypass buffered I/O */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
448 ret = url_read(url_fileno(&s->pb), pkt->data, pkt->size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
449 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
450 ret = get_buffer(&s->pb, pkt->data, pkt->size);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
451 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
452 if (ret != pkt->size) {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
453 av_free_packet(pkt);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
454 return -EIO;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
455 } else {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
456 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
457 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
458 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
459
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
460 AVInputFormat rawvideo_iformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
461 "rawvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
462 "raw video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
463 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
464 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
465 raw_read_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
466 rawvideo_read_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
467 raw_read_close,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
468 .extensions = "yuv",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
469 .value = CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
470 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
471
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
472 AVOutputFormat rawvideo_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
473 "rawvideo",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
474 "raw video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
475 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
476 "yuv",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
477 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
478 CODEC_ID_NONE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
479 CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
480 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
481 raw_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
482 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
483 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
484
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
485 static int null_write_packet(struct AVFormatContext *s,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
486 int stream_index,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
487 unsigned char *buf, int size, int force_pts)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
488 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
489 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
490 }
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
491
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
492 AVOutputFormat null_oformat = {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
493 "null",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
494 "null video format",
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
495 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
496 NULL,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
497 0,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
498 #ifdef WORDS_BIGENDIAN
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
499 CODEC_ID_PCM_S16BE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
500 #else
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
501 CODEC_ID_PCM_S16LE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
502 #endif
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
503 CODEC_ID_RAWVIDEO,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
504 raw_write_header,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
505 null_write_packet,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
506 raw_write_trailer,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
507 .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE,
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
508 };
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
509
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
510 int raw_init(void)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
511 {
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
512 av_register_input_format(&mp3_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
513 av_register_output_format(&mp2_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
514
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
515 av_register_input_format(&ac3_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
516 av_register_output_format(&ac3_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
517
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
518 av_register_output_format(&h263_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
519
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
520 av_register_input_format(&m4v_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
521 av_register_output_format(&m4v_oformat);
100
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
522
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
523 av_register_input_format(&h264_iformat);
fa3ebf0d0270 H264 decoder & demuxer
michaelni
parents: 85
diff changeset
524 av_register_output_format(&h264_oformat);
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
525
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
526 av_register_input_format(&mpegvideo_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
527 av_register_output_format(&mpeg1video_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
528
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
529 av_register_input_format(&mjpeg_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
530 av_register_output_format(&mjpeg_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
531
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
532 av_register_input_format(&pcm_s16le_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
533 av_register_output_format(&pcm_s16le_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
534 av_register_input_format(&pcm_s16be_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
535 av_register_output_format(&pcm_s16be_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
536 av_register_input_format(&pcm_u16le_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
537 av_register_output_format(&pcm_u16le_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
538 av_register_input_format(&pcm_u16be_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
539 av_register_output_format(&pcm_u16be_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
540 av_register_input_format(&pcm_s8_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
541 av_register_output_format(&pcm_s8_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
542 av_register_input_format(&pcm_u8_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
543 av_register_output_format(&pcm_u8_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
544 av_register_input_format(&pcm_mulaw_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
545 av_register_output_format(&pcm_mulaw_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
546 av_register_input_format(&pcm_alaw_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
547 av_register_output_format(&pcm_alaw_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
548
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
549 av_register_input_format(&rawvideo_iformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
550 av_register_output_format(&rawvideo_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
551
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
552 av_register_output_format(&null_oformat);
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
553 return 0;
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
554 }