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.
Unified · Split
| @@ -33,6 +33,7 @@ · 32 unmodified lines | |||
| 33 | #include <stdatomic.h> | 33 | #include <stdatomic.h> |
| 34 | 34 | ||
| 35 | #include "libavutil/avassert.h" | 35 | #include "libavutil/avassert.h" |
| 36 | #include "libavutil/avstring.h" | ||
| 36 | #include "v4l2-common.h" | 37 | #include "v4l2-common.h" |
| 37 | #include <dirent.h> | 38 | #include <dirent.h> |
| 38 | 39 | ||
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include "avformat.h" | 26 | #include "avformat.h" |
| 27 | #include "internal.h" | 27 | #include "internal.h" |
| 28 | #include "libavutil/avstring.h" | ||
| 28 | #include "libavutil/dict.h" | 29 | #include "libavutil/dict.h" |
| 29 | #include "libavutil/intreadwrite.h" | 30 | #include "libavutil/intreadwrite.h" |
| 30 | #include "libavutil/tea.h" | 31 | #include "libavutil/tea.h" |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | * License along with FFmpeg; if not, write to the Free Software | 19 | * License along with FFmpeg; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ | 21 | */ |
| 22 | #include "libavutil/avstring.h" | ||
| 22 | #include "avformat.h" | 23 | #include "avformat.h" |
| 23 | #include "internal.h" | 24 | #include "internal.h" |
| 24 | #include "libavutil/channel_layout.h" | 25 | #include "libavutil/channel_layout.h" |
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ | 21 | */ |
| 22 | 22 | ||
| 23 | #include "libavutil/avstring.h" | ||
| 23 | #include "libavutil/channel_layout.h" | 24 | #include "libavutil/channel_layout.h" |
| 24 | #include "avformat.h" | 25 | #include "avformat.h" |
| 25 | #include "internal.h" | 26 | #include "internal.h" |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | * http://www.goice.co.jp/member/mo/formats/au.html | 27 | * http://www.goice.co.jp/member/mo/formats/au.html |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "libavutil/bprint.h" | ||
| 30 | #include "avformat.h" | 31 | #include "avformat.h" |
| 31 | #include "internal.h" | 32 | #include "internal.h" |
| 32 | #include "avio_internal.h" | 33 | #include "avio_internal.h" |
| @@ -187,4 +187,18 @@ void ffio_reset_dyn_buf(AVIOContext *s); · 186 unmodified lines | |||
| 187 | */ | 187 | */ |
| 188 | void ffio_free_dyn_buf(AVIOContext **s); | 188 | void ffio_free_dyn_buf(AVIOContext **s); |
| 189 | 189 | ||
| 190 | struct AVBPrint; | ||
| 191 | /** | ||
| 192 | * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting | ||
| 193 | * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or | ||
| 194 | * EOF. The line ending characters are NOT included in the buffer, but they | ||
| 195 | * are skipped on the input. | ||
| 196 | * | ||
| 197 | * @param s the read-only AVIOContext | ||
| 198 | * @param bp the AVBPrint buffer | ||
| 199 | * @return the length of the read line not including the line endings, | ||
| 200 | * negative on error, or if the buffer becomes truncated. | ||
| 201 | */ | ||
| 202 | int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp); | ||
| 203 | |||
| 190 | #endif /* AVFORMAT_AVIO_INTERNAL_H */ | 204 | #endif /* AVFORMAT_AVIO_INTERNAL_H */ |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | |||
| 26 | #include "libavutil/timestamp.h" | 26 | #include "libavutil/timestamp.h" |
| 27 | #include "libavcodec/bsf.h" | 27 | #include "libavcodec/bsf.h" |
| 28 | #include "avformat.h" | 28 | #include "avformat.h" |
| 29 | #include "avio_internal.h" | ||
| 29 | #include "internal.h" | 30 | #include "internal.h" |
| 30 | #include "url.h" | 31 | #include "url.h" |
| 31 | 32 | ||
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 | */ | 21 | */ |
| 22 | #include <libxml/parser.h> | 22 | #include <libxml/parser.h> |
| 23 | #include "libavutil/bprint.h" | ||
| 23 | #include "libavutil/intreadwrite.h" | 24 | #include "libavutil/intreadwrite.h" |
| 24 | #include "libavutil/opt.h" | 25 | #include "libavutil/opt.h" |
| 25 | #include "libavutil/time.h" | 26 | #include "libavutil/time.h" |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | |||
| 28 | #include "libavutil/avassert.h" | 28 | #include "libavutil/avassert.h" |
| 29 | #include "libavutil/avutil.h" | 29 | #include "libavutil/avutil.h" |
| 30 | #include "libavutil/avstring.h" | 30 | #include "libavutil/avstring.h" |
| 31 | #include "libavutil/bprint.h" | ||
| 31 | #include "libavutil/intreadwrite.h" | 32 | #include "libavutil/intreadwrite.h" |
| 32 | #include "libavutil/mathematics.h" | 33 | #include "libavutil/mathematics.h" |
| 33 | #include "libavutil/opt.h" | 34 | #include "libavutil/opt.h" |
| @@ -19,6 +19,7 @@ · 18 unmodified lines | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "libavutil/avstring.h" | ||
| 22 | #include "libavutil/channel_layout.h" | 23 | #include "libavutil/channel_layout.h" |
| 23 | #include "libavutil/opt.h" | 24 | #include "libavutil/opt.h" |
| 24 | #include "libavutil/pixdesc.h" | 25 | #include "libavutil/pixdesc.h" |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | #include <inttypes.h> | 22 | #include <inttypes.h> |
| 23 | 23 | ||
| 24 | #include "libavutil/adler32.h" | 24 | #include "libavutil/adler32.h" |
| 25 | #include "libavutil/avstring.h" | ||
| 25 | 26 | ||
| 26 | #include "libavcodec/codec_id.h" | 27 | #include "libavcodec/codec_id.h" |
| 27 | #include "libavcodec/codec_par.h" | 28 | #include "libavcodec/codec_par.h" |
| @@ -37,6 +37,7 @@ · 36 unmodified lines | |||
| 37 | #include "libavutil/mathematics.h" | 37 | #include "libavutil/mathematics.h" |
| 38 | #include "libavutil/parseutils.h" | 38 | #include "libavutil/parseutils.h" |
| 39 | #include "libavutil/avstring.h" | 39 | #include "libavutil/avstring.h" |
| 40 | #include "libavutil/bprint.h" | ||
| 40 | #include "libavutil/intreadwrite.h" | 41 | #include "libavutil/intreadwrite.h" |
| 41 | #include "libavutil/random_seed.h" | 42 | #include "libavutil/random_seed.h" |
| 42 | #include "libavutil/opt.h" | 43 | #include "libavutil/opt.h" |
| @@ -23,8 +23,6 @@ · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | #include <stdint.h> | 24 | #include <stdint.h> |
| 25 | 25 | ||
| 26 | #include "libavutil/bprint.h" | ||
| 27 | |||
| 28 | #include "libavcodec/avcodec.h" | 26 | #include "libavcodec/avcodec.h" |
| 29 | #include "libavcodec/bsf.h" | 27 | #include "libavcodec/bsf.h" |
| 30 | 28 | ||
| @@ -539,19 +537,6 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen); · 508 unmodified lines | |||
| 539 | */ | 537 | */ |
| 540 | int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen); | 538 | int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen); |
| 541 | 539 | ||
| 542 | /** | ||
| 543 | * Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting | ||
| 544 | * its contents. Stop reading after reaching a \\r, a \\n, a \\r\\n, a \\0 or | ||
| 545 | * EOF. The line ending characters are NOT included in the buffer, but they | ||
| 546 | * are skipped on the input. | ||
| 547 | * | ||
| 548 | * @param s the read-only AVIOContext | ||
| 549 | * @param bp the AVBPrint buffer | ||
| 550 | * @return the length of the read line not including the line endings, | ||
| 551 | * negative on error, or if the buffer becomes truncated. | ||
| 552 | */ | ||
| 553 | int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp); | ||
| 554 | |||
| 555 | #define SPACE_CHARS " \t\r\n" | 540 | #define SPACE_CHARS " \t\r\n" |
| 556 | 541 | ||
| 557 | /** | 542 | /** |
| @@ -931,6 +916,7 @@ int ff_reshuffle_raw_rgb(AVFormatContext *s, AVPacket **ppkt, AVCodecParameters · 373 unmodified lines | |||
| 931 | */ | 916 | */ |
| 932 | int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette); | 917 | int ff_get_packet_palette(AVFormatContext *s, AVPacket *pkt, int ret, uint32_t *palette); |
| 933 | 918 | ||
| 919 | struct AVBPrint; | ||
| 934 | /** | 920 | /** |
| 935 | * Finalize buf into extradata and set its size appropriately. | 921 | * Finalize buf into extradata and set its size appropriately. |
| 936 | */ | 922 | */ |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | |||
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #include "libavutil/avassert.h" | 24 | #include "libavutil/avassert.h" |
| 25 | #include "libavutil/avstring.h" | ||
| 25 | #include "libavutil/opt.h" | 26 | #include "libavutil/opt.h" |
| 26 | #include "libavutil/parseutils.h" | 27 | #include "libavutil/parseutils.h" |
| 27 | #include "libavutil/time.h" | 28 | #include "libavutil/time.h" |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | #include <inttypes.h> | 47 | #include <inttypes.h> |
| 48 | 48 | ||
| 49 | #include "libavutil/aes.h" | 49 | #include "libavutil/aes.h" |
| 50 | #include "libavutil/avstring.h" | ||
| 50 | #include "libavutil/mastering_display_metadata.h" | 51 | #include "libavutil/mastering_display_metadata.h" |
| 51 | #include "libavutil/mathematics.h" | 52 | #include "libavutil/mathematics.h" |
| 52 | #include "libavcodec/bytestream.h" | 53 | #include "libavcodec/bytestream.h" |
| @@ -27,6 +27,7 @@ · 26 unmodified lines | |||
| 27 | * @see https://www.w3.org/TR/ttml-imsc/rec | 27 | * @see https://www.w3.org/TR/ttml-imsc/rec |
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "libavutil/avstring.h" | ||
| 30 | #include "avformat.h" | 31 | #include "avformat.h" |
| 31 | #include "internal.h" | 32 | #include "internal.h" |
| 32 | #include "libavcodec/ttmlenc.h" | 33 | #include "libavcodec/ttmlenc.h" |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | 25 | ||
| 26 | #include "libavutil/avassert.h" | 26 | #include "libavutil/avassert.h" |
| 27 | #include "libavutil/avstring.h" | 27 | #include "libavutil/avstring.h" |
| 28 | #include "libavutil/bprint.h" | ||
| 28 | #include "libavutil/dict.h" | 29 | #include "libavutil/dict.h" |
| 29 | #include "libavutil/internal.h" | 30 | #include "libavutil/internal.h" |
| 30 | #include "libavutil/mathematics.h" | 31 | #include "libavutil/mathematics.h" |