📄 dsutil.pas
字号:
{*******************************************************************************
* part of DSPack 1.03 *
* *
* home page : http://www.progdigy.com *
* email : hgourvest@progdigy.com *
* *
* date : 27-05-2001 *
*******************************************************************************}
unit DSUtil;
interface
uses Windows, Messages, Graphics, ActiveX, Sysutils, DirectShow;
const
WM_GRAPHNOTIFY = WM_APP + 1; // Filter Graph Event
IID_IPropertyBag : TGUID = '{55272A00-42CB-11CE-8135-00AA004BB851}';
IID_ISpecifyPropertyPages : TGUID = '{B196B28B-BAB4-101A-B69C-00AA00341D07}';
type
TOverlayColor = record
case integer of
0:(low : cardinal;
hight : cardinal);
1:(color : TColor);
end;
TFilePath = array[0..MAX_PATH] of WChar;
// User OPerationS
TDSUOPSFlag = (
SelectVideoModePreference,
PlayTitleOrAtTime,
PlayChapter,
PlayTitle,
Stop,
ReturnFromSubMenu,
PlayChapterOrAtTime,
PlayPrevOrReplayChapter,
PlayNextChapter,
PlayForwards,
PlayBackwards,
ShowMenuTitle,
ShowMenuRoot,
ShowMenuSubPic,
ShowMenuAudio,
ShowMenuAngle,
ShowMenuChapter,
CanResume,
SelectOrActivateButton,
CanStillOff,
CanPauseOn,
SelectAudioStream,
SelectSubPicStream,
SelectAngle,
SelectKaraokeAudioPresentationMode
);
TDSUOPSKind = set of TDSUOPSFlag;
TUOPS = record
TitlePlay : boolean; //2 Finds the media file with the specified title index and plays it back.
ChapterPlay : boolean; //1 Plays the media file with the specified title index and chapter value.
TimePlay : boolean; //0 Plays the media file with the specified title index, starting at the specified time.
StopForResume : boolean; //3 Transitions playback to the DVD_DOMAIN_Stop state after saving resume information.
GoUp : boolean; //4 Halts playback of the current media file and starts playback of the designated previous program chain (PGC).
TimeSearch : boolean; //0,5 Halts playback of the current chapter and starts playback from the specified time in the same media file.
ChapterSearch : boolean; //1,5 Halts playback of the current chapter and starts playback from the specified chapter value in the same media file.
PrevPGSearch : boolean; //6 Halts playback of the current program and starts playback from the previous program within the program chain (PGC).
TopPGSearch : boolean; //6 Halts playback of the current program and restarts playback of the current program within the program chain (PGC).
NextPGSearch : boolean; //7 Halts playback of the current program and starts playback from the next program within the program chain (PGC).
ForwardScan : boolean; //8 Search forward through the current disc at the specified speed.
BackwardScan : boolean; //9 Search backward through the current disc at the specified speed.
MenuCall_Title_Menu : boolean; //10 Displays the specified menu on the screen.
MenuCall_Root_Menu : boolean; //11
MenuCall_Sub_picture_Menu : boolean; //12
MenuCall_Audio_Menu : boolean; //13
MenuCall_Angle_Menu : boolean; //14
MenuCall_Chapter_Menu : boolean; //15
Resume : boolean; //16 Returns to playing back a title from a menu.
UpperButtonSelect : boolean; //17 Selects the upper directional button from the displayed menu.
LowerButtonSelect : boolean; //17 Selects the lower directional button from the displayed menu.
LeftButtonSelect : boolean; //17 Selects the left directional button from the displayed menu.
RightButtonSelect : boolean; //17 Selects the right directional button from the displayed menu.
ButtonActivate : boolean; //17 Activates the selected button.
ButtonSelectAndActivate : boolean; //17 Selects and activates the specified button.
StillOff : boolean; //18 Resumes playback, cancelling still mode.
PauseOn : boolean; //19 Pauses the current media file playback.
PauseOff : boolean; //19 Unpauses the current media file playback.
AudioStreamChange : boolean; //20 Sets the current audio stream.
SubpictureStreamChange : boolean; //21 Enables or disables picture-in-picture mode and sets the subpicture to the specified source.
AngleChange : boolean; //22 Sets the new display angle.
KaraokeAudioPresentationModeChange: boolean; //23 Sets the audio playback mode to karaoke.
VideoModePreferrence : boolean; //24 Sets the video display mode the user prefers.
end;
TDSAMSeeking = (
CanSeekAbsolute,
CanSeekForwards,
CanSeekBackwards,
CanGetCurrentPos,
CanGetStopPos,
CanGetDuration,
CanPlayBackwards,
CanDoSegments,
Source
);
TDSAMSeekingKind = set of TDSAMSeeking;
function FileToPath(FileName: string): TFilePath;
function GetEventCodeDef(code: longint): string;
function IntToBin(Value: LongInt; Digits: Integer): String;
function IntToUOPS(value : longint):TUOPS;
function IntToTimeCode(x : longint): TDVD_TimeCode;
function BinToInt(Value: String): LongInt;
function TimeCodeToFrames(value : TDVD_TimeCode): longint;
function ShowFilterPropertyPage(Filter: IBaseFilter): HRESULT;
function AddGraphToRot(Graph: IFilterGraph; out dwRegister: Longint): HRESULT;
function RemoveGraphFromRot(dwRegister: longint): HRESULT;
implementation
function FileToPath(FileName: string): TFilePath;
begin
MultiByteToWideChar(CP_ACP,0,Pchar(FileName),-1,result,Sizeof(result) div sizeof(result[0]));
end;
function GetEventCodeDef(code: longint): string;
begin
case code of
EC_ACTIVATE : result:= 'EC_ACTIVATE - A video window is being activated or deactivated.';
EC_BUFFERING_DATA : result:= 'EC_BUFFERING_DATA - The graph is buffering data, or has stopped buffering data.';
EC_CLOCK_CHANGED : result:= 'EC_CLOCK_CHANGED - The reference clock has changed.';
EC_COMPLETE : result:= 'EC_COMPLETE - All data from a particular stream has been rendered.';
EC_DEVICE_LOST : result:= 'EC_DEVICE_LOST - A Plug and Play device was removed or has become available again.';
EC_DISPLAY_CHANGED : result:= 'EC_DISPLAY_CHANGED - The display mode has changed.';
EC_END_OF_SEGMENT : result:= 'EC_END_OF_SEGMENT - The end of a segment has been reached.';
EC_ERROR_STILLPLAYING : result:= 'EC_ERROR_STILLPLAYING - An asynchronous command to run the graph has failed.';
EC_ERRORABORT : result:= 'EC_ERRORABORT - An operation was aborted because of an error.';
EC_FULLSCREEN_LOST : result:= 'EC_FULLSCREEN_LOST - The video renderer is switching out of full-screen mode.';
EC_GRAPH_CHANGED : result:= 'EC_GRAPH_CHANGED - The filter graph has changed.';
EC_NEED_RESTART : result:= 'EC_NEED_RESTART - A filter is requesting that the graph be restarted.';
EC_NOTIFY_WINDOW : result:= 'EC_NOTIFY_WINDOW - Notifies a filter of the video renderer''s window.';
EC_OLE_EVENT : result:= 'EC_OLE_EVENT - A filter is passing a text string to the application.';
EC_OPENING_FILE : result:= 'EC_OPENING_FILE - The graph is opening a file, or has finished opening a file.';
EC_PALETTE_CHANGED : result:= 'EC_PALETTE_CHANGED - The video palette has changed.';
EC_PAUSED : result:= 'EC_PAUSED - A pause request has completed.';
EC_QUALITY_CHANGE : result:= 'EC_QUALITY_CHANGE - The graph is dropping samples, for quality control.';
EC_REPAINT : result:= 'EC_REPAINT - A video renderer requires a repaint.';
EC_SEGMENT_STARTED : result:= 'EC_SEGMENT_STARTED - A new segment has started.';
EC_SHUTTING_DOWN : result:= 'EC_SHUTTING_DOWN - The filter graph is shutting down, prior to being destroyed.';
EC_SNDDEV_IN_ERROR : result:= 'EC_SNDDEV_IN_ERROR - An audio device error has occurred on an input pin.';
EC_SNDDEV_OUT_ERROR : result:= 'EC_SNDDEV_OUT_ERROR - An audio device error has occurred on an output pin.';
EC_STARVATION : result:= 'EC_STARVATION - A filter is not receiving enough data.';
EC_STEP_COMPLETE : result:= 'EC_STEP_COMPLETE - A filter performing frame stepping has stepped the specified number of frames.';
EC_STREAM_CONTROL_STARTED : result:= 'EC_STREAM_CONTROL_STARTED - A stream-control start command has taken effect.';
EC_STREAM_CONTROL_STOPPED : result:= 'EC_STREAM_CONTROL_STOPPED - A stream-control start command has taken effect.';
EC_STREAM_ERROR_STILLPLAYING : result:= 'EC_STREAM_ERROR_STILLPLAYING - An error has occurred in a stream. The stream is still playing.';
EC_STREAM_ERROR_STOPPED : result:= 'EC_STREAM_ERROR_STOPPED - A stream has stopped because of an error.';
EC_USERABORT : result:= 'EC_USERABORT - The user has terminated playback.';
EC_VIDEO_SIZE_CHANGED : result:= 'EC_VIDEO_SIZE_CHANGED - The native video size has changed.';
EC_WINDOW_DESTROYED : result:= 'EC_WINDOW_DESTROYED - The video renderer was destroyed or removed from the graph.';
EC_TIMECODE_AVAILABLE : result:= 'EC_TIMECODE_AVAILABLE- Sent by filter supporting timecode';
EC_EXTDEVICE_MODE_CHANGE : result:= 'EC_EXTDEVICE_MODE_CHANGE - Sent by filter supporting IAMExtDevice';
EC_CLOCK_UNSET : result:= 'EC_CLOCK_UNSET - notify the filter graph to unset the current graph clock';
EC_TIME : result:= 'EC_TIME - The requested reference time occurred (currently not used)';
EC_DVD_ANGLE_CHANGE : result:= 'EC_DVD_ANGLE_CHANGE - Signals that either the number of available angles changed or that the current angle number changed.';
EC_DVD_ANGLES_AVAILABLE : result:= 'EC_DVD_ANGLES_AVAILABLE - Indicates whether an angle block is being played and angle changes can be performed.';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -