Commit 3933f253 authored by KO Myung-Hun's avatar KO Myung-Hun Committed by Jean-Baptiste Kempf

Replace the bitmap structures of Microsoft with ones of VLC

Signed-off-by: default avatarRafaël Carré <funman@videolan.org>
Modified-by: default avatarRafaël Carré <funman@videolan.org>
    ... Replace them in ASF demux as well
(cherry picked from commit a67afb66)
Signed-off-by: default avatarKO Myung-Hun <komh@chollian.net>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 89ab9f18
...@@ -106,8 +106,9 @@ _WAVEHEADER { ...@@ -106,8 +106,9 @@ _WAVEHEADER {
} WAVEHEADER; } WAVEHEADER;
#endif /* _WAVEHEADER_ */ #endif /* _WAVEHEADER_ */
#if !defined(_BITMAPINFOHEADER_) && !defined(WIN32) #ifndef _VLC_BITMAPINFOHEADER_
#define _BITMAPINFOHEADER_ #define _VLC_BITMAPINFOHEADER_
typedef struct typedef struct
ATTR_PACKED ATTR_PACKED
{ {
...@@ -122,14 +123,14 @@ ATTR_PACKED ...@@ -122,14 +123,14 @@ ATTR_PACKED
uint32_t biYPelsPerMeter; uint32_t biYPelsPerMeter;
uint32_t biClrUsed; uint32_t biClrUsed;
uint32_t biClrImportant; uint32_t biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER; } VLC_BITMAPINFOHEADER, *VLC_PBITMAPINFOHEADER, *VLC_LPBITMAPINFOHEADER;
typedef struct typedef struct
ATTR_PACKED ATTR_PACKED
{ {
BITMAPINFOHEADER bmiHeader; VLC_BITMAPINFOHEADER bmiHeader;
int bmiColors[1]; int bmiColors[1];
} BITMAPINFO, *LPBITMAPINFO; } VLC_BITMAPINFO, *VLC_LPBITMAPINFO;
#endif #endif
#ifndef _RECT32_ #ifndef _RECT32_
...@@ -151,12 +152,12 @@ typedef int64_t REFERENCE_TIME; ...@@ -151,12 +152,12 @@ typedef int64_t REFERENCE_TIME;
typedef struct typedef struct
ATTR_PACKED ATTR_PACKED
{ {
RECT32 rcSource; RECT32 rcSource;
RECT32 rcTarget; RECT32 rcTarget;
uint32_t dwBitRate; uint32_t dwBitRate;
uint32_t dwBitErrorRate; uint32_t dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame; REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader; VLC_BITMAPINFOHEADER bmiHeader;
} VIDEOINFOHEADER; } VIDEOINFOHEADER;
#endif #endif
...@@ -187,12 +188,12 @@ ATTR_PACKED ...@@ -187,12 +188,12 @@ ATTR_PACKED
typedef struct typedef struct
ATTR_PACKED ATTR_PACKED
{ {
RECT32 rcSource; RECT32 rcSource;
RECT32 rcTarget; RECT32 rcTarget;
uint32_t dwBitRate; uint32_t dwBitRate;
uint32_t dwBitErrorRate; uint32_t dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame; REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader; VLC_BITMAPINFOHEADER bmiHeader;
union union
{ {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include <vlc_meta.h> /* vlc_meta_Set*, vlc_meta_New */ #include <vlc_meta.h> /* vlc_meta_Set*, vlc_meta_New */
#include <vlc_access.h> /* GET_PRIVATE_ID_STATE */ #include <vlc_access.h> /* GET_PRIVATE_ID_STATE */
#include <vlc_codecs.h> /* BITMAPINFOHEADER, WAVEFORMATEX */ #include <vlc_codecs.h> /* VLC_BITMAPINFOHEADER, WAVEFORMATEX */
#include "libasf.h" #include "libasf.h"
...@@ -859,7 +859,7 @@ static int DemuxInit( demux_t *p_demux ) ...@@ -859,7 +859,7 @@ static int DemuxInit( demux_t *p_demux )
else if( guidcmp( &p_sp->i_stream_type, else if( guidcmp( &p_sp->i_stream_type,
&asf_object_stream_type_video ) && &asf_object_stream_type_video ) &&
p_sp->i_type_specific_data_length >= 11 + p_sp->i_type_specific_data_length >= 11 +
sizeof( BITMAPINFOHEADER ) ) sizeof( VLC_BITMAPINFOHEADER ) )
{ {
uint8_t *p_data = &p_sp->p_type_specific_data[11]; uint8_t *p_data = &p_sp->p_type_specific_data[11];
...@@ -883,13 +883,13 @@ static int DemuxInit( demux_t *p_demux ) ...@@ -883,13 +883,13 @@ static int DemuxInit( demux_t *p_demux )
} }
if( p_sp->i_type_specific_data_length > 11 + if( p_sp->i_type_specific_data_length > 11 +
sizeof( BITMAPINFOHEADER ) ) sizeof( VLC_BITMAPINFOHEADER ) )
{ {
fmt.i_extra = __MIN( GetDWLE( p_data ), fmt.i_extra = __MIN( GetDWLE( p_data ),
p_sp->i_type_specific_data_length - 11 - p_sp->i_type_specific_data_length - 11 -
sizeof( BITMAPINFOHEADER ) ); sizeof( VLC_BITMAPINFOHEADER ) );
fmt.p_extra = malloc( fmt.i_extra ); fmt.p_extra = malloc( fmt.i_extra );
memcpy( fmt.p_extra, &p_data[sizeof( BITMAPINFOHEADER )], memcpy( fmt.p_extra, &p_data[sizeof( VLC_BITMAPINFOHEADER )],
fmt.i_extra ); fmt.i_extra );
} }
......
...@@ -530,8 +530,8 @@ static int Open( vlc_object_t * p_this ) ...@@ -530,8 +530,8 @@ static int Open( vlc_object_t * p_this )
fmt.video.i_frame_rate = tk->i_rate; fmt.video.i_frame_rate = tk->i_rate;
fmt.video.i_frame_rate_base = tk->i_scale; fmt.video.i_frame_rate_base = tk->i_scale;
fmt.i_extra = fmt.i_extra =
__MAX( p_vids->p_bih->biSize - sizeof( BITMAPINFOHEADER ), __MIN( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ),
p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER) ); p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER) );
if( fmt.i_extra > 0 ) if( fmt.i_extra > 0 )
{ {
fmt.p_extra = malloc( fmt.i_extra ); fmt.p_extra = malloc( fmt.i_extra );
...@@ -559,7 +559,7 @@ static int Open( vlc_object_t * p_this ) ...@@ -559,7 +559,7 @@ static int Open( vlc_object_t * p_this )
if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 ) if( fmt.video.i_bits_per_pixel > 0 && fmt.video.i_bits_per_pixel <= 8 )
{ {
/* The palette is not always included in biSize */ /* The palette is not always included in biSize */
fmt.i_extra = p_vids->i_chunk_size - sizeof(BITMAPINFOHEADER); fmt.i_extra = p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER);
if( fmt.i_extra > 0 && fmt.p_extra ) if( fmt.i_extra > 0 && fmt.p_extra )
{ {
const uint8_t *p_pal = fmt.p_extra; const uint8_t *p_pal = fmt.p_extra;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_codecs.h> /* BITMAPINFOHEADER */ #include <vlc_codecs.h> /* VLC_BITMAPINFOHEADER */
#include "libavi.h" #include "libavi.h"
...@@ -401,11 +401,11 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk ) ...@@ -401,11 +401,11 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
{ {
p_chk->strf.vids.p_bih->biSize = p_chk->common.i_chunk_size; p_chk->strf.vids.p_bih->biSize = p_chk->common.i_chunk_size;
} }
if( p_chk->common.i_chunk_size > sizeof(BITMAPINFOHEADER) ) if( p_chk->common.i_chunk_size > sizeof(VLC_BITMAPINFOHEADER) )
{ {
memcpy( &p_chk->strf.vids.p_bih[1], memcpy( &p_chk->strf.vids.p_bih[1],
p_buff + 8 + sizeof(BITMAPINFOHEADER), /* 8=fourrc+size */ p_buff + 8 + sizeof(VLC_BITMAPINFOHEADER), /* 8=fourrc+size */
p_chk->common.i_chunk_size -sizeof(BITMAPINFOHEADER) ); p_chk->common.i_chunk_size -sizeof(VLC_BITMAPINFOHEADER) );
} }
#ifdef AVI_DEBUG #ifdef AVI_DEBUG
msg_Dbg( (vlc_object_t*)s, msg_Dbg( (vlc_object_t*)s,
......
...@@ -124,8 +124,8 @@ typedef struct avi_chunk_strf_auds_s ...@@ -124,8 +124,8 @@ typedef struct avi_chunk_strf_auds_s
typedef struct avi_chunk_strf_vids_s typedef struct avi_chunk_strf_vids_s
{ {
AVI_CHUNK_COMMON AVI_CHUNK_COMMON
int i_cat; int i_cat;
BITMAPINFOHEADER *p_bih; VLC_BITMAPINFOHEADER *p_bih;
} avi_chunk_strf_vids_t; } avi_chunk_strf_vids_t;
typedef union avi_chunk_strf_u typedef union avi_chunk_strf_u
......
...@@ -976,24 +976,24 @@ bool matroska_segment_c::Select( mtime_t i_start_time ) ...@@ -976,24 +976,24 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
if( !strcmp( p_tk->psz_codec, "V_MS/VFW/FOURCC" ) ) if( !strcmp( p_tk->psz_codec, "V_MS/VFW/FOURCC" ) )
{ {
if( p_tk->i_extra_data < (int)sizeof( BITMAPINFOHEADER ) ) if( p_tk->i_extra_data < (int)sizeof( VLC_BITMAPINFOHEADER ) )
{ {
msg_Err( &sys.demuxer, "missing/invalid BITMAPINFOHEADER" ); msg_Err( &sys.demuxer, "missing/invalid VLC_BITMAPINFOHEADER" );
p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' ); p_tk->fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' );
} }
else else
{ {
BITMAPINFOHEADER *p_bih = (BITMAPINFOHEADER*)p_tk->p_extra_data; VLC_BITMAPINFOHEADER *p_bih = (VLC_BITMAPINFOHEADER*)p_tk->p_extra_data;
p_tk->fmt.video.i_width = GetDWLE( &p_bih->biWidth ); p_tk->fmt.video.i_width = GetDWLE( &p_bih->biWidth );
p_tk->fmt.video.i_height= GetDWLE( &p_bih->biHeight ); p_tk->fmt.video.i_height= GetDWLE( &p_bih->biHeight );
p_tk->fmt.i_codec = GetFOURCC( &p_bih->biCompression ); p_tk->fmt.i_codec = GetFOURCC( &p_bih->biCompression );
p_tk->fmt.i_extra = GetDWLE( &p_bih->biSize ) - sizeof( BITMAPINFOHEADER ); p_tk->fmt.i_extra = GetDWLE( &p_bih->biSize ) - sizeof( VLC_BITMAPINFOHEADER );
if( p_tk->fmt.i_extra > 0 ) if( p_tk->fmt.i_extra > 0 )
{ {
/* Very unlikely yet possible: bug #5659*/ /* Very unlikely yet possible: bug #5659*/
size_t maxlen = p_tk->i_extra_data - sizeof( BITMAPINFOHEADER ); size_t maxlen = p_tk->i_extra_data - sizeof( VLC_BITMAPINFOHEADER );
p_tk->fmt.i_extra = ( p_tk->fmt.i_extra < maxlen )? p_tk->fmt.i_extra = ( p_tk->fmt.i_extra < maxlen )?
p_tk->fmt.i_extra : maxlen; p_tk->fmt.i_extra : maxlen;
......
...@@ -575,7 +575,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -575,7 +575,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
} }
} }
tk->i_extra = 11 + sizeof( BITMAPINFOHEADER ) + i_codec_extra; tk->i_extra = 11 + sizeof( VLC_BITMAPINFOHEADER ) + i_codec_extra;
tk->p_extra = malloc( tk->i_extra ); tk->p_extra = malloc( tk->i_extra );
if( !tk->p_extra ) if( !tk->p_extra )
{ {
...@@ -586,8 +586,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -586,8 +586,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
bo_addle_u32( &bo, p_input->p_fmt->video.i_width ); bo_addle_u32( &bo, p_input->p_fmt->video.i_width );
bo_addle_u32( &bo, p_input->p_fmt->video.i_height ); bo_addle_u32( &bo, p_input->p_fmt->video.i_height );
bo_add_u8 ( &bo, 0x02 ); /* flags */ bo_add_u8 ( &bo, 0x02 ); /* flags */
bo_addle_u16( &bo, sizeof( BITMAPINFOHEADER ) + i_codec_extra ); bo_addle_u16( &bo, sizeof( VLC_BITMAPINFOHEADER ) + i_codec_extra );
bo_addle_u32( &bo, sizeof( BITMAPINFOHEADER ) + i_codec_extra ); bo_addle_u32( &bo, sizeof( VLC_BITMAPINFOHEADER ) + i_codec_extra );
bo_addle_u32( &bo, p_input->p_fmt->video.i_width ); bo_addle_u32( &bo, p_input->p_fmt->video.i_width );
bo_addle_u32( &bo, p_input->p_fmt->video.i_height ); bo_addle_u32( &bo, p_input->p_fmt->video.i_height );
bo_addle_u16( &bo, 1 ); bo_addle_u16( &bo, 1 );
......
...@@ -75,8 +75,8 @@ typedef struct avi_stream_s ...@@ -75,8 +75,8 @@ typedef struct avi_stream_s
float f_fps; float f_fps;
int i_bitrate; int i_bitrate;
BITMAPINFOHEADER *p_bih; VLC_BITMAPINFOHEADER *p_bih;
WAVEFORMATEX *p_wf; WAVEFORMATEX *p_wf;
} avi_stream_t; } avi_stream_t;
...@@ -370,7 +370,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -370,7 +370,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_sys->i_stream_video = p_sys->i_streams; p_sys->i_stream_video = p_sys->i_streams;
} }
p_stream->p_wf = NULL; p_stream->p_wf = NULL;
p_stream->p_bih = malloc( sizeof( BITMAPINFOHEADER ) + p_stream->p_bih = malloc( sizeof( VLC_BITMAPINFOHEADER ) +
p_input->p_fmt->i_extra ); p_input->p_fmt->i_extra );
if( !p_stream->p_bih ) if( !p_stream->p_bih )
{ {
...@@ -378,7 +378,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -378,7 +378,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
#define p_bih p_stream->p_bih #define p_bih p_stream->p_bih
p_bih->biSize = sizeof( BITMAPINFOHEADER ) + p_bih->biSize = sizeof( VLC_BITMAPINFOHEADER ) +
p_input->p_fmt->i_extra; p_input->p_fmt->i_extra;
if( p_input->p_fmt->i_extra > 0 ) if( p_input->p_fmt->i_extra > 0 )
{ {
...@@ -478,7 +478,7 @@ static int Mux ( sout_mux_t *p_mux ) ...@@ -478,7 +478,7 @@ static int Mux ( sout_mux_t *p_mux )
== VLC_FOURCC( 'X', 'V', 'I', 'D' ) ) == VLC_FOURCC( 'X', 'V', 'I', 'D' ) )
{ {
int i_header_length = int i_header_length =
p_stream->p_bih->biSize - sizeof(BITMAPINFOHEADER); p_stream->p_bih->biSize - sizeof(VLC_BITMAPINFOHEADER);
p_data = block_Realloc( p_data, p_data = block_Realloc( p_data,
i_header_length, p_data->i_buffer ); i_header_length, p_data->i_buffer );
if( !p_data) if( !p_data)
...@@ -811,7 +811,7 @@ static int avi_HeaderAdd_strf( buffer_out_t *p_bo, avi_stream_t *p_stream ) ...@@ -811,7 +811,7 @@ static int avi_HeaderAdd_strf( buffer_out_t *p_bo, avi_stream_t *p_stream )
bo_AddDWordLE( p_bo, p_stream->p_bih->biClrUsed ); bo_AddDWordLE( p_bo, p_stream->p_bih->biClrUsed );
bo_AddDWordLE( p_bo, p_stream->p_bih->biClrImportant ); bo_AddDWordLE( p_bo, p_stream->p_bih->biClrImportant );
bo_AddMem( p_bo, bo_AddMem( p_bo,
p_stream->p_bih->biSize - sizeof( BITMAPINFOHEADER ), p_stream->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ),
(uint8_t*)&p_stream->p_bih[1] ); (uint8_t*)&p_stream->p_bih[1] );
break; break;
} }
......
...@@ -59,8 +59,8 @@ typedef unsigned long DWORD; ...@@ -59,8 +59,8 @@ typedef unsigned long DWORD;
#define BI_RGB 0L #define BI_RGB 0L
#if !defined(_BITMAPFILEHEADER_) #if !defined(_VLC_BITMAPFILEHEADER_)
#define _BITMAPFILEHEADER_ #define _VLC_BITMAPFILEHEADER_
typedef struct typedef struct
#ifdef HAVE_ATTRIBUTE_PACKED #ifdef HAVE_ATTRIBUTE_PACKED
__attribute__((__packed__)) __attribute__((__packed__))
...@@ -71,7 +71,7 @@ typedef struct ...@@ -71,7 +71,7 @@ typedef struct
uint16_t bfReserved1; uint16_t bfReserved1;
uint16_t bfReserved2; uint16_t bfReserved2;
uint32_t bfOffBits; uint32_t bfOffBits;
} BITMAPFILEHEADER, *LPBITMAPFILEHEADER, *PBITMAPFILEHEADER; } VLC_BITMAPFILEHEADER, *VLC_LPBITMAPFILEHEADER, *VLC_PBITMAPFILEHEADER;
#endif #endif
#endif #endif
......
...@@ -88,7 +88,7 @@ ATMO_BOOL CAtmoExternalCaptureInput::Close(void) ...@@ -88,7 +88,7 @@ ATMO_BOOL CAtmoExternalCaptureInput::Close(void)
5. let the thread wake up and return imediately to the caller 5. let the thread wake up and return imediately to the caller
so that the real videoout wouldn't be stop for a too long time so that the real videoout wouldn't be stop for a too long time
*/ */
void CAtmoExternalCaptureInput::DeliverNewSourceDataPaket(BITMAPINFOHEADER *bmpInfoHeader,void *pixelData) void CAtmoExternalCaptureInput::DeliverNewSourceDataPaket(VLC_BITMAPINFOHEADER *bmpInfoHeader,void *pixelData)
{ {
/* /*
normaly we should protect this area of code by critical_section or a mutex, normaly we should protect this area of code by critical_section or a mutex,
......
...@@ -36,7 +36,7 @@ protected: ...@@ -36,7 +36,7 @@ protected:
CRITICAL_SECTION m_BufferLock; CRITICAL_SECTION m_BufferLock;
#endif #endif
BITMAPINFOHEADER m_CurrentFrameHeader; VLC_BITMAPINFOHEADER m_CurrentFrameHeader;
void *m_pCurrentFramePixels; void *m_pCurrentFramePixels;
virtual DWORD Execute(void); virtual DWORD Execute(void);
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
this method is called from the com server AtmoLiveViewControlImpl! this method is called from the com server AtmoLiveViewControlImpl!
or inside videolan from the filter method to start a new processing or inside videolan from the filter method to start a new processing
*/ */
void DeliverNewSourceDataPaket(BITMAPINFOHEADER *bmpInfoHeader,void *pixelData); void DeliverNewSourceDataPaket(VLC_BITMAPINFOHEADER *bmpInfoHeader,void *pixelData);
public: public:
CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData); CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData);
......
...@@ -191,8 +191,8 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap) ...@@ -191,8 +191,8 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
// transform 256 color image (gray scale!) // transform 256 color image (gray scale!)
// into m_basicWeight or use the GREEN value of a 24bit image! // into m_basicWeight or use the GREEN value of a 24bit image!
// channel of a true color bitmap! // channel of a true color bitmap!
BITMAPINFO bmpInfo; VLC_BITMAPINFO bmpInfo;
BITMAPFILEHEADER bmpFileHeader; VLC_BITMAPFILEHEADER bmpFileHeader;
/* /*
ATMO_LOAD_GRADIENT_FILENOTFOND ATMO_LOAD_GRADIENT_FILENOTFOND
...@@ -206,7 +206,7 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap) ...@@ -206,7 +206,7 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
if(!bmp) if(!bmp)
return ATMO_LOAD_GRADIENT_FILENOTFOND; return ATMO_LOAD_GRADIENT_FILENOTFOND;
if(fread(&bmpFileHeader, sizeof(BITMAPFILEHEADER), 1, bmp) != 1) if(fread(&bmpFileHeader, sizeof(VLC_BITMAPFILEHEADER), 1, bmp) != 1)
{ {
fclose(bmp); fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_SIZE; return ATMO_LOAD_GRADIENT_FAILED_SIZE;
...@@ -218,7 +218,7 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap) ...@@ -218,7 +218,7 @@ int CAtmoZoneDefinition::LoadGradientFromBitmap(char *pszBitmap)
return ATMO_LOAD_GRADIENT_FAILED_HEADER; return ATMO_LOAD_GRADIENT_FAILED_HEADER;
} }
if(fread(&bmpInfo, sizeof(BITMAPINFO), 1, bmp) != 1) if(fread(&bmpInfo, sizeof(VLC_BITMAPINFO), 1, bmp) != 1)
{ {
fclose(bmp); fclose(bmp);
return ATMO_LOAD_GRADIENT_FAILED_SIZE; return ATMO_LOAD_GRADIENT_FAILED_SIZE;
......
...@@ -774,7 +774,7 @@ struct filter_sys_t ...@@ -774,7 +774,7 @@ struct filter_sys_t
/* storage for temporal settings "volatile" */ /* storage for temporal settings "volatile" */
CAtmoDynData *p_atmo_dyndata; CAtmoDynData *p_atmo_dyndata;
/* initialized for buildin driver with AtmoCreateTransferBuffers */ /* initialized for buildin driver with AtmoCreateTransferBuffers */
BITMAPINFOHEADER mini_image_format; VLC_BITMAPINFOHEADER mini_image_format;
/* is only use buildin driver! */ /* is only use buildin driver! */
uint8_t *p_atmo_transfer_buffer; uint8_t *p_atmo_transfer_buffer;
/* end buildin driver */ /* end buildin driver */
...@@ -991,9 +991,9 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter, ...@@ -991,9 +991,9 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter,
p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel * p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel *
width * height); width * height);
memset(&p_sys->mini_image_format,0,sizeof(BITMAPINFOHEADER)); memset(&p_sys->mini_image_format,0,sizeof(VLC_BITMAPINFOHEADER));
p_sys->mini_image_format.biSize = sizeof(BITMAPINFOHEADER); p_sys->mini_image_format.biSize = sizeof(VLC_BITMAPINFOHEADER);
p_sys->mini_image_format.biWidth = width; p_sys->mini_image_format.biWidth = width;
p_sys->mini_image_format.biHeight = height; p_sys->mini_image_format.biHeight = height;
p_sys->mini_image_format.biBitCount = bytePerPixel*8; p_sys->mini_image_format.biBitCount = bytePerPixel*8;
...@@ -2192,12 +2192,12 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys, ...@@ -2192,12 +2192,12 @@ static void ExtractMiniImage_YUV(filter_sys_t *p_sys,
void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename) void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
{ {
/* for debug out only used*/ /* for debug out only used*/
BITMAPINFO bmp_info; VLC_BITMAPINFO bmp_info;
BITMAPFILEHEADER bmp_fileheader; VLC_BITMAPFILEHEADER bmp_fileheader;
FILE *fp_bitmap; FILE *fp_bitmap;
memset(&bmp_info, 0, sizeof(BITMAPINFO)); memset(&bmp_info, 0, sizeof(VLC_BITMAPINFO));
bmp_info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp_info.bmiHeader.biSize = sizeof(VLC_BITMAPINFOHEADER);
bmp_info.bmiHeader.biSizeImage = p_sys->i_atmo_height * bmp_info.bmiHeader.biSizeImage = p_sys->i_atmo_height *
p_sys->i_atmo_width * 4; p_sys->i_atmo_width * 4;
bmp_info.bmiHeader.biCompression = BI_RGB; bmp_info.bmiHeader.biCompression = BI_RGB;
...@@ -2208,18 +2208,18 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename) ...@@ -2208,18 +2208,18 @@ void SaveBitmap(filter_sys_t *p_sys, uint8_t *p_pixels, char *psz_filename)
bmp_fileheader.bfReserved1 = 0; bmp_fileheader.bfReserved1 = 0;
bmp_fileheader.bfReserved2 = 0; bmp_fileheader.bfReserved2 = 0;
bmp_fileheader.bfSize = sizeof(BITMAPFILEHEADER) + bmp_fileheader.bfSize = sizeof(VLC_BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER) + sizeof(VLC_BITMAPINFOHEADER) +
bmp_info.bmiHeader.biSizeImage; bmp_info.bmiHeader.biSizeImage;
bmp_fileheader.bfType = VLC_TWOCC('B','M'); bmp_fileheader.bfType = VLC_TWOCC('B','M');
bmp_fileheader.bfOffBits = sizeof(BITMAPFILEHEADER) + bmp_fileheader.bfOffBits = sizeof(VLC_BITMAPFILEHEADER) +
sizeof(BITMAPINFOHEADER); sizeof(VLC_BITMAPINFOHEADER);
fp_bitmap = fopen(psz_filename,"wb"); fp_bitmap = fopen(psz_filename,"wb");
if( fp_bitmap != NULL) if( fp_bitmap != NULL)
{ {
fwrite(&bmp_fileheader, sizeof(BITMAPFILEHEADER), 1, fp_bitmap); fwrite(&bmp_fileheader, sizeof(VLC_BITMAPFILEHEADER), 1, fp_bitmap);
fwrite(&bmp_info.bmiHeader, sizeof(BITMAPINFOHEADER), 1, fp_bitmap); fwrite(&bmp_info.bmiHeader, sizeof(VLC_BITMAPINFOHEADER), 1, fp_bitmap);
fwrite(p_pixels, bmp_info.bmiHeader.biSizeImage, 1, fp_bitmap); fwrite(p_pixels, bmp_info.bmiHeader.biSizeImage, 1, fp_bitmap);
fclose(fp_bitmap); fclose(fp_bitmap);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment