|
-
October 31st, 2005, 11:34 PM
#1
DirectShow playback with no pause between clips
I'm writing an application in DirectShow but I have a few questions.
Specifically, I'm trying to get two video clips to play, sequentially, in the same screen space, with no pause in between. I've been using the Jukebox sample as my template, but it produces a little blip of a pause between clips while it builds the filter graph for the new clip and places/resizes the video window. If I know that both clips share the same video codec and size properties, how do I get away with not rebuilding the filter graph and not resizing the video window? Also, do I need to queue one clip up and get it playing before the last one ends in order not to have any pause between them?
All the best,
Robert K S
-
November 1st, 2005, 04:17 AM
#2
Re: DirectShow playback with no pause between clips
Try this :
Create two child windows side-by-side, create two seperate DirectShow graphs : one for each media file : and give each graph its own window using the IVideoWindow interface.
Simple huh ? I hope this is what you want.
Darwen.
[edit]
Sorry, I didn't read your post correctly.
One possible solution is to have two filter graphs, both in "play" and use custom reference clocks. The reference clock for the second filter graph will only start when the first video finishes. However this won't account for random seeking between the two videos.
This is only a suggestion : in actual fact I can't think of a reliable way to do this.
Darwen.
Last edited by darwen; November 1st, 2005 at 05:19 AM.
-
November 2nd, 2005, 06:00 AM
#3
Cannot compile Geraint Davies' GMFBridge
I got suggestions to check out the GMFBridge tool, and indeed, it looks like it may provide a path to seamless playback of video clips using DirectShow. Unfortunately, I can't get the samples to build. Here's the first compiler complaint holding me up:
Compiling...
source.cpp
c:\Documents and Settings\Administrator\Desktop\GMFBridge\source.cpp(235) : error C3861: 'wsprintfWInternal': identifier not found, even with argument-dependent lookup
The line of code it points to:
wsprintfW(wsz, L"FilterGraph %08p pid %08x", (DWORD_PTR)(IUnknown*)pGraph, GetCurrentProcessId());
It turns out wsprintfW is defined in wxutil.h:
#define wsprintfW wsprintfWInternal
But if I look for any definition of wsprintfWInternal, it's undefined. Further down in wxutil.h there's this commented section:
Code:
// miscellaneous string conversion functions
// NOTE: as we need to use the same binaries on Win95 as on NT this code should
// be compiled WITHOUT unicode being defined. Otherwise we will not pick up
// these internal routines and the binary will not run on Win95.
// int WINAPIV wsprintfWInternal(LPWSTR, LPCWSTR, ...);
//LPWSTR
//WINAPI
//lstrcpyWInternal(
// LPWSTR lpString1,
// LPCWSTR lpString2
// );
and in wxutil.cpp there's another commented section:
Code:
// int WINAPIV wsprintfWInternal(LPWSTR wszOut, LPCWSTR pszFmt, ...)
// {
// char fmt[256]; // !!!
// char ach[256]; // !!!
// int i;
//
// va_list va;
// va_start(va, pszFmt);
// WideCharToMultiByte(GetACP(), 0, pszFmt, -1, fmt, 256, NULL, NULL);
// (void)StringCchVPrintf(ach, NUMELMS(ach), fmt, va);
// i = lstrlenA(ach);
// va_end(va);
//
// MultiByteToWideChar(CP_ACP, 0, ach, -1, wszOut, i+1);
//
// return i;
// }
but I'm not sure if any of the above is helpful.
Any suggestions? How can I get this puppy to compile? Has anyone else had success?
Last edited by Robert K S; November 2nd, 2005 at 06:08 AM.
All the best,
Robert K S
-
November 2nd, 2005, 09:21 AM
#4
Re: DirectShow playback with no pause between clips
Geraint Davies offered the following two solutions, both of which I'm ashamed not to have come up with myself! 
I know they've been messing with this win-95 compatibility stuff recently. I
think the correct solution would be to remove the #define in wxutil.h, since
there's a wsprintfW on all interesting platforms now.
However, far the simplest solution is to remove the whole if (false) block.
Worry about that later if you think you need to debug the graph building
code. Same with the similar code in the sink filter.
G
All the best,
Robert K S
-
November 17th, 2005, 04:48 AM
#5
Re: DirectShow playback with no pause between clips
Hi Robert. I ran into a similar problem - or exactly the sam problem, maybe.
I found the hatred the wsprintfW function (mangled into "wsprintfWInternal"???) in the code needed to register a graph in the ROT. The code provided in MSDN is:
Code:
HRESULT CDlgVideo::AddToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
{
IMoniker * pMoniker;
IRunningObjectTable *pROT;
if (FAILED(GetRunningObjectTable(0, &pROT))) {
return E_FAIL;
}
WCHAR wsz[256];
wsprintfW(wsz, L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph, GetCurrentProcessId());
HRESULT hr = CreateItemMoniker(L"!", wsz, &pMoniker);
if (SUCCEEDED(hr)) {
hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister);
pMoniker->Release();
}
pROT->Release();
return hr;
}
I changed it to
Code:
HRESULT CSampleGrabberCB::AddToRot(IUnknown *pUnkGraph, DWORD *pdwRegister)
{
IMoniker * pMoniker;
IRunningObjectTable *pROT;
if (FAILED(GetRunningObjectTable(0, &pROT))) {
return E_FAIL;
}
CStringW strw;
strw.Format(L"FilterGraph %08x pid %08x", (DWORD_PTR)pUnkGraph, GetCurrentProcessId());
HRESULT hr = CreateItemMoniker(L"!", strw, &pMoniker);
if (SUCCEEDED(hr)) {
hr = pROT->Register(0, pUnkGraph, pMoniker, pdwRegister);
pMoniker->Release();
}
pROT->Release();
return hr;
}
and now it compiles and works fine.
Hope this can help.
Ciao.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|