【问题标题】:TheoraVideoManager wont initialize Unhandled exception at 0x7329E13D (msvcr110.dll)TheoraVideoManager 不会在 0x7329E13D (msvcr110.dll) 处初始化未处理的异常
【发布时间】:2013-08-12 14:31:33
【问题描述】:

我似乎有一个问题,由于 TheoraVideoManager 没有初始化,我一直收到未处理的异常异常,我在 Win32Project1.exe 中的 0x7329E13D (msvcr110.dll) 处遇到未处理的异常:0xC0000005:访问冲突读取位置 0x00194000。

这就是我的做法

#include <theoraplayer/TheoraPlayer.h>
#include <theoraplayer/TheoraDataSource.h>
#include "theoraplayer/TheoraVideoManager.h"
TheoraVideoManager *mgr ;

//////////////////////////////

void  init(void)
{
mgr=new TheoraVideoManager();
char* x="one.ogg";
Texttemp=new THVideo(x);
}

///////////

Video.h
extern TheoraVideoManager *mgr ;

/////////////

    THVideo(char* File){        
  ///// crashes here on clip
        clip=mgr->createVideoClip(new TheoraMemoryFileDataSource(File));
        clip->setAutoRestart(1);
        clip->pause();
        texture->texID=createTexture(nextPow2(clip->getWidth()),nextPow2(clip->getHeight()), textureFormat);

    }

/////////////////////////

【问题讨论】:

    标签: c++ ogg-theora


    【解决方案1】:

    如果您使用的指针是 init 且具有不同的 NULL 值,您的代码将不予考虑。因此,如果在您的管理器初始化或剪辑初始化时出现问题,您将使用指针并在没有更多详细信息的情况下崩溃。

    首先将管理器声明为具有空值的静态。

    TheoraVideoManager *mgr = NULL;
    

    现在假设 THVideo 是一个类,并且该剪辑是一个数据成员。 在所有代码中检查指针是否不为空,如果出现问题则抛出异常。

    THVideo(const char* File){        
         if (mgr == NULL)
          { throw "null pointer";}
    
        clip=mgr->createVideoClip(new TheoraMemoryFileDataSource(File));
        if(clip == NULL)
         { throw "error on file data source" }
    
          .....
      }
    

    【讨论】:

    • 很抱歉我在发布后清理了 abit 的迟到的回复,我确实声明为 null,但没有任何区别,我在 vs 中设置了链接器并重新链接了所有设置。并且它开始工作了,所以我的 libtheora 设置中一定有问题,尽管不确定是什么
    猜你喜欢
    • 1970-01-01
    • 2010-10-23
    • 2021-11-29
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多