From 9b5e4e5715deede7bdea8e7a17f1bb85e4b7b09b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 May 2017 11:10:55 +0200 Subject: demux_raw: drop "mp-rawvideo" use This is an old pseudo codec to pass through the pixel format. Setup a suitable AVCodecParameter directly instead, so the "rawvideo" codec can be used. --- DOCS/interface-changes.rst | 1 + common/av_common.c | 4 ---- demux/demux_raw.c | 19 +++++++++++++++++-- video/decode/vd_lavc.c | 5 ----- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index aadbf159d0..b767f4b450 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -24,6 +24,7 @@ Interface changes Some of them were removed in earlier releases. - introduce --replaygain... options, which replace the same functionality provided by the deprecated --af=volume:replaygain... mechanism. + - drop the internal "mp-rawvideo" codec (used by --demuxer=rawvideo) --- mpv 0.25.0 --- - remove opengl-cb dxva2 dummy hwdec interop (see git "vo_opengl: remove dxva2 dummy hwdec backend") diff --git a/common/av_common.c b/common/av_common.c index d7ad8e172c..c91da79634 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -90,10 +90,6 @@ AVCodecParameters *mp_codec_params_to_av(struct mp_codec_params *c) // Video only avp->width = c->disp_w; avp->height = c->disp_h; - if (c->codec && strcmp(c->codec, "mp-rawvideo") == 0) { - avp->format = imgfmt2pixfmt(c->codec_tag); - avp->codec_tag = 0; - } // Audio only avp->sample_rate = c->samplerate; diff --git a/demux/demux_raw.c b/demux/demux_raw.c index 674d4e7fea..c0948c59dc 100644 --- a/demux/demux_raw.c +++ b/demux/demux_raw.c @@ -22,6 +22,10 @@ #include #include +#include + +#include "common/av_common.h" + #include "options/m_config.h" #include "options/m_option.h" @@ -30,6 +34,7 @@ #include "stheader.h" #include "codec_tags.h" +#include "video/fmt-conversion.h" #include "video/img_format.h" #include "video/img_fourcc.h" @@ -187,9 +192,9 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check) const char *decoder = "rawvideo"; int imgfmt = opts->vformat; int imgsize = opts->imgsize; + int mp_imgfmt = 0; if (opts->mp_format && !IMGFMT_IS_HWACCEL(opts->mp_format)) { - decoder = "mp-rawvideo"; - imgfmt = opts->mp_format; + mp_imgfmt = opts->mp_format; if (!imgsize) { struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(opts->mp_format); for (int p = 0; p < desc.num_planes; p++) { @@ -241,6 +246,16 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check) c->reliable_fps = true; c->disp_w = width; c->disp_h = height; + if (mp_imgfmt) { + c->lav_codecpar = avcodec_parameters_alloc(); + if (!c->lav_codecpar) + abort(); + c->lav_codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + c->lav_codecpar->codec_id = mp_codec_to_av_codec_id(decoder); + c->lav_codecpar->format = imgfmt2pixfmt(mp_imgfmt); + c->lav_codecpar->width = width; + c->lav_codecpar->height = height; + } demux_add_sh_stream(demuxer, sh); struct priv *p = talloc_ptrtype(demuxer, p); diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 9c1a2a0317..8febf93325 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -556,9 +556,6 @@ static void init_avctx(struct dec_video *vd, const char *decoder, assert(!ctx->avctx); - if (strcmp(decoder, "mp-rawvideo") == 0) - decoder = "rawvideo"; - AVCodec *lavc_codec = avcodec_find_decoder_by_name(decoder); if (!lavc_codec) return; @@ -1216,8 +1213,6 @@ static int control(struct dec_video *vd, int cmd, void *arg) static void add_decoders(struct mp_decoder_list *list) { mp_add_lavc_decoders(list, AVMEDIA_TYPE_VIDEO); - mp_add_decoder(list, "lavc", "mp-rawvideo", "mp-rawvideo", - "raw video"); } const struct vd_functions mpcodecs_vd_ffmpeg = { -- cgit v1.2.3