Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C examples update #276

Merged
merged 9 commits into from
Mar 13, 2019
Merged

C examples update #276

merged 9 commits into from
Mar 13, 2019

Conversation

lars18th
Copy link
Contributor

This it's an upgrade from original PR #21

Take into account that the file examples/make-test-c.sh assumes the structure of examples/include/ and examples/lib/ described in #265.

Regards.

@lars18th lars18th changed the base branch from master to dev February 13, 2018 18:44
@@ -0,0 +1,9 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just a Makefile?

It might be probably even better if this uses the installed version of SRT. For example, instruct the user that they should do:

  1. Configure with installation directory of your choice, may be also inside this directory, e.g. "installed": configure --prefix=installed
  2. make && make install
  3. Compile this pointing the directory in SRTDIR variable: make SRTDIR=../installed
  4. Makefile will contain something like:
FLAGS=$(shell PKG_CONFIG_PATH=$(SRTDIR)/lib/pkgconfig pkg-config --cflags --libs srt openssl)

test-c-server: test-c-server.c
test-c-client: test-c-client.c
%:%.c
    $(CC) -o $@ $^ $(FLAGS) -lstdc++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ethouris ,

I know about your opinion. And you're right!
However, I think on this examples as a "guide". This it's the reason for a very simple script. So, I suggest to commit in this form (at time).

Regarding the "install" I suggest to support two ways in the "configure": Option 1 it's the "make install". And the Option 2 it's "make package", that generates a target directory with "target/lib", "target/include" and some examples. Why this? For use it for cross-compilation without installing it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because this can also demonstrate to the users how they can write their applications. In order to have a directory "target" with installed things, it's enough that you simply do configure --prefix=target. Although I think there could be a script that would first compile the SRT library into a directory local to examples and then continues with compiling and linking against it...

}

printf("srt setsockflag\n");
srt_setsockflag(ss, SRTO_SENDER, &yes, sizeof yes);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind how the user would like to call this application, and whether the stream would be sent from client to server or the other way around. Might be that it would be specified by options, and if not (for simplification) it's rather better that we have a kinda "stream server", so server is sending, client is reading. Important to inform the user that this flag is only needed to communicate with SRT with version earlier than 1.3.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user doesn't need to call this application. It does "dummy" work. This it's only an "example" code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but you know that users will next try to compile it and see if this works...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too! 😄

@ethouris
Copy link
Collaborator

BTW - after my changes with reshaping the project's directories, there's examples/testcapi-connect.c file that is updated with the latest changes. Probably it would be rather a better idea to merge them.

@ethouris
Copy link
Collaborator

Come on, I just did this together with some other work. During this "reshaping" I created the examples directory, moved this file to it, and then figured out that it's a complete messup and doesn't work, so I added some fixes. Sorry for that. But still, we need an example with connect and with accept, and without this PR we wouldn't have the latter.

@ethouris
Copy link
Collaborator

ethouris commented Mar 5, 2018

Hello? We still need this.

@lars18th
Copy link
Contributor Author

lars18th commented Mar 5, 2018

Hello? We still need this.

Hi @ethouris ,

Yes! I'm very busy. I'll review soon.

@maxsharabayko maxsharabayko added this to the v.1.3.3 milestone Feb 15, 2019
@rndi rndi changed the base branch from dev to master March 12, 2019 17:58
Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Updated with the latest master
  • Replaced deprecated srt_socket(AF_INET, SOCK_DGRAM, 0) with srt_create_socket().
  • Fixed sin_family not being set in sockaddr_in.
  • Deleted make-test-c.sh if favor of including the samples to CMakeLists.txt.
  • Fixed other examples (updated logging -> srt_logging namespace).

Fixes #20. Closes #267.

@rndi rndi merged commit a872e49 into Haivision:master Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Type: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants