[vlc-commits] mux: avformat: add support for RGB
Francois Cartegnie
git at videolan.org
Tue Sep 25 16:35:00 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Sep 24 18:39:48 2018 +0200| [bd803cc97f678f032cd2e4bcd7ca7216ae57fd2b] | committer: Francois Cartegnie
mux: avformat: add support for RGB
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd803cc97f678f032cd2e4bcd7ca7216ae57fd2b
---
modules/codec/avcodec/fourcc.c | 9 ++++++++-
modules/demux/avformat/mux.c | 10 ++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index 7711090c03..293ead515e 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -62,7 +62,12 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
{ VLC_CODEC_SP5X, AV_CODEC_ID_SP5X },
{ VLC_CODEC_JPEGLS, AV_CODEC_ID_JPEGLS },
{ VLC_CODEC_MP4V, AV_CODEC_ID_MPEG4 },
- /* AV_CODEC_ID_RAWVIDEO */
+ { VLC_CODEC_RGB32, AV_CODEC_ID_RAWVIDEO },
+ { VLC_CODEC_RGB24, AV_CODEC_ID_RAWVIDEO },
+ { VLC_CODEC_RGB16, AV_CODEC_ID_RAWVIDEO },
+ { VLC_CODEC_RGB8, AV_CODEC_ID_RAWVIDEO },
+ { VLC_CODEC_RGBA, AV_CODEC_ID_RAWVIDEO },
+ { VLC_CODEC_ARGB, AV_CODEC_ID_RAWVIDEO },
{ VLC_CODEC_DIV1, AV_CODEC_ID_MSMPEG4V1 },
{ VLC_CODEC_DIV2, AV_CODEC_ID_MSMPEG4V2 },
{ VLC_CODEC_DIV3, AV_CODEC_ID_MSMPEG4V3 },
@@ -559,6 +564,8 @@ vlc_fourcc_t GetVlcFourcc( unsigned i_ffmpeg_codec )
{
for( size_t i = 0; i < ARRAY_SIZE(video_codecs); i++ )
{
+ if( i_ffmpeg_codec == AV_CODEC_ID_RAWVIDEO )
+ return VLC_CODEC_UNKNOWN;
if( video_codecs[i].i_codec == i_ffmpeg_codec )
return video_codecs[i].i_fourcc;
}
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index c2802497bd..215bcfb0a8 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -32,6 +32,7 @@
#include <vlc_common.h>
#include <vlc_block.h>
#include <vlc_sout.h>
+#include <vlc_es.h>
#include <libavformat/avformat.h>
@@ -285,6 +286,15 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
stream->sample_aspect_ratio.num = codecpar->sample_aspect_ratio.num;
stream->time_base.den = i_frame_rate;
stream->time_base.num = i_frame_rate_base;
+ if(i_codec_id == AV_CODEC_ID_RAWVIDEO)
+ {
+ video_format_t vfmt;
+ video_format_Copy(&vfmt, &fmt->video);
+ video_format_FixRgb(&vfmt);
+ if(GetFfmpegChroma(&codecpar->format, &vfmt))
+ msg_Warn(p_mux, "can't match format RAW video %4.4s", &vfmt.i_chroma);
+ video_format_Clean(&vfmt);
+ }
if (fmt->i_bitrate == 0) {
msg_Warn( p_mux, "Missing video bitrate, assuming 512k" );
i_bitrate = 512000;
More information about the vlc-commits
mailing list