icecast: Rework dependencies

Remove private Tremor. (use libvorbisidec in repo)
Remove need for libvorbis (add missing vorbis_comment functions)
Remove openSSL (uses mbedTLS via libcurl)

Add myself as co-maintainer.

Signed-off-by: Ted Hess <thess@kitschensync.net>
This commit is contained in:
Ted Hess
2017-01-14 18:00:31 -05:00
parent b4de19b9d9
commit da55f36f80
5 changed files with 166 additions and 183 deletions
@@ -1,104 +1,114 @@
--- a/src/format_flac.c
+++ b/src/format_flac.c
@@ -18,7 +18,7 @@
#endif
#include <stdlib.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include <string.h>
typedef struct source_tag source_t;
--- a/src/format_midi.c
+++ b/src/format_midi.c
@@ -18,7 +18,7 @@
#endif
#include <stdlib.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include <string.h>
typedef struct source_tag source_t;
--- a/src/format_ogg.c
+++ b/src/format_ogg.c
@@ -24,7 +24,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include "refbuf.h"
#include "source.h"
--- a/src/format_ogg.h
+++ b/src/format_ogg.h
@@ -18,7 +18,7 @@
#ifndef __FORMAT_OGG_H__
#define __FORMAT_OGG_H__
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include "refbuf.h"
#include "format.h"
--- a/src/format_speex.c
+++ b/src/format_speex.c
@@ -18,7 +18,7 @@
#endif
#include <stdlib.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include <speex/speex_header.h>
typedef struct source_tag source_t;
--- a/src/format_theora.c
+++ b/src/format_theora.c
@@ -18,7 +18,7 @@
#endif
#include <stdlib.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include <theora/theora.h>
typedef struct source_tag source_t;
--- a/src/format_vorbis.c
+++ b/src/format_vorbis.c
@@ -18,8 +18,8 @@
#endif
@@ -19,7 +19,7 @@
#include <stdlib.h>
-#include <ogg/ogg.h>
#include <ogg/ogg.h>
-#include <vorbis/codec.h>
+#include <tremor/ogg.h>
+#include <tremor/ivorbiscodec.h>
#include <memory.h>
#include <string.h>
--- a/src/source.c
+++ b/src/source.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#include <errno.h>
@@ -34,6 +34,7 @@
#define CATMODULE "format-vorbis"
#include "logging.h"
#ifndef _WIN32
--- a/src/format_kate.c
+++ b/src/format_kate.c
@@ -19,7 +19,7 @@
+int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include <tremor/ogg.h>
#ifdef HAVE_KATE
#include <kate/oggkate.h>
#endif
typedef struct vorbis_codec_tag
{
@@ -583,3 +584,91 @@ static refbuf_t *process_vorbis_page (og
return NULL;
}
+/* Some additional functions from vorbis missing from tremore */
+
+static void _v_writestring(oggpack_buffer *o,char *s, int bytes)
+{
+
+ while(bytes--){
+ oggpack_write(o,*s++,8);
+ }
+}
+
+static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc)
+{
+ char temp[]="Xiph.Org libVorbis I 20150104";
+ int bytes = strlen(temp);
+
+ /* preamble */
+ oggpack_write(opb,0x03,8);
+ _v_writestring(opb,"vorbis", 6);
+
+ /* vendor */
+ oggpack_write(opb,bytes,32);
+ _v_writestring(opb,temp, bytes);
+
+ /* comments */
+
+ oggpack_write(opb,vc->comments,32);
+ if(vc->comments){
+ int i;
+ for(i=0;i<vc->comments;i++){
+ if(vc->user_comments[i]){
+ oggpack_write(opb,vc->comment_lengths[i],32);
+ _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
+ }else{
+ oggpack_write(opb,0,32);
+ }
+ }
+ }
+ oggpack_write(opb,1,1);
+
+ return(0);
+}
+
+void vorbis_comment_add(vorbis_comment *vc,char *comment)
+{
+ vc->user_comments=_ogg_realloc(vc->user_comments,
+ (vc->comments+2)*sizeof(*vc->user_comments));
+ vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
+ (vc->comments+2)*sizeof(*vc->comment_lengths));
+ vc->comment_lengths[vc->comments]=strlen(comment);
+ vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
+ strcpy(vc->user_comments[vc->comments], comment);
+ vc->comments++;
+ vc->user_comments[vc->comments]=NULL;
+}
+
+void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents)
+{
+ char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
+ strcpy(comment, tag);
+ strcat(comment, "=");
+ strcat(comment, contents);
+ vorbis_comment_add(vc, comment);
+
+ return;
+}
+
+int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op)
+{
+ oggpack_buffer opb;
+
+ oggpack_writeinit(&opb);
+ if(_vorbis_pack_comment(&opb,vc)){
+ oggpack_writeclear(&opb);
+ return OV_EIMPL;
+ }
+
+ op->packet = _ogg_malloc(oggpack_bytes(&opb));
+ memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
+
+ op->bytes=oggpack_bytes(&opb);
+ op->b_o_s=0;
+ op->e_o_s=0;
+ op->granulepos=0;
+ op->packetno=1;
+
+ oggpack_writeclear(&opb);
+ return 0;
+}
--- a/m4/vorbis.m4
+++ b/m4/vorbis.m4
@@ -38,9 +38,9 @@ if test "x$vorbis_prefix" != "x$ogg_pref
@@ -144,12 +154,3 @@
#
# check if the installed Ogg is sufficiently new.
@@ -42,7 +42,7 @@ LIBS="$LIBS $OGG_LIBS"
LDFLAGS="$LDFLAGS $OGG_LDFLAGS"
AC_TRY_LINK_FUNC(ogg_sync_init,
[ xt_cv_lib_ogg=ok ],
- [ AC_TRY_LINK([#include <ogg/ogg.h>],,
+ [ AC_TRY_LINK([#include <tremor/ogg.h>],,
[ xt_cv_lib_ogg="pre v1.0, needs updating" ],
[ xt_cv_lib_ogg="not found" ])
])