Форум: "Media";
Текущий архив: 2006.02.12;
Скачать: [xml.tar.bz2];
Внизразрешение видеозахвата Найти похожие ветки
← →
jakata (2005-06-14 12:28) [0]Для изменения разрешения использую интерфейс IAMStreamConfig.
hr := ResolutionInterface.GetNumberOfCapabilities (piCount,piSize);
for i := 0 to piCount - 1 do
begin
hr := ResolutionInterface.GetStreamCaps(i, pmt, pSCC);
if IsEqualGUID(pmt.majortype, MEDIATYPE_Video) then
begin
if IsEqualGUID(pmt.subtype, MEDIASUBTYPE_RGB24) then
// тут мне нужно получить список разрешений для RGB24!
end
end;
Откуда брать разрешение? И в каком формате оно хранится? Из документации я мало что поняла.
В pmt ничего размерного нет. В pSCC всякие размеры хранятся. Какие именно мне брать? И главное, в какое поле pmt мне потом их положить, когда SetFormat буду делать?
← →
jakata (2005-06-14 12:37) [1]MinOutputSize, MaxOutputSize, а также InputSize выдают фигню какую-то, проверяю vfw-диалогами, неправильные это всё разрешения.
Откуда брать правильные?=(
← →
Анонимщик1 (2005-06-21 15:23) [2]
uses
DirectShow9 // ICreateDevEnum
,ActiveX // IEnumMoniker, FAILED, SUCCEEDED
,DSUtil; // IID_IPropertyBag
type
TVideoTypeRec = record
MediaTypeGUID: TGUID;
Description : String;
end;
var
VideoTypes: array[0..79] of TVideoTypeRec;
pDevEnum: ICreateDevEnum = nil;
pMonEnum: IEnumMoniker = nil;
procedure InitVideoSubTypes;
var
i: Integer;
begin
for i := Low(VideoTypes) to High(VideoTypes) do
begin
case i of
// Analog Video Subtypes
0: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_NTSC_M;
VideoTypes[i].Description := "(M) NSTC";
end;
1: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_B;
VideoTypes[i].Description := "(B) PAL";
end;
2: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_D;
VideoTypes[i].Description := "(D) PAL";
end;
3: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_G;
VideoTypes[i].Description := "(G) PAL";
end;
4: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_H;
VideoTypes[i].Description := "(H) PAL";
end;
5: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_I;
VideoTypes[i].Description := "(I) PAL";
end;
6: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_M;
VideoTypes[i].Description := "(M) PAL";
end;
7: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_PAL_N;
VideoTypes[i].Description := "(N) PAL";
end;
8: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_B;
VideoTypes[i].Description := "(B) SECAM";
end;
9: begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_D;
VideoTypes[i].Description := "(D) SECAM";
end;
10:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_G;
VideoTypes[i].Description := "(G) SECAM";
end;
11:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_H;
VideoTypes[i].Description := "(H) SECAM";
end;
12:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_K;
VideoTypes[i].Description := "(K) SECAM";
end;
13:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_K1;
VideoTypes[i].Description := "(K1) SECAM";
end;
14:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AnalogVideo_SECAM_L;
VideoTypes[i].Description := "(L) SECAM";
end;
// DirectX Video Acceleration Video Subtypes
15:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AI44;
VideoTypes[i].Description := "For subpicture and text overlay";
end;
16:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_IA44;
VideoTypes[i].Description := "For subpicture and text overlay";
end;
// DV Video Subtypes
17:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dvsl;
VideoTypes[i].Description := "SD-DVCR 525-60 or SD-DVCR 625-50";
end;
18:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dvsd;
VideoTypes[i].Description := "SDL-DVCR 525-60 or SDL-DVCR 625-50";
end;
19:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dvhd;
VideoTypes[i].Description := "HD-DVCR 1125-60 or HD-DVCR 1250-50";
end;
20:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dv25;
VideoTypes[i].Description := "25 Mbps DVCPRO 25 (525-60 or 625-50)";
end;
21:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dv50;
VideoTypes[i].Description := "DVCPRO 50 (525-60 or 625-50)";
end;
22:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_dvh1;
VideoTypes[i].Description := "DVCPRO 100 (1080/60i, 1080/50i, or 720/60P)";
end;
23:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_DVCS;
VideoTypes[i].Description := "MEDIASUBTYPE_DVCS";
end;
24:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_DVSD;
VideoTypes[i].Description := "MEDIASUBTYPE_DVSD";
end;
// Uncompressed RGB Video Subtypes
25:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB1;
VideoTypes[i].Description := "RGB, 1 bit per pixel (bpp), palettized";
end;
26:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB4;
VideoTypes[i].Description := "RGB, 4 bpp, palettized";
end;
27:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB8;
VideoTypes[i].Description := "RGB, 8 bpp";
end;
28:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB555;
VideoTypes[i].Description := "RGB 555, 16 bpp";
end;
29:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB565;
VideoTypes[i].Description := "RGB 565, 16 bpp";
end;
30:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB24;
VideoTypes[i].Description := "RGB, 24 bpp";
end;
31:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB32;
VideoTypes[i].Description := "RGB, 32 bpp";
end;
32:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB1555;
VideoTypes[i].Description := "RGB 555 with alpha channel";
end;
33:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB32;
VideoTypes[i].Description := "RGB 32 with alpha channel";
end;
34:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB4444;
VideoTypes[i].Description := "16-bit RGB with alpha channel; 4 bits per channel";
end;
← →
Анонимщик1 (2005-06-21 15:24) [3]
35:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_A2R10G10B10;
VideoTypes[i].Description := "32-bit RGB with alpha channel; 10 bits per RGB channel plus 2 bits for alpha";
end;
36:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_A2B10G10R10;
VideoTypes[i].Description := "32-bit RGB with alpha channel; 10 bits per RGB channel plus 2 bits for alpha";
end;
// Video Mixing Renderer Video Subtypes
37:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB32_D3D_DX7_RT;
VideoTypes[i].Description := "32-bit RGB render target";
end;
38:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB16_D3D_DX7_RT;
VideoTypes[i].Description := "16-bit RGB render target";
end;
39:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB32_D3D_DX7_RT;
VideoTypes[i].Description := "32-bit ARGB render target";
end;
40:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB4444_D3D_DX7_RT;
VideoTypes[i].Description := "ARGB4444 render target. For subpicture graphics";
end;
41:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB1555_D3D_DX7_RT;
VideoTypes[i].Description := "ARGB1555 render target. For subpicture graphics";
end;
42:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB32_D3D_DX9_RT;
VideoTypes[i].Description := "32-bit RGB render target";
end;
43:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_RGB16_D3D_DX9_RT;
VideoTypes[i].Description := "16-bit RGB render target";
end;
44:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB32_D3D_DX9_RT;
VideoTypes[i].Description := "32-bit ARGB render target";
end;
45:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB4444_D3D_DX9_RT;
VideoTypes[i].Description := "ARGB4444 render target. For subpicture graphics";
end;
46:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_ARGB1555_D3D_DX9_RT;
VideoTypes[i].Description := "ARGB1555 render target. For subpicture graphics";
end;
// YUV Video Subtypes
47:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_AYUV;
VideoTypes[i].Description := "4:4:4 YUV format";
end;
48:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_UYVY;
VideoTypes[i].Description := "UYVY (packed 4:2:2)";
end;
49:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_Y411;
VideoTypes[i].Description := "Same as Y41P";
end;
50:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_Y41P;
VideoTypes[i].Description := "Y41P (packed 4:1:1)";
end;
51:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_Y211;
VideoTypes[i].Description := "Y211";
end;
52:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_YUY2;
VideoTypes[i].Description := "YUY2 (packed 4:2:2)";
end;
53:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_YVYU;
VideoTypes[i].Description := "YVYU (packed 4:2:2)";
end;
54:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_YUYV;
VideoTypes[i].Description := "Same as YUY2. (Used by Canopus; FOURCC ""YUYV"")";
end;
55:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_IF09;
VideoTypes[i].Description := "Indeo YVU9";
end;
56:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_IYUV;
VideoTypes[i].Description := "IYUV";
end;
57:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_YV12;
VideoTypes[i].Description := "YV12";
end;
58:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_YVU9;
VideoTypes[i].Description := "YVU9";
end;
// Miscellaneous Video Subtypes
59:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_CFCC;
VideoTypes[i].Description := "MJPG format produced by some cards. (FOURCC ""CFCC"")";
end;
end;
← →
Анонимщик1 (2005-06-21 15:24) [4]
60:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_CLJR;
VideoTypes[i].Description := "Cirrus Logic CLJR format. (FOURCC ""CLJR"")";
end;
61:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_CPLA;
VideoTypes[i].Description := "Cinepak UYVY format. (FOURCC ""CPLA"")";
end;
62:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_CLPL;
VideoTypes[i].Description := "A YUV format supported by some Cirrus Logic drivers. (FOURCC ""CLPL"")";
end;
63:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_IJPG;
VideoTypes[i].Description := "Intergraph JPEG format. (FOURCC ""IJPG"")";
end;
64:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_MDVF;
VideoTypes[i].Description := "A DV encoding format. (FOURCC ""MDVF"")";
end;
65:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_MJPG;
VideoTypes[i].Description := "Motion JPEG (MJPG) compressed video. (FOURCC ""MJPG"")";
end;
66:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_MPEG1Packet;
VideoTypes[i].Description := "MPEG1 Video Packet";
end;
67:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_MPEG1Payload;
VideoTypes[i].Description := "MPEG1 Video Payload";
end;
68:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_Overlay;
VideoTypes[i].Description := "Video delivered using hardware overlay";
end;
69:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_Plum;
VideoTypes[i].Description := "Plum MJPG format. (FOURCC ""Plum"")";
end;
70:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_QTJpeg;
VideoTypes[i].Description := "QuickTime JPEG compressed data";
end;
71:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_QTMovie;
VideoTypes[i].Description := "Apple® QuickTime® compression";
end;
72:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_QTRle;
VideoTypes[i].Description := "QuickTime RLE compressed data";
end;
73:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_QTRpza;
VideoTypes[i].Description := "QuickTime RPZA compressed data";
end;
74:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_QTSmc;
VideoTypes[i].Description := "QuickTime SMC compressed data";
end;
75:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_TVMJ;
VideoTypes[i].Description := "TrueVision MJPG format. (FOURCC ""TVMJ"")";
end;
76:begin
// â MSDN åñòü, à â çàãîëîâî÷íûõ ôàéëàõ îòñóòñòâóåò
VideoTypes[i].MediaTypeGUID := GUID_NULL;//MEDIASUBTYPE_VideoPort;
VideoTypes[i].Description := "GUID NULL";//"Video port data, used with DVD";
end;
77:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_VPVBI;
VideoTypes[i].Description := "Video port vertical blanking interval (VBI) data";
end;
78:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_VPVideo;
VideoTypes[i].Description := "Video port video data";
end;
79:begin
VideoTypes[i].MediaTypeGUID := MEDIASUBTYPE_WAKE;
VideoTypes[i].Description := "MJPG format produced by some cards. (FOURCC ""WAKE"")";
end;
end;
end;
end;
← →
Анонимщик1 (2005-06-21 15:27) [5]Имеем в виду, что у нас на форме три лист - бокса: Capture_LB (список устройств захвата), Contacts_LB (списко исходящих видеоконтактов выделенного устройства захвата) и Formats_LB (список поддерживаемых форматов выделенного контакта).
Продолжаем:function GetStringDescriptionForVideoSubtype(const currentVideoSubType: TGUID): String;
var
i: Integer;
begin
Result := "type not found";
for i := Low(VideoTypes) to High(VideoTypes) do begin
if IsEqualGUID(currentVideoSubType, VideoTypes[i].MediaTypeGUID) then
begin
Result := VideoTypes[i].Description;
exit;
end;
end;
end;
procedure TForm1.ClearContacts;
var
i: Integer;
begin
for i := 0 to Contacts_LB.Count - 1 do IMoniker(Pointer(Contacts_LB.Items.Objects[i]))._Release;
Contacts_LB.Clear;
end;
procedure TForm1.ClearFormats;
var
i: Integer;
begin
Formats_LB.Clear;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
hr: HRESULT;
pMoniker: IMoniker;
pPropBag: IPropertyBag;
oleVar : OleVariant;
begin
// ïîëó÷àåì ñïèñîê ôèëüòðîâ âèäåîçàõâàòà
// Ñòàòüÿ â DirectShow->Using Direct Show->Video Capture->Selecting a Capture Device
InitVideoSubTypes;
// èíèöèàëèçàöèÿ ïåðåìåííûõ
hr := 0;
pMoniker := nil;
pPropBag := nil;
oleVar := "";
// ñíà÷àëà ñîçäàåì ïåðå÷èñëèòåëü ñèñòåìíûõ óñòðîéñòâ
hr := CoCreateInstance(CLSID_SystemDeviceEnum, nil, CLSCTX_INPROC_SERVER,
IID_ICreateDevEnum, pDevEnum);
if FAILED(hr) then raise Exception.Create("Íå óäàåòñÿ ïîëó÷èòü ICreateDevEnum");
// òåïåðü ñîçäàåì ïåðå÷èñëèòåëü äëÿ óñòðîéñòâ âèäåîââîäà
hr := pDevEnum.CreateClassEnumerator(CLSID_VideoInputDeviceCategory, pMonEnum, 0);
if FAILED(hr) then raise Exception.Create("Íå óäàåòñÿ ïîëó÷èòü IEnumMoniker");
// òåïåðü ïåðå÷èñëÿåì âñå óñòðîéñòâà
while pMonEnum.Next(1, pMoniker, nil) = S_OK do begin
hr := pMoniker.BindToStorage(nil, nil, IID_IPropertyBag, pPropBag);
if FAILED(hr) then continue; // ïðîñòî ïîéäåì äàëüøå
// Âîçüìåì îïèñàíèå è äðóæåñòâåííîå èìÿ
hr := pPropBag.Read("Description", oleVar, nil);
if FAILED(hr) then hr := pPropBag.Read("FriendlyName", oleVar, nil);
if SUCCEEDED(hr) then begin // äîáàâèì â ñïèñîê
pMoniker._AddRef;
Capture_LB.AddItem(oleVar, TObject(pMoniker));
end;
end;
end;
← →
Анонимщик1 (2005-06-21 15:29) [6]Пардон за зяблики в комментариях - но они не так и важны.
Последняя часть:procedure TForm1.Capture_LBClick(Sender: TObject);
var
hr : HRESULT;
pCapt : IBaseFilter;
pMoniker : IMoniker;
pEnumPins : IEnumPins;
pPin : IPin;
pinDirection: PIN_DIRECTION;
pinInfo : PIN_INFO;
i : Integer;
currName : String;
pStreamConfig: IAMStreamConfig;
countCap, sizeCap: Integer;
iFormat: Integer;
pMt: PAMMediaType;
scc: VIDEO_STREAM_CONFIG_CAPS;
begin
// âûâîäèì âñå êîíòàêòû âûäåëåííîãî ôèëüòðà
// èíèöèàëèçèðóåì ïåðåìåííûå, åñëè íóæíî
if Capture_LB.ItemIndex < 0 then exit;
hr := 0;
pCapt := nil;
pMoniker := nil;
pEnumPins := nil;
pPin := nil;
pStreamConfig := nil;
ClearContacts;
ClearFormats;
// ïîëó÷àåì ìîíèêåð
pMoniker := IMoniker(Pointer(Capture_LB.Items.Objects[Capture_LB.ItemIndex]));
if pMoniker = nil then exit;
hr := pMoniker.BindToObject(nil, nil, IID_IBaseFilter, pCapt);
if FAILED(hr) then raise Exception.Create("Íå ìîãó ïîëó÷èòü IBaseFilter");
// òåïåðü ïîëó÷èì âñå èñõîäÿùèå êîíòàêòû ôèëüòðà
// Ñòàòüÿ â DirectShow->Using Direct Show->Basic Direct Show Tasks->
// Enumerating Objects in a Filter Graph->EnumeratingPins
hr := pCapt.EnumPins(pEnumPins);
if FAILED(hr) then Exception.Create("Íå ìîãó ïîëó÷èòü IEnumPins");
while pEnumPins.Next(1, pPin, 0) = S_OK do begin
hr := pPin.QueryDirection(pinDirection);
if FAILED(hr) then Exception.Create("Íå ìîãó ïîëó÷èòü PIN_DIRECTION");
if pinDirection = PINDIR_OUTPUT then begin // äîáàâëÿåì â ñïèñîê
hr := pPin.QueryPinInfo(pinInfo);
// ïîëó÷èì òàêæå èíòåðôåéñ êîíôèãóðèðîâàíèÿ
hr := pPin.QueryInterface(IID_IAMStreamConfig, pStreamConfig);
if FAILED(hr) then ShowMessage("Íå ìîãó ïîëó÷èòü èíòåðôåéñ êîíôèãóðèðîâàíèÿ") else begin
countCap := 0;
sizeCap := 0;
hr := pStreamConfig.GetNumberOfCapabilities(countCap, sizeCap);
if SUCCEEDED(hr) then begin
if sizeCap = sizeof(VIDEO_STREAM_CONFIG_CAPS) then begin
for iFormat := 0 to countCap - 1 do begin
hr := pStreamConfig.GetStreamCaps(iFormat, pMt, scc);
// íî îíî íàì è íå íàäî
DeleteMediaType(pMt);
end;
end;
end;
end;
if FAILED(hr) then Exception.Create("Íå ìîãó ïîëó÷èòü PinInfo");
currName := "";
for i := 0 to 127 do begin
if pinInfo.achName[i] = #0 then break;
currName := currName + pinInfo.achName[i];
end;
pPin._AddRef;
Contacts_LB.Items.AddObject(currName, TObject(pPin));
end;
end;
end;
procedure TForm1.Contacts_LBClick(Sender: TObject);
var
hr : HRESULT;
pPin : IPin;
pEnumMT: IEnumMediaTypes;
pMt : PAMMediaType;
subTypeStr: String;
width, height: LongInt;
begin
// ïîêàçûâàåì èíôîðìàöèþ î ïîääåðæèâàåìûõ ðàçðåøåíèÿõ è ôîðìàòàõ
if Contacts_LB.ItemIndex < 0 then exit;
// î÷èùàåì ïðåäûäóùèå ôîðìàòû
ClearFormats;
// èíèöèàëèçèðóåì ëîêàëüíûå ïåðåìåííûå
hr := 0;
pPin := nil;
pEnumMT := nil;
width := 0;
height := 0;
// ïîëó÷àåì óêàçàòåëü íà èíòåðôåéñ
pPin := IPin(Pointer(Contacts_LB.Items.Objects[Contacts_LB.ItemIndex]));
if pPin = nil then exit;
hr := pPin.EnumMediaTypes(pEnumMT);
if FAILED(hr) then Exception.Create("Íå ìîãó ïîëó÷èòü _PinInfo");
while pEnumMT.Next(1, pMt, nil) = S_OK do begin
if IsEqualGUID(pMt.majortype, MEDIATYPE_Video) then begin // èíòåðåñóþò òîëüêî âèäåî-òèïû
subTypeStr := GetStringDescriptionForVideoSubtype(pMT.subtype);
if IsEqualGUID(pMt.formattype, FORMAT_MPEG2Video) then begin
if pMt.cbFormat = SizeOf(MPEG2VIDEOINFO) then begin
width := MPEG2VIDEOINFO(pMt.pbFormat^).hdr.bmiHeader.biWidth;
height:= MPEG2VIDEOINFO(pMt.pbFormat^).hdr.bmiHeader.biHeight;
end;
end;
if IsEqualGUID(pMt.formattype, FORMAT_VideoInfo) then begin
if pMt.cbFormat = SizeOf(VIDEOINFOHEADER) then begin
width := VIDEOINFOHEADER(pMt.pbFormat^).bmiHeader.biWidth;
height:= VIDEOINFOHEADER(pMt.pbFormat^).bmiHeader.biHeight;
end;
end;
if IsEqualGUID(pMt.formattype, FORMAT_VideoInfo2) then begin
if pMt.cbFormat = SizeOf(VIDEOINFOHEADER2) then begin
width := VIDEOINFOHEADER2(pMt.pbFormat^).bmiHeader.biWidth;
height:= VIDEOINFOHEADER2(pMt.pbFormat^).bmiHeader.biHeight;
end;
end;
DeleteMediaType(pmt);
subTypeStr := subTypeStr + "; " + IntToStr(width) + " x " + IntToStr(height);
Formats_LB.Items.Add(subTypeStr);
end;
end;
end;
← →
Анонимщик1 (2005-06-21 15:29) [7]Это все
← →
palgen © (2005-09-02 10:20) [8]С помощью этого кода можно узнать информацию только поддерживаемых разрешений ? или нет ? и каким образом можно применить выбранное разрешение к обьекту ?
← →
palgen © (2005-09-02 10:22) [9]Если кто-нибудь знает скиньте плиз на palgenngtu@rambler.ru
Страницы: 1 вся ветка
Форум: "Media";
Текущий архив: 2006.02.12;
Скачать: [xml.tar.bz2];
Память: 0.55 MB
Время: 0.04 c