AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia FVideoImage.SetResolutionByIndex
Thema durchsuchen
Ansicht
Themen-Optionen

FVideoImage.SetResolutionByIndex

Ein Thema von holger_barntrup · begonnen am 5. Mär 2021
Antwort Antwort
Benutzerbild von holger_barntrup
holger_barntrup

Registriert seit: 1. Feb 2007
Ort: Barntrup
97 Beiträge
 
Delphi 10.4 Sydney
 
#1

FVideoImage.SetResolutionByIndex

  Alt 5. Mär 2021, 09:41
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;
Angehängte Dateien
Dateityp: zip M_Kamera.zip (1,98 MB, 3x aufgerufen)
Gruß Holger

Geändert von holger_barntrup ( 5. Mär 2021 um 10:48 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:09 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