mirror of
https://github.com/ivabus/pantry
synced 2024-11-22 08:25:07 +03:00
xiph.org/libshout (#3971)
* new file: projects/xiph.org/libshout/package.yml new file: projects/xiph.org/libshout/test.c * libs? * ldflags * openssl v1
This commit is contained in:
parent
f71b32abe2
commit
31907e1c65
2 changed files with 136 additions and 0 deletions
49
projects/xiph.org/libshout/package.yml
Normal file
49
projects/xiph.org/libshout/package.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
distributable:
|
||||
url: https://downloads.xiph.org/releases/libshout/libshout-{{version}}.tar.gz
|
||||
strip-components: 1
|
||||
versions:
|
||||
url: https://ftp.osuosl.org/pub/xiph/releases/libshout/
|
||||
match: /libshout-\d+\.\d+\.\d+\.tar\.gz/
|
||||
strip:
|
||||
- /^libshout-/
|
||||
- /\.tar\.gz/
|
||||
dependencies:
|
||||
xiph.org/ogg: '*'
|
||||
xiph.org/vorbis: '*'
|
||||
openssl.org: ~1
|
||||
speex.org: '*'
|
||||
theora.org: '*'
|
||||
build:
|
||||
dependencies:
|
||||
freedesktop.org/pkg-config: '*'
|
||||
darwin:
|
||||
curl.se: '*'
|
||||
gnu.org/patch: '*'
|
||||
linux:
|
||||
gnu.org/gcc: '*'
|
||||
script:
|
||||
- run: curl -L "$PATCH" | patch
|
||||
if: darwin
|
||||
- ./configure $CONFIGURE_ARGS
|
||||
- make --jobs {{ hw.concurrency }} install
|
||||
env:
|
||||
PATCH: https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff
|
||||
CONFIGURE_ARGS:
|
||||
- --disable-debug
|
||||
- --disable-dependency-tracking
|
||||
- --prefix="{{prefix}}"
|
||||
- --libdir="{{prefix}}/lib"
|
||||
provides:
|
||||
- bin/shout
|
||||
test:
|
||||
dependencies:
|
||||
freedesktop.org/pkg-config: '*'
|
||||
linux:
|
||||
gnu.org/gcc: '*'
|
||||
script:
|
||||
- pkg-config --modversion shout | grep {{version}}
|
||||
- cc test.c -lshout -lssl -lcrypto -o test
|
||||
- ./test
|
||||
env:
|
||||
linux:
|
||||
LDFLAGS: -fPIC
|
87
projects/xiph.org/libshout/test.c
Normal file
87
projects/xiph.org/libshout/test.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/* example.c: Demonstration of the libshout API.
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <shout/shout.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
shout_t *shout;
|
||||
unsigned char buff[4096];
|
||||
size_t read, total;
|
||||
int ret;
|
||||
|
||||
shout_init();
|
||||
|
||||
if (!(shout = shout_new())) {
|
||||
printf("Could not allocate shout_t\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_host(shout, "127.0.0.1") != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting hostname: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting protocol: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_port(shout, 8000) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting port: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_password(shout, "hackme") != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting password: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
if (shout_set_mount(shout, "/example.ogg") != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting mount: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting user: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_set_content_format(shout, SHOUT_FORMAT_OGG, SHOUT_USAGE_UNKNOWN, NULL) != SHOUTERR_SUCCESS) {
|
||||
printf("Error setting format: %s\n", shout_get_error(shout));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (shout_open(shout) == SHOUTERR_SUCCESS) {
|
||||
printf("Connected to server...\n");
|
||||
total = 0;
|
||||
while (1) {
|
||||
read = fread(buff, 1, sizeof(buff), stdin);
|
||||
total = total + read;
|
||||
|
||||
if (read > 0) {
|
||||
ret = shout_send(shout, buff, read);
|
||||
if (ret != SHOUTERR_SUCCESS) {
|
||||
printf("DEBUG: Send error: %s\n", shout_get_error(shout));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
shout_sync(shout);
|
||||
}
|
||||
} else {
|
||||
printf("Error connecting: %s\n", shout_get_error(shout));
|
||||
}
|
||||
|
||||
shout_close(shout);
|
||||
|
||||
shout_shutdown();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue