]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/roqaudioenc.c
h264: add H264_ prefix to the NAL unit types
[ffmpeg] / libavcodec / roqaudioenc.c
index d440fbe9448c055aa3bff11203c6a65c6bf5af5c..f687f5cd9d9294737a84b2136679eba9d381143f 100644 (file)
@@ -32,8 +32,7 @@
 #define MAX_DPCM (127*127)
 
 
-typedef struct
-{
+typedef struct ROQDPCMContext {
     short lastSample[2];
     int input_frames;
     int buffered_samples;
@@ -147,15 +146,16 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
             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;
@@ -193,14 +193,14 @@ static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
 AVCodec ff_roq_dpcm_encoder = {
     .name           = "roq_dpcm",
+    .long_name      = NULL_IF_CONFIG_SMALL("id RoQ DPCM"),
     .type           = AVMEDIA_TYPE_AUDIO,
     .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,
+    .capabilities   = AV_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"),
 };