avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h

It only uses an AVIOContext and an AVBPrint.

When doing so, it turned out that several non-users of
ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata()
relied on libavformat/internal.h to include bprint.h or avstring.h
for them. In order to avoid a repeat of this and in order to reduce
unnecessary dependencies, a forward declaration of struct AVBPrint is
used instead of including bprint.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-07-23 04:01:44 +02:00
parent 642b202567
commit fd101c9c3b
17 changed files with 30 additions and 15 deletions

View File

@ -33,6 +33,7 @@
#include <stdatomic.h>
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "v4l2-common.h"
#include <dirent.h>

View File

@ -25,6 +25,7 @@
#include "avformat.h"
#include "internal.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/tea.h"

View File

@ -19,6 +19,7 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "libavutil/channel_layout.h"

View File

@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "avformat.h"
#include "internal.h"

View File

@ -27,6 +27,7 @@
* http://www.goice.co.jp/member/mo/formats/au.html
*/
#include "libavutil/bprint.h"
#include "avformat.h"
#include "internal.h"
#include "avio_internal.h"

View File

@ -187,4 +187,18 @@ void ffio_reset_dyn_buf(AVIOContext *s);
*/
void ffio_free_dyn_buf(AVIOContext **s);
struct AVBPrint;
/**
* Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting
* its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or
* EOF. The line ending characters are NOT included in the buffer, but they
* are skipped on the input.
*
* @param s the read-only AVIOContext
* @param bp the AVBPrint buffer
* @return the length of the read line not including the line endings,
* negative on error, or if the buffer becomes truncated.
*/
int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp);
#endif /* AVFORMAT_AVIO_INTERNAL_H */

View File

@ -26,6 +26,7 @@
#include "libavutil/timestamp.h"
#include "libavcodec/bsf.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "url.h"

View File

@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libxml/parser.h>
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"

View File

@ -28,6 +28,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"

View File

@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"

View File

@ -22,6 +22,7 @@
#include <inttypes.h>
#include "libavutil/adler32.h"
#include "libavutil/avstring.h"
#include "libavcodec/codec_id.h"
#include "libavcodec/codec_par.h"

View File

@ -37,6 +37,7 @@
#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"

View File

@ -23,8 +23,6 @@
#include <stdint.h>
#include "libavutil/bprint.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/bsf.h"
@ -539,19 +537,6 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen);
*/
int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen);
/**
* Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting
* its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or
* EOF. The line ending characters are NOT included in the buffer, but they
* are skipped on the input.
*
* @param s the read-only AVIOContext
* @param bp the AVBPrint buffer
* @return the length of the read line not including the line endings,
* negative on error, or if the buffer becomes truncated.
*/
int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp);
#define SPACE_CHARS " \t\r\n"
/**
@ -931,6 +916,7 @@ int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters
*/
int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette);
struct AVBPrint;
/**
* Finalize buf into extradata and set its size appropriately.
*/

View File

@ -22,6 +22,7 @@
*/
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/time.h"

View File

@ -47,6 +47,7 @@
#include <inttypes.h>
#include "libavutil/aes.h"
#include "libavutil/avstring.h"
#include "libavutil/mastering_display_metadata.h"
#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"

View File

@ -27,6 +27,7 @@
* @see https://www.w3.org/TR/ttml-imsc/rec
*/
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "libavcodec/ttmlenc.h"

View File

@ -25,6 +25,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/dict.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"