avformat/yuvmpegenc: add support for rawvideo input

The demuxer exports rawvideo, so there's no reason for the muxer to only
work with wrapped_avframe.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2023-05-17 11:21:52 -03:00
parent 4c695bfa65
commit a2a0a81184
1 changed files with 7 additions and 1 deletions

View File

@ -189,6 +189,11 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
avio_printf(s->pb, Y4M_FRAME_MAGIC "\n"); avio_printf(s->pb, Y4M_FRAME_MAGIC "\n");
if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
avio_write(pb, pkt->data, pkt->size);
return 0;
}
width = st->codecpar->width; width = st->codecpar->width;
height = st->codecpar->height; height = st->codecpar->height;
desc = av_pix_fmt_desc_get(st->codecpar->format); desc = av_pix_fmt_desc_get(st->codecpar->format);
@ -218,7 +223,8 @@ static int yuv4_init(AVFormatContext *s)
if (s->nb_streams != 1) if (s->nb_streams != 1)
return AVERROR(EIO); return AVERROR(EIO);
if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME) { if (s->streams[0]->codecpar->codec_id != AV_CODEC_ID_WRAPPED_AVFRAME &&
s->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) {
av_log(s, AV_LOG_ERROR, "ERROR: Codec not supported.\n"); av_log(s, AV_LOG_ERROR, "ERROR: Codec not supported.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }