Skip to content
Commits on Source (6)
examples/dvb_ecmg
examples/dvb_ecmg_test
examples/dvb_gen_si
examples/dvb_print_si
examples/mpeg_print_pcr
examples/mpeg_restamp
examples/rtp_check_seqnum
/bitstream
/bitstream.pc
/examples/dvb_ecmg
/examples/dvb_ecmg_test
/examples/dvb_gen_si
/examples/dvb_print_si
/examples/mpeg_print_pcr
/examples/mpeg_restamp
/examples/rtp_check_seqnum
PREFIX ?= /usr/local
INCLUDE = $(subst //,/,$(DESTDIR)/$(PREFIX)/include/bitstream)
INCLUDEDIR = $(PREFIX)/include
LIBDIR = $(PREFIX)/lib
INCLUDE = $(DESTDIR)$(INCLUDEDIR)/bitstream
PKGCONFIG = $(DESTDIR)$(LIBDIR)/pkgconfig
VERSION = 1.2
all:
@echo "Run \"make install\" to install biTStream into $(INCLUDE)"
ln -nsf .. examples/bitstream
$(MAKE) -C examples
install:
bitstream.pc: bitstream.pc.in
@echo "GEN $@"
@sed -e 's|@PREFIX@|$(PREFIX)|' \
-e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \
-e 's|@VERSION@|$(VERSION)|' \
$< > $@
install: bitstream.pc
@echo "INSTALL $(INCLUDE)"
@install -d $(INCLUDE)
@install -m 644 common.h $(INCLUDE)/
......@@ -29,12 +40,42 @@ install:
@install -m 644 scte/*.h $(INCLUDE)/scte
@install -d $(INCLUDE)/smpte
@install -m 644 smpte/*.h $(INCLUDE)/smpte
@echo "INSTALL $(PKGCONFIG)/bitstream.pc"
@install -d $(PKGCONFIG)
@install -m 644 bitstream.pc $(PKGCONFIG)
uninstall:
@echo "REMOVE $(INCLUDE)"
@rm -rf $(INCLUDE)
@$(RM) -r $(INCLUDE)
@echo "REMOVE $(PKGCONFIG)/bitstream.pc"
@$(RM) $(PKGCONFIG)/bitstream.pc
dist:
git archive --format=tar --prefix=bitstream-$(VERSION)/ master | bzip2 -9 > bitstream-$(VERSION).tar.bz2
git archive --format=tar --prefix=bitstream-$(VERSION)/ master | \
bzip2 -9 > bitstream-$(VERSION).tar.bz2
clean:
$(RM) bitstream bitstream.pc
$(MAKE) -C examples clean
# if you want to check only particular headers,
# use make check HEADER_LIST="dvb/sim.h ietf/rtp.h"
HEADER_LIST = $$(find * -name '*.h')
FLAGS = -I. -Werror -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wformat=2
compiler_c = $(CC) $(FLAGS) $(CFLAGS)
compiler_c++ = $(CXX) $(FLAGS) $(CXXFLAGS)
compile = $(compiler_$1) -include "$$header" -c -x $1 /dev/null -o /dev/null
check:
@ln -nsf . bitstream
@for header in $(HEADER_LIST); do \
$(if $(V),set -x;) \
$(call compile,c) || exit 1; \
$(call compile,c++) || exit 1; \
echo "PASS: $$header"; \
done
.PHONY: install uninstall distcheck
.PHONY: all install uninstall dist clean check
prefix=@PREFIX@
includedir=@INCLUDEDIR@
Name: bitstream
Description: Binary structures for MPEG, DVB, IETF, SMPTE, IEEE, SCTE, etc.
Version: @VERSION@
Cflags: -I${includedir}
......@@ -124,7 +124,7 @@ static inline uint32_t dvb_time_encode_duration(unsigned int duration_sec)
}
#undef dec2bcd
static time_t dvb_time_format_UTC(uint64_t UTC_time, struct tm *tm, char *output) {
static inline time_t dvb_time_format_UTC(uint64_t UTC_time, struct tm *tm, char *output) {
struct tm tm_local;
if (tm == NULL)
tm = &tm_local;
......
......@@ -128,14 +128,14 @@ static inline void desc44_print(const uint8_t *p_desc, f_print pf_print,
switch (i_print_type) {
case PRINT_XML:
pf_print(opaque,
"<CABLE_DESC frequency=\"%"PRIu64"\" fecouter=\"%s\" modulation=\"%s\" symbolrate=\"%u\" fecinner=\"%s\"/>",
"<CABLE_DESC frequency=\"%" PRIu64 "\" fecouter=\"%s\" modulation=\"%s\" symbolrate=\"%u\" fecinner=\"%s\"/>",
desc44_get_frequency(p_desc), psz_fecouter, psz_modulation,
desc44_get_symbolrate(p_desc),
dvb_delivery_get_fec(desc43_get_fecinner(p_desc)));
break;
default:
pf_print(opaque,
" - desc 44 dvb-c frequency=%"PRIu64" Hz fecouter=%s modulation=%s symbolrate=%u fecinner=%s",
" - desc 44 dvb-c frequency=%" PRIu64 " Hz fecouter=%s modulation=%s symbolrate=%u fecinner=%s",
desc44_get_frequency(p_desc), psz_fecouter, psz_modulation,
desc44_get_symbolrate(p_desc),
dvb_delivery_get_fec(desc43_get_fecinner(p_desc)));
......
......@@ -247,7 +247,7 @@ static inline void desc5a_print(const uint8_t *p_desc, f_print pf_print,
switch (i_print_type) {
case PRINT_XML:
pf_print(opaque,
"<TERRESTRIAL_DESC frequency=\"%"PRIu64"\" bandwidth=\"%u\" priority=\"%s\" timeslicing=\"%d\" mpefec=\"%d\" constellation=\"%s\" hierarchy=\"%s\" coderatehp=\"%s\" coderatelp=\"%s\" guard=\"%s\" transmission=\"%s\" otherfrequency=\"%d\"/>",
"<TERRESTRIAL_DESC frequency=\"%" PRIu64 "\" bandwidth=\"%u\" priority=\"%s\" timeslicing=\"%d\" mpefec=\"%d\" constellation=\"%s\" hierarchy=\"%s\" coderatehp=\"%s\" coderatelp=\"%s\" guard=\"%s\" transmission=\"%s\" otherfrequency=\"%d\"/>",
desc5a_get_frequency(p_desc), i_bandwidth,
desc5a_get_priority(p_desc) ? "HP" : "LP",
desc5a_get_timeslicing(p_desc) ? 1 : 0,
......@@ -260,7 +260,7 @@ static inline void desc5a_print(const uint8_t *p_desc, f_print pf_print,
break;
default:
pf_print(opaque,
" - desc 5a dvb-t frequency=%"PRIu64" Hz bandwidth=%u MHz priority=%s timeslicing=%d mpefec=%d constellation=%s hierarchy=%s coderatehp=%s coderatelp=%s guard=%s transmission=%s otherfrequency=%d",
" - desc 5a dvb-t frequency=%" PRIu64 " Hz bandwidth=%u MHz priority=%s timeslicing=%d mpefec=%d constellation=%s hierarchy=%s coderatehp=%s coderatelp=%s guard=%s transmission=%s otherfrequency=%d",
desc5a_get_frequency(p_desc), i_bandwidth,
desc5a_get_priority(p_desc) ? "HP" : "LP",
desc5a_get_timeslicing(p_desc) ? 1 : 0,
......
......@@ -203,9 +203,9 @@ static inline bool intf##_append_##name(uint8_t *p_tlv, type i_##name) \
static inline type intf##_find_##name(uint8_t *p_tlv, uint16_t n) \
{ \
const uint8_t *p_tlv_n = tlv_find_param(p_tlv, param, n); \
type i_##name = (type)(p_tlv_n[4]) << 8 * (sizeof(type) - 1); \
type i_##name = 0; \
int i; \
for (i = 1; i < sizeof(type); i++) \
for (i = 0; i < sizeof(type); i++) \
i_##name |= (utype)(p_tlv_n[4 + i]) << 8 * (sizeof(type) - i - 1); \
return i_##name; \
}
......
CFLAGS = -Wall -O2 -g
CFLAGS_LOCAL = -Wall -O2 -g -I. -I../..
LDFLAGS = -lrt
PREFIX ?= /usr/local
WARN = -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare
CPPFLAGS = -I.
CFLAGS := $(WARN) -O2 -g $(CFLAGS)
LDFLAGS := -lrt $(LDFLAGS)
OBJ = dvb_print_si dvb_gen_si dvb_ecmg dvb_ecmg_test mpeg_print_pcr rtp_check_seqnum mpeg_restamp
ifeq "$(shell uname -s)" "Darwin"
LDFLAGS += -liconv
LDLIBS += -liconv
# Prevent generation of .dSYM debug directories
CFLAGS += -gstabs
CFLAGS_LOCAL += -gstabs
endif
all: $(OBJ)
%: %.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS)
local: CFLAGS = $(CFLAGS_LOCAL)
local: all
install: $(OBJ)
install -d "$(DESTDIR)$(PREFIX)/bin"
install -m 755 $(OBJ) "$(DESTDIR)$(PREFIX)/bin"
clean:
rm -rf $(OBJ)
$(RM) $(OBJ)
#!/bin/sh
# Test if each header can be used standalone
# Copyright (C) 2011 Unix Solutions Ltd.
#
# License: MIT
# Authors: Georgi Chorbadzhiyski <georgi@unixsol.org>
#
HEADER_LIST="dvb/sim.h ietf/rtp.h"
# Find is used in such a way in order to work on OS X as well as Linux
# If you want to test only particular headers comment the line bellow
HEADER_LIST=$(find * | grep \\.h$ | sort | sed -e 's|^\./||')
for suffix in "c" "cpp"
do
case $suffix in
"cpp")
compiler="g++"
;;
*)
compiler="gcc"
;;
esac
for HDR in $HEADER_LIST
do
test_file=$(echo $HDR | sed -e 's|/|_|g;s|\.h$||')
echo "Testing ($compiler): $HDR"
printf "#include \"$HDR\"\n\nint main(void) { return 0; }\n" > $test_file.$suffix
$compiler -I.. -Werror -Wall -Wextra -Wno-unused -Wno-sign-compare -Wformat-security $test_file.$suffix -o $test_file
[ $? != 0 ] && exit 1
rm $test_file $test_file.$suffix
done
done
......@@ -62,12 +62,12 @@ static inline void scte35_null_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"null\" pts_adjustment=\"%"PRIu64"\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"null\" pts_adjustment=\"%" PRIu64 "\">",
SCTE35_NULL_COMMAND, i_pts_adjustment);
break;
default:
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=null pts_adjustment=%"PRIu64,
"new SCTE35 command=%" PRIu8 " command_str=null pts_adjustment=%" PRIu64,
SCTE35_NULL_COMMAND, i_pts_adjustment);
}
}
......@@ -82,12 +82,12 @@ static inline void scte35_insert_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"insert\" pts_adjustment=\"%"PRIu64"\" event_id=\"%"PRIu32"\" cancel=\"1\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"insert\" pts_adjustment=\"%" PRIu64 "\" event_id=\"%" PRIu32 "\" cancel=\"1\">",
SCTE35_INSERT_COMMAND, i_pts_adjustment, i_event_id);
break;
default:
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=insert pts_adjustment=%"PRIu64" event_id=%"PRIu32" cancel=true",
"new SCTE35 command=%" PRIu8 " command_str=insert pts_adjustment=%" PRIu64 " event_id=%" PRIu32 " cancel=true",
SCTE35_INSERT_COMMAND, i_pts_adjustment, i_event_id);
}
return;
......@@ -113,12 +113,12 @@ static inline void scte35_insert_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
snprintf(psz_duration, 255,
" auto_return=\"%d\" duration=\"%"PRIu64"\"",
" auto_return=\"%d\" duration=\"%" PRIu64 "\"",
b_auto_return ? 1 : 0, i_duration);
break;
default:
snprintf(psz_duration, 255,
" auto_return=%s duration=%"PRIu64"",
" auto_return=%s duration=%" PRIu64 "",
b_auto_return ? "true" : "false", i_duration);
}
}
......@@ -157,11 +157,11 @@ static inline void scte35_insert_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
snprintf(psz_splice_time, 255, " splice_time=\"%"PRIu64"\"",
snprintf(psz_splice_time, 255, " splice_time=\"%" PRIu64 "\"",
i_pts_time);
break;
default:
snprintf(psz_splice_time, 255, " splice_time=%"PRIu64"",
snprintf(psz_splice_time, 255, " splice_time=%" PRIu64 "",
i_pts_time);
}
}
......@@ -170,14 +170,14 @@ static inline void scte35_insert_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"insert\" pts_adjustment=\"%"PRIu64"\" event_id=\"%"PRIu32"\" cancel=\"0\" out_of_network=\"%d\" program_splice=\"%d\"%s%s unique_program_id=\"%"PRIu16"\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"insert\" pts_adjustment=\"%" PRIu64 "\" event_id=\"%" PRIu32 "\" cancel=\"0\" out_of_network=\"%d\" program_splice=\"%d\"%s%s unique_program_id=\"%" PRIu16 "\">",
SCTE35_INSERT_COMMAND, i_pts_adjustment, i_event_id,
b_out_of_network ? 1 : 0, b_program_splice ? 1 : 0,
psz_splice_time, psz_duration, i_unique_program_id);
break;
default:
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=insert pts_adjustment=%"PRIu64" event_id=%"PRIu32" cancel=false out_of_network=%s program_splice=%s%s%s unique_program_id=%"PRIu16,
"new SCTE35 command=%" PRIu8 " command_str=insert pts_adjustment=%" PRIu64 " event_id=%" PRIu32 " cancel=false out_of_network=%s program_splice=%s%s%s unique_program_id=%" PRIu16,
SCTE35_INSERT_COMMAND, i_pts_adjustment, i_event_id,
b_out_of_network ? "true" : "false",
b_program_splice ? "true" : "false",
......@@ -195,23 +195,23 @@ static inline void scte35_time_signal_print(const uint8_t *p_scte35,
case PRINT_XML:
if (scte35_splice_time_has_time_specified(p_splice_time))
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"time_signal\" pts_adjustment=\"%"PRIu64"\" splice_time=\"%"PRIu64"\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"time_signal\" pts_adjustment=\"%" PRIu64 "\" splice_time=\"%" PRIu64 "\">",
SCTE35_TIME_SIGNAL_COMMAND, i_pts_adjustment,
scte35_splice_time_get_pts_time(p_splice_time));
else
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"time_signal\" pts_adjustment=\"%"PRIu64"\" splice_time=\"undefined\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"time_signal\" pts_adjustment=\"%" PRIu64 "\" splice_time=\"undefined\">",
SCTE35_TIME_SIGNAL_COMMAND, i_pts_adjustment);
break;
default:
if (scte35_splice_time_has_time_specified(p_splice_time))
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=time_signal pts_adjustment=%"PRIu64" splice_time=%"PRIu64,
"new SCTE35 command=%" PRIu8 " command_str=time_signal pts_adjustment=%" PRIu64 " splice_time=%" PRIu64,
SCTE35_TIME_SIGNAL_COMMAND, i_pts_adjustment,
scte35_splice_time_get_pts_time(p_splice_time));
else
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=time_signal pts_adjustment=%"PRIu64" splice_time=undefined",
"new SCTE35 command=%" PRIu8 " command_str=time_signal pts_adjustment=%" PRIu64 " splice_time=undefined",
SCTE35_TIME_SIGNAL_COMMAND, i_pts_adjustment);
}
}
......@@ -225,12 +225,12 @@ static inline void scte35_private_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"private\" pts_adjustment=\"%"PRIu64"\" identifier=\"%"PRIu32"\" />",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"private\" pts_adjustment=\"%" PRIu64 "\" identifier=\"%" PRIu32 "\" />",
SCTE35_PRIVATE_COMMAND, i_pts_adjustment, i_identifier);
break;
default:
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=private pts_adjustment=%"PRIu64" identifier=%"PRIu32,
"new SCTE35 command=%" PRIu8 " command_str=private pts_adjustment=%" PRIu64 " identifier=%" PRIu32,
SCTE35_PRIVATE_COMMAND, i_pts_adjustment, i_identifier);
}
}
......@@ -268,12 +268,12 @@ static inline void scte35_print(const uint8_t *p_scte35,
switch (i_print_type) {
case PRINT_XML:
pf_print(print_opaque,
"<SCTE35 command=\"%"PRIu8"\" command_str=\"%s\" pts_adjustment=\"%"PRIu64"\">",
"<SCTE35 command=\"%" PRIu8 "\" command_str=\"%s\" pts_adjustment=\"%" PRIu64 "\">",
i_type, scte35_get_command_type_txt(i_type), i_pts_adjustment);
break;
default:
pf_print(print_opaque,
"new SCTE35 command=%"PRIu8" command_str=%s pts_adjustment=%"PRIu64,
"new SCTE35 command=%" PRIu8 " command_str=%s pts_adjustment=%" PRIu64,
i_type, scte35_get_command_type_txt(i_type), i_pts_adjustment);
}
}
......