Browse Source

image: remove the source video_format parameter from image_ReadUrl()

It's always an empty video format with an 0 chroma. The format will be known
from the MIME type or the file probing.
pull/85/head
Steve Lhomme 7 years ago
parent
commit
62904dbc92
  1. 4
      include/vlc_image.h
  2. 5
      modules/access/screen/screen.c
  3. 5
      modules/gui/skins2/src/file_bitmap.cpp
  4. 5
      modules/spu/logo.c
  5. 2
      modules/spu/rss.c
  6. 9
      modules/stream_out/sdi/DBMSDIOutput.cpp
  7. 6
      modules/video_filter/alphamask.c
  8. 5
      modules/video_filter/blendbench.c
  9. 6
      modules/video_filter/erase.c
  10. 9
      modules/video_output/decklink.cpp
  11. 25
      src/misc/image.c
  12. 5
      src/video_output/vout_spuregion_helper.h

4
include/vlc_image.h

@ -41,7 +41,7 @@ struct image_handler_t
const video_format_t *, const uint8_t *, size_t,
video_format_t * );
picture_t * (*pf_read_url) ( image_handler_t *, const char *,
const video_format_t *, video_format_t * );
video_format_t * );
block_t * (*pf_write) ( image_handler_t *, picture_t *,
const video_format_t *, const video_format_t * );
int (*pf_write_url) ( image_handler_t *, picture_t *,
@ -66,7 +66,7 @@ VLC_API void image_HandlerDelete( image_handler_t * );
#define image_Read( a, b, c, d ) a->pf_read( a, b, c, NULL, 0, d )
#define image_ReadExt( a, b, c, d, e, f ) a->pf_read( a, b, c, d, e, f )
#define image_ReadUrl( a, b, c, d ) a->pf_read_url( a, b, c, d )
#define image_ReadUrl( a, b, c ) a->pf_read_url( a, b, c )
#define image_Write( a, b, c, d ) a->pf_write( a, b, c, d )
#define image_WriteUrl( a, b, c, d, e ) a->pf_write_url( a, b, c, d, e )
#define image_Convert( a, b, c, d ) a->pf_convert( a, b, c, d )

5
modules/access/screen/screen.c

@ -224,16 +224,15 @@ static int Open( vlc_object_t *p_this )
if( mouseurl )
{
image_handler_t *p_image;
video_format_t fmt_in, fmt_out;
video_format_t fmt_out;
msg_Dbg( p_demux, "Using %s for the mouse pointer image", mouseurl );
memset( &fmt_in, 0, sizeof( fmt_in ) );
memset( &fmt_out, 0, sizeof( fmt_out ) );
fmt_out.i_chroma = VLC_CODEC_RGBA;
p_image = image_HandlerCreate( p_demux );
if( p_image )
{
p_sys->p_mouse =
image_ReadUrl( p_image, mouseurl, &fmt_in, &fmt_out );
image_ReadUrl( p_image, mouseurl, &fmt_out );
image_HandlerDelete( p_image );
}
if( !p_sys->p_mouse )

5
modules/gui/skins2/src/file_bitmap.cpp

@ -36,10 +36,9 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
GenericBitmap( pIntf, nbFrames, fps, nbLoops ), m_width( 0 ), m_height( 0 ),
m_pData( NULL )
{
video_format_t fmt_in, fmt_out;
video_format_t fmt_out;
picture_t *pPic;
video_format_Init( &fmt_in, 0 );
video_format_Init( &fmt_out, VLC_CODEC_RGBA );
if( strstr( fileName.c_str(), "://" ) == NULL )
@ -51,7 +50,7 @@ FileBitmap::FileBitmap( intf_thread_t *pIntf, image_handler_t *pImageHandler,
free( psz_uri );
}
pPic = image_ReadUrl( pImageHandler, fileName.c_str(), &fmt_in, &fmt_out );
pPic = image_ReadUrl( pImageHandler, fileName.c_str(), &fmt_out );
if( !pPic )
return;

5
modules/spu/logo.c

@ -608,9 +608,6 @@ static picture_t *LoadImage( vlc_object_t *p_this, const char *psz_filename )
if( !psz_filename )
return NULL;
video_format_t fmt_in;
video_format_Init( &fmt_in, 0 );
video_format_t fmt_out;
video_format_Init( &fmt_out, VLC_CODEC_YUVA );
@ -619,7 +616,7 @@ static picture_t *LoadImage( vlc_object_t *p_this, const char *psz_filename )
return NULL;
char *psz_url = vlc_path2uri( psz_filename, NULL );
picture_t *p_pic = image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
picture_t *p_pic = image_ReadUrl( p_image, psz_url, &fmt_out );
free( psz_url );
image_HandlerDelete( p_image );

2
modules/spu/rss.c

@ -560,7 +560,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url )
memset( &fmt_out, 0, sizeof(video_format_t) );
fmt_out.i_chroma = VLC_CODEC_YUVA;
p_orig = image_ReadUrl( p_handler, psz_url, &fmt_in, &fmt_out );
p_orig = image_ReadUrl( p_handler, psz_url, &fmt_out );
if( !p_orig )
{

9
modules/stream_out/sdi/DBMSDIOutput.cpp

@ -735,17 +735,16 @@ picture_t * DBMSDIOutput::CreateNoSignalPicture(const char *psz_file, const vide
image_handler_t *img = image_HandlerCreate(p_stream);
if (img)
{
video_format_t in, dummy;
video_format_Init(&dummy, 0);
video_format_t in;
video_format_Init(&in, 0);
video_format_Setup(&in, 0,
fmt->i_width, fmt->i_height,
fmt->i_width, fmt->i_height, 1, 1);
picture_t *png = image_ReadUrl(img, psz_file, &dummy, &in);
picture_t *png = image_ReadUrl(img, psz_file, &in);
if (png)
{
video_format_Clean(&dummy);
video_format_t dummy;
video_format_Copy(&dummy, fmt);
p_pic = image_Convert(img, png, &in, &dummy);
if(!video_format_IsSimilar(&dummy, fmt))
@ -754,10 +753,10 @@ picture_t * DBMSDIOutput::CreateNoSignalPicture(const char *psz_file, const vide
p_pic = NULL;
}
picture_Release(png);
video_format_Clean(&dummy);
}
image_HandlerDelete(img);
video_format_Clean(&in);
video_format_Clean(&dummy);
}
return p_pic;
}

6
modules/video_filter/alphamask.c

@ -175,17 +175,15 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
{
filter_sys_t *p_sys = p_filter->p_sys;
image_handler_t *p_image;
video_format_t fmt_in, fmt_out;
video_format_Init( &fmt_in, 0 );
video_format_t fmt_out;
video_format_Init( &fmt_out, VLC_CODEC_YUVA );
if( p_sys->p_mask )
picture_Release( p_sys->p_mask );
p_image = image_HandlerCreate( p_filter );
char *psz_url = vlc_path2uri( psz_filename, NULL );
p_sys->p_mask =
image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
image_ReadUrl( p_image, psz_url, &fmt_out );
free( psz_url );
video_format_Clean( &fmt_in );
video_format_Clean( &fmt_out );
image_HandlerDelete( p_image );
}

5
modules/video_filter/blendbench.c

@ -122,14 +122,13 @@ static int blendbench_LoadImage( vlc_object_t *p_this, picture_t **pp_pic,
vlc_fourcc_t i_chroma, char *psz_file, const char *psz_name )
{
image_handler_t *p_image;
video_format_t fmt_in, fmt_out;
video_format_t fmt_out;
memset( &fmt_in, 0, sizeof(video_format_t) );
memset( &fmt_out, 0, sizeof(video_format_t) );
fmt_out.i_chroma = i_chroma;
p_image = image_HandlerCreate( p_this );
*pp_pic = image_ReadUrl( p_image, psz_file, &fmt_in, &fmt_out );
*pp_pic = image_ReadUrl( p_image, psz_file, &fmt_out );
image_HandlerDelete( p_image );
if( *pp_pic == NULL )

6
modules/video_filter/erase.c

@ -98,15 +98,13 @@ static void LoadMask( filter_t *p_filter, const char *psz_filename )
{
filter_sys_t *p_sys = p_filter->p_sys;
image_handler_t *p_image;
video_format_t fmt_in, fmt_out;
video_format_t fmt_out;
picture_t *p_old_mask = p_sys->p_mask;
video_format_Init( &fmt_in, 0 );
video_format_Init( &fmt_out, VLC_CODEC_YUVA );
p_image = image_HandlerCreate( p_filter );
char *psz_url = vlc_path2uri( psz_filename, NULL );
p_sys->p_mask = image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
p_sys->p_mask = image_ReadUrl( p_image, psz_url, &fmt_out );
free( psz_url );
video_format_Clean( &fmt_in );
video_format_Clean( &fmt_out );
if( p_sys->p_mask )
{

9
modules/video_output/decklink.cpp

@ -436,17 +436,16 @@ static picture_t * CreateNoSignalPicture(vlc_object_t *p_this, const video_forma
return NULL;
}
video_format_t in, dummy;
video_format_Init(&dummy, 0);
video_format_t in;
video_format_Init(&in, 0);
video_format_Setup(&in, 0,
fmt->i_width, fmt->i_height,
fmt->i_width, fmt->i_height, 1, 1);
picture_t *png = image_ReadUrl(img, psz_file, &dummy, &in);
picture_t *png = image_ReadUrl(img, psz_file, &in);
if (png)
{
video_format_Clean(&dummy);
video_format_t dummy;
video_format_Copy(&dummy, fmt);
p_pic = image_Convert(img, png, &in, &dummy);
if(!video_format_IsSimilar(&dummy, fmt))
@ -455,10 +454,10 @@ static picture_t * CreateNoSignalPicture(vlc_object_t *p_this, const video_forma
p_pic = NULL;
}
picture_Release(png);
video_format_Clean(&dummy);
}
image_HandlerDelete(img);
video_format_Clean(&in);
video_format_Clean(&dummy);
return p_pic;
}

25
src/misc/image.c

@ -63,7 +63,7 @@ static picture_t *ImageRead( image_handler_t *, block_t *,
const video_format_t *, const uint8_t *, size_t,
video_format_t * );
static picture_t *ImageReadUrl( image_handler_t *, const char *,
const video_format_t *, video_format_t * );
video_format_t * );
static block_t *ImageWrite( image_handler_t *, picture_t *,
const video_format_t *, const video_format_t * );
static int ImageWriteUrl( image_handler_t *, picture_t *,
@ -273,7 +273,6 @@ static picture_t *ImageRead( image_handler_t *p_image, block_t *p_block,
}
static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
const video_format_t *p_fmt_in,
video_format_t *p_fmt_out )
{
block_t *p_block;
@ -301,22 +300,18 @@ static picture_t *ImageReadUrl( image_handler_t *p_image, const char *psz_url,
goto error;
video_format_t fmtin;
video_format_Init( &fmtin, p_fmt_in->i_chroma );
video_format_Copy( &fmtin, p_fmt_in );
video_format_Init( &fmtin, 0 ); /* no chroma, the MIME type of the picture will be used */
char *psz_mime = stream_MimeType( p_stream );
if( psz_mime != NULL )
{
fmtin.i_chroma = image_Mime2Fourcc( psz_mime );
free( psz_mime );
}
if( !fmtin.i_chroma )
{
char *psz_mime = stream_MimeType( p_stream );
if( psz_mime != NULL )
{
fmtin.i_chroma = image_Mime2Fourcc( psz_mime );
free( psz_mime );
}
if( !fmtin.i_chroma )
{
/* Try to guess format from file name */
fmtin.i_chroma = image_Ext2Fourcc( psz_url );
}
/* Try to guess format from file name */
fmtin.i_chroma = image_Ext2Fourcc( psz_url );
}
vlc_stream_Delete( p_stream );

5
src/video_output/vout_spuregion_helper.h

@ -66,16 +66,13 @@ static inline subpicture_region_t *
spuregion_CreateFromPicture( vlc_object_t *p_this, video_format_t *p_fmt,
const char *psz_uri )
{
video_format_t fmt_in;
video_format_Init( &fmt_in, 0 );
picture_t *p_pic = NULL;
int i_flags = p_this->obj.flags;
p_this->obj.flags |= OBJECT_FLAGS_NOINTERACT|OBJECT_FLAGS_QUIET;
image_handler_t *p_image = image_HandlerCreate( p_this );
if( p_image )
{
p_pic = image_ReadUrl( p_image, psz_uri, &fmt_in, p_fmt );
p_pic = image_ReadUrl( p_image, psz_uri, p_fmt );
image_HandlerDelete( p_image );
}
p_this->obj.flags = i_flags;

Loading…
Cancel
Save