[vlc-commits] [Git][videolan/vlc][master] 16 commits: vlc_fourcc: fix typo
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Aug 25 07:05:08 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
756bc601 by Steve Lhomme at 2023-08-25T06:39:38+00:00
vlc_fourcc: fix typo
- - - - -
eea271bf by Steve Lhomme at 2023-08-25T06:39:38+00:00
daala: use vlc_fourcc_t for the local codec
- - - - -
5854bc72 by Steve Lhomme at 2023-08-25T06:39:38+00:00
screen/xcb: use vlc_fourcc_t for the local chroma
- - - - -
54dc2e42 by Steve Lhomme at 2023-08-25T06:39:38+00:00
audiobargraph: use the real vlc_fourcc_t for YUVA
This is an internal VLC value, not a FourCC we pass to another API.
- - - - -
212f918e by Steve Lhomme at 2023-08-25T06:39:38+00:00
dxgi_fmt: set the mask for some RGB mapping
DXGI_FORMAT_B8G8R8X8_UNORM is mapped to VLC_CODEC_RGB32,
DXGI_FORMAT_B5G6R5_UNORM is mapped to VLC_CODEC_RGB16.
DXGI_FORMAT_B8G8R8A8_UNORM is mapped to VLC_CODEC_BGRA and doesn't need a mask.
- - - - -
c955e76b by Steve Lhomme at 2023-08-25T06:39:38+00:00
access/dshow: store the chroma as a vlc_fourcc_t
- - - - -
bdc46d9a by Steve Lhomme at 2023-08-25T06:39:38+00:00
access/dshow: pass the chroma as a vlc_fourcc_t
- - - - -
bfbf7b75 by Steve Lhomme at 2023-08-25T06:39:38+00:00
access/dshow: pass the format to fix as a video_format_t
We don't need to know it comes from an es_format_t.
- - - - -
c2821b97 by Steve Lhomme at 2023-08-25T06:39:38+00:00
access/dshow: don't set masks set by RgbFix
It's better to have a single location when possible.
The RGB24 and RGB32 don't match so we keep them local.
- - - - -
880043e3 by Steve Lhomme at 2023-08-25T06:39:38+00:00
demux/mkv: use %4.4s to log a FourCC
No need to call vlc_fourcc_to_char() for that.
- - - - -
0132a575 by Steve Lhomme at 2023-08-25T06:39:38+00:00
schroedinger: use %4.4s to log a FourCC
No need to call vlc_fourcc_to_char() for that.
- - - - -
5dd44b63 by Steve Lhomme at 2023-08-25T06:39:38+00:00
dvdbsub: log the FourCC as a string
As it's done everywhere else.
- - - - -
29ae37d8 by Steve Lhomme at 2023-08-25T06:39:38+00:00
i420_rgb: don't do video_format_Init before video_format_Copy
video_format_Copy is really an init like video_format_InitFromFormat. The
video_format_t doesn't should to be uninitialized prior this call. Otherwise
it needs to be cleared with video_format_Clear().
- - - - -
9cd6ff85 by Steve Lhomme at 2023-08-25T06:39:38+00:00
i420_rgb: only fix the mask if it's not set
The call is more important than the log message refers to.
- - - - -
753737c2 by Steve Lhomme at 2023-08-25T06:39:38+00:00
avcodec/fourcc: exit early for AV_CODEC_ID_RAWVIDEO
- - - - -
87f265b0 by Steve Lhomme at 2023-08-25T06:39:38+00:00
direct3d9: don't rely on the mask to tell if a format is RGB
- - - - -
15 changed files:
- include/vlc_fourcc.h
- modules/access/dshow/access.h
- modules/access/dshow/dshow.cpp
- modules/access/dshow/filter.cpp
- modules/access/dshow/filter.h
- modules/access/screen/xcb.c
- modules/codec/avcodec/fourcc.c
- modules/codec/daala.c
- modules/codec/dvbsub.c
- modules/codec/schroedinger.c
- modules/demux/mkv/matroska_segment_parse.cpp
- modules/spu/audiobargraph_v.c
- modules/video_chroma/dxgi_fmt.c
- modules/video_chroma/i420_rgb.c
- modules/video_output/win32/direct3d9.c
Changes:
=====================================
include/vlc_fourcc.h
=====================================
@@ -349,7 +349,7 @@
#define VLC_CODEC_RGB12 VLC_FOURCC('R','V','1','2')
/* 15-bit RGB padded to 16 bits (using explicit masks) */
#define VLC_CODEC_RGB15 VLC_FOURCC('R','V','1','5')
-/* 16-bit RGB (using explit masks) */
+/* 16-bit RGB (using explicit masks) */
#define VLC_CODEC_RGB16 VLC_FOURCC('R','V','1','6')
/* 24-bit RGB (using explicit masks) */
#define VLC_CODEC_RGB24 VLC_FOURCC('R','V','2','4')
=====================================
modules/access/dshow/access.h
=====================================
@@ -81,7 +81,7 @@ struct access_sys_t
/* misc properties */
int i_width;
int i_height;
- int i_chroma;
+ vlc_fourcc_t i_chroma;
vlc_tick_t i_start;
};
=====================================
modules/access/dshow/dshow.cpp
=====================================
@@ -68,7 +68,7 @@ static int OpenDevice( vlc_object_t *, access_sys_t *, std::string, bool );
static ComPtr<IBaseFilter> FindCaptureDevice( vlc_object_t *, std::string *,
std::list<std::string> *, bool );
static size_t EnumDeviceCaps( vlc_object_t *, ComPtr<IBaseFilter> &,
- int, int, int, int, int, int,
+ vlc_fourcc_t, int, int, int, int, int,
AM_MEDIA_TYPE *mt, size_t, bool );
static bool ConnectFilters( vlc_object_t *, access_sys_t *,
ComPtr<IBaseFilter> &, ComPtr<CaptureFilter> & );
@@ -299,7 +299,7 @@ struct dshow_stream_t
} header;
- int i_fourcc;
+ vlc_fourcc_t i_fourcc;
es_out_id_t *p_es;
bool b_pts;
@@ -622,37 +622,27 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
return VLC_SUCCESS;
}
-static void SetRGBMasks( vlc_fourcc_t i_fourcc, es_format_t *fmt )
+static void SetRGBMasks( vlc_fourcc_t i_fourcc, video_format_t *fmt )
{
switch( i_fourcc )
{
- case VLC_CODEC_RGB15:
- fmt->video.i_rmask = 0x7c00;
- fmt->video.i_gmask = 0x03e0;
- fmt->video.i_bmask = 0x001f;
- break;
- case VLC_CODEC_RGB16:
- fmt->video.i_rmask = 0xf800;
- fmt->video.i_gmask = 0x07e0;
- fmt->video.i_bmask = 0x001f;
- break;
case VLC_CODEC_RGB24:
/* This is in BGR format */
- fmt->video.i_bmask = 0x00ff0000;
- fmt->video.i_gmask = 0x0000ff00;
- fmt->video.i_rmask = 0x000000ff;
+ fmt->i_bmask = 0x00ff0000;
+ fmt->i_gmask = 0x0000ff00;
+ fmt->i_rmask = 0x000000ff;
break;
case VLC_CODEC_RGB32:
/* This is in BGRx format */
- fmt->video.i_bmask = 0xff000000;
- fmt->video.i_gmask = 0x00ff0000;
- fmt->video.i_rmask = 0x0000ff00;
+ fmt->i_bmask = 0xff000000;
+ fmt->i_gmask = 0x00ff0000;
+ fmt->i_rmask = 0x0000ff00;
break;
default:
return;
}
- fmt->video.i_chroma = i_fourcc;
- video_format_FixRgb( &fmt->video );
+ fmt->i_chroma = i_fourcc;
+ video_format_FixRgb( fmt );
}
/*****************************************************************************
@@ -733,7 +723,7 @@ static int DemuxOpen( vlc_object_t *p_this )
}
/* Setup rgb mask for RGB formats */
- SetRGBMasks( p_stream->i_fourcc, &fmt );
+ SetRGBMasks( p_stream->i_fourcc, &fmt.video );
if( p_stream->header.video.AvgTimePerFrame )
{
@@ -946,7 +936,7 @@ static bool ConnectFilters( vlc_object_t *p_this, access_sys_t *p_sys,
/*
* get fourcc priority from arbitrary preference, the higher the better
*/
-static int GetFourCCPriority( int i_fourcc )
+static int GetFourCCPriority( vlc_fourcc_t i_fourcc )
{
switch( i_fourcc )
{
@@ -1317,7 +1307,7 @@ FindCaptureDevice( vlc_object_t *p_this, std::string *p_devicename,
}
static size_t EnumDeviceCaps( vlc_object_t *p_this, ComPtr<IBaseFilter> &p_filter,
- int i_fourcc, int i_width, int i_height,
+ vlc_fourcc_t i_fourcc, int i_width, int i_height,
int i_channels, int i_samplespersec,
int i_bitspersample, AM_MEDIA_TYPE *mt,
size_t mt_max, bool b_audio )
@@ -1385,7 +1375,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, ComPtr<IBaseFilter> &p_filte
{
if( SUCCEEDED(pSC->GetStreamCaps(i, &p_mt, static_cast<BYTE*>(pSCC))) )
{
- int i_current_fourcc = GetFourCCFromMediaType( *p_mt );
+ vlc_fourcc_t i_current_fourcc = GetFourCCFromMediaType( *p_mt );
int i_current_priority = GetFourCCPriority(i_current_fourcc);
if( (i_fourcc && (i_current_fourcc != i_fourcc))
@@ -1578,7 +1568,7 @@ static size_t EnumDeviceCaps( vlc_object_t *p_this, ComPtr<IBaseFilter> &p_filte
while( p_enummt->Next( 1, &p_mt, NULL ) == S_OK )
{
- int i_current_fourcc = GetFourCCFromMediaType( *p_mt );
+ vlc_fourcc_t i_current_fourcc = GetFourCCFromMediaType( *p_mt );
if( !b_audio && i_current_fourcc && p_mt->majortype == MEDIATYPE_Video
&& p_mt->formattype == FORMAT_VideoInfo )
{
=====================================
modules/access/dshow/filter.cpp
=====================================
@@ -95,9 +95,9 @@ HRESULT WINAPI CopyMediaType( AM_MEDIA_TYPE *pmtTarget,
return S_OK;
}
-int GetFourCCFromMediaType( const AM_MEDIA_TYPE &media_type )
+vlc_fourcc_t GetFourCCFromMediaType( const AM_MEDIA_TYPE &media_type )
{
- int i_fourcc = 0;
+ vlc_fourcc_t i_fourcc = 0;
if( media_type.majortype == MEDIATYPE_Video )
{
@@ -505,7 +505,7 @@ STDMETHODIMP CapturePin::QueryAccept( const AM_MEDIA_TYPE *pmt )
return S_FALSE;
}
- int i_fourcc = GetFourCCFromMediaType(*pmt);
+ vlc_fourcc_t i_fourcc = GetFourCCFromMediaType(*pmt);
if( !i_fourcc )
{
msg_Dbg( p_input, "CapturePin::QueryAccept "
=====================================
modules/access/dshow/filter.h
=====================================
@@ -40,7 +40,7 @@ void WINAPI FreeMediaType( AM_MEDIA_TYPE& mt );
HRESULT WINAPI CopyMediaType( AM_MEDIA_TYPE *pmtTarget,
const AM_MEDIA_TYPE *pmtSource );
-int GetFourCCFromMediaType(const AM_MEDIA_TYPE &media_type);
+vlc_fourcc_t GetFourCCFromMediaType(const AM_MEDIA_TYPE &media_type);
/****************************************************************************
* Declaration of our dummy directshow filter pin class
=====================================
modules/access/screen/xcb.c
=====================================
@@ -519,7 +519,7 @@ static es_out_id_t *InitES (demux_t *demux, uint_fast16_t width,
{
demux_sys_t *p_sys = demux->p_sys;
const xcb_setup_t *setup = xcb_get_setup (p_sys->conn);
- uint32_t chroma = 0;
+ vlc_fourcc_t chroma = 0;
for (const xcb_format_t *fmt = xcb_setup_pixmap_formats (setup),
*end = fmt + xcb_setup_pixmap_formats_length (setup);
=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -594,10 +594,10 @@ bool GetFfmpegCodec( enum es_format_category_e cat, vlc_fourcc_t i_fourcc,
vlc_fourcc_t GetVlcFourcc( enum AVCodecID i_ffmpeg_codec )
{
+ if( i_ffmpeg_codec == AV_CODEC_ID_RAWVIDEO )
+ return VLC_CODEC_UNKNOWN;
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;
}
=====================================
modules/codec/daala.c
=====================================
@@ -608,7 +608,7 @@ static int OpenEncoder( vlc_object_t *p_this )
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
char *psz_tmp = var_GetString( p_enc, ENC_CFG_PREFIX "chroma-fmt" );
- uint32_t i_codec;
+ vlc_fourcc_t i_codec;
if( !psz_tmp ) {
free(p_sys);
return VLC_ENOMEM;
=====================================
modules/codec/dvbsub.c
=====================================
@@ -2273,7 +2273,8 @@ static void encode_object( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
bs_write( s, 2, 1 );
break;
default:
- msg_Err( p_enc, "FOURCC %d not supported by encoder.", p_region->fmt.i_chroma );
+ msg_Err( p_enc, "FOURCC %4.4s not supported by encoder.",
+ (const char*)&p_region->fmt.i_chroma );
continue;
}
=====================================
modules/codec/schroedinger.c
=====================================
@@ -1450,14 +1450,12 @@ static block_t *Encode( encoder_t *p_enc, picture_t *p_pic )
date_t date;
if( p_pic->format.i_chroma != p_enc->fmt_in.i_codec ) {
- char chroma_in[5], chroma_out[5];
- vlc_fourcc_to_char( p_pic->format.i_chroma, chroma_in );
- chroma_in[4] = '\0';
- chroma_out[4] = '\0';
- vlc_fourcc_to_char( p_enc->fmt_in.i_codec, chroma_out );
- msg_Warn( p_enc, "Resetting chroma from %s to %s", chroma_out, chroma_in );
+ msg_Warn( p_enc, "Resetting chroma from %4.4s to %4.4s",
+ (const char*)&p_enc->fmt_in.i_codec,
+ (const char*)&p_pic->format.i_chroma );
if( !SetEncChromaFormat( p_enc, p_pic->format.i_chroma ) ) {
- msg_Err( p_enc, "Could not reset chroma format to %s", chroma_in );
+ msg_Err( p_enc, "Could not reset chroma format to %4.4s",
+ (const char*)&p_pic->format.i_chroma );
return NULL;
}
}
=====================================
modules/demux/mkv/matroska_segment_parse.cpp
=====================================
@@ -740,13 +740,8 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
ONLY_FMT(VIDEO);
if ( colourspace.ValidateSize() )
{
- char clrspc[5];
-
vars.tk->fmt.i_codec = GetFOURCC( colourspace.GetBuffer() );
-
- vlc_fourcc_to_char( vars.tk->fmt.i_codec, clrspc );
- clrspc[4] = '\0';
- debug( vars, "Colour Space=%s", clrspc );
+ debug( vars, "Colour Space=%4.4s", (const char*)&vars.tk->fmt.i_codec );
}
}
#if LIBMATROSKA_VERSION >= 0x010405
=====================================
modules/spu/audiobargraph_v.c
=====================================
@@ -239,7 +239,7 @@ static void Draw(BarGraph_t *b)
if (b->p_pic)
picture_Release(b->p_pic);
- b->p_pic = picture_New(VLC_FOURCC('Y','U','V','A'), w, h, 1, 1);
+ b->p_pic = picture_New(VLC_CODEC_YUVA, w, h, 1, 1);
if (!b->p_pic)
return;
picture_t *p_pic = b->p_pic;
=====================================
modules/video_chroma/dxgi_fmt.c
=====================================
@@ -132,11 +132,18 @@ const d3d_format_t *DxgiGetRenderFormatList(void)
void DxgiFormatMask(DXGI_FORMAT format, video_format_t *fmt)
{
- if (format == DXGI_FORMAT_B8G8R8X8_UNORM || format == DXGI_FORMAT_B8G8R8A8_UNORM)
+ switch(format)
{
+ case DXGI_FORMAT_B8G8R8X8_UNORM:
fmt->i_rmask = 0x0000ff00;
fmt->i_gmask = 0x00ff0000;
fmt->i_bmask = 0xff000000;
+ break;
+ case DXGI_FORMAT_B5G6R5_UNORM:
+ fmt->i_bmask = 0xf800;
+ fmt->i_gmask = 0x07e0;
+ fmt->i_rmask = 0x001f;
+ break;
}
}
=====================================
modules/video_chroma/i420_rgb.c
=====================================
@@ -256,11 +256,12 @@ static int Activate( filter_t *p_filter )
}
video_format_t vfmt;
- video_format_Init( &vfmt, p_filter->fmt_out.video.i_chroma );
video_format_Copy( &vfmt, &p_filter->fmt_out.video );
if( !vfmt.i_rmask || !vfmt.i_gmask || !vfmt.i_bmask )
+ {
msg_Warn( p_filter, "source did not set proper target RGB masks, using default" );
- video_format_FixRgb( &vfmt );
+ video_format_FixRgb( &vfmt );
+ }
SetYUV( p_filter, &vfmt );
video_format_Clean( &vfmt );
#endif
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -1632,8 +1632,9 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt, vlc_video_cont
msg_Dbg(vd, "found input surface format %s for source %4.4s", d3dfmt->name, (const char *)&vd->source->i_chroma);
bool force_dxva_hd = var_InheritBool(vd, "direct3d9-dxvahd");
- if (force_dxva_hd || (dst_format && vd->source->color_range != COLOR_RANGE_FULL && dst_format->rmask && !d3dfmt->rmask &&
- sys->d3d9_device->d3ddev.identifier.VendorId == GPU_MANUFACTURER_NVIDIA))
+ if (force_dxva_hd || (dst_format && vd->source->color_range != COLOR_RANGE_FULL &&
+ sys->d3d9_device->d3ddev.identifier.VendorId == GPU_MANUFACTURER_NVIDIA) &&
+ !vlc_fourcc_IsYUV(dst_format->fourcc) && vlc_fourcc_IsYUV(d3dfmt->fourcc))
{
// NVIDIA bug, YUV to RGB internal conversion in StretchRect always converts from limited to limited range
msg_Dbg(vd, "init DXVA-HD processor from %s to %s", d3dfmt->name, dst_format?dst_format->name:"unknown");
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5a68b441c3dd53e13d8f27adb4e63a9fe509afa...87f265b0dbdb7e08e0afcf7e8a7e22143724d7fe
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c5a68b441c3dd53e13d8f27adb4e63a9fe509afa...87f265b0dbdb7e08e0afcf7e8a7e22143724d7fe
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list