OK, content of RefreshRateControl.txt:
2007-08-16 10:34:32: RefreshRateControl start. Def RR: 0
2007-08-16 10:34:45: Playback started. Playing file G:\movie\dvd\300\VIDEO_TS\VIDEO_TS.IFO
2007-08-16 10:34:45: Trying to connect to current MediaPortal's DirectShow graph
2007-08-16 10:34:45: Player is type DVDPlayer9
2007-08-16 10:34:45: Got IGraphBuilder field: _graphBuilder
2007-08-16 10:34:45: Got valid graph!
2007-08-16 10:34:45: Got frame time 0, frame rate is 0
2007-08-16 10:34:45: Finding best refresh rate for 0 fps
2007-08-16 10:34:45: Couldn't find good refresh rate, returning default 0 Hz)
2007-08-16 10:34:49: Playback stopped
2007-08-16 10:34:53: RefreshRateControl stop.
When I in plugin setup test the same file it correctly finds 25 fps and choose 75 Hz refreshrate. But for some reason it fails to do this during playback.
I am using MPV and MPA as codec
Since I never get a trace like: "Video has VideoInfoHeader...." in RefreshRateControl.txt it seems that somthing goes wrong somwhere in this code snippet (sorry for bad ident of code...):
foreach (IBaseFilter filter in new FilterEnumrerator((IFilterGraph)graphBuilder))
{
foreach (IPin pin in new PinEnumerator(filter))
{
/*
* try to find video
*/
mediaType = new AMMediaType();
hr = pin.ConnectionMediaType(mediaType);
if (hr == 0)
{
if (mediaType.formatType == DirectShowLib.FormatType.VideoInfo &&
mediaType.formatSize == Marshal.SizeOf(typeof(DirectShowLib.VideoInfoHeader)))
{
WriteToLog("Video has VideoInfoHeader info, getting frame time");
VideoInfoHeader videoHeader = new VideoInfoHeader();
Marshal.PtrToStructure(mediaType.formatPtr, videoHeader);
if (videoHeader.AvgTimePerFrame != 0)
{
frameTime = videoHeader.AvgTimePerFrame;
}
WriteToLog("Frame time is {0}", videoHeader.AvgTimePerFrame);
}
if (mediaType.formatType == DirectShowLib.FormatType.VideoInfo2 &&
mediaType.formatSize == Marshal.SizeOf(typeof(DirectShowLib.VideoInfoHeader2)))
{
WriteToLog("Video has VideoInfoHeader2 info, getting frame time");
VideoInfoHeader2 videoHeader2 = new VideoInfoHeader2();
Marshal.PtrToStructure(mediaType.formatPtr, videoHeader2);
if (videoHeader2.AvgTimePerFrame != 0)
{
frameTime = videoHeader2.AvgTimePerFrame;
}
WriteToLog("Frame time is {0}", videoHeader2.AvgTimePerFrame);
}
}
hr = 0;
// /
}
}
if (frameTime != 0)
frameRate = (float)(10000000.0f / frameTime);
WriteToLog("Got frame time {0}, frame rate is {1}", frameTime, frameRate);
2007-08-16 10:34:32: RefreshRateControl start. Def RR: 0
2007-08-16 10:34:45: Playback started. Playing file G:\movie\dvd\300\VIDEO_TS\VIDEO_TS.IFO
2007-08-16 10:34:45: Trying to connect to current MediaPortal's DirectShow graph
2007-08-16 10:34:45: Player is type DVDPlayer9
2007-08-16 10:34:45: Got IGraphBuilder field: _graphBuilder
2007-08-16 10:34:45: Got valid graph!
2007-08-16 10:34:45: Got frame time 0, frame rate is 0
2007-08-16 10:34:45: Finding best refresh rate for 0 fps
2007-08-16 10:34:45: Couldn't find good refresh rate, returning default 0 Hz)
2007-08-16 10:34:49: Playback stopped
2007-08-16 10:34:53: RefreshRateControl stop.
When I in plugin setup test the same file it correctly finds 25 fps and choose 75 Hz refreshrate. But for some reason it fails to do this during playback.
I am using MPV and MPA as codec
Since I never get a trace like: "Video has VideoInfoHeader...." in RefreshRateControl.txt it seems that somthing goes wrong somwhere in this code snippet (sorry for bad ident of code...):
foreach (IBaseFilter filter in new FilterEnumrerator((IFilterGraph)graphBuilder))
{
foreach (IPin pin in new PinEnumerator(filter))
{
/*
* try to find video
*/
mediaType = new AMMediaType();
hr = pin.ConnectionMediaType(mediaType);
if (hr == 0)
{
if (mediaType.formatType == DirectShowLib.FormatType.VideoInfo &&
mediaType.formatSize == Marshal.SizeOf(typeof(DirectShowLib.VideoInfoHeader)))
{
WriteToLog("Video has VideoInfoHeader info, getting frame time");
VideoInfoHeader videoHeader = new VideoInfoHeader();
Marshal.PtrToStructure(mediaType.formatPtr, videoHeader);
if (videoHeader.AvgTimePerFrame != 0)
{
frameTime = videoHeader.AvgTimePerFrame;
}
WriteToLog("Frame time is {0}", videoHeader.AvgTimePerFrame);
}
if (mediaType.formatType == DirectShowLib.FormatType.VideoInfo2 &&
mediaType.formatSize == Marshal.SizeOf(typeof(DirectShowLib.VideoInfoHeader2)))
{
WriteToLog("Video has VideoInfoHeader2 info, getting frame time");
VideoInfoHeader2 videoHeader2 = new VideoInfoHeader2();
Marshal.PtrToStructure(mediaType.formatPtr, videoHeader2);
if (videoHeader2.AvgTimePerFrame != 0)
{
frameTime = videoHeader2.AvgTimePerFrame;
}
WriteToLog("Frame time is {0}", videoHeader2.AvgTimePerFrame);
}
}
hr = 0;
// /
}
}
if (frameTime != 0)
frameRate = (float)(10000000.0f / frameTime);
WriteToLog("Got frame time {0}, frame rate is {1}", frameTime, frameRate);