質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

0回答

580閲覧

CythonでOggデコーダのビルドができない

CabbageLettuce

総合スコア57

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2019/09/10 15:32

PythonのモジュールでOggを再生したくていろいろ探してみたら、
https://qiita.com/cocuh/items/94a98cb312af7694ffd6
この記事があったのでこれを参考にやってみたところ、

python setup.py build_ext -i

このコマンドを実行したところ、以下のエラーが出てきました。

running build_ext cythoning vorbistest.pyx to vorbistest.c C:\Users\cabba\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\cabba\playogg\vorbistest.pyx tree = Parsing.p_module(s, pxd, full_module_name) Error compiling Cython file: ------------------------------------------------------------ ... cimport vorbistest as h ^ ------------------------------------------------------------ vorbistest.pyx:1:8: 'vorbistest.pxd' not found Error compiling Cython file: ------------------------------------------------------------ ... cdef int endian = 0 # 0 for little endian, 1 for big endian cdef int bitStream cdef char array[BUFFER_SIZE] # arrayという名のbuffer cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo ^ ------------------------------------------------------------ vorbistest.pyx:15:9: 'vorbis_info' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... cdef char array[BUFFER_SIZE] # arrayという名のbuffer cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile ^ ------------------------------------------------------------ vorbistest.pyx:17:9: 'OggVorbis_File' is not a type identifier Error compiling Cython file: ------------------------------------------------------------ ... cdef FILE *f = fopen(name, "rb") cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile h.ov_open(f, &oggFile, NULL, 0) ^ ------------------------------------------------------------ vorbistest.pyx:19:5: cimported module has no attribute 'ov_open' Error compiling Cython file: ------------------------------------------------------------ ... cdef h.vorbis_info *pinfo cdef OggVorbis_File oggFile h.ov_open(f, &oggFile, NULL, 0) pinfo = h.ov_info(&oggFile, -1) ^ ------------------------------------------------------------ vorbistest.pyx:20:13: cimported module has no attribute 'ov_info' Error compiling Cython file: ------------------------------------------------------------ ... import io buf = io.BytesIO() cdef long load_length load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) ^ ------------------------------------------------------------ vorbistest.pyx:36:19: cimported module has no attribute 'ov_read' Error compiling Cython file: ------------------------------------------------------------ ... cdef long load_length load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) while load_length>0: buf.write(array[:load_length]) load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) ^ ------------------------------------------------------------ vorbistest.pyx:39:23: cimported module has no attribute 'ov_read' Error compiling Cython file: ------------------------------------------------------------ ... load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) while load_length>0: buf.write(array[:load_length]) load_length = h.ov_read(&oggFile, array, BUFFER_SIZE, endian, 2, 1, &bitStream) pass h.ov_clear(&oggFile) ^ ------------------------------------------------------------ vorbistest.pyx:41:5: cimported module has no attribute 'ov_clear' building 'vorbistest' extension creating build creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\cabba\AppData\Local\Programs\Python\Python37\include -IC:\Users\cabba\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcvorbistest.c /Fobuild\temp.win-amd64-3.7\Release\vorbistest.obj vorbistest.c vorbistest.c(1): fatal error C1189: #error: Do not use this file, it is the result of a failed Cython compilation. error: command 'C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe' failed with exit status 2

setup.pytest.pyvorbis.pxdvorbistest.pyx が全てカレントディレクトリに入っています。

環境は、

  • Windows10 64bit
  • Python 3.7.4
  • Visual C++ 2015

です。
何か他にインストールするものなどありますでしょうか?

ちなみに、ffplayなどを使って再生しようとも思いましたが、

  • ffplayの出力がPythonの画面に流れてくる
  • 出力をPythonの画面に流さないために cmd /c start ffplay … で別画面でffplayを実行すると、Pythonの subprocess.Popen.kill() ができない

等の理由で断念しました。

あと、最終的な目標はネットワーク上にあるOggファイルのストリーム再生です。
Oggファイルが上記条件を満たして再生できれば、Pythonモジュールを使った再生にはこだわりません。
他の方法もありましたら、よろしくおねがいします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問