Revision a0af2fa4 libavformat/raw.c

View differences:

libavformat/raw.c
221 221
    return 0;
222 222
}
223 223

  
224
/* ac3 read */
225
static int ac3_read_header(AVFormatContext *s,
226
                           AVFormatParameters *ap)
227
{
228
    AVStream *st;
229

  
230
    st = av_new_stream(s, 0);
231
    if (!st)
232
        return AVERROR(ENOMEM);
233

  
234
    st->codec->codec_type = CODEC_TYPE_AUDIO;
235
    st->codec->codec_id = CODEC_ID_AC3;
236
    st->need_parsing = AVSTREAM_PARSE_FULL;
237
    /* the parameters will be extracted from the compressed bitstream */
238
    return 0;
239
}
240

  
241
static int shorten_read_header(AVFormatContext *s,
242
                               AVFormatParameters *ap)
243
{
244
    AVStream *st;
245

  
246
    st = av_new_stream(s, 0);
247
    if (!st)
248
        return AVERROR(ENOMEM);
249
    st->codec->codec_type = CODEC_TYPE_AUDIO;
250
    st->codec->codec_id = CODEC_ID_SHORTEN;
251
    st->need_parsing = AVSTREAM_PARSE_FULL;
252
    /* the parameters will be extracted from the compressed bitstream */
253
    return 0;
254
}
255

  
256
/* flac read */
257
static int flac_read_header(AVFormatContext *s,
258
                            AVFormatParameters *ap)
259
{
260
    AVStream *st;
261

  
262
    st = av_new_stream(s, 0);
263
    if (!st)
264
        return AVERROR(ENOMEM);
265
    st->codec->codec_type = CODEC_TYPE_AUDIO;
266
    st->codec->codec_id = CODEC_ID_FLAC;
267
    st->need_parsing = AVSTREAM_PARSE_FULL;
268
    /* the parameters will be extracted from the compressed bitstream */
269
    return 0;
270
}
271

  
272
/* dts read */
273
static int dts_read_header(AVFormatContext *s,
274
                           AVFormatParameters *ap)
275
{
276
    AVStream *st;
277

  
278
    st = av_new_stream(s, 0);
279
    if (!st)
280
        return AVERROR(ENOMEM);
281

  
282
    st->codec->codec_type = CODEC_TYPE_AUDIO;
283
    st->codec->codec_id = CODEC_ID_DTS;
284
    st->need_parsing = AVSTREAM_PARSE_FULL;
285
    /* the parameters will be extracted from the compressed bitstream */
286
    return 0;
287
}
288

  
289
/* aac read */
290
static int aac_read_header(AVFormatContext *s,
291
                           AVFormatParameters *ap)
224
static int audio_read_header(AVFormatContext *s,
225
                             AVFormatParameters *ap)
292 226
{
293
    AVStream *st;
294

  
295
    st = av_new_stream(s, 0);
227
    AVStream *st = av_new_stream(s, 0);
296 228
    if (!st)
297 229
        return AVERROR(ENOMEM);
298

  
299 230
    st->codec->codec_type = CODEC_TYPE_AUDIO;
300
    st->codec->codec_id = CODEC_ID_AAC;
231
    st->codec->codec_id = s->iformat->value;
301 232
    st->need_parsing = AVSTREAM_PARSE_FULL;
302 233
    /* the parameters will be extracted from the compressed bitstream */
303 234
    return 0;
......
459 390
    "raw shorten",
460 391
    0,
461 392
    NULL,
462
    shorten_read_header,
393
    audio_read_header,
463 394
    raw_read_partial_packet,
464 395
    raw_read_close,
465 396
    .flags= AVFMT_GENERIC_INDEX,
466 397
    .extensions = "shn",
398
    .value = CODEC_ID_SHORTEN,
467 399
};
468 400

  
469 401
AVInputFormat flac_demuxer = {
......
471 403
    "raw flac",
472 404
    0,
473 405
    flac_probe,
474
    flac_read_header,
406
    audio_read_header,
475 407
    raw_read_partial_packet,
476 408
    raw_read_close,
477 409
    .flags= AVFMT_GENERIC_INDEX,
478 410
    .extensions = "flac",
411
    .value = CODEC_ID_FLAC,
479 412
};
480 413

  
481 414
#ifdef CONFIG_MUXERS
......
499 432
    "raw ac3",
500 433
    0,
501 434
    ac3_probe,
502
    ac3_read_header,
435
    audio_read_header,
503 436
    raw_read_partial_packet,
504 437
    raw_read_close,
505 438
    .flags= AVFMT_GENERIC_INDEX,
506 439
    .extensions = "ac3",
440
    .value = CODEC_ID_AC3,
507 441
};
508 442
#endif
509 443

  
......
541 475
    "raw dts",
542 476
    0,
543 477
    NULL,
544
    dts_read_header,
478
    audio_read_header,
545 479
    raw_read_partial_packet,
546 480
    raw_read_close,
547 481
    .flags= AVFMT_GENERIC_INDEX,
548 482
    .extensions = "dts",
483
    .value = CODEC_ID_DTS,
549 484
};
550 485

  
551 486
AVInputFormat aac_demuxer = {
......
553 488
    "ADTS AAC",
554 489
    0,
555 490
    NULL,
556
    aac_read_header,
491
    audio_read_header,
557 492
    raw_read_partial_packet,
558 493
    raw_read_close,
559 494
    .flags= AVFMT_GENERIC_INDEX,
560 495
    .extensions = "aac",
496
    .value = CODEC_ID_AAC,
561 497
};
562 498

  
563 499
#ifdef CONFIG_ROQ_MUXER

Also available in: Unified diff