From 4e32cb7754a94ddee3eab6c5dfcdc6b197999bed Mon Sep 17 00:00:00 2001 From: Heikki Tampio Date: Tue, 23 Jan 2024 14:04:20 +0200 Subject: [PATCH] examples: Input V3C test file name as a command-line parameter --- examples/README.md | 10 +++++----- examples/v3c_receiver.cc | 10 +++++++++- examples/v3c_sender.cc | 15 ++++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/examples/README.md b/examples/README.md index d25435fb..e95a074b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,12 +31,12 @@ NOTE: The hook should not be used for extensive media processing. It is meant to To demonstrate V3C streaming, uvgRTP comes with example V3C sender and V3C receiver programs, found in `uvgRTP/build/examples`. Below are simple step-by-step instructions to run these programs: 1. Build the library according to instructions in [BUILDING.md](../BUILDING.md). Crypto++ is not needed. +2. Build the `v3c_sender` and `v3c_receiver` applications according to building instructions on the top of this page. 3. Download a test sequence from [here](https://ultravideo.fi/uvgRTP_example_sequence_longdress.vpcc). -4. Set the PATH variable in the [v3c_sender](v3c_sender.cc#L20) and [v3c_receiver](v3c_receiver.cc#L49) to the path of the test sequence. -5. Build the `v3c_sender` and `v3c_receiver` applications according to building instructions on the top of this page. -6. Start the `v3c_receiver` program with `./v3c_receiver` -7. Start the `v3c_sender` program with `./v3c_sender`. The program will parse the test sequence for transmission and send it to the receiver. -8. The with `v3c_receiver` will print information on the reception and reconstruction of the V3C bitstream. +4. Place the test sequence in uvgRTP/build/examples/Release +5. Start the `v3c_receiver` program with `./v3c_receiver uvgRTP_example_sequence_longdress.vpcc`. If you have changed the filename, modify the command accordingly. +6. Start the `v3c_sender` program with `./v3c_sender uvgRTP_example_sequence_longdress.vpcc`. The program will parse the test sequence for transmission and send it to the receiver. +7. The with `v3c_receiver` will print information on the reception and reconstruction of the V3C bitstream. ## RTCP example diff --git a/examples/v3c_receiver.cc b/examples/v3c_receiver.cc index 38612bc8..aa19fd28 100644 --- a/examples/v3c_receiver.cc +++ b/examples/v3c_receiver.cc @@ -50,8 +50,16 @@ std::string PATH = ""; bool write_file(const char* data, size_t len, const std::string& filename); -int main(void) +int main(int argc, char* argv[]) { + if (argc != 2) { + std::cout << "Enter test file name as input parameter" << std::endl; + return EXIT_FAILURE; + } + else { + PATH = argv[1]; + } + std::cout << "Starting uvgRTP V3C receive hook example" << std::endl; /* Initialize uvgRTP context and session*/ diff --git a/examples/v3c_sender.cc b/examples/v3c_sender.cc index 4fe988b9..203846c2 100644 --- a/examples/v3c_sender.cc +++ b/examples/v3c_sender.cc @@ -8,12 +8,6 @@ #include #include -/* Usage - * 1. Set the PATH in both sender and receiver to the V-PCC file to be transmitted. You can download it from a link on - * Github in uvgrtp/examples - * 2. Start the receiver program - * 3. Start the sender program */ - constexpr char LOCAL_IP[] = "127.0.0.1"; // Path to the V-PCC file that you want to send @@ -21,7 +15,7 @@ std::string PATH = ""; void sender_func(uvgrtp::media_stream* stream, const char* cbuf, const std::vector &units, rtp_flags_t flags, int fmt); std::atomic bytes_sent; -int main(void) +int main(int argc, char* argv[]) { /* This example demonstrates transmitting a file that is in the V3C sample stream format via uvgRTP. It can be used to transmit * V-PCC encoded files, but with minor modifications (addition of V3C_CAD and V3C_PVD streams) it can also be used for MIV @@ -56,6 +50,13 @@ int main(void) - Remember to use RTP_NO_H26X_SCL flag when sending video frames, as there is no start codes in the video sub-streams - v3c_sender and v3c_receiver programs use common functions defined in v3c_util. */ + if (argc != 2) { + std::cout << "Enter test file name as input parameter" << std::endl; + return EXIT_FAILURE; + } + else { + PATH = argv[1]; + } bytes_sent = 0; v3c_file_map mmap;