Commit 59eadb50 authored by Andreas Rheinhardt's avatar 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: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
parent b9eaf77e
......@@ -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"
......
......@@ -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)
......
......@@ -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 */
......@@ -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"
......
......@@ -32,7 +32,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "internal.h"
#include "g722.h"
#include "libavutil/common.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
......
......@@ -33,7 +33,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "internal.h"
#include "mpegaudio.h"
typedef struct TWOLAMEContext {
......
......@@ -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)
......
......@@ -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"
......
......@@ -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 */
......
......@@ -27,7 +27,6 @@
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "internal.h"
#include "wma.h"
#include "libavutil/avassert.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment