Mercurial > libavformat.hg
annotate raw.c @ 690:fec605ce7d4a libavformat
mp4a fix based on some code by (Song.Itany inventec-inc com)
author | michael |
---|---|
date | Fri, 04 Mar 2005 00:30:18 +0000 |
parents | e2687b784c3a |
children | af4e24d6310c |
rev | line source |
---|---|
0 | 1 /* |
2 * RAW encoder and decoder | |
3 * Copyright (c) 2001 Fabrice Bellard. | |
4 * | |
5 * This library is free software; you can redistribute it and/or | |
6 * modify it under the terms of the GNU Lesser General Public | |
7 * License as published by the Free Software Foundation; either | |
8 * version 2 of the License, or (at your option) any later version. | |
9 * | |
10 * This library is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 * Lesser General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Lesser General Public | |
16 * License along with this library; if not, write to the Free Software | |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 */ | |
19 #include "avformat.h" | |
20 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
21 #ifdef CONFIG_ENCODERS |
0 | 22 /* simple formats */ |
64 | 23 static int raw_write_header(struct AVFormatContext *s) |
0 | 24 { |
25 return 0; | |
26 } | |
27 | |
468 | 28 static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt) |
0 | 29 { |
468 | 30 put_buffer(&s->pb, pkt->data, pkt->size); |
0 | 31 put_flush_packet(&s->pb); |
32 return 0; | |
33 } | |
34 | |
64 | 35 static int raw_write_trailer(struct AVFormatContext *s) |
0 | 36 { |
37 return 0; | |
38 } | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
39 #endif //CONFIG_ENCODERS |
0 | 40 |
41 /* raw input */ | |
65 | 42 static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap) |
0 | 43 { |
44 AVStream *st; | |
45 int id; | |
46 | |
47 st = av_new_stream(s, 0); | |
48 if (!st) | |
49 return AVERROR_NOMEM; | |
50 if (ap) { | |
51 id = s->iformat->value; | |
52 if (id == CODEC_ID_RAWVIDEO) { | |
53 st->codec.codec_type = CODEC_TYPE_VIDEO; | |
54 } else { | |
55 st->codec.codec_type = CODEC_TYPE_AUDIO; | |
56 } | |
57 st->codec.codec_id = id; | |
58 | |
59 switch(st->codec.codec_type) { | |
60 case CODEC_TYPE_AUDIO: | |
61 st->codec.sample_rate = ap->sample_rate; | |
62 st->codec.channels = ap->channels; | |
567 | 63 av_set_pts_info(st, 64, 1, st->codec.sample_rate); |
0 | 64 break; |
65 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
|
66 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
|
67 st->codec.frame_rate_base = ap->frame_rate_base; |
0 | 68 st->codec.width = ap->width; |
69 st->codec.height = ap->height; | |
128 | 70 st->codec.pix_fmt = ap->pix_fmt; |
0 | 71 break; |
72 default: | |
73 return -1; | |
74 } | |
75 } else { | |
76 return -1; | |
77 } | |
78 return 0; | |
79 } | |
80 | |
81 #define RAW_PACKET_SIZE 1024 | |
82 | |
64 | 83 static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) |
0 | 84 { |
85 int ret, size; | |
28 | 86 // AVStream *st = s->streams[0]; |
0 | 87 |
88 size= RAW_PACKET_SIZE; | |
89 | |
90 if (av_new_packet(pkt, size) < 0) | |
482 | 91 return AVERROR_IO; |
0 | 92 |
93 pkt->stream_index = 0; | |
94 ret = get_buffer(&s->pb, pkt->data, size); | |
95 if (ret <= 0) { | |
96 av_free_packet(pkt); | |
482 | 97 return AVERROR_IO; |
0 | 98 } |
99 /* note: we need to modify the packet size here to handle the last | |
100 packet */ | |
101 pkt->size = ret; | |
102 return ret; | |
103 } | |
104 | |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
105 static int raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
106 { |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
107 int ret, size; |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
108 |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
109 size = RAW_PACKET_SIZE; |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
110 |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
111 if (av_new_packet(pkt, size) < 0) |
482 | 112 return AVERROR_IO; |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
113 |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
114 pkt->stream_index = 0; |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
115 ret = get_partial_buffer(&s->pb, pkt->data, size); |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
116 if (ret <= 0) { |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
117 av_free_packet(pkt); |
482 | 118 return AVERROR_IO; |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
119 } |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
120 pkt->size = ret; |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
121 return ret; |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
122 } |
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
123 |
64 | 124 static int raw_read_close(AVFormatContext *s) |
0 | 125 { |
126 return 0; | |
127 } | |
128 | |
306 | 129 int pcm_read_seek(AVFormatContext *s, |
558 | 130 int stream_index, int64_t timestamp, int flags) |
306 | 131 { |
132 AVStream *st; | |
133 int block_align, byte_rate; | |
134 int64_t pos; | |
135 | |
136 st = s->streams[0]; | |
137 switch(st->codec.codec_id) { | |
138 case CODEC_ID_PCM_S16LE: | |
139 case CODEC_ID_PCM_S16BE: | |
140 case CODEC_ID_PCM_U16LE: | |
141 case CODEC_ID_PCM_U16BE: | |
142 block_align = 2 * st->codec.channels; | |
143 byte_rate = block_align * st->codec.sample_rate; | |
144 break; | |
145 case CODEC_ID_PCM_S8: | |
146 case CODEC_ID_PCM_U8: | |
147 case CODEC_ID_PCM_MULAW: | |
148 case CODEC_ID_PCM_ALAW: | |
149 block_align = st->codec.channels; | |
150 byte_rate = block_align * st->codec.sample_rate; | |
151 break; | |
152 default: | |
153 block_align = st->codec.block_align; | |
154 byte_rate = st->codec.bit_rate / 8; | |
155 break; | |
156 } | |
157 | |
158 if (block_align <= 0 || byte_rate <= 0) | |
159 return -1; | |
160 | |
161 /* compute the position by aligning it to block_align */ | |
558 | 162 pos = av_rescale_rnd(timestamp * byte_rate, |
163 st->time_base.num, | |
164 st->time_base.den * (int64_t)block_align, | |
165 (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); | |
166 pos *= block_align; | |
306 | 167 |
168 /* recompute exact position */ | |
464 | 169 st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); |
306 | 170 url_fseek(&s->pb, pos + s->data_offset, SEEK_SET); |
171 return 0; | |
172 } | |
173 | |
63 | 174 /* ac3 read */ |
175 static int ac3_read_header(AVFormatContext *s, | |
176 AVFormatParameters *ap) | |
177 { | |
178 AVStream *st; | |
179 | |
180 st = av_new_stream(s, 0); | |
181 if (!st) | |
182 return AVERROR_NOMEM; | |
183 | |
184 st->codec.codec_type = CODEC_TYPE_AUDIO; | |
185 st->codec.codec_id = CODEC_ID_AC3; | |
306 | 186 st->need_parsing = 1; |
63 | 187 /* the parameters will be extracted from the compressed bitstream */ |
188 return 0; | |
189 } | |
190 | |
686
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
191 static int shorten_read_header(AVFormatContext *s, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
192 AVFormatParameters *ap) |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
193 { |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
194 AVStream *st; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
195 |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
196 st = av_new_stream(s, 0); |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
197 if (!st) |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
198 return AVERROR_NOMEM; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
199 st->codec.codec_type = CODEC_TYPE_AUDIO; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
200 st->codec.codec_id = CODEC_ID_SHORTEN; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
201 st->need_parsing = 1; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
202 /* the parameters will be extracted from the compressed bitstream */ |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
203 return 0; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
204 } |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
205 |
496
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
206 /* dts read */ |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
207 static int dts_read_header(AVFormatContext *s, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
208 AVFormatParameters *ap) |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
209 { |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
210 AVStream *st; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
211 |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
212 st = av_new_stream(s, 0); |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
213 if (!st) |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
214 return AVERROR_NOMEM; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
215 |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
216 st->codec.codec_type = CODEC_TYPE_AUDIO; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
217 st->codec.codec_id = CODEC_ID_DTS; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
218 st->need_parsing = 1; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
219 /* the parameters will be extracted from the compressed bitstream */ |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
220 return 0; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
221 } |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
222 |
0 | 223 /* mpeg1/h263 input */ |
224 static int video_read_header(AVFormatContext *s, | |
225 AVFormatParameters *ap) | |
226 { | |
227 AVStream *st; | |
228 | |
229 st = av_new_stream(s, 0); | |
230 if (!st) | |
231 return AVERROR_NOMEM; | |
232 | |
233 st->codec.codec_type = CODEC_TYPE_VIDEO; | |
234 st->codec.codec_id = s->iformat->value; | |
306 | 235 st->need_parsing = 1; |
236 | |
0 | 237 /* for mjpeg, specify frame rate */ |
238 /* for mpeg4 specify it too (most mpeg4 streams dont have the fixed_vop_rate set ...)*/ | |
306 | 239 if (st->codec.codec_id == CODEC_ID_MJPEG || |
240 st->codec.codec_id == CODEC_ID_MPEG4) { | |
241 if (ap && ap->frame_rate) { | |
85
25062c9b1f86
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
65
diff
changeset
|
242 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
|
243 st->codec.frame_rate_base = ap->frame_rate_base; |
0 | 244 } else { |
85
25062c9b1f86
per context frame_rate_base, this should finally fix frame_rate related av sync issues
michaelni
parents:
65
diff
changeset
|
245 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
|
246 st->codec.frame_rate_base = 1; |
0 | 247 } |
248 } | |
249 return 0; | |
250 } | |
251 | |
252 #define SEQ_START_CODE 0x000001b3 | |
253 #define GOP_START_CODE 0x000001b8 | |
254 #define PICTURE_START_CODE 0x00000100 | |
255 | |
256 /* XXX: improve that by looking at several start codes */ | |
257 static int mpegvideo_probe(AVProbeData *p) | |
258 { | |
49 | 259 int code; |
260 const uint8_t *d; | |
0 | 261 |
262 /* we search the first start code. If it is a sequence, gop or | |
263 picture start code then we decide it is an mpeg video | |
264 stream. We do not send highest value to give a chance to mpegts */ | |
49 | 265 /* NOTE: the search range was restricted to avoid too many false |
266 detections */ | |
267 | |
268 if (p->buf_size < 6) | |
269 return 0; | |
270 d = p->buf; | |
271 code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]); | |
272 if ((code & 0xffffff00) == 0x100) { | |
273 if (code == SEQ_START_CODE || | |
274 code == GOP_START_CODE || | |
275 code == PICTURE_START_CODE) | |
276 return 50 - 1; | |
277 else | |
278 return 0; | |
0 | 279 } |
280 return 0; | |
281 } | |
282 | |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
283 static int h263_probe(AVProbeData *p) |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
284 { |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
285 int code; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
286 const uint8_t *d; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
287 |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
288 if (p->buf_size < 6) |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
289 return 0; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
290 d = p->buf; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
291 code = (d[0] << 14) | (d[1] << 6) | (d[2] >> 2); |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
292 if (code == 0x20) { |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
293 return 50; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
294 } |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
295 return 0; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
296 } |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
297 |
473
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
298 static int h261_probe(AVProbeData *p) |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
299 { |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
300 int code; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
301 const uint8_t *d; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
302 |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
303 if (p->buf_size < 6) |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
304 return 0; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
305 d = p->buf; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
306 code = (d[0] << 12) | (d[1] << 4) | (d[2] >> 4); |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
307 if (code == 0x10) { |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
308 return 50; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
309 } |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
310 return 0; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
311 } |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
312 |
686
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
313 AVInputFormat shorten_iformat = { |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
314 "shn", |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
315 "raw shn", |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
316 0, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
317 NULL, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
318 shorten_read_header, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
319 raw_read_partial_packet, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
320 raw_read_close, |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
321 .extensions = "shn", |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
322 }; |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
323 |
0 | 324 AVInputFormat ac3_iformat = { |
325 "ac3", | |
326 "raw ac3", | |
327 0, | |
328 NULL, | |
63 | 329 ac3_read_header, |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
330 raw_read_partial_packet, |
0 | 331 raw_read_close, |
332 .extensions = "ac3", | |
333 }; | |
334 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
335 #ifdef CONFIG_ENCODERS |
0 | 336 AVOutputFormat ac3_oformat = { |
337 "ac3", | |
338 "raw ac3", | |
339 "audio/x-ac3", | |
340 "ac3", | |
341 0, | |
342 CODEC_ID_AC3, | |
343 0, | |
344 raw_write_header, | |
345 raw_write_packet, | |
346 raw_write_trailer, | |
347 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
348 #endif //CONFIG_ENCODERS |
0 | 349 |
496
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
350 AVInputFormat dts_iformat = { |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
351 "dts", |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
352 "raw dts", |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
353 0, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
354 NULL, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
355 dts_read_header, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
356 raw_read_partial_packet, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
357 raw_read_close, |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
358 .extensions = "dts", |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
359 }; |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
360 |
473
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
361 AVInputFormat h261_iformat = { |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
362 "h261", |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
363 "raw h261", |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
364 0, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
365 h261_probe, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
366 video_read_header, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
367 raw_read_partial_packet, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
368 raw_read_close, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
369 .extensions = "h261", |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
370 .value = CODEC_ID_H261, |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
371 }; |
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
372 |
576
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
373 #ifdef CONFIG_ENCODERS |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
374 AVOutputFormat h261_oformat = { |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
375 "h261", |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
376 "raw h261", |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
377 "video/x-h261", |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
378 "h261", |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
379 0, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
380 0, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
381 CODEC_ID_H261, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
382 raw_write_header, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
383 raw_write_packet, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
384 raw_write_trailer, |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
385 }; |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
386 #endif //CONFIG_ENCODERS |
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
387 |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
388 AVInputFormat h263_iformat = { |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
389 "h263", |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
390 "raw h263", |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
391 0, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
392 h263_probe, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
393 video_read_header, |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
394 raw_read_partial_packet, |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
395 raw_read_close, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
396 // .extensions = "h263", //FIXME remove after writing mpeg4_probe |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
397 .value = CODEC_ID_H263, |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
398 }; |
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
399 |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
400 #ifdef CONFIG_ENCODERS |
0 | 401 AVOutputFormat h263_oformat = { |
402 "h263", | |
403 "raw h263", | |
404 "video/x-h263", | |
405 "h263", | |
406 0, | |
407 0, | |
408 CODEC_ID_H263, | |
409 raw_write_header, | |
410 raw_write_packet, | |
411 raw_write_trailer, | |
412 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
413 #endif //CONFIG_ENCODERS |
0 | 414 |
415 AVInputFormat m4v_iformat = { | |
416 "m4v", | |
417 "raw MPEG4 video format", | |
418 0, | |
419 NULL /*mpegvideo_probe*/, | |
420 video_read_header, | |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
421 raw_read_partial_packet, |
0 | 422 raw_read_close, |
423 .extensions = "m4v", //FIXME remove after writing mpeg4_probe | |
424 .value = CODEC_ID_MPEG4, | |
425 }; | |
426 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
427 #ifdef CONFIG_ENCODERS |
0 | 428 AVOutputFormat m4v_oformat = { |
429 "m4v", | |
430 "raw MPEG4 video format", | |
431 NULL, | |
432 "m4v", | |
433 0, | |
434 CODEC_ID_NONE, | |
435 CODEC_ID_MPEG4, | |
436 raw_write_header, | |
437 raw_write_packet, | |
438 raw_write_trailer, | |
439 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
440 #endif //CONFIG_ENCODERS |
0 | 441 |
100 | 442 AVInputFormat h264_iformat = { |
443 "h264", | |
444 "raw H264 video format", | |
445 0, | |
446 NULL /*mpegvideo_probe*/, | |
447 video_read_header, | |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
448 raw_read_partial_packet, |
100 | 449 raw_read_close, |
450 .extensions = "h26l,h264", //FIXME remove after writing mpeg4_probe | |
451 .value = CODEC_ID_H264, | |
452 }; | |
453 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
454 #ifdef CONFIG_ENCODERS |
100 | 455 AVOutputFormat h264_oformat = { |
456 "h264", | |
457 "raw H264 video format", | |
458 NULL, | |
459 "h264", | |
460 0, | |
461 CODEC_ID_NONE, | |
462 CODEC_ID_H264, | |
463 raw_write_header, | |
464 raw_write_packet, | |
465 raw_write_trailer, | |
466 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
467 #endif //CONFIG_ENCODERS |
100 | 468 |
0 | 469 AVInputFormat mpegvideo_iformat = { |
470 "mpegvideo", | |
471 "MPEG video", | |
472 0, | |
473 mpegvideo_probe, | |
474 video_read_header, | |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
475 raw_read_partial_packet, |
0 | 476 raw_read_close, |
477 .value = CODEC_ID_MPEG1VIDEO, | |
478 }; | |
479 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
480 #ifdef CONFIG_ENCODERS |
0 | 481 AVOutputFormat mpeg1video_oformat = { |
482 "mpeg1video", | |
483 "MPEG video", | |
484 "video/x-mpeg", | |
485 "mpg,mpeg", | |
486 0, | |
487 0, | |
488 CODEC_ID_MPEG1VIDEO, | |
489 raw_write_header, | |
490 raw_write_packet, | |
491 raw_write_trailer, | |
492 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
493 #endif //CONFIG_ENCODERS |
0 | 494 |
637
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
495 #ifdef CONFIG_ENCODERS |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
496 AVOutputFormat mpeg2video_oformat = { |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
497 "mpeg2video", |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
498 "MPEG2 video", |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
499 NULL, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
500 "m2v", |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
501 0, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
502 0, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
503 CODEC_ID_MPEG2VIDEO, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
504 raw_write_header, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
505 raw_write_packet, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
506 raw_write_trailer, |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
507 }; |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
508 #endif //CONFIG_ENCODERS |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
509 |
0 | 510 AVInputFormat mjpeg_iformat = { |
511 "mjpeg", | |
512 "MJPEG video", | |
513 0, | |
514 NULL, | |
515 video_read_header, | |
389
e14fcd57ad2f
decode latency patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>)
michael
parents:
306
diff
changeset
|
516 raw_read_partial_packet, |
0 | 517 raw_read_close, |
518 .extensions = "mjpg,mjpeg", | |
519 .value = CODEC_ID_MJPEG, | |
520 }; | |
521 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
522 #ifdef CONFIG_ENCODERS |
0 | 523 AVOutputFormat mjpeg_oformat = { |
524 "mjpeg", | |
525 "MJPEG video", | |
526 "video/x-mjpeg", | |
527 "mjpg,mjpeg", | |
528 0, | |
529 0, | |
530 CODEC_ID_MJPEG, | |
531 raw_write_header, | |
532 raw_write_packet, | |
533 raw_write_trailer, | |
534 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
535 #endif //CONFIG_ENCODERS |
0 | 536 |
537 /* pcm formats */ | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
538 |
306 | 539 #define PCMINPUTDEF(name, long_name, ext, codec) \ |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
540 AVInputFormat pcm_ ## name ## _iformat = {\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
541 #name,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
542 long_name,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
543 0,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
544 NULL,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
545 raw_read_header,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
546 raw_read_packet,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
547 raw_read_close,\ |
306 | 548 pcm_read_seek,\ |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
549 .extensions = ext,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
550 .value = codec,\ |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
551 }; |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
552 |
306 | 553 #if !defined(CONFIG_ENCODERS) && defined(CONFIG_DECODERS) |
554 | |
555 #define PCMDEF(name, long_name, ext, codec) \ | |
556 PCMINPUTDEF(name, long_name, ext, codec) | |
557 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
558 #else |
0 | 559 |
560 #define PCMDEF(name, long_name, ext, codec) \ | |
306 | 561 PCMINPUTDEF(name, long_name, ext, codec)\ |
0 | 562 \ |
563 AVOutputFormat pcm_ ## name ## _oformat = {\ | |
564 #name,\ | |
565 long_name,\ | |
566 NULL,\ | |
567 ext,\ | |
568 0,\ | |
569 codec,\ | |
570 0,\ | |
571 raw_write_header,\ | |
572 raw_write_packet,\ | |
573 raw_write_trailer,\ | |
574 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
575 #endif //CONFIG_ENCODERS |
0 | 576 |
577 #ifdef WORDS_BIGENDIAN | |
578 #define BE_DEF(s) s | |
579 #define LE_DEF(s) NULL | |
580 #else | |
581 #define BE_DEF(s) NULL | |
582 #define LE_DEF(s) s | |
583 #endif | |
584 | |
585 | |
586 PCMDEF(s16le, "pcm signed 16 bit little endian format", | |
587 LE_DEF("sw"), CODEC_ID_PCM_S16LE) | |
588 | |
589 PCMDEF(s16be, "pcm signed 16 bit big endian format", | |
590 BE_DEF("sw"), CODEC_ID_PCM_S16BE) | |
591 | |
592 PCMDEF(u16le, "pcm unsigned 16 bit little endian format", | |
593 LE_DEF("uw"), CODEC_ID_PCM_U16LE) | |
594 | |
595 PCMDEF(u16be, "pcm unsigned 16 bit big endian format", | |
596 BE_DEF("uw"), CODEC_ID_PCM_U16BE) | |
597 | |
598 PCMDEF(s8, "pcm signed 8 bit format", | |
599 "sb", CODEC_ID_PCM_S8) | |
600 | |
601 PCMDEF(u8, "pcm unsigned 8 bit format", | |
602 "ub", CODEC_ID_PCM_U8) | |
603 | |
604 PCMDEF(mulaw, "pcm mu law format", | |
605 "ul", CODEC_ID_PCM_MULAW) | |
606 | |
607 PCMDEF(alaw, "pcm A law format", | |
608 "al", CODEC_ID_PCM_ALAW) | |
609 | |
64 | 610 static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) |
0 | 611 { |
612 int packet_size, ret, width, height; | |
613 AVStream *st = s->streams[0]; | |
614 | |
615 width = st->codec.width; | |
616 height = st->codec.height; | |
617 | |
128 | 618 packet_size = avpicture_get_size(st->codec.pix_fmt, width, height); |
619 if (packet_size < 0) | |
537 | 620 return -1; |
0 | 621 |
622 if (av_new_packet(pkt, packet_size) < 0) | |
482 | 623 return AVERROR_IO; |
0 | 624 |
625 pkt->stream_index = 0; | |
626 #if 0 | |
627 /* bypass buffered I/O */ | |
628 ret = url_read(url_fileno(&s->pb), pkt->data, pkt->size); | |
629 #else | |
630 ret = get_buffer(&s->pb, pkt->data, pkt->size); | |
631 #endif | |
632 if (ret != pkt->size) { | |
633 av_free_packet(pkt); | |
482 | 634 return AVERROR_IO; |
0 | 635 } else { |
636 return 0; | |
637 } | |
638 } | |
639 | |
640 AVInputFormat rawvideo_iformat = { | |
641 "rawvideo", | |
642 "raw video format", | |
643 0, | |
644 NULL, | |
645 raw_read_header, | |
646 rawvideo_read_packet, | |
647 raw_read_close, | |
648 .extensions = "yuv", | |
649 .value = CODEC_ID_RAWVIDEO, | |
650 }; | |
651 | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
652 #ifdef CONFIG_ENCODERS |
0 | 653 AVOutputFormat rawvideo_oformat = { |
654 "rawvideo", | |
655 "raw video format", | |
656 NULL, | |
657 "yuv", | |
658 0, | |
659 CODEC_ID_NONE, | |
660 CODEC_ID_RAWVIDEO, | |
661 raw_write_header, | |
662 raw_write_packet, | |
663 raw_write_trailer, | |
664 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
665 #endif //CONFIG_ENCODERS |
0 | 666 |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
667 #ifdef CONFIG_ENCODERS |
468 | 668 static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt) |
0 | 669 { |
670 return 0; | |
671 } | |
672 | |
673 AVOutputFormat null_oformat = { | |
674 "null", | |
675 "null video format", | |
676 NULL, | |
677 NULL, | |
678 0, | |
679 #ifdef WORDS_BIGENDIAN | |
680 CODEC_ID_PCM_S16BE, | |
681 #else | |
682 CODEC_ID_PCM_S16LE, | |
683 #endif | |
684 CODEC_ID_RAWVIDEO, | |
685 raw_write_header, | |
686 null_write_packet, | |
687 raw_write_trailer, | |
688 .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE, | |
689 }; | |
277
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
690 #endif //CONFIG_ENCODERS |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
691 |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
692 #ifndef CONFIG_ENCODERS |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
693 #define av_register_output_format(format) |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
694 #endif |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
695 #ifndef CONFIG_DECODERS |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
696 #define av_register_input_format(format) |
a313e1080322
disable encoders where appropriate (patch courtesy of BERO
melanson
parents:
241
diff
changeset
|
697 #endif |
0 | 698 |
699 int raw_init(void) | |
700 { | |
686
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
701 |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
702 av_register_input_format(&shorten_iformat); |
e2687b784c3a
shorten decoder by (Jeff Muizelaar <jrmuizel gmail com>)
michael
parents:
637
diff
changeset
|
703 |
0 | 704 av_register_input_format(&ac3_iformat); |
705 av_register_output_format(&ac3_oformat); | |
706 | |
496
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
707 av_register_input_format(&dts_iformat); |
112057e05179
libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents:
483
diff
changeset
|
708 |
473
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
709 av_register_input_format(&h261_iformat); |
576
f701ba509d0c
H.261 encoder by (Maarten Daniels <maarten dot daniels at luc dot ac dot be>)
michael
parents:
567
diff
changeset
|
710 av_register_output_format(&h261_oformat); |
473
e0a66a870b7f
h261 decoder by (Maarten Daniels <maarten.daniels at student dot luc dot ac dot be>)
michael
parents:
468
diff
changeset
|
711 |
135
56590088f801
truncated h263 decoding support / H263-ES "demuxer"
michaelni
parents:
128
diff
changeset
|
712 av_register_input_format(&h263_iformat); |
0 | 713 av_register_output_format(&h263_oformat); |
714 | |
715 av_register_input_format(&m4v_iformat); | |
716 av_register_output_format(&m4v_oformat); | |
100 | 717 |
718 av_register_input_format(&h264_iformat); | |
719 av_register_output_format(&h264_oformat); | |
0 | 720 |
721 av_register_input_format(&mpegvideo_iformat); | |
722 av_register_output_format(&mpeg1video_oformat); | |
723 | |
637
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
724 av_register_output_format(&mpeg2video_oformat); |
76e36d97a27a
Patch for creating m2v files by (Fabrizio Gennari <fabrizio.ge tiscali it)
michael
parents:
576
diff
changeset
|
725 |
0 | 726 av_register_input_format(&mjpeg_iformat); |
727 av_register_output_format(&mjpeg_oformat); | |
728 | |
729 av_register_input_format(&pcm_s16le_iformat); | |
730 av_register_output_format(&pcm_s16le_oformat); | |
731 av_register_input_format(&pcm_s16be_iformat); | |
732 av_register_output_format(&pcm_s16be_oformat); | |
733 av_register_input_format(&pcm_u16le_iformat); | |
734 av_register_output_format(&pcm_u16le_oformat); | |
735 av_register_input_format(&pcm_u16be_iformat); | |
736 av_register_output_format(&pcm_u16be_oformat); | |
737 av_register_input_format(&pcm_s8_iformat); | |
738 av_register_output_format(&pcm_s8_oformat); | |
739 av_register_input_format(&pcm_u8_iformat); | |
740 av_register_output_format(&pcm_u8_oformat); | |
741 av_register_input_format(&pcm_mulaw_iformat); | |
742 av_register_output_format(&pcm_mulaw_oformat); | |
743 av_register_input_format(&pcm_alaw_iformat); | |
744 av_register_output_format(&pcm_alaw_oformat); | |
745 | |
746 av_register_input_format(&rawvideo_iformat); | |
747 av_register_output_format(&rawvideo_oformat); | |
748 | |
749 av_register_output_format(&null_oformat); | |
750 return 0; | |
751 } |