aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-10-13 08:59:53 +0200
committerAnton Khirnov <anton@khirnov.net>2024-10-16 16:29:12 +0200
commit461a359abce7958cdd9cb4961ad9070118300258 (patch)
tree6c3c1eadb293c866ce720d7ba32bd58e3a7fa345
parentde49452bc122077ed64b48bcfc475cf53e3be78b (diff)
downloadffmpeg-461a359abce7958cdd9cb4961ad9070118300258.tar.gz
lavf: add a header for generic-layer interfaces
Analogous to what was previously done in avcodec and avfilter.
-rw-r--r--libavdevice/alldevices.c2
-rw-r--r--libavformat/allformats.c1
-rw-r--r--libavformat/avformat.c1
-rw-r--r--libavformat/avformat_internal.h93
-rw-r--r--libavformat/demux.c1
-rw-r--r--libavformat/demux.h16
-rw-r--r--libavformat/internal.h45
-rw-r--r--libavformat/mux.c1
-rw-r--r--libavformat/options.c1
-rw-r--r--libavformat/seek.c1
10 files changed, 100 insertions, 62 deletions
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 9b9a9146c7..3f0e6101a5 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -20,8 +20,8 @@
#include "libavutil/attributes.h"
#include "libavutil/attributes_internal.h"
+#include "libavformat/avformat_internal.h"
#include "libavformat/demux.h"
-#include "libavformat/internal.h"
#include "libavformat/mux.h"
#include "avdevice.h"
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index 305fa46532..445f13f42a 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -25,6 +25,7 @@
#include "libavformat/internal.h"
#include "avformat.h"
+#include "avformat_internal.h"
#include "demux.h"
#include "mux.h"
diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 89ee669bf9..471e148af4 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -36,6 +36,7 @@
#include "libavcodec/codec_desc.h"
#include "libavcodec/packet_internal.h"
#include "avformat.h"
+#include "avformat_internal.h"
#include "avio.h"
#include "demux.h"
#include "mux.h"
diff --git a/libavformat/avformat_internal.h b/libavformat/avformat_internal.h
new file mode 100644
index 0000000000..a1079fe122
--- /dev/null
+++ b/libavformat/avformat_internal.h
@@ -0,0 +1,93 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * APIs internal to the generic avformat layer.
+ *
+ * MUST NOT be included by individual muxers or demuxers.
+ */
+
+#ifndef AVFORMAT_AVFORMAT_INTERNAL_H
+#define AVFORMAT_AVFORMAT_INTERNAL_H
+
+#include <stdint.h>
+
+#include "avformat.h"
+
+#define RELATIVE_TS_BASE (INT64_MAX - (1LL << 48))
+
+static av_always_inline int is_relative(int64_t ts)
+{
+ return ts > (RELATIVE_TS_BASE - (1LL << 48));
+}
+
+/**
+ * Wrap a given time stamp, if there is an indication for an overflow
+ *
+ * @param st stream
+ * @param timestamp the time stamp to wrap
+ * @return resulting time stamp
+ */
+int64_t ff_wrap_timestamp(const AVStream *st, int64_t timestamp);
+
+typedef struct FFStreamGroup {
+ /**
+ * The public context.
+ */
+ AVStreamGroup pub;
+
+ AVFormatContext *fmtctx;
+} FFStreamGroup;
+
+static av_always_inline FFStreamGroup *ffstreamgroup(AVStreamGroup *stg)
+{
+ return (FFStreamGroup*)stg;
+}
+
+static av_always_inline const FFStreamGroup *cffstreamgroup(const AVStreamGroup *stg)
+{
+ return (const FFStreamGroup*)stg;
+}
+
+void ff_flush_packet_queue(AVFormatContext *s);
+
+const struct AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
+ enum AVCodecID codec_id);
+
+/**
+ * Frees a stream without modifying the corresponding AVFormatContext.
+ * Must only be called if the latter doesn't matter or if the stream
+ * is not yet attached to an AVFormatContext.
+ */
+void ff_free_stream(AVStream **st);
+
+/**
+ * Frees a stream group without modifying the corresponding AVFormatContext.
+ * Must only be called if the latter doesn't matter or if the stream
+ * is not yet attached to an AVFormatContext.
+ */
+void ff_free_stream_group(AVStreamGroup **pstg);
+
+int ff_is_intra_only(enum AVCodecID id);
+
+struct FFOutputFormat;
+struct FFInputFormat;
+void avpriv_register_devices(const struct FFOutputFormat * const o[],
+ const struct FFInputFormat * const i[]);
+
+#endif // AVFORMAT_AVFORMAT_INTERNAL_H
diff --git a/libavformat/demux.c b/libavformat/demux.c
index 4fd22c4934..902056452d 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -43,6 +43,7 @@
#include "libavcodec/raw.h"
#include "avformat.h"
+#include "avformat_internal.h"
#include "avio_internal.h"
#include "demux.h"
#include "id3v2.h"
diff --git a/libavformat/demux.h b/libavformat/demux.h
index 9c76095662..647011affb 100644
--- a/libavformat/demux.h
+++ b/libavformat/demux.h
@@ -170,22 +170,6 @@ typedef struct FFStreamInfo {
*/
#define FFERROR_REDO FFERRTAG('R','E','D','O')
-#define RELATIVE_TS_BASE (INT64_MAX - (1LL << 48))
-
-static av_always_inline int is_relative(int64_t ts)
-{
- return ts > (RELATIVE_TS_BASE - (1LL << 48));
-}
-
-/**
- * Wrap a given time stamp, if there is an indication for an overflow
- *
- * @param st stream
- * @param timestamp the time stamp to wrap
- * @return resulting time stamp
- */
-int64_t ff_wrap_timestamp(const AVStream *st, int64_t timestamp);
-
/**
* Read a transport packet from a media file.
*
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 489a7cad08..0f31962d52 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -426,26 +426,6 @@ static av_always_inline const FFStream *cffstream(const AVStream *st)
return (const FFStream*)st;
}
-typedef struct FFStreamGroup {
- /**
- * The public context.
- */
- AVStreamGroup pub;
-
- AVFormatContext *fmtctx;
-} FFStreamGroup;
-
-
-static av_always_inline FFStreamGroup *ffstreamgroup(AVStreamGroup *stg)
-{
- return (FFStreamGroup*)stg;
-}
-
-static av_always_inline const FFStreamGroup *cffstreamgroup(const AVStreamGroup *stg)
-{
- return (const FFStreamGroup*)stg;
-}
-
#ifdef __GNUC__
#define dynarray_add(tab, nb_ptr, elem)\
do {\
@@ -461,9 +441,6 @@ do {\
} while(0)
#endif
-
-void ff_flush_packet_queue(AVFormatContext *s);
-
/**
* Automatically create sub-directories
*
@@ -591,9 +568,6 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
enum AVCodecID ff_guess_image2_codec(const char *filename);
-const struct AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
- enum AVCodecID codec_id);
-
/**
* Set the time base and wrapping info for a given stream. This will be used
* to interpret the stream's timestamps. If the new time base is invalid
@@ -616,24 +590,12 @@ void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits,
int ff_framehash_write_header(AVFormatContext *s);
/**
- * Frees a stream without modifying the corresponding AVFormatContext.
- * Must only be called if the latter doesn't matter or if the stream
- * is not yet attached to an AVFormatContext.
- */
-void ff_free_stream(AVStream **st);
-/**
* Remove a stream from its AVFormatContext and free it.
* The stream must be the last stream of the AVFormatContext.
*/
void ff_remove_stream(AVFormatContext *s, AVStream *st);
/**
- * Frees a stream group without modifying the corresponding AVFormatContext.
- * Must only be called if the latter doesn't matter or if the stream
- * is not yet attached to an AVFormatContext.
- */
-void ff_free_stream_group(AVStreamGroup **pstg);
-/**
* Remove a stream group from its AVFormatContext and free it.
* The stream group must be the last stream group of the AVFormatContext.
*/
@@ -643,8 +605,6 @@ unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id);
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag);
-int ff_is_intra_only(enum AVCodecID id);
-
/**
* Select a PCM codec based on the given parameters.
*
@@ -752,9 +712,4 @@ int ff_match_url_ext(const char *url, const char *extensions);
int ff_get_frame_filename(char *buf, int buf_size, const char *path,
int64_t number, int flags);
-struct FFOutputFormat;
-struct FFInputFormat;
-void avpriv_register_devices(const struct FFOutputFormat * const o[],
- const struct FFInputFormat * const i[]);
-
#endif /* AVFORMAT_INTERNAL_H */
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 011de51ddd..7d2435c49f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -20,6 +20,7 @@
*/
#include "avformat.h"
+#include "avformat_internal.h"
#include "internal.h"
#include "mux.h"
#include "version.h"
diff --git a/libavformat/options.c b/libavformat/options.c
index 039f1eea42..10d6ce2d35 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avformat.h"
+#include "avformat_internal.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 800ef40576..9822f9d83d 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -29,6 +29,7 @@
#include "libavcodec/avcodec.h"
#include "avformat.h"
+#include "avformat_internal.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"