0

我有直接显示的 Mp4 捕获应用程序。在我的应用程序中,我需要连续捕获 30 分钟(或说一些动态值)视频。我的图表如下

Video Source --> x264vfw - H.264/MPEG-4 AVC Codec --------->GDCL MPEG-4 Multiplexer --> File Writer                                             
                                                        | 
Audio Source --> ACM Wrapper --> Monogram AAC Encoder --|

为此,我制定了类似 --> 的逻辑

  1. 捕获类,其中包含制作图生成器、获取设备、构建图、启动和停止捕获图所需的所有内容。
  2. 为捕获类制作 2 个指针对象并为第一个和第二个对象构建图形。
  3. 运行第一张图并在 30 分钟超时后,开始第二张图并停止第一张图

以相同的方式连续运行图表,我想这个逻辑应该可以正常工作......并且几乎在逻辑上是正确的

当我构建第一个成功生成第一个图形并使用第二个指针对象我为该对象构建图形时,它不连接Audio Source Pin并且ACM WrapeerHRESULT = -2147220969

有人对这种行为有想法吗?

如果需要,我可以粘贴我的代码。

谢谢。

@Roman R.,我正在编辑我的帖子以添加我的代码片段,我希望我在这里添加了所需的详细信息。

编辑:

// Create 1st Capture Instance
Capture *capodd = new Capture();
capodd->destination = capinfo.destination;
capodd->periodicity = capinfo.periodicity;

// Select 1st Audio and 1st Video Device from Devices add their filters to graph
capodd->SelectDevice(1,1);

// Build Graph for the 1st Capture Instance
capodd->BuildMp4CaptureGraph();

// Create 2nd Capture Instance
Capture *capeven = new Capture();
capeven->destination = capinfo.destination;
capeven->periodicity = capinfo.periodicity;

// Select 1st Audio and 1st Video Device from Devices add their filters to graph
capeven->SelectDevice(1,1);

// Build Graph for the 2nd Capture Instance
capeven->BuildMp4CaptureGraph();


while(1)
{
    // set current capture file 
    Capture *capcurrent = new Capture();
    if(!capodd.Fcapturing && !capeven.Fcapturing)
    {
        capcurrent = capodd
        capodd->StopCapture();
    }
    else if(capodd.Fcapturing)
    {
        capcurrent = capeven;
        capodd->StopCapture();
    }
    else
    {
        capcurrent = capodd;
        capeven->StopCapture();
    }



    // Set the Capture File name 
    capcurrent->setCaptureInfo();

    // start capturing
    capcurrent->StartCapture();

    HANDLE hTimer = NULL;
    HANDLE hTimerQueue = NULL;
    int arg = 123;
    gDoneEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
    if (NULL == gDoneEvent)
    {
        capcurrent->ErrMsg(TEXT("CreateEvent failed (%d)\n"), GetLastError());
        return FALSE;
    }

     hTimerQueue = CreateTimerQueue();
    if (NULL == hTimerQueue)
    {
        capcurrent->ErrMsg(TEXT("CreateTimerQueue failed (%d)\n"), GetLastError());
        return FALSE;
    }

    // Set a timer to call the timer routine in 10 seconds.
    if (!CreateTimerQueueTimer( &hTimer, hTimerQueue, 
        (WAITORTIMERCALLBACK)TimerRoutine, &arg , (capcurrent->dwTimeLimit)*1000, 0, 0))
    {
        capcurrent->ErrMsg(TEXT("CreateTimerQueueTimer failed (%d)\n"), GetLastError());
        return FALSE;
    }

    if (WaitForSingleObject(gDoneEvent, ((capcurrent->dwTimeLimit)*1000)+1000) != WAIT_OBJECT_0)
        capcurrent->ErrMsg(TEXT("WaitForSingleObject failed (%d)\n"), GetLastError());

    CloseHandle(gDoneEvent);

    // Delete all timers in the timer queue.
    if (!DeleteTimerQueue(hTimerQueue))
        capcurrent->ErrMsg(TEXT("DeleteTimerQueue failed (%d)\n"), GetLastError());


}

选择设备获取音频和视频过滤器设备并将所选过滤器添加到图形

BuildMp4CaptureGraph 创建了上图中的图形,使用 CoCreateInstance 创建了 ACM Wrapper 和 GDCL Mux 过滤器并将其添加到图形中

我猜有些资源需要对外发布,不确定。

4

1 回答 1

1

-2147220969-> 0x80040217-> VFW_E_CANNOT_CONNECT

找不到中间过滤器的组合来建立连接。

也就是说,您第二次构建图表的尝试失败了。您需要检查图表上的过滤器,以将错误隔离到特定的引脚连接。

另请注意,您通常不能在 2 个以上的图中使用相同的捕获设备,它们被活动管道专门锁定。

于 2012-05-29T12:38:10.160 回答