Hi Everyone,
I've created a small patch that adds support for I420 to directdrawsink for hardware that provides it. It should be easy to add more yuv formats. Carsten Index: gstdirectdrawsink.c =================================================================== --- gstdirectdrawsink.c (original) +++ gstdirectdrawsink.c (working copy) @@ -117,6 +117,11 @@ GST_PAD_ALWAYS, GST_STATIC_CAPS ("video/x-raw-rgb, " "framerate = (fraction) [ 0, MAX ], " + "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]" + ";" + "video/x-raw-yuv, " + "format=(fourcc)I420, " + "framerate = (fraction) [ 0, MAX ], " "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]") ); @@ -864,11 +869,23 @@ /* Write each line respecting the destination surface pitch */ data = surf_desc.lpSurface; - src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height; - for (line = 0; line < surf_desc.dwHeight; line++) { - memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch); - data += surf_desc.lPitch; + if(surf_desc.ddpfPixelFormat.dwFlags==DDPF_RGB){ + src_pitch = GST_BUFFER_SIZE (buf) / ddrawsink->video_height; + for (line = 0; line < surf_desc.dwHeight; line++) { + memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch), src_pitch); + data += surf_desc.lPitch; + } + }else{ + //Y plane + src_pitch = GST_ROUND_UP_4(ddrawsink->video_width); + for (line = 0; line < surf_desc.dwHeight; line++) { + memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch),ddrawsink->video_width); + data += surf_desc.lPitch; + } + //U/V planes + memcpy (data, GST_BUFFER_DATA (buf) + (line * src_pitch),GST_BUFFER_SIZE (buf) - (line * src_pitch)); } + /* Unlock the surface */ hRes = IDirectDrawSurface7_Unlock (ddrawsink->offscreen_surface, NULL); @@ -982,6 +999,7 @@ pPixelFormat->dwFlags = DDPF_FOURCC; ret &= gst_structure_get_fourcc (structure, "format", &fourcc); pPixelFormat->dwFourCC = fourcc; + pPixelFormat->dwYUVBitCount = 8; } else { GST_CAT_WARNING_OBJECT (directdrawsink_debug, ddrawsink, "unknown caps name received %" GST_PTR_FORMAT, caps); @@ -1609,6 +1627,9 @@ DDCAPS ddcaps_hardware; DDCAPS ddcaps_emulation; GstCaps *format_caps = NULL; + DWORD numCodes = 0; + DWORD *fccCodes = NULL; + gint i; ddrawsink->caps = gst_caps_new_empty (); if (!ddrawsink->caps) @@ -1684,8 +1705,26 @@ return NULL; } - /*GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, "returning caps %s", - * gst_caps_to_string (ddrawsink->caps)); */ + IDirectDraw7_GetFourCCCodes(ddrawsink->ddraw_object,&numCodes,NULL); + fccCodes=g_newa(DWORD,numCodes); + IDirectDraw7_GetFourCCCodes(ddrawsink->ddraw_object,&numCodes,fccCodes); + for(i=0;i<numCodes;i++){ + GstCaps *caps=NULL; + if(fccCodes[i]==GST_MAKE_FOURCC('I','4','2','0')){ + caps = gst_caps_new_simple ("video/x-raw-yuv", + "format", GST_TYPE_FOURCC, fccCodes[i], + "width", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, + "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1,NULL); + //"bpp", G_TYPE_INT, 16, + //"depth", G_TYPE_INT, 15, + //"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL); + } + if (caps) + gst_caps_append (ddrawsink->caps,caps); + } + //GST_CAT_INFO_OBJECT (directdrawsink_debug, ddrawsink, "returning caps %s", + // gst_caps_to_string (ddrawsink->caps)); return ddrawsink->caps; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Hi,
I would like to know if it is plan to add properties to choose different look for the directdrawsink and ximagesink (autovideosink in general) ? I mean, change the title of the window, and display system menu or not, and can resize or not the window. Sincerely Julien > Hi Everyone, > I've created a small patch that adds support for I420 to directdrawsink > for hardware that provides it. > > It should be easy to add more yuv formats. > > Carsten > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________ > gstreamer-devel mailing list > [hidden email] > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
On Thu, Feb 28, 2008 at 05:48:23PM +0100, [hidden email] wrote:
> I would like to know if it is plan to add properties to choose different > look for the directdrawsink and ximagesink (autovideosink in general) ? > I mean, change the title of the window, and display system menu or not, > and can resize or not the window. The normal operation for a videosink is to be embedded in another window using GstXOverlay. This other window would be managed by your choice of toolkit, i.e., Gtk+ or Qt on Linux. Automatically creating a window when not embedded is a handy feature for pipeline construction and debugging, but it is not intended to be useful as an end-user interface. dave... ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |