Revision d4e0130e

View differences:

libavformat/mov.c
1227 1227
    case CODEC_ID_GSM:
1228 1228
    case CODEC_ID_ADPCM_MS:
1229 1229
    case CODEC_ID_ADPCM_IMA_WAV:
1230
        st->codec->frame_size = sc->samples_per_frame;
1230 1231
        st->codec->block_align = sc->bytes_per_frame;
1231 1232
        break;
1232 1233
    case CODEC_ID_ALAC:
libavformat/movenc.c
314 314
           codec_id == CODEC_ID_PCM_F64LE;
315 315
}
316 316

  
317
static int mov_write_ms_tag(ByteIOContext *pb, MOVTrack *track)
318
{
319
    int64_t pos = url_ftell(pb);
320
    put_be32(pb, 0);
321
    put_le32(pb, track->tag);
322
    track->enc->codec_tag = track->tag >> 16;
323
    ff_put_wav_header(pb, track->enc);
324
    return updateSize(pb, pos);
325
}
326

  
317 327
static int mov_write_wave_tag(ByteIOContext *pb, MOVTrack *track)
318 328
{
319 329
    int64_t pos = url_ftell(pb);
......
339 349
        mov_write_ac3_tag(pb, track);
340 350
    } else if (track->enc->codec_id == CODEC_ID_ALAC) {
341 351
        mov_write_extradata_tag(pb, track);
352
    } else if (track->enc->codec_id == CODEC_ID_ADPCM_MS ||
353
               track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
354
        mov_write_ms_tag(pb, track);
342 355
    }
343 356

  
344 357
    put_be32(pb, 8);     /* size */
......
395 408
            if (mov_get_lpcm_flags(track->enc->codec_id))
396 409
                tag = AV_RL32("lpcm");
397 410
            version = 2;
398
        } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id)) {
411
        } else if (track->audio_vbr || mov_pcm_le_gt16(track->enc->codec_id) ||
412
                   track->enc->codec_id == CODEC_ID_ADPCM_MS ||
413
                   track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
399 414
            version = 1;
400 415
        }
401 416
    }
......
457 472
        track->enc->codec_id == CODEC_ID_AC3 ||
458 473
        track->enc->codec_id == CODEC_ID_AMR_NB ||
459 474
        track->enc->codec_id == CODEC_ID_ALAC ||
475
        track->enc->codec_id == CODEC_ID_ADPCM_MS ||
476
        track->enc->codec_id == CODEC_ID_ADPCM_IMA_WAV ||
460 477
        mov_pcm_le_gt16(track->enc->codec_id)))
461 478
        mov_write_wave_tag(pb, track);
462 479
    else if(track->tag == MKTAG('m','p','4','a'))
......
1909 1926
            av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
1910 1927
            return -1;
1911 1928
        }
1929
    } else if (enc->codec_id == CODEC_ID_ADPCM_MS ||
1930
               enc->codec_id == CODEC_ID_ADPCM_IMA_WAV) {
1931
        samplesInChunk = enc->frame_size;
1912 1932
    } else if (trk->sampleSize)
1913 1933
        samplesInChunk = size/trk->sampleSize;
1914 1934
    else
......
2108 2128
            if(!st->codec->frame_size && !av_get_bits_per_sample(st->codec->codec_id)) {
2109 2129
                av_log(s, AV_LOG_ERROR, "track %d: codec frame size is not set\n", i);
2110 2130
                goto error;
2131
            }else if(st->codec->codec_id == CODEC_ID_ADPCM_MS ||
2132
                     st->codec->codec_id == CODEC_ID_ADPCM_IMA_WAV){
2133
                if (!st->codec->block_align) {
2134
                    av_log(s, AV_LOG_ERROR, "track %d: codec block align is not set for adpcm\n", i);
2135
                    goto error;
2136
                }
2137
                track->sampleSize = st->codec->block_align;
2111 2138
            }else if(st->codec->frame_size > 1){ /* assume compressed audio */
2112 2139
                track->audio_vbr = 1;
2113 2140
            }else{

Also available in: Unified diff