Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   FVideoImage.SetResolutionByIndex (https://www.delphipraxis.net/207230-fvideoimage-setresolutionbyindex.html)

holger_barntrup 5. Mär 2021 09:41


FVideoImage.SetResolutionByIndex
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo in die Runde

Ich brauche mal eure Hilfe, suche seit gestern schon den Fehler und komme nicht darauf.
Hier wird ein Videostream gestartet und dann soll eine voreingestellte Auflösung eingestellt werden.
Das funktioniert auch alles solange das 'Showmessage' drin steht, kommentiere ich das aus, dann hängt das Programm sich auf.
Ich hab vermutlich schon so die Scheuklappen auf das ich nicht drauf komme.

Ich hab mal das Projekt als zip angehängt

Delphi-Quellcode:
procedure TForm1.BitBtn_StartClick(Sender: TObject);

Var euh : tstringlist;
  I, J: Integer;
  S: string;
  Resolution: TStringBuilder;
  ResIndex: Integer;
  ResolutionList: TStringList;

const
ALLOWED_CHARS = ['0' .. '9', '*']; // Only numbers and the *

begin
  Screen.Cursor := crHourGlass;
  BitBtn_Start.Enabled := false;
  Application.ProcessMessages;
  fVideoImage.VideoStart(ComboBox1.Items[ComboBox1.itemindex]);
  ResolutionList := TStringList.Create;
  FVideoImage.GetListOfSupportedVideoSizes(ResolutionList);

  Resolution := TStringBuilder.Create;
  ResIndex := 0; // If none is found, 0 will be used as default

  // Iterate through all the resolutions
  for I := 0 to ResolutionList.Count - 1 do
  begin
    S := ResolutionList[I]; // Store each resolution in a string
    Resolution.Clear;      // Clear previous resolutions // Iterate through all the chars from current resolution
  for J := 0 to Length(S) do
  begin
  // Add each char to Resolution var in case they are valid ones
  if S[J] in ALLOWED_CHARS then
    Resolution.Append(S[J]);
  end; // Now Resolution has only valid chars, check it this is the ideal
  //if Resolution.ToString = '1280*720' then
  //if Resolution.ToString = '640*480' then

  if Resolution.ToString = edit1.text then
    begin
      ResIndex := I; // Get the index from the ideal resolution
      Break;        // Get out of the loop
    end;
  end; // Set the resolution by using the ideal index


  ShowMessage (IntToStr(ResIndex)); // <<<<<< ohne hängt das Programm



  Button1.Enabled := true;
  BitBtn_Stop.Enabled := true;
  BitBtn_Properties.Enabled := true;
  BitBtn_StreamProp.Enabled := true;
  BitBtn_SaveBMP.Enabled := true;
  Screen.Cursor := crDefault;
  FVideoImage.SetResolutionByIndex(ResIndex);

end;
:?


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:42 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz