mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 09:00:10 +01:00
xvmc: Replace frame_started by picture_structure
The preferred solution to keeping track of the picture structure has been putting it in the state tracker, so use picture_structure instead of frame_started to check if a frame needs to begin. If picture_structure has been changed, end the frame and start again. Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com> Signed-off-by: Christian König <deathsimple@vodafone.de>
This commit is contained in:
parent
0a00a9a05b
commit
a09754c15f
2 changed files with 16 additions and 10 deletions
|
|
@ -101,11 +101,14 @@ SetDecoderStatus(XvMCSurfacePrivate *surface)
|
||||||
{
|
{
|
||||||
struct pipe_video_decoder *decoder;
|
struct pipe_video_decoder *decoder;
|
||||||
struct pipe_video_buffer *ref_frames[2];
|
struct pipe_video_buffer *ref_frames[2];
|
||||||
|
struct pipe_mpeg12_picture_desc desc = { { PIPE_VIDEO_PROFILE_MPEG1} };
|
||||||
|
|
||||||
XvMCContextPrivate *context_priv;
|
XvMCContextPrivate *context_priv;
|
||||||
|
|
||||||
unsigned i, num_refs = 0;
|
unsigned i, num_refs = 0;
|
||||||
|
|
||||||
|
desc.picture_structure = surface->picture_structure;
|
||||||
|
|
||||||
assert(surface);
|
assert(surface);
|
||||||
|
|
||||||
context_priv = surface->context->privData;
|
context_priv = surface->context->privData;
|
||||||
|
|
@ -124,6 +127,7 @@ SetDecoderStatus(XvMCSurfacePrivate *surface)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
decoder->set_reference_frames(decoder, ref_frames, num_refs);
|
decoder->set_reference_frames(decoder, ref_frames, num_refs);
|
||||||
|
decoder->set_picture_parameters(context_priv->decoder, &desc.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -148,9 +152,9 @@ RecursiveEndFrame(XvMCSurfacePrivate *surface)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->frame_started) {
|
if (surface->picture_structure) {
|
||||||
surface->frame_started = 0;
|
|
||||||
SetDecoderStatus(surface);
|
SetDecoderStatus(surface);
|
||||||
|
surface->picture_structure = 0;
|
||||||
|
|
||||||
for (i = 0; i < 2; ++i)
|
for (i = 0; i < 2; ++i)
|
||||||
surface->ref[i] = NULL;
|
surface->ref[i] = NULL;
|
||||||
|
|
@ -273,7 +277,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
|
||||||
xvmc_mb = macroblocks->macro_blocks + first_macroblock;
|
xvmc_mb = macroblocks->macro_blocks + first_macroblock;
|
||||||
|
|
||||||
/* If the surface we're rendering hasn't changed the ref frames shouldn't change. */
|
/* If the surface we're rendering hasn't changed the ref frames shouldn't change. */
|
||||||
if (target_surface_priv->frame_started && (
|
if (target_surface_priv->picture_structure > 0 && (
|
||||||
|
target_surface_priv->picture_structure != picture_structure ||
|
||||||
target_surface_priv->ref[0] != past_surface ||
|
target_surface_priv->ref[0] != past_surface ||
|
||||||
target_surface_priv->ref[1] != future_surface ||
|
target_surface_priv->ref[1] != future_surface ||
|
||||||
(xvmc_mb->x == 0 && xvmc_mb->y == 0))) {
|
(xvmc_mb->x == 0 && xvmc_mb->y == 0))) {
|
||||||
|
|
@ -285,10 +290,11 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
|
||||||
target_surface_priv->ref[0] = past_surface;
|
target_surface_priv->ref[0] = past_surface;
|
||||||
target_surface_priv->ref[1] = future_surface;
|
target_surface_priv->ref[1] = future_surface;
|
||||||
|
|
||||||
|
if (target_surface_priv->picture_structure)
|
||||||
|
SetDecoderStatus(target_surface_priv);
|
||||||
|
else {
|
||||||
|
target_surface_priv->picture_structure = picture_structure;
|
||||||
SetDecoderStatus(target_surface_priv);
|
SetDecoderStatus(target_surface_priv);
|
||||||
|
|
||||||
if (!target_surface_priv->frame_started) {
|
|
||||||
target_surface_priv->frame_started = 1;
|
|
||||||
decoder->begin_frame(decoder);
|
decoder->begin_frame(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -494,7 +500,7 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
|
||||||
surface_priv = surface->privData;
|
surface_priv = surface->privData;
|
||||||
context_priv = surface_priv->context->privData;
|
context_priv = surface_priv->context->privData;
|
||||||
|
|
||||||
if (surface_priv->frame_started) {
|
if (surface_priv->picture_structure) {
|
||||||
SetDecoderStatus(surface_priv);
|
SetDecoderStatus(surface_priv);
|
||||||
context_priv->decoder->end_frame(context_priv->decoder);
|
context_priv->decoder->end_frame(context_priv->decoder);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ typedef struct
|
||||||
void *decode_buffer;
|
void *decode_buffer;
|
||||||
struct pipe_video_buffer *video_buffer;
|
struct pipe_video_buffer *video_buffer;
|
||||||
|
|
||||||
// have we allready told the decoder to start a frame
|
/* nonzero if this picture is already being decoded */
|
||||||
bool frame_started;
|
int picture_structure;
|
||||||
|
|
||||||
XvMCSurface *ref[2];
|
XvMCSurface *ref[2];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue