다음을 통해 공유


Networked Media Device Best Practices (Windows Embedded CE 6.0)

1/5/2010

The following sections describe tips and tricks to help you develop a Networked Media Device (NDM).

Playing Rented Video Content

To playback video content from http://www.movielink.com on a networked media device

  1. Using Microsoft Windows Media Connect (WMC), share the folder that contains the content from http://www.movielink.com.

    The folder location is typically C:\Program Files\Movielink\MovielinkManager\Data\Content.

  2. After you download the rented movie, clear the hidden file attribute to allow the file to be accessible to the NMD.

    All rented content from http://www.movielink.com sets the hidden attribute.

Storing Frequently Used Bitmaps in Video Memory

To avoid a color-conversion on every blit, do not use device-independent bitmap (DIB) sections that are not the same format as the primary. The call to the SHLoadDIBitmap function in the following code example results in a bitmap that is 24 bpp and that is stored in system memory. Because the device is running at 32 bpp, every time the BitBlt function is called, a color-conversion takes place. There may be instances where the hardware cannot perform a system-to-video blit, so even if the bitmap was in the correct format, the display hardware would not draw the bitmap. The following code example does not store frequently used bitmaps in video memory.

// To load the bitmap
HBITMAP hbmBitmap = SHLoadDIBitmap("sample.bmp");

// To draw the bitmap
HDC hdcMem = CreateCompatibleDC( hdcMain );
HGDIOBJ hobjMem = SelectObject(hdcMem, hbmBitmap);
BitBlt( hdcMain, ..., hdcMem, ..., SRCCOPY);
SelectObject( hdcMem, hobjMem );
DeleteDC( hdcMem );

The following code example results in a color conversion blit that happens at bitmap load time to get the bitmap in the same format as the primary. The following code example stores the bitmap in video memory, so it can be drawn using hardware acceleration. One drawback to the following code example is that it uses video memory.

// To load the bitmap
HBITMAP hbmBitmap = SHLoadDIBitmap("sample.bmp");
HDC hdcCompat = CreateCompatibleDC( hdcMain );
HDC hdcMem = CreateCompatibleDC( hdcMain );
BITMAP Bitmap = { 0 };
GetObject( hbmBitmap, sizeof ( Bitmap ), &Bitmap );
int Width = Bitmap.bmWidth;
int Height = Bitmap.bmHeight;
HBITMAP hbmCompat = CreateCompatibleBitmap( hdcMain, Width, Height );
HGDIOBJ hobjMem = SelectObject( hdcMem, hbmBitmap );
HGDIOBJ hobjCompat = SelectObject( hdcCompat, hbmCompat );
BitBlt( hdcCompat, 0, 0, Width, Height, hdcMem, 0, 0, SRCCOPY );
SelectObject( hdcMem, hobjMem );
SelectObject( hdcCompat, hobjCompat );
DeleteDC( hdcCompat );
DeleteDC( hdcMem );
DeleteObject( hbmBitmap );

// To draw the bitmap
HDC hdcMem = CreateCompatibleDC( hdcMain );
HGDIOBJ hobjMem = SelectObject( hdcMem, hbmCompat );
BitBlt( hdcMain, ..., hdcMem, ..., SRCCOPY );
SelectObject( hdcMem, hobjMem );
DeleteDC( hdcMem );

See Also

Other Resources

Developing a Networked Media Device