OggVorbis ov_open()抛出访问冲突异常 [英] OggVorbis ov_open() Throws Access Violation Exception

查看:201
本文介绍了OggVorbis ov_open()抛出访问冲突异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Vorbis SDK / DLL打开OggVorbis文件。 ov_open()引发访问冲突异常 0x00000014 。我已经检查了文件存在:我打开它与 fopen 并打印内容到控制台只是为了检查 - 一切顺利!

I'm trying to open an OggVorbis file using the Vorbis SDK/DLLs. ov_open() throws an Access Violation exception 0x00000014. I have checked the file exists: I've opened it with fopen and printed the contents to the console just to check - all went fine!

可能没有什么区别,但DLL已经编译为 DEBUG Win32 ,我的项目正在同一配置下编译。

Might not make a difference, but the DLLs have been compiled as DEBUG Win32, and my project is compiling under the same configuration.

我使用文件的绝对路径,为了放心,文件确实存在。如前所述,我可以自己打开并阅读。

I'm using an absolute path to the file, for reassurance, and the file does exist. As stated before, I can open and read it myself.

* .ogg文件是使用FL Studio在192kbps下渲染的,它也在Adobe Audition中打开和播放和VLC Media Player。

The *.ogg file was rendered using FL Studio at 192kbps, and it also opens and plays fine in Adobe Audition and VLC Media Player.

这是我打开文件并发送到Vorbis库的代码(代码来自 this 教程):

This is the code I have to open the file and send it to the Vorbis library (the code came from this tutorial):

FILE* oggFile;
const char* path = "C:\\absolute\\path\\to\\file.ogg";
const char* openMode = "rb";
int result;

if (!(oggFile = fopen(path, openMode)))
{
    throw std::string("Could not open file.");
}

if ((result = ov_open(oggFile, &oggStream, NULL, 0)) < 0)
{
    // Never gets here
    fclose(oggFile);
    throw std::string("Could not open Ogg stream: ");
}

抛出异常的Vorbis代码:

The "Vorbis" code where the exception is thrown:

// vorbisfile.c: line #827

static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence) {
    if(f==NULL)return(-1);
    return fseek(f,off,whence); // Exception thrown here
}

此时, off == 0 whence == 1

我看到方法名称包含64。这是否可能想读一个64位编码文件?或者它试图运行作为64位,当它实际编译为32位?或者这不是问题? :P

I do see the method name contains "64". Could this be wanting to read a 64bit encoded file? Or is it trying to run as 64bit when it's actually compiled as 32bit? Or is this not the issue at all? :P

另外,当我按照教程我注意到有一些错误的代码,我不得不纠正。所以我想知道如果教程是完整足够,即:可能有一些变量我应该 #define ,或者其他可能在发送打开

Also, as I followed the tutorial I noticed there were a couple of mistakes in the code that I had to correct. So I'm wondering if the tutorial is "complete" enough, ie: perhaps there is some variable I should #define, or something else that's possibly missing prior to sending the opened file to ov_open in order for it to be handled accordingly.

技术规格:


  • Windows 10

  • Visual Studio Express 2013

  • _MSC_VER 1800

  • libogg.dll v1.3.2(current)

  • libvorbis.dll v1.3.5(current)

  • Windows 10
  • Visual Studio Express 2013
  • _MSC_VER 1800
  • libogg.dll v1.3.2 (current)
  • libvorbis.dll v1.3.5 (current)

注意:下载的 Vorbis 源代码只包含解决方案项目文件,直到VS2010。我在Visual Studio Express 2013中打开VS2010 解决方案,以便编译它们,以实现与我的项目的兼容性。

NOTE: The downloaded Vorbis source code only contained Solution and Project files up to VS2010. I opened the VS2010 Solutions in Visual Studio Express 2013 to compile them in order to attain compatibility with my project. I'm also wondering if this might lead to some issues.

推荐答案

OggVorbis文档建议不要在windows上使用ov_open href =https://xiph.org/vorbis/doc/vorbisfile/ov_open.html =nofollow> https://xiph.org/vorbis/doc/vorbisfile/ov_open.html )。

The OggVorbis documentation recommends not using ov_open on windows (https://xiph.org/vorbis/doc/vorbisfile/ov_open.html).

请使用ov_open_callbacks。

Use ov_open_callbacks instead.

这样应该可以工作:

ov_open_callbacks(oggFile, &oggStream, NULL, 0, OV_CALLBACKS_DEFAULT);

这篇关于OggVorbis ov_open()抛出访问冲突异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