]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/gsm_parser.c
h263: Drop uninitialized variable use from log message
[ffmpeg] / libavcodec / gsm_parser.c
index a2965d3fb52f43bc6e22bfa2aa14151ea229e420..c0befc779693fc671f72157f45f1ce9d1eab7e88 100644 (file)
@@ -31,6 +31,7 @@
 typedef struct GSMParseContext {
     ParseContext pc;
     int block_size;
+    int duration;
     int remaining;
 } GSMParseContext;
 
@@ -44,8 +45,15 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
 
     if (!s->block_size) {
         switch (avctx->codec_id) {
-        case CODEC_ID_GSM:    s->block_size = GSM_BLOCK_SIZE;    break;
-        case CODEC_ID_GSM_MS: s->block_size = GSM_MS_BLOCK_SIZE; break;
+        case AV_CODEC_ID_GSM:
+            s->block_size = GSM_BLOCK_SIZE;
+            s->duration   = GSM_FRAME_SIZE;
+            break;
+        case AV_CODEC_ID_GSM_MS:
+            s->block_size = avctx->block_align ? avctx->block_align
+                                               : GSM_MS_BLOCK_SIZE;
+            s->duration   = GSM_FRAME_SIZE * 2;
+            break;
         default:
             return AVERROR(EINVAL);
         }
@@ -66,13 +74,16 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
         *poutbuf_size = 0;
         return buf_size;
     }
+
+    s1->duration = s->duration;
+
     *poutbuf      = buf;
     *poutbuf_size = buf_size;
     return next;
 }
 
 AVCodecParser ff_gsm_parser = {
-    .codec_ids      = { CODEC_ID_GSM, CODEC_ID_GSM_MS },
+    .codec_ids      = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS },
     .priv_data_size = sizeof(GSMParseContext),
     .parser_parse   = gsm_parse,
     .parser_close   = ff_parse_close,