Hallo,

ich hab folgendes Problem:

Für ein Projekt bastel ich mir einen SampleGrabber mit der DirectShowLib Version 2. Jetzt will ich dem Samplegrabber die Auflösung mitteilen, was aber nicht geht, ich mach das so:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[SIZE=2][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] hr;[/SIZE]
[SIZE=2][COLOR=#2b91af]AMMediaType[/COLOR][/SIZE][SIZE=2] media = [/SIZE][SIZE=2][COLOR=#0000ff]new [/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]AMMediaType[/COLOR][/SIZE][SIZE=2]();[/SIZE]
[SIZE=2]hr = sampleGrabber.GetConnectedMediaType(media);[/SIZE]
[SIZE=2][COLOR=#2b91af]DsError[/COLOR][/SIZE][SIZE=2].ThrowExceptionForHR(hr);[/SIZE]
[SIZE=2][COLOR=#2b91af]VideoInfoHeader[/COLOR][/SIZE][SIZE=2] videoInfoHeader = ([/SIZE][SIZE=2][COLOR=#2b91af]VideoInfoHeader[/COLOR][/SIZE][SIZE=2])[/SIZE][SIZE=2][COLOR=#2b91af]Marshal[/COLOR][/SIZE][SIZE=2].PtrToStructure(media.formatPtr, [/SIZE][SIZE=2][COLOR=#0000ff]typeof[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2b91af]VideoInfoHeader[/COLOR][/SIZE][SIZE=2]));[/SIZE]
[SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][SIZE=2] == videoInfoHeader) {[/SIZE]
[SIZE=2][COLOR=#2b91af]  Program[/COLOR][/SIZE][SIZE=2].error([/SIZE][SIZE=2][COLOR=#a31515]"VideoInfoHeader is NULL"[/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000ff]  return[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]videoInfoHeader.BmiHeader.Width = 320;[/SIZE]
[SIZE=2]videoInfoHeader.BmiHeader.Height = 240;[/SIZE]
[SIZE=2][COLOR=#2b91af]Marshal[/COLOR][/SIZE][SIZE=2].StructureToPtr(videoInfoHeader, media.formatPtr, [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]hr = sampleGrabber.SetMediaType(media);[/SIZE]
[SIZE=2][COLOR=#2b91af]DsError[/COLOR][/SIZE][SIZE=2].ThrowExceptionForHR(hr);[/SIZE]
[SIZE=2][COLOR=#2b91af]DsUtils[/COLOR][/SIZE][SIZE=2].FreeAMMediaType(media);[/SIZE]
[SIZE=2]media = [/SIZE][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][SIZE=2];[/SIZE]
[/SIZE]

Dummerweise geht das so nicht, die Auflösung bleibt immer Standard: 800x600.
Kein Fehler kein nix - Weiß jemand warum das nicht geht?