pass d3dvideosink a window id
jacob s
jacobhameiri at gmail.com
Wed Jun 26 06:37:48 PDT 2013
Thanks,
Tried this code, but it still opens the default windows:
#include <gst/gst.h>
#include <gst/video/videooverlay.h>
#include "windows.h"
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
GstElement* d3dvideosink_element;
HWND video_window;
WNDCLASS WndClass;
DWORD err = 0 ;
WNDCLASSEX wc;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("videotestsrc ! videoconvert !
d3dvideosink",NULL);
d3dvideosink_element =
gst_bin_get_by_name((GstBin*)pipeline,"d3dvideosink");
wc.cbSize = sizeof(WNDCLASSEX);
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = GetModuleHandle(NULL);
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = NULL;
wc.lpszClassName = L"myWindowClass";
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc))
{
MessageBox(NULL, L"Window Registration Failed!", L"Error!",
MB_ICONEXCLAMATION | MB_OK);
return 0;
}
video_window = CreateWindowEx(
WS_EX_CLIENTEDGE,
L"myWindowClass",
L"The title of my window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
NULL, NULL, GetModuleHandle(NULL), NULL);
err = GetLastError();
gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(d3dvideosink_element),(guintptr)video_window);
/* Start playing */
gst_element_set_state(pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
2013/6/26 Sebastian Dröge <slomo at circular-chaos.org>
> On Mi, 2013-06-26 at 12:06 +0300, jacob s wrote:
> > Hi,
> >
> >
> > Is it possible to pass d3dvideosink a windows id ? how ?
> >
> > if not what sink should I use to show my own custom window ( version
> > 1.0 on windows ) and how ?
>
> You can use gst_video_overlay_set_window_handle() on the sink, the same
> way you do it on other platforms. Alternative you can also set it on
> playbin and it will propagate that value to the sink.
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130626/482d19fb/attachment.html>
More information about the gstreamer-devel
mailing list