diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-20 13:21:28 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-20 18:34:48 +0200 |
commit | 913aa4204a2a2e0f3588f628441bf8d6edc12db7 (patch) | |
tree | a4dc1c28b3b1d1a20cc731d7cf78ea0819d5fbab /libavformat/swfdec.c | |
parent | bc0e776c9aaf06f437bf21e05a713fd54dc85400 (diff) |
avformat/swf: Separate mux and demux contexts
There was almost no overlap between them: The only field used by both
was an int named samples_per_frame. Therefore this commit separates
them.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/swfdec.c')
-rw-r--r-- | libavformat/swfdec.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index e427998744..7ca8460420 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -34,6 +34,18 @@ #include "libavcodec/get_bits.h" #include "swf.h" +typedef struct SWFDecContext { + int samples_per_frame; + int frame_rate; +#if CONFIG_ZLIB +#define ZBUF_SIZE 4096 + AVIOContext *zpb; + uint8_t *zbuf_in; + uint8_t *zbuf_out; + z_stream zstream; +#endif +} SWFDecContext; + static const AVCodecTag swf_audio_codec_tags[] = { { AV_CODEC_ID_PCM_S16LE, 0x00 }, { AV_CODEC_ID_ADPCM_SWF, 0x01 }, @@ -101,7 +113,7 @@ static int swf_probe(const AVProbeData *p) static int zlib_refill(void *opaque, uint8_t *buf, int buf_size) { AVFormatContext *s = opaque; - SWFContext *swf = s->priv_data; + SWFDecContext *swf = s->priv_data; z_stream *z = &swf->zstream; int ret; @@ -132,7 +144,7 @@ retry: static int swf_read_header(AVFormatContext *s) { - SWFContext *swf = s->priv_data; + SWFDecContext *swf = s->priv_data; AVIOContext *pb = s->pb; int nbits, len, tag; @@ -202,7 +214,7 @@ static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info) static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) { - SWFContext *swf = s->priv_data; + SWFDecContext *swf = s->priv_data; AVIOContext *pb = s->pb; AVStream *vst = NULL, *ast = NULL, *st = 0; int tag, len, i, frame, v, res; @@ -525,7 +537,7 @@ bitmap_end_skip: #if CONFIG_ZLIB static av_cold int swf_read_close(AVFormatContext *avctx) { - SWFContext *s = avctx->priv_data; + SWFDecContext *s = avctx->priv_data; inflateEnd(&s->zstream); av_freep(&s->zbuf_in); av_freep(&s->zbuf_out); @@ -537,7 +549,7 @@ static av_cold int swf_read_close(AVFormatContext *avctx) AVInputFormat ff_swf_demuxer = { .name = "swf", .long_name = NULL_IF_CONFIG_SMALL("SWF (ShockWave Flash)"), - .priv_data_size = sizeof(SWFContext), + .priv_data_size = sizeof(SWFDecContext), .read_probe = swf_probe, .read_header = swf_read_header, .read_packet = swf_read_packet, |