VLC 4.0.0-dev
Collaboration diagram for Generic picture API:

Files

file  vlc_picture.h
 This file defines picture structures and functions in vlc.
 

Data Structures

struct  plane_t
 Description of a planar graphic field. More...
 
struct  picture_context_t
 
struct  picture_buffer_t
 
struct  vlc_video_context_operations
 
struct  picture_t
 Video picture. More...
 
struct  vlc_pic_chain
 picture chaining helpers More...
 
struct  picture_resource_t
 Resource for a picture. More...
 

Macros

#define PICTURE_PLANE_MAX   (VOUT_MAX_PLANES)
 Maximum number of plane for a picture. More...
 
#define Y_PIXELS   p[Y_PLANE].p_pixels
 
#define Y_PITCH   p[Y_PLANE].i_pitch
 
#define U_PIXELS   p[U_PLANE].p_pixels
 
#define U_PITCH   p[U_PLANE].i_pitch
 
#define V_PIXELS   p[V_PLANE].p_pixels
 
#define V_PITCH   p[V_PLANE].i_pitch
 
#define A_PIXELS   p[A_PLANE].p_pixels
 
#define A_PITCH   p[A_PLANE].i_pitch
 

Typedefs

typedef struct plane_t plane_t
 Description of a planar graphic field. More...
 
typedef struct picture_context_t picture_context_t
 
typedef struct picture_buffer_t picture_buffer_t
 
typedef struct vlc_decoder_device vlc_decoder_device
 
typedef struct vlc_video_context vlc_video_context
 
typedef struct vlc_pic_chain vlc_picture_chain_t
 picture chaining helpers More...
 

Enumerations

enum  vlc_video_context_type {
  VLC_VIDEO_CONTEXT_VAAPI = 1 , VLC_VIDEO_CONTEXT_VDPAU , VLC_VIDEO_CONTEXT_DXVA2 , VLC_VIDEO_CONTEXT_D3D11VA ,
  VLC_VIDEO_CONTEXT_AWINDOW , VLC_VIDEO_CONTEXT_NVDEC , VLC_VIDEO_CONTEXT_CVPX , VLC_VIDEO_CONTEXT_MMAL ,
  VLC_VIDEO_CONTEXT_GSTDECODE
}
 Decoder device type. More...
 
enum  { Y_PLANE = 0 , U_PLANE = 1 , V_PLANE = 2 , A_PLANE = 3 }
 

Functions

vlc_video_contextvlc_video_context_Create (vlc_decoder_device *, enum vlc_video_context_type private_type, size_t private_size, const struct vlc_video_context_operations *)
 
void vlc_video_context_Release (vlc_video_context *)
 
enum vlc_video_context_type vlc_video_context_GetType (const vlc_video_context *)
 
void * vlc_video_context_GetPrivate (vlc_video_context *, enum vlc_video_context_type)
 
vlc_video_contextvlc_video_context_Hold (vlc_video_context *)
 
vlc_decoder_devicevlc_video_context_HoldDevice (vlc_video_context *)
 Get the decoder device used by the device context. More...
 
static vlc_video_contextpicture_GetVideoContext (picture_t *pic)
 
static bool picture_HasChainedPics (const picture_t *pic)
 Check whether a picture has other pictures linked. More...
 
static void vlc_picture_chain_Init (vlc_picture_chain_t *chain)
 Initializes or reset a picture chain. More...
 
static bool vlc_picture_chain_IsEmpty (const vlc_picture_chain_t *chain)
 Check whether a picture chain holds pictures or not. More...
 
static bool vlc_picture_chain_HasNext (const vlc_picture_chain_t *chain)
 Check whether a picture chain has more than one picture. More...
 
static picture_tvlc_picture_chain_PopFront (vlc_picture_chain_t *chain)
 Pop the front of a picture chain. More...
 
static picture_tvlc_picture_chain_PeekFront (vlc_picture_chain_t *chain)
 Peek the front of a picture chain. More...
 
static void vlc_picture_chain_Append (vlc_picture_chain_t *chain, picture_t *pic)
 Append a picture to a picture chain. More...
 
