Skip to content

Commit

Permalink
Created lib for srt
Browse files Browse the repository at this point in the history
  • Loading branch information
massis08 committed Dec 27, 2021
1 parent ef151db commit 5164cf3
Show file tree
Hide file tree
Showing 22 changed files with 42 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cpp/apps/st2110_extractor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ namespace
config.pcap_file, config.profile, config.storage_folder, pcap, get_stream_info, &factory,
&updater, progress_callback, config.extract_frames};

const auto is_srt = true;
const auto is_srt = false;

run_full_analysis(is_srt, context);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/apps/stream_pre_processor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ int main(int argc, char* argv[])
console->info("Processing {}.", pcap_id->get<std::string>());
try
{
const auto is_srt = true;
const auto is_srt = false;

const json analysis_result =
analyze_stream(pcap_path->get<std::string>(), pcap_id->get<std::string>(), is_srt);
Expand Down
1 change: 1 addition & 0 deletions cpp/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ add_subdirectory(test_lib)
add_subdirectory(core)
add_subdirectory(net)
add_subdirectory(rtp)
add_subdirectory(srt)
add_subdirectory(pcap)
add_subdirectory(st2110)
add_subdirectory(ptp)
Expand Down
2 changes: 1 addition & 1 deletion cpp/libs/preprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ cmake_minimum_required(VERSION 3.9)

list_declare_library(ebu_list_preprocessor)

target_link_libraries(${PROJECT_NAME} ebu_list_analysis ebu_list_pcap ebu_list_ptp)
target_link_libraries(${PROJECT_NAME} ebu_list_analysis ebu_list_pcap ebu_list_ptp ebu_list_srt)
5 changes: 5 additions & 0 deletions cpp/libs/srt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.9)

list_declare_library(ebu_list_srt)

target_link_libraries(${PROJECT_NAME} ebu_list_core ebu_list_net ebu_list_analysis ebu_list_st2110)
2 changes: 2 additions & 0 deletions cpp/libs/srt/unit_tests/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main()
#include "catch2/catch.hpp"
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions cpp/libs/srt/unit_tests/utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "utils.h"

using namespace ebu_list;
using namespace ebu_list::srt;
using namespace ebu_list::st2110;

//------------------------------------------------------------------------------

detector::status_description test::run_srt_format_detector(srt_format_detector& srt_d, udp_source& s)
{
for(;;)
{
auto packet = s.next();
if(!packet)
return detector::status_description{/*.state*/ detector::state::invalid,
/*.error_code*/ "UNIT_TESTING"};

const auto result = srt_d.handle_data(std::move(packet.value()));
if(result.state == detector::state::valid || result.state == detector::state::invalid) return result;
}
}
10 changes: 10 additions & 0 deletions cpp/libs/srt/unit_tests/utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "ebu/list/st2110/format_detector.h"
#include "ebu/list/srt/srt_format_detector.h"
#include "udp_source.h"

namespace ebu_list::test
{
st2110::detector::status_description run_srt_format_detector(srt::srt_format_detector& srt_d, udp_source& s);
}
15 changes: 0 additions & 15 deletions cpp/libs/st2110/unit_tests/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "utils.h"

using namespace ebu_list;
using namespace ebu_list::srt;
using namespace ebu_list::st2110;

//------------------------------------------------------------------------------
Expand All @@ -19,17 +18,3 @@ detector::status_description test::run_detector(detector& d, rtp_source& s)
if(result.state == detector::state::valid || result.state == detector::state::invalid) return result;
}
}

detector::status_description test::run_srt_format_detector(srt_format_detector& srt_d, udp_source& s)
{
for(;;)
{
auto packet = s.next();
if(!packet)
return detector::status_description{/*.state*/ detector::state::invalid,
/*.error_code*/ "UNIT_TESTING"};

const auto result = srt_d.handle_data(std::move(packet.value()));
if(result.state == detector::state::valid || result.state == detector::state::invalid) return result;
}
}
3 changes: 0 additions & 3 deletions cpp/libs/st2110/unit_tests/utils.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#pragma once

#include "ebu/list/st2110/format_detector.h"
#include "ebu/list/srt/srt_format_detector.h"
#include "rtp_source.h"
#include "udp_source.h"

namespace ebu_list::test
{
st2110::detector::status_description run_detector(st2110::detector& d, rtp_source& s);
st2110::detector::status_description run_srt_format_detector(srt::srt_format_detector& srt_d, udp_source& s);
}

0 comments on commit 5164cf3

Please sign in to comment.