Path: blob/21.2-virgl/src/gallium/include/pipe/p_video_codec.h
4566 views
/**************************************************************************1*2* Copyright 2009 Younes Manton.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627#ifndef PIPE_VIDEO_CONTEXT_H28#define PIPE_VIDEO_CONTEXT_H2930#include "pipe/p_video_state.h"3132#ifdef __cplusplus33extern "C" {34#endif3536struct pipe_screen;37struct pipe_surface;38struct pipe_macroblock;39struct pipe_picture_desc;40struct pipe_fence_handle;4142/**43* Gallium video codec for a specific format/profile44*/45struct pipe_video_codec46{47struct pipe_context *context;4849enum pipe_video_profile profile;50unsigned level;51enum pipe_video_entrypoint entrypoint;52enum pipe_video_chroma_format chroma_format;53unsigned width;54unsigned height;55unsigned max_references;56bool expect_chunked_decode;5758/**59* destroy this video decoder60*/61void (*destroy)(struct pipe_video_codec *codec);6263/**64* start decoding of a new frame65*/66void (*begin_frame)(struct pipe_video_codec *codec,67struct pipe_video_buffer *target,68struct pipe_picture_desc *picture);6970/**71* decode a macroblock72*/73void (*decode_macroblock)(struct pipe_video_codec *codec,74struct pipe_video_buffer *target,75struct pipe_picture_desc *picture,76const struct pipe_macroblock *macroblocks,77unsigned num_macroblocks);7879/**80* decode a bitstream81*/82void (*decode_bitstream)(struct pipe_video_codec *codec,83struct pipe_video_buffer *target,84struct pipe_picture_desc *picture,85unsigned num_buffers,86const void * const *buffers,87const unsigned *sizes);8889/**90* encode to a bitstream91*/92void (*encode_bitstream)(struct pipe_video_codec *codec,93struct pipe_video_buffer *source,94struct pipe_resource *destination,95void **feedback);9697/**98* end decoding of the current frame99*/100void (*end_frame)(struct pipe_video_codec *codec,101struct pipe_video_buffer *target,102struct pipe_picture_desc *picture);103104/**105* flush any outstanding command buffers to the hardware106* should be called before a video_buffer is acessed by the gallium frontend again107*/108void (*flush)(struct pipe_video_codec *codec);109110/**111* get encoder feedback112*/113void (*get_feedback)(struct pipe_video_codec *codec, void *feedback, unsigned *size);114};115116/**117* output for decoding / input for displaying118*/119struct pipe_video_buffer120{121struct pipe_context *context;122123enum pipe_format buffer_format;124unsigned width;125unsigned height;126bool interlaced;127unsigned bind;128129/**130* destroy this video buffer131*/132void (*destroy)(struct pipe_video_buffer *buffer);133134/**135* get an individual sampler view for each plane136*/137struct pipe_sampler_view **(*get_sampler_view_planes)(struct pipe_video_buffer *buffer);138139/**140* get an individual sampler view for each component141*/142struct pipe_sampler_view **(*get_sampler_view_components)(struct pipe_video_buffer *buffer);143144/**145* get an individual surfaces for each plane146*/147struct pipe_surface **(*get_surfaces)(struct pipe_video_buffer *buffer);148149/*150* auxiliary associated data151*/152void *associated_data;153154/*155* codec where the associated data came from156*/157struct pipe_video_codec *codec;158159/*160* destroy the associated data161*/162void (*destroy_associated_data)(void *associated_data);163};164165#ifdef __cplusplus166}167#endif168169#endif /* PIPE_VIDEO_CONTEXT_H */170171172