summaryrefslogtreecommitdiffstats
path: root/src/libXvMC
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2008-07-24 16:50:18 -0400
committerYounes Manton <[email protected]>2008-07-24 16:50:18 -0400
commitd1dc937c62083c3d8ab9f420df8e54f5c3217468 (patch)
tree3e345839ad504d285b3759a83db690ff5920a842 /src/libXvMC
parenta8da04cb861b8f9caf3acd33f52f64621f0c15e2 (diff)
g3dvl: Added more XvMC stubs to get mplayer working.
Diffstat (limited to 'src/libXvMC')
-rw-r--r--src/libXvMC/context.c28
-rw-r--r--src/libXvMC/subpicture.c123
-rw-r--r--src/libXvMC/surface.c17
3 files changed, 150 insertions, 18 deletions
diff --git a/src/libXvMC/context.c b/src/libXvMC/context.c
index 59e1cb2b256..9cf654d6bb2 100644
--- a/src/libXvMC/context.c
+++ b/src/libXvMC/context.c
@@ -183,18 +183,36 @@ XvMCSurfaceInfo* XvMCListSurfaceTypes(Display *display, XvPortID port, int *num)
surface_info->chroma_format = XVMC_CHROMA_FORMAT_420;
surface_info->max_width = 2048;
surface_info->max_height = 2048;
+ surface_info->subpicture_max_width = 2048;
+ surface_info->subpicture_max_height = 2048;
surface_info->mc_type = XVMC_IDCT | XVMC_MPEG_2;
surface_info->surface_type_id = 123; /* FIXME: XAllocID(display)*/;
- surface_info->flags |= XVMC_INTRA_UNSIGNED;
+ surface_info->flags = XVMC_INTRA_UNSIGNED | XVMC_SUBPICTURE_INDEPENDENT_SCALING | XVMC_BACKEND_SUBPICTURE;
return surface_info;
}
XvImageFormatValues* XvMCListSubpictureTypes(Display* display, XvPortID port, int surface_type_id, int *count_return)
{
- /* TODO */
- *count_return = 0;
-
- return NULL;
+ XvImageFormatValues *image_formats = calloc(1, sizeof(XvImageFormatValues));
+
+ *count_return = 1;
+
+ image_formats[0].id = 123;
+ image_formats[0].type = XvRGB;
+ image_formats[0].byte_order = LSBFirst;
+ image_formats[0].bits_per_pixel = 8;
+ image_formats[0].format = XvPacked;
+ image_formats[0].num_planes = 1;
+ image_formats[0].depth = 8;
+ image_formats[0].red_mask = 0x0000FF;
+ image_formats[0].green_mask = 0x00FF00;
+ image_formats[0].blue_mask = 0xFF0000;
+ image_formats[0].component_order[0] = 'R';
+ image_formats[0].component_order[0] = 'G';
+ image_formats[0].component_order[0] = 'B';
+ image_formats[0].scanline_order = XvTopToBottom;
+
+ return image_formats;
}
diff --git a/src/libXvMC/subpicture.c b/src/libXvMC/subpicture.c
index 38d93438334..c8f70c90d0c 100644
--- a/src/libXvMC/subpicture.c
+++ b/src/libXvMC/subpicture.c
@@ -13,7 +13,33 @@ Status XvMCCreateSubpicture
int xvimage_id
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!context)
+ return XvMCBadContext;
+
+ assert(subpicture);
+
+ if (width > 2048 || height > 2048)
+ return BadValue;
+
+ if (xvimage_id != 123)
+ return BadMatch;
+
+ subpicture->subpicture_id = XAllocID(display);
+ subpicture->context_id = context->context_id;
+ subpicture->xvimage_id = xvimage_id;
+ subpicture->width = width;
+ subpicture->height = height;
+ subpicture->num_palette_entries = 0;
+ subpicture->entry_bytes = 0;
+ subpicture->component_order[0] = 0;
+ subpicture->component_order[1] = 0;
+ subpicture->component_order[2] = 0;
+ subpicture->component_order[3] = 0;
+ /* TODO: subpicture->privData = ;*/
+
+ return Success;
}
Status XvMCClearSubpicture
@@ -27,7 +53,14 @@ Status XvMCClearSubpicture
unsigned int color
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ /* TODO: Assert clear rect is within bounds? Or clip? */
+
+ return Success;
}
Status XvMCCompositeSubpicture
@@ -43,17 +76,42 @@ Status XvMCCompositeSubpicture
short dsty
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ assert(image);
+
+ if (subpicture->xvimage_id != image->id)
+ return BadMatch;
+
+ /* TODO: Assert rects are within bounds? Or clip? */
+
+ return Success;
}
Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
return BadImplementation;
}
Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, unsigned char *palette)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ assert(palette);
+
+ /* We don't support paletted subpictures */
+ return BadMatch;
}
Status XvMCBlendSubpicture
@@ -71,7 +129,19 @@ Status XvMCBlendSubpicture
unsigned short surfh
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!target_surface)
+ return XvMCBadSurface;
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ if (target_surface->context_id != subpicture->context_id)
+ return BadMatch;
+
+ /* TODO: Assert rects are within bounds? Or clip? */
+ return Success;
}
Status XvMCBlendSubpicture2
@@ -90,21 +160,56 @@ Status XvMCBlendSubpicture2
unsigned short surfh
)
{
- return BadImplementation;
+ assert(display);
+
+ if (!source_surface || !target_surface)
+ return XvMCBadSurface;
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ if (source_surface->context_id != subpicture->context_id)
+ return BadMatch;
+
+ if (source_surface->context_id != subpicture->context_id)
+ return BadMatch;
+
+ /* TODO: Assert rects are within bounds? Or clip? */
+ return Success;
}
Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ return Success;
}
Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ return Success;
}
Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *status)
{
- return BadImplementation;
+ assert(display);
+
+ if (!subpicture)
+ return XvMCBadSubpicture;
+
+ assert(status);
+
+ /* TODO */
+ *status = 0;
+
+ return Success;
}
diff --git a/src/libXvMC/surface.c b/src/libXvMC/surface.c
index a550114655c..1c07220e844 100644
--- a/src/libXvMC/surface.c
+++ b/src/libXvMC/surface.c
@@ -281,14 +281,23 @@ Status XvMCRenderSurface
Status XvMCFlushSurface(Display *display, XvMCSurface *surface)
{
+ assert(display);
+
+ if (!surface)
+ return XvMCBadSurface;
+
/* TODO: Check display & surface match */
- return BadImplementation;
+ return Success;
}
Status XvMCSyncSurface(Display *display, XvMCSurface *surface)
{
- /* TODO: Check display & surface match */
- return BadImplementation;
+ assert(display);
+
+ if (!surface)
+ return XvMCBadSurface;
+
+ return Success;
}
Status XvMCPutSurface
@@ -358,7 +367,7 @@ Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status)
/* TODO */
*status = 0;
- return BadImplementation;
+ return Success;
}
Status XvMCDestroySurface(Display *display, XvMCSurface *surface)