Statistics
| Branch: | Revision:

ffmpeg / libavformat / raw.c @ b68a7679

History | View | Annotate | Download (32.6 KB)

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

    
23
#include "libavutil/crc.h"
24
#include "libavcodec/ac3_parser.h"
25
#include "libavcodec/get_bits.h"
26
#include "libavcodec/bytestream.h"
27
#include "avformat.h"
28
#include "raw.h"
29
#include "id3v2.h"
30
#include "id3v1.h"
31

    
32
/* simple formats */
33

    
34
#if CONFIG_ROQ_MUXER
35
static int roq_write_header(struct AVFormatContext *s)
36
{
37
    static const uint8_t header[] = {
38
        0x84, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x1E, 0x00
39
    };
40

    
41
    put_buffer(s->pb, header, 8);
42
    put_flush_packet(s->pb);
43

    
44
    return 0;
45
}
46
#endif
47

    
48
#if CONFIG_NULL_MUXER
49
static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
50
{
51
    return 0;
52
}
53
#endif
54

    
55
#if CONFIG_MUXERS
56
static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
57
{
58
    put_buffer(s->pb, pkt->data, pkt->size);
59
    put_flush_packet(s->pb);
60
    return 0;
61
}
62
#endif
63

    
64
#if CONFIG_DEMUXERS
65
/* raw input */
66
static int raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
67
{
68
    AVStream *st;
69
    enum CodecID id;
70

    
71
    st = av_new_stream(s, 0);
72
    if (!st)
73
        return AVERROR(ENOMEM);
74

    
75
        id = s->iformat->value;
76
        if (id == CODEC_ID_RAWVIDEO) {
77
            st->codec->codec_type = CODEC_TYPE_VIDEO;
78
        } else {
79
            st->codec->codec_type = CODEC_TYPE_AUDIO;
80
        }
81
        st->codec->codec_id = id;
82

    
83
        switch(st->codec->codec_type) {
84
        case CODEC_TYPE_AUDIO:
85
            st->codec->sample_rate = ap->sample_rate;
86
            if(ap->channels) st->codec->channels = ap->channels;
87
            else             st->codec->channels = 1;
88
            st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
89
            assert(st->codec->bits_per_coded_sample > 0);
90
            st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
91
            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
92
            break;
93
        case CODEC_TYPE_VIDEO:
94
            if(ap->time_base.num)
95
                av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
96
            else
97
                av_set_pts_info(st, 64, 1, 25);
98
            st->codec->width = ap->width;
99
            st->codec->height = ap->height;
100
            st->codec->pix_fmt = ap->pix_fmt;
101
            if(st->codec->pix_fmt == PIX_FMT_NONE)
102
                st->codec->pix_fmt= PIX_FMT_YUV420P;
103
            break;
104
        default:
105
            return -1;
106
        }
107
    return 0;
108
}
109

    
110
#define RAW_PACKET_SIZE 1024
111
#define RAW_SAMPLES     1024
112

    
113
static int raw_read_packet(AVFormatContext *s, AVPacket *pkt)
114
{
115
    int ret, size, bps;
116
    //    AVStream *st = s->streams[0];
117

    
118
    size= RAW_SAMPLES*s->streams[0]->codec->block_align;
119

    
120
    ret= av_get_packet(s->pb, pkt, size);
121

    
122
    pkt->stream_index = 0;
123
    if (ret < 0)
124
        return ret;
125

    
126
    bps= av_get_bits_per_sample(s->streams[0]->codec->codec_id);
127
    assert(bps); // if false there IS a bug elsewhere (NOT in this function)
128
    pkt->dts=
129
    pkt->pts= pkt->pos*8 / (bps * s->streams[0]->codec->channels);
130

    
131
    return ret;
132
}
133

    
134
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)
135
{
136
    int ret, size;
137

    
138
    size = RAW_PACKET_SIZE;
139

    
140
    if (av_new_packet(pkt, size) < 0)
141
        return AVERROR(ENOMEM);
142

    
143
    pkt->pos= url_ftell(s->pb);
144
    pkt->stream_index = 0;
145
    ret = get_partial_buffer(s->pb, pkt->data, size);
146
    if (ret < 0) {
147
        av_free_packet(pkt);
148
        return ret;
149
    }
150
    pkt->size = ret;
151
    return ret;
152
}
153
#endif
154

    
155
#if CONFIG_RAWVIDEO_DEMUXER
156
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
157
{
158
    int packet_size, ret, width, height;
159
    AVStream *st = s->streams[0];
160

    
161
    width = st->codec->width;
162
    height = st->codec->height;
163

    
164
    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
165
    if (packet_size < 0)
166
        return -1;
167

    
168
    ret= av_get_packet(s->pb, pkt, packet_size);
169
    pkt->pts=
170
    pkt->dts= pkt->pos / packet_size;
171

    
172
    pkt->stream_index = 0;
173
    if (ret < 0)
174
        return ret;
175
    return 0;
176
}
177
#endif
178

    
179
#if CONFIG_INGENIENT_DEMUXER
180
// http://www.artificis.hu/files/texts/ingenient.txt
181
static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
182
{
183
    int ret, size, w, h, unk1, unk2;
184

    
185
    if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
186
        return AVERROR(EIO); // FIXME
187

    
188
    size = get_le32(s->pb);
189

    
190
    w = get_le16(s->pb);
191
    h = get_le16(s->pb);
192

    
193
    url_fskip(s->pb, 8); // zero + size (padded?)
194
    url_fskip(s->pb, 2);
195
    unk1 = get_le16(s->pb);
196
    unk2 = get_le16(s->pb);
197
    url_fskip(s->pb, 22); // ASCII timestamp
198

    
199
    av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
200
        size, w, h, unk1, unk2);
201

    
202
    if (av_new_packet(pkt, size) < 0)
203
        return AVERROR(ENOMEM);
204

    
205
    pkt->pos = url_ftell(s->pb);
206
    pkt->stream_index = 0;
207
    ret = get_buffer(s->pb, pkt->data, size);
