[FFmpeg-cvslog] avcodec/internal: Move ff_samples_to_time_base() to encode.h
Andreas Rheinhardt
git at videolan.org
Sun Aug 28 13:27:08 EEST 2022
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Aug 24 23:04:14 2022 +0200| [59eadb5060acd07ad2d4dc5dbb354ee81f034222] | committer: Andreas Rheinhardt
avcodec/internal: Move ff_samples_to_time_base() to encode.h
It is only used by encoders; in fact, AVCodecContext.time_base
is only used by encoders, so it is only useful for encoders.
Also constify the AVCodecContext parameter in it.
Also fixup the other headers a bit while removing now unnecessary
internal.h inclusions.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59eadb5060acd07ad2d4dc5dbb354ee81f034222
---
libavcodec/ac3enc.c | 2 --
libavcodec/audio_frame_queue.c | 2 +-
libavcodec/encode.h | 12 ++++++++++++
libavcodec/flacenc.c | 1 -
libavcodec/g722enc.c | 1 -
libavcodec/internal.h | 12 ------------
libavcodec/libtwolame.c | 1 -
libavcodec/libvo-amrwbenc.c | 1 -
libavcodec/libvorbisenc.c | 1 -
libavcodec/mpegaudioenc_template.c | 1 -
libavcodec/wmaenc.c | 1 -
11 files changed, 13 insertions(+), 22 deletions(-)
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index c57904b01b..3fe625a659 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -30,7 +30,6 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
-#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/crc.h"
#include "libavutil/internal.h"
@@ -41,7 +40,6 @@
#include "codec_internal.h"
#include "config_components.h"
#include "encode.h"
-#include "internal.h"
#include "me_cmp.h"
#include "put_bits.h"
#include "audiodsp.h"
diff --git a/libavcodec/audio_frame_queue.c b/libavcodec/audio_frame_queue.c
index f2ccd69281..08b4b368c7 100644
--- a/libavcodec/audio_frame_queue.c
+++ b/libavcodec/audio_frame_queue.c
@@ -22,7 +22,7 @@
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "audio_frame_queue.h"
-#include "internal.h"
+#include "encode.h"
#include "libavutil/avassert.h"
av_cold void ff_af_queue_init(AVCodecContext *avctx, AudioFrameQueue *afq)
diff --git a/libavcodec/encode.h b/libavcodec/encode.h
index e5d6b754b1..296ffd312e 100644
--- a/libavcodec/encode.h
+++ b/libavcodec/encode.h
@@ -78,4 +78,16 @@ int ff_encode_preinit(AVCodecContext *avctx);
int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
const AVFrame *frame, int *got_packet);
+/**
+ * Rescale from sample rate to AVCodecContext.time_base.
+ */
+static av_always_inline int64_t ff_samples_to_time_base(const AVCodecContext *avctx,
+ int64_t samples)
+{
+ if (samples == AV_NOPTS_VALUE)
+ return AV_NOPTS_VALUE;
+ return av_rescale_q(samples, (AVRational){ 1, avctx->sample_rate },
+ avctx->time_base);
+}
+
#endif /* AVCODEC_ENCODE_H */
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 00f78fc814..73cf185314 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -32,7 +32,6 @@
#include "encode.h"
#include "put_bits.h"
#include "put_golomb.h"
-#include "internal.h"
#include "lpc.h"
#include "flac.h"
#include "flacdata.h"
diff --git a/libavcodec/g722enc.c b/libavcodec/g722enc.c
index 2c0a5019dd..7ba283df61 100644
--- a/libavcodec/g722enc.c
+++ b/libavcodec/g722enc.c
@@ -32,7 +32,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
-#include "internal.h"
#include "g722.h"
#include "libavutil/common.h"
diff --git a/libavcodec/internal.h b/libavcodec/internal.h
index 823067b7ee..6f34f98d4e 100644
--- a/libavcodec/internal.h
+++ b/libavcodec/internal.h
@@ -181,18 +181,6 @@ void ff_color_frame(AVFrame *frame, const int color[4]);
*/
#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - AV_INPUT_BUFFER_PADDING_SIZE)
-/**
- * Rescale from sample rate to AVCodecContext.time_base.
- */
-static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx,
- int64_t samples)
-{
- if(samples == AV_NOPTS_VALUE)
- return AV_NOPTS_VALUE;
- return av_rescale_q(samples, (AVRational){ 1, avctx->sample_rate },
- avctx->time_base);
-}
-
/**
* 2^(x) for integer x
* @return correctly rounded float
diff --git a/libavcodec/libtwolame.c b/libavcodec/libtwolame.c
index 9929248485..3da57bb779 100644
--- a/libavcodec/libtwolame.c
+++ b/libavcodec/libtwolame.c
@@ -33,7 +33,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
-#include "internal.h"
#include "mpegaudio.h"
typedef struct TWOLAMEContext {
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index 3c94bcba32..a2d7f33ef7 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -29,7 +29,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
-#include "internal.h"
#define MAX_PACKET_SIZE (1 + (477 + 7) / 8)
diff --git a/libavcodec/libvorbisenc.c b/libavcodec/libvorbisenc.c
index 3353776083..718e9d1912 100644
--- a/libavcodec/libvorbisenc.c
+++ b/libavcodec/libvorbisenc.c
@@ -28,7 +28,6 @@
#include "audio_frame_queue.h"
#include "codec_internal.h"
#include "encode.h"
-#include "internal.h"
#include "version.h"
#include "vorbis.h"
#include "vorbis_parser.h"
diff --git a/libavcodec/mpegaudioenc_template.c b/libavcodec/mpegaudioenc_template.c
index 839bd98dd1..67b8069102 100644
--- a/libavcodec/mpegaudioenc_template.c
+++ b/libavcodec/mpegaudioenc_template.c
@@ -28,7 +28,6 @@
#include "avcodec.h"
#include "encode.h"
-#include "internal.h"
#include "put_bits.h"
#define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 99f0100dc1..95b992859a 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -27,7 +27,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
-#include "internal.h"
#include "wma.h"
#include "libavutil/avassert.h"
More information about the ffmpeg-cvslog
mailing list