diff -Nru gavl-1.2.0/configure gavl-1.4.0/configure --- gavl-1.2.0/configure 2011-01-08 00:49:49.000000000 +0000 +++ gavl-1.4.0/configure 2012-06-08 11:49:51.000000000 +0000 @@ -2980,7 +2980,7 @@ # Define the identity of the package. PACKAGE=gavl - VERSION=1.2.0 + VERSION=1.4.0 cat >>confdefs.h <<_ACEOF @@ -11369,11 +11369,9 @@ if test x$test_libpng = xtrue; then -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS LIBS="$LIBS -lpng -lm -lz" -CFLAGS="$CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5 $as_echo_n "checking for libpng... " >&6; } @@ -11402,12 +11400,10 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - PNG_LIBS=$LIBS; - PNG_CFLAGS=$CFLAGS ;; + PNG_LIBS=$LIBS;; false) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; }; PNG_LIBS=""; PNG_CFLAGS="";; esac -CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS fi diff -Nru gavl-1.2.0/configure.ac gavl-1.4.0/configure.ac --- gavl-1.2.0/configure.ac 2011-01-05 19:43:29.000000000 +0000 +++ gavl-1.4.0/configure.ac 2012-06-08 11:49:47.000000000 +0000 @@ -4,7 +4,7 @@ AM_CONFIG_HEADER(include/gavl/config.h) -AM_INIT_AUTOMAKE(gavl, 1.2.0) +AM_INIT_AUTOMAKE(gavl, 1.4.0) GAVL_VERSION=$VERSION diff -Nru gavl-1.2.0/debian/changelog gavl-1.4.0/debian/changelog --- gavl-1.2.0/debian/changelog 2012-01-17 18:10:00.000000000 +0000 +++ gavl-1.4.0/debian/changelog 2012-06-11 10:23:07.000000000 +0000 @@ -1,3 +1,24 @@ +gavl (1.4.0-1) unstable; urgency=low + + [ IOhannes m zmölnig ] + * New upstream release. + * Avoid empty lines within paragraph + * Removed vframefill_overflow.patch (no longer needed) + * Renamed patch 0002-ubuntu_armel_ftbfs.patch -> 0001-ubuntu_armel_ftbfs.patch + * debian/copyright: + - Use final DEP-5 format + - use 'Files:' rather than 'File:', even if it is only one + - Remove commas in 'Files:' section + * Bumped standards-version to 3.9.3 + * Updated symbols file for libgavl1 + + [ Alessio Treglia ] + * debian/copyright: + - Group files by license, sort and use short-indent style. + * debian/control: Needs debhelper >= 9. + + -- Alessio Treglia Mon, 11 Jun 2012 12:21:55 +0200 + gavl (1.2.0-4) unstable; urgency=low * Fix dh's sequence, use 'dh $@ --with foo' syntax. diff -Nru gavl-1.2.0/debian/control gavl-1.4.0/debian/control --- gavl-1.2.0/debian/control 2012-01-17 18:09:16.000000000 +0000 +++ gavl-1.4.0/debian/control 2012-06-11 10:02:34.000000000 +0000 @@ -8,11 +8,11 @@ Alessio Treglia DM-Upload-Allowed: yes Homepage: http://gmerlin.sourceforge.net/ -Standards-Version: 3.9.2 +Standards-Version: 3.9.3 Build-Depends: automake, autotools-dev, - debhelper (>= 8.1.3~), + debhelper (>= 9), dh-autoreconf, doxygen, libtool diff -Nru gavl-1.2.0/debian/copyright gavl-1.4.0/debian/copyright --- gavl-1.2.0/debian/copyright 2012-01-17 18:09:16.000000000 +0000 +++ gavl-1.4.0/debian/copyright 2012-06-11 10:01:18.000000000 +0000 @@ -1,4 +1,4 @@ -Format: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=200 +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Gmerlin Audio Video Library Upstream-Contact: Members of the Gmerlin project Source: http://sourceforge.net/projects/gmerlin/files/gavl/ @@ -6,67 +6,26 @@ Files: * Copyright: 2001-2011 Members of the Gmerlin project -License: GPL-2+ - -Files: gavl/memcpy.c -Copyright: 2001-2004 the xine project - 2001 - 2011 Members of the Gmerlin project] -License: GPL-2+ - -Files: gavl/mmx/mmx.h -Copyright: 2000-2001 Michel Lespinasse - 1999-2000 Aaron Holtzman -License: GPL-2+ - -Files: gavl/libgdither/* -Copyright: 2002 Steve Harris -License: GPL-2+ - -Files: gavl/libsamplerate/* -Copyright: 2001-2008 Erik de Castro Lopo -License: GPL-2+ - -File: include/float_cast.h -Copyright: 2001-2002 Erik de Castro Lopo -License: GPL-2+ - -Files: include/arith128.h, ./gavl/arith128.c -Copyright: 2001-2011 Members of the Gmerlin project - 2004 Linas Vepstas -License: GPL-2+ - -Files: include/samplerate.h -Copyright: 2002-2004 Erik de Castro Lopo -License: GPL-2+ - -Files: include/attributes.h -Copyright: 2000-2001 Michel Lespinasse - 1999-2000 Aaron Holtzman + 2001-2004 the xine project + 2004 Linas Vepstas + 2001-2008 Erik de Castro Lopo + 2002 Steve Harris + 2001-2002 Erik de Castro Lopo + 2000-2001 Michel Lespinasse + 1999-2000 Aaron Holtzman + 2000-2001 Michel Lespinasse + 1999-2000 Aaron Holtzman License: GPL-2+ Files: include/bswap.h Copyright: 2006 Michael Niedermayer License: LGPL-2.1+ - FFmpeg is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - FFmpeg 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with FFmpeg; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -X-Comment: On Debian systems, the complete text of the GNU Lesser General - Public License can be found in /usr/share/common-licenses/LGPL-2.1 file. Files: debian/* -Copyright: 2010-2012 Alessio Treglia - 2008-2009 Romain Beauxis - 2008 Christian Marillat +Copyright: + 2010-2012 Alessio Treglia + 2008-2009 Romain Beauxis + 2008 Christian Marillat License: GPL-2+ License: GPL-2+ @@ -80,9 +39,25 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Comment: - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +License: LGPL-2.1+ + FFmpeg is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + . + FFmpeg 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 + Lesser General Public License for more details. +Comment: + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2.1 file. + . + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . diff -Nru gavl-1.2.0/debian/libgavl1.symbols gavl-1.4.0/debian/libgavl1.symbols --- gavl-1.2.0/debian/libgavl1.symbols 2012-01-17 17:53:10.000000000 +0000 +++ gavl-1.4.0/debian/libgavl1.symbols 2012-06-11 09:54:31.000000000 +0000 @@ -45,7 +45,9 @@ gavl_channel_id_to_string@Base 1.1.0 gavl_channel_index@Base 1.1.0 gavl_chroma_placement_to_string@Base 1.1.0 + gavl_compression_constant_frame_samples@Base 1.4.0 gavl_compression_get_extension@Base 1.2.0 + gavl_compression_info_copy@Base 1.4.0 gavl_compression_info_dump@Base 1.2.0 gavl_compression_info_free@Base 1.2.0 gavl_compression_need_pixelformat@Base 1.2.0 @@ -79,6 +81,7 @@ gavl_frames_to_time@Base 1.1.0 gavl_front_channels@Base 1.1.0 gavl_get_color_channel_format@Base 1.1.2 + gavl_get_field_format@Base 1.4.0 gavl_get_pixelformat@Base 1.1.0 gavl_get_sample_format@Base 1.1.0 gavl_image_transform_create@Base 1.1.0 @@ -89,6 +92,24 @@ gavl_interlace_mode_to_string@Base 1.1.0 gavl_interleave_mode_to_string@Base 1.1.0 gavl_lfe_channels@Base 1.1.0 + gavl_metadata_copy@Base 1.4.0 + gavl_metadata_date_time_to_string@Base 1.4.0 + gavl_metadata_date_to_string@Base 1.4.0 + gavl_metadata_dump@Base 1.4.0 + gavl_metadata_equal@Base 1.4.0 + gavl_metadata_free@Base 1.4.0 + gavl_metadata_get@Base 1.4.0 + gavl_metadata_get_date@Base 1.4.0 + gavl_metadata_get_date_time@Base 1.4.0 + gavl_metadata_get_int@Base 1.4.0 + gavl_metadata_init@Base 1.4.0 + gavl_metadata_merge2@Base 1.4.0 + gavl_metadata_merge@Base 1.4.0 + gavl_metadata_set@Base 1.4.0 + gavl_metadata_set_date@Base 1.4.0 + gavl_metadata_set_date_time@Base 1.4.0 + gavl_metadata_set_int@Base 1.4.0 + gavl_metadata_set_nocpy@Base 1.4.0 gavl_num_pixelformats@Base 1.1.0 gavl_num_sample_formats@Base 1.1.0 gavl_overlay_blend@Base 1.1.0 diff -Nru gavl-1.2.0/debian/patches/0001-ubuntu_armel_ftbfs.patch gavl-1.4.0/debian/patches/0001-ubuntu_armel_ftbfs.patch --- gavl-1.2.0/debian/patches/0001-ubuntu_armel_ftbfs.patch 1970-01-01 00:00:00.000000000 +0000 +++ gavl-1.4.0/debian/patches/0001-ubuntu_armel_ftbfs.patch 2012-06-11 09:54:31.000000000 +0000 @@ -0,0 +1,18 @@ +Description: Fix build failure on Ubuntu armel. +Bug-Ubuntu: https://launchpad.net/bugs/704027 +Author: Alessio Treglia +--- + src/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- gavl.orig/src/Makefile.am ++++ gavl/src/Makefile.am +@@ -30,7 +30,7 @@ benchmark_LDADD = ../gavl/libgavl.la @RT + + + volume_test_SOURCES = volume_test.c +-volume_test_LDADD = ../gavl/libgavl.la ++volume_test_LDADD = -lm ../gavl/libgavl.la + + dump_frame_table_SOURCES = dump_frame_table.c + dump_frame_table_LDADD = ../gavl/libgavl.la diff -Nru gavl-1.2.0/debian/patches/0001-vframefill_overflow.patch gavl-1.4.0/debian/patches/0001-vframefill_overflow.patch --- gavl-1.2.0/debian/patches/0001-vframefill_overflow.patch 2012-01-17 17:53:10.000000000 +0000 +++ gavl-1.4.0/debian/patches/0001-vframefill_overflow.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Author: Cristian Morales Vega -Description: fixes array-out-of-bounds access in gavl_video_frame_fill() ---- gavl.orig/gavl/videoframe.c -+++ gavl/gavl/videoframe.c -@@ -1510,7 +1510,7 @@ - uint16_t packed_16; - uint8_t packed_32[4]; - uint16_t packed_64[4]; -- float color_float[2]; -+ float color_float[4]; - - gavl_init_memcpy(); - diff -Nru gavl-1.2.0/debian/patches/0002-ubuntu_armel_ftbfs.patch gavl-1.4.0/debian/patches/0002-ubuntu_armel_ftbfs.patch --- gavl-1.2.0/debian/patches/0002-ubuntu_armel_ftbfs.patch 2012-01-17 17:53:10.000000000 +0000 +++ gavl-1.4.0/debian/patches/0002-ubuntu_armel_ftbfs.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -Description: Fix build failure on Ubuntu armel. -Bug-Ubuntu: https://launchpad.net/bugs/704027 -Author: Alessio Treglia ---- - src/Makefile.am | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- gavl.orig/src/Makefile.am -+++ gavl/src/Makefile.am -@@ -30,7 +30,7 @@ benchmark_LDADD = ../gavl/libgavl.la @RT - - - volume_test_SOURCES = volume_test.c --volume_test_LDADD = ../gavl/libgavl.la -+volume_test_LDADD = -lm ../gavl/libgavl.la - - dump_frame_table_SOURCES = dump_frame_table.c - dump_frame_table_LDADD = ../gavl/libgavl.la diff -Nru gavl-1.2.0/debian/patches/series gavl-1.4.0/debian/patches/series --- gavl-1.2.0/debian/patches/series 2012-01-17 17:53:10.000000000 +0000 +++ gavl-1.4.0/debian/patches/series 2012-06-11 09:54:31.000000000 +0000 @@ -1,2 +1 @@ -0001-vframefill_overflow.patch -0002-ubuntu_armel_ftbfs.patch +0001-ubuntu_armel_ftbfs.patch diff -Nru gavl-1.2.0/doc/Doxyfile.in gavl-1.4.0/doc/Doxyfile.in --- gavl-1.2.0/doc/Doxyfile.in 2010-03-10 15:46:22.000000000 +0000 +++ gavl-1.4.0/doc/Doxyfile.in 2012-06-08 11:49:47.000000000 +0000 @@ -424,7 +424,7 @@ # directories like "/usr/src/myproject". Separate the files or directories # with spaces. -INPUT = @TOP_SRCDIR@/doc/mainpage.incl @TOP_SRCDIR@/include/gavl/timecode.h @TOP_SRCDIR@/include/gavl/gavl.h @TOP_SRCDIR@/include/gavl/gavltime.h @TOP_SRCDIR@/include/gavl/gavldsp.h @TOP_SRCDIR@/include/gavl/compression.h +INPUT = @TOP_SRCDIR@/doc/mainpage.incl @TOP_SRCDIR@/include/gavl/timecode.h @TOP_SRCDIR@/include/gavl/gavl.h @TOP_SRCDIR@/include/gavl/gavltime.h @TOP_SRCDIR@/include/gavl/gavldsp.h @TOP_SRCDIR@/include/gavl/compression.h @TOP_SRCDIR@/include/gavl/metadata.h @TOP_SRCDIR@/include/gavl/metatags.h # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff -Nru gavl-1.2.0/gavl/audioconverter.c gavl-1.4.0/gavl/audioconverter.c --- gavl-1.2.0/gavl/audioconverter.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/audioconverter.c 2012-06-08 11:49:47.000000000 +0000 @@ -71,8 +71,8 @@ cnv->contexts = ctx; } cnv->num_conversions = 0; - cnv->contexts = (gavl_audio_convert_context_t*)0; - cnv->last_context = (gavl_audio_convert_context_t*)0; + cnv->contexts = NULL; + cnv->last_context = NULL; } void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv) diff -Nru gavl-1.2.0/gavl/audioformat.c gavl-1.4.0/gavl/audioformat.c --- gavl-1.2.0/gavl/audioformat.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/audioformat.c 2012-06-08 11:49:47.000000000 +0000 @@ -49,7 +49,7 @@ if(format == sample_format_names[i].format) return sample_format_names[i].name; } - return (char*)0; + return NULL; } gavl_sample_format_t gavl_string_to_sample_format(const char * str) @@ -99,7 +99,7 @@ if(mode == interleave_mode_names[i].mode) return interleave_mode_names[i].name; } - return (char*)0; + return NULL; } static const struct @@ -150,7 +150,7 @@ if(id == channel_id_names[i].id) return channel_id_names[i].name; } - return (char*)0; + return NULL; } void gavl_audio_format_dump(const gavl_audio_format_t * f) diff -Nru gavl-1.2.0/gavl/blend.c gavl-1.4.0/gavl/blend.c --- gavl-1.2.0/gavl/blend.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/blend.c 2012-06-08 11:49:47.000000000 +0000 @@ -32,8 +32,8 @@ gavl_overlay_blend_context_t * ret; ret = calloc(1, sizeof(*ret)); - ret->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0); - ret->dst_win = gavl_video_frame_create((gavl_video_format_t*)0); + ret->ovl_win = gavl_video_frame_create(NULL); + ret->dst_win = gavl_video_frame_create(NULL); gavl_video_options_set_defaults(&ret->opt); @@ -71,7 +71,7 @@ { gavl_video_frame_null(ctx->ovl_win); gavl_video_frame_destroy(ctx->ovl_win); - ctx->ovl_win = (gavl_video_frame_t*)0; + ctx->ovl_win = NULL; ctx->has_overlay = 0; } @@ -95,7 +95,7 @@ dst_format->pixelformat, &ctx->ovl_format.pixelformat); - ctx->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0); + ctx->ovl_win = gavl_video_frame_create(NULL); gavl_video_format_copy(ovl_format, &ctx->ovl_format); return 1; } diff -Nru gavl-1.2.0/gavl/c/blend_c.c gavl-1.4.0/gavl/c/blend_c.c --- gavl-1.2.0/gavl/c/blend_c.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/gavl/c/blend_c.c 2012-06-08 11:49:46.000000000 +0000 @@ -23,6 +23,7 @@ #include #include +#include /* Switch on individual items in the colorspace tables / macros */ #define HAVE_YUVJ_TO_YUV_8 @@ -2142,7 +2143,7 @@ return blend_rgba_float; break; case GAVL_PIXELFORMAT_NONE: - return (gavl_blend_func_t)0; + return NULL; } - return (gavl_blend_func_t)0; + return NULL; } diff -Nru gavl-1.2.0/gavl/c/dsp_c.c gavl-1.4.0/gavl/c/dsp_c.c --- gavl-1.2.0/gavl/c/dsp_c.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/gavl/c/dsp_c.c 2012-06-08 11:49:46.000000000 +0000 @@ -539,7 +539,7 @@ while(--i) { tmp = *(src1++) + *(src2++); - *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647); + *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL); } } @@ -683,7 +683,7 @@ while(--i) { tmp = *(src1++) - *(src2++); - *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647); + *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL); } } diff -Nru gavl-1.2.0/gavl/colorspace.c gavl-1.4.0/gavl/colorspace.c --- gavl-1.2.0/gavl/colorspace.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/colorspace.c 2012-06-08 11:49:47.000000000 +0000 @@ -208,7 +208,7 @@ if(pixelformat_tab[i].pixelformat == pixelformat) return pixelformat_tab[i].name; } - return (const char*)0; + return NULL; } gavl_pixelformat_t gavl_string_to_pixelformat(const char * name) diff -Nru gavl-1.2.0/gavl/compression.c gavl-1.4.0/gavl/compression.c --- gavl-1.2.0/gavl/compression.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/compression.c 2012-06-08 11:49:47.000000000 +0000 @@ -20,6 +20,7 @@ * *****************************************************************/ #include #include +#include #include #include @@ -57,8 +58,9 @@ free(info->global_header); } -#define FLAG_SEPARATE (1<<0) -#define FLAG_NEEDS_PIXELFORMAT (1<<1) +#define FLAG_SEPARATE (1<<0) +#define FLAG_NEEDS_PIXELFORMAT (1<<1) +#define FLAG_CFS (1<<2) // Constant Frame Samples struct { @@ -72,11 +74,12 @@ /* Audio */ { GAVL_CODEC_ID_ALAW, NULL, "alaw" }, { GAVL_CODEC_ID_ULAW, NULL, "ulaw" }, - { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2" }, - { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3" }, - { GAVL_CODEC_ID_AC3, "ac3", "AC3" }, - { GAVL_CODEC_ID_AAC, NULL, "AAC" }, + { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2", FLAG_CFS }, + { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3", FLAG_CFS }, + { GAVL_CODEC_ID_AC3, "ac3", "AC3", FLAG_CFS }, + { GAVL_CODEC_ID_AAC, NULL, "AAC", FLAG_CFS }, { GAVL_CODEC_ID_VORBIS, NULL, "Vorbis" }, + { GAVL_CODEC_ID_FLAC, NULL, "Flac" }, /* Video */ { GAVL_CODEC_ID_JPEG, "jpg", "JPEG image", FLAG_SEPARATE | FLAG_NEEDS_PIXELFORMAT }, @@ -119,6 +122,17 @@ return 0; } +int gavl_compression_constant_frame_samples(gavl_codec_id_t id) + { + int i; + for(i = 0; i < sizeof(compression_ids)/sizeof(compression_ids[0]); i++) + { + if(compression_ids[i].id == id) + return !!(compression_ids[i].flags & FLAG_CFS); + } + return 0; + } + static const char * get_name(gavl_codec_id_t id) @@ -168,6 +182,19 @@ } GAVL_PUBLIC +void gavl_compression_info_copy(gavl_compression_info_t * dst, + const gavl_compression_info_t * src) + { + memcpy(dst, src, sizeof(*dst)); + if(src->global_header) + { + dst->global_header = malloc(src->global_header_len); + memcpy(dst->global_header, src->global_header, src->global_header_len); + } + } + + +GAVL_PUBLIC void gavl_packet_alloc(gavl_packet_t * p, int len) { if(len > p->data_alloc) diff -Nru gavl-1.2.0/gavl/dsputils.c gavl-1.4.0/gavl/dsputils.c --- gavl-1.2.0/gavl/dsputils.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/dsputils.c 2012-06-08 11:49:47.000000000 +0000 @@ -39,8 +39,7 @@ void (*interpolate)(const uint8_t * src_1, const uint8_t * src_2, - uint8_t * dst, int num, float fac) = - (void (*)(const uint8_t *, const uint8_t *, uint8_t *, int, float))0; + uint8_t * dst, int num, float fac) = NULL; num_planes = gavl_pixelformat_num_planes(format->pixelformat); gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); diff -Nru gavl-1.2.0/gavl/interleave.c gavl-1.4.0/gavl/interleave.c --- gavl-1.2.0/gavl/interleave.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/interleave.c 2012-06-08 11:49:47.000000000 +0000 @@ -205,7 +205,7 @@ } break; } - return (gavl_audio_func_t)0; + return NULL; } gavl_interleave_table_t * diff -Nru gavl-1.2.0/gavl/libgdither/gdither.c gavl-1.4.0/gavl/libgdither/gdither.c --- gavl-1.2.0/gavl/libgdither/gdither.c 2009-05-03 21:39:35.000000000 +0000 +++ gavl-1.4.0/gavl/libgdither/gdither.c 2012-06-08 11:49:47.000000000 +0000 @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: gdither.c,v 1.5 2009/05/03 21:39:35 gmerlin Exp $ + * $Id: gdither.c,v 1.5 2009-05-03 21:39:35 gmerlin Exp $ */ #include "gdither_types_internal.h" diff -Nru gavl-1.2.0/gavl/libgdither/gdither.h gavl-1.4.0/gavl/libgdither/gdither.h --- gavl-1.2.0/gavl/libgdither/gdither.h 2007-11-15 21:20:42.000000000 +0000 +++ gavl-1.4.0/gavl/libgdither/gdither.h 2012-06-08 11:49:47.000000000 +0000 @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: gdither.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ + * $Id: gdither.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ */ #ifndef GDITHER_H diff -Nru gavl-1.2.0/gavl/libgdither/gdither_types.h gavl-1.4.0/gavl/libgdither/gdither_types.h --- gavl-1.2.0/gavl/libgdither/gdither_types.h 2007-11-15 21:20:42.000000000 +0000 +++ gavl-1.4.0/gavl/libgdither/gdither_types.h 2012-06-08 11:49:47.000000000 +0000 @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: gdither_types.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ + * $Id: gdither_types.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ */ #ifndef GDITHER_TYPES_H diff -Nru gavl-1.2.0/gavl/libgdither/gdither_types_internal.h gavl-1.4.0/gavl/libgdither/gdither_types_internal.h --- gavl-1.2.0/gavl/libgdither/gdither_types_internal.h 2007-11-15 21:20:42.000000000 +0000 +++ gavl-1.4.0/gavl/libgdither/gdither_types_internal.h 2012-06-08 11:49:47.000000000 +0000 @@ -15,7 +15,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: gdither_types_internal.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ + * $Id: gdither_types_internal.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ */ #ifndef GDITHER_TYPES_H diff -Nru gavl-1.2.0/gavl/Makefile.am gavl-1.4.0/gavl/Makefile.am --- gavl-1.2.0/gavl/Makefile.am 2010-03-02 00:28:37.000000000 +0000 +++ gavl-1.4.0/gavl/Makefile.am 2012-06-08 11:49:47.000000000 +0000 @@ -71,6 +71,7 @@ frametable.c \ interleave.c \ memcpy.c \ +metadata.c \ mix.c \ peakdetector.c \ psnr.c \ diff -Nru gavl-1.2.0/gavl/Makefile.in gavl-1.4.0/gavl/Makefile.in --- gavl-1.2.0/gavl/Makefile.in 2011-01-08 00:49:50.000000000 +0000 +++ gavl-1.4.0/gavl/Makefile.in 2012-06-08 11:49:52.000000000 +0000 @@ -87,8 +87,8 @@ colorchannel.lo colorspace.lo compression.lo cputest.lo \ deinterlace.lo deinterlace_blend.lo deinterlace_copy.lo \ deinterlace_scale.lo dsp.lo dsputils.lo frametable.lo \ - interleave.lo memcpy.lo mix.lo peakdetector.lo psnr.lo \ - rectangle.lo sampleformat.lo samplerate.lo scale.lo \ + interleave.lo memcpy.lo metadata.lo mix.lo peakdetector.lo \ + psnr.lo rectangle.lo sampleformat.lo samplerate.lo scale.lo \ scale_context.lo scale_kernels.lo scale_table.lo ssim.lo \ time.lo timecode.lo timer.lo transform.lo transform_context.lo \ transform_table.lo video.lo videoformat.lo videoframe.lo \ @@ -331,6 +331,7 @@ frametable.c \ interleave.c \ memcpy.c \ +metadata.c \ mix.c \ peakdetector.c \ psnr.c \ @@ -474,6 +475,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frametable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleave.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcpy.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mix.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peakdetector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psnr.Plo@am__quote@ diff -Nru gavl-1.2.0/gavl/metadata.c gavl-1.4.0/gavl/metadata.c --- gavl-1.2.0/gavl/metadata.c 1970-01-01 00:00:00.000000000 +0000 +++ gavl-1.4.0/gavl/metadata.c 2012-06-08 11:49:47.000000000 +0000 @@ -0,0 +1,360 @@ +/***************************************************************** + * gavl - a general purpose audio/video processing library + * + * Copyright (c) 2001 - 2011 Members of the Gmerlin project + * gmerlin-general@lists.sourceforge.net + * http://gmerlin.sourceforge.net + * + * 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 2 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 . + * *****************************************************************/ + +#include +#include + +#include +#include +#include + +static char * my_strdup(const char * str) + { + char * ret; + int len = strlen(str) + 1; + + ret = malloc(len); + strncpy(ret, str, len); + return ret; + } + + +void +gavl_metadata_free(gavl_metadata_t * m) + { + int i; + for(i = 0; i < m->num_tags; i++) + { + free(m->tags[i].key); + free(m->tags[i].val); + } + if(m->tags) + free(m->tags); + gavl_metadata_init(m); + } + +void +gavl_metadata_copy(gavl_metadata_t * dst, + const gavl_metadata_t * src) + { + int i; + dst->tags = calloc(src->tags_alloc, sizeof(*dst->tags)); + + for(i = 0; i < src->num_tags; i++) + { + dst->tags[i].key = my_strdup(src->tags[i].key); + dst->tags[i].val = my_strdup(src->tags[i].val); + } + dst->tags_alloc = src->tags_alloc; + dst->num_tags = src->num_tags; + } + + +void +gavl_metadata_init(gavl_metadata_t * m) + { + memset(m, 0, sizeof(*m)); + } + + +static int find_tag(const gavl_metadata_t * m, const char * key) + { + int i; + for(i = 0; i < m->num_tags; i++) + { + if(!strcmp(m->tags[i].key, key)) + return i; + } + return -1; + } + +void +gavl_metadata_set(gavl_metadata_t * m, + const char * key, + const char * val_c) + { + char * val; + if(val_c && (*val_c != '\0')) + val = my_strdup(val_c); + else + val = NULL; + gavl_metadata_set_nocpy(m, key, val); + } + + +void +gavl_metadata_set_nocpy(gavl_metadata_t * m, + const char * key, + char * val) + { + int idx = find_tag(m, key); + + if(idx >= 0) // Tag exists + { + if(m->tags[idx].val) + free(m->tags[idx].val); + if(val && (*val != '\0')) // Replace tag + m->tags[idx].val = val; + else // Delete tag + { + if(idx < (m->num_tags - 1)) + { + memmove(m->tags + idx, m->tags + idx + 1, + (m->num_tags - 1 - idx) * sizeof(*m->tags)); + } + m->num_tags--; + } + } + else + { + if(val && (*val != '\0')) // Add new tag + { + if(m->num_tags + 1 > m->tags_alloc) + { + m->tags_alloc = m->num_tags + 16; + m->tags = realloc(m->tags, + m->tags_alloc * sizeof(*m->tags)); + } + m->tags[m->num_tags].key = my_strdup(key); + m->tags[m->num_tags].val = val; + m->num_tags++; + } + } + } + +#define STR_SIZE 128 + +void +gavl_metadata_set_int(gavl_metadata_t * m, + const char * key, + int val) + { + char str[STR_SIZE]; + snprintf(str, STR_SIZE, "%d", val); + gavl_metadata_set(m, key, str); + } + +#undef STR_SIZE + +const char * gavl_metadata_get(const gavl_metadata_t * m, + const char * key) + { + int idx = find_tag(m, key); + if(idx < 0) + return NULL; + return m->tags[idx].val; + } + + +int gavl_metadata_get_int(const gavl_metadata_t * m, + const char * key, int * ret) + { + char * rest; + const char * val_str = gavl_metadata_get(m, key); + if(!val_str) + return 0; + *ret = strtol(val_str, &rest, 10); + if(*rest != '\0') + return 0; + return 1; + } + +/* Time <-> String */ + +void +gavl_metadata_date_to_string(int year, + int month, + int day, char * ret) + { + snprintf(ret, GAVL_METADATA_DATE_STRING_LEN, + "%04d-%02d-%02d", year, month, day); + } + +void +gavl_metadata_date_time_to_string(int year, + int month, + int day, + int hour, + int minute, + int second, + char * ret) + { + snprintf(ret, GAVL_METADATA_DATE_TIME_STRING_LEN, + "%04d-%02d-%02d %02d:%02d:%02d", + year, month, day, hour, minute, second); + } + +void +gavl_metadata_set_date(gavl_metadata_t * m, + const char * key, + int year, + int month, + int day) + { + // YYYY-MM-DD + char buf[GAVL_METADATA_DATE_STRING_LEN]; + gavl_metadata_date_to_string(year, month, day, buf); + gavl_metadata_set(m, key, buf); + } + +void +gavl_metadata_set_date_time(gavl_metadata_t * m, + const char * key, + int year, + int month, + int day, + int hour, + int minute, + int second) + { + // YYYY-MM-DD HH:MM:SS + char buf[GAVL_METADATA_DATE_TIME_STRING_LEN]; + gavl_metadata_date_time_to_string(year, + month, + day, + hour, + minute, + second, + buf); + gavl_metadata_set(m, key, buf); + } + +GAVL_PUBLIC int +gavl_metadata_get_date(gavl_metadata_t * m, + const char * key, + int * year, + int * month, + int * day) + { + const char * val = gavl_metadata_get(m, key); + if(!val) + return 0; + + if(sscanf(val, "%04d-%02d-%02d", year, month, day) < 3) + return 0; + return 1; + } + +GAVL_PUBLIC int +gavl_metadata_get_date_time(gavl_metadata_t * m, + const char * key, + int * year, + int * month, + int * day, + int * hour, + int * minute, + int * second) + { + const char * val = gavl_metadata_get(m, key); + if(!val) + return 0; + + if(sscanf(val, "%04d-%02d-%02d %02d:%02d:%02d", + year, month, day, hour, minute, second) < 6) + return 0; + return 1; + } + + + +void gavl_metadata_merge(gavl_metadata_t * dst, + const gavl_metadata_t * src1, + const gavl_metadata_t * src2) + { + int i; + /* src1 has priority */ + for(i = 0; i < src1->num_tags; i++) + gavl_metadata_set(dst, src1->tags[i].key, src1->tags[i].val); + + /* From src2 we take only the tags, which aren't available */ + for(i = 0; i < src2->num_tags; i++) + { + if(!gavl_metadata_get(dst, src2->tags[i].key)) + gavl_metadata_set(dst, src2->tags[i].key, + src2->tags[i].val); + } + } + +void gavl_metadata_merge2(gavl_metadata_t * dst, + const gavl_metadata_t * src) + { + int i; + for(i = 0; i < src->num_tags; i++) + { + if(!gavl_metadata_get(dst, src->tags[i].key)) + gavl_metadata_set(dst, + src->tags[i].key, + src->tags[i].val); + } + } + +GAVL_PUBLIC void +gavl_metadata_dump(const gavl_metadata_t * m, int indent) + { + int len, i, j; + int max_key_len = 0; + + for(i = 0; i < m->num_tags; i++) + { + len = strlen(m->tags[i].key); + if(len > max_key_len) + max_key_len = len; + } + + for(i = 0; i < m->num_tags; i++) + { + len = strlen(m->tags[i].key); + + for(j = 0; j < indent; j++) + fprintf(stderr, " "); + + fprintf(stderr, "%s: ", m->tags[i].key); + + for(j = 0; j < max_key_len - len; j++) + fprintf(stderr, " "); + + fprintf(stderr, "%s\n", m->tags[i].val); + } + } + +int +gavl_metadata_equal(const gavl_metadata_t * m1, + const gavl_metadata_t * m2) + { + int i; + const char * val; + + /* Check if tags from m1 are present in m2 */ + for(i = 0; i < m1->num_tags; i++) + { + val = gavl_metadata_get(m2, m1->tags[i].key); + if(!val || strcmp(val, m1->tags[i].val)) + return 0; + } + + /* Check if tags from m2 are present in m1 */ + for(i = 0; i < m2->num_tags; i++) + { + if(!gavl_metadata_get(m1, m2->tags[i].key)) + return 0; + } + return 1; + } diff -Nru gavl-1.2.0/gavl/mix.c gavl-1.4.0/gavl/mix.c --- gavl-1.2.0/gavl/mix.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/mix.c 2012-06-08 11:49:47.000000000 +0000 @@ -150,9 +150,21 @@ // int output_side; int input_lfe; int output_lfe; - int in_index, out_index; + float center_level; + float rear_level; + + if(in->center_level > 0.0) + center_level = in->center_level; + else + center_level = 1.0; + + if(in->rear_level > 0.0) + rear_level = in->rear_level; + else + rear_level = 1.0; + input_front = gavl_front_channels(in); output_front = gavl_front_channels(out); @@ -362,7 +374,7 @@ OUT_INDEX(GAVL_CHID_FRONT_CENTER); IN_INDEX(GAVL_CHID_FRONT_CENTER); - ret[out_index][in_index] = in->center_level; + ret[out_index][in_index] = center_level; break; case 2: /* 3 Front -> 2 Front */ OUT_INDEX(GAVL_CHID_FRONT_LEFT); @@ -375,11 +387,11 @@ OUT_INDEX(GAVL_CHID_FRONT_LEFT); IN_INDEX(GAVL_CHID_FRONT_CENTER); - ret[out_index][in_index] = in->center_level; + ret[out_index][in_index] = center_level; OUT_INDEX(GAVL_CHID_FRONT_RIGHT); IN_INDEX(GAVL_CHID_FRONT_CENTER); - ret[out_index][in_index] = in->center_level; + ret[out_index][in_index] = center_level; break; case 3: /* 3 Front -> 3 Front */ OUT_INDEX(GAVL_CHID_FRONT_LEFT); @@ -558,17 +570,17 @@ case 1: /* 1 Rear -> 1 Front */ OUT_INDEX(GAVL_CHID_FRONT_CENTER); IN_INDEX(GAVL_CHID_REAR_CENTER); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; break; case 2: /* 1 Rear -> 2 Front */ case 3: OUT_INDEX(GAVL_CHID_FRONT_LEFT); IN_INDEX(GAVL_CHID_REAR_CENTER); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; OUT_INDEX(GAVL_CHID_FRONT_RIGHT); IN_INDEX(GAVL_CHID_REAR_CENTER); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; break; } break; @@ -597,21 +609,21 @@ /* 2 Rear -> 1 Front */ OUT_INDEX(GAVL_CHID_FRONT_CENTER); IN_INDEX(GAVL_CHID_REAR_LEFT); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; OUT_INDEX(GAVL_CHID_FRONT_CENTER); IN_INDEX(GAVL_CHID_REAR_RIGHT); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; } else { OUT_INDEX(GAVL_CHID_FRONT_LEFT); IN_INDEX(GAVL_CHID_REAR_LEFT); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; OUT_INDEX(GAVL_CHID_FRONT_RIGHT); IN_INDEX(GAVL_CHID_REAR_RIGHT); - ret[out_index][in_index] = in->rear_level; + ret[out_index][in_index] = rear_level; break; } break; diff -Nru gavl-1.2.0/gavl/sampleformat.c gavl-1.4.0/gavl/sampleformat.c --- gavl-1.2.0/gavl/sampleformat.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/sampleformat.c 2012-06-08 11:49:47.000000000 +0000 @@ -594,7 +594,7 @@ case GAVL_SAMPLE_NONE: break; } - return (gavl_audio_func_t)0; + return NULL; } void gavl_destroy_sampleformat_table(gavl_sampleformat_table_t * t) diff -Nru gavl-1.2.0/gavl/scale.c gavl-1.4.0/gavl/scale.c --- gavl-1.2.0/gavl/scale.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/scale.c 2012-06-08 11:49:47.000000000 +0000 @@ -64,8 +64,8 @@ int i, j; ret = calloc(1, sizeof(*ret)); - ret->src = gavl_video_frame_create((gavl_video_format_t*)0); - ret->dst = gavl_video_frame_create((gavl_video_format_t*)0); + ret->src = gavl_video_frame_create(NULL); + ret->dst = gavl_video_frame_create(NULL); gavl_video_options_set_defaults(&ret->opt); diff -Nru gavl-1.2.0/gavl/scale_context.c gavl-1.4.0/gavl/scale_context.c --- gavl-1.2.0/gavl/scale_context.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/scale_context.c 2012-06-08 11:49:47.000000000 +0000 @@ -182,7 +182,7 @@ return tab->scale_float_x_4; break; } - return (gavl_video_scale_scanline_func)0; + return NULL; } static void get_minmax(gavl_pixelformat_t pixelformat, @@ -925,10 +925,10 @@ int h_radius_real; const float * h_coeffs_real; - float *h_c = (float*)0; + float *h_c = NULL; int v_radius_real; const float * v_coeffs_real; - float *v_c = (float*)0; + float *v_c = NULL; int src_width, src_height; /* Needed for generating the scale table */ diff -Nru gavl-1.2.0/gavl/scale_kernels.c gavl-1.4.0/gavl/scale_kernels.c --- gavl-1.2.0/gavl/scale_kernels.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/scale_kernels.c 2012-06-08 11:49:47.000000000 +0000 @@ -149,6 +149,6 @@ return get_weight_sinc; default: *num_points = 0; - return (gavl_video_scale_get_weight)0; + return NULL; } } diff -Nru gavl-1.2.0/gavl/scale_table.c gavl-1.4.0/gavl/scale_table.c --- gavl-1.2.0/gavl/scale_table.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/scale_table.c 2012-06-08 11:49:47.000000000 +0000 @@ -101,10 +101,10 @@ int i, j, src_index_min, src_index_nearest; double src_index_f; float widen_factor; - float * preblur_factors = (float*)0; + float * preblur_factors = NULL; int num_preblur_factors = 0; int num_tmp_factors = 0; - float * tmp_factors = (float*)0; + float * tmp_factors = NULL; gavl_video_scale_get_weight weight_func; diff -Nru gavl-1.2.0/gavl/timer.c gavl-1.4.0/gavl/timer.c --- gavl-1.2.0/gavl/timer.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/timer.c 2012-06-08 11:49:47.000000000 +0000 @@ -109,7 +109,14 @@ uint64_t gavl_benchmark_get_time(int config_flags) { struct timespec ts; +#if defined(CLOCK_PROCESS_CPUTIME_ID) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); +#elif defined(CLOCK_PROF) + clock_gettime(CLOCK_PROF, &ts); +#else + clockgettime(CLOCK_REALTIME, &ts); +#endif + return (uint64_t)(ts.tv_sec) * 1000000000 + ts.tv_nsec; } diff -Nru gavl-1.2.0/gavl/transform_context.c gavl-1.4.0/gavl/transform_context.c --- gavl-1.2.0/gavl/transform_context.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/transform_context.c 2012-06-08 11:49:47.000000000 +0000 @@ -124,7 +124,7 @@ return tab->transform_float_x_4; break; } - return (gavl_transform_scanline_func)0; + return NULL; } diff -Nru gavl-1.2.0/gavl/video.c gavl-1.4.0/gavl/video.c --- gavl-1.2.0/gavl/video.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/video.c 2012-06-08 11:49:47.000000000 +0000 @@ -58,7 +58,7 @@ free(cnv->first_context); cnv->first_context = ctx; } - cnv->last_context = (gavl_video_convert_context_t*)0; + cnv->last_context = NULL; cnv->num_contexts = 0; } diff -Nru gavl-1.2.0/gavl/videoformat.c gavl-1.4.0/gavl/videoformat.c --- gavl-1.2.0/gavl/videoformat.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/videoformat.c 2012-06-08 11:49:47.000000000 +0000 @@ -137,7 +137,7 @@ if(interlace_mode_tab[i].mode == mode) return interlace_mode_tab[i].name; } - return (const char*)0; + return NULL; } typedef const struct @@ -165,7 +165,7 @@ if(framerate_mode_tab[i].mode == mode) return framerate_mode_tab[i].name; } - return (const char*)0; + return NULL; } @@ -194,7 +194,7 @@ if(chroma_placement_tab[i].mode == mode) return chroma_placement_tab[i].name; } - return (const char*)0; + return NULL; } @@ -293,3 +293,24 @@ } return ret; } + +void gavl_get_field_format(const gavl_video_format_t * frame_format, + gavl_video_format_t * field_format, + int field) + { + gavl_video_format_copy(field_format, frame_format); + + field_format->image_height /= 2; + field_format->frame_height /= 2; + + if(frame_format->image_height % 2) + { + /* Top field gets an extra scanline */ + if(!field) + { + field_format->image_height++; + if(field_format->frame_height < field_format->image_height) + field_format->frame_height = field_format->image_height; + } + } + } diff -Nru gavl-1.2.0/gavl/videoframe.c gavl-1.4.0/gavl/videoframe.c --- gavl-1.2.0/gavl/videoframe.c 2011-01-07 15:30:15.000000000 +0000 +++ gavl-1.4.0/gavl/videoframe.c 2012-06-08 11:49:47.000000000 +0000 @@ -49,258 +49,65 @@ static void video_frame_alloc(gavl_video_frame_t * ret, const gavl_video_format_t * format, int align) { - switch(format->pixelformat) - { - case GAVL_GRAY_8: - ret->strides[0] = format->frame_width; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_GRAYA_16: - case GAVL_GRAY_16: - case GAVL_RGB_15: - case GAVL_BGR_15: - case GAVL_RGB_16: - case GAVL_BGR_16: - ret->strides[0] = format->frame_width*2; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGB_24: - case GAVL_BGR_24: - ret->strides[0] = format->frame_width*3; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGB_32: - case GAVL_BGR_32: - case GAVL_YUVA_32: - case GAVL_GRAYA_32: - ret->strides[0] = format->frame_width*4; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGBA_32: - ret->strides[0] = format->frame_width*4; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGB_48: - ret->strides[0] = format->frame_width*6; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGBA_64: - case GAVL_YUVA_64: - ret->strides[0] = format->frame_width*8; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_GRAY_FLOAT: - ret->strides[0] = format->frame_width*sizeof(float); - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_GRAYA_FLOAT: - ret->strides[0] = 2*format->frame_width*sizeof(float); - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - - case GAVL_RGB_FLOAT: - case GAVL_YUV_FLOAT: - ret->strides[0] = format->frame_width*3*sizeof(float); - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_RGBA_FLOAT: - case GAVL_YUVA_FLOAT: - ret->strides[0] = format->frame_width*4*sizeof(float); - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_YUY2: - case GAVL_UYVY: - ret->strides[0] = format->frame_width*2; - if(align) - ALIGN(ret->strides[0]); - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0] * format->frame_height); - break; - case GAVL_YUV_420_P: - case GAVL_YUVJ_420_P: - ret->strides[0] = format->frame_width; - ret->strides[1] = (format->frame_width+1)/2; - ret->strides[2] = (format->frame_width+1)/2; - - if(align) - { - ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*((format->frame_height+1)/2)+ - ret->strides[2]*((format->frame_height+1)/2)); - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+1)/2); - break; - case GAVL_YUV_410_P: - ret->strides[0] = format->frame_width; - ret->strides[1] = (format->frame_width+3)/4; - ret->strides[2] = (format->frame_width+3)/4; - - if(align) - { - ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } - - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*((format->frame_height+3)/4)+ - ret->strides[2]*((format->frame_height+3)/4)); - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+3)/4); - break; - case GAVL_YUV_422_P: - case GAVL_YUVJ_422_P: - ret->strides[0] = format->frame_width; - ret->strides[1] = (format->frame_width+1)/2; - ret->strides[2] = (format->frame_width+1)/2; - - if(align) - { - ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } - - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*format->frame_height+ - ret->strides[2]*format->frame_height); - - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; - break; - case GAVL_YUV_422_P_16: - ret->strides[0] = format->frame_width*2; - ret->strides[1] = ((format->frame_width+1)/2)*2; - ret->strides[2] = ((format->frame_width+1)/2)*2; - - if(align) - { - ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } - - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*format->frame_height+ - ret->strides[2]*format->frame_height); + int planar; - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; - break; - case GAVL_YUV_411_P: - ret->strides[0] = format->frame_width; - ret->strides[1] = (format->frame_width+3)/4; - ret->strides[2] = (format->frame_width+3)/4; + if(format->pixelformat == GAVL_PIXELFORMAT_NONE) + { + fprintf(stderr, "Pixelformat not specified for video frame\n"); + return; + } + planar = gavl_pixelformat_is_planar(format->pixelformat); + + if(planar) + { + int sub_h; + int sub_v; + int bpc; + + gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); + + bpc = gavl_pixelformat_bytes_per_component(format->pixelformat); - if(align) - { - ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } + if(!ret->strides[0]) + { + ret->strides[0] = bpc * format->frame_width; + ret->strides[1] = bpc * ((format->frame_width + sub_h - 1) / sub_h); + ret->strides[2] = ret->strides[1]; - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*format->frame_height+ - ret->strides[2]*format->frame_height); - - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; - break; - case GAVL_YUV_444_P: - case GAVL_YUVJ_444_P: - ret->strides[0] = format->frame_width; - ret->strides[1] = format->frame_width; - ret->strides[2] = format->frame_width; - if(align) { ALIGN(ret->strides[0]); ALIGN(ret->strides[1]); ALIGN(ret->strides[2]); } - - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*format->frame_height+ - ret->strides[2]*format->frame_height); - - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; - break; - case GAVL_YUV_444_P_16: - ret->strides[0] = format->frame_width*2; - ret->strides[1] = format->frame_width*2; - ret->strides[2] = format->frame_width*2; - + } + + ret->planes[0] = memalign(ALIGNMENT_BYTES, + ret->strides[0]*format->frame_height+ + ret->strides[1]*((format->frame_height+sub_v-1)/sub_v)+ + ret->strides[2]*((format->frame_height+sub_v-1)/sub_v)); + ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; + ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+sub_v-1)/sub_v); + } + else // Packed + { + if(!ret->strides[0]) + { + ret->strides[0] = + format->frame_width * gavl_pixelformat_bytes_per_pixel(format->pixelformat); if(align) - { ALIGN(ret->strides[0]); - ALIGN(ret->strides[1]); - ALIGN(ret->strides[2]); - } - - ret->planes[0] = memalign(ALIGNMENT_BYTES, - ret->strides[0]*format->frame_height+ - ret->strides[1]*format->frame_height+ - ret->strides[2]*format->frame_height); - - ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; - ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; - break; - case GAVL_PIXELFORMAT_NONE: - fprintf(stderr, "Pixelformat not specified for video frame\n"); - return; + } + ret->planes[0] = memalign(ALIGNMENT_BYTES, + ret->strides[0] * format->frame_height); } - } static void video_frame_free(gavl_video_frame_t * frame) { if(frame->planes[0]) free(frame->planes[0]); - frame->planes[0] = (uint8_t*)0; + frame->planes[0] = NULL; } gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t * format) @@ -330,7 +137,7 @@ void gavl_video_frame_null(gavl_video_frame_t* frame) { - frame->planes[0] = (uint8_t*)0; + frame->planes[0] = NULL; } void gavl_video_frame_clear_mask(gavl_video_frame_t * frame, @@ -1038,7 +845,7 @@ case GAVL_PIXELFORMAT_NONE: break; } - return (flip_scanline_func)0; + return NULL; } void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format, @@ -1510,7 +1317,7 @@ uint16_t packed_16; uint8_t packed_32[4]; uint16_t packed_64[4]; - float color_float[2]; + float color_float[4]; gavl_init_memcpy(); @@ -1744,19 +1551,27 @@ int i; int sub_h, sub_v; int advance; - int num_planes = gavl_pixelformat_num_planes(format->pixelformat); + int num_planes; if(!frame->strides[0]) gavl_video_frame_set_strides(frame, format); - gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); - - for(i = 0; i < num_planes; i++) + if(buffer) { - frame->planes[i] = buffer; - advance = frame->strides[i] * format->frame_height; - if(i) - advance /= sub_v; - buffer += advance; + num_planes = gavl_pixelformat_num_planes(format->pixelformat); + gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); + + for(i = 0; i < num_planes; i++) + { + frame->planes[i] = buffer; + advance = frame->strides[i] * format->frame_height; + if(i) + advance /= sub_v; + buffer += advance; + } + } + else + { + video_frame_alloc(frame, format, 0); } } diff -Nru gavl-1.2.0/include/gavl/compression.h gavl-1.4.0/include/gavl/compression.h --- gavl-1.2.0/include/gavl/compression.h 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/include/gavl/compression.h 2012-06-08 11:49:30.000000000 +0000 @@ -47,6 +47,11 @@ #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2) //!< Packets can consist of 2 consecutive fields #define GAVL_COMPRESSION_SBR (1<<3) //!< Samplerate got doubled by decoder, format and sample counts are for the upsampled rate +/** \brief Codec ID + * + * These are used as identifiers for the type of compression + */ + typedef enum { GAVL_CODEC_ID_NONE = 0, //!< Unknown/unsupported compression format @@ -58,6 +63,7 @@ GAVL_CODEC_ID_AC3, //!< AC3 GAVL_CODEC_ID_AAC, //!< AAC as stored in quicktime/mp4 GAVL_CODEC_ID_VORBIS, //!< Vorbis (segmented extradata and packets) + GAVL_CODEC_ID_FLAC, //!< Flac (extradata contain a file header without comment and seektable) /* Video */ GAVL_CODEC_ID_JPEG = 0x10000, //!< JPEG image @@ -68,7 +74,7 @@ GAVL_CODEC_ID_MPEG2, //!< MPEG-2 video GAVL_CODEC_ID_MPEG4_ASP, //!< MPEG-4 ASP (a.k.a. Divx4) GAVL_CODEC_ID_H264, //!< H.264 (Annex B) - GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata + GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata) GAVL_CODEC_ID_DIRAC, //!< Complete DIRAC frames, sequence end code appended to last packet GAVL_CODEC_ID_DV, //!< DV (several variants) } gavl_codec_id_t; @@ -111,6 +117,17 @@ GAVL_PUBLIC void gavl_compression_info_dump(const gavl_compression_info_t * info); +/** \brief Copy a compression info + * \param dst Destination + * \param src Source + * + */ + +GAVL_PUBLIC +void gavl_compression_info_copy(gavl_compression_info_t * dst, + const gavl_compression_info_t * src); + + /** \brief Get the file extension of the corresponding raw format * \param id A codec ID * \param separate If non-null returns 1 if each packet should be in a separate file @@ -141,6 +158,16 @@ GAVL_PUBLIC int gavl_compression_need_pixelformat(gavl_codec_id_t id); +/** \brief Check if an audio compression constant frame samples + * \param id A codec ID + * \returns 1 if the compression has the same number of samples in each frame, 0 else + * + */ + +GAVL_PUBLIC +int gavl_compression_constant_frame_samples(gavl_codec_id_t id); + + #define GAVL_PACKET_TYPE_I 'I' //!< Packet is an I-frame #define GAVL_PACKET_TYPE_P 'P' //!< Packet is a P-frame @@ -207,6 +234,9 @@ GAVL_PUBLIC void gavl_packet_dump(const gavl_packet_t * p); +/** + * @} + */ #ifdef __cplusplus } diff -Nru gavl-1.2.0/include/gavl/gavl.h gavl-1.4.0/include/gavl/gavl.h --- gavl-1.2.0/include/gavl/gavl.h 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/include/gavl/gavl.h 2012-06-08 11:49:30.000000000 +0000 @@ -701,7 +701,7 @@ Plots an audio frame into an ascii file with one line per sample in the format: - ... + sample_number channel1 channel2 ... In addition, a file for making a plot with gnuplot is generated. name_base is used for generating the filenames. For the data file, @@ -2228,6 +2228,25 @@ int gavl_get_color_channel_format(const gavl_video_format_t * frame_format, gavl_video_format_t * channel_format, gavl_color_channel_t ch); + + +/*! + \ingroup video_format + \brief Get the video format of one field + \param frame_format The video format of the full frame + \param field_format Format of the field + \param field Field (0 or 1) + + Use this function if you need to split a frame into fields. + It handles odd heights correctly + + Since 1.2.1 +*/ + +GAVL_PUBLIC +void gavl_get_field_format(const gavl_video_format_t * frame_format, + gavl_video_format_t * field_format, + int field); /*! @@ -3768,9 +3787,8 @@ /** \brief Create a frame table for constant framerate video * \param offset Timestamp of the first frame - * \param duration Duration of each frame + * \param frame_duration Duration of each frame * \param num_frames Number of frames - * \param fmt Timecode format (or NULL) * \param start_timecode Timecode of the first frame (or GAVL_TIMECODE_UNDEFINED) * \returns A newly allocated frame table * @@ -3940,7 +3958,7 @@ */ GAVL_PUBLIC -int gavl_frame_table_save(const gavl_frame_table_t * tab, +int gavl_frame_table_save(const gavl_frame_table_t * t, const char * filename); /** \brief Load a frame table from a file diff -Nru gavl-1.2.0/include/gavl/gavltime.h gavl-1.4.0/include/gavl/gavltime.h --- gavl-1.2.0/include/gavl/gavltime.h 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/include/gavl/gavltime.h 2012-06-08 11:49:30.000000000 +0000 @@ -276,7 +276,8 @@ uint64_t gavl_benchmark_get_time(int flags); /*! \ingroup timer - * \brief Get a description about the value returned by \ref gavl_benchmark_get_time + * \brief Get a description about the value returned by + * \ref gavl_benchmark_get_time * \param flags Flags returned by \ref gavl_accel_supported * \returns A string describing what the time value means * diff -Nru gavl-1.2.0/include/gavl/gavl_version.h gavl-1.4.0/include/gavl/gavl_version.h --- gavl-1.2.0/include/gavl/gavl_version.h 2011-01-08 00:49:58.000000000 +0000 +++ gavl-1.4.0/include/gavl/gavl_version.h 2012-06-08 11:49:58.000000000 +0000 @@ -1,10 +1,10 @@ #ifndef __GAVL_VERSION_H_ #define __GAVL_VERSION_H_ -#define GAVL_VERSION "1.2.0" +#define GAVL_VERSION "1.4.0" #define GAVL_VERSION_MAJOR 1 -#define GAVL_VERSION_MINOR 2 +#define GAVL_VERSION_MINOR 4 #define GAVL_VERSION_MICRO 0 #define GAVL_MAKE_BUILD(a,b,c) ((a << 16) + (b << 8) + c) diff -Nru gavl-1.2.0/include/gavl/Makefile.am gavl-1.4.0/include/gavl/Makefile.am --- gavl-1.2.0/include/gavl/Makefile.am 2010-03-02 00:28:37.000000000 +0000 +++ gavl-1.4.0/include/gavl/Makefile.am 2012-06-08 11:49:30.000000000 +0000 @@ -1,3 +1,13 @@ -pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h +pkginclude_HEADERS = \ +compression.h \ +gavl.h \ +gavltime.h \ +gavl_version.h \ +gavldsp.h \ +timecode.h \ +gavldefs.h \ +metadata.h \ +metatags.h + EXTRA_DIST = gavl_version.h.in diff -Nru gavl-1.2.0/include/gavl/Makefile.in gavl-1.4.0/include/gavl/Makefile.in --- gavl-1.2.0/include/gavl/Makefile.in 2011-01-08 00:49:51.000000000 +0000 +++ gavl-1.4.0/include/gavl/Makefile.in 2012-06-08 11:49:53.000000000 +0000 @@ -206,7 +206,17 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h +pkginclude_HEADERS = \ +compression.h \ +gavl.h \ +gavltime.h \ +gavl_version.h \ +gavldsp.h \ +timecode.h \ +gavldefs.h \ +metadata.h \ +metatags.h + EXTRA_DIST = gavl_version.h.in all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff -Nru gavl-1.2.0/include/gavl/metadata.h gavl-1.4.0/include/gavl/metadata.h --- gavl-1.2.0/include/gavl/metadata.h 1970-01-01 00:00:00.000000000 +0000 +++ gavl-1.4.0/include/gavl/metadata.h 2012-06-08 11:49:30.000000000 +0000 @@ -0,0 +1,333 @@ +/***************************************************************** + * gavl - a general purpose audio/video processing library + * + * Copyright (c) 2001 - 2011 Members of the Gmerlin project + * gmerlin-general@lists.sourceforge.net + * http://gmerlin.sourceforge.net + * + * 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 2 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 . + * *****************************************************************/ + +#ifndef GAVL_METADATA_H_INCLUDED +#define GAVL_METADATA_H_INCLUDED + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** \defgroup metadata Metadata + * \brief Metadata support + * + * This is a simple dictionary structure, which is + * used my gmerlin applications and libraries to + * associate metadata with a media file or a single + * media stream. + * + * Metadata are defined as all data, which are not directly + * related to the decoding process, but might be of interest + * for the user. + * + * The tag types are completely generic so applications can + * define their own tags. For compatibility it is, however + * recommended to use the tags defined in \ref metatags.h + * + * Since 1.4.0 + * + * @{ + */ + +/** Length of a date string of the format YYYY-MM-DD + */ +#define GAVL_METADATA_DATE_STRING_LEN 11 + +/** Length of a date/time string of the format YYYY-MM-DD HH:MM:SS + */ + +#define GAVL_METADATA_DATE_TIME_STRING_LEN 20 + +/** \brief Single metadata tag + */ + +typedef struct + { + char * key; //!< Key + char * val; //!< Value + } gavl_metadata_tag_t; + +/** \brief Single metadata structure + */ + + +typedef struct + { + gavl_metadata_tag_t * tags; //!< Array of tags + int tags_alloc; //!< Number of allocated tags (never touch this) + int num_tags; //!< Number of valid tags + } gavl_metadata_t; + +/** \brief Free all metadata tags + * \arg m A metadata structure + */ + +GAVL_PUBLIC void +gavl_metadata_free(gavl_metadata_t * m); + +/** \brief Initialize structre + * \arg m A metadata structure + * + * Use this if you define a \ref gavl_metadata_t + * structure in unintialized memory (e.g. on the stack) + * before using it. + */ + +GAVL_PUBLIC void +gavl_metadata_init(gavl_metadata_t * m); + +/** \brief Set a tag + * \arg m A metadata structure + * \arg key Key + * \arg val Value + * + * Set a metadata tag. The value is copied. + */ + +GAVL_PUBLIC void +gavl_metadata_set(gavl_metadata_t * m, + const char * key, + const char * val); + +/** \brief Set a tag + * \arg m A metadata structure + * \arg key Key + * \arg val Value + * + * Like \ref gavl_metadata_set except that the + * value is not copied. + */ + +GAVL_PUBLIC void +gavl_metadata_set_nocpy(gavl_metadata_t * m, + const char * key, + char * val); + +/** \brief Get the value of a tag + * \arg m A metadata structure + * \arg key Key + * \returns Value of the tag or NULL if the tag doesn't exist + */ + +GAVL_PUBLIC +const char * gavl_metadata_get(const gavl_metadata_t * m, + const char * key); + +/** \brief Set an integer tag + * \arg m A metadata structure + * \arg key Key + * \arg val Value + */ + +GAVL_PUBLIC void +gavl_metadata_set_int(gavl_metadata_t * m, + const char * key, + int val); + +/** \brief Get an integer tag + * \arg m A metadata structure + * \arg key Key + * \arg ret Returns the value + * \returns 1 if ret contains a valid tag, 0 if the tag doesn't exist or is not numeric + */ + +GAVL_PUBLIC +int gavl_metadata_get_int(const gavl_metadata_t * m, + const char * key, int * ret); + +/** \brief Set a date tag + * \arg m A metadata structure + * \arg key Key + * \arg year Year + * \arg month Month + * \arg day Day + */ + +GAVL_PUBLIC void +gavl_metadata_set_date(gavl_metadata_t * m, + const char * key, + int year, + int month, + int day); + +/** \brief Get a date tag + * \arg m A metadata structure + * \arg key Key + * \arg year Returns year + * \arg month Returns month + * \arg day Returns day + * \returns 1 if a valid date was returned, 0 else + */ + +GAVL_PUBLIC int +gavl_metadata_get_date(gavl_metadata_t * m, + const char * key, + int * year, + int * month, + int * day); + +/** \brief Set a date/time tag + * \arg m A metadata structure + * \arg key Key + * \arg year Year + * \arg month Month + * \arg day Day + * \arg hour Hour + * \arg minute Minute + * \arg second Second + */ + +GAVL_PUBLIC void +gavl_metadata_set_date_time(gavl_metadata_t * m, + const char * key, + int year, + int month, + int day, + int hour, + int minute, + int second); + +/** \brief Get a date/time tag + * \arg m A metadata structure + * \arg key Key + * \arg year Returns year + * \arg month Returns month + * \arg day Returns day + * \arg hour Returns hour + * \arg minute Returns minute + * \arg second Returns second + * \returns 1 if a valid date/time was returned, 0 else + */ + +GAVL_PUBLIC int +gavl_metadata_get_date_time(gavl_metadata_t * m, + const char * key, + int * year, + int * month, + int * day, + int * hour, + int * minute, + int * second); + +/** \brief Format a date string + * \arg year Year + * \arg month Month + * \arg day Day + * \arg ret String to be formatted + * + * The string needs to be at least \ref GAVL_METADATA_DATE_STRING_LEN + * bytes long. + */ + +GAVL_PUBLIC void +gavl_metadata_date_to_string(int year, + int month, + int day, char * ret); + +/** \brief Format a date string + * \arg year Year + * \arg month Month + * \arg day Day + * \arg ret String to be formatted + * \arg hour Hour + * \arg minute Minute + * \arg second Second + * + * The string needs to be at least + * \ref GAVL_METADATA_DATE_TIME_STRING_LEN bytes long. + */ + +GAVL_PUBLIC void +gavl_metadata_date_time_to_string(int year, + int month, + int day, + int hour, + int minute, + int second, + char * ret); + +/** \brief Merge two metadata structures + * \arg dst Destination + * \arg src1 First source + * \arg src2 Second source + * + * Copy all tags from src1 and src2 to dst. If a tag + * is available in src1 and src2, the one from src1 is + * taken. + */ + +GAVL_PUBLIC +void gavl_metadata_merge(gavl_metadata_t * dst, + const gavl_metadata_t * src1, + const gavl_metadata_t * src2); + +/** \brief Merge two metadata structures + * \arg dst Destination + * \arg src Source + * + * Copy tags from src to dst, which are not + * already contained in dst. + */ + +GAVL_PUBLIC +void gavl_metadata_merge2(gavl_metadata_t * dst, + const gavl_metadata_t * src); + +/** \brief Copy metadata structure + * \arg dst Destination + * \arg src Source + * + * Copy all tags from src to dst + */ + +GAVL_PUBLIC void +gavl_metadata_copy(gavl_metadata_t * dst, + const gavl_metadata_t * src); + +/** \brief Dump metadata structure to stderr + * \arg m Metadata + * \arg indent Spaces to append to each line + */ + +GAVL_PUBLIC void +gavl_metadata_dump(const gavl_metadata_t * m, int indent); + +/** \brief Check if 2 metadata structures are equal + * \arg m1 Metadata 1 + * \arg m2 Metadata 2 + * \returns 1 if the 2 metadata structures are identical, 0 else + */ + +GAVL_PUBLIC int +gavl_metadata_equal(const gavl_metadata_t * m1, + const gavl_metadata_t * m2); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif // GAVL_METADATA_H_INCLUDED diff -Nru gavl-1.2.0/include/gavl/metatags.h gavl-1.4.0/include/gavl/metatags.h --- gavl-1.2.0/include/gavl/metatags.h 1970-01-01 00:00:00.000000000 +0000 +++ gavl-1.4.0/include/gavl/metatags.h 2012-06-08 11:49:30.000000000 +0000 @@ -0,0 +1,173 @@ +/***************************************************************** + * gavl - a general purpose audio/video processing library + * + * Copyright (c) 2001 - 2011 Members of the Gmerlin project + * gmerlin-general@lists.sourceforge.net + * http://gmerlin.sourceforge.net + * + * 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 2 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 . + * *****************************************************************/ + +#ifndef GAVL_METATAGS_H_INCLUDED +#define GAVL_METATAGS_H_INCLUDED + +/** \defgroup metatags Defined metadata keys + * \ingroup metadata + * + * For interoperabiolity reasons, try to use these macros + * as metadata keys whenever possible. + * + * Since 1.4.0 + * + * @{ + */ + +/** \brief Title of the song/movie... */ + +#define GAVL_META_TITLE "Title" + +/** \brief Performing artist */ + +#define GAVL_META_ARTIST "Artist" + +/** \brief Artist of the Album */ + +#define GAVL_META_ALBUMARTIST "Albumartist" + +/** \brief Author */ + +#define GAVL_META_AUTHOR "Author" + +/** \brief Copyright */ + +#define GAVL_META_COPYRIGHT "Copyright" + +/** \brief Album */ + +#define GAVL_META_ALBUM "Album" + +/** \brief Genre */ + +#define GAVL_META_GENRE "Genre" + +/** \brief Tracknumber within the album + * + * Integer starting with 1 + */ + +#define GAVL_META_TRACKNUMBER "Tracknumber" + +/** \brief Generic date + * + * YYYY-MM-DD [HH:MM:SS] + */ + +#define GAVL_META_DATE "Date" + +/** \brief Creation date + * + * YYYY-MM-DD [HH:MM:SS] + */ + +#define GAVL_META_DATE_CREATE "CreationDate" // YYYY-MM-DD [HH:MM:SS] + +/** \brief Modification date + * + * YYYY-MM-DD [HH:MM:SS] + */ + +#define GAVL_META_DATE_MODIFY "ModificationDate" // YYYY-MM-DD [HH:MM:SS] + +/** \brief Generic year + */ + +#define GAVL_META_YEAR "Year" // YYYY + +/** \brief Language + * + * Use this for subtitles or audio streams + */ + +#define GAVL_META_LANGUAGE "Language" // ISO 639-2/B 3 letter code + +/** \brief Comment + */ + +#define GAVL_META_COMMENT "Comment" + +/** \brief Related URL + */ + +#define GAVL_META_URL "URL" + +/** \brief Software + * + * For media files, this is the multiplexer software. + * For single stream this is the encoder software + */ + +#define GAVL_META_SOFTWARE "Software" + +/** \brief Person, who created the file + */ + +#define GAVL_META_CREATOR "Creator" + +/** \brief Format + * + * For media files, this is the container format. + * For single stream this is the name of the codec + */ +#define GAVL_META_FORMAT "Format" + +/** \brief Label + * + * Stream label (e.g. "Directors comments") + */ + +#define GAVL_META_LABEL "Label" + +/** \brief Bitrate + * + * Bitrate as integer in bits/s. Can also be a + * string (like VBR) + */ + +#define GAVL_META_BITRATE "Bitrate" + +/** \brief Valid bits per audio sample + */ + +#define GAVL_META_AUDIO_BITS "BitsPerSample" + +/** \brief Valid bits per pixel + */ + +#define GAVL_META_VIDEO_BPP "BitsPerPixel" + +/** \brief Vendor of the device/software, which created the file + */ + +#define GAVL_META_VENDOR "Vendor" + +/** \brief Model name of the device, which created the file + */ + +#define GAVL_META_DEVICE "Device" + +/** + * @} + */ + +#endif // GAVL_METATAGS_H_INCLUDED diff -Nru gavl-1.2.0/include/gavl/timecode.h gavl-1.4.0/include/gavl/timecode.h --- gavl-1.2.0/include/gavl/timecode.h 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/include/gavl/timecode.h 2012-06-08 11:49:30.000000000 +0000 @@ -204,7 +204,7 @@ char str[GAVL_TIMECODE_STRING_LEN_SHORT]); -/* +/** * @} */ diff -Nru gavl-1.2.0/m4/check_funcs.m4 gavl-1.4.0/m4/check_funcs.m4 --- gavl-1.2.0/m4/check_funcs.m4 2010-08-30 21:07:21.000000000 +0000 +++ gavl-1.4.0/m4/check_funcs.m4 2012-06-08 11:49:29.000000000 +0000 @@ -9,7 +9,7 @@ have_avcodec=false -AVCODEC_BUILD="3345152" +AVCODEC_BUILD="3412992" AC_ARG_ENABLE(libavcodec, [AC_HELP_STRING([--disable-libavcodec],[Disable libavcodec (default: autodetect)])], @@ -48,7 +48,7 @@ have_avformat=false -AVFORMAT_BUILD="3278080" +AVFORMAT_BUILD="3415808" AC_ARG_ENABLE(libavformat, [AC_HELP_STRING([--disable-libavformat],[Disable libavformat (default: autodetect)])], @@ -130,6 +130,13 @@ if test $found_header = "false"; then have_libpostproc=false +else +CFLAGS="-DPOSTPROC_HEADER=$POSTPROC_HEADER $CFLAGS" +AC_CHECK_TYPES([pp_context_t, pp_context, pp_mode_t, pp_mode], [], [], [[ +#ifdef POSTPROC_HEADER +#include POSTPROC_HEADER +#endif +]]) fi CFLAGS="$CFLAGS_save" @@ -577,11 +584,9 @@ if test x$test_libtiff = xtrue; then -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS LIBS="$LIBS -ltiff" -CFLAGS="$CFLAGS" AC_MSG_CHECKING(for libtiff) AC_TRY_LINK([#include ], @@ -596,11 +601,9 @@ case $have_libtiff in true) AC_DEFINE(HAVE_LIBTIFF) AC_MSG_RESULT(yes) - TIFF_LIBS=$LIBS; - TIFF_CFLAGS=$CFLAGS ;; + TIFF_LIBS=$LIBS;; false) AC_MSG_RESULT(no); TIFF_LIBS=""; TIFF_CFLAGS="";; esac -CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS fi @@ -755,11 +758,9 @@ if test x$test_libpng = xtrue; then -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS LIBS="$LIBS -lpng -lm -lz" -CFLAGS="$CFLAGS" AC_MSG_CHECKING(for libpng) AC_TRY_LINK([#include ], @@ -772,11 +773,9 @@ case $have_libpng in true) AC_DEFINE(HAVE_LIBPNG) AC_MSG_RESULT(yes) - PNG_LIBS=$LIBS; - PNG_CFLAGS=$CFLAGS ;; + PNG_LIBS=$LIBS;; false) AC_MSG_RESULT(no); PNG_LIBS=""; PNG_CFLAGS="";; esac -CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS fi @@ -990,7 +989,7 @@ AC_DEFUN([GMERLIN_CHECK_FLAC],[ -FLAC_REQUIRED="1.1.0" +FLAC_REQUIRED="1.2.0" have_flac="false" AC_ARG_ENABLE(flac, @@ -1025,7 +1024,7 @@ if(sscanf(FLAC__VERSION_STRING, "%d.%d.%d", &version_major, &version_minor, &version_patchlevel) < 3) return -1; - if((version_major != 1) || (version_minor < 1)) + if((version_major != 1) || (version_minor < 2)) return 1; version_file = fopen("flac_version", "w"); fprintf(version_file, "%d.%d.%d\n", version_major, @@ -1576,10 +1575,8 @@ if test x$test_libjpeg = xtrue; then -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS LIBS="$LIBS -ljpeg" -CFLAGS="$CFLAGS" AC_MSG_CHECKING(for libjpeg) AC_TRY_LINK([#include @@ -1590,13 +1587,11 @@ case $have_libjpeg in true) AC_DEFINE(HAVE_LIBJPEG) AC_MSG_RESULT(yes) - JPEG_LIBS=$LIBS; - JPEG_CFLAGS=$CFLAGS;; + JPEG_LIBS=$LIBS;; false) AC_MSG_RESULT(no); JPEG_LIBS=""; JPEG_CFLAGS="";; * ) AC_MSG_RESULT("Somethings wrong: $have_libjpeg") ;; esac -CFLAGS=$OLD_CFLAGS LIBS=$OLD_LIBS fi @@ -1639,7 +1634,6 @@ dnl Search for OpenGL libraries dnl -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS have_GL="true" @@ -1652,17 +1646,14 @@ ],[],[have_GL="false"]) fi -GL_CFLAGS=$CFLAGS GL_LIBS=$LIBS -CFLAGS="$OLD_CFLAGS" LIBS="$OLD_LIBS" dnl dnl Check for GLX dnl -OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS have_GLX="true" @@ -1675,10 +1666,8 @@ NULL, NULL); return 0;}],[],[have_GLX="false"]) fi -GLX_CFLAGS=$CFLAGS GLX_LIBS=$LIBS -CFLAGS="$OLD_CFLAGS" LIBS="$OLD_LIBS" if test "x$have_GL" = "xtrue"; then @@ -1772,8 +1761,8 @@ sem_t s; result = sem_init(&s, 0, 0); if(result) - return 0; - return -1; + return -1; + return 0; } ], [ @@ -1811,7 +1800,8 @@ esac],[test_vdpau=true]) if test x$test_vdpau = xtrue; then - +if test x$have_x = xtrue; then + OLD_CFLAGS=$CFLAGS OLD_LIBS=$LIBS @@ -1839,6 +1829,7 @@ LIBS=$OLD_LIBS fi +fi AC_SUBST(VDPAU_CFLAGS) AC_SUBST(VDPAU_LIBS) diff -Nru gavl-1.2.0/src/blend_test.c gavl-1.4.0/src/blend_test.c --- gavl-1.2.0/src/blend_test.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/blend_test.c 2012-06-08 11:49:30.000000000 +0000 @@ -48,7 +48,7 @@ gavl_video_converter_t * cnv; gavl_video_format_t format_1; - gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; + gavl_video_frame_t * frame_1 = NULL; if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) @@ -153,7 +153,7 @@ } png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)0, + (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); setjmp(png_jmpbuf(png_ptr)); @@ -261,7 +261,7 @@ format->pixelformat = pixelformat; } else - frame_1 = (gavl_video_frame_t*)0; + frame_1 = NULL; if(frame_1) { diff -Nru gavl-1.2.0/src/colorspace_test.c gavl-1.4.0/src/colorspace_test.c --- gavl-1.2.0/src/colorspace_test.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/colorspace_test.c 2012-06-08 11:49:30.000000000 +0000 @@ -60,43 +60,43 @@ * Some braindead YUV conversion (but works at least :-) */ -static int * r_to_y = (int*)0; -static int * g_to_y = (int*)0; -static int * b_to_y = (int*)0; - -static int * r_to_u = (int*)0; -static int * g_to_u = (int*)0; -static int * b_to_u = (int*)0; - -static int * r_to_v = (int*)0; -static int * g_to_v = (int*)0; -static int * b_to_v = (int*)0; - -static int * y_to_rgb = (int*)0; -static int * v_to_r = (int*)0; -static int * u_to_g = (int*)0; -static int * v_to_g = (int*)0; -static int * u_to_b = (int*)0; +static int * r_to_y = NULL; +static int * g_to_y = NULL; +static int * b_to_y = NULL; + +static int * r_to_u = NULL; +static int * g_to_u = NULL; +static int * b_to_u = NULL; + +static int * r_to_v = NULL; +static int * g_to_v = NULL; +static int * b_to_v = NULL; + +static int * y_to_rgb = NULL; +static int * v_to_r = NULL; +static int * u_to_g = NULL; +static int * v_to_g = NULL; +static int * u_to_b = NULL; /* JPEG Quantization */ -static int * r_to_yj = (int*)0; -static int * g_to_yj = (int*)0; -static int * b_to_yj = (int*)0; - -static int * r_to_uj = (int*)0; -static int * g_to_uj = (int*)0; -static int * b_to_uj = (int*)0; - -static int * r_to_vj = (int*)0; -static int * g_to_vj = (int*)0; -static int * b_to_vj = (int*)0; - -static int * yj_to_rgb = (int*)0; -static int * vj_to_r = (int*)0; -static int * uj_to_g = (int*)0; -static int * vj_to_g = (int*)0; -static int * uj_to_b = (int*)0; +static int * r_to_yj = NULL; +static int * g_to_yj = NULL; +static int * b_to_yj = NULL; + +static int * r_to_uj = NULL; +static int * g_to_uj = NULL; +static int * b_to_uj = NULL; + +static int * r_to_vj = NULL; +static int * g_to_vj = NULL; +static int * b_to_vj = NULL; + +static int * yj_to_rgb = NULL; +static int * vj_to_r = NULL; +static int * uj_to_g = NULL; +static int * vj_to_g = NULL; +static int * uj_to_b = NULL; @@ -1321,7 +1321,7 @@ int color_type; int png_transforms; gavl_video_frame_t * tmp_frame; - gavl_video_frame_t * out_frame = (gavl_video_frame_t *)0; + gavl_video_frame_t * out_frame = NULL; gavl_video_format_t tmp_format; int i; diff -Nru gavl-1.2.0/src/colorspace_time.c gavl-1.4.0/src/colorspace_time.c --- gavl-1.2.0/src/colorspace_time.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/colorspace_time.c 2012-06-08 11:49:30.000000000 +0000 @@ -38,14 +38,14 @@ static void timer_init() { - gettimeofday(&time_before, (struct timezone*)0); + gettimeofday(&time_before, NULL); } static void timer_stop() { double before, after, diff; - gettimeofday(&time_after, (struct timezone*)0); + gettimeofday(&time_after, NULL); before = time_before.tv_sec + time_before.tv_usec / 1.0e6; after = time_after.tv_sec + time_after.tv_usec / 1.0e6; diff -Nru gavl-1.2.0/src/fill_test.c gavl-1.4.0/src/fill_test.c --- gavl-1.2.0/src/fill_test.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/fill_test.c 2012-06-08 11:49:30.000000000 +0000 @@ -39,7 +39,7 @@ gavl_video_converter_t * cnv; gavl_video_format_t format_1; - gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; + gavl_video_frame_t * frame_1 = NULL; if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) diff -Nru gavl-1.2.0/src/pngutil.c gavl-1.4.0/src/pngutil.c --- gavl-1.2.0/src/pngutil.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/pngutil.c 2012-06-08 11:49:30.000000000 +0000 @@ -39,7 +39,7 @@ gavl_video_converter_t * cnv; gavl_video_format_t format_1; - gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; + gavl_video_frame_t * frame_1 = NULL; if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) @@ -147,7 +147,7 @@ } png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)0, + (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); setjmp(png_jmpbuf(png_ptr)); @@ -251,7 +251,7 @@ format->pixelformat = pixelformat; } else - frame_1 = (gavl_video_frame_t*)0; + frame_1 = NULL; if(frame_1) { diff -Nru gavl-1.2.0/src/scaletest.c gavl-1.4.0/src/scaletest.c --- gavl-1.2.0/src/scaletest.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/scaletest.c 2012-06-08 11:49:30.000000000 +0000 @@ -73,7 +73,7 @@ gavl_video_converter_t * cnv; gavl_video_format_t format_1; - gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; + gavl_video_frame_t * frame_1 = NULL; if((format->pixelformat != GAVL_RGB_24) && @@ -184,7 +184,7 @@ } png_ptr = png_create_read_struct - (PNG_LIBPNG_VER_STRING, (png_voidp)0, + (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); setjmp(png_jmpbuf(png_ptr)); @@ -288,7 +288,7 @@ format->pixelformat = pixelformat; } else - frame_1 = (gavl_video_frame_t*)0; + frame_1 = NULL; if(frame_1) { diff -Nru gavl-1.2.0/src/timeutils.c gavl-1.4.0/src/timeutils.c --- gavl-1.2.0/src/timeutils.c 2011-01-07 15:30:16.000000000 +0000 +++ gavl-1.4.0/src/timeutils.c 2012-06-08 11:49:30.000000000 +0000 @@ -20,6 +20,8 @@ * *****************************************************************/ #include +#include + #include #include @@ -30,14 +32,14 @@ void timer_init() { - gettimeofday(&time_before, (struct timezone*)0); + gettimeofday(&time_before, NULL); } uint64_t timer_stop() { uint64_t before, after, diff; - gettimeofday(&time_after, (struct timezone*)0); + gettimeofday(&time_after, NULL); before = ((uint64_t)time_before.tv_sec)*1000000 + time_before.tv_usec; after = ((uint64_t)time_after.tv_sec)*1000000 + time_after.tv_usec;