Revision 1d7d9935 libavformat/asf-enc.c

View differences:

libavformat/asf-enc.c
196 196

  
197 197
static int preroll_time = 3100;
198 198

  
199
static const uint8_t error_spread_ADPCM_G726[] = { 0x01, 0x90, 0x01, 0x90, 0x01, 0x01, 0x00, 0x00 };
200

  
201 199
static void put_guid(ByteIOContext *s, const GUID *g)
202 200
{
203 201
    assert(sizeof(*g) == 16);
......
345 343
    /* stream headers */
346 344
    for(n=0;n<s->nb_streams;n++) {
347 345
        int64_t es_pos;
348
        const uint8_t *er_spr = NULL;
349
        int er_spr_len = 0;
350 346
        //        ASFStream *stream = &asf->streams[n];
351 347

  
352 348
        enc = s->streams[n]->codec;
......
354 350
        asf->streams[n].seq = 0;
355 351

  
356 352

  
357
        if (enc->codec_type == CODEC_TYPE_AUDIO) {
358
            if (enc->codec_id == CODEC_ID_ADPCM_G726) {
359
                er_spr     = error_spread_ADPCM_G726;
360
                er_spr_len = sizeof(error_spread_ADPCM_G726);
361
            }
362
        }
363

  
364 353
        switch(enc->codec_type) {
365 354
        case CODEC_TYPE_AUDIO:
366 355
            wav_extra_size = 0;
367 356
            extra_size = 18 + wav_extra_size;
368
            extra_size2 = er_spr_len;
357
            extra_size2 = 8;
369 358
            break;
370 359
        default:
371 360
        case CODEC_TYPE_VIDEO:
......
378 367
        hpos = put_header(pb, &stream_header);
379 368
        if (enc->codec_type == CODEC_TYPE_AUDIO) {
380 369
            put_guid(pb, &audio_stream);
381
            if ((er_spr != NULL) && (er_spr_len != 0)) {
382
                put_guid(pb, &audio_conceal_spread);
383
            } else {
384
                put_guid(pb, &video_conceal_none);
385
            }
370
            put_guid(pb, &audio_conceal_spread);
386 371
        } else {
387 372
            put_guid(pb, &video_stream);
388 373
            put_guid(pb, &video_conceal_none);
......
411 396
                url_fseek(pb, cur_pos, SEEK_SET);
412 397
            }
413 398
            /* ERROR Correction */
414
            if ((er_spr != NULL) && (er_spr_len != 0))
415
                put_buffer(pb, er_spr, er_spr_len);
399
            put_byte(pb, 0x01);
400
            if(enc->codec_id == CODEC_ID_ADPCM_G726 || !enc->block_align){
401
                put_le16(pb, 0x0190);
402
                put_le16(pb, 0x0190);
403
            }else{
404
                put_le16(pb, enc->block_align);
405
                put_le16(pb, enc->block_align);
406
            }
407
            put_le16(pb, 0x01);
408
            put_byte(pb, 0x00);
416 409
        } else {
417 410
            put_le32(pb, enc->width);
418 411
            put_le32(pb, enc->height);

Also available in: Unified diff