summaryrefslogtreecommitdiff
path: root/libavcodec/pgssubdec.c
diff options
context:
space:
mode:
authorJohn Stebbins <stebbins@jetheaddev.com>2014-06-18 13:38:36 -0700
committerMichael Niedermayer <michaelni@gmx.at>2014-06-30 17:24:47 +0200
commit4701f7676ce9b2e9672960c12348b7de447419b2 (patch)
tree109f1eda00d96ba6c31198fabe79df3dc3808812 /libavcodec/pgssubdec.c
parentca7f2a737256c2ed59955b600554a12af0ec82af (diff)
downloadffmpeg-4701f7676ce9b2e9672960c12348b7de447419b2.tar.gz
avcodec/pgssubdec: split out flush_cache()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pgssubdec.c')
-rw-r--r--libavcodec/pgssubdec.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index f572d81bcf..63346c08f1 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -73,18 +73,10 @@ typedef struct PGSSubContext {
int forced_subs_only;
} PGSSubContext;
-static av_cold int init_decoder(AVCodecContext *avctx)
+static void flush_cache(AVCodecContext *avctx)
{
- avctx->pix_fmt = AV_PIX_FMT_PAL8;
-
- return 0;
-}
-
-static av_cold int close_decoder(AVCodecContext *avctx)
-{
- uint16_t picture;
-
PGSSubContext *ctx = avctx->priv_data;
+ uint16_t picture;
av_freep(&ctx->presentation.objects);
ctx->presentation.object_count = 0;
@@ -93,6 +85,18 @@ static av_cold int close_decoder(AVCodecContext *avctx)
av_freep(&ctx->pictures[picture].rle);
ctx->pictures[picture].rle_buffer_size = 0;
}
+}
+
+static av_cold int init_decoder(AVCodecContext *avctx)
+{
+ avctx->pix_fmt = AV_PIX_FMT_PAL8;
+
+ return 0;
+}
+
+static av_cold int close_decoder(AVCodecContext *avctx)
+{
+ flush_cache(avctx);
return 0;
}