208
    if (ret < 0) {
209
        av_free_packet(pkt);
210
        return ret;
211
    }
212
    pkt->size = ret;
213
    return ret;
214
}
215
#endif
216

    
217
#if CONFIG_DEMUXERS
218
int pcm_read_seek(AVFormatContext *s,
219
                  int stream_index, int64_t timestamp, int flags)
220
{
221
    AVStream *st;
222
    int block_align, byte_rate;
223
    int64_t pos, ret;
224

    
225
    st = s->streams[0];
226

    
227
    block_align = st->codec->block_align ? st->codec->block_align :
228
        (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3;
229
    byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 :
230
        block_align * st->codec->sample_rate;
231

    
232
    if (block_align <= 0 || byte_rate <= 0)
233
        return -1;
234
    if (timestamp < 0) timestamp = 0;
235

    
236
    /* compute the position by aligning it to block_align */
237
    pos = av_rescale_rnd(timestamp * byte_rate,
238
                         st->time_base.num,
239
                         st->time_base.den * (int64_t)block_align,
240
                         (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
241
    pos *= block_align;
242

    
243
    /* recompute exact position */
244
    st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);
245
    if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0)
246
        return ret;
247
    return 0;
248
}
249

    
250
static int audio_read_header(AVFormatContext *s,
251
                             AVFormatParameters *ap)
252
{
253
    AVStream *st = av_new_stream(s, 0);
254
    if (!st)
255
        return AVERROR(ENOMEM);
256
    st->codec->codec_type = CODEC_TYPE_AUDIO;
257
    st->codec->codec_id = s->iformat->value;
258
    st->need_parsing = AVSTREAM_PARSE_FULL;
259
    /* the parameters will be extracted from the compressed bitstream */
260

    
261
    return 0;
262
}
263

    
264
/* MPEG-1/H.263 input */
265
static int video_read_header(AVFormatContext *s,
266
                             AVFormatParameters *ap)
267
{
268
    AVStream *st;
269

    
270
    st = av_new_stream(s, 0);
271
    if (!st)
272
        return AVERROR(ENOMEM);
273

    
274
    st->codec->codec_type = CODEC_TYPE_VIDEO;
275
    st->codec->codec_id = s->iformat->value;
276
    st->need_parsing = AVSTREAM_PARSE_FULL;
277

    
278
    /* for MJPEG, specify frame rate */
279
    /* for MPEG-4 specify it, too (most MPEG-4 streams do not have the fixed_vop_rate set ...)*/
280
    if (ap->time_base.num) {
281
        st->codec->time_base= ap->time_base;
282
    } else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
283
                st->codec->codec_id == CODEC_ID_MPEG4 ||
284
                st->codec->codec_id == CODEC_ID_DIRAC ||
285
                st->codec->codec_id == CODEC_ID_H264) {
286
        st->codec->time_base= (AVRational){1,25};
287
    }
288
    av_set_pts_info(st, 64, 1, 1200000);
289

    
290
    return 0;
291
}
292
#endif
293

    
294
#if CONFIG_MPEGVIDEO_DEMUXER
295
#define SEQ_START_CODE          0x000001b3
296
#define GOP_START_CODE          0x000001b8
297
#define PICTURE_START_CODE      0x00000100
298
#define SLICE_START_CODE        0x00000101
299
#define PACK_START_CODE         0x000001ba
300
#define VIDEO_ID                0x000001e0
301
#define AUDIO_ID                0x000001c0
302

    
303
static int mpegvideo_probe(AVProbeData *p)
304
{
305
    uint32_t code= -1;
306
    int pic=0, seq=0, slice=0, pspack=0, pes=0;
307
    int i;
308

    
309
    for(i=0; i<p->buf_size; i++){
310
        code = (code<<8) + p->buf[i];
311
        if ((code & 0xffffff00) == 0x100) {
312
            switch(code){
313
            case     SEQ_START_CODE:   seq++; break;
314
            case PICTURE_START_CODE:   pic++; break;
315
            case   SLICE_START_CODE: slice++; break;
316
            case    PACK_START_CODE: pspack++; break;
317
            }
318
            if     ((code & 0x1f0) == VIDEO_ID)   pes++;
319
            else if((code & 0x1e0) == AUDIO_ID)   pes++;
320
        }
321
    }
322
    if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes)
323
        return pic>1 ? AVPROBE_SCORE_MAX/2+1 : AVPROBE_SCORE_MAX/4; // +1 for .mpg
324
    return 0;
