Skip to content

Commit

Permalink
Аудио
Browse files Browse the repository at this point in the history
Начало добавления аудио обработки
  • Loading branch information
konvikkor committed Jul 6, 2018
1 parent 16f83b9 commit 73fdf77
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions uFFMPG.pas
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,18 @@ function TMyFFMpegCore.OpenFile(FileName: String): Boolean;
raise Exception.Create ('Error Message:Could not allocate raw video buffer');
Steams[i].bufsize := ret;
end;
if PAVstream(PPtrIdx(FormatContext.streams, I))^.codec.codec_type = AVMEDIA_TYPE_AUDIO then begin
Steams[i].stream := PPtrIdx(FormatContext.streams, I);
avdec := avcodec_find_decoder(Steams[i].stream.codec.codec_id);
if not assigned(avdec) then
raise Exception.Create('Error Message:Failed to find ' + string(av_get_media_type_string(Steams[i].stream.codec.codec_type)) + ' codec');
(* Init the decoders, with or without reference counting *)
//av_dict_set(@opts, 'refcounted_frames', '1', 0); /// Test Function
ret := avcodec_open2(Steams[i].stream.codec, avdec, @opts);
if ret < 0 then
raise Exception.Create('Error Message:Failed to open ' + string(av_get_media_type_string(Steams[i].stream.codec.codec_type)) + ' codec');
//Steams[i].bufsize := ret;
end;
end;
{* инициализация глобальных переменных *}
FStartPosition.TimeInt :=
Expand Down
12 changes: 10 additions & 2 deletions uFFMpegThead.pas
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,19 @@ procedure TMyDecodeThead.Execute;
FMyFFMpeg.Stop;
Continue; // if end file then stop
end;
if Assigned(FDecodeAUDIO) then begin
FDecodeAUDIO(Delay);
if Delay = $FFFFFFFF then begin
//Delay:=3;
//Sleep(Delay);
end else
if Assigned(FRunAUDIO) then FRunAUDIO(Delay);
end;
if Assigned(FDecodeVIDEO) then begin
FDecodeVIDEO(Delay);
if Delay = $FFFFFFFF then begin
Delay:=3;
Sleep(Delay);
//Delay:=3;
//Sleep(Delay);
end else
if Assigned(FRunVIDEO) then FRunVIDEO(Delay);
end;
Expand Down

0 comments on commit 73fdf77

Please sign in to comment.