avformat/mpeg: demux ivtv captions
[ffmpeg.git] / libavcodec / zlib_wrapper.h
blobfa8ee654fd56279873fd5343fb82893c7c4f5d95
1 /*
2 * Wrappers for zlib
3 * Copyright (C) 2022 Andreas Rheinhardt
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef AVCODEC_ZLIB_WRAPPER_H
23 #define AVCODEC_ZLIB_WRAPPER_H
25 #include <zlib.h>
27 typedef struct FFZStream {
28 z_stream zstream;
29 int inited;
30 } FFZStream;
32 /**
33 * Wrapper around inflateInit(). It initializes the fields that zlib
34 * requires to be initialized before inflateInit().
35 * In case of error it also returns an error message to the provided logctx;
36 * in any case, it sets zstream->inited to indicate whether inflateInit()
37 * succeeded.
38 * @return Returns 0 on success or a negative error code on failure
40 int ff_inflate_init(FFZStream *zstream, void *logctx);
42 /**
43 * Wrapper around inflateEnd(). It calls inflateEnd() iff
44 * zstream->inited is set and resets zstream->inited.
45 * It is therefore safe to be called even if
46 * ff_inflate_init() has never been called on it (or errored out)
47 * provided that the FFZStream (or just FFZStream.inited) has been zeroed.
49 void ff_inflate_end(FFZStream *zstream);
51 /**
52 * Wrapper around deflateInit(). It works analogously to ff_inflate_init().
54 int ff_deflate_init(FFZStream *zstream, int level, void *logctx);
56 /**
57 * Wrapper around deflateEnd(). It works analogously to ff_inflate_end().
59 void ff_deflate_end(FFZStream *zstream);
61 #endif /* AVCODEC_ZLIB_WRAPPER_H */