325
}
326
#endif
327

    
328
#if CONFIG_CAVSVIDEO_DEMUXER
329
#define CAVS_SEQ_START_CODE       0x000001b0
330
#define CAVS_PIC_I_START_CODE     0x000001b3
331
#define CAVS_UNDEF_START_CODE     0x000001b4
332
#define CAVS_PIC_PB_START_CODE    0x000001b6
333
#define CAVS_VIDEO_EDIT_CODE      0x000001b7
334
#define CAVS_PROFILE_JIZHUN       0x20
335

    
336
static int cavsvideo_probe(AVProbeData *p)
337
{
338
    uint32_t code= -1;
339
    int pic=0, seq=0, slice_pos = 0;
340
    int i;
341

    
342
    for(i=0; i<p->buf_size; i++){
343
        code = (code<<8) + p->buf[i];
344
        if ((code & 0xffffff00) == 0x100) {
345
            if(code < CAVS_SEQ_START_CODE) {
346
                /* slices have to be consecutive */
347
                if(code < slice_pos)
348
                    return 0;
349
                slice_pos = code;
350
            } else {
351
                slice_pos = 0;
352
            }
353
            if (code == CAVS_SEQ_START_CODE) {
354
                seq++;
355
                /* check for the only currently supported profile */
356
                if(p->buf[i+1] != CAVS_PROFILE_JIZHUN)
357
                    return 0;
358
            } else if ((code == CAVS_PIC_I_START_CODE) ||
359
                       (code == CAVS_PIC_PB_START_CODE)) {
360
                pic++;
361
            } else if ((code == CAVS_UNDEF_START_CODE) ||
362
                       (code >  CAVS_VIDEO_EDIT_CODE)) {
363
                return 0;
364
            }
365
        }
366
    }
367
    if(seq && seq*9<=pic*10)
368
        return AVPROBE_SCORE_MAX/2;
369
    return 0;
370
}
371
#endif
372

    
373
#if CONFIG_M4V_DEMUXER
374
#define VISUAL_OBJECT_START_CODE       0x000001b5
375
#define VOP_START_CODE                 0x000001b6
376

    
377
static int mpeg4video_probe(AVProbeData *probe_packet)
378
{
379
    uint32_t temp_buffer= -1;
380
    int VO=0, VOL=0, VOP = 0, VISO = 0, res=0;
381
    int i;
382

    
383
    for(i=0; i<probe_packet->buf_size; i++){
384
        temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
385
        if ((temp_buffer & 0xffffff00) != 0x100)
386
            continue;
387

    
388
        if (temp_buffer == VOP_START_CODE)                         VOP++;
389
        else if (temp_buffer == VISUAL_OBJECT_START_CODE)          VISO++;
390
        else if (temp_buffer < 0x120)                              VO++;
391
        else if (temp_buffer < 0x130)                              VOL++;
392
        else if (   !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
393
                 && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
394
    }
395

    
396
    if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0)
397
        return AVPROBE_SCORE_MAX/2;
398
    return 0;
399
}
400
#endif
401

    
402
#if CONFIG_H264_DEMUXER
403
static int h264_probe(AVProbeData *p)
404
{
405
    uint32_t code= -1;
406
    int sps=0, pps=0, idr=0, res=0, sli=0;
407
    int i;
408

    
409
    for(i=0; i<p->buf_size; i++){
410
        code = (code<<8) + p->buf[i];
411
        if ((code & 0xffffff00) == 0x100) {
412
            int ref_idc= (code>>5)&3;
413
            int type   = code & 0x1F;
414
            static const int8_t ref_zero[32]={
415
                2, 0, 0, 0, 0,-1, 1,-1,
416
               -1, 1, 1, 1, 1,-1, 2, 2,
417
                2, 2, 2, 0, 2, 2, 2, 2,
418
                2, 2, 2, 2, 2, 2, 2, 2
419
            };
420

    
421
            if(code & 0x80) //forbidden bit
422
                return 0;
423

    
424
            if(ref_zero[type] == 1 && ref_idc)
425
                return 0;
426
            if(ref_zero[type] ==-1 && !ref_idc)
427
                return 0;
428
            if(ref_zero[type] == 2)
429
                res++;
430

    
431
            switch(type){
432
            case     1:   sli++; break;
433
            case     5:   idr++; break;
434
            case     7:
435
                if(p->buf[i+2]&0x0F)
436
                    return 0;
437
                sps++;
438
                break;
439
            case     8:   pps++; break;
440
            }
441
        }
442
    }
443
    if(sps && pps && (idr||sli>3) && res<(sps+pps+idr))
444
        return AVPROBE_SCORE_MAX/2+1; // +1 for .mpg
445
    return 0;
446
}
447
#endif
448

    
449
#if CONFIG_H263_DEMUXER
450
static int h263_probe(AVProbeData *p)
451
{
452
    uint64_t code= -1;
453
    int i;
454
    int valid_psc=0;
455
    int invalid_psc=0;
456
    int res_change=0;
457
    int src_fmt, last_src_fmt=-1;
458

    
459
    for(i=0; i<p->buf_size; i++){
460
        code = (code<<8) + p->buf[i];
461
        if ((code & 0xfffffc0000) == 0x800000) {
462
            src_fmt= (code>>2)&3;
463
            if(   src_fmt != last_src_fmt
464
               && last_src_fmt>0 && last_src_fmt<6
465
               && src_fmt<6)
466
                res_change++;
467

    
468
            if((code&0x300)==0x200 && src_fmt){
469
                valid_psc++;
470
            }else
471
                invalid_psc++;
472
            last_src_fmt= src_fmt;
473
        }
474
    }
475
//av_log(NULL, AV_LOG_ERROR, "h263_probe: psc:%d invalid:%d res_change:%d\n", valid_psc, invalid_psc, res_change);
476
//h263_probe: psc:3 invalid:0 res_change:0 (1588/recent_ffmpeg_parses_mpg_incorrectly.mpg)
477
    if(valid_psc > 2*invalid_psc + 2*res_change + 3){
478
        return 50;
479
    }else if(valid_psc > 2*invalid_psc)
480
        return 25;
481
    return 0;
482
}
483
#endif
484

    
485
#if CONFIG_H261_DEMUXER
486
static int h261_probe(AVProbeData *p)
487
{
488
    uint32_t code= -1;
489
    int i;
490
    int valid_psc=0;
491
    int invalid_psc=0;
492
    int next_gn=0;
493
    int src_fmt=0;
494
    GetBitContext gb;
495

    
496
    init_get_bits(&gb, p->buf, p->buf_size*8);
497

    
498
    for(i=0; i<p->buf_size*8; i++){
499
        code = (code<<1) + get_bits1(&gb);
500
        if ((code & 0xffff0000) == 0x10000) {
501
            int gn= (code>>12)&0xf;
502
            if(!gn)
503
                src_fmt= code&8;
504
            if(gn != next_gn) invalid_psc++;
505
            else              valid_psc++;
506

    
507
            if(src_fmt){ // CIF
508
                next_gn= (gn+1     )%13;
509
            }else{       //QCIF
510
                next_gn= (gn+1+!!gn)% 7;
511
            }
512
        }
513
    }
514
    if(valid_psc > 2*invalid_psc + 6){
515
        return 50;
516
    }else if(valid_psc > 2*invalid_psc + 2)
517
        return 25;
518
    return 0;
519
}
520
#endif
521

    
522
#if CONFIG_DTS_DEMUXER
523
#define DCA_MARKER_14B_BE 0x1FFFE800
524
#define DCA_MARKER_14B_LE 0xFF1F00E8
525
#define DCA_MARKER_RAW_BE 0x7FFE8001
526
#define DCA_MARKER_RAW_LE 0xFE7F0180
527
static int dts_probe(AVProbeData *p)
528
{
529
    const uint8_t *buf, *bufp;
530
    uint32_t state = -1;
531
    int markers[3] = {0};
532
    int sum, max;
533

    
534
    buf = p->buf;
535

    
536
    for(; buf < (p->buf+p->buf_size)-2; buf+=2) {
537
        bufp = buf;
538
        state = (state << 16) | bytestream_get_be16(&bufp);
539

    
540
        /* regular bitstream */
541
        if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE)
542
            markers[0]++;
543

    
544
        /* 14 bits big-endian bitstream */
545
        if (state == DCA_MARKER_14B_BE)
546
            if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
547
                markers[1]++;
548

    
549
        /* 14 bits little-endian bitstream */
550
        if (state == DCA_MARKER_14B_LE)
551
            if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007)
