[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-player-dev
Subject:    Re: [Player-dev] CR: HXRecord - Video Previewing Cleanup Part 1
From:       Greg Wright <gwright () real ! com>
Date:       2007-10-09 17:46:24
Message-ID: 470BBE70.1010708 () real ! com
[Download RAW message or body]

Looks good.
--greg.

Peter Krenesky wrote:
> Modified by: Peter Krenesky <peter@osuosl.org>
> Date: <10:04:07>
> Project: olpc-player
> 
> Synopsis: Part 1 of cleaning up the video preview code.  video previewing 
> values were all hardcoded and opened only in a new window.  This update 
> allows the client to pass in settings as well as the window id of a drawable 
> to draw the preview on.  There will be further cleanup and refinement of this 
> code
> 
> Overview:
> 
>   - Logic for opening preview was moved into the appropriate classes.  
>   - open video preview now accepts and uses height, width, and window handle
> 
> 
> Files Added:
> samples/pygtk-producer.py
> 
> Files Modified: 
> hxinput.cpp
> hxinput.h
> pyinput.cpp
> samplepreviewsink.cpp
> samplepreviewsink.h
> xlibpreview.cpp
> xlibpreview.h
> 
> Platforms and Profiles Functionality verified:
> x86 helix-client-OLPC
> 
> Branch: HEAD
> 
> Copyright assignment:
> 
> In consideration for RealNetworks' hosting and maintenance of my modification,
> I agree to assign to RealNetworks full copyright ownership of the code 
> included
> in the attached patch, and agree that RealNetworks has no duty of accounting 
> to
> me for it. I warrant that this code is entirely original to and owned by me, 
> that I can legally grant the copyright assignment, and that my contribution
> does not violate any other person's rights, and laws or breach any contract. I
> understand that RealNetworks may license this code under RPSL, RCSL, and/or 
> any
> other license at RealNetworks' discretion, and use the code in any way.
> 
> QA Instructions: Use the newly added pygtk-producer.py to test video preview 
> using a window created by pygtk
> 
> Index: hxinput.cpp
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/hxinput.cpp,v
> retrieving revision 1.1
> diff -u -w -r1.1 hxinput.cpp
> --- hxinput.cpp	24 Sep 2007 17:04:26 -0000	1.1
> +++ hxinput.cpp	9 Oct 2007 17:39:28 -0000
> @@ -50,6 +50,11 @@
>  
>  #include "hxinput.h"
>  #include "ihxtbase.h"
> +#include "pyrecord.h"
> +#include "hxrecord.h"
> +
> +#include "ihxtpreviewsink.h"
> +#include "samplepreviewsink.h"
>  
>  /* 
>   * Class:   PyHxinput
> @@ -239,6 +244,98 @@
>  }
>  
>  /* 
> + *  Opens a video preview for this input
> + */
> +HX_RESULT
> +PyHxInput::OpenVideoPreview(UINT32 width, UINT32 height, PyObject* 
> windowhandle, bool rawvideo)
> +{
> +    HX_RESULT res = HXR_FAIL;
> +
> +    IHXTClassFactory *pClassFactory = NULL;
> +    IHXTPropertyBag *pOptimalSettings = NULL;
> +    IHXTPreviewSinkControl *pPreviewSinkControl = NULL;
> +    UINT32 colorFormat = HXT_VIDEO_FORMAT_BGRA32_NONINVERTED;
> +
> +    res = QueryInterface(IID_IHXTPreviewSinkControl, 
> (void**)&pPreviewSinkControl);
> +
> +    if (SUCCEEDED(res))
> +        res = core->QueryInterface(IID_IHXTClassFactory, 
> (void**)&pClassFactory);
> +
> +    //create property bag for settings
> +    if (SUCCEEDED(res))
> +        res = pClassFactory->CreateInstance(IID_IHXTPropertyBag, 
> (IUnknown**)&pOptimalSettings);
> +
> +    //get optimal setttings
> +    if (SUCCEEDED(res)) {
> +
> +        // Set media format
> +        res = pOptimalSettings->SetString(kPropMediaFormat, 
> kValueMediaFormatUncompVideo);
> +
> +        // set preview position
> +        if (rawvideo)
> +        {
> +            res = pOptimalSettings->SetUint(kPropPreviewSinkPosition, 
> kValueBeforeAllPrefilters);
> +        }
> +        else 
> +        {
> +            res = pOptimalSettings->SetUint(kPropPreviewSinkPosition, 
> kValueAfterAllPrefilters);
> +        }
> +
> +        res = 
> pPreviewSinkControl->GetOptimalSinkProperties(&pOptimalSettings);
> +
> +        // set update interval (all updates)
> +        res = pOptimalSettings->SetInt(kPropSinkUpdateInterval, 
> kValueAllSamples);
> +
> +        // set height
> +        if (SUCCEEDED(res))
> +            res = pOptimalSettings->SetUint(kPropVideoFrameWidth, width);
> +
> +        // set width
> +        if (SUCCEEDED(res))
> +            res = pOptimalSettings->SetUint(kPropVideoFrameHeight, height);
> +
> +        // set color format
> +        if (SUCCEEDED(res))
> +            res = pOptimalSettings->SetUint(kPropVideoColorFormat, 
> colorFormat);
> +    }
> +
> +    if (SUCCEEDED(res)) 
> +    { 
> +        // Create Sink
> +        IHXTPreviewSink *pSink = new CVideoPreviewSink(
> +            kValueBeforeAllPrefilters,      /* previewposition */
> +            0,                              /* previewsinkcount */
> +            0,                              /* outputprofile */
> +            0,                              /* audience */
> +            kValueMediaFormatUncompVideo,   /* media format */
> +        	windowhandle,                   /* window */
> +            colorFormat,                    /* video format */
> +            width,                          /* width*/
> +            height                          /* height*/
> +            );
> +        pSink->AddRef();
> +
> +        // Add Sink
> +        pPreviewSinkControl->AddSink(pSink, pOptimalSettings);
> +        HX_RELEASE(pSink);
> +
> +        IHXTInputPreviewControl* pIHXTInputPreviewControl = NULL;
> +        res = QueryInterface(IID_IHXTInputPreviewControl, 
> (void**)&pIHXTInputPreviewControl);
> +        if(SUCCEEDED(res))
> +        {
> +            res = pIHXTInputPreviewControl->Open();
> +            HX_RELEASE(pIHXTInputPreviewControl);
> +        }
> +    }
> +
> +    HX_RELEASE(pOptimalSettings);
> +    HX_RELEASE(pPreviewSinkControl);
> +    HX_RELEASE(pClassFactory);
> +
> +    return res;
> +}
> +
> +/* 
>   *  Remove an input by index
>   */
>  HX_RESULT
> @@ -281,25 +378,3 @@
>      
>      return res;
>  }
> -
> -/* 
> - *  Opens a preview for this input
> - */
> -HX_RESULT
> -PyHxInput::OpenPreview()
> -{
> -    HX_RESULT res HXR_OK;
> -    
> -    // Get the configuration interface
> -    IHXTConfigurationAgent* pConfigurator = NULL;
> -    res = m_pUnknown->QueryInterface(IID_IHXTConfigurationAgent, 
> (void**)&pConfigurator);
> -    
> -    // set the value
> -    if (SUCCEEDED(res))
> -    {    
> -        //res = pConfigurator->SetInt(key, value);
> -    }
> -    HX_RELEASE(pConfigurator);
> -    
> -    return res;
> -}
> Index: hxinput.h
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/hxinput.h,v
> retrieving revision 1.1
> diff -u -w -r1.1 hxinput.h
> --- hxinput.h	24 Sep 2007 17:04:26 -0000	1.1
> +++ hxinput.h	9 Oct 2007 17:39:28 -0000
> @@ -78,11 +78,10 @@
>      UINT32      GetPrefilterCount();
>      HX_RESULT   MoveInput(UINT32 origin, UINT32 destination);
>      HX_RESULT   MovePrefilter(UINT32 origin, UINT32 destination);
> +    HX_RESULT   OpenVideoPreview(UINT32 width, UINT32 height, PyObject* 
> windowhandle, bool rawvideo);
>      HX_RESULT   RemoveInput(UINT32 index);
>      HX_RESULT   RemovePrefilter(UINT32 index);
>  
> -    HX_RESULT OpenPreview();
> -
>  };
>  
>  #endif
> Index: pyinput.cpp
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/pyinput.cpp,v
> retrieving revision 1.1
> diff -u -w -r1.1 pyinput.cpp
> --- pyinput.cpp	24 Sep 2007 17:04:26 -0000	1.1
> +++ pyinput.cpp	9 Oct 2007 17:39:29 -0000
> @@ -55,10 +55,10 @@
>  #include "pyinput.h"
>  #include "pyprefilter.h"
>  
> +//TODO remove after audio preview is moved to its proper place
>  #include "ihxtpreviewsink.h"
>  #include "samplepreviewsink.h"
>  
> -
>  /* module data */
>  static const char input_doc[] = "Helix Producer Input object.  this is a 
> generic class that can wrap any of the objects used in the job workflow";
>  
> @@ -70,6 +70,8 @@
>  static const char input_get_prefilter_count_doc[] = "Returns the count of 
> prefilters associated with this input";
>  static const char input_move_input_doc[] = "Moves an input from origin index 
> (integer) to destination index (integer)";
>  static const char input_move_prefilter_doc[] = "Moves a prefilter from origin 
> index (integer) to destination index (integer)";
> +static const char input_open_audio_preview_doc[] = "TODO: replace with real 
> value when this method is functional";
> +static const char input_open_video_preview_doc[] = "Opens a video preview for 
> this input.  expects height (int), width (int), window handle (long) [, and 
> raw video (bool)]";
>  static const char input_remove_input_doc[] = "Removes an input by index 
> (integer)";
>  static const char input_remove_prefilter_doc[] = "Remove a prefilter by index 
> (integer)";
>  
> @@ -329,91 +331,31 @@
>      PyObject *args
>  )
>  {    
> -    HX_RESULT res;
> -    
> -    IHXTClassFactory *classFactory = NULL;
> -    IHXTPropertyBag *optimalSettings = NULL;
> -    IHXTPreviewSinkControl *previewSinkControl = NULL;    
> -    
> -    res = 
> pyfilter->p_hxfilter->m_pUnknown->QueryInterface(IID_IHXTPreviewSinkControl, 
> (void**)&previewSinkControl);
> -    
> -    if (SUCCEEDED(res))
> -        res = core->QueryInterface(IID_IHXTClassFactory, 
> (void**)&classFactory);
> -    	
> -    //create property bag for settings
> -    if (SUCCEEDED(res))
> -        res = classFactory->CreateInstance(IID_IHXTPropertyBag, 
> (IUnknown**)&optimalSettings);
> -    
> -    //get optimal setttings
> -    if (SUCCEEDED(res)) {
> -        
> -        // set preview position
> -        
> -        // Set media format
> -        res = optimalSettings->SetString(kPropMediaFormat, 
> kValueMediaFormatUncompVideo);
> -        
> -        //if (SUCCEEDED(res))
> -        res = optimalSettings->SetUint(kPropPreviewSinkPosition, 
> kValueBeforeAllPrefilters);               
> -        
> -        res = previewSinkControl->GetOptimalSinkProperties(&optimalSettings);
> -    
> -    
> -    
> -    // set update interval (all updates)
> -    //if (SUCCEEDED(res))
> -        res = optimalSettings->SetInt(kPropSinkUpdateInterval, 
> kValueAllSamples);
> -    
> -    // set height
> -    //if (SUCCEEDED(res))
> -        //res = optimalSettings->SetUint(kPropVideoFrameWidth, 320);
> -    
> -    // set width
> -    //if (SUCCEEDED(res))
> -        //res = optimalSettings->SetUint(kPropVideoFrameHeight, 240);
> -    
> -    // set color format
> -    //if (SUCCEEDED(res))
> -        res = optimalSettings->SetUint(kPropVideoColorFormat, 
> HXT_VIDEO_FORMAT_BGRA32_NONINVERTED);
> -        //  res = optimalSettings->SetUint(kPropVideoColorFormat, 
> HXT_VIDEO_FORMAT_ARGB32_NONINVERTED);
> -    }
> -    
> -    if (SUCCEEDED(res)) 
> +    UINT32      width, height;
> +	PyObject    *site;
> +    PyObject    *rawinput;
> +    bool        raw = true;
> +	if (!PyArg_ParseTuple(args, "iiO|O", &width, &height, &site, &raw))
>      {
> -        UINT32 *width, *height, *colorFormat;
> -        
> -        optimalSettings->GetUint(kPropVideoFrameWidth, width),    /*width*/
> -        optimalSettings->GetUint(kPropVideoFrameHeight, height);   /*height*/
> -        optimalSettings->GetUint(kPropVideoColorFormat, 
> colorFormat);   /*height*/
> -        
> -        
> -        // Create Sink
> -        IHXTPreviewSink *sink = new CVideoPreviewSink(
> -            kValueBeforeAllPrefilters,      /* previewposition */
> -            0,      /* previewsinkcount */
> -            0,      /* outputprofile */
> -            0,      /* audience */
> -            kValueMediaFormatUncompVideo,   /*media format */
> -            *colorFormat, /*video format */
> -            320,    /*width*/
> -            240);   /*height*/
> -        sink->AddRef();
> -        
> -        // Add Sink              
> -        previewSinkControl->AddSink(sink, optimalSettings);
> +        PyErr_SetString(PyExc_ValueError, "open video preview expects 4 
> parameters (width, height, drawable, [raw_stream]) drawable should be window 
> handle or xid");
> +	    return NULL;
> +    }
>                  
> -        IHXTInputPreviewControl* pIHXTInputPreviewControl = NULL;
> -        res = 
> ((IHXTInput*)pyfilter->p_hxfilter->m_pUnknown)->QueryInterface(IID_IHXTInputPreviewControl, 
> (void**)&pIHXTInputPreviewControl);
> -        if(SUCCEEDED(res))
> +    if (rawinput == Py_False)
>          {
> -            res = pIHXTInputPreviewControl->Open();		    
> -            HX_RELEASE(pIHXTInputPreviewControl);
> -        }
> +        raw = false;
>      }
>      
> +	if (SUCCEEDED(((PyHxInput*)pyfilter->p_hxfilter)->OpenVideoPreview(width, 
> height, site, raw)))
> +    {
>      Py_INCREF(Py_None);
>      return Py_None;    
>  }
>  
> +    PyErr_SetString(PyExc_RuntimeError, "Error while opening preview");
> +    return NULL;
> +}
> +
>  static PyObject*
>  input_open_audio_preview
>  (
> @@ -511,9 +453,9 @@
>      (char *)input_move_prefilter_doc},
>      
>      {"openVideoPreview", (PyCFunction)input_open_video_preview, METH_VARARGS,
> -    (char *)input_remove_input_doc},
> +    (char *)input_open_video_preview_doc},
>      {"openAudioPreview", (PyCFunction)input_open_audio_preview, METH_VARARGS,
> -    (char *)input_remove_input_doc},
> +    (char *)input_open_audio_preview_doc},
>      
>      
>      {"removeInput", (PyCFunction)input_remove_input, METH_VARARGS,
> Index: samplepreviewsink.cpp
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/samplepreviewsink.cpp,v
> retrieving revision 1.1
> diff -u -w -r1.1 samplepreviewsink.cpp
> --- samplepreviewsink.cpp	24 Sep 2007 17:04:26 -0000	1.1
> +++ samplepreviewsink.cpp	9 Oct 2007 17:39:29 -0000
> @@ -265,6 +265,7 @@
>  		    INT32 nOutputProfile,
>  		    INT32 nAudience,
>  		    const char* szMediaFormat, 
> +			PyObject* site,
>  		    UINT32 nColorFormat,
>  		    UINT32 nVideoWidth,
>  		    UINT32 nVideoHeight)
> @@ -281,6 +282,8 @@
>      , m_pXLibPreview(NULL)
>  #endif
>  {
> +    m_Site = site;
> +	
>      char cVideoPreviewFileName[25];
>      _snprintf( cVideoPreviewFileName, 
> sizeof(cVideoPreviewFileName), "VideoPreview_%ld.txt",m_nFileNumber);
>      m_nFileNumber++;
> @@ -292,6 +295,7 @@
>  
>      if(strcmp(szMediaFormat, kValueMediaFormatUncompVideo) == 0)
>      {
> +	//TODO CLEAN THIS LOGIC UP
>  	if(TRUE || m_nColorFormat == HXT_VIDEO_FORMAT_BGR24_INVERTED || 
>  	    m_nColorFormat == HXT_VIDEO_FORMAT_BGR24_NONINVERTED)
>  	{
> @@ -306,7 +310,7 @@
>  	    m_pXLibPreview = new CXLibPreview();
>  	    if(m_pXLibPreview)
>  	    {
> -		m_pXLibPreview->CreatePreviewWindow(nPreviewIndex, nVideoWidth, 
> nVideoHeight);
> +		m_pXLibPreview->CreatePreviewWindow(nVideoWidth, nVideoHeight, m_Site);
>  	    }
>  #endif
>  	}
> @@ -367,7 +371,7 @@
>  	    m_pWinPreview->CreatePreviewWindow(m_nPreviewIndex, nVideoWidth, 
> nVideoHeight); 
>  #endif
>  #ifdef _LINUX
> -	    m_pXLibPreview->CreatePreviewWindow(m_nPreviewIndex, nVideoWidth, 
> nVideoHeight); 
> +	    m_pXLibPreview->CreatePreviewWindow(nVideoWidth, nVideoHeight, m_Site); 
>  #endif
>  	}
>  	else
> Index: samplepreviewsink.h
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/samplepreviewsink.h,v
> retrieving revision 1.1
> diff -u -w -r1.1 samplepreviewsink.h
> --- samplepreviewsink.h	24 Sep 2007 17:04:26 -0000	1.1
> +++ samplepreviewsink.h	9 Oct 2007 17:39:29 -0000
> @@ -148,14 +148,17 @@
>      : public CSamplePreviewSink
>  {
>  public:
> -    CVideoPreviewSink( UINT32 nPreviewPosition, 
> +    CVideoPreviewSink( 
> +            UINT32 nPreviewPosition, 
>  			UINT nPreviewIndex,
>  			INT32 nOutputProfile,
>  			INT32 nAudience,
>  			const char* szMediaFormat, 
> +			PyObject* site,
>  			UINT32 nColorFormat = HXT_VIDEO_FORMAT_BGR24_INVERTED,
>  			UINT32 nVideoWidth = 160,
> -			UINT32 nVideoHeight = 120 );    
> +			UINT32 nVideoHeight = 120
> +	);
>      ~CVideoPreviewSink();
>      
>      //	IHXTPreviewSink methods
> @@ -164,7 +167,7 @@
>      
>  private:
>      UINT32 m_nColorFormat;
> -    
> +    PyObject* m_Site;
>      static UINT32 m_nFileNumber;
>      FILE* m_pfVideoPreviewFile;
>  #ifdef _WINDOWS
> Index: xlibpreview.cpp
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/xlibpreview.cpp,v
> retrieving revision 1.1
> diff -u -w -r1.1 xlibpreview.cpp
> --- xlibpreview.cpp	24 Sep 2007 17:04:26 -0000	1.1
> +++ xlibpreview.cpp	9 Oct 2007 17:39:29 -0000
> @@ -49,10 +49,9 @@
>  CXLibPreview::CXLibPreview()
>  : m_window(NULL)
>  , m_graphicsContext(NULL)
> -, m_pDisplay(NULL)
>  , m_pVisual(NULL)
> -, m_nPreviewIndex(0)
>  {	
> +		
>  }   	
>  
>  ///////////////////////////////////////////////////////////////////////
> @@ -61,63 +60,54 @@
>      FreeWindow();
>  }
>  
> -///////////////////////////////////////////////////////////////////////
> -/*LRESULT CALLBACK 
> -CXLibPreview::WindowProc( HWND hwnd,      // handle to window
> -			UINT uMsg,      // message identifier
> -			WPARAM wParam,  // first message parameter
> -			LPARAM lParam   // second message parameter
> -			)
> -{
> -    CXLibPreview *pThis = (CXLibPreview *)::GetWindowLong(hwnd, 
> GWL_USERDATA);
> -    return DefWindowProc(hwnd, uMsg, wParam, lParam);
> -}*/
> -
>  
>  ///////////////////////////////////////////////////////////////////////
> -HX_RESULT CXLibPreview::CreatePreviewWindow(UINT32 nPreviewIndex, short 
> width, short height)
> +HX_RESULT CXLibPreview::CreatePreviewWindow(short width, short height, 
> PyObject* site)
>  {    
>      HX_RESULT res = HXR_OK;
>      
> +	m_Width = width;
> +	m_Height = height;
>      
>      Window rootwin;
> -        
>      Colormap cmap;
>      XEvent e;
>      int scr;
>   
> -    if(!(m_pDisplay=XOpenDisplay(NULL))) {
> +    if(!(m_xwindow.display = XOpenDisplay(NULL))) {
>              fprintf(stderr, "ERROR: could not open display\n");
>              exit(1);
>      }
>   
> -    scr = DefaultScreen(m_pDisplay);
> -    rootwin = RootWindow(m_pDisplay, scr);
> -    cmap = DefaultColormap(m_pDisplay, scr);
> +	m_xwindow.window = (void*)PyLong_AsLong(site);
>  
> -    m_window=XCreateSimpleWindow(m_pDisplay, rootwin, 1, 1, width, height, 0, 
> -                        BlackPixel(m_pDisplay, scr), BlackPixel(m_pDisplay, 
> scr));
> +	// now get all the window info    
> +    scr = DefaultScreen((Display*)m_xwindow.display);
> +    rootwin = RootWindow((Display*)m_xwindow.display, scr);
> +    cmap = DefaultColormap((Display*)m_xwindow.display, scr);
> +    m_window=XCreateSimpleWindow((Display*)m_xwindow.display, 
> (Window)m_xwindow.window, 0, 0, m_Width,m_Height, 0, 
> +                        BlackPixel((Display*)m_xwindow.display, scr), 
> BlackPixel(m_xwindow.display, scr));
>  
> -    XStoreName(m_pDisplay, m_window, "Video Preview");
> +    XStoreName((Display*)m_xwindow.display, m_window, "Video Preview");
>   
> -    m_graphicsContext=XCreateGC(m_pDisplay, m_window, 0, NULL);
> +    m_graphicsContext=XCreateGC((Display*)m_xwindow.display, m_window, 0, 
> NULL);
>      //XSetForeground(m_pDisplay, m_graphicsContext, WhitePixel(m_pDisplay, 
> scr));
>      
>      //Get X window attributes & visual
>      XWindowAttributes attr;
> -    XGetWindowAttributes(m_pDisplay, m_window, &attr);    
> +    XGetWindowAttributes((Display*)m_xwindow.display, m_window, &attr);
>      m_pVisual = attr.visual;
>   
> -    XSelectInput(m_pDisplay, m_window, ExposureMask|ButtonPressMask);
> +    XSelectInput((Display*)m_xwindow.display, m_window, ExposureMask|
> ButtonPressMask);
>   
>      
> -    XSelectInput( m_pDisplay, m_window, ExposureMask );
> +    XSelectInput( (Display*)m_xwindow.display, m_window, ExposureMask );
>      
>      
> -    XMapWindow(m_pDisplay, m_window);
> +    XMapWindow((Display*)m_xwindow.display, m_window);
>   
> -    //get event to force window draw
> -    XPeekEvent(m_pDisplay, &e);
> +    //peek event to force window draw
> +    XPeekEvent((Display*)m_xwindow.display, &e);
>      
>      return res;
>  }
> @@ -128,20 +118,20 @@
>      
>      if (m_graphicsContext)
>      {        
> -        XFreeGC(m_pDisplay, m_graphicsContext);
> +        XFreeGC((Display*)m_xwindow.display, m_graphicsContext);
>          m_graphicsContext = NULL;
>      }
>          
>      if (m_window)
>      {
> -        XDestroyWindow(m_pDisplay, m_window);       
> +        XDestroyWindow((Display*)m_xwindow.display, m_window);
>  	    m_window = NULL;
>      }
>          
> -    if (m_pDisplay) 
> +    if (m_xwindow.display) 
>      {       
> -        XCloseDisplay(m_pDisplay);
> -        m_pDisplay = NULL;
> +        XCloseDisplay((Display*)m_xwindow.display);
> +        m_xwindow.display = NULL;
>      }
>      
>  }
> @@ -149,28 +139,28 @@
>  ///////////////////////////////////////////////////////////////////////
>  void CXLibPreview::DrawVideo(const UCHAR* pBuffer, UINT32 size)
>  {
> -    XLockDisplay(m_pDisplay);
> +    XLockDisplay((Display*)m_xwindow.display);
>      if (m_ximage)
>      {
>          //XDestroyImage(m_ximage);
>      }
>          
>      m_ximage = XCreateImage(
> -        m_pDisplay, 
> +        (Display*)m_xwindow.display, 
>          m_pVisual, 
>          24,          /*depth*/
>          ZPixmap, 
>          0,          /*offset*/
>          (char*)pBuffer, 
> -        320,        /* width */
> -        240,        /* height */
> +        m_Width,        /* width */
> +        m_Height,        /* height */
>          32,          /* bitmap pad */ 
>          0);         /* bytes per line */
>      
> -    XUnlockDisplay(m_pDisplay);
> +    XUnlockDisplay((Display*)m_xwindow.display);
>      
> -    XLockDisplay(m_pDisplay);
> -    XPutImage(m_pDisplay,
> +    XLockDisplay((Display*)m_xwindow.display);
> +    XPutImage((Display*)m_xwindow.display,
>                  m_window,
>                  m_graphicsContext,
>                  m_ximage,
> @@ -178,10 +168,8 @@
>                  0,      /* src y (top edge) */
>                  0,      /* dest offset x */
>                  0,      /* dest offset y */  
> -                320,    /* width */
> -                240);   /* height */
> +                m_Width,    /* width */
> +                m_Height);   /* height */
>      
> -    XUnlockDisplay(m_pDisplay);
> -    //XEvent e;
> -    //XNextEvent(m_pDisplay, &e);   
> +    XUnlockDisplay((Display*)m_xwindow.display);
>  }
> Index: xlibpreview.h
> ===================================================================
> RCS file: /cvsroot/player/kit/python/hxrecord/xlibpreview.h,v
> retrieving revision 1.1
> diff -u -w -r1.1 xlibpreview.h
> --- xlibpreview.h	24 Sep 2007 17:04:26 -0000	1.1
> +++ xlibpreview.h	9 Oct 2007 17:39:29 -0000
> @@ -41,6 +41,8 @@
>  
>  #include "hxcom.h"
>  #include "hxresult.h"
> +#include "Python.h"
> +#include "hxwintyp.h"
>  
>  #include<X11/Xlib.h>
>  
> @@ -50,39 +52,28 @@
>  #define	_XLIB_PREVIEW_H_
>  
>  
> -
> -
>  class CXLibPreview
>  {
>  public:
>      CXLibPreview();
>      virtual ~CXLibPreview(void);
>      
> -    HX_RESULT CreatePreviewWindow(UINT32 nPreviewIndex, short width, short 
> height);
> +    HX_RESULT CreatePreviewWindow(short width, short height, PyObject* site);
>      void FreeWindow(void);
>      
>      void DrawVideo(const UCHAR* buffer, UINT32 size);
>      
>  protected:
>      
> -    // this is the function that is registered with windows.  When we create
> -    // an HWND of the CXLibPreview class, we set the window long to identify
> -    // the CXLibPreview instance.  Then, this function can pull the value
> -    // and call the CTWinCallback_Callback() function on the owner.
> -    //static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, 
> LPARAM lParam);
> -    
> -    //HWND m_hWnd;
> -    //HDRAWDIB m_hDrawDib;
> -    //HDC m_hDC;
> -    //RECT m_rectClient;
>      //BITMAPINFOHEADER m_bi;
>  
>      Window  m_window;
>      GC      m_graphicsContext;
> -    Display *m_pDisplay;
>      Visual  *m_pVisual;
>      XImage  *m_ximage;
> -    UINT32 m_nPreviewIndex;
> +	short   	m_Height;
> +	short   	m_Width;
> +	HXxWindow 	m_xwindow;
>      
>      static UINT32 zm_nWindowCount;
>  };              
> 
> _______________________________________________
> Player-dev mailing list
> Player-dev@helixcommunity.org
> http://lists.helixcommunity.org/mailman/listinfo/player-dev


_______________________________________________
Player-dev mailing list
Player-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/player-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic