I'm trying to decode the audio track from an mp4 file that can play audio in other media players.  However, when I look at the audio in the frame that I decode, it's all set to 0 (or sometimes -0.  The format type is AV_SAMPLE_FMT_FLTP).<br /><br />I've been using decode_audio.c to help guild me in writing the code.  My packet decoding looks like:<br /><br />    int err = avcodec_send_packet(aCodecCtx, &packet);<br />    if (err < 0)<br />    {<br />        qDebug() << "Error sending packet to decoder";<br />        return;<br />    }<br />    <br />    while (err >= 0)<br />    {<br />        err = avcodec_receive_frame(aCodecCtx, aFrame);<br />        if (err == AVERROR(EAGAIN) || err == AVERROR_EOF)<br />            return;<br /><br />        if (err < 0)<br />        {<br />            qDebug() << "Error decoding packet: " << err;<br />            return;<br />        }<br /><br />        int data_size = av_get_bytes_per_sample(aCodecCtx->sample_fmt);<br />        if (data_size < 0) {<br />            /* This should not occur, checking just for paranoia */<br />            fprintf(stderr, "Failed to calculate data size\n");<br />            exit(1);<br />        }<br /><br />        for (int i = 0; i < aFrame->nb_samples; i++)<br />            for (int ch = 0; ch < aCodecCtx->channels; ch++)<br />            {<br />                float val = 0;<br />                switch (aCodecCtx->sample_fmt)<br />                {<br />                ...<br />                case AV_SAMPLE_FMT_FLT:<br />                case AV_SAMPLE_FMT_FLTP:<br />                {<br />                    uint8_t *byteBuffer = aFrame->data[ch];<br />                    float* buffer = (float *)byteBuffer;<br />                    val = buffer[i];<br />                    break;<br />                }<br />                ...<br />            }<br />            <br />            _audioBuffer.write((const char *)&val, sizeof(float));<br />        }<br />    }<br /><br />Basically I'm trying to write the audio data as a series of floats to an output file.  I'm not getting any error codes, but the data is all 0 or values with small exponents.  <br /><br />The nm_samples is 1024, the data format is AV_SAMPLE_FMT_FLTP and there are 2 channels.  Is there something I'm doing wrong here?