552
                markers[2]++;
553
    }
554
    sum = markers[0] + markers[1] + markers[2];
555
    max = markers[1] > markers[0];
556
    max = markers[2] > markers[max] ? 2 : max;
557
    if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
558
        markers[max] * 4 > sum * 3)
559
        return AVPROBE_SCORE_MAX/2+1;
560

    
561
    return 0;
562
}
563
#endif
564

    
565
#if CONFIG_DIRAC_DEMUXER
566
static int dirac_probe(AVProbeData *p)
567
{
568
    if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D'))
569
        return AVPROBE_SCORE_MAX;
570
    else
571
        return 0;
572
}
573
#endif
574

    
575
#if CONFIG_DNXHD_DEMUXER
576
static int dnxhd_probe(AVProbeData *p)
577
{
578
    static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
579
    int w, h, compression_id;
580
    if (p->buf_size < 0x2c)
581
        return 0;
582
    if (memcmp(p->buf, header, 5))
583
        return 0;
584
    h = AV_RB16(p->buf + 0x18);
585
    w = AV_RB16(p->buf + 0x1a);
586
    if (!w || !h)
587
        return 0;
588
    compression_id = AV_RB32(p->buf + 0x28);
589
    if (compression_id < 1237 || compression_id > 1253)
590
        return 0;
591
    return AVPROBE_SCORE_MAX;
592
}
593
#endif
594

    
595
#if CONFIG_AC3_DEMUXER || CONFIG_EAC3_DEMUXER
596
static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
597
{
598
    int max_frames, first_frames = 0, frames;
599
    uint8_t *buf, *buf2, *end;
600
    AC3HeaderInfo hdr;
601
    GetBitContext gbc;
602
    enum CodecID codec_id = CODEC_ID_AC3;
603

    
604
    max_frames = 0;
605
    buf = p->buf;
606
    end = buf + p->buf_size;
607

    
608
    for(; buf < end; buf++) {
609
        buf2 = buf;
610

    
611
        for(frames = 0; buf2 < end; frames++) {
612
            init_get_bits(&gbc, buf2, 54);
613
            if(ff_ac3_parse_header(&gbc, &hdr) < 0)
614
                break;
615
            if(buf2 + hdr.frame_size > end ||
616
               av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, buf2 + 2, hdr.frame_size - 2))
617
                break;
618
            if (hdr.bitstream_id > 10)
619
                codec_id = CODEC_ID_EAC3;
620
            buf2 += hdr.frame_size;
621
        }
622
        max_frames = FFMAX(max_frames, frames);
623
        if(buf == p->buf)
624
            first_frames = frames;
625
    }
626
    if(codec_id != expected_codec_id) return 0;
627
    // keep this in sync with mp3 probe, both need to avoid
628
    // issues with MPEG-files!
629
    if   (first_frames>=4) return AVPROBE_SCORE_MAX/2+1;
630
    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
631
    else if(max_frames>=4) return AVPROBE_SCORE_MAX/4;
632
    else if(max_frames>=1) return 1;
633
    else                   return 0;
634
}
635
#endif
636

    
637
#if CONFIG_AC3_DEMUXER
638
static int ac3_probe(AVProbeData *p)
639
{
640
    return ac3_eac3_probe(p, CODEC_ID_AC3);
641
}
642
#endif
643

    
644
#if CONFIG_EAC3_DEMUXER
645
static int eac3_probe(AVProbeData *p)
646
{
647
    return ac3_eac3_probe(p, CODEC_ID_EAC3);
648
}
649
#endif
650

    
651
#if CONFIG_AAC_DEMUXER
652
static int adts_aac_probe(AVProbeData *p)
653
{
654
    int max_frames = 0, first_frames = 0;
655
    int fsize, frames;
656
    uint8_t *buf0 = p->buf;
657
    uint8_t *buf2;
658
    uint8_t *buf;
659
    uint8_t *end = buf0 + p->buf_size - 7;
660

    
661
    if (ff_id3v2_match(buf0)) {
662
        buf0 += ff_id3v2_tag_len(buf0);
663
    }
664
    buf = buf0;
665

    
666
    for(; buf < end; buf= buf2+1) {
667
        buf2 = buf;
668

    
669
        for(frames = 0; buf2 < end; frames++) {
670
            uint32_t header = AV_RB16(buf2);
671
            if((header&0xFFF6) != 0xFFF0)
672
                break;
673
            fsize = (AV_RB32(buf2+3)>>13) & 0x8FFF;
674
            if(fsize < 7)
675
                break;
676
            buf2 += fsize;
677
        }
678
        max_frames = FFMAX(max_frames, frames);
679
        if(buf == buf0)
680
            first_frames= frames;
681
    }
682
    if   (first_frames>=3) return AVPROBE_SCORE_MAX/2+1;
683
    else if(max_frames>500)return AVPROBE_SCORE_MAX/2;
684
    else if(max_frames>=3) return AVPROBE_SCORE_MAX/4;
685
    else if(max_frames>=1) return 1;
686
    else                   return 0;
687
}
688

    
689
static int adts_aac_read_header(AVFormatContext *s,
690
                                AVFormatParameters *ap)
