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