[vlc-devel] [V3 10/13] lib: Allow a picture to be constructed from an attachment
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Thu Nov 19 09:11:37 CET 2020
On Wed, Nov 18, 2020, at 8:07 PM, Rémi Denis-Courmont wrote:
> Le mercredi 18 novembre 2020, 16:23:56 EET Hugo Beauzée-Luyssen a écrit :
> > ---
> > lib/picture.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 57 insertions(+)
> >
> > diff --git a/lib/picture.c b/lib/picture.c
> > index fc8b769b2a..910440d84e 100644
> > --- a/lib/picture.c
> > +++ b/lib/picture.c
> > @@ -30,6 +30,8 @@
> > #include <vlc_atomic.h>
> > #include <vlc_picture.h>
> > #include <vlc_block.h>
> > +#include <vlc_image.h>
> > +#include <vlc_input.h>
> > #include <vlc_fs.h>
> >
> > #include "picture_internal.h"
> > @@ -41,6 +43,13 @@ struct libvlc_picture_t
> > block_t* converted;
> > video_format_t fmt;
> > libvlc_time_t time;
> > + input_attachment_t* attachment;
> > +};
> > +
> > +struct libvlc_picture_list_t
> > +{
> > + size_t count;
> > + libvlc_picture_t* pictures[];
> > };
> >
> > libvlc_picture_t* libvlc_picture_new( vlc_object_t* p_obj, picture_t*
> > input, @@ -54,6 +63,7 @@ libvlc_picture_t* libvlc_picture_new(
> > vlc_object_t* p_obj, picture_t* input, vlc_atomic_rc_init( &pic->rc );
> > pic->type = type;
> > pic->time = MS_FROM_VLC_TICK( input->date );
> > + pic->attachment = NULL;
> > vlc_fourcc_t format;
> > switch ( type )
> > {
> > @@ -79,6 +89,51 @@ libvlc_picture_t* libvlc_picture_new( vlc_object_t*
> > p_obj, picture_t* input, return pic;
> > }
> >
> > +static void libvlc_picture_block_release( block_t* block )
> > +{
> > + free( block );
> > +}
> > +
> > +static const struct vlc_block_callbacks block_cbs =
> > +{
> > + libvlc_picture_block_release,
> > +};
> > +
> > +static libvlc_picture_t* libvlc_picture_from_attachment(
> > input_attachment_t* attachment ) +{
> > + vlc_fourcc_t fcc = image_Mime2Fourcc( attachment->psz_mime );
> > + if ( !fcc || ( fcc != VLC_CODEC_PNG && fcc != VLC_CODEC_JPEG ) )
> > + return NULL;
>
> The first test is redundant.
>
Indeed, thanks for noticing.
Fixed locally.
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list