rollback to windowsmedia + fix on audio crash

preferencesAboutTextFull
Clément Fauconnier 5 years ago
parent f708b59790
commit 10950bd702
  1. 16
      src/podcast/UBPodcastController.cpp
  2. 15
      src/podcast/podcast.pri
  3. 5
      src/podcast/windowsmedia/UBWaveRecorder.cpp

@ -59,8 +59,8 @@
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include "ffmpeg/UBFFmpegVideoEncoder.h" #include "windowsmedia/UBWindowsMediaVideoEncoder.h"
#include "ffmpeg/UBMicrophoneInput.h" #include "windowsmedia/UBWaveRecorder.h"
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)
#include "ffmpeg/UBFFmpegVideoEncoder.h" #include "ffmpeg/UBFFmpegVideoEncoder.h"
#include "ffmpeg/UBMicrophoneInput.h" #include "ffmpeg/UBMicrophoneInput.h"
@ -308,7 +308,13 @@ void UBPodcastController::start()
applicationMainModeChanged(UBApplication::applicationController->displayMode()); applicationMainModeChanged(UBApplication::applicationController->displayMode());
#ifdef Q_OS_WIN
mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop
#elif defined(Q_OS_OSX)
mVideoEncoder = new UBFFmpegVideoEncoder(this);
#elif defined(Q_OS_LINUX)
mVideoEncoder = new UBFFmpegVideoEncoder(this); mVideoEncoder = new UBFFmpegVideoEncoder(this);
#endif
if (mVideoEncoder) if (mVideoEncoder)
{ {
@ -799,7 +805,13 @@ QStringList UBPodcastController::audioRecordingDevices()
{ {
QStringList devices; QStringList devices;
#ifdef Q_OS_WIN
devices = UBWaveRecorder::waveInDevices();
#elif defined(Q_OS_OSX)
devices = UBMicrophoneInput::availableDevicesNames(); devices = UBMicrophoneInput::availableDevicesNames();
#elif defined(Q_OS_LINUX)
devices = UBMicrophoneInput::availableDevicesNames();
#endif
return devices; return devices;
} }

@ -13,16 +13,13 @@ SOURCES += src/podcast/UBPodcastController.cpp \
win32 { win32 {
SOURCES += src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp \ SOURCES += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.cpp \
src/podcast/ffmpeg/UBMicrophoneInput.cpp src/podcast/windowsmedia/UBWindowsMediaFile.cpp \
src/podcast/windowsmedia/UBWaveRecorder.cpp
HEADERS += src/podcast/ffmpeg/UBFFmpegVideoEncoder.h \
src/podcast/ffmpeg/UBMicrophoneInput.h
LIBS += -L$$PWD/../OpenBoard-ThirdParty/ffmpeg/lib/ -lavformat -lavcodec -lswscale -lswresample -lavutil
INCLUDEPATH += $$PWD/../OpenBoard-ThirdParty/ffmpeg/include HEADERS += src/podcast/windowsmedia/UBWindowsMediaVideoEncoder.h \
DEPENDPATH += $$PWD/../OpenBoard-ThirdParty/ffmpeg/include src/podcast/windowsmedia/UBWindowsMediaFile.h \
src/podcast/windowsmedia/UBWaveRecorder.h
} }
macx { macx {

@ -76,8 +76,7 @@ bool UBWaveRecorder::init(const QString& waveInDeviceName)
} }
} }
WAVEFORMATEX format; WAVEFORMATEX format = {0};
format.cbSize = 0;
format.wFormatTag = WAVE_FORMAT_PCM; format.wFormatTag = WAVE_FORMAT_PCM;
format.nChannels = mNbChannels; format.nChannels = mNbChannels;
format.wBitsPerSample = mBitsPerSample; format.wBitsPerSample = mBitsPerSample;
@ -85,7 +84,7 @@ bool UBWaveRecorder::init(const QString& waveInDeviceName)
format.nBlockAlign = format.nChannels * (format.wBitsPerSample / 8); format.nBlockAlign = format.nChannels * (format.wBitsPerSample / 8);
format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign;
if (waveInOpen(&mWaveInDevice, deviceID, &format, (DWORD)waveInProc, (DWORD_PTR)this, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) if (waveInOpen(&mWaveInDevice, deviceID, &format, reinterpret_cast<DWORD_PTR>(waveInProc), reinterpret_cast<DWORD_PTR>(this), CALLBACK_FUNCTION) != MMSYSERR_NOERROR)
{ {
setLastErrorMessage("Cannot open wave in device "); setLastErrorMessage("Cannot open wave in device ");
return false; return false;

Loading…
Cancel
Save