version: derive from git tag/commit hash; drop audio playback debug logs
Version is no longer hardcoded: at configure time CMake uses the tag name when HEAD is exactly on a tag (leading "v" stripped), otherwise the first 8 hex digits of the commit hash. When git is unavailable (e.g. source tarball) it falls back to the contents of version.txt, which is now the single place to bump the release version. Also remove the temporary qDebug() flood in the audio playback path (ViewerWidget::QueueNextAudioBuffer / ReceivedAudioBufferForPlayback, AudioManager::PushToOutput).
This commit is contained in:
+27
-5
@@ -18,7 +18,15 @@
|
||||
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
|
||||
|
||||
project(olive-editor VERSION 0.4.1 LANGUAGES CXX)
|
||||
set(PROJECT_VERSION "0.4.1-alpha")
|
||||
# Fallback version used only when git is unavailable (e.g. source tarball);
|
||||
# normally overridden by the git tag / commit hash logic further below.
|
||||
# Edit version.txt to change it.
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/version.txt")
|
||||
file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" PROJECT_VERSION LIMIT_COUNT 1)
|
||||
string(STRIP "${PROJECT_VERSION}" PROJECT_VERSION)
|
||||
else()
|
||||
set(PROJECT_VERSION "0.0.0-unknown")
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOFX_SUPPORTS_OPENGLRENDER")
|
||||
@@ -253,18 +261,32 @@ elseif(UNIX)
|
||||
list(APPEND OLIVE_LIBRARIES Qt${QT_VERSION_MAJOR}::DBus)
|
||||
endif()
|
||||
|
||||
# Generate Git hash
|
||||
# Determine version from git: the tag name if HEAD is exactly on a tag,
|
||||
# otherwise the first 8 hex digits of the commit hash. Falls back to
|
||||
# version.txt (read above) when git is unavailable (e.g. tarball).
|
||||
set(PROJECT_LONG_VERSION ${PROJECT_VERSION})
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --exact-match --tags HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_VARIABLE GIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
|
||||
set(PROJECT_LONG_VERSION ${PROJECT_VERSION}-${GIT_HASH})
|
||||
if(GIT_TAG)
|
||||
# Tags are named like "v0.4.1-alpha"; drop the leading "v"
|
||||
string(REGEX REPLACE "^v" "" PROJECT_VERSION "${GIT_TAG}")
|
||||
else()
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short=8 HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE PROJECT_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
set(PROJECT_LONG_VERSION ${PROJECT_VERSION})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -93,11 +93,6 @@ int InputCallback(const void *input, void *output, unsigned long frameCount,
|
||||
bool AudioManager::PushToOutput(const AudioParams ¶ms,
|
||||
const QByteArray &samples, QString *error)
|
||||
{
|
||||
qDebug() << "AudioManager::PushToOutput: device=" << output_device_
|
||||
<< "sample_rate=" << params.sample_rate()
|
||||
<< "channels=" << params.channel_count()
|
||||
<< "bytes=" << samples.size();
|
||||
|
||||
if (output_device_ == paNoDevice) {
|
||||
if (error)
|
||||
*error = tr("No output device is set");
|
||||
|
||||
@@ -852,14 +852,9 @@ void ViewerWidget::QueueNextAudioBuffer()
|
||||
// Clamp queue end by zero and the audio length
|
||||
queue_end = std::clamp(queue_end, rational(0),
|
||||
GetConnectedNode()->GetAudioLength());
|
||||
qDebug() << "ViewerWidget::QueueNextAudioBuffer: time="
|
||||
<< audio_playback_queue_time_.toDouble() << "end="
|
||||
<< queue_end.toDouble()
|
||||
<< "audio_length=" << GetConnectedNode()->GetAudioLength().toDouble();
|
||||
if ((playback_speed_ > 0 && queue_end <= audio_playback_queue_time_) ||
|
||||
(playback_speed_ < 0 && queue_end >= audio_playback_queue_time_)) {
|
||||
// This will queue nothing, so stop the loop here
|
||||
qDebug() << "ViewerWidget::QueueNextAudioBuffer: nothing to queue";
|
||||
if (prequeuing_audio_) {
|
||||
DecrementPrequeuedAudio();
|
||||
}
|
||||
@@ -878,8 +873,6 @@ void ViewerWidget::QueueNextAudioBuffer()
|
||||
|
||||
void ViewerWidget::ReceivedAudioBufferForPlayback()
|
||||
{
|
||||
qDebug() << "ViewerWidget::ReceivedAudioBufferForPlayback: queue_size="
|
||||
<< audio_playback_queue_.size();
|
||||
while (!audio_playback_queue_.empty() &&
|
||||
audio_playback_queue_.front()->HasResult()) {
|
||||
RenderTicketWatcher *watcher = audio_playback_queue_.front();
|
||||
@@ -887,10 +880,6 @@ void ViewerWidget::ReceivedAudioBufferForPlayback()
|
||||
|
||||
if (watcher->HasResult()) {
|
||||
SampleBuffer samples = watcher->Get().value<SampleBuffer>();
|
||||
qDebug() << "ViewerWidget::ReceivedAudioBufferForPlayback: got buffer"
|
||||
<< "allocated=" << samples.is_allocated()
|
||||
<< "sample_count=" << samples.sample_count()
|
||||
<< "channels=" << samples.audio_params().channel_count();
|
||||
if (samples.is_allocated()) {
|
||||
// If the samples must be reversed, reverse them now
|
||||
if (playback_speed_ < 0) {
|
||||
@@ -901,16 +890,11 @@ void ViewerWidget::ReceivedAudioBufferForPlayback()
|
||||
AudioProcessor::Buffer buf;
|
||||
int r = audio_processor_.Convert(samples.to_raw_ptrs().data(),
|
||||
samples.sample_count(), &buf);
|
||||
qDebug() << "ViewerWidget::ReceivedAudioBufferForPlayback: Convert"
|
||||
<< "returned=" << r << "buf_size=" << buf.size();
|
||||
|
||||
// TempoProcessor may have emptied the array
|
||||
if (r >= 0) {
|
||||
if (!buf.empty()) {
|
||||
const QByteArray &pack = buf.at(0);
|
||||
qDebug() << "ViewerWidget::ReceivedAudioBufferForPlayback: pushing"
|
||||
<< pack.size() << "bytes prequeuing="
|
||||
<< prequeuing_audio_;
|
||||
if (prequeuing_audio_) {
|
||||
// Add to prequeued audio buffer
|
||||
prequeued_audio_.append(pack);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
0.4.2-alpha
|
||||
Reference in New Issue
Block a user