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