static void vlc_picture_chain_AppendChain (picture_t *chain, picture_t *tail)
 Append a picture chain to a picture chain. More...
 
static void vlc_picture_chain_GetAndClear (vlc_picture_chain_t *in, vlc_picture_chain_t *out)
 Copy the picture chain in another picture chain and clear the original picture chain. More...
 
static vlc_picture_chain_t picture_GetAndResetChain (picture_t *pic)
 Reset a picture chain. More...
 
picture_tpicture_New (vlc_fourcc_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den)
 This function will create a new picture. More...
 
picture_tpicture_NewFromFormat (const video_format_t *p_fmt)
 This function will create a new picture using the given format. More...
 
picture_tpicture_NewFromResource (const video_format_t *, const picture_resource_t *)
 This function will create a new picture using the provided resource. More...
 
void picture_Destroy (picture_t *picture)
 Destroys a picture without references. More...
 
static picture_tpicture_Hold (picture_t *picture)
 Increments the picture reference count. More...
 
static void picture_Release (picture_t *picture)
 Decrements the picture reference count. More...
 
void picture_CopyProperties (picture_t *p_dst, const picture_t *p_src)
 This function will copy all picture dynamic properties. More...
 
void picture_Reset (picture_t *)
 This function will reset a picture information (properties and quantizers). More...
 
void picture_CopyPixels (picture_t *p_dst, const picture_t *p_src)
 This function will copy the picture pixels. More...
 
void plane_CopyPixels (plane_t *p_dst, const plane_t *p_src)
 
void picture_Copy (picture_t *p_dst, const picture_t *p_src)
 This function will copy both picture dynamic properties and pixels. More...
 
picture_tpicture_Clone (picture_t *pic)
 Perform a shallow picture copy. More...
 
int picture_AttachAncillary (picture_t *pic, struct vlc_ancillary *ancillary)
 Attach an ancillary to the picture. More...
 
void * picture_AttachNewAncillary (picture_t *pic, vlc_ancillary_id id, size_t size)
 Allocate a new ancillary and attach it to a picture. More...
 
struct vlc_ancillarypicture_GetAncillary (const picture_t *pic, vlc_ancillary_id id)
 Return the ancillary identified by an ID. More...
 
int picture_Export (vlc_object_t *p_obj, block_t **pp_image, video_format_t *p_fmt, picture_t *p_picture, vlc_fourcc_t i_format, int i_override_width, int i_override_height, bool b_crop)
 This function will export a picture to an encoded bitstream. More...
 
int picture_Setup (picture_t *, const video_format_t *)
 This function will setup all fields of a picture_t without allocating any memory. More...
 
static void picture_SwapUV (picture_t *picture)
 Swap UV planes of a Tri Planars picture. More...
 

Detailed Description

Macro Definition Documentation

◆ A_PITCH

#define A_PITCH   p[A_PLANE].i_pitch

◆ A_PIXELS

#define A_PIXELS   p[A_PLANE].p_pixels

◆ PICTURE_PLANE_MAX

#define PICTURE_PLANE_MAX   (VOUT_MAX_PLANES)

Maximum number of plane for a picture.

◆ U_PITCH

#define U_PITCH   p[U_PLANE].i_pitch

◆ U_PIXELS

#define U_PIXELS   p[U_PLANE].p_pixels

◆ V_PITCH

#define V_PITCH   p[V_PLANE].i_pitch

◆ V_PIXELS

#define V_PIXELS   p[V_PLANE].p_pixels

◆ Y_PITCH

#define Y_PITCH   p[Y_PLANE].i_pitch

◆ Y_PIXELS

#define Y_PIXELS   p[Y_PLANE].p_pixels

Typedef Documentation

◆ picture_buffer_t

◆ picture_context_t

◆ plane_t

typedef struct plane_t plane_t

Description of a planar graphic field.

◆ vlc_decoder_device

◆ vlc_picture_chain_t

picture chaining helpers

◆ vlc_video_context

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Y_PLANE 
U_PLANE 
V_PLANE 
A_PLANE 

◆ vlc_video_context_type

Decoder device type.

