Statistics
| Branch: | Revision:

ffmpeg / libavformat / raw.c @ 3adcfbbe

History | View | Annotate | Download (32.8 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_DNXHD ||
286
                st->codec->codec_id == CODEC_ID_H264) {
287
        st->codec->time_base= (AVRational){1,25};
288
    }
289
    av_set_pts_info(st, 64, 1, 1200000);
290

    
291
    return 0;
292
}
293
#endif
294

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
499
    for(i=0; i<p->buf_size*8; i++){
500
        if ((code & 0x01ff0000) || !(code & 0xff00)) {
501
            code = (code<<8) + get_bits(&gb, 8);
502
            i += 7;
503
        } else
504
        code = (code<<1) + get_bits1(&gb);
505
        if ((code & 0xffff0000) == 0x10000) {
506
            int gn= (code>>12)&0xf;
507
            if(!gn)
508
                src_fmt= code&8;
509
            if(gn != next_gn) invalid_psc++;
510
            else              valid_psc++;
511

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

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

    
539
    buf = p->buf;
540

    
541
    for(; buf < (p->buf+p->buf_size)-2; buf+=2) {
542
        bufp = buf;
543
        state = (state << 16) | bytestream_get_be16(&bufp);
544

    
545
        /* regular bitstream */
546
        if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE)
547
            markers[0]++;
548

    
549
        /* 14 bits big-endian bitstream */
550
        if (state == DCA_MARKER_14B_BE)
551
            if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0)
552
                markers[1]++;
553

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

    
566
    return 0;
567
}
568
#endif
569

    
570
#if CONFIG_DIRAC_DEMUXER
571
static int dirac_probe(AVProbeData *p)
572
{
573
    if (AV_RL32(p->buf) == MKTAG('B', 'B', 'C', 'D'))
574
        return AVPROBE_SCORE_MAX;
575
    else
576
        return 0;
577
}
578
#endif
579

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

    
600
#if CONFIG_AC3_DEMUXER || CONFIG_EAC3_DEMUXER
601
static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id)
602
{
603
    int max_frames, first_frames = 0, frames;
604
    uint8_t *buf, *buf2, *end;
605
    AC3HeaderInfo hdr;
606
    GetBitContext gbc;
607
    enum CodecID codec_id = CODEC_ID_AC3;
608

    
609
    max_frames = 0;
610
    buf = p->buf;
611
    end = buf + p->buf_size;
612

    
613
    for(; buf < end; buf++) {
614
        buf2 = buf;
615

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

    
642
#if CONFIG_AC3_DEMUXER
643
static int ac3_probe(AVProbeData *p)
644
{
645
    return ac3_eac3_probe(p, CODEC_ID_AC3);
646
}
647
#endif
648

    
649
#if CONFIG_EAC3_DEMUXER
650
static int eac3_probe(AVProbeData *p)
651
{
652
    return ac3_eac3_probe(p, CODEC_ID_EAC3);
653
}
654
#endif
655

    
656
#if CONFIG_AAC_DEMUXER
657
static int adts_aac_probe(AVProbeData *p)
658
{
659
    int max_frames = 0, first_frames = 0;
660
    int fsize, frames;
661
    uint8_t *buf0 = p->buf;
662
    uint8_t *buf2;
663
    uint8_t *buf;
664
    uint8_t *end = buf0 + p->buf_size - 7;
665

    
666
    if (ff_id3v2_match(buf0)) {
667
        buf0 += ff_id3v2_tag_len(buf0);
668
    }
669
    buf = buf0;
670

    
671
    for(; buf < end; buf= buf2+1) {
672
        buf2 = buf;
673

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

    
694
static int adts_aac_read_header(AVFormatContext *s,
695
                                AVFormatParameters *ap)
696
{
697
    AVStream *st;
698

    
699
    st = av_new_stream(s, 0);
700
    if (!st)
701
        return AVERROR(ENOMEM);
702

    
703
    st->codec->codec_type = CODEC_TYPE_AUDIO;
704
    st->codec->codec_id = s->iformat->value;
705
    st->need_parsing = AVSTREAM_PARSE_FULL;
706

    
707
    ff_id3v1_read(s);
708
    ff_id3v2_read(s);
709

    
710
    return 0;
711
}
712

    
713
#endif
714

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

    
717
#if CONFIG_AAC_DEMUXER
718
AVInputFormat aac_demuxer = {
719
    "aac",
720
    NULL_IF_CONFIG_SMALL("raw ADTS AAC"),
721
    0,
722
    adts_aac_probe,
723
    adts_aac_read_header,
724
    ff_raw_read_partial_packet,
725
    .flags= AVFMT_GENERIC_INDEX,
726
    .extensions = "aac",
727
    .value = CODEC_ID_AAC,
728
};
729
#endif
730

    
731
#if CONFIG_AC3_DEMUXER
732
AVInputFormat ac3_demuxer = {
733
    "ac3",
734
    NULL_IF_CONFIG_SMALL("raw AC-3"),
735
    0,
736
    ac3_probe,
737
    audio_read_header,
738
    ff_raw_read_partial_packet,
739
    .flags= AVFMT_GENERIC_INDEX,
740
    .extensions = "ac3",
741
    .value = CODEC_ID_AC3,
742
};
743
#endif
744

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

    
760
#if CONFIG_DIRAC_DEMUXER
761
AVInputFormat dirac_demuxer = {
762
    "dirac",
763
    NULL_IF_CONFIG_SMALL("raw Dirac"),
764
    0,
765
    dirac_probe,
766
    video_read_header,
767
    ff_raw_read_partial_packet,
768
    .flags= AVFMT_GENERIC_INDEX,
769
    .value = CODEC_ID_DIRAC,
770
};
771
#endif
772

    
773
#if CONFIG_DIRAC_MUXER
774
AVOutputFormat dirac_muxer = {
775
    "dirac",
776
    NULL_IF_CONFIG_SMALL("raw Dirac"),
777
    NULL,
778
    "drc",
779
    0,
780
    CODEC_ID_NONE,
781
    CODEC_ID_DIRAC,
782
    NULL,
783
    raw_write_packet,
784
    .flags= AVFMT_NOTIMESTAMPS,
785
};
786
#endif
787

    
788
#if CONFIG_DNXHD_DEMUXER
789
AVInputFormat dnxhd_demuxer = {
790
    "dnxhd",
791
    NULL_IF_CONFIG_SMALL("raw DNxHD (SMPTE VC-3)"),
792
    0,
793
    dnxhd_probe,
794
    video_read_header,
795
    ff_raw_read_partial_packet,
796
    .flags= AVFMT_GENERIC_INDEX,
797
    .value = CODEC_ID_DNXHD,
798
};
799
#endif
800

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

    
816
#if CONFIG_DTS_DEMUXER
817
AVInputFormat dts_demuxer = {
818
    "dts",
819
    NULL_IF_CONFIG_SMALL("raw DTS"),
820
    0,
821
    dts_probe,
822
    audio_read_header,
823
    ff_raw_read_partial_packet,
824
    .flags= AVFMT_GENERIC_INDEX,
825
    .extensions = "dts",
826
    .value = CODEC_ID_DTS,
827
};
828
#endif
829

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

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

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

    
874
#if CONFIG_GSM_DEMUXER
875
AVInputFormat gsm_demuxer = {
876
    "gsm",
877
    NULL_IF_CONFIG_SMALL("raw GSM"),
878
    0,
879
    NULL,
880
    audio_read_header,
881
    ff_raw_read_partial_packet,
882
    .flags= AVFMT_GENERIC_INDEX,
883
    .extensions = "gsm",
884
    .value = CODEC_ID_GSM,
885
};
886
#endif
887

    
888
#if CONFIG_H261_DEMUXER
889
AVInputFormat h261_demuxer = {
890
    "h261",
891
    NULL_IF_CONFIG_SMALL("raw H.261"),
892
    0,
893
    h261_probe,
894
    video_read_header,
895
    ff_raw_read_partial_packet,
896
    .flags= AVFMT_GENERIC_INDEX,
897
    .extensions = "h261",
898
    .value = CODEC_ID_H261,
899
};
900
#endif
901

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

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

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

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

    
960
#if CONFIG_H264_MUXER
961
AVOutputFormat h264_muxer = {
962
    "h264",
963
    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
964
    NULL,
965
    "h264",
966
    0,
967
    CODEC_ID_NONE,
968
    CODEC_ID_H264,
969
    NULL,
970
    raw_write_packet,
971
    .flags= AVFMT_NOTIMESTAMPS,
972
};
973
#endif
974

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

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

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

    
1018
#if CONFIG_MJPEG_DEMUXER
1019
AVInputFormat mjpeg_demuxer = {
1020
    "mjpeg",
1021
    NULL_IF_CONFIG_SMALL("raw MJPEG video"),
1022
    0,
1023
    NULL,
1024
    video_read_header,
1025
    ff_raw_read_partial_packet,
1026
    .flags= AVFMT_GENERIC_INDEX,
1027
    .extensions = "mjpg,mjpeg",
1028
    .value = CODEC_ID_MJPEG,
1029
};
1030
#endif
1031

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

    
1047
#if CONFIG_MLP_DEMUXER
1048
AVInputFormat mlp_demuxer = {
1049
    "mlp",
1050
    NULL_IF_CONFIG_SMALL("raw MLP"),
1051
    0,
1052
    NULL,
1053
    audio_read_header,
1054
    ff_raw_read_partial_packet,
1055
    .flags= AVFMT_GENERIC_INDEX,
1056
    .extensions = "mlp",
1057
    .value = CODEC_ID_MLP,
1058
};
1059
#endif
1060

    
1061
#if CONFIG_MLP_MUXER
1062
AVOutputFormat mlp_muxer = {
1063
    "mlp",
1064
    NULL_IF_CONFIG_SMALL("raw MLP"),
1065
    NULL,
1066
    "mlp",
1067
    0,
1068
    CODEC_ID_MLP,
1069
    CODEC_ID_NONE,
1070
    NULL,
1071
    raw_write_packet,
1072
    .flags= AVFMT_NOTIMESTAMPS,
1073
};
1074
#endif
1075

    
1076
#if CONFIG_TRUEHD_DEMUXER
1077
AVInputFormat truehd_demuxer = {
1078
    "truehd",
1079
    NULL_IF_CONFIG_SMALL("raw TrueHD"),
1080
    0,
1081
    NULL,
1082
    audio_read_header,
1083
    ff_raw_read_partial_packet,
1084
    .flags= AVFMT_GENERIC_INDEX,
1085
    .extensions = "thd",
1086
    .value = CODEC_ID_TRUEHD,
1087
};
1088
#endif
1089

    
1090
#if CONFIG_TRUEHD_MUXER
1091
AVOutputFormat truehd_muxer = {
1092
    "truehd",
1093
    NULL_IF_CONFIG_SMALL("raw TrueHD"),
1094
    NULL,
1095
    "thd",
1096
    0,
1097
    CODEC_ID_TRUEHD,
1098
    CODEC_ID_NONE,
1099
    NULL,
1100
    raw_write_packet,
1101
    .flags= AVFMT_NOTIMESTAMPS,
1102
};
1103
#endif
1104

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

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

    
1135
#if CONFIG_MPEGVIDEO_DEMUXER
1136
AVInputFormat mpegvideo_demuxer = {
1137
    "mpegvideo",
1138
    NULL_IF_CONFIG_SMALL("raw MPEG video"),
1139
    0,
1140
    mpegvideo_probe,
1141
    video_read_header,
1142
    ff_raw_read_partial_packet,
1143
    .flags= AVFMT_GENERIC_INDEX,
1144
    .value = CODEC_ID_MPEG1VIDEO,
1145
};
1146
#endif
1147

    
1148
#if CONFIG_CAVSVIDEO_DEMUXER
1149
AVInputFormat cavsvideo_demuxer = {
1150
    "cavsvideo",
1151
    NULL_IF_CONFIG_SMALL("raw Chinese AVS video"),
1152
    0,
1153
    cavsvideo_probe,
1154
    video_read_header,
1155
    ff_raw_read_partial_packet,
1156
    .flags= AVFMT_GENERIC_INDEX,
1157
    .value = CODEC_ID_CAVS,
1158
};
1159
#endif
1160

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

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

    
1194
#if CONFIG_RAWVIDEO_MUXER
1195
AVOutputFormat rawvideo_muxer = {
1196
    "rawvideo",
1197
    NULL_IF_CONFIG_SMALL("raw video format"),
1198
    NULL,
1199
    "yuv,rgb",
1200
    0,
1201
    CODEC_ID_NONE,
1202
    CODEC_ID_RAWVIDEO,
1203
    NULL,
1204
    raw_write_packet,
1205
    .flags= AVFMT_NOTIMESTAMPS,
1206
};
1207
#endif
1208

    
1209
#if CONFIG_ROQ_MUXER
1210
AVOutputFormat roq_muxer =
1211
{
1212
    "RoQ",
1213
    NULL_IF_CONFIG_SMALL("raw id RoQ format"),
1214
    NULL,
1215
    "roq",
1216
    0,
1217
    CODEC_ID_ROQ_DPCM,
1218
    CODEC_ID_ROQ,
1219
    roq_write_header,
1220
    raw_write_packet,
1221
};
1222
#endif
1223

    
1224
#if CONFIG_SHORTEN_DEMUXER
1225
AVInputFormat shorten_demuxer = {
1226
    "shn",
1227
    NULL_IF_CONFIG_SMALL("raw Shorten"),
1228
    0,
1229
    NULL,
1230
    audio_read_header,
1231
    ff_raw_read_partial_packet,
1232
    .flags= AVFMT_GENERIC_INDEX,
1233
    .extensions = "shn",
1234
    .value = CODEC_ID_SHORTEN,
1235
};
1236
#endif
1237

    
1238
#if CONFIG_VC1_DEMUXER
1239
AVInputFormat vc1_demuxer = {
1240
    "vc1",
1241
    NULL_IF_CONFIG_SMALL("raw VC-1"),
1242
    0,
1243
    NULL /* vc1_probe */,
1244
    video_read_header,
1245
    ff_raw_read_partial_packet,
1246
    .extensions = "vc1",
1247
    .value = CODEC_ID_VC1,
1248
};
1249
#endif
1250

    
1251
/* PCM formats */
1252

    
1253
#define PCMINPUTDEF(name, long_name, ext, codec) \
1254
AVInputFormat pcm_ ## name ## _demuxer = {\
1255
    #name,\
1256
    NULL_IF_CONFIG_SMALL(long_name),\
1257
    0,\
1258
    NULL,\
1259
    raw_read_header,\
1260
    raw_read_packet,\
1261
    NULL,\
1262
    pcm_read_seek,\
1263
    .flags= AVFMT_GENERIC_INDEX,\
1264
    .extensions = ext,\
1265
    .value = codec,\
1266
};
1267

    
1268
#define PCMOUTPUTDEF(name, long_name, ext, codec) \
1269
AVOutputFormat pcm_ ## name ## _muxer = {\
1270
    #name,\
1271
    NULL_IF_CONFIG_SMALL(long_name),\
1272
    NULL,\
1273
    ext,\
1274
    0,\
1275
    codec,\
1276
    CODEC_ID_NONE,\
1277
    NULL,\
1278
    raw_write_packet,\
1279
    .flags= AVFMT_NOTIMESTAMPS,\
1280
};
1281

    
1282

    
1283
#if  !CONFIG_MUXERS && CONFIG_DEMUXERS
1284
#define PCMDEF(name, long_name, ext, codec) \
1285
        PCMINPUTDEF(name, long_name, ext, codec)
1286
#elif CONFIG_MUXERS && !CONFIG_DEMUXERS
1287
#define PCMDEF(name, long_name, ext, codec) \
1288
        PCMOUTPUTDEF(name, long_name, ext, codec)
1289
#elif CONFIG_MUXERS && CONFIG_DEMUXERS
1290
#define PCMDEF(name, long_name, ext, codec) \
1291
        PCMINPUTDEF(name, long_name, ext, codec)\
1292
        PCMOUTPUTDEF(name, long_name, ext, codec)
1293
#else
1294
#define PCMDEF(name, long_name, ext, codec)
1295
#endif
1296

    
1297
#if HAVE_BIGENDIAN
1298
#define BE_DEF(s) s
1299
#define LE_DEF(s) NULL
1300
#else
1301
#define BE_DEF(s) NULL
1302
#define LE_DEF(s) s
1303
#endif
1304

    
1305
PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
1306
       NULL, CODEC_ID_PCM_F64BE)
1307

    
1308
PCMDEF(f64le, "PCM 64 bit floating-point little-endian format",
1309
       NULL, CODEC_ID_PCM_F64LE)
1310

    
1311
PCMDEF(f32be, "PCM 32 bit floating-point big-endian format",
1312
       NULL, CODEC_ID_PCM_F32BE)
1313

    
1314
PCMDEF(f32le, "PCM 32 bit floating-point little-endian format",
1315
       NULL, CODEC_ID_PCM_F32LE)
1316

    
1317
PCMDEF(s32be, "PCM signed 32 bit big-endian format",
1318
       NULL, CODEC_ID_PCM_S32BE)
1319

    
1320
PCMDEF(s32le, "PCM signed 32 bit little-endian format",
1321
       NULL, CODEC_ID_PCM_S32LE)
1322

    
1323
PCMDEF(s24be, "PCM signed 24 bit big-endian format",
1324
       NULL, CODEC_ID_PCM_S24BE)
1325

    
1326
PCMDEF(s24le, "PCM signed 24 bit little-endian format",
1327
       NULL, CODEC_ID_PCM_S24LE)
1328

    
1329
PCMDEF(s16be, "PCM signed 16 bit big-endian format",
1330
       BE_DEF("sw"), CODEC_ID_PCM_S16BE)
1331

    
1332
PCMDEF(s16le, "PCM signed 16 bit little-endian format",
1333
       LE_DEF("sw"), CODEC_ID_PCM_S16LE)
1334

    
1335
PCMDEF(s8, "PCM signed 8 bit format",
1336
       "sb", CODEC_ID_PCM_S8)
1337

    
1338
PCMDEF(u32be, "PCM unsigned 32 bit big-endian format",
1339
       NULL, CODEC_ID_PCM_U32BE)
1340

    
1341
PCMDEF(u32le, "PCM unsigned 32 bit little-endian format",
1342
       NULL, CODEC_ID_PCM_U32LE)
1343

    
1344
PCMDEF(u24be, "PCM unsigned 24 bit big-endian format",
1345
       NULL, CODEC_ID_PCM_U24BE)
1346

    
1347
PCMDEF(u24le, "PCM unsigned 24 bit little-endian format",
1348
       NULL, CODEC_ID_PCM_U24LE)
1349

    
1350
PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
1351
       BE_DEF("uw"), CODEC_ID_PCM_U16BE)
1352

    
1353
PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
1354
       LE_DEF("uw"), CODEC_ID_PCM_U16LE)
1355

    
1356
PCMDEF(u8, "PCM unsigned 8 bit format",
1357
       "ub", CODEC_ID_PCM_U8)
1358

    
1359
PCMDEF(alaw, "PCM A-law format",
1360
       "al", CODEC_ID_PCM_ALAW)
1361

    
1362
PCMDEF(mulaw, "PCM mu-law format",
1363
       "ul", CODEC_ID_PCM_MULAW)