Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/formatcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
#include "codeccontext.h"
#include "codecparameters.h"

#if !API_AVFORMAT_URL
extern "C"
{
#include <libavutil/avstring.h>
}
#endif

using namespace std;

namespace {
Expand Down Expand Up @@ -60,7 +67,7 @@ void set_uri(AVFormatContext *ctx, string_view uri)
av_free(ctx->url);
ctx->url = av_strdup(uri.data());
#else
av_strlcpy(ctx->filename, uri.data(), std::min<size_t>(sizeof(m_raw->filename), uri.size() + 1));
av_strlcpy(ctx->filename, uri.data(), std::min<size_t>(sizeof(ctx->filename), uri.size() + 1));
ctx->filename[uri.size()] = '\0';
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ enable_testing()
#(Catch2 REQUIRED)

add_library(test_main STATIC test-main.cpp)
target_link_libraries(test_main PUBLIC Catch2::Catch2)
target_link_libraries(test_main PUBLIC Catch2::Catch2 avcpp::avcpp)

add_executable(test_executor
Frame.cpp
Expand Down
2 changes: 1 addition & 1 deletion tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ catch2 = dependency('catch2', required: true, fallback:['catch2','catch2_dep'])
main_test = static_library(
'main_test',
'test-main.cpp',
dependencies: catch2
dependencies: [catch2, avcpp_dep]
)

main_test_dep = declare_dependency(
Expand Down
11 changes: 9 additions & 2 deletions tests/test-main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// In a Catch project with multiple files, dedicate one file to compile the
// source code of Catch itself and reuse the resulting object file for linking.

// Let Catch provide main():
#define CATCH_CONFIG_MAIN
#define CATCH_CONFIG_RUNNER

#include <catch2/catch.hpp>

#include "av.h"

int main(int argc, char* argv[])
{
av::init();
return Catch::Session().run(argc, argv);
}

// That's it

// Compile implementation of Catch for use with files that do contain tests:
Expand Down
Loading