* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intmath.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"
+#include "mathops.h"
#define ROQ_FRAME_SIZE 735
#define ROQ_HEADER_SIZE 8
{
ROQDPCMContext *context = avctx->priv_data;
-#if FF_API_OLD_ENCODE_AUDIO
- av_freep(&avctx->coded_frame);
-#endif
av_freep(&context->frame_buffer);
return 0;
context->lastSample[0] = context->lastSample[1] = 0;
-#if FF_API_OLD_ENCODE_AUDIO
- avctx->coded_frame= avcodec_alloc_frame();
- if (!avctx->coded_frame) {
- ret = AVERROR(ENOMEM);
- goto error;
- }
-#endif
-
return 0;
error:
roq_dpcm_encode_close(avctx);
context->input_frames++;
return 0;
}
- in = context->frame_buffer;
}
+ if (context->input_frames < 8)
+ in = context->frame_buffer;
if (stereo) {
context->lastSample[0] &= 0xFF00;
context->lastSample[1] &= 0xFF00;
}
- if (context->input_frames == 7 || !in)
+ if (context->input_frames == 7)
data_size = avctx->channels * context->buffered_samples;
else
data_size = avctx->channels * avctx->frame_size;
AVCodec ff_roq_dpcm_encoder = {
.name = "roq_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_ROQ_DPCM,
+ .id = AV_CODEC_ID_ROQ_DPCM,
.priv_data_size = sizeof(ROQDPCMContext),
.init = roq_dpcm_encode_init,
.encode2 = roq_dpcm_encode_frame,
.close = roq_dpcm_encode_close,
.capabilities = CODEC_CAP_DELAY,
- .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
- .long_name = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
+ .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
+ AV_SAMPLE_FMT_NONE },
};