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.
This commit is contained in:
wm4 2017-05-20 11:10:55 +02:00
parent 37f0571973
commit 9b5e4e5715
4 changed files with 18 additions and 11 deletions

View File

@ -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")

View File

@ -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;

View File

@ -22,6 +22,10 @@
#include <unistd.h>
#include <string.h>
#include <libavcodec/avcodec.h>
#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);

View File

@ -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 = {