Enumerator
VLC_VIDEO_CONTEXT_VAAPI 

private: vaapi_vctx* or empty

VLC_VIDEO_CONTEXT_VDPAU 

private: chroma type (YUV) or empty (RGB)

VLC_VIDEO_CONTEXT_DXVA2 

private: d3d9_video_context_t*

VLC_VIDEO_CONTEXT_D3D11VA 

private: d3d11_video_context_t*

VLC_VIDEO_CONTEXT_AWINDOW 

private: android_video_context_t*

VLC_VIDEO_CONTEXT_NVDEC 

empty

VLC_VIDEO_CONTEXT_CVPX 

private: cvpx_video_context*

VLC_VIDEO_CONTEXT_MMAL 

empty

VLC_VIDEO_CONTEXT_GSTDECODE 

empty

Function Documentation

◆ picture_AttachAncillary()

int picture_AttachAncillary ( picture_t pic,
struct vlc_ancillary ancillary 
)

Attach an ancillary to the picture.

Warning
the ancillary will be released only if the picture is created from picture_New(), and picture_Clone().
Note
Several ancillaries can be attached to a picture, but if two ancillaries are identified by the same ID, only the last one take precedence.
Parameters
picthe picture to attach an ancillary
ancillaryancillary that will be held by the frame, can't be NULL
Returns
VLC_SUCCESS in case of success, VLC_ENOMEM in case of alloc error

References picture_priv_t::ancillaries, container_of, picture_priv_buffer_t::priv, and vlc_ancillary_array_Insert().

Referenced by picture_AttachNewAncillary().

◆ picture_AttachNewAncillary()

void * picture_AttachNewAncillary ( picture_t pic,
vlc_ancillary_id  id,
size_t  size 
)

Allocate a new ancillary and attach it to a picture.

Helper equivalent to malloc + vlc_ancillary_Create + picture_AttachAncillary. The returned memory is not initialized.

Parameters
picpicture to attach created ancillary to
idid of the ancillary to create
sizeallocation size in bytes
Returns
The allocated pointer on success, NULL on out-of-memory

References vlc_ancillary::data, picture_AttachAncillary(), vlc_ancillary_Create(), and vlc_ancillary_Release().

◆ picture_Clone()

picture_t * picture_Clone ( picture_t pic)

Perform a shallow picture copy.

This function makes a shallow copy of an existing picture. The same planes and resources will be used, and the cloned picture reference count will be incremented.

Returns
A clone picture on success, NULL on error.

References picture_priv_t::ancillaries, container_of, picture_DestroyClone(), picture_InternalClone(), picture_priv_buffer_t::priv, and vlc_ancillary_array_Dup().

Referenced by vout_snapshot_Set().

◆ picture_Copy()

void picture_Copy ( picture_t p_dst,
const picture_t p_src 
)

This function will copy both picture dynamic properties and pixels.

You have to notice that sometime a simple picture_Hold may do what you want without the copy overhead. Provided for convenience.

Parameters
p_dstpointer to the destination picture.
p_srcpointer to the source picture.

References picture_CopyPixels(), and picture_CopyProperties().

Referenced by PrerenderPicture().

◆ picture_CopyPixels()

void picture_CopyPixels ( picture_t p_dst,
const picture_t p_src 
)

This function will copy the picture pixels.

You can safely copy between pictures that do not have the same size, only the compatible(smaller) part will be copied.

References picture_t::context, picture_context_t::copy, picture_t::i_planes, picture_t::p, and plane_CopyPixels().

Referenced by picture_Copy().

◆ picture_CopyProperties()

void picture_CopyProperties ( picture_t p_dst,
const picture_t p_src 
)

◆ picture_Destroy()

void picture_Destroy ( picture_t picture)

Destroys a picture without references.

This function destroys a picture with zero references left. Never call this function directly. Use picture_Release() instead.

References picture_priv_t::ancillaries, container_of, picture_priv_t::destroy, picture_priv_t::gc, PictureDestroyContext(), picture_priv_buffer_t::priv, picture_t::refs, vlc_ancillary_array_Clear(), and vlc_atomic_rc_get().

Referenced by picture_Release().

