Help: Media seek in directshow
-
I wrote a program to convert mpeg file to avi in directshow, now the conversion is OK, but I can't find out a method to seek the source media, I want to seek to a given point in source media before the conversion begin. In other words, I want to convert a segment of mpeg file to avi file. The structure of my program is following: 1. Read source mpeg file by using pGraph->AddSourceFilter(...); 2. Init IMediaSeeking, IMediaControl, etc by query pGraph; 3. Setup output avi file and init pMux by using pBuilder->SetOutputFileName(...); 4. Create Mpeg splitter and Mpeg Decoder then add them to pGraph; 5. Connect all filters by using pBuilder->RenderStream(....); 6. Start conversion by using pMediaControl->run(). now the conversion of whole mpeg file is OK, but I can't seek the source media, the pMediaSeeking->SetPositions(...) and GetDuration() function always return fail. I also tried to seek media by pMux but failed. someone can give me instruction to resolve it? thanks in advance.
-
I wrote a program to convert mpeg file to avi in directshow, now the conversion is OK, but I can't find out a method to seek the source media, I want to seek to a given point in source media before the conversion begin. In other words, I want to convert a segment of mpeg file to avi file. The structure of my program is following: 1. Read source mpeg file by using pGraph->AddSourceFilter(...); 2. Init IMediaSeeking, IMediaControl, etc by query pGraph; 3. Setup output avi file and init pMux by using pBuilder->SetOutputFileName(...); 4. Create Mpeg splitter and Mpeg Decoder then add them to pGraph; 5. Connect all filters by using pBuilder->RenderStream(....); 6. Start conversion by using pMediaControl->run(). now the conversion of whole mpeg file is OK, but I can't seek the source media, the pMediaSeeking->SetPositions(...) and GetDuration() function always return fail. I also tried to seek media by pMux but failed. someone can give me instruction to resolve it? thanks in advance.
Did you get my response to your email (maybe your email filter ate it or i didn't help you any :))? It was something like: I’m not sure if you can seek in that type of graph. If you follow the guidelines at Seeking the Filter Graph[^] you’ll find out if it works or not Mark
Mark Salsbery Microsoft MVP - Visual C++ This episode brought to you by the number 3
-
Did you get my response to your email (maybe your email filter ate it or i didn't help you any :))? It was something like: I’m not sure if you can seek in that type of graph. If you follow the guidelines at Seeking the Filter Graph[^] you’ll find out if it works or not Mark
Mark Salsbery Microsoft MVP - Visual C++ This episode brought to you by the number 3
Thank you very much. I checked my mailbox and not found your mail.(maybe the antivirus software ate it:(,), however after I follow your instruction to read the "Seeking the Filter Graph" in MSDN, I still can't find out the answer, It only tell me how to seek the media for rendering the media on screen, I also use pMediaSeeking->GetCapabilities(...) to check if it supports seeking, it return S_OK.