common/encode_lavc: prefix global functions with mp_

To avoid conflicts with xavs2.
This commit is contained in:
Kacper Michajłow
2026-03-08 14:17:39 +01:00
parent 2a4eb8067c
commit 38aed4d1f2
5 changed files with 21 additions and 21 deletions
+5 -5
View File
@@ -98,7 +98,7 @@ static int init(struct ao *ao)
{
struct priv *ac = ao->priv;
ac->enc = encoder_context_alloc(ao->encode_lavc_ctx, STREAM_AUDIO, ao->log);
ac->enc = mp_encoder_context_alloc(ao->encode_lavc_ctx, STREAM_AUDIO, ao->log);
if (!ac->enc)
return -1;
talloc_steal(ac, ac->enc);
@@ -137,10 +137,10 @@ static int init(struct ao *ao)
encoder->sample_fmt = af_to_avformat(ao->format);
encoder->bits_per_raw_sample = ac->sample_size * 8;
if (!encoder_init_codec_and_muxer(ac->enc))
if (!mp_encoder_init_codec_and_muxer(ac->enc))
goto fail;
ac->worst_time_base = encoder_get_mux_timebase_unlocked(ac->enc);
ac->worst_time_base = mp_encoder_get_mux_timebase_unlocked(ac->enc);
ac->pcmhack = 0;
if (encoder->frame_size <= 1)
ac->pcmhack = av_get_bits_per_sample(encoder->codec_id) / 8;
@@ -183,7 +183,7 @@ static void uninit(struct ao *ao)
if (!ac->shutdown) {
if (!write_frame(ao, MP_EOF_FRAME))
MP_WARN(ao, "could not flush last frame\n");
encoder_encode(ac->enc, NULL);
mp_encoder_encode(ac->enc, NULL);
}
talloc_free(ac->filter_root);
@@ -217,7 +217,7 @@ static void encode(struct ao *ao, struct mp_aframe *af)
ac->lastpts = frame_pts;
frame->quality = encoder->global_quality;
encoder_encode(ac->enc, frame);
mp_encoder_encode(ac->enc, frame);
av_frame_free(&frame);
}
+5 -5
View File
@@ -424,7 +424,7 @@ done:
av_packet_unref(pkt);
}
AVRational encoder_get_mux_timebase_unlocked(struct encoder_context *p)
AVRational mp_encoder_get_mux_timebase_unlocked(struct encoder_context *p)
{
return p->mux_stream->st->time_base;
}
@@ -746,7 +746,7 @@ bool encode_lavc_stream_type_ok(struct encode_lavc_context *ctx,
return !!find_codec_for(ctx, type, &auto_codec) || !auto_codec;
}
struct encoder_context *encoder_context_alloc(struct encode_lavc_context *ctx,
struct encoder_context *mp_encoder_context_alloc(struct encode_lavc_context *ctx,
enum stream_type type,
struct mp_log *log)
{
@@ -826,7 +826,7 @@ static void encoder_2pass_prepare(struct encoder_context *p)
talloc_free(filename);
}
bool encoder_init_codec_and_muxer(struct encoder_context *p)
bool mp_encoder_init_codec_and_muxer(struct encoder_context *p)
{
mp_assert(!avcodec_is_open(p->encoder));
@@ -893,7 +893,7 @@ fail:
return false;
}
bool encoder_encode(struct encoder_context *p, AVFrame *frame)
bool mp_encoder_encode(struct encoder_context *p, AVFrame *frame)
{
int status = avcodec_send_frame(p->encoder, frame);
if (status < 0) {
@@ -929,7 +929,7 @@ fail:
return false;
}
void encoder_update_log(struct mpv_global *global)
void mp_encoder_update_log(struct mpv_global *global)
{
struct encode_opts *options = mp_get_config_group(NULL, global, &encode_config);
if (options->file && (!strcmp(options->file, "-") ||
+6 -6
View File
@@ -59,7 +59,7 @@ struct encode_lavc_context {
// Static information after encoder init. This never changes (even if there are
// dynamic runtime changes, they have to work over AVPacket side data).
// For use in encoder_context, most fields are copied from encoder_context.encoder
// by encoder_init_codec_and_muxer().
// by mp_encoder_init_codec_and_muxer().
struct encoder_stream_info {
AVRational timebase; // timebase used by the encoder (in frames/out packets)
AVCodecParameters *codecpar;
@@ -91,20 +91,20 @@ struct encoder_context {
// Free with talloc_free(). (Keep in mind actual deinitialization requires
// sending a flush packet.)
// This can fail and return NULL.
struct encoder_context *encoder_context_alloc(struct encode_lavc_context *ctx,
struct encoder_context *mp_encoder_context_alloc(struct encode_lavc_context *ctx,
enum stream_type type,
struct mp_log *log);
// After setting your codec parameters on p->encoder, you call this to "open"
// the encoder. This also initializes p->mux_stream. Returns false on failure.
bool encoder_init_codec_and_muxer(struct encoder_context *p);
bool mp_encoder_init_codec_and_muxer(struct encoder_context *p);
// Encode the frame and write the packet. frame is ref'ed as need.
bool encoder_encode(struct encoder_context *p, AVFrame *frame);
bool mp_encoder_encode(struct encoder_context *p, AVFrame *frame);
// Return muxer timebase (only available if p->mux_stream is initialized).
AVRational encoder_get_mux_timebase_unlocked(struct encoder_context *p);
AVRational mp_encoder_get_mux_timebase_unlocked(struct encoder_context *p);
void encoder_update_log(struct mpv_global *global);
void mp_encoder_update_log(struct mpv_global *global);
#endif
+1 -1
View File
@@ -154,7 +154,7 @@ void mp_update_logging(struct MPContext *mpctx, bool preinit)
terminal_setup_getch(mpctx->input);
if (enabled)
encoder_update_log(mpctx->global);
mp_encoder_update_log(mpctx->global);
}
void mp_print_version(struct mp_log *log, int always)
+4 -4
View File
@@ -46,7 +46,7 @@ struct priv {
static int preinit(struct vo *vo)
{
struct priv *vc = vo->priv;
vc->enc = encoder_context_alloc(vo->encode_lavc_ctx, STREAM_VIDEO, vo->log);
vc->enc = mp_encoder_context_alloc(vo->encode_lavc_ctx, STREAM_VIDEO, vo->log);
if (!vc->enc)
return -1;
talloc_steal(vc, vc->enc);
@@ -59,7 +59,7 @@ static void uninit(struct vo *vo)
struct encoder_context *enc = vc->enc;
if (!vc->shutdown)
encoder_encode(enc, NULL); // finish encoding
mp_encoder_encode(enc, NULL); // finish encoding
}
static int reconfig2(struct vo *vo, struct mp_image *img)
@@ -143,7 +143,7 @@ static int reconfig2(struct vo *vo, struct mp_image *img)
else
encoder->framerate = (AVRational){ 240, 1 };
if (!encoder_init_codec_and_muxer(vc->enc))
if (!mp_encoder_init_codec_and_muxer(vc->enc))
goto error;
return 0;
@@ -232,7 +232,7 @@ static bool draw_frame(struct vo *vo, struct vo_frame *voframe)
frame->pts = rint(outpts * av_q2d(av_inv_q(avc->time_base)));
frame->pict_type = 0; // keep this at unknown/undefined
frame->quality = avc->global_quality;
encoder_encode(enc, frame);
mp_encoder_encode(enc, frame);
av_frame_free(&frame);
done: