]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
move sbuf definitions to sbuf.h
authorJaroslav Kysela <perex@perex.cz>
Tue, 28 Nov 2017 16:53:16 +0000 (17:53 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sun, 3 Dec 2017 16:29:06 +0000 (17:29 +0100)
src/download.h
src/epgdb.c
src/imagecache.c
src/parsers/parser_avc.h
src/parsers/parser_hevc.c
src/sbuf.h [new file with mode: 0644]
src/service.h
src/tvheadend.h
src/utils.c

index 8c791174a89dd4e3174128e5585dee15e7a02589..9f1f1dd9cb67aa9e0e470cd06e19a89a30702bb3 100644 (file)
@@ -21,6 +21,7 @@
 #define __DOWNLOAD__
 
 #include "http.h"
+#include "sbuf.h"
 
 typedef struct download {
   int   subsys;
index 8457394c848bc32621e2260125ee8c0446a907ea..1acb961ea0413159f1f6708a44978a0a465f9a84 100644 (file)
@@ -26,7 +26,7 @@
 #include <setjmp.h>
 
 #include "tvheadend.h"
-#include "queue.h"
+#include "sbuf.h"
 #include "htsmsg_binary.h"
 #include "settings.h"
 #include "channels.h"
index fe8a8b2adf6715d3f3bc033d9fc8561eb5765255..b01d0ae1e0fe97237f9ebb02077e7840bef909a3 100644 (file)
@@ -32,7 +32,7 @@
 #include "tvheadend.h"
 #include "filebundle.h"
 #include "imagecache.h"
-#include "queue.h"
+#include "sbuf.h"
 #include "redblack.h"
 #include "notify.h"
 #include "prop.h"
index 96758ed9cfd826cc2866034feeea825b510e81a2..4ff0effa61252cdc59c97495e33be3f464dcdb1b 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "tvheadend.h"
 #include "packet.h"
+#include "sbuf.h"
 
 const uint8_t * avc_find_startcode(const uint8_t *p, const uint8_t *end);
 
index 5fa1b86b5e3a695742aaec9f5dc5e9e8c8f2c197..4354149a61c264cfc165ba922a81d662f635dd82 100644 (file)
@@ -37,6 +37,7 @@
  */
 
 #include "tvheadend.h"
+#include "sbuf.h"
 #include "parsers.h"
 #include "parser_hevc.h"
 #include "parser_avc.h"
diff --git a/src/sbuf.h b/src/sbuf.h
new file mode 100644 (file)
index 0000000..b59c194
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ *  Tvheadend - sbuf routines
+ *  Copyright (C) 2007 Andreas Ă–man
+ *  Copyright (C) 2014-2017 Jaroslav Kysela
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __TVH_SBUF_H
+#define __TVH_SBUF_H
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+/**
+ * Simple dynamically growing buffer
+ */
+typedef struct sbuf {
+  uint8_t *sb_data;
+  int      sb_ptr;
+  int      sb_size;
+  uint16_t sb_err;
+  uint8_t  sb_bswap;
+} sbuf_t;
+
+
+void sbuf_init(sbuf_t *sb);
+void sbuf_init_fixed(sbuf_t *sb, int len);
+
+void sbuf_free(sbuf_t *sb);
+
+void sbuf_reset(sbuf_t *sb, int max_len);
+void sbuf_reset_and_alloc(sbuf_t *sb, int len);
+
+static inline void sbuf_steal_data(sbuf_t *sb)
+{
+  sb->sb_data = NULL;
+  sb->sb_ptr = sb->sb_size = sb->sb_err = 0;
+}
+
+static inline void sbuf_err(sbuf_t *sb, int errors)
+{
+  sb->sb_err += errors;
+}
+
+void sbuf_alloc_(sbuf_t *sb, int len);
+
+static inline void sbuf_alloc(sbuf_t *sb, int len)
+{
+  if (sb->sb_ptr + len >= sb->sb_size)
+    sbuf_alloc_(sb, len);
+}
+
+void sbuf_realloc(sbuf_t *sb, int len);
+
+void sbuf_append(sbuf_t *sb, const void *data, int len);
+void sbuf_append_from_sbuf(sbuf_t *sb, sbuf_t *src);
+
+void sbuf_cut(sbuf_t *sb, int off);
+
+void sbuf_put_be32(sbuf_t *sb, uint32_t u32);
+void sbuf_put_be16(sbuf_t *sb, uint16_t u16);
+void sbuf_put_byte(sbuf_t *sb, uint8_t u8);
+
+ssize_t sbuf_read(sbuf_t *sb, int fd);
+
+static inline uint8_t sbuf_peek_u8(sbuf_t *sb, int off) { return sb->sb_data[off]; }
+static inline  int8_t sbuf_peek_s8(sbuf_t *sb, int off) { return sb->sb_data[off]; }
+uint16_t sbuf_peek_u16(sbuf_t *sb, int off);
+static inline int16_t sbuf_peek_s16(sbuf_t *sb, int off) { return sbuf_peek_u16(sb, off); }
+uint16_t sbuf_peek_u16le(sbuf_t *sb, int off);
+static inline int16_t sbuf_peek_s16le(sbuf_t *sb, int off) { return sbuf_peek_u16le(sb, off); }
+uint16_t sbuf_peek_u16be(sbuf_t *sb, int off);
+static inline int16_t sbuf_peek_s16be(sbuf_t *sb, int off) { return sbuf_peek_u16be(sb, off); }
+uint32_t sbuf_peek_u32(sbuf_t *sb, int off);
+static inline int32_t sbuf_peek_s32(sbuf_t *sb, int off) { return sbuf_peek_u32(sb, off); }
+uint32_t sbuf_peek_u32le(sbuf_t *sb, int off);
+static inline int32_t sbuf_peek_s32le(sbuf_t *sb, int off) { return sbuf_peek_u32le(sb, off); }
+uint32_t sbuf_peek_u32be(sbuf_t *sb, int off);
+static inline  int32_t sbuf_peek_s32be(sbuf_t *sb, int off) { return sbuf_peek_u32be(sb, off); }
+static inline uint8_t *sbuf_peek(sbuf_t *sb, int off) { return sb->sb_data + off; }
+
+#endif /* __TVH_SBUF_H */
index b80b4716a08a1da2e5e7d211a3f1a2d3269f64ce..ed31eb16e6d52fbfe0ea9c1192a412788f0ecbfc 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef SERVICE_H__
 #define SERVICE_H__
 
+#include "sbuf.h"
 #include "htsmsg.h"
 #include "idnode.h"
 #include "profile.h"
index ece6ee43350075fe957da2b6fd34c2618e0c8bdd..8f6dc19c9ae2090b235df6f8366594531304c0a5 100644 (file)
@@ -637,18 +637,6 @@ typedef struct streaming_queue {
 } streaming_queue_t;
 
 
-/**
- * Simple dynamically growing buffer
- */
-typedef struct sbuf {
-  uint8_t *sb_data;
-  int      sb_ptr;
-  int      sb_size;
-  uint16_t sb_err;
-  uint8_t  sb_bswap;
-} sbuf_t;
-
-
 streaming_component_type_t streaming_component_txt2type(const char *str);
 const char *streaming_component_type2txt(streaming_component_type_t s);
 streaming_component_type_t streaming_component_txt2type(const char *s);
@@ -778,67 +766,6 @@ static inline int64_t ts_rescale_inv(int64_t ts, int tb)
   return (ts * 90000LL) / tb;
 }
 
-void sbuf_init(sbuf_t *sb);
-
-void sbuf_init_fixed(sbuf_t *sb, int len);
-
-void sbuf_free(sbuf_t *sb);
-
-void sbuf_reset(sbuf_t *sb, int max_len);
-
-void sbuf_reset_and_alloc(sbuf_t *sb, int len);
-
-static inline void sbuf_steal_data(sbuf_t *sb)
-{
-  sb->sb_data = NULL;
-  sb->sb_ptr = sb->sb_size = sb->sb_err = 0;
-}
-
-static inline void sbuf_err(sbuf_t *sb, int errors)
-{
-  sb->sb_err += errors;
-}
-
-void sbuf_alloc_(sbuf_t *sb, int len);
-
-static inline void sbuf_alloc(sbuf_t *sb, int len)
-{
-  if (sb->sb_ptr + len >= sb->sb_size)
-    sbuf_alloc_(sb, len);
-}
-
-void sbuf_realloc(sbuf_t *sb, int len);
-
-void sbuf_append(sbuf_t *sb, const void *data, int len);
-
-void sbuf_append_from_sbuf(sbuf_t *sb, sbuf_t *src);
-
-void sbuf_cut(sbuf_t *sb, int off);
-
-void sbuf_put_be32(sbuf_t *sb, uint32_t u32);
-
-void sbuf_put_be16(sbuf_t *sb, uint16_t u16);
-
-void sbuf_put_byte(sbuf_t *sb, uint8_t u8);
-
-ssize_t sbuf_read(sbuf_t *sb, int fd);
-
-static inline uint8_t sbuf_peek_u8(sbuf_t *sb, int off) { return sb->sb_data[off]; }
-static inline  int8_t sbuf_peek_s8(sbuf_t *sb, int off) { return sb->sb_data[off]; }
-uint16_t sbuf_peek_u16(sbuf_t *sb, int off);
-static inline int16_t sbuf_peek_s16(sbuf_t *sb, int off) { return sbuf_peek_u16(sb, off); }
-uint16_t sbuf_peek_u16le(sbuf_t *sb, int off);
-static inline int16_t sbuf_peek_s16le(sbuf_t *sb, int off) { return sbuf_peek_u16le(sb, off); }
-uint16_t sbuf_peek_u16be(sbuf_t *sb, int off);
-static inline int16_t sbuf_peek_s16be(sbuf_t *sb, int off) { return sbuf_peek_u16be(sb, off); }
-uint32_t sbuf_peek_u32(sbuf_t *sb, int off);
-static inline int32_t sbuf_peek_s32(sbuf_t *sb, int off) { return sbuf_peek_u32(sb, off); }
-uint32_t sbuf_peek_u32le(sbuf_t *sb, int off);
-static inline int32_t sbuf_peek_s32le(sbuf_t *sb, int off) { return sbuf_peek_u32le(sb, off); }
-uint32_t sbuf_peek_u32be(sbuf_t *sb, int off);
-static inline  int32_t sbuf_peek_s32be(sbuf_t *sb, int off) { return sbuf_peek_u32be(sb, off); }
-static inline uint8_t *sbuf_peek(sbuf_t *sb, int off) { return sb->sb_data + off; }
-
 char *md5sum ( const char *str, int lowercase );
 
 int makedirs ( int subsys, const char *path, int mode, int mstrict, gid_t gid, uid_t uid );
index 2fd26761beb94c55cbc18f7b90678dde794fa2e8..53cf95bc2bd01423fcf32d655ea21af4c27910d3 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "tvheadend.h"
 #include "tvh_endian.h"
+#include "sbuf.h"
 
 /**
  * CRC32