691
{
692
    AVStream *st;
693

    
694
    st = av_new_stream(s, 0);
695
    if (!st)
696
        return AVERROR(ENOMEM);
697

    
698
    st->codec->codec_type = CODEC_TYPE_AUDIO;
699
    st->codec->codec_id = s->iformat->value;
700
    st->need_parsing = AVSTREAM_PARSE_FULL;
701

    
702
    ff_id3v1_read(s);
703
    ff_id3v2_read(s);
704

    
705
    return 0;
706
}
707

    
708
#endif
709

    
710
/* Note: Do not forget to add new entries to the Makefile as well. */
711

    
712
#if CONFIG_AAC_DEMUXER
713
AVInputFormat aac_demuxer = {
714
    "aac",
715
    NULL_IF_CONFIG_SMALL("raw ADTS AAC"),
716
    0,
717
    adts_aac_probe,
718
    adts_aac_read_header,
719
    ff_raw_read_partial_packet,
720
    .flags= AVFMT_GENERIC_INDEX,
721
    .extensions = "aac",
722
    .value = CODEC_ID_AAC,
723
};
724
#endif
725

    
726
#if CONFIG_AC3_DEMUXER
727
AVInputFormat ac3_demuxer = {
728
    "ac3",
729
    NULL_IF_CONFIG_SMALL("raw AC-3"),
730
    0,
731
    ac3_probe,
732
    audio_read_header,
733
    ff_raw_read_partial_packet,
734
    .flags= AVFMT_GENERIC_INDEX,
735
    .extensions = "ac3",
736
    .value = CODEC_ID_AC3,
737
};
738
#endif
739

    
740
#if CONFIG_AC3_MUXER
741
AVOutputFormat ac3_muxer = {
742
    "ac3",
743
    NULL_IF_CONFIG_SMALL("raw AC-3"),
744
    "audio/x-ac3",
745
    "ac3",
746
    0,
747
    CODEC_ID_AC3,
748
    CODEC_ID_NONE,
749
    NULL,
750
    raw_write_packet,
751
    .flags= AVFMT_NOTIMESTAMPS,
752
};
753
#endif
754

    
755
#if CONFIG_DIRAC_DEMUXER
756
AVInputFormat dirac_demuxer = {
757
    "dirac",
758
    NULL_IF_CONFIG_SMALL("raw Dirac"),
759
    0,
760
    dirac_probe,
761
    video_read_header,
762
    ff_raw_read_partial_packet,
763
    .flags= AVFMT_GENERIC_INDEX,
764
    .value = CODEC_ID_DIRAC,
765
};
766
#endif
767

    
768
#if CONFIG_DIRAC_MUXER
769
AVOutputFormat dirac_muxer = {
770
    "dirac",
771
    NULL_IF_CONFIG_SMALL("raw Dirac"),
772
    NULL,
773
    "drc",
774
    0,
775
    CODEC_ID_NONE,
776
    CODEC_ID_DIRAC,
777
    NULL,
778
    raw_write_packet,
779
    .flags= AVFMT_NOTIMESTAMPS,
780
};
781
#endif
782

    
783
#if CONFIG_DNXHD_DEMUXER
784
AVInputFormat dnxhd_demuxer = {
785
    "dnxhd",
786
    NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
787
    0,
788
    dnxhd_probe,
789
    video_read_header,
790
    ff_raw_read_partial_packet,
791
    .flags= AVFMT_GENERIC_INDEX,
792
    .value = CODEC_ID_DNXHD,
793
};
794
#endif
795

    
796
#if CONFIG_DNXHD_MUXER
797
AVOutputFormat dnxhd_muxer = {
798
    "dnxhd",
799
    NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
800
    NULL,
801
    "dnxhd",
802
    0,
803
    CODEC_ID_NONE,
804
    CODEC_ID_DNXHD,
805
    NULL,
806
    raw_write_packet,
807
    .flags= AVFMT_NOTIMESTAMPS,
808
};
809
#endif
810

    
811
#if CONFIG_DTS_DEMUXER
812
AVInputFormat dts_demuxer = {
813
    "dts",
814
    NULL_IF_CONFIG_SMALL("raw DTS"),
815
    0,
816
    dts_probe,
817
    audio_read_header,
818
    ff_raw_read_partial_packet,
819
    .flags= AVFMT_GENERIC_INDEX,
820
    .extensions = "dts",
821
    .value = CODEC_ID_DTS,
822
};
823
#endif
824

    
825
#if CONFIG_DTS_MUXER
826
AVOutputFormat dts_muxer = {
827
    "dts",
828
    NULL_IF_CONFIG_SMALL("raw DTS"),
829
    "audio/x-dca",
830
    "dts",
831
    0,
832
    CODEC_ID_DTS,
833
    CODEC_ID_NONE,
834
    NULL,
835
    raw_write_packet,
836
    .flags= AVFMT_NOTIMESTAMPS,
837
};
838
#endif
839

    
840
#if CONFIG_EAC3_DEMUXER
841
AVInputFormat eac3_demuxer = {
842
    "eac3",
843
    NULL_IF_CONFIG_SMALL("raw E-AC-3"),
844
    0,
845
    eac3_probe,
846
    audio_read_header,
847
    ff_raw_read_partial_packet,
848
    .flags= AVFMT_GENERIC_INDEX,
849
    .extensions = "eac3",
850
    .value = CODEC_ID_EAC3,
851
};
852
#endif
853

    
854
#if CONFIG_EAC3_MUXER
855
AVOutputFormat eac3_muxer = {
856
    "eac3",
857
    NULL_IF_CONFIG_SMALL("raw E-AC-3"),
858
    "audio/x-eac3",
859
    "eac3",
860
    0,
861
    CODEC_ID_EAC3,
862
    CODEC_ID_NONE,
863
    NULL,
864
    raw_write_packet,
865
    .flags= AVFMT_NOTIMESTAMPS,
866
};
867
#endif
868

    
869
#if CONFIG_GSM_DEMUXER
870
AVInputFormat gsm_demuxer = {
871
    "gsm",
872
    NULL_IF_CONFIG_SMALL("raw GSM"),
873
    0,
874
    NULL,
875
    audio_read_header,
876
    ff_raw_read_partial_packet,
877
    .flags= AVFMT_GENERIC_INDEX,
878
    .extensions = "gsm",
879
    .value = CODEC_ID_GSM,
880
};
881
#endif
882

    
883
#if CONFIG_H261_DEMUXER
884
AVInputFormat h261_demuxer = {
885
    "h261",
886
    NULL_IF_CONFIG_SMALL("raw H.261"),
887
    0,
888
    h261_probe,
889
    video_read_header,
890
    ff_raw_read_partial_packet,
891
    .flags= AVFMT_GENERIC_INDEX,
892
    .extensions = "h261",
893
    .value = CODEC_ID_H261,
894
};
895
#endif
896

    
897
#if CONFIG_H261_MUXER
898
AVOutputFormat h261_muxer = {
899
    "h261",
900
    NULL_IF_CONFIG_SMALL("raw H.261"),
901
    "video/x-h261",
902
    "h261",
903
    0,
904
    CODEC_ID_NONE,
905
    CODEC_ID_H261,
906
    NULL,
907
    raw_write_packet,
908
    .flags= AVFMT_NOTIMESTAMPS,
909
};
910
#endif
911

    
912
#if CONFIG_H263_DEMUXER
913
AVInputFormat h263_demuxer = {
914
    "h263",
915
    NULL_IF_CONFIG_SMALL("raw H.263"),
916
    0,
917
    h263_probe,
918
    video_read_header,
919
    ff_raw_read_partial_packet,
920
    .flags= AVFMT_GENERIC_INDEX,
921
//    .extensions = "h263", //FIXME remove after writing mpeg4_probe
922
    .value = CODEC_ID_H263,
923
};
924
#endif
925

    
926
#if CONFIG_H263_MUXER
927
AVOutputFormat h263_muxer = {
928
    "h263",
929
    NULL_IF_CONFIG_SMALL("raw H.263"),
930
    "video/x-h263",
931
    "h263",
932
    0,
933
    CODEC_ID_NONE,
934
    CODEC_ID_H263,
935
    NULL,
936
    raw_write_packet,
937
    .flags= AVFMT_NOTIMESTAMPS,
938
};
939
#endif
940

    
941
#if CONFIG_H264_DEMUXER
942
AVInputFormat h264_demuxer = {
943
    "h264",
944
    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
945
    0,
946
    h264_probe,
947
    video_read_header,
948
    ff_raw_read_partial_packet,
949
    .flags= AVFMT_GENERIC_INDEX,
950
    .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
951
    .value = CODEC_ID_H264,
952
};
953
#endif
954

    
955
#if CONFIG_H264_MUXER
956
AVOutputFormat h264_muxer = {
957
    "h264",
958
    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
959
    NULL,
960
    "h264",
961
    0,
962
    CODEC_ID_NONE,
963
    CODEC_ID_H264,
964
    NULL,
965
    raw_write_packet,
966
    .flags= AVFMT_NOTIMESTAMPS,
967
};
968
#endif
969

    
970
#if CONFIG_INGENIENT_DEMUXER
971
AVInputFormat ingenient_demuxer = {
972
    "ingenient",
973
    NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
974
    0,
975
    NULL,
976
    video_read_header,
977
    ingenient_read_packet,
978
    .flags= AVFMT_GENERIC_INDEX,
979
    .extensions = "cgi", // FIXME
980
    .value = CODEC_ID_MJPEG,
981
};
982
#endif
983

    
984
#if CONFIG_M4V_DEMUXER
985
AVInputFormat m4v_demuxer = {
986
    "m4v",
987
    NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
988
    0,
989
    mpeg4video_probe, /** probing for MPEG-4 data */
990
    video_read_header,
991
    ff_raw_read_partial_packet,
992
    .flags= AVFMT_GENERIC_INDEX,
993
    .extensions = "m4v",
994
    .value = CODEC_ID_MPEG4,
995
};
996
#endif
997

    
998
#if CONFIG_M4V_MUXER
999
AVOutputFormat m4v_muxer = {
1000
    "m4v",
1001
    NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
1002
    NULL,
1003
    "m4v",
1004
    0,
1005
    CODEC_ID_NONE,
1006
    CODEC_ID_MPEG4,
1007
    NULL,
1008
    raw_write_packet,
1009
    .flags= AVFMT_NOTIMESTAMPS,
1010
};
1011
#endif
1012

    
1013
#if CONFIG_MJPEG_DEMUXER
1014
AVInputFormat mjpeg_demuxer = {
1015
    "mjpeg",
1016
    NULL_IF_CONFIG_SMALL("raw MJPEG video"),
1017
    0,
1018
    NULL,
1019
    video_read_header,
1020
    ff_raw_read_partial_packet,
1021
    .flags= AVFMT_GENERIC_INDEX,
1022
    .extensions = "mjpg,mjpeg",
1023
    .value = CODEC_ID_MJPEG,
1024
};
1025
#endif
1026

    
1027
#if CONFIG_MJPEG_MUXER
1028
AVOutputFormat mjpeg_muxer = {
1029
    "mjpeg",
1030
    NULL_IF_CONFIG_SMALL("raw MJPEG video"),
1031
    "video/x-mjpeg",
1032
    "mjpg,mjpeg",
1033
    0,
1034
    CODEC_ID_NONE,
1035
    CODEC_ID_MJPEG,
1036
    NULL,
1037
    raw_write_packet,
1038
    .flags= AVFMT_NOTIMESTAMPS,
1039
};
1040
#endif
1041

    
1042
#if CONFIG_MLP_DEMUXER
1043
AVInputFormat mlp_demuxer = {
1044
    "mlp",
1045
    NULL_IF_CONFIG_SMALL("raw MLP"),
1046
    0,
1047
    NULL,
1048
    audio_read_header,
1049
    ff_raw_read_partial_packet,
1050
    .flags= AVFMT_GENERIC_INDEX,
1051
    .extensions = "mlp",
1052
    .value = CODEC_ID_MLP,
1053
};
1054
#endif
1055

    
1056
#if CONFIG_MLP_MUXER
1057
AVOutputFormat mlp_muxer = {
1058
    "mlp",
1059
    NULL_IF_CONFIG_SMALL("raw MLP"),
1060
    NULL,
1061
    "mlp",
1062
    0,
1063
    CODEC_ID_MLP,
1064
    CODEC_ID_NONE,
1065
    NULL,
1066
    raw_write_packet,
1067
    .flags= AVFMT_NOTIMESTAMPS,
1068
};
1069
#endif
1070

    
1071
#if CONFIG_TRUEHD_DEMUXER
1072
AVInputFormat truehd_demuxer = {
1073
    "truehd",
1074
    NULL_IF_CONFIG_SMALL("raw TrueHD"),
1075
    0,
1076
    NULL,
1077
    audio_read_header,
1078
    ff_raw_read_partial_packet,
1079
    .flags= AVFMT_GENERIC_INDEX,
1080
    .extensions = "thd",
1081
    .value = CODEC_ID_TRUEHD,
1082
};
1083
#endif
1084

    
1085
#if CONFIG_TRUEHD_MUXER
1086
AVOutputFormat truehd_muxer = {
1087
    "truehd",
1088
    NULL_IF_CONFIG_SMALL("raw TrueHD"),
1089
    NULL,
1090
    "thd",
1091
    0,
1092
    CODEC_ID_TRUEHD,
1093
    CODEC_ID_NONE,
1094
    NULL,
1095
    raw_write_packet,
1096
    .flags= AVFMT_NOTIMESTAMPS,
1097
};
1098
#endif
1099

    
1100
#if CONFIG_MPEG1VIDEO_MUXER
1101
AVOutputFormat mpeg1video_muxer = {
1102
    "mpeg1video",
1103
    NULL_IF_CONFIG_SMALL("raw MPEG-1 video"),
1104
    "video/x-mpeg",
1105
    "mpg,mpeg,m1v",
1106
    0,
1107
    CODEC_ID_NONE,
1108
    CODEC_ID_MPEG1VIDEO,
1109
    NULL,
1110
    raw_write_packet,
1111
    .flags= AVFMT_NOTIMESTAMPS,
1112
};
1113
#endif
1114

    
1115
#if CONFIG_MPEG2VIDEO_MUXER
1116
AVOutputFormat mpeg2video_muxer = {
1117
    "mpeg2video",
1118
    NULL_IF_CONFIG_SMALL("raw MPEG-2 video"),
1119
    NULL,
1120
    "m2v",
1121
    0,
1122
    CODEC_ID_NONE,
1123
    CODEC_ID_MPEG2VIDEO,
1124
    NULL,
1125
    raw_write_packet,
1126
    .flags= AVFMT_NOTIMESTAMPS,
1127
};
1128
#endif
1129

    
1130
#if CONFIG_MPEGVIDEO_DEMUXER
1131
AVInputFormat mpegvideo_demuxer = {
1132
    "mpegvideo",
1133
    NULL_IF_CONFIG_SMALL("raw MPEG video"),
1134
    0,
1135
    mpegvideo_probe,
1136
    video_read_header,
1137
    ff_raw_read_partial_packet,
1138
    .flags= AVFMT_GENERIC_INDEX,
1139
    .value = CODEC_ID_MPEG1VIDEO,
1140
};
1141
#endif
1142

    
1143
#if CONFIG_CAVSVIDEO_DEMUXER
1144
AVInputFormat cavsvideo_demuxer = {
1145
    "cavsvideo",
1146
    NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
1147
    0,
1148
    cavsvideo_probe,
1149
    video_read_header,
1150
    ff_raw_read_partial_packet,
1151
    .flags= AVFMT_GENERIC_INDEX,
1152
    .value = CODEC_ID_CAVS,
1153
};
1154
#endif
1155

    
1156
#if CONFIG_NULL_MUXER
1157
AVOutputFormat null_muxer = {
1158
    "null",
1159
    NULL_IF_CONFIG_SMALL("raw null video format"),
1160
    NULL,
1161
    NULL,
1162
    0,
1163
#if HAVE_BIGENDIAN
1164
    CODEC_ID_PCM_S16BE,
1165
#else
1166
    CODEC_ID_PCM_S16LE,
1167
#endif
1168
    CODEC_ID_RAWVIDEO,
1169
    NULL,
1170
    null_write_packet,
1171
    .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS,
1172
};
1173
#endif
1174

    
1175
#if CONFIG_RAWVIDEO_DEMUXER
1176
AVInputFormat rawvideo_demuxer = {
1177
    "rawvideo",
1178
    NULL_IF_CONFIG_SMALL("raw video format"),
1179
    0,
1180
    NULL,
1181
    raw_read_header,
1182
    rawvideo_read_packet,
1183
    .flags= AVFMT_GENERIC_INDEX,
1184
    .extensions = "yuv,cif,qcif,rgb",
1185
    .value = CODEC_ID_RAWVIDEO,
1186
};
1187
#endif
1188

    
1189
#if CONFIG_RAWVIDEO_MUXER
1190
AVOutputFormat rawvideo_muxer = {
1191
    "rawvideo",
1192
    NULL_IF_CONFIG_SMALL("raw video format"),
1193
    NULL,
1194
    "yuv,rgb",
1195
    0,
1196
    CODEC_ID_NONE,
1197
    CODEC_ID_RAWVIDEO,
1198
    NULL,
1199
    raw_write_packet,
1200
    .flags= AVFMT_NOTIMESTAMPS,
1201
};
1202
#endif
1203

    
1204
#if CONFIG_ROQ_MUXER
1205
AVOutputFormat roq_muxer =
1206
{
1207
    "RoQ",
1208
    NULL_IF_CONFIG_SMALL("raw id RoQ format"),
1209
    NULL,
1210
    "roq",
1211
    0,
1212
    CODEC_ID_ROQ_DPCM,
1213
    CODEC_ID_ROQ,
1214
    roq_write_header,
1215
    raw_write_packet,
1216
};
1217
#endif
1218

    
1219
#if CONFIG_SHORTEN_DEMUXER
1220
AVInputFormat shorten_demuxer = {
1221
    "shn",
1222
    NULL_IF_CONFIG_SMALL("raw Shorten"),
1223
    0,
1224
    NULL,
1225
    audio_read_header,
1226
    ff_raw_read_partial_packet,
1227
    .flags= AVFMT_GENERIC_INDEX,
1228
    .extensions = "shn",
1229
    .value = CODEC_ID_SHORTEN,
1230
};
1231
#endif
1232

    
1233
#if CONFIG_VC1_DEMUXER
1234
AVInputFormat vc1_demuxer = {
1235
    "vc1",
1236
    NULL_IF_CONFIG_SMALL("raw VC-1"),
1237
    0,
1238
    NULL /* vc1_probe */,
1239
    video_read_header,
1240
    ff_raw_read_partial_packet,
1241
    .extensions = "vc1",
1242
    .value = CODEC_ID_VC1,
1243
};
1244
#endif
1245

    
1246
/* PCM formats */
1247

    
1248
#define PCMINPUTDEF(name, long_name, ext, codec) \
1249
AVInputFormat pcm_ ## name ## _demuxer = {\
1250
    #name,\