◆ picture_Export()

int picture_Export ( vlc_object_t p_obj,
block_t **  pp_image,
video_format_t p_fmt,
picture_t p_picture,
vlc_fourcc_t  i_format,
int  i_override_width,
int  i_override_height,
bool  b_crop 
)

This function will export a picture to an encoded bitstream.

pp_image will contain the encoded bitstream in psz_format format.

p_fmt can be NULL otherwise it will be set with the format used for the picture before encoding.

i_override_width/height allow to override the width and/or the height of the picture to be encoded:

  • if strictly lower than 0, the original dimension will be used.
  • if equal to 0, it will be deduced from the other dimension which must be different to 0.
  • if strictly higher than 0, it will either override the dimension if b_crop is false, or crop the picture to the provided size if b_crop is true. If at most one of them is > 0 then the picture aspect ratio will be kept.

References picture_t::date, picture_t::format, video_format_t::i_chroma, vlc_frame_t::i_dts, video_format_t::i_height, vlc_frame_t::i_pts, video_format_t::i_sar_den, video_format_t::i_sar_num, video_format_t::i_visible_height, video_format_t::i_visible_width, video_format_t::i_width, video_format_t::i_x_offset, video_format_t::i_y_offset, image_HandlerCreate, image_HandlerDelete(), image_Write, VLC_EGENERIC, VLC_ENOMEM, and VLC_SUCCESS.

Referenced by vout_GetSnapshot().

◆ picture_GetAncillary()

struct vlc_ancillary * picture_GetAncillary ( const picture_t pic,
vlc_ancillary_id  id 
)

Return the ancillary identified by an ID.

Parameters
idid of ancillary to request
Returns
the ancillary or NULL if the ancillary for that particular id is not present

References picture_priv_t::ancillaries, container_of, and vlc_ancillary_array_Get().

◆ picture_GetAndResetChain()

static vlc_picture_chain_t picture_GetAndResetChain ( picture_t pic)
inlinestatic

Reset a picture chain.

Returns
the picture chain that was contained in the picture

References picture_t::p_next, and vlc_pic_chain::tail.

Referenced by FilterChainVideoFilter().

◆ picture_GetVideoContext()

static vlc_video_context * picture_GetVideoContext ( picture_t pic)
inlinestatic

◆ picture_HasChainedPics()

static bool picture_HasChainedPics ( const picture_t pic)
inlinestatic

◆ picture_Hold()

static picture_t * picture_Hold ( picture_t picture)
inlinestatic

◆ picture_New()

picture_t * picture_New ( vlc_fourcc_t  i_chroma,
int  i_width,
int  i_height,
int  i_sar_num,
int  i_sar_den 
)

This function will create a new picture.

The picture created will implement a default release management compatible with picture_Hold and picture_Release. This default management will release p_sys, gc.p_sys fields if non NULL.

References picture_NewFromFormat(), video_format_Init(), and video_format_Setup().

◆ picture_NewFromFormat()

picture_t * picture_NewFromFormat ( const video_format_t p_fmt)

This function will create a new picture using the given format.

When possible, it is preferred to use this function over picture_New as more information about the format is kept.

◆ picture_NewFromResource()

◆ picture_Release()

◆ picture_Reset()

void picture_Reset ( picture_t p_picture)

This function will reset a picture information (properties and quantizers).

It is sometimes useful for reusing pictures (like from a pool).

References picture_priv_t::ancillaries, picture_t::b_force, picture_t::b_progressive, picture_t::b_still, picture_t::b_top_field_first, container_of, picture_t::date, picture_t::i_nb_fields, PictureDestroyContext(), vlc_ancillary_array_Clear(), and VLC_TICK_INVALID.

Referenced by ModuleThread_NewVideoBuffer(), and VoutVideoFilterInteractiveNewPicture().

◆ picture_Setup()

int picture_Setup ( picture_t ,
const video_format_t  
)

This function will setup all fields of a picture_t without allocating any memory.

XXX The memory must already be initialized. It does not need to be released.

It will return VLC_EGENERIC if the core does not understand the requested format.

It can be useful to get the properties of planes.

