summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-21 23:15:32 +0100
committerwm4 <wm4@nowhere>2013-12-21 23:15:32 +0100
commit0a3e9a9ac3a90da831b497e0613dfb66bc14f3d2 (patch)
treeb70f214f8c3fc802d6d6edbf8395273c854ac0fd /video
parenta4fe95b0d8d339ba5afbdb5346ad8fd367a4a1c1 (diff)
parent245e5b844177e9ad9a9c07eff5efab7c3fccdebc (diff)
downloadmpv-0a3e9a9ac3a90da831b497e0613dfb66bc14f3d2.tar.bz2
mpv-0a3e9a9ac3a90da831b497e0613dfb66bc14f3d2.tar.xz
Merge branch 'msg_refactor'
This branch changes mp_msg() so that it doesn't require global context. The changes are pretty violent.
Diffstat (limited to 'video')
-rw-r--r--video/decode/dec_video.c66
-rw-r--r--video/decode/dec_video.h2
-rw-r--r--video/decode/lavc.h1
-rw-r--r--video/decode/vaapi.c50
-rw-r--r--video/decode/vd_lavc.c58
-rw-r--r--video/decode/vda.c11
-rw-r--r--video/decode/vdpau.c13
-rw-r--r--video/decode/vdpau_old.c12
-rw-r--r--video/filter/vf.c47
-rw-r--r--video/filter/vf.h9
-rw-r--r--video/filter/vf_crop.c4
-rw-r--r--video/filter/vf_delogo.c36
-rw-r--r--video/filter/vf_divtc.c32
-rw-r--r--video/filter/vf_dlopen.c23
-rw-r--r--video/filter/vf_eq.c4
-rw-r--r--video/filter/vf_expand.c2
-rw-r--r--video/filter/vf_gradfun.c2
-rw-r--r--video/filter/vf_lavfi.c22
-rw-r--r--video/filter/vf_phase.c18
-rw-r--r--video/filter/vf_pp.c6
-rw-r--r--video/filter/vf_pullup.c3
-rw-r--r--video/filter/vf_scale.c18
-rw-r--r--video/filter/vf_softpulldown.c5
-rw-r--r--video/filter/vf_stereo3d.c11
-rw-r--r--video/filter/vf_unsharp.c5
-rw-r--r--video/filter/vf_vavpp.c65
-rw-r--r--video/fmt-conversion.c25
-rw-r--r--video/image_writer.c23
-rw-r--r--video/image_writer.h6
-rw-r--r--video/img_format.c8
-rw-r--r--video/out/bitmap_packer.c4
-rw-r--r--video/out/gl_common.c48
-rw-r--r--video/out/gl_common.h4
-rw-r--r--video/out/gl_hwdec_vaglx.c10
-rw-r--r--video/out/gl_hwdec_vdpau.c14
-rw-r--r--video/out/gl_lcms.c67
-rw-r--r--video/out/gl_lcms.h4
-rw-r--r--video/out/gl_video.c22
-rw-r--r--video/out/vo.c9
-rw-r--r--video/out/vo.h1
-rw-r--r--video/out/vo_image.c2
-rw-r--r--video/out/vo_lavc.c7
-rw-r--r--video/out/vo_opengl.c5
-rw-r--r--video/out/vo_opengl_old.c2
-rw-r--r--video/out/vo_vaapi.c32
-rw-r--r--video/out/vo_vdpau.c93
-rw-r--r--video/out/x11_common.c37
-rw-r--r--video/out/x11_common.h3
-rw-r--r--video/sws_utils.c13
-rw-r--r--video/sws_utils.h2
-rw-r--r--video/vaapi.c82
-rw-r--r--video/vaapi.h19
-rw-r--r--video/vdpau.c8
-rw-r--r--video/vdpau.h10
54 files changed, 538 insertions, 547 deletions
diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c
index b150816a90..09bbd243c9 100644
--- a/video/decode/dec_video.c
+++ b/video/decode/dec_video.c
@@ -87,14 +87,14 @@ int video_set_colors(struct dec_video *d_video, const char *item, int value)
data.item = item;
data.value = value;
- mp_msg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value);
+ MP_VERBOSE(d_video, "set video colors %s=%d \n", item, value);
if (d_video->vfilter) {
int ret = video_vf_vo_control(d_video, VFCTRL_SET_EQUALIZER, &data);
if (ret == CONTROL_TRUE)
return 1;
}
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo.\n",
- item);
+ MP_VERBOSE(d_video, "Video attribute '%s' is not supported by selected vo.\n",
+ item);
return 0;
}
@@ -104,7 +104,7 @@ int video_get_colors(struct dec_video *d_video, const char *item, int *value)
data.item = item;
- mp_msg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item);
+ MP_VERBOSE(d_video, "get video colors %s \n", item);
if (d_video->vfilter) {
int ret = video_vf_vo_control(d_video, VFCTRL_GET_EQUALIZER, &data);
if (ret == CONTROL_TRUE) {
@@ -119,7 +119,7 @@ void video_uninit(struct dec_video *d_video)
{
mp_image_unrefp(&d_video->waiting_decoded_mpi);
if (d_video->vd_driver) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Uninit video.\n");
+ MP_VERBOSE(d_video, "Uninit video.\n");
d_video->vd_driver->uninit(d_video);
}
talloc_free(d_video->priv);
@@ -130,7 +130,7 @@ void video_uninit(struct dec_video *d_video)
static int init_video_codec(struct dec_video *d_video, const char *decoder)
{
if (!d_video->vd_driver->init(d_video, decoder)) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Video decoder init failed.\n");
+ MP_VERBOSE(d_video, "Video decoder init failed.\n");
return 0;
}
return 1;
@@ -172,22 +172,22 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
struct mp_decoder_list *list =
mp_select_video_decoders(d_video->header->codec, video_decoders);
- mp_print_decoders(MSGT_DECVIDEO, MSGL_V, "Codec list:", list);
+ mp_print_decoders(d_video->log, MSGL_V, "Codec list:", list);
for (int n = 0; n < list->num_entries; n++) {
struct mp_decoder_entry *sel = &list->entries[n];
const struct vd_functions *driver = find_driver(sel->family);
if (!driver)
continue;
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Opening video decoder %s:%s\n",
- sel->family, sel->decoder);
+ MP_VERBOSE(d_video, "Opening video decoder %s:%s\n",
+ sel->family, sel->decoder);
d_video->vd_driver = driver;
if (init_video_codec(d_video, sel->decoder)) {
decoder = sel;
break;
}
d_video->vd_driver = NULL;
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Video decoder init failed for "
+ MP_WARN(d_video, "Video decoder init failed for "
"%s:%s\n", sel->family, sel->decoder);
}
@@ -195,11 +195,10 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders)
d_video->decoder_desc =
talloc_asprintf(d_video, "%s [%s:%s]", decoder->desc, decoder->family,
decoder->decoder);
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Selected video codec: %s\n",
- d_video->decoder_desc);
+ MP_INFO(d_video, "Selected video codec: %s\n",
+ d_video->decoder_desc);
} else {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR,
- "Failed to initialize a video decoder for codec '%s'.\n",
+ MP_ERR(d_video, "Failed to initialize a video decoder for codec '%s'.\n",
d_video->header->codec ? d_video->header->codec : "<unknown>");
}
@@ -216,7 +215,7 @@ static void add_pts_to_sort(struct dec_video *d_video, double pts)
d_video->num_buffered_pts = delay;
if (d_video->num_buffered_pts ==
sizeof(d_video->buffered_pts) / sizeof(double))
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
+ MP_ERR(d_video, "Too many buffered pts\n");
else {
int i, j;
for (i = 0; i < d_video->num_buffered_pts; i++)
@@ -244,8 +243,7 @@ static double retrieve_sorted_pts(struct dec_video *d_video, double codec_pts)
d_video->num_buffered_pts--;
sorted_pts = d_video->buffered_pts[d_video->num_buffered_pts];
} else {
- mp_msg(MSGT_CPLAYER, MSGL_ERR,
- "No pts value from demuxer to use for frame!\n");
+ MP_ERR(d_video, "No pts value from demuxer to use for frame!\n");
sorted_pts = MP_NOPTS_VALUE;
}
@@ -277,9 +275,8 @@ static double retrieve_sorted_pts(struct dec_video *d_video, double codec_pts)
}
if (probcount1 >= probcount2 * 1.5 + 2) {
d_video->pts_assoc_mode = 3 - d_video->pts_assoc_mode;
- mp_msg(MSGT_DECVIDEO, MSGL_WARN,
- "Switching to pts association mode %d.\n",
- d_video->pts_assoc_mode);
+ MP_WARN(d_video, "Switching to pts association mode %d.\n",
+ d_video->pts_assoc_mode);
}
}
return d_video->pts_assoc_mode == 1 ? codec_pts : sorted_pts;
@@ -347,7 +344,7 @@ struct mp_image *video_decode(struct dec_video *d_video,
if (!opts->correct_pts || pts == MP_NOPTS_VALUE) {
if (opts->correct_pts)
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, "No video PTS! Making something up.\n");
+ MP_WARN(d_video, "No video PTS! Making something up.\n");
double frame_time = 1.0f / (d_video->fps > 0 ? d_video->fps : 25);
double base = d_video->last_packet_pdts;
@@ -359,8 +356,8 @@ struct mp_image *video_decode(struct dec_video *d_video,
}
if (d_video->decoded_pts != MP_NOPTS_VALUE && pts <= d_video->decoded_pts) {
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Non-monotonic video pts: %f <= %f\n",
- pts, d_video->decoded_pts);
+ MP_WARN(d_video, "Non-monotonic video pts: %f <= %f\n",
+ pts, d_video->decoded_pts);
}
if (d_video->has_broken_packet_pts < 0)
@@ -380,13 +377,12 @@ int video_reconfig_filters(struct dec_video *d_video,
struct mp_image_params p = *params;
struct sh_video *sh = d_video->header->video;
- mp_msg(MSGT_DECVIDEO, MSGL_V,
- "VIDEO: %dx%d %5.3f fps %5.1f kbps (%4.1f kB/s)\n",
- p.w, p.h, sh->fps, sh->i_bps * 0.008,
- sh->i_bps / 1000.0);
+ MP_VERBOSE(d_video, "VIDEO: %dx%d %5.3f fps %5.1f kbps (%4.1f kB/s)\n",
+ p.w, p.h, sh->fps, sh->i_bps * 0.008,
+ sh->i_bps / 1000.0);
- mp_msg(MSGT_DECVIDEO, MSGL_V, "VDec: vo config request - %d x %d (%s)\n",
- p.w, p.h, vo_format_name(p.imgfmt));
+ MP_VERBOSE(d_video, "VDec: vo config request - %d x %d (%s)\n",
+ p.w, p.h, vo_format_name(p.imgfmt));
float decoder_aspect = p.d_w / (float)p.d_h;
if (d_video->initial_decoder_aspect == 0)
@@ -410,9 +406,9 @@ int video_reconfig_filters(struct dec_video *d_video,
vf_set_dar(&p.d_w, &p.d_h, p.w, p.h, force_aspect);
if (abs(p.d_w - p.w) >= 4 || abs(p.d_h - p.h) >= 4) {
- mp_msg(MSGT_CPLAYER, MSGL_V, "Aspect ratio is %.2f:1 - "
- "scaling to correct movie aspect.\n", sh->aspect);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\n", sh->aspect);
+ MP_VERBOSE(d_video, "Aspect ratio is %.2f:1 - "
+ "scaling to correct movie aspect.\n", sh->aspect);
+ MP_SMODE(d_video, "ID_VIDEO_ASPECT=%1.4f\n", sh->aspect);
} else {
p.d_w = p.w;
p.d_h = p.h;
@@ -430,11 +426,11 @@ int video_reconfig_filters(struct dec_video *d_video,
mp_image_params_guess_csp(&p);
// Time to config libvo!
- mp_msg(MSGT_CPLAYER, MSGL_V, "VO Config (%dx%d->%dx%d,0x%X)\n",
- p.w, p.h, p.d_w, p.d_h, p.imgfmt);
+ MP_VERBOSE(d_video, "VO Config (%dx%d->%dx%d,0x%X)\n",
+ p.w, p.h, p.d_w, p.d_h, p.imgfmt);
if (vf_reconfig(d_video->vfilter, &p) < 0) {
- mp_msg(MSGT_CPLAYER, MSGL_WARN, "FATAL: Cannot initialize video driver.\n");
+ MP_WARN(d_video, "FATAL: Cannot initialize video driver.\n");
return -1;
}
diff --git a/video/decode/dec_video.h b/video/decode/dec_video.h
index c0a8fcffe1..7805d89c48 100644
--- a/video/decode/dec_video.h
+++ b/video/decode/dec_video.h
@@ -29,6 +29,8 @@ struct mp_decoder_list;
struct vo;
struct dec_video {
+ struct mp_log *log;
+ struct mpv_global *global;
struct MPOpts *opts;
struct vf_chain *vfilter; // video filter chain
struct vo *vo; // (still) needed by video_set/get_colors
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index ead147ab18..867488de95 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -21,6 +21,7 @@ enum hwdec_type {
};
typedef struct lavc_ctx {
+ struct mp_log *log;
struct MPOpts *opts;
AVCodecContext *avctx;
AVFrame *pic;
diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c
index 8a9ff4ae50..d4b1c41840 100644
--- a/video/decode/vaapi.c
+++ b/video/decode/vaapi.c
@@ -55,6 +55,7 @@
#define MAX_SURFACES (MAX_DECODER_SURFACES + ADDTIONAL_SURFACES)
struct priv {
+ struct mp_log *log;
struct mp_vaapi_ctx *ctx;
VADisplay display;
Display *x11_display;
@@ -166,7 +167,7 @@ static bool preallocate_surfaces(struct lavc_ctx *ctx, int num)
{
struct priv *p = ctx->hwdec_priv;
if (!va_surface_pool_reserve(p->pool, num, p->w, p->h)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Could not allocate surfaces.\n");
+ MP_ERR(p, "Could not allocate surfaces.\n");
return false;
}
for (int i = 0; i < num; i++) {
@@ -218,57 +219,55 @@ static int create_decoder(struct lavc_ctx *ctx)
const struct hwdec_profile_entry *pe = hwdec_find_profile(ctx, profiles);
if (!pe) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Unsupported codec or profile.\n");
+ MP_ERR(p, "Unsupported codec or profile.\n");
goto error;
}
int num_profiles = vaMaxNumProfiles(p->display);
VAProfile *va_profiles = talloc_zero_array(tmp, VAProfile, num_profiles);
status = vaQueryConfigProfiles(p->display, va_profiles, &num_profiles);
- if (!check_va_status(status, "vaQueryConfigProfiles()"))
+ if (!CHECK_VA_STATUS(p, "vaQueryConfigProfiles()"))
goto error;
- mp_msg(MSGT_VO, MSGL_DBG2, "[vaapi] %d profiles available:\n", num_profiles);
+ MP_DBG(p, "%d profiles available:\n", num_profiles);
for (int i = 0; i < num_profiles; i++)
- mp_msg(MSGT_VO, MSGL_DBG2, " %s\n", str_va_profile(va_profiles[i]));
+ MP_DBG(p, " %s\n", str_va_profile(va_profiles[i]));
VAProfile va_profile = pe->hw_profile;
if (!has_profile(va_profiles, num_profiles, va_profile)) {
- mp_msg(MSGT_VO, MSGL_ERR,
- "[vaapi] Decoder profile '%s' not available.\n",
+ MP_ERR(p, "Decoder profile '%s' not available.\n",
str_va_profile(va_profile));
goto error;
}
- mp_msg(MSGT_VO, MSGL_V, "[vaapi] Using profile '%s'.\n",
- str_va_profile(va_profile));
+ MP_VERBOSE(p, "Using profile '%s'.\n", str_va_profile(va_profile));
int num_surfaces = hwdec_get_max_refs(ctx);
if (!is_direct_mapping(p->display)) {
- mp_msg(MSGT_VO, MSGL_V, "[vaapi] No direct mapping.\n");
+ MP_VERBOSE(p, "No direct mapping.\n");
// Note: not sure why it has to be *=2 rather than +=1.
num_surfaces *= 2;
}
num_surfaces = MPMIN(num_surfaces, MAX_DECODER_SURFACES) + ADDTIONAL_SURFACES;
if (num_surfaces > MAX_SURFACES) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Internal error: too many surfaces.\n");
+ MP_ERR(p, "Internal error: too many surfaces.\n");
goto error;
}
if (!preallocate_surfaces(ctx, num_surfaces)) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Could not allocate surfaces.\n");
+ MP_ERR(p, "Could not allocate surfaces.\n");
goto error;
}
int num_ep = vaMaxNumEntrypoints(p->display);
VAEntrypoint *ep = talloc_zero_array(tmp, VAEntrypoint, num_ep);
status = vaQueryConfigEntrypoints(p->display, va_profile, ep, &num_ep);
- if (!check_va_status(status, "vaQueryConfigEntrypoints()"))
+ if (!CHECK_VA_STATUS(p, "vaQueryConfigEntrypoints()"))
goto error;
int entrypoint = find_entrypoint(p->format, ep, num_ep);
if (entrypoint < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Could not find VA entrypoint.\n");
+ MP_ERR(p, "Could not find VA entrypoint.\n");
goto error;
}
@@ -277,23 +276,23 @@ static int create_decoder(struct lavc_ctx *ctx)
};
status = vaGetConfigAttributes(p->display, va_profile, entrypoint,
&attrib, 1);
- if (!check_va_status(status, "vaGetConfigAttributes()"))
+ if (!CHECK_VA_STATUS(p, "vaGetConfigAttributes()"))
goto error;
if ((attrib.value & p->rt_format) == 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Chroma format not supported.\n");
+ MP_ERR(p, "Chroma format not supported.\n");
goto error;
}
status = vaCreateConfig(p->display, va_profile, entrypoint, &attrib, 1,
&p->va_context->config_id);
- if (!check_va_status(status, "vaCreateConfig()"))
+ if (!CHECK_VA_STATUS(p, "vaCreateConfig()"))
goto error;
status = vaCreateContext(p->display, p->va_context->config_id,
p->w, p->h, VA_PROGRESSIVE,
p->surfaces, num_surfaces,
&p->va_context->context_id);
- if (!check_va_status(status, "vaCreateContext()"))
+ if (!CHECK_VA_STATUS(p, "vaCreateContext()"))
goto error;
res = 0;
@@ -328,7 +327,7 @@ static struct mp_image *allocate_image(struct lavc_ctx *ctx, int format,
}
va_surface_release(s);
}
- mp_msg(MSGT_VO, MSGL_ERR, "[vaapi] Insufficient number of surfaces.\n");
+ MP_ERR(p, "Insufficient number of surfaces.\n");
return NULL;
}
@@ -353,7 +352,7 @@ static bool create_va_dummy_ctx(struct priv *p)
VADisplay *display = vaGetDisplay(p->x11_display);
if (!display)
goto destroy_ctx;
- p->ctx = va_initialize(display);
+ p->ctx = va_initialize(display, p->log);
if (!p->ctx) {
vaTerminate(display);
goto destroy_ctx;
@@ -385,6 +384,7 @@ static int init_with_vactx(struct lavc_ctx *ctx, struct mp_vaapi_ctx *vactx)
{
struct priv *p = talloc_ptrtype(NULL, p);
*p = (struct priv) {
+ .log = mp_log_new(p, ctx->log, "vaapi"),
.ctx = vactx,
.va_context = &p->va_context_storage,
.rt_format = VA_RT_FORMAT_YUV420
@@ -398,7 +398,7 @@ static int init_with_vactx(struct lavc_ctx *ctx, struct mp_vaapi_ctx *vactx)
}
p->display = p->ctx->display;
- p->pool = va_surface_pool_alloc(p->display, p->rt_format);
+ p->pool = va_surface_pool_alloc(p->ctx, p->rt_format);
p->sw_pool = talloc_steal(p, mp_image_pool_new(17));
p->va_context->display = p->display;
@@ -432,7 +432,7 @@ static int probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
static int probe_copy(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
const char *decoder)
{
- struct priv dummy = {0};
+ struct priv dummy = {mp_null_log};
if (!create_va_dummy_ctx(&dummy))
return HWDEC_ERR_NO_CTX;
destroy_va_dummy_ctx(&dummy);
@@ -452,12 +452,10 @@ static struct mp_image *copy_image(struct lavc_ctx *ctx, struct mp_image *img)
struct va_surface *surface = va_surface_in_mp_image(img);
if (surface) {
- struct mp_image *simg =
- va_surface_download(surface, p->ctx->image_formats, p->sw_pool);
+ struct mp_image *simg = va_surface_download(surface, p->sw_pool);
if (simg) {
if (!p->printed_readback_warning) {
- mp_msg(MSGT_VO, MSGL_WARN, "[vaapi] Using GPU readback. This "
- "is usually inefficient.\n");
+ MP_WARN(p, "Using GPU readback. This is usually inefficient.\n");
p->printed_readback_warning = true;
}
talloc_free(img);
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 8a8d2b6abc..7530eb0fa5 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -127,7 +127,7 @@ static bool hwdec_codec_allowed(struct dec_video *vd, const char *codec)
return false;
}
-static enum AVDiscard str2AVDiscard(char *str)
+static enum AVDiscard str2AVDiscard(struct dec_video *vd, char *str)
{
if (!str) return AVDISCARD_DEFAULT;
if (strcasecmp(str, "none" ) == 0) return AVDISCARD_NONE;
@@ -136,7 +136,7 @@ static enum AVDiscard str2AVDiscard(char *str)
if (strcasecmp(str, "bidir" ) == 0) return AVDISCARD_BIDIR;
if (strcasecmp(str, "nonkey" ) == 0) return AVDISCARD_NONKEY;
if (strcasecmp(str, "all" ) == 0) return AVDISCARD_ALL;
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Unknown discard value %s\n", str);
+ MP_ERR(vd, "Unknown discard value %s\n", str);
return AVDISCARD_DEFAULT;
}
@@ -218,8 +218,8 @@ static bool probe_hwdec(struct dec_video *vd, bool autoprobe, enum hwdec_type ap
{
struct vd_lavc_hwdec *hwdec = find_hwcodec(api);
if (!hwdec) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Requested hardware decoder not "
- "compiled.\n");
+ MP_VERBOSE(vd, "Requested hardware decoder not "
+ "compiled.\n");
return false;
}
const char *hw_decoder = NULL;
@@ -229,10 +229,10 @@ static bool probe_hwdec(struct dec_video *vd, bool autoprobe, enum hwdec_type ap
*use_decoder = hw_decoder;
return true;
} else if (r == HWDEC_ERR_NO_CODEC) {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Hardware decoder '%s' not found in "
- "libavcodec.\n", hw_decoder ? hw_decoder : decoder);
+ MP_VERBOSE(vd, "Hardware decoder '%s' not found in "
+ "libavcodec.\n", hw_decoder ? hw_decoder : decoder);
} else if (r == HWDEC_ERR_NO_CTX && !autoprobe) {
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, "VO does not support requested "
+ MP_WARN(vd, "VO does not support requested "
"hardware decoder.\n");
}
return false;
@@ -243,11 +243,12 @@ static int init(struct dec_video *vd, const char *decoder)
{
vd_ffmpeg_ctx *ctx;
ctx = vd->priv = talloc_zero(NULL, vd_ffmpeg_ctx);
+ ctx->log = vd->log;
ctx->opts = vd->opts;
ctx->non_dr1_pool = talloc_steal(ctx, mp_image_pool_new(16));
if (bstr_endswith0(bstr0(decoder), "_vdpau")) {
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, "VDPAU decoder '%s' was requested. "
+ MP_WARN(vd, "VDPAU decoder '%s' was requested. "
"This way of enabling hardware\ndecoding is not supported "
"anymore. Use --hwdec=vdpau instead.\nThe --hwdec-codec=... "
"option can be used to restrict which codecs are\nenabled, "
@@ -272,24 +273,24 @@ static int init(struct dec_video *vd, const char *decoder)
&hwdec, &hw_decoder);
}
} else {
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Not trying to use hardware decoding: "
- "codec %s is blacklisted by user.\n", decoder);
+ MP_VERBOSE(vd, "Not trying to use hardware decoding: "
+ "codec %s is blacklisted by user.\n", decoder);
}
if (hwdec) {
ctx->software_fallback_decoder = talloc_strdup(ctx, decoder);
if (hw_decoder)
decoder = hw_decoder;
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Trying to use hardware decoding.\n");
+ MP_INFO(vd, "Trying to use hardware decoding.\n");
} else if (vd->opts->hwdec_api != HWDEC_NONE) {
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, "Using software decoding.\n");
+ MP_INFO(vd, "Using software decoding.\n");
}
init_avctx(vd, decoder, hwdec);
if (!ctx->avctx) {
if (ctx->software_fallback_decoder) {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Error initializing hardware "
- "decoding, falling back to software decoding.\n");
+ MP_ERR(vd, "Error initializing hardware decoding, "
+ "falling back to software decoding.\n");
decoder = ctx->software_fallback_decoder;
ctx->software_fallback_decoder = NULL;
init_avctx(vd, decoder, NULL);
@@ -420,14 +421,13 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
avctx->flags |= lavc_param->bitexact;
avctx->flags2 |= lavc_param->fast;
- avctx->skip_loop_filter = str2AVDiscard(lavc_param->skip_loop_filter_str);
- avctx->skip_idct = str2AVDiscard(lavc_param->skip_idct_str);
- avctx->skip_frame = str2AVDiscard(lavc_param->skip_frame_str);
+ avctx->skip_loop_filter = str2AVDiscard(vd, lavc_param->skip_loop_filter_str);
+ avctx->skip_idct = str2AVDiscard(vd, lavc_param->skip_idct_str);
+ avctx->skip_frame = str2AVDiscard(vd, lavc_param->skip_frame_str);
if (lavc_param->avopt) {
if (parse_avopts(avctx, lavc_param->avopt) < 0) {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR,
- "Your options /%s/ look like gibberish to me pal\n",
+ MP_ERR(vd, "Your options /%s/ look like gibberish to me pal\n",
lavc_param->avopt);
uninit_avctx(vd);
return;
@@ -448,6 +448,9 @@ static void init_avctx(struct dec_video *vd, const char *decoder,
if (mp_rawvideo) {
avctx->pix_fmt = imgfmt2pixfmt(sh->format);
avctx->codec_tag = 0;
+ if (avctx->pix_fmt == AV_PIX_FMT_NONE && sh->format)
+ MP_ERR(vd, "Image format %s not supported by lavc.\n",
+ mp_imgfmt_to_name(sh->format));</