1251
    NULL_IF_CONFIG_SMALL(long_name),\
1252
    0,\
1253
    NULL,\
1254
    raw_read_header,\
1255
    raw_read_packet,\
1256
    NULL,\
1257
    pcm_read_seek,\
1258
    .flags= AVFMT_GENERIC_INDEX,\
1259
    .extensions = ext,\
1260
    .value = codec,\
1261
};
1262

    
1263
#define PCMOUTPUTDEF(name, long_name, ext, codec) \
1264
AVOutputFormat pcm_ ## name ## _muxer = {\
1265
    #name,\
1266
    NULL_IF_CONFIG_SMALL(long_name),\
1267
    NULL,\
1268
    ext,\
1269
    0,\
1270
    codec,\
1271
    CODEC_ID_NONE,\
1272
    NULL,\
1273
    raw_write_packet,\
1274
    .flags= AVFMT_NOTIMESTAMPS,\
1275
};
1276

    
1277

    
1278
#if  !CONFIG_MUXERS && CONFIG_DEMUXERS
1279
#define PCMDEF(name, long_name, ext, codec) \
1280
        PCMINPUTDEF(name, long_name, ext, codec)
1281
#elif CONFIG_MUXERS && !CONFIG_DEMUXERS
1282
#define PCMDEF(name, long_name, ext, codec) \
1283
        PCMOUTPUTDEF(name, long_name, ext, codec)
1284
#elif CONFIG_MUXERS && CONFIG_DEMUXERS
1285
#define PCMDEF(name, long_name, ext, codec) \
1286
        PCMINPUTDEF(name, long_name, ext, codec)\
1287
        PCMOUTPUTDEF(name, long_name, ext, codec)
1288
#else
1289
#define PCMDEF(name, long_name, ext, codec)
1290
#endif
1291

    
1292
#if HAVE_BIGENDIAN
1293
#define BE_DEF(s) s
1294
#define LE_DEF(s) NULL
1295
#else
1296
#define BE_DEF(s) NULL
1297
#define LE_DEF(s) s
1298
#endif
1299

    
1300
PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
1301
       NULL, CODEC_ID_PCM_F64BE)
1302

    
1303
PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
1304
       NULL, CODEC_ID_PCM_F64LE)
1305

    
1306
PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
1307
       NULL, CODEC_ID_PCM_F32BE)
1308

    
1309
PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
1310
       NULL, CODEC_ID_PCM_F32LE)
1311

    
1312
PCMDEF(s32be, "PCM signed 32 bit big-endian format",
1313
       NULL, CODEC_ID_PCM_S32BE)
1314

    
1315
PCMDEF(s32le, "PCM signed 32 bit little-endian format",
1316
       NULL, CODEC_ID_PCM_S32LE)
1317

    
1318
PCMDEF(s24be, "PCM signed 24 bit big-endian format",
1319
       NULL, CODEC_ID_PCM_S24BE)
1320

    
1321
PCMDEF(s24le, "PCM signed 24 bit little-endian format",
1322
       NULL, CODEC_ID_PCM_S24LE)
1323

    
1324
PCMDEF(s16be, "PCM signed 16 bit big-endian format",
1325
       BE_DEF("sw"), CODEC_ID_PCM_S16BE)
1326

    
1327
PCMDEF(s16le, "PCM signed 16 bit little-endian format",
1328
       LE_DEF("sw"), CODEC_ID_PCM_S16LE)
1329

    
1330
PCMDEF(s8, "PCM signed 8 bit format",
1331
       "sb", CODEC_ID_PCM_S8)
1332

    
1333
PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
1334
       NULL, CODEC_ID_PCM_U32BE)
1335

    
1336
PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
1337
       NULL, CODEC_ID_PCM_U32LE)
1338

    
1339
PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
1340
       NULL, CODEC_ID_PCM_U24BE)
1341

    
1342
PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
1343
       NULL, CODEC_ID_PCM_U24LE)
1344

    
1345
PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
1346
       BE_DEF("uw"), CODEC_ID_PCM_U16BE)
1347

    
1348
PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
1349
       LE_DEF("uw"), CODEC_ID_PCM_U16LE)
1350

    
1351
PCMDEF(u8, "PCM unsigned 8 bit format",
1352
       "ub", CODEC_ID_PCM_U8)
1353

    
1354
PCMDEF(alaw, "PCM A-law format",
1355
       "al", CODEC_ID_PCM_ALAW)
1356

    
1357
PCMDEF(mulaw, "PCM mu-law format",
1358
       "ul", CODEC_ID_PCM_MULAW)