◆ picture_SwapUV()

static void picture_SwapUV ( picture_t picture)
inlinestatic

Swap UV planes of a Tri Planars picture.

It just swap the planes information without doing any copy.

References picture_t::i_planes, picture_t::p, U_PLANE, V_PLANE, and vlc_assert.

◆ plane_CopyPixels()

void plane_CopyPixels ( plane_t p_dst,
const plane_t p_src 
)

◆ vlc_picture_chain_Append()

static void vlc_picture_chain_Append ( vlc_picture_chain_t chain,
picture_t pic 
)
inlinestatic

Append a picture to a picture chain.

Parameters
chainthe picture chain pointer
picthe picture to append to the chain

References vlc_pic_chain::front, picture_t::p_next, picture_HasChainedPics(), vlc_pic_chain::tail, and vlc_assert.

Referenced by picture_fifo_Flush(), PictureFifoPush(), and vout_snapshot_Set().

◆ vlc_picture_chain_AppendChain()

static void vlc_picture_chain_AppendChain ( picture_t chain,
picture_t tail 
)
inlinestatic

Append a picture chain to a picture chain.

References picture_t::p_next.

◆ vlc_picture_chain_GetAndClear()

static void vlc_picture_chain_GetAndClear ( vlc_picture_chain_t in,
vlc_picture_chain_t out 
)
inlinestatic

Copy the picture chain in another picture chain and clear the original picture chain.

Parameters
inpicture chain to copy and clear
outpicture chain to copy into

References vlc_picture_chain_Init().

Referenced by picture_fifo_Flush().

◆ vlc_picture_chain_HasNext()

static bool vlc_picture_chain_HasNext ( const vlc_picture_chain_t chain)
inlinestatic

Check whether a picture chain has more than one picture.

References vlc_pic_chain::front, vlc_pic_chain::tail, and vlc_picture_chain_IsEmpty().

◆ vlc_picture_chain_Init()

static void vlc_picture_chain_Init ( vlc_picture_chain_t chain)
inlinestatic

Initializes or reset a picture chain.

Warning
do not call this if the chain still holds pictures, it will leak them.

References vlc_pic_chain::front.

Referenced by filter_chain_AppendInner(), picture_fifo_Flush(), PictureFifoReset(), vlc_picture_chain_GetAndClear(), and vout_snapshot_New().

◆ vlc_picture_chain_IsEmpty()

static bool vlc_picture_chain_IsEmpty ( const vlc_picture_chain_t chain)
inlinestatic

◆ vlc_picture_chain_PeekFront()

static picture_t * vlc_picture_chain_PeekFront ( vlc_picture_chain_t chain)
inlinestatic

Peek the front of a picture chain.

The picture chain is unchanged.

Returns
the front of the picture chain (the picture itself)

References vlc_pic_chain::front.

◆ vlc_picture_chain_PopFront()

static picture_t * vlc_picture_chain_PopFront ( vlc_picture_chain_t chain)
inlinestatic

Pop the front of a picture chain.

The next picture in the chain becomes the front of the picture chain.

Returns
the front of the picture chain (the picture itself)

References vlc_pic_chain::front, and picture_t::p_next.

Referenced by filter_chain_VideoFilter(), FilterDeletePictures(), picture_fifo_Flush(), PictureFifoPop(), vout_snapshot_Destroy(), and vout_snapshot_Get().

◆ vlc_video_context_Create()

◆ vlc_video_context_GetPrivate()

void * vlc_video_context_GetPrivate ( vlc_video_context vctx,
enum  vlc_video_context_type 
)

◆ vlc_video_context_GetType()

enum vlc_video_context_type vlc_video_context_GetType ( const vlc_video_context vctx)

◆ vlc_video_context_Hold()

◆ vlc_video_context_HoldDevice()

vlc_decoder_device * vlc_video_context_HoldDevice ( vlc_video_context vctx)

Get the decoder device used by the device context.

This will increment the refcount of the decoder device.

References vlc_video_context::device, and vlc_decoder_device_Hold().

Referenced by DisplayHoldDecoderDevice(), and vout_Start().

◆ vlc_video_context_Release()