aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2012-01-13 00:40:10 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-20 15:08:41 -0500
commit2460b168b4ca308504ee9f7966e3e4cfb3fc90e6 (patch)
tree9505a26174bdf2625c20d54aa2d432887b8506d5
parent7575ffac8a2da4c03a606f6a94286979d953dde5 (diff)
downloadffmpeg-2460b168b4ca308504ee9f7966e3e4cfb3fc90e6.tar.gz
gsm parser: set duration
-rw-r--r--libavcodec/gsm_parser.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index a2965d3fb5..89afe80ef0 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -31,6 +31,7 @@
typedef struct GSMParseContext {
ParseContext pc;
int block_size;
+ int duration;
int remaining;
} GSMParseContext;
@@ -44,8 +45,14 @@ 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 CODEC_ID_GSM:
+ s->block_size = GSM_BLOCK_SIZE;
+ s->duration = GSM_FRAME_SIZE;
+ break;
+ case CODEC_ID_GSM_MS:
+ s->block_size = GSM_MS_BLOCK_SIZE;
+ s->duration = GSM_FRAME_SIZE * 2;
+ break;
default:
return AVERROR(EINVAL);
}
@@ -66,6 +73,9 @@ 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;