summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/csputils.c4
-rw-r--r--video/decode/vd_lavc.c9
-rw-r--r--video/fmt-conversion.c8
-rw-r--r--video/image_writer.c6
-rw-r--r--video/img_format.c17
-rw-r--r--video/mp_image.c4
-rw-r--r--video/out/vo_lavc.c19
7 files changed, 6 insertions, 61 deletions
diff --git a/video/csputils.c b/video/csputils.c
index 8f6a9e351e..6835aeed20 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -190,10 +190,8 @@ enum mp_csp_trc avcol_trc_to_mp_csp_trc(int avtrc)
case AVCOL_TRC_LINEAR: return MP_CSP_TRC_LINEAR;
case AVCOL_TRC_GAMMA22: return MP_CSP_TRC_GAMMA22;
case AVCOL_TRC_GAMMA28: return MP_CSP_TRC_GAMMA28;
-#if HAVE_AVUTIL_HDR
case AVCOL_TRC_SMPTEST2084: return MP_CSP_TRC_SMPTE_ST2084;
case AVCOL_TRC_ARIB_STD_B67: return MP_CSP_TRC_ARIB_STD_B67;
-#endif
default: return MP_CSP_TRC_AUTO;
}
}
@@ -242,10 +240,8 @@ int mp_csp_trc_to_avcol_trc(enum mp_csp_trc trc)
case MP_CSP_TRC_LINEAR: return AVCOL_TRC_LINEAR;
case MP_CSP_TRC_GAMMA22: return AVCOL_TRC_GAMMA22;
case MP_CSP_TRC_GAMMA28: return AVCOL_TRC_GAMMA28;
-#if HAVE_AVUTIL_HDR
case MP_CSP_TRC_SMPTE_ST2084: return AVCOL_TRC_SMPTEST2084;
case MP_CSP_TRC_ARIB_STD_B67: return AVCOL_TRC_ARIB_STD_B67;
-#endif
default: return AVCOL_TRC_UNSPECIFIED;
}
}
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index d25c99981e..4a25060081 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -663,11 +663,9 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
MP_VERBOSE(vd, " %s", av_get_pix_fmt_name(fmt[i]));
MP_VERBOSE(vd, "\n");
-#if HAVE_AVCODEC_PROFILE_NAME
const char *profile = avcodec_profile_name(avctx->codec_id, avctx->profile);
MP_VERBOSE(vd, "Codec profile: %s (0x%x)\n", profile ? profile : "unknown",
avctx->profile);
-#endif
assert(ctx->hwdec);
@@ -794,7 +792,6 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
reset_avctx(vd);
hwdec_lock(ctx);
-#if HAVE_AVCODEC_NEW_CODEC_API
ret = avcodec_send_packet(avctx, packet ? &pkt : NULL);
if (ret >= 0 || ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
if (ret >= 0)
@@ -807,10 +804,6 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
} else {
consumed = true;
}
-#else
- ret = avcodec_decode_video2(avctx, ctx->pic, &got_picture, &pkt);
- consumed = true;
-#endif
hwdec_unlock(ctx);
// Reset decoder if it was fully flushed. Caller might send more flush
@@ -864,7 +857,7 @@ static void decode(struct dec_video *vd, struct demux_packet *packet,
return;
}
assert(mpi->planes[0] || mpi->planes[3]);
- mpi->pts = mp_pts_from_av(MP_AVFRAME_DEC_PTS(ctx->pic), &ctx->codec_timebase);
+ mpi->pts = mp_pts_from_av(ctx->pic->pts, &ctx->codec_timebase);
mpi->dts = mp_pts_from_av(ctx->pic->pkt_dts, &ctx->codec_timebase);
struct mp_image_params params;
diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c
index 8b991c5d19..7a9e2088f8 100644
--- a/video/fmt-conversion.c
+++ b/video/fmt-conversion.c
@@ -73,10 +73,8 @@ static const struct {
{IMGFMT_XYZ12, AV_PIX_FMT_XYZ12},
-#ifdef AV_PIX_FMT_RGBA64
{IMGFMT_RGBA64, AV_PIX_FMT_RGBA64},
{IMGFMT_BGRA64, AV_PIX_FMT_BGRA64},
-#endif
#if LIBAVUTIL_VERSION_MICRO >= 100
{IMGFMT_BGR0, AV_PIX_FMT_BGR0},
@@ -90,9 +88,7 @@ static const struct {
{IMGFMT_0BGR, AV_PIX_FMT_ABGR},
#endif
-#ifdef AV_PIX_FMT_YA16
{IMGFMT_YA16, AV_PIX_FMT_YA16},
-#endif
{IMGFMT_VDPAU, AV_PIX_FMT_VDPAU},
#if HAVE_VIDEOTOOLBOX_HWACCEL
@@ -103,15 +99,11 @@ static const struct {
#if HAVE_D3D_HWACCEL
{IMGFMT_D3D11VA, AV_PIX_FMT_D3D11VA_VLD},
#endif
-#if HAVE_AV_PIX_FMT_MMAL
{IMGFMT_MMAL, AV_PIX_FMT_MMAL},
-#endif
#if HAVE_CUDA_HWACCEL
{IMGFMT_CUDA, AV_PIX_FMT_CUDA},
#endif
-#ifdef AV_PIX_FMT_P010
{IMGFMT_P010, AV_PIX_FMT_P010},
-#endif
#ifdef AV_PIX_FMT_P016
{IMGFMT_P016, AV_PIX_FMT_P016},
#endif
diff --git a/video/image_writer.c b/video/image_writer.c
index 8a5980c98e..59d986f3fc 100644
--- a/video/image_writer.c
+++ b/video/image_writer.c
@@ -133,7 +133,6 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
pic->color_trc = mp_csp_trc_to_avcol_trc(image->params.color.gamma);
}
-#if HAVE_AVCODEC_NEW_CODEC_API
int ret = avcodec_send_frame(avctx, pic);
if (ret < 0)
goto error_exit;
@@ -142,11 +141,6 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
if (ret < 0)
goto error_exit;
got_output = 1;
-#else
- int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
- if (ret < 0)
- goto error_exit;
-#endif
fwrite(pkt.data, pkt.size, 1, fp);
diff --git a/video/img_format.c b/video/img_format.c
index 24545a8501..0232f53890 100644
--- a/video/img_format.c
+++ b/video/img_format.c
@@ -161,21 +161,14 @@ struct mp_imgfmt_desc mp_imgfmt_get_desc(int mpfmt)
int shift = -1; // shift for all components, or -1 if not uniform
for (int c = 0; c < pd->nb_components; c++) {
AVComponentDescriptor d = pd->comp[c];
-#if HAVE_AV_NEW_PIXDESC
- int depth = d.depth;
- int step = d.step;
-#else
- int depth = d.depth_minus1 + 1;
- int step = d.step_minus1 + 1;
-#endif
// multiple components per plane -> Y is definitive, ignore chroma
if (!desc.bpp[d.plane])
- desc.bpp[d.plane] = step * el_size;
- planedepth[d.plane] += depth;
- need_endian |= (depth + d.shift) > 8;
+ desc.bpp[d.plane] = d.step * el_size;
+ planedepth[d.plane] += d.depth;
+ need_endian |= (d.depth + d.shift) > 8;
if (c == 0)
- desc.component_bits = depth;
- if (depth != desc.component_bits)
+ desc.component_bits = d.depth;
+ if (d.depth != desc.component_bits)
desc.component_bits = 0;
if (c == 0)
shift = d.shift;
diff --git a/video/mp_image.c b/video/mp_image.c
index b56c9e60b3..ee1ab4104e 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -744,9 +744,7 @@ struct mp_image *mp_image_from_av_frame(struct AVFrame *av_frame)
mp_image_copy_fields_from_av_frame(&t, av_frame);
for (int p = 0; p < MP_MAX_PLANES; p++)
t.bufs[p] = av_frame->buf[p];
-#if HAVE_AVUTIL_HAS_HWCONTEXT
t.hwctx = av_frame->hw_frames_ctx;
-#endif
return mp_image_new_ref(&t);
}
@@ -763,9 +761,7 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *img)
mp_image_copy_fields_to_av_frame(frame, new_ref);
for (int p = 0; p < MP_MAX_PLANES; p++)
frame->buf[p] = new_ref->bufs[p];
-#if HAVE_AVUTIL_HAS_HWCONTEXT
frame->hw_frames_ctx = new_ref->hwctx;
-#endif
*new_ref = (struct mp_image){0};
talloc_free(new_ref);
return frame;
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index 1721136f8b..5c7406d4b9 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -241,7 +241,6 @@ static void encode_video_and_write(struct vo *vo, AVFrame *frame)
struct priv *vc = vo->priv;
AVPacket packet = {0};
-#if HAVE_AVCODEC_NEW_CODEC_API
int status = avcodec_send_frame(vc->codec, frame);
if (status < 0) {
MP_ERR(vo, "error encoding at %d %d/%d\n",
@@ -276,24 +275,6 @@ static void encode_video_and_write(struct vo *vo, AVFrame *frame)
write_packet(vo, &packet);
av_packet_unref(&packet);
}
-#else
- av_init_packet(&packet);
- int got_packet = 0;
- int status = avcodec_encode_video2(vc->codec, &packet, frame, &got_packet);
- if (status < 0) {
- MP_ERR(vo, "error encoding at %d %d/%d\n",
- frame ? (int) frame->pts : -1,
- vc->codec->time_base.num,
- vc->codec->time_base.den);
- return;
- }
- if (!got_packet) {
- return;
- }
- encode_lavc_write_stats(vo->encode_lavc_ctx, vc->codec);
- write_packet(vo, &packet);
- av_packet_unref(&packet);
-#endif
}
static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)