Statistics
| Branch: | Revision:

ffmpeg / libavformat / raw.c @ f76eef99

History | View | Annotate | Download (32.5 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
    if(valid_psc > 2*invalid_psc + 2*res_change + 2){
477
        return 50;
478
    }else if(valid_psc > 2*invalid_psc)
479
        return 25;
480
    return 0;
481
}
482
#endif
483

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

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

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

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

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

    
533
    buf = p->buf;
534

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

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

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

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

    
560
    return 0;
561
}
562
#endif
563

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
704
    return 0;
705
}
706

    
707
#endif
708

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1245
/* PCM formats */
1246

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

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

    
1276

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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