Imported Upstream version 1.4.0
IOhannes m zmölnig
11 years ago
2979 | 2979 | |
2980 | 2980 | # Define the identity of the package. |
2981 | 2981 | PACKAGE=gavl |
2982 | VERSION=1.2.0 | |
2982 | VERSION=1.4.0 | |
2983 | 2983 | |
2984 | 2984 | |
2985 | 2985 | cat >>confdefs.h <<_ACEOF |
11368 | 11368 | |
11369 | 11369 | if test x$test_libpng = xtrue; then |
11370 | 11370 | |
11371 | OLD_CFLAGS=$CFLAGS | |
11372 | 11371 | OLD_LIBS=$LIBS |
11373 | 11372 | |
11374 | 11373 | LIBS="$LIBS -lpng -lm -lz" |
11375 | CFLAGS="$CFLAGS" | |
11376 | 11374 | |
11377 | 11375 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpng" >&5 |
11378 | 11376 | $as_echo_n "checking for libpng... " >&6; } |
11401 | 11399 | |
11402 | 11400 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 |
11403 | 11401 | $as_echo "yes" >&6; } |
11404 | PNG_LIBS=$LIBS; | |
11405 | PNG_CFLAGS=$CFLAGS ;; | |
11402 | PNG_LIBS=$LIBS;; | |
11406 | 11403 | false) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
11407 | 11404 | $as_echo "no" >&6; }; PNG_LIBS=""; PNG_CFLAGS="";; |
11408 | 11405 | esac |
11409 | CFLAGS=$OLD_CFLAGS | |
11410 | 11406 | LIBS=$OLD_LIBS |
11411 | 11407 | |
11412 | 11408 | fi |
3 | 3 | |
4 | 4 | AM_CONFIG_HEADER(include/gavl/config.h) |
5 | 5 | |
6 | AM_INIT_AUTOMAKE(gavl, 1.2.0) | |
6 | AM_INIT_AUTOMAKE(gavl, 1.4.0) | |
7 | 7 | |
8 | 8 | GAVL_VERSION=$VERSION |
9 | 9 |
423 | 423 | # directories like "/usr/src/myproject". Separate the files or directories |
424 | 424 | # with spaces. |
425 | 425 | |
426 | 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 | |
426 | 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 | |
427 | 427 | |
428 | 428 | # If the value of the INPUT tag contains directories, you can use the |
429 | 429 | # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp |
70 | 70 | frametable.c \ |
71 | 71 | interleave.c \ |
72 | 72 | memcpy.c \ |
73 | metadata.c \ | |
73 | 74 | mix.c \ |
74 | 75 | peakdetector.c \ |
75 | 76 | psnr.c \ |
86 | 86 | colorchannel.lo colorspace.lo compression.lo cputest.lo \ |
87 | 87 | deinterlace.lo deinterlace_blend.lo deinterlace_copy.lo \ |
88 | 88 | deinterlace_scale.lo dsp.lo dsputils.lo frametable.lo \ |
89 | interleave.lo memcpy.lo mix.lo peakdetector.lo psnr.lo \ | |
90 | rectangle.lo sampleformat.lo samplerate.lo scale.lo \ | |
89 | interleave.lo memcpy.lo metadata.lo mix.lo peakdetector.lo \ | |
90 | psnr.lo rectangle.lo sampleformat.lo samplerate.lo scale.lo \ | |
91 | 91 | scale_context.lo scale_kernels.lo scale_table.lo ssim.lo \ |
92 | 92 | time.lo timecode.lo timer.lo transform.lo transform_context.lo \ |
93 | 93 | transform_table.lo video.lo videoformat.lo videoframe.lo \ |
330 | 330 | frametable.c \ |
331 | 331 | interleave.c \ |
332 | 332 | memcpy.c \ |
333 | metadata.c \ | |
333 | 334 | mix.c \ |
334 | 335 | peakdetector.c \ |
335 | 336 | psnr.c \ |
473 | 474 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/frametable.Plo@am__quote@ |
474 | 475 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interleave.Plo@am__quote@ |
475 | 476 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memcpy.Plo@am__quote@ |
477 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Plo@am__quote@ | |
476 | 478 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mix.Plo@am__quote@ |
477 | 479 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/peakdetector.Plo@am__quote@ |
478 | 480 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psnr.Plo@am__quote@ |
70 | 70 | cnv->contexts = ctx; |
71 | 71 | } |
72 | 72 | cnv->num_conversions = 0; |
73 | cnv->contexts = (gavl_audio_convert_context_t*)0; | |
74 | cnv->last_context = (gavl_audio_convert_context_t*)0; | |
73 | cnv->contexts = NULL; | |
74 | cnv->last_context = NULL; | |
75 | 75 | } |
76 | 76 | |
77 | 77 | void gavl_audio_converter_destroy(gavl_audio_converter_t* cnv) |
48 | 48 | if(format == sample_format_names[i].format) |
49 | 49 | return sample_format_names[i].name; |
50 | 50 | } |
51 | return (char*)0; | |
51 | return NULL; | |
52 | 52 | } |
53 | 53 | |
54 | 54 | gavl_sample_format_t gavl_string_to_sample_format(const char * str) |
98 | 98 | if(mode == interleave_mode_names[i].mode) |
99 | 99 | return interleave_mode_names[i].name; |
100 | 100 | } |
101 | return (char*)0; | |
101 | return NULL; | |
102 | 102 | } |
103 | 103 | |
104 | 104 | static const struct |
149 | 149 | if(id == channel_id_names[i].id) |
150 | 150 | return channel_id_names[i].name; |
151 | 151 | } |
152 | return (char*)0; | |
152 | return NULL; | |
153 | 153 | } |
154 | 154 | |
155 | 155 | void gavl_audio_format_dump(const gavl_audio_format_t * f) |
31 | 31 | gavl_overlay_blend_context_t * ret; |
32 | 32 | ret = calloc(1, sizeof(*ret)); |
33 | 33 | |
34 | ret->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0); | |
35 | ret->dst_win = gavl_video_frame_create((gavl_video_format_t*)0); | |
34 | ret->ovl_win = gavl_video_frame_create(NULL); | |
35 | ret->dst_win = gavl_video_frame_create(NULL); | |
36 | 36 | |
37 | 37 | gavl_video_options_set_defaults(&ret->opt); |
38 | 38 | |
70 | 70 | { |
71 | 71 | gavl_video_frame_null(ctx->ovl_win); |
72 | 72 | gavl_video_frame_destroy(ctx->ovl_win); |
73 | ctx->ovl_win = (gavl_video_frame_t*)0; | |
73 | ctx->ovl_win = NULL; | |
74 | 74 | ctx->has_overlay = 0; |
75 | 75 | } |
76 | 76 | |
94 | 94 | dst_format->pixelformat, |
95 | 95 | &ctx->ovl_format.pixelformat); |
96 | 96 | |
97 | ctx->ovl_win = gavl_video_frame_create((gavl_video_format_t*)0); | |
97 | ctx->ovl_win = gavl_video_frame_create(NULL); | |
98 | 98 | gavl_video_format_copy(ovl_format, &ctx->ovl_format); |
99 | 99 | return 1; |
100 | 100 | } |
22 | 22 | #include <blend.h> |
23 | 23 | |
24 | 24 | #include <math.h> |
25 | #include <stdlib.h> | |
25 | 26 | |
26 | 27 | /* Switch on individual items in the colorspace tables / macros */ |
27 | 28 | #define HAVE_YUVJ_TO_YUV_8 |
2141 | 2142 | return blend_rgba_float; |
2142 | 2143 | break; |
2143 | 2144 | case GAVL_PIXELFORMAT_NONE: |
2144 | return (gavl_blend_func_t)0; | |
2145 | } | |
2146 | return (gavl_blend_func_t)0; | |
2147 | } | |
2145 | return NULL; | |
2146 | } | |
2147 | return NULL; | |
2148 | } |
538 | 538 | while(--i) |
539 | 539 | { |
540 | 540 | tmp = *(src1++) + *(src2++); |
541 | *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647); | |
541 | *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL); | |
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
682 | 682 | while(--i) |
683 | 683 | { |
684 | 684 | tmp = *(src1++) - *(src2++); |
685 | *(dst++) = GENERIC_CLIP(tmp,-2147483648,2147483647); | |
685 | *(dst++) = GENERIC_CLIP(tmp,-2147483648LL,2147483647LL); | |
686 | 686 | } |
687 | 687 | } |
688 | 688 |
207 | 207 | if(pixelformat_tab[i].pixelformat == pixelformat) |
208 | 208 | return pixelformat_tab[i].name; |
209 | 209 | } |
210 | return (const char*)0; | |
210 | return NULL; | |
211 | 211 | } |
212 | 212 | |
213 | 213 | gavl_pixelformat_t gavl_string_to_pixelformat(const char * name) |
19 | 19 | * *****************************************************************/ |
20 | 20 | #include <stdlib.h> |
21 | 21 | #include <stdio.h> |
22 | #include <string.h> | |
22 | 23 | |
23 | 24 | #include <gavl/gavl.h> |
24 | 25 | #include <gavl/compression.h> |
56 | 57 | free(info->global_header); |
57 | 58 | } |
58 | 59 | |
59 | #define FLAG_SEPARATE (1<<0) | |
60 | #define FLAG_NEEDS_PIXELFORMAT (1<<1) | |
60 | #define FLAG_SEPARATE (1<<0) | |
61 | #define FLAG_NEEDS_PIXELFORMAT (1<<1) | |
62 | #define FLAG_CFS (1<<2) // Constant Frame Samples | |
61 | 63 | |
62 | 64 | struct |
63 | 65 | { |
71 | 73 | /* Audio */ |
72 | 74 | { GAVL_CODEC_ID_ALAW, NULL, "alaw" }, |
73 | 75 | { GAVL_CODEC_ID_ULAW, NULL, "ulaw" }, |
74 | { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2" }, | |
75 | { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3" }, | |
76 | { GAVL_CODEC_ID_AC3, "ac3", "AC3" }, | |
77 | { GAVL_CODEC_ID_AAC, NULL, "AAC" }, | |
76 | { GAVL_CODEC_ID_MP2, "mp2", "MPEG layer 2", FLAG_CFS }, | |
77 | { GAVL_CODEC_ID_MP3, "mp3", "MPEG layer 3", FLAG_CFS }, | |
78 | { GAVL_CODEC_ID_AC3, "ac3", "AC3", FLAG_CFS }, | |
79 | { GAVL_CODEC_ID_AAC, NULL, "AAC", FLAG_CFS }, | |
78 | 80 | { GAVL_CODEC_ID_VORBIS, NULL, "Vorbis" }, |
81 | { GAVL_CODEC_ID_FLAC, NULL, "Flac" }, | |
79 | 82 | |
80 | 83 | /* Video */ |
81 | 84 | { GAVL_CODEC_ID_JPEG, "jpg", "JPEG image", FLAG_SEPARATE | FLAG_NEEDS_PIXELFORMAT }, |
118 | 121 | return 0; |
119 | 122 | } |
120 | 123 | |
124 | int gavl_compression_constant_frame_samples(gavl_codec_id_t id) | |
125 | { | |
126 | int i; | |
127 | for(i = 0; i < sizeof(compression_ids)/sizeof(compression_ids[0]); i++) | |
128 | { | |
129 | if(compression_ids[i].id == id) | |
130 | return !!(compression_ids[i].flags & FLAG_CFS); | |
131 | } | |
132 | return 0; | |
133 | } | |
134 | ||
121 | 135 | |
122 | 136 | static const char * |
123 | 137 | get_name(gavl_codec_id_t id) |
167 | 181 | } |
168 | 182 | |
169 | 183 | GAVL_PUBLIC |
184 | void gavl_compression_info_copy(gavl_compression_info_t * dst, | |
185 | const gavl_compression_info_t * src) | |
186 | { | |
187 | memcpy(dst, src, sizeof(*dst)); | |
188 | if(src->global_header) | |
189 | { | |
190 | dst->global_header = malloc(src->global_header_len); | |
191 | memcpy(dst->global_header, src->global_header, src->global_header_len); | |
192 | } | |
193 | } | |
194 | ||
195 | ||
196 | GAVL_PUBLIC | |
170 | 197 | void gavl_packet_alloc(gavl_packet_t * p, int len) |
171 | 198 | { |
172 | 199 | if(len > p->data_alloc) |
38 | 38 | |
39 | 39 | void (*interpolate)(const uint8_t * src_1, |
40 | 40 | const uint8_t * src_2, |
41 | uint8_t * dst, int num, float fac) = | |
42 | (void (*)(const uint8_t *, const uint8_t *, uint8_t *, int, float))0; | |
41 | uint8_t * dst, int num, float fac) = NULL; | |
43 | 42 | |
44 | 43 | num_planes = gavl_pixelformat_num_planes(format->pixelformat); |
45 | 44 | gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); |
204 | 204 | } |
205 | 205 | break; |
206 | 206 | } |
207 | return (gavl_audio_func_t)0; | |
207 | return NULL; | |
208 | 208 | } |
209 | 209 | |
210 | 210 | gavl_interleave_table_t * |
14 | 14 | * along with this program; if not, write to the Free Software |
15 | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | 16 | * |
17 | * $Id: gdither.c,v 1.5 2009/05/03 21:39:35 gmerlin Exp $ | |
17 | * $Id: gdither.c,v 1.5 2009-05-03 21:39:35 gmerlin Exp $ | |
18 | 18 | */ |
19 | 19 | |
20 | 20 | #include "gdither_types_internal.h" |
14 | 14 | * along with this program; if not, write to the Free Software |
15 | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | 16 | * |
17 | * $Id: gdither.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ | |
17 | * $Id: gdither.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ | |
18 | 18 | */ |
19 | 19 | |
20 | 20 | #ifndef GDITHER_H |
14 | 14 | * along with this program; if not, write to the Free Software |
15 | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | 16 | * |
17 | * $Id: gdither_types.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ | |
17 | * $Id: gdither_types.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ | |
18 | 18 | */ |
19 | 19 | |
20 | 20 | #ifndef GDITHER_TYPES_H |
14 | 14 | * along with this program; if not, write to the Free Software |
15 | 15 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
16 | 16 | * |
17 | * $Id: gdither_types_internal.h,v 1.2 2007/11/15 21:20:42 gmerlin Exp $ | |
17 | * $Id: gdither_types_internal.h,v 1.2 2007-11-15 21:20:42 gmerlin Exp $ | |
18 | 18 | */ |
19 | 19 | |
20 | 20 | #ifndef GDITHER_TYPES_H |
0 | /***************************************************************** | |
1 | * gavl - a general purpose audio/video processing library | |
2 | * | |
3 | * Copyright (c) 2001 - 2011 Members of the Gmerlin project | |
4 | * gmerlin-general@lists.sourceforge.net | |
5 | * http://gmerlin.sourceforge.net | |
6 | * | |
7 | * This program is free software: you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation, either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | * *****************************************************************/ | |
20 | ||
21 | #include <config.h> | |
22 | #include <gavl/metadata.h> | |
23 | ||
24 | #include <stdlib.h> | |
25 | #include <string.h> | |
26 | #include <stdio.h> | |
27 | ||
28 | static char * my_strdup(const char * str) | |
29 | { | |
30 | char * ret; | |
31 | int len = strlen(str) + 1; | |
32 | ||
33 | ret = malloc(len); | |
34 | strncpy(ret, str, len); | |
35 | return ret; | |
36 | } | |
37 | ||
38 | ||
39 | void | |
40 | gavl_metadata_free(gavl_metadata_t * m) | |
41 | { | |
42 | int i; | |
43 | for(i = 0; i < m->num_tags; i++) | |
44 | { | |
45 | free(m->tags[i].key); | |
46 | free(m->tags[i].val); | |
47 | } | |
48 | if(m->tags) | |
49 | free(m->tags); | |
50 | gavl_metadata_init(m); | |
51 | } | |
52 | ||
53 | void | |
54 | gavl_metadata_copy(gavl_metadata_t * dst, | |
55 | const gavl_metadata_t * src) | |
56 | { | |
57 | int i; | |
58 | dst->tags = calloc(src->tags_alloc, sizeof(*dst->tags)); | |
59 | ||
60 | for(i = 0; i < src->num_tags; i++) | |
61 | { | |
62 | dst->tags[i].key = my_strdup(src->tags[i].key); | |
63 | dst->tags[i].val = my_strdup(src->tags[i].val); | |
64 | } | |
65 | dst->tags_alloc = src->tags_alloc; | |
66 | dst->num_tags = src->num_tags; | |
67 | } | |
68 | ||
69 | ||
70 | void | |
71 | gavl_metadata_init(gavl_metadata_t * m) | |
72 | { | |
73 | memset(m, 0, sizeof(*m)); | |
74 | } | |
75 | ||
76 | ||
77 | static int find_tag(const gavl_metadata_t * m, const char * key) | |
78 | { | |
79 | int i; | |
80 | for(i = 0; i < m->num_tags; i++) | |
81 | { | |
82 | if(!strcmp(m->tags[i].key, key)) | |
83 | return i; | |
84 | } | |
85 | return -1; | |
86 | } | |
87 | ||
88 | void | |
89 | gavl_metadata_set(gavl_metadata_t * m, | |
90 | const char * key, | |
91 | const char * val_c) | |
92 | { | |
93 | char * val; | |
94 | if(val_c && (*val_c != '\0')) | |
95 | val = my_strdup(val_c); | |
96 | else | |
97 | val = NULL; | |
98 | gavl_metadata_set_nocpy(m, key, val); | |
99 | } | |
100 | ||
101 | ||
102 | void | |
103 | gavl_metadata_set_nocpy(gavl_metadata_t * m, | |
104 | const char * key, | |
105 | char * val) | |
106 | { | |
107 | int idx = find_tag(m, key); | |
108 | ||
109 | if(idx >= 0) // Tag exists | |
110 | { | |
111 | if(m->tags[idx].val) | |
112 | free(m->tags[idx].val); | |
113 | if(val && (*val != '\0')) // Replace tag | |
114 | m->tags[idx].val = val; | |
115 | else // Delete tag | |
116 | { | |
117 | if(idx < (m->num_tags - 1)) | |
118 | { | |
119 | memmove(m->tags + idx, m->tags + idx + 1, | |
120 | (m->num_tags - 1 - idx) * sizeof(*m->tags)); | |
121 | } | |
122 | m->num_tags--; | |
123 | } | |
124 | } | |
125 | else | |
126 | { | |
127 | if(val && (*val != '\0')) // Add new tag | |
128 | { | |
129 | if(m->num_tags + 1 > m->tags_alloc) | |
130 | { | |
131 | m->tags_alloc = m->num_tags + 16; | |
132 | m->tags = realloc(m->tags, | |
133 | m->tags_alloc * sizeof(*m->tags)); | |
134 | } | |
135 | m->tags[m->num_tags].key = my_strdup(key); | |
136 | m->tags[m->num_tags].val = val; | |
137 | m->num_tags++; | |
138 | } | |
139 | } | |
140 | } | |
141 | ||
142 | #define STR_SIZE 128 | |
143 | ||
144 | void | |
145 | gavl_metadata_set_int(gavl_metadata_t * m, | |
146 | const char * key, | |
147 | int val) | |
148 | { | |
149 | char str[STR_SIZE]; | |
150 | snprintf(str, STR_SIZE, "%d", val); | |
151 | gavl_metadata_set(m, key, str); | |
152 | } | |
153 | ||
154 | #undef STR_SIZE | |
155 | ||
156 | const char * gavl_metadata_get(const gavl_metadata_t * m, | |
157 | const char * key) | |
158 | { | |
159 | int idx = find_tag(m, key); | |
160 | if(idx < 0) | |
161 | return NULL; | |
162 | return m->tags[idx].val; | |
163 | } | |
164 | ||
165 | ||
166 | int gavl_metadata_get_int(const gavl_metadata_t * m, | |
167 | const char * key, int * ret) | |
168 | { | |
169 | char * rest; | |
170 | const char * val_str = gavl_metadata_get(m, key); | |
171 | if(!val_str) | |
172 | return 0; | |
173 | *ret = strtol(val_str, &rest, 10); | |
174 | if(*rest != '\0') | |
175 | return 0; | |
176 | return 1; | |
177 | } | |
178 | ||
179 | /* Time <-> String */ | |
180 | ||
181 | void | |
182 | gavl_metadata_date_to_string(int year, | |
183 | int month, | |
184 | int day, char * ret) | |
185 | { | |
186 | snprintf(ret, GAVL_METADATA_DATE_STRING_LEN, | |
187 | "%04d-%02d-%02d", year, month, day); | |
188 | } | |
189 | ||
190 | void | |
191 | gavl_metadata_date_time_to_string(int year, | |
192 | int month, | |
193 | int day, | |
194 | int hour, | |
195 | int minute, | |
196 | int second, | |
197 | char * ret) | |
198 | { | |
199 | snprintf(ret, GAVL_METADATA_DATE_TIME_STRING_LEN, | |
200 | "%04d-%02d-%02d %02d:%02d:%02d", | |
201 | year, month, day, hour, minute, second); | |
202 | } | |
203 | ||
204 | void | |
205 | gavl_metadata_set_date(gavl_metadata_t * m, | |
206 | const char * key, | |
207 | int year, | |
208 | int month, | |
209 | int day) | |
210 | { | |
211 | // YYYY-MM-DD | |
212 | char buf[GAVL_METADATA_DATE_STRING_LEN]; | |
213 | gavl_metadata_date_to_string(year, month, day, buf); | |
214 | gavl_metadata_set(m, key, buf); | |
215 | } | |
216 | ||
217 | void | |
218 | gavl_metadata_set_date_time(gavl_metadata_t * m, | |
219 | const char * key, | |
220 | int year, | |
221 | int month, | |
222 | int day, | |
223 | int hour, | |
224 | int minute, | |
225 | int second) | |
226 | { | |
227 | // YYYY-MM-DD HH:MM:SS | |
228 | char buf[GAVL_METADATA_DATE_TIME_STRING_LEN]; | |
229 | gavl_metadata_date_time_to_string(year, | |
230 | month, | |
231 | day, | |
232 | hour, | |
233 | minute, | |
234 | second, | |
235 | buf); | |
236 | gavl_metadata_set(m, key, buf); | |
237 | } | |
238 | ||
239 | GAVL_PUBLIC int | |
240 | gavl_metadata_get_date(gavl_metadata_t * m, | |
241 | const char * key, | |
242 | int * year, | |
243 | int * month, | |
244 | int * day) | |
245 | { | |
246 | const char * val = gavl_metadata_get(m, key); | |
247 | if(!val) | |
248 | return 0; | |
249 | ||
250 | if(sscanf(val, "%04d-%02d-%02d", year, month, day) < 3) | |
251 | return 0; | |
252 | return 1; | |
253 | } | |
254 | ||
255 | GAVL_PUBLIC int | |
256 | gavl_metadata_get_date_time(gavl_metadata_t * m, | |
257 | const char * key, | |
258 | int * year, | |
259 | int * month, | |
260 | int * day, | |
261 | int * hour, | |
262 | int * minute, | |
263 | int * second) | |
264 | { | |
265 | const char * val = gavl_metadata_get(m, key); | |
266 | if(!val) | |
267 | return 0; | |
268 | ||
269 | if(sscanf(val, "%04d-%02d-%02d %02d:%02d:%02d", | |
270 | year, month, day, hour, minute, second) < 6) | |
271 | return 0; | |
272 | return 1; | |
273 | } | |
274 | ||
275 | ||
276 | ||
277 | void gavl_metadata_merge(gavl_metadata_t * dst, | |
278 | const gavl_metadata_t * src1, | |
279 | const gavl_metadata_t * src2) | |
280 | { | |
281 | int i; | |
282 | /* src1 has priority */ | |
283 | for(i = 0; i < src1->num_tags; i++) | |
284 | gavl_metadata_set(dst, src1->tags[i].key, src1->tags[i].val); | |
285 | ||
286 | /* From src2 we take only the tags, which aren't available */ | |
287 | for(i = 0; i < src2->num_tags; i++) | |
288 | { | |
289 | if(!gavl_metadata_get(dst, src2->tags[i].key)) | |
290 | gavl_metadata_set(dst, src2->tags[i].key, | |
291 | src2->tags[i].val); | |
292 | } | |
293 | } | |
294 | ||
295 | void gavl_metadata_merge2(gavl_metadata_t * dst, | |
296 | const gavl_metadata_t * src) | |
297 | { | |
298 | int i; | |
299 | for(i = 0; i < src->num_tags; i++) | |
300 | { | |
301 | if(!gavl_metadata_get(dst, src->tags[i].key)) | |
302 | gavl_metadata_set(dst, | |
303 | src->tags[i].key, | |
304 | src->tags[i].val); | |
305 | } | |
306 | } | |
307 | ||
308 | GAVL_PUBLIC void | |
309 | gavl_metadata_dump(const gavl_metadata_t * m, int indent) | |
310 | { | |
311 | int len, i, j; | |
312 | int max_key_len = 0; | |
313 | ||
314 | for(i = 0; i < m->num_tags; i++) | |
315 | { | |
316 | len = strlen(m->tags[i].key); | |
317 | if(len > max_key_len) | |
318 | max_key_len = len; | |
319 | } | |
320 | ||
321 | for(i = 0; i < m->num_tags; i++) | |
322 | { | |
323 | len = strlen(m->tags[i].key); | |
324 | ||
325 | for(j = 0; j < indent; j++) | |
326 | fprintf(stderr, " "); | |
327 | ||
328 | fprintf(stderr, "%s: ", m->tags[i].key); | |
329 | ||
330 | for(j = 0; j < max_key_len - len; j++) | |
331 | fprintf(stderr, " "); | |
332 | ||
333 | fprintf(stderr, "%s\n", m->tags[i].val); | |
334 | } | |
335 | } | |
336 | ||
337 | int | |
338 | gavl_metadata_equal(const gavl_metadata_t * m1, | |
339 | const gavl_metadata_t * m2) | |
340 | { | |
341 | int i; | |
342 | const char * val; | |
343 | ||
344 | /* Check if tags from m1 are present in m2 */ | |
345 | for(i = 0; i < m1->num_tags; i++) | |
346 | { | |
347 | val = gavl_metadata_get(m2, m1->tags[i].key); | |
348 | if(!val || strcmp(val, m1->tags[i].val)) | |
349 | return 0; | |
350 | } | |
351 | ||
352 | /* Check if tags from m2 are present in m1 */ | |
353 | for(i = 0; i < m2->num_tags; i++) | |
354 | { | |
355 | if(!gavl_metadata_get(m1, m2->tags[i].key)) | |
356 | return 0; | |
357 | } | |
358 | return 1; | |
359 | } |
149 | 149 | // int output_side; |
150 | 150 | int input_lfe; |
151 | 151 | int output_lfe; |
152 | ||
153 | 152 | int in_index, out_index; |
154 | 153 | |
154 | float center_level; | |
155 | float rear_level; | |
156 | ||
157 | if(in->center_level > 0.0) | |
158 | center_level = in->center_level; | |
159 | else | |
160 | center_level = 1.0; | |
161 | ||
162 | if(in->rear_level > 0.0) | |
163 | rear_level = in->rear_level; | |
164 | else | |
165 | rear_level = 1.0; | |
166 | ||
155 | 167 | input_front = gavl_front_channels(in); |
156 | 168 | output_front = gavl_front_channels(out); |
157 | 169 | |
361 | 373 | |
362 | 374 | OUT_INDEX(GAVL_CHID_FRONT_CENTER); |
363 | 375 | IN_INDEX(GAVL_CHID_FRONT_CENTER); |
364 | ret[out_index][in_index] = in->center_level; | |
376 | ret[out_index][in_index] = center_level; | |
365 | 377 | break; |
366 | 378 | case 2: /* 3 Front -> 2 Front */ |
367 | 379 | OUT_INDEX(GAVL_CHID_FRONT_LEFT); |
374 | 386 | |
375 | 387 | OUT_INDEX(GAVL_CHID_FRONT_LEFT); |
376 | 388 | IN_INDEX(GAVL_CHID_FRONT_CENTER); |
377 | ret[out_index][in_index] = in->center_level; | |
378 | ||
379 | OUT_INDEX(GAVL_CHID_FRONT_RIGHT); | |
380 | IN_INDEX(GAVL_CHID_FRONT_CENTER); | |
381 | ret[out_index][in_index] = in->center_level; | |
389 | ret[out_index][in_index] = center_level; | |
390 | ||
391 | OUT_INDEX(GAVL_CHID_FRONT_RIGHT); | |
392 | IN_INDEX(GAVL_CHID_FRONT_CENTER); | |
393 | ret[out_index][in_index] = center_level; | |
382 | 394 | break; |
383 | 395 | case 3: /* 3 Front -> 3 Front */ |
384 | 396 | OUT_INDEX(GAVL_CHID_FRONT_LEFT); |
557 | 569 | case 1: /* 1 Rear -> 1 Front */ |
558 | 570 | OUT_INDEX(GAVL_CHID_FRONT_CENTER); |
559 | 571 | IN_INDEX(GAVL_CHID_REAR_CENTER); |
560 | ret[out_index][in_index] = in->rear_level; | |
572 | ret[out_index][in_index] = rear_level; | |
561 | 573 | break; |
562 | 574 | case 2: /* 1 Rear -> 2 Front */ |
563 | 575 | case 3: |
564 | 576 | OUT_INDEX(GAVL_CHID_FRONT_LEFT); |
565 | 577 | IN_INDEX(GAVL_CHID_REAR_CENTER); |
566 | ret[out_index][in_index] = in->rear_level; | |
578 | ret[out_index][in_index] = rear_level; | |
567 | 579 | |
568 | 580 | OUT_INDEX(GAVL_CHID_FRONT_RIGHT); |
569 | 581 | IN_INDEX(GAVL_CHID_REAR_CENTER); |
570 | ret[out_index][in_index] = in->rear_level; | |
582 | ret[out_index][in_index] = rear_level; | |
571 | 583 | break; |
572 | 584 | } |
573 | 585 | break; |
596 | 608 | /* 2 Rear -> 1 Front */ |
597 | 609 | OUT_INDEX(GAVL_CHID_FRONT_CENTER); |
598 | 610 | IN_INDEX(GAVL_CHID_REAR_LEFT); |
599 | ret[out_index][in_index] = in->rear_level; | |
611 | ret[out_index][in_index] = rear_level; | |
600 | 612 | |
601 | 613 | OUT_INDEX(GAVL_CHID_FRONT_CENTER); |
602 | 614 | IN_INDEX(GAVL_CHID_REAR_RIGHT); |
603 | ret[out_index][in_index] = in->rear_level; | |
615 | ret[out_index][in_index] = rear_level; | |
604 | 616 | } |
605 | 617 | else |
606 | 618 | { |
607 | 619 | OUT_INDEX(GAVL_CHID_FRONT_LEFT); |
608 | 620 | IN_INDEX(GAVL_CHID_REAR_LEFT); |
609 | ret[out_index][in_index] = in->rear_level; | |
621 | ret[out_index][in_index] = rear_level; | |
610 | 622 | |
611 | 623 | OUT_INDEX(GAVL_CHID_FRONT_RIGHT); |
612 | 624 | IN_INDEX(GAVL_CHID_REAR_RIGHT); |
613 | ret[out_index][in_index] = in->rear_level; | |
625 | ret[out_index][in_index] = rear_level; | |
614 | 626 | break; |
615 | 627 | } |
616 | 628 | break; |
593 | 593 | case GAVL_SAMPLE_NONE: |
594 | 594 | break; |
595 | 595 | } |
596 | return (gavl_audio_func_t)0; | |
596 | return NULL; | |
597 | 597 | } |
598 | 598 | |
599 | 599 | void gavl_destroy_sampleformat_table(gavl_sampleformat_table_t * t) |
63 | 63 | int i, j; |
64 | 64 | ret = calloc(1, sizeof(*ret)); |
65 | 65 | |
66 | ret->src = gavl_video_frame_create((gavl_video_format_t*)0); | |
67 | ret->dst = gavl_video_frame_create((gavl_video_format_t*)0); | |
66 | ret->src = gavl_video_frame_create(NULL); | |
67 | ret->dst = gavl_video_frame_create(NULL); | |
68 | 68 | |
69 | 69 | gavl_video_options_set_defaults(&ret->opt); |
70 | 70 |
181 | 181 | return tab->scale_float_x_4; |
182 | 182 | break; |
183 | 183 | } |
184 | return (gavl_video_scale_scanline_func)0; | |
184 | return NULL; | |
185 | 185 | } |
186 | 186 | |
187 | 187 | static void get_minmax(gavl_pixelformat_t pixelformat, |
924 | 924 | |
925 | 925 | int h_radius_real; |
926 | 926 | const float * h_coeffs_real; |
927 | float *h_c = (float*)0; | |
927 | float *h_c = NULL; | |
928 | 928 | int v_radius_real; |
929 | 929 | const float * v_coeffs_real; |
930 | float *v_c = (float*)0; | |
930 | float *v_c = NULL; | |
931 | 931 | |
932 | 932 | int src_width, src_height; /* Needed for generating the scale table */ |
933 | 933 |
148 | 148 | return get_weight_sinc; |
149 | 149 | default: |
150 | 150 | *num_points = 0; |
151 | return (gavl_video_scale_get_weight)0; | |
151 | return NULL; | |
152 | 152 | } |
153 | 153 | } |
100 | 100 | int i, j, src_index_min, src_index_nearest; |
101 | 101 | double src_index_f; |
102 | 102 | float widen_factor; |
103 | float * preblur_factors = (float*)0; | |
103 | float * preblur_factors = NULL; | |
104 | 104 | int num_preblur_factors = 0; |
105 | 105 | int num_tmp_factors = 0; |
106 | float * tmp_factors = (float*)0; | |
106 | float * tmp_factors = NULL; | |
107 | 107 | |
108 | 108 | gavl_video_scale_get_weight weight_func; |
109 | 109 |
108 | 108 | uint64_t gavl_benchmark_get_time(int config_flags) |
109 | 109 | { |
110 | 110 | struct timespec ts; |
111 | #if defined(CLOCK_PROCESS_CPUTIME_ID) | |
111 | 112 | clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); |
113 | #elif defined(CLOCK_PROF) | |
114 | clock_gettime(CLOCK_PROF, &ts); | |
115 | #else | |
116 | clockgettime(CLOCK_REALTIME, &ts); | |
117 | #endif | |
118 | ||
112 | 119 | return (uint64_t)(ts.tv_sec) * 1000000000 + ts.tv_nsec; |
113 | 120 | } |
114 | 121 |
123 | 123 | return tab->transform_float_x_4; |
124 | 124 | break; |
125 | 125 | } |
126 | return (gavl_transform_scanline_func)0; | |
126 | return NULL; | |
127 | 127 | } |
128 | 128 | |
129 | 129 |
57 | 57 | free(cnv->first_context); |
58 | 58 | cnv->first_context = ctx; |
59 | 59 | } |
60 | cnv->last_context = (gavl_video_convert_context_t*)0; | |
60 | cnv->last_context = NULL; | |
61 | 61 | cnv->num_contexts = 0; |
62 | 62 | } |
63 | 63 |
136 | 136 | if(interlace_mode_tab[i].mode == mode) |
137 | 137 | return interlace_mode_tab[i].name; |
138 | 138 | } |
139 | return (const char*)0; | |
139 | return NULL; | |
140 | 140 | } |
141 | 141 | |
142 | 142 | typedef const struct |
164 | 164 | if(framerate_mode_tab[i].mode == mode) |
165 | 165 | return framerate_mode_tab[i].name; |
166 | 166 | } |
167 | return (const char*)0; | |
167 | return NULL; | |
168 | 168 | |
169 | 169 | } |
170 | 170 | |
193 | 193 | if(chroma_placement_tab[i].mode == mode) |
194 | 194 | return chroma_placement_tab[i].name; |
195 | 195 | } |
196 | return (const char*)0; | |
196 | return NULL; | |
197 | 197 | |
198 | 198 | } |
199 | 199 | |
292 | 292 | } |
293 | 293 | return ret; |
294 | 294 | } |
295 | ||
296 | void gavl_get_field_format(const gavl_video_format_t * frame_format, | |
297 | gavl_video_format_t * field_format, | |
298 | int field) | |
299 | { | |
300 | gavl_video_format_copy(field_format, frame_format); | |
301 | ||
302 | field_format->image_height /= 2; | |
303 | field_format->frame_height /= 2; | |
304 | ||
305 | if(frame_format->image_height % 2) | |
306 | { | |
307 | /* Top field gets an extra scanline */ | |
308 | if(!field) | |
309 | { | |
310 | field_format->image_height++; | |
311 | if(field_format->frame_height < field_format->image_height) | |
312 | field_format->frame_height = field_format->image_height; | |
313 | } | |
314 | } | |
315 | } |
48 | 48 | static void video_frame_alloc(gavl_video_frame_t * ret, |
49 | 49 | const gavl_video_format_t * format, int align) |
50 | 50 | { |
51 | switch(format->pixelformat) | |
52 | { | |
53 | case GAVL_GRAY_8: | |
54 | ret->strides[0] = format->frame_width; | |
55 | if(align) | |
56 | ALIGN(ret->strides[0]); | |
57 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
58 | ret->strides[0] * format->frame_height); | |
59 | break; | |
60 | case GAVL_GRAYA_16: | |
61 | case GAVL_GRAY_16: | |
62 | case GAVL_RGB_15: | |
63 | case GAVL_BGR_15: | |
64 | case GAVL_RGB_16: | |
65 | case GAVL_BGR_16: | |
66 | ret->strides[0] = format->frame_width*2; | |
67 | if(align) | |
68 | ALIGN(ret->strides[0]); | |
69 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
70 | ret->strides[0] * format->frame_height); | |
71 | break; | |
72 | case GAVL_RGB_24: | |
73 | case GAVL_BGR_24: | |
74 | ret->strides[0] = format->frame_width*3; | |
75 | if(align) | |
76 | ALIGN(ret->strides[0]); | |
77 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
78 | ret->strides[0] * format->frame_height); | |
79 | break; | |
80 | case GAVL_RGB_32: | |
81 | case GAVL_BGR_32: | |
82 | case GAVL_YUVA_32: | |
83 | case GAVL_GRAYA_32: | |
84 | ret->strides[0] = format->frame_width*4; | |
85 | if(align) | |
86 | ALIGN(ret->strides[0]); | |
87 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
88 | ret->strides[0] * format->frame_height); | |
89 | break; | |
90 | case GAVL_RGBA_32: | |
91 | ret->strides[0] = format->frame_width*4; | |
92 | if(align) | |
93 | ALIGN(ret->strides[0]); | |
94 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
95 | ret->strides[0] * format->frame_height); | |
96 | break; | |
97 | case GAVL_RGB_48: | |
98 | ret->strides[0] = format->frame_width*6; | |
99 | if(align) | |
100 | ALIGN(ret->strides[0]); | |
101 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
102 | ret->strides[0] * format->frame_height); | |
103 | break; | |
104 | case GAVL_RGBA_64: | |
105 | case GAVL_YUVA_64: | |
106 | ret->strides[0] = format->frame_width*8; | |
107 | if(align) | |
108 | ALIGN(ret->strides[0]); | |
109 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
110 | ret->strides[0] * format->frame_height); | |
111 | break; | |
112 | case GAVL_GRAY_FLOAT: | |
113 | ret->strides[0] = format->frame_width*sizeof(float); | |
114 | if(align) | |
115 | ALIGN(ret->strides[0]); | |
116 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
117 | ret->strides[0] * format->frame_height); | |
118 | break; | |
119 | case GAVL_GRAYA_FLOAT: | |
120 | ret->strides[0] = 2*format->frame_width*sizeof(float); | |
121 | if(align) | |
122 | ALIGN(ret->strides[0]); | |
123 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
124 | ret->strides[0] * format->frame_height); | |
125 | break; | |
126 | ||
127 | case GAVL_RGB_FLOAT: | |
128 | case GAVL_YUV_FLOAT: | |
129 | ret->strides[0] = format->frame_width*3*sizeof(float); | |
130 | if(align) | |
131 | ALIGN(ret->strides[0]); | |
132 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
133 | ret->strides[0] * format->frame_height); | |
134 | break; | |
135 | case GAVL_RGBA_FLOAT: | |
136 | case GAVL_YUVA_FLOAT: | |
137 | ret->strides[0] = format->frame_width*4*sizeof(float); | |
138 | if(align) | |
139 | ALIGN(ret->strides[0]); | |
140 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
141 | ret->strides[0] * format->frame_height); | |
142 | break; | |
143 | case GAVL_YUY2: | |
144 | case GAVL_UYVY: | |
145 | ret->strides[0] = format->frame_width*2; | |
146 | if(align) | |
147 | ALIGN(ret->strides[0]); | |
148 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
149 | ret->strides[0] * format->frame_height); | |
150 | break; | |
151 | case GAVL_YUV_420_P: | |
152 | case GAVL_YUVJ_420_P: | |
153 | ret->strides[0] = format->frame_width; | |
154 | ret->strides[1] = (format->frame_width+1)/2; | |
155 | ret->strides[2] = (format->frame_width+1)/2; | |
156 | ||
51 | int planar; | |
52 | ||
53 | if(format->pixelformat == GAVL_PIXELFORMAT_NONE) | |
54 | { | |
55 | fprintf(stderr, "Pixelformat not specified for video frame\n"); | |
56 | return; | |
57 | } | |
58 | planar = gavl_pixelformat_is_planar(format->pixelformat); | |
59 | ||
60 | if(planar) | |
61 | { | |
62 | int sub_h; | |
63 | int sub_v; | |
64 | int bpc; | |
65 | ||
66 | gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); | |
67 | ||
68 | bpc = gavl_pixelformat_bytes_per_component(format->pixelformat); | |
69 | ||
70 | if(!ret->strides[0]) | |
71 | { | |
72 | ret->strides[0] = bpc * format->frame_width; | |
73 | ret->strides[1] = bpc * ((format->frame_width + sub_h - 1) / sub_h); | |
74 | ret->strides[2] = ret->strides[1]; | |
75 | ||
157 | 76 | if(align) |
158 | 77 | { |
159 | 78 | ALIGN(ret->strides[0]); |
160 | 79 | ALIGN(ret->strides[1]); |
161 | 80 | ALIGN(ret->strides[2]); |
162 | 81 | } |
163 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
164 | ret->strides[0]*format->frame_height+ | |
165 | ret->strides[1]*((format->frame_height+1)/2)+ | |
166 | ret->strides[2]*((format->frame_height+1)/2)); | |
167 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
168 | ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+1)/2); | |
169 | break; | |
170 | case GAVL_YUV_410_P: | |
171 | ret->strides[0] = format->frame_width; | |
172 | ret->strides[1] = (format->frame_width+3)/4; | |
173 | ret->strides[2] = (format->frame_width+3)/4; | |
174 | ||
82 | } | |
83 | ||
84 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
85 | ret->strides[0]*format->frame_height+ | |
86 | ret->strides[1]*((format->frame_height+sub_v-1)/sub_v)+ | |
87 | ret->strides[2]*((format->frame_height+sub_v-1)/sub_v)); | |
88 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
89 | ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+sub_v-1)/sub_v); | |
90 | } | |
91 | else // Packed | |
92 | { | |
93 | if(!ret->strides[0]) | |
94 | { | |
95 | ret->strides[0] = | |
96 | format->frame_width * gavl_pixelformat_bytes_per_pixel(format->pixelformat); | |
175 | 97 | if(align) |
176 | { | |
177 | 98 | ALIGN(ret->strides[0]); |
178 | ALIGN(ret->strides[1]); | |
179 | ALIGN(ret->strides[2]); | |
180 | } | |
181 | ||
182 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
183 | ret->strides[0]*format->frame_height+ | |
184 | ret->strides[1]*((format->frame_height+3)/4)+ | |
185 | ret->strides[2]*((format->frame_height+3)/4)); | |
186 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
187 | ret->planes[2] = ret->planes[1] + ret->strides[1]*((format->frame_height+3)/4); | |
188 | break; | |
189 | case GAVL_YUV_422_P: | |
190 | case GAVL_YUVJ_422_P: | |
191 | ret->strides[0] = format->frame_width; | |
192 | ret->strides[1] = (format->frame_width+1)/2; | |
193 | ret->strides[2] = (format->frame_width+1)/2; | |
194 | ||
195 | if(align) | |
196 | { | |
197 | ALIGN(ret->strides[0]); | |
198 | ALIGN(ret->strides[1]); | |
199 | ALIGN(ret->strides[2]); | |
200 | } | |
201 | ||
202 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
203 | ret->strides[0]*format->frame_height+ | |
204 | ret->strides[1]*format->frame_height+ | |
205 | ret->strides[2]*format->frame_height); | |
206 | ||
207 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
208 | ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; | |
209 | break; | |
210 | case GAVL_YUV_422_P_16: | |
211 | ret->strides[0] = format->frame_width*2; | |
212 | ret->strides[1] = ((format->frame_width+1)/2)*2; | |
213 | ret->strides[2] = ((format->frame_width+1)/2)*2; | |
214 | ||
215 | if(align) | |
216 | { | |
217 | ALIGN(ret->strides[0]); | |
218 | ALIGN(ret->strides[1]); | |
219 | ALIGN(ret->strides[2]); | |
220 | } | |
221 | ||
222 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
223 | ret->strides[0]*format->frame_height+ | |
224 | ret->strides[1]*format->frame_height+ | |
225 | ret->strides[2]*format->frame_height); | |
226 | ||
227 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
228 | ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; | |
229 | break; | |
230 | case GAVL_YUV_411_P: | |
231 | ret->strides[0] = format->frame_width; | |
232 | ret->strides[1] = (format->frame_width+3)/4; | |
233 | ret->strides[2] = (format->frame_width+3)/4; | |
234 | ||
235 | if(align) | |
236 | { | |
237 | ALIGN(ret->strides[0]); | |
238 | ALIGN(ret->strides[1]); | |
239 | ALIGN(ret->strides[2]); | |
240 | } | |
241 | ||
242 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
243 | ret->strides[0]*format->frame_height+ | |
244 | ret->strides[1]*format->frame_height+ | |
245 | ret->strides[2]*format->frame_height); | |
246 | ||
247 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
248 | ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; | |
249 | break; | |
250 | case GAVL_YUV_444_P: | |
251 | case GAVL_YUVJ_444_P: | |
252 | ret->strides[0] = format->frame_width; | |
253 | ret->strides[1] = format->frame_width; | |
254 | ret->strides[2] = format->frame_width; | |
255 | ||
256 | if(align) | |
257 | { | |
258 | ALIGN(ret->strides[0]); | |
259 | ALIGN(ret->strides[1]); | |
260 | ALIGN(ret->strides[2]); | |
261 | } | |
262 | ||
263 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
264 | ret->strides[0]*format->frame_height+ | |
265 | ret->strides[1]*format->frame_height+ | |
266 | ret->strides[2]*format->frame_height); | |
267 | ||
268 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
269 | ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; | |
270 | break; | |
271 | case GAVL_YUV_444_P_16: | |
272 | ret->strides[0] = format->frame_width*2; | |
273 | ret->strides[1] = format->frame_width*2; | |
274 | ret->strides[2] = format->frame_width*2; | |
275 | ||
276 | if(align) | |
277 | { | |
278 | ALIGN(ret->strides[0]); | |
279 | ALIGN(ret->strides[1]); | |
280 | ALIGN(ret->strides[2]); | |
281 | } | |
282 | ||
283 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
284 | ret->strides[0]*format->frame_height+ | |
285 | ret->strides[1]*format->frame_height+ | |
286 | ret->strides[2]*format->frame_height); | |
287 | ||
288 | ret->planes[1] = ret->planes[0] + ret->strides[0]*format->frame_height; | |
289 | ret->planes[2] = ret->planes[1] + ret->strides[1]*format->frame_height; | |
290 | break; | |
291 | case GAVL_PIXELFORMAT_NONE: | |
292 | fprintf(stderr, "Pixelformat not specified for video frame\n"); | |
293 | return; | |
294 | } | |
295 | ||
99 | } | |
100 | ret->planes[0] = memalign(ALIGNMENT_BYTES, | |
101 | ret->strides[0] * format->frame_height); | |
102 | } | |
296 | 103 | } |
297 | 104 | |
298 | 105 | static void video_frame_free(gavl_video_frame_t * frame) |
299 | 106 | { |
300 | 107 | if(frame->planes[0]) |
301 | 108 | free(frame->planes[0]); |
302 | frame->planes[0] = (uint8_t*)0; | |
109 | frame->planes[0] = NULL; | |
303 | 110 | } |
304 | 111 | |
305 | 112 | gavl_video_frame_t * gavl_video_frame_create(const gavl_video_format_t * format) |
329 | 136 | |
330 | 137 | void gavl_video_frame_null(gavl_video_frame_t* frame) |
331 | 138 | { |
332 | frame->planes[0] = (uint8_t*)0; | |
139 | frame->planes[0] = NULL; | |
333 | 140 | } |
334 | 141 | |
335 | 142 | void gavl_video_frame_clear_mask(gavl_video_frame_t * frame, |
1037 | 844 | case GAVL_PIXELFORMAT_NONE: |
1038 | 845 | break; |
1039 | 846 | } |
1040 | return (flip_scanline_func)0; | |
847 | return NULL; | |
1041 | 848 | } |
1042 | 849 | |
1043 | 850 | void gavl_video_frame_copy_flip_x(const gavl_video_format_t * format, |
1509 | 1316 | uint16_t packed_16; |
1510 | 1317 | uint8_t packed_32[4]; |
1511 | 1318 | uint16_t packed_64[4]; |
1512 | float color_float[2]; | |
1319 | float color_float[4]; | |
1513 | 1320 | |
1514 | 1321 | gavl_init_memcpy(); |
1515 | 1322 | |
1743 | 1550 | int i; |
1744 | 1551 | int sub_h, sub_v; |
1745 | 1552 | int advance; |
1746 | int num_planes = gavl_pixelformat_num_planes(format->pixelformat); | |
1553 | int num_planes; | |
1747 | 1554 | if(!frame->strides[0]) |
1748 | 1555 | gavl_video_frame_set_strides(frame, format); |
1749 | 1556 | |
1750 | gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); | |
1751 | ||
1752 | for(i = 0; i < num_planes; i++) | |
1753 | { | |
1754 | frame->planes[i] = buffer; | |
1755 | advance = frame->strides[i] * format->frame_height; | |
1756 | if(i) | |
1757 | advance /= sub_v; | |
1758 | buffer += advance; | |
1557 | if(buffer) | |
1558 | { | |
1559 | num_planes = gavl_pixelformat_num_planes(format->pixelformat); | |
1560 | gavl_pixelformat_chroma_sub(format->pixelformat, &sub_h, &sub_v); | |
1561 | ||
1562 | for(i = 0; i < num_planes; i++) | |
1563 | { | |
1564 | frame->planes[i] = buffer; | |
1565 | advance = frame->strides[i] * format->frame_height; | |
1566 | if(i) | |
1567 | advance /= sub_v; | |
1568 | buffer += advance; | |
1569 | } | |
1570 | } | |
1571 | else | |
1572 | { | |
1573 | video_frame_alloc(frame, format, 0); | |
1759 | 1574 | } |
1760 | 1575 | |
1761 | 1576 | } |
0 | pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h | |
0 | pkginclude_HEADERS = \ | |
1 | compression.h \ | |
2 | gavl.h \ | |
3 | gavltime.h \ | |
4 | gavl_version.h \ | |
5 | gavldsp.h \ | |
6 | timecode.h \ | |
7 | gavldefs.h \ | |
8 | metadata.h \ | |
9 | metatags.h | |
10 | ||
1 | 11 | |
2 | 12 | EXTRA_DIST = gavl_version.h.in |
205 | 205 | top_build_prefix = @top_build_prefix@ |
206 | 206 | top_builddir = @top_builddir@ |
207 | 207 | top_srcdir = @top_srcdir@ |
208 | pkginclude_HEADERS = compression.h gavl.h gavltime.h gavl_version.h gavldsp.h timecode.h gavldefs.h | |
208 | pkginclude_HEADERS = \ | |
209 | compression.h \ | |
210 | gavl.h \ | |
211 | gavltime.h \ | |
212 | gavl_version.h \ | |
213 | gavldsp.h \ | |
214 | timecode.h \ | |
215 | gavldefs.h \ | |
216 | metadata.h \ | |
217 | metatags.h | |
218 | ||
209 | 219 | EXTRA_DIST = gavl_version.h.in |
210 | 220 | all: config.h |
211 | 221 | $(MAKE) $(AM_MAKEFLAGS) all-am |
45 | 45 | #define GAVL_COMPRESSION_HAS_B_FRAMES (1<<1) //!< Frames don't appear in presentation order |
46 | 46 | #define GAVL_COMPRESSION_HAS_FIELD_PICTURES (1<<2) //!< Packets can consist of 2 consecutive fields |
47 | 47 | #define GAVL_COMPRESSION_SBR (1<<3) //!< Samplerate got doubled by decoder, format and sample counts are for the upsampled rate |
48 | ||
49 | /** \brief Codec ID | |
50 | * | |
51 | * These are used as identifiers for the type of compression | |
52 | */ | |
48 | 53 | |
49 | 54 | typedef enum |
50 | 55 | { |
57 | 62 | GAVL_CODEC_ID_AC3, //!< AC3 |
58 | 63 | GAVL_CODEC_ID_AAC, //!< AAC as stored in quicktime/mp4 |
59 | 64 | GAVL_CODEC_ID_VORBIS, //!< Vorbis (segmented extradata and packets) |
65 | GAVL_CODEC_ID_FLAC, //!< Flac (extradata contain a file header without comment and seektable) | |
60 | 66 | |
61 | 67 | /* Video */ |
62 | 68 | GAVL_CODEC_ID_JPEG = 0x10000, //!< JPEG image |
67 | 73 | GAVL_CODEC_ID_MPEG2, //!< MPEG-2 video |
68 | 74 | GAVL_CODEC_ID_MPEG4_ASP, //!< MPEG-4 ASP (a.k.a. Divx4) |
69 | 75 | GAVL_CODEC_ID_H264, //!< H.264 (Annex B) |
70 | GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata | |
76 | GAVL_CODEC_ID_THEORA, //!< Theora (segmented extradata) | |
71 | 77 | GAVL_CODEC_ID_DIRAC, //!< Complete DIRAC frames, sequence end code appended to last packet |
72 | 78 | GAVL_CODEC_ID_DV, //!< DV (several variants) |
73 | 79 | } gavl_codec_id_t; |
110 | 116 | GAVL_PUBLIC |
111 | 117 | void gavl_compression_info_dump(const gavl_compression_info_t * info); |
112 | 118 | |
119 | /** \brief Copy a compression info | |
120 | * \param dst Destination | |
121 | * \param src Source | |
122 | * | |
123 | */ | |
124 | ||
125 | GAVL_PUBLIC | |
126 | void gavl_compression_info_copy(gavl_compression_info_t * dst, | |
127 | const gavl_compression_info_t * src); | |
128 | ||
129 | ||
113 | 130 | /** \brief Get the file extension of the corresponding raw format |
114 | 131 | * \param id A codec ID |
115 | 132 | * \param separate If non-null returns 1 if each packet should be in a separate file |
140 | 157 | GAVL_PUBLIC |
141 | 158 | int gavl_compression_need_pixelformat(gavl_codec_id_t id); |
142 | 159 | |
160 | /** \brief Check if an audio compression constant frame samples | |
161 | * \param id A codec ID | |
162 | * \returns 1 if the compression has the same number of samples in each frame, 0 else | |
163 | * | |
164 | */ | |
165 | ||
166 | GAVL_PUBLIC | |
167 | int gavl_compression_constant_frame_samples(gavl_codec_id_t id); | |
168 | ||
169 | ||
143 | 170 | |
144 | 171 | #define GAVL_PACKET_TYPE_I 'I' //!< Packet is an I-frame |
145 | 172 | #define GAVL_PACKET_TYPE_P 'P' //!< Packet is a P-frame |
206 | 233 | GAVL_PUBLIC |
207 | 234 | void gavl_packet_dump(const gavl_packet_t * p); |
208 | 235 | |
236 | /** | |
237 | * @} | |
238 | */ | |
209 | 239 | |
210 | 240 | #ifdef __cplusplus |
211 | 241 | } |
700 | 700 | |
701 | 701 | Plots an audio frame into an ascii file with one line per |
702 | 702 | sample in the format: |
703 | <sample_number> <channel1> <channel2> ... | |
703 | sample_number channel1 channel2 ... | |
704 | 704 | |
705 | 705 | In addition, a file for making a plot with gnuplot is generated. |
706 | 706 | name_base is used for generating the filenames. For the data file, |
2227 | 2227 | int gavl_get_color_channel_format(const gavl_video_format_t * frame_format, |
2228 | 2228 | gavl_video_format_t * channel_format, |
2229 | 2229 | gavl_color_channel_t ch); |
2230 | ||
2231 | ||
2232 | /*! | |
2233 | \ingroup video_format | |
2234 | \brief Get the video format of one field | |
2235 | \param frame_format The video format of the full frame | |
2236 | \param field_format Format of the field | |
2237 | \param field Field (0 or 1) | |
2238 | ||
2239 | Use this function if you need to split a frame into fields. | |
2240 | It handles odd heights correctly | |
2241 | ||
2242 | Since 1.2.1 | |
2243 | */ | |
2244 | ||
2245 | GAVL_PUBLIC | |
2246 | void gavl_get_field_format(const gavl_video_format_t * frame_format, | |
2247 | gavl_video_format_t * field_format, | |
2248 | int field); | |
2230 | 2249 | |
2231 | 2250 | |
2232 | 2251 | /*! |
3767 | 3786 | |
3768 | 3787 | /** \brief Create a frame table for constant framerate video |
3769 | 3788 | * \param offset Timestamp of the first frame |
3770 | * \param duration Duration of each frame | |
3789 | * \param frame_duration Duration of each frame | |
3771 | 3790 | * \param num_frames Number of frames |
3772 | * \param fmt Timecode format (or NULL) | |
3773 | 3791 | * \param start_timecode Timecode of the first frame (or GAVL_TIMECODE_UNDEFINED) |
3774 | 3792 | * \returns A newly allocated frame table |
3775 | 3793 | * |
3939 | 3957 | */ |
3940 | 3958 | |
3941 | 3959 | GAVL_PUBLIC |
3942 | int gavl_frame_table_save(const gavl_frame_table_t * tab, | |
3960 | int gavl_frame_table_save(const gavl_frame_table_t * t, | |
3943 | 3961 | const char * filename); |
3944 | 3962 | |
3945 | 3963 | /** \brief Load a frame table from a file |
0 | 0 | #ifndef __GAVL_VERSION_H_ |
1 | 1 | #define __GAVL_VERSION_H_ |
2 | 2 | |
3 | #define GAVL_VERSION "1.2.0" | |
3 | #define GAVL_VERSION "1.4.0" | |
4 | 4 | |
5 | 5 | #define GAVL_VERSION_MAJOR 1 |
6 | #define GAVL_VERSION_MINOR 2 | |
6 | #define GAVL_VERSION_MINOR 4 | |
7 | 7 | #define GAVL_VERSION_MICRO 0 |
8 | 8 | |
9 | 9 | #define GAVL_MAKE_BUILD(a,b,c) ((a << 16) + (b << 8) + c) |
275 | 275 | uint64_t gavl_benchmark_get_time(int flags); |
276 | 276 | |
277 | 277 | /*! \ingroup timer |
278 | * \brief Get a description about the value returned by \ref gavl_benchmark_get_time | |
278 | * \brief Get a description about the value returned by | |
279 | * \ref gavl_benchmark_get_time | |
279 | 280 | * \param flags Flags returned by \ref gavl_accel_supported |
280 | 281 | * \returns A string describing what the time value means |
281 | 282 | * |
0 | /***************************************************************** | |
1 | * gavl - a general purpose audio/video processing library | |
2 | * | |
3 | * Copyright (c) 2001 - 2011 Members of the Gmerlin project | |
4 | * gmerlin-general@lists.sourceforge.net | |
5 | * http://gmerlin.sourceforge.net | |
6 | * | |
7 | * This program is free software: you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation, either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | * *****************************************************************/ | |
20 | ||
21 | #ifndef GAVL_METADATA_H_INCLUDED | |
22 | #define GAVL_METADATA_H_INCLUDED | |
23 | ||
24 | #ifdef __cplusplus | |
25 | extern "C" { | |
26 | #endif | |
27 | ||
28 | #include <gavl/gavldefs.h> | |
29 | ||
30 | /** \defgroup metadata Metadata | |
31 | * \brief Metadata support | |
32 | * | |
33 | * This is a simple dictionary structure, which is | |
34 | * used my gmerlin applications and libraries to | |
35 | * associate metadata with a media file or a single | |
36 | * media stream. | |
37 | * | |
38 | * Metadata are defined as all data, which are not directly | |
39 | * related to the decoding process, but might be of interest | |
40 | * for the user. | |
41 | * | |
42 | * The tag types are completely generic so applications can | |
43 | * define their own tags. For compatibility it is, however | |
44 | * recommended to use the tags defined in \ref metatags.h | |
45 | * | |
46 | * Since 1.4.0 | |
47 | * | |
48 | * @{ | |
49 | */ | |
50 | ||
51 | /** Length of a date string of the format YYYY-MM-DD | |
52 | */ | |
53 | #define GAVL_METADATA_DATE_STRING_LEN 11 | |
54 | ||
55 | /** Length of a date/time string of the format YYYY-MM-DD HH:MM:SS | |
56 | */ | |
57 | ||
58 | #define GAVL_METADATA_DATE_TIME_STRING_LEN 20 | |
59 | ||
60 | /** \brief Single metadata tag | |
61 | */ | |
62 | ||
63 | typedef struct | |
64 | { | |
65 | char * key; //!< Key | |
66 | char * val; //!< Value | |
67 | } gavl_metadata_tag_t; | |
68 | ||
69 | /** \brief Single metadata structure | |
70 | */ | |
71 | ||
72 | ||
73 | typedef struct | |
74 | { | |
75 | gavl_metadata_tag_t * tags; //!< Array of tags | |
76 | int tags_alloc; //!< Number of allocated tags (never touch this) | |
77 | int num_tags; //!< Number of valid tags | |
78 | } gavl_metadata_t; | |
79 | ||
80 | /** \brief Free all metadata tags | |
81 | * \arg m A metadata structure | |
82 | */ | |
83 | ||
84 | GAVL_PUBLIC void | |
85 | gavl_metadata_free(gavl_metadata_t * m); | |
86 | ||
87 | /** \brief Initialize structre | |
88 | * \arg m A metadata structure | |
89 | * | |
90 | * Use this if you define a \ref gavl_metadata_t | |
91 | * structure in unintialized memory (e.g. on the stack) | |
92 | * before using it. | |
93 | */ | |
94 | ||
95 | GAVL_PUBLIC void | |
96 | gavl_metadata_init(gavl_metadata_t * m); | |
97 | ||
98 | /** \brief Set a tag | |
99 | * \arg m A metadata structure | |
100 | * \arg key Key | |
101 | * \arg val Value | |
102 | * | |
103 | * Set a metadata tag. The value is copied. | |
104 | */ | |
105 | ||
106 | GAVL_PUBLIC void | |
107 | gavl_metadata_set(gavl_metadata_t * m, | |
108 | const char * key, | |
109 | const char * val); | |
110 | ||
111 | /** \brief Set a tag | |
112 | * \arg m A metadata structure | |
113 | * \arg key Key | |
114 | * \arg val Value | |
115 | * | |
116 | * Like \ref gavl_metadata_set except that the | |
117 | * value is not copied. | |
118 | */ | |
119 | ||
120 | GAVL_PUBLIC void | |
121 | gavl_metadata_set_nocpy(gavl_metadata_t * m, | |
122 | const char * key, | |
123 | char * val); | |
124 | ||
125 | /** \brief Get the value of a tag | |
126 | * \arg m A metadata structure | |
127 | * \arg key Key | |
128 | * \returns Value of the tag or NULL if the tag doesn't exist | |
129 | */ | |
130 | ||
131 | GAVL_PUBLIC | |
132 | const char * gavl_metadata_get(const gavl_metadata_t * m, | |
133 | const char * key); | |
134 | ||
135 | /** \brief Set an integer tag | |
136 | * \arg m A metadata structure | |
137 | * \arg key Key | |
138 | * \arg val Value | |
139 | */ | |
140 | ||
141 | GAVL_PUBLIC void | |
142 | gavl_metadata_set_int(gavl_metadata_t * m, | |
143 | const char * key, | |
144 | int val); | |
145 | ||
146 | /** \brief Get an integer tag | |
147 | * \arg m A metadata structure | |
148 | * \arg key Key | |
149 | * \arg ret Returns the value | |
150 | * \returns 1 if ret contains a valid tag, 0 if the tag doesn't exist or is not numeric | |
151 | */ | |
152 | ||
153 | GAVL_PUBLIC | |
154 | int gavl_metadata_get_int(const gavl_metadata_t * m, | |
155 | const char * key, int * ret); | |
156 | ||
157 | /** \brief Set a date tag | |
158 | * \arg m A metadata structure | |
159 | * \arg key Key | |
160 | * \arg year Year | |
161 | * \arg month Month | |
162 | * \arg day Day | |
163 | */ | |
164 | ||
165 | GAVL_PUBLIC void | |
166 | gavl_metadata_set_date(gavl_metadata_t * m, | |
167 | const char * key, | |
168 | int year, | |
169 | int month, | |
170 | int day); | |
171 | ||
172 | /** \brief Get a date tag | |
173 | * \arg m A metadata structure | |
174 | * \arg key Key | |
175 | * \arg year Returns year | |
176 | * \arg month Returns month | |
177 | * \arg day Returns day | |
178 | * \returns 1 if a valid date was returned, 0 else | |
179 | */ | |
180 | ||
181 | GAVL_PUBLIC int | |
182 | gavl_metadata_get_date(gavl_metadata_t * m, | |
183 | const char * key, | |
184 | int * year, | |
185 | int * month, | |
186 | int * day); | |
187 | ||
188 | /** \brief Set a date/time tag | |
189 | * \arg m A metadata structure | |
190 | * \arg key Key | |
191 | * \arg year Year | |
192 | * \arg month Month | |
193 | * \arg day Day | |
194 | * \arg hour Hour | |
195 | * \arg minute Minute | |
196 | * \arg second Second | |
197 | */ | |
198 | ||
199 | GAVL_PUBLIC void | |
200 | gavl_metadata_set_date_time(gavl_metadata_t * m, | |
201 | const char * key, | |
202 | int year, | |
203 | int month, | |
204 | int day, | |
205 | int hour, | |
206 | int minute, | |
207 | int second); | |
208 | ||
209 | /** \brief Get a date/time tag | |
210 | * \arg m A metadata structure | |
211 | * \arg key Key | |
212 | * \arg year Returns year | |
213 | * \arg month Returns month | |
214 | * \arg day Returns day | |
215 | * \arg hour Returns hour | |
216 | * \arg minute Returns minute | |
217 | * \arg second Returns second | |
218 | * \returns 1 if a valid date/time was returned, 0 else | |
219 | */ | |
220 | ||
221 | GAVL_PUBLIC int | |
222 | gavl_metadata_get_date_time(gavl_metadata_t * m, | |
223 | const char * key, | |
224 | int * year, | |
225 | int * month, | |
226 | int * day, | |
227 | int * hour, | |
228 | int * minute, | |
229 | int * second); | |
230 | ||
231 | /** \brief Format a date string | |
232 | * \arg year Year | |
233 | * \arg month Month | |
234 | * \arg day Day | |
235 | * \arg ret String to be formatted | |
236 | * | |
237 | * The string needs to be at least \ref GAVL_METADATA_DATE_STRING_LEN | |
238 | * bytes long. | |
239 | */ | |
240 | ||
241 | GAVL_PUBLIC void | |
242 | gavl_metadata_date_to_string(int year, | |
243 | int month, | |
244 | int day, char * ret); | |
245 | ||
246 | /** \brief Format a date string | |
247 | * \arg year Year | |
248 | * \arg month Month | |
249 | * \arg day Day | |
250 | * \arg ret String to be formatted | |
251 | * \arg hour Hour | |
252 | * \arg minute Minute | |
253 | * \arg second Second | |
254 | * | |
255 | * The string needs to be at least | |
256 | * \ref GAVL_METADATA_DATE_TIME_STRING_LEN bytes long. | |
257 | */ | |
258 | ||
259 | GAVL_PUBLIC void | |
260 | gavl_metadata_date_time_to_string(int year, | |
261 | int month, | |
262 | int day, | |
263 | int hour, | |
264 | int minute, | |
265 | int second, | |
266 | char * ret); | |
267 | ||
268 | /** \brief Merge two metadata structures | |
269 | * \arg dst Destination | |
270 | * \arg src1 First source | |
271 | * \arg src2 Second source | |
272 | * | |
273 | * Copy all tags from src1 and src2 to dst. If a tag | |
274 | * is available in src1 and src2, the one from src1 is | |
275 | * taken. | |
276 | */ | |
277 | ||
278 | GAVL_PUBLIC | |
279 | void gavl_metadata_merge(gavl_metadata_t * dst, | |
280 | const gavl_metadata_t * src1, | |
281 | const gavl_metadata_t * src2); | |
282 | ||
283 | /** \brief Merge two metadata structures | |
284 | * \arg dst Destination | |
285 | * \arg src Source | |
286 | * | |
287 | * Copy tags from src to dst, which are not | |
288 | * already contained in dst. | |
289 | */ | |
290 | ||
291 | GAVL_PUBLIC | |
292 | void gavl_metadata_merge2(gavl_metadata_t * dst, | |
293 | const gavl_metadata_t * src); | |
294 | ||
295 | /** \brief Copy metadata structure | |
296 | * \arg dst Destination | |
297 | * \arg src Source | |
298 | * | |
299 | * Copy all tags from src to dst | |
300 | */ | |
301 | ||
302 | GAVL_PUBLIC void | |
303 | gavl_metadata_copy(gavl_metadata_t * dst, | |
304 | const gavl_metadata_t * src); | |
305 | ||
306 | /** \brief Dump metadata structure to stderr | |
307 | * \arg m Metadata | |
308 | * \arg indent Spaces to append to each line | |
309 | */ | |
310 | ||
311 | GAVL_PUBLIC void | |
312 | gavl_metadata_dump(const gavl_metadata_t * m, int indent); | |
313 | ||
314 | /** \brief Check if 2 metadata structures are equal | |
315 | * \arg m1 Metadata 1 | |
316 | * \arg m2 Metadata 2 | |
317 | * \returns 1 if the 2 metadata structures are identical, 0 else | |
318 | */ | |
319 | ||
320 | GAVL_PUBLIC int | |
321 | gavl_metadata_equal(const gavl_metadata_t * m1, | |
322 | const gavl_metadata_t * m2); | |
323 | ||
324 | /** | |
325 | * @} | |
326 | */ | |
327 | ||
328 | #ifdef __cplusplus | |
329 | } | |
330 | #endif | |
331 | ||
332 | #endif // GAVL_METADATA_H_INCLUDED |
0 | /***************************************************************** | |
1 | * gavl - a general purpose audio/video processing library | |
2 | * | |
3 | * Copyright (c) 2001 - 2011 Members of the Gmerlin project | |
4 | * gmerlin-general@lists.sourceforge.net | |
5 | * http://gmerlin.sourceforge.net | |
6 | * | |
7 | * This program is free software: you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation, either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 | * *****************************************************************/ | |
20 | ||
21 | #ifndef GAVL_METATAGS_H_INCLUDED | |
22 | #define GAVL_METATAGS_H_INCLUDED | |
23 | ||
24 | /** \defgroup metatags Defined metadata keys | |
25 | * \ingroup metadata | |
26 | * | |
27 | * For interoperabiolity reasons, try to use these macros | |
28 | * as metadata keys whenever possible. | |
29 | * | |
30 | * Since 1.4.0 | |
31 | * | |
32 | * @{ | |
33 | */ | |
34 | ||
35 | /** \brief Title of the song/movie... */ | |
36 | ||
37 | #define GAVL_META_TITLE "Title" | |
38 | ||
39 | /** \brief Performing artist */ | |
40 | ||
41 | #define GAVL_META_ARTIST "Artist" | |
42 | ||
43 | /** \brief Artist of the Album */ | |
44 | ||
45 | #define GAVL_META_ALBUMARTIST "Albumartist" | |
46 | ||
47 | /** \brief Author */ | |
48 | ||
49 | #define GAVL_META_AUTHOR "Author" | |
50 | ||
51 | /** \brief Copyright */ | |
52 | ||
53 | #define GAVL_META_COPYRIGHT "Copyright" | |
54 | ||
55 | /** \brief Album */ | |
56 | ||
57 | #define GAVL_META_ALBUM "Album" | |
58 | ||
59 | /** \brief Genre */ | |
60 | ||
61 | #define GAVL_META_GENRE "Genre" | |
62 | ||
63 | /** \brief Tracknumber within the album | |
64 | * | |
65 | * Integer starting with 1 | |
66 | */ | |
67 | ||
68 | #define GAVL_META_TRACKNUMBER "Tracknumber" | |
69 | ||
70 | /** \brief Generic date | |
71 | * | |
72 | * YYYY-MM-DD [HH:MM:SS] | |
73 | */ | |
74 | ||
75 | #define GAVL_META_DATE "Date" | |
76 | ||
77 | /** \brief Creation date | |
78 | * | |
79 | * YYYY-MM-DD [HH:MM:SS] | |
80 | */ | |
81 | ||
82 | #define GAVL_META_DATE_CREATE "CreationDate" // YYYY-MM-DD [HH:MM:SS] | |
83 | ||
84 | /** \brief Modification date | |
85 | * | |
86 | * YYYY-MM-DD [HH:MM:SS] | |
87 | */ | |
88 | ||
89 | #define GAVL_META_DATE_MODIFY "ModificationDate" // YYYY-MM-DD [HH:MM:SS] | |
90 | ||
91 | /** \brief Generic year | |
92 | */ | |
93 | ||
94 | #define GAVL_META_YEAR "Year" // YYYY | |
95 | ||
96 | /** \brief Language | |
97 | * | |
98 | * Use this for subtitles or audio streams | |
99 | */ | |
100 | ||
101 | #define GAVL_META_LANGUAGE "Language" // ISO 639-2/B 3 letter code | |
102 | ||
103 | /** \brief Comment | |
104 | */ | |
105 | ||
106 | #define GAVL_META_COMMENT "Comment" | |
107 | ||
108 | /** \brief Related URL | |
109 | */ | |
110 | ||
111 | #define GAVL_META_URL "URL" | |
112 | ||
113 | /** \brief Software | |
114 | * | |
115 | * For media files, this is the multiplexer software. | |
116 | * For single stream this is the encoder software | |
117 | */ | |
118 | ||
119 | #define GAVL_META_SOFTWARE "Software" | |
120 | ||
121 | /** \brief Person, who created the file | |
122 | */ | |
123 | ||
124 | #define GAVL_META_CREATOR "Creator" | |
125 | ||
126 | /** \brief Format | |
127 | * | |
128 | * For media files, this is the container format. | |
129 | * For single stream this is the name of the codec | |
130 | */ | |
131 | #define GAVL_META_FORMAT "Format" | |
132 | ||
133 | /** \brief Label | |
134 | * | |
135 | * Stream label (e.g. "Directors comments") | |
136 | */ | |
137 | ||
138 | #define GAVL_META_LABEL "Label" | |
139 | ||
140 | /** \brief Bitrate | |
141 | * | |
142 | * Bitrate as integer in bits/s. Can also be a | |
143 | * string (like VBR) | |
144 | */ | |
145 | ||
146 | #define GAVL_META_BITRATE "Bitrate" | |
147 | ||
148 | /** \brief Valid bits per audio sample | |
149 | */ | |
150 | ||
151 | #define GAVL_META_AUDIO_BITS "BitsPerSample" | |
152 | ||
153 | /** \brief Valid bits per pixel | |
154 | */ | |
155 | ||
156 | #define GAVL_META_VIDEO_BPP "BitsPerPixel" | |
157 | ||
158 | /** \brief Vendor of the device/software, which created the file | |
159 | */ | |
160 | ||
161 | #define GAVL_META_VENDOR "Vendor" | |
162 | ||
163 | /** \brief Model name of the device, which created the file | |
164 | */ | |
165 | ||
166 | #define GAVL_META_DEVICE "Device" | |
167 | ||
168 | /** | |
169 | * @} | |
170 | */ | |
171 | ||
172 | #endif // GAVL_METATAGS_H_INCLUDED |
203 | 203 | char str[GAVL_TIMECODE_STRING_LEN_SHORT]); |
204 | 204 | |
205 | 205 | |
206 | /* | |
206 | /** | |
207 | 207 | * @} |
208 | 208 | */ |
209 | 209 |
8 | 8 | |
9 | 9 | have_avcodec=false |
10 | 10 | |
11 | AVCODEC_BUILD="3345152" | |
11 | AVCODEC_BUILD="3412992" | |
12 | 12 | |
13 | 13 | AC_ARG_ENABLE(libavcodec, |
14 | 14 | [AC_HELP_STRING([--disable-libavcodec],[Disable libavcodec (default: autodetect)])], |
47 | 47 | |
48 | 48 | have_avformat=false |
49 | 49 | |
50 | AVFORMAT_BUILD="3278080" | |
50 | AVFORMAT_BUILD="3415808" | |
51 | 51 | |
52 | 52 | AC_ARG_ENABLE(libavformat, |
53 | 53 | [AC_HELP_STRING([--disable-libavformat],[Disable libavformat (default: autodetect)])], |
129 | 129 | |
130 | 130 | if test $found_header = "false"; then |
131 | 131 | have_libpostproc=false |
132 | else | |
133 | CFLAGS="-DPOSTPROC_HEADER=$POSTPROC_HEADER $CFLAGS" | |
134 | AC_CHECK_TYPES([pp_context_t, pp_context, pp_mode_t, pp_mode], [], [], [[ | |
135 | #ifdef POSTPROC_HEADER | |
136 | #include POSTPROC_HEADER | |
137 | #endif | |
138 | ]]) | |
132 | 139 | fi |
133 | 140 | |
134 | 141 | CFLAGS="$CFLAGS_save" |
576 | 583 | |
577 | 584 | if test x$test_libtiff = xtrue; then |
578 | 585 | |
579 | OLD_CFLAGS=$CFLAGS | |
580 | 586 | OLD_LIBS=$LIBS |
581 | 587 | |
582 | 588 | LIBS="$LIBS -ltiff" |
583 | CFLAGS="$CFLAGS" | |
584 | 589 | |
585 | 590 | AC_MSG_CHECKING(for libtiff) |
586 | 591 | AC_TRY_LINK([#include <tiffio.h>], |
595 | 600 | case $have_libtiff in |
596 | 601 | true) AC_DEFINE(HAVE_LIBTIFF) |
597 | 602 | AC_MSG_RESULT(yes) |
598 | TIFF_LIBS=$LIBS; | |
599 | TIFF_CFLAGS=$CFLAGS ;; | |
603 | TIFF_LIBS=$LIBS;; | |
600 | 604 | false) AC_MSG_RESULT(no); TIFF_LIBS=""; TIFF_CFLAGS="";; |
601 | 605 | esac |
602 | CFLAGS=$OLD_CFLAGS | |
603 | 606 | LIBS=$OLD_LIBS |
604 | 607 | |
605 | 608 | fi |
754 | 757 | |
755 | 758 | if test x$test_libpng = xtrue; then |
756 | 759 | |
757 | OLD_CFLAGS=$CFLAGS | |
758 | 760 | OLD_LIBS=$LIBS |
759 | 761 | |
760 | 762 | LIBS="$LIBS -lpng -lm -lz" |
761 | CFLAGS="$CFLAGS" | |
762 | 763 | |
763 | 764 | AC_MSG_CHECKING(for libpng) |
764 | 765 | AC_TRY_LINK([#include <png.h>], |
771 | 772 | case $have_libpng in |
772 | 773 | true) AC_DEFINE(HAVE_LIBPNG) |
773 | 774 | AC_MSG_RESULT(yes) |
774 | PNG_LIBS=$LIBS; | |
775 | PNG_CFLAGS=$CFLAGS ;; | |
775 | PNG_LIBS=$LIBS;; | |
776 | 776 | false) AC_MSG_RESULT(no); PNG_LIBS=""; PNG_CFLAGS="";; |
777 | 777 | esac |
778 | CFLAGS=$OLD_CFLAGS | |
779 | 778 | LIBS=$OLD_LIBS |
780 | 779 | |
781 | 780 | fi |
989 | 988 | |
990 | 989 | AC_DEFUN([GMERLIN_CHECK_FLAC],[ |
991 | 990 | |
992 | FLAC_REQUIRED="1.1.0" | |
991 | FLAC_REQUIRED="1.2.0" | |
993 | 992 | have_flac="false" |
994 | 993 | |
995 | 994 | AC_ARG_ENABLE(flac, |
1024 | 1023 | if(sscanf(FLAC__VERSION_STRING, "%d.%d.%d", &version_major, |
1025 | 1024 | &version_minor, &version_patchlevel) < 3) |
1026 | 1025 | return -1; |
1027 | if((version_major != 1) || (version_minor < 1)) | |
1026 | if((version_major != 1) || (version_minor < 2)) | |
1028 | 1027 | return 1; |
1029 | 1028 | version_file = fopen("flac_version", "w"); |
1030 | 1029 | fprintf(version_file, "%d.%d.%d\n", version_major, |
1575 | 1574 | |
1576 | 1575 | if test x$test_libjpeg = xtrue; then |
1577 | 1576 | |
1578 | OLD_CFLAGS=$CFLAGS | |
1579 | 1577 | OLD_LIBS=$LIBS |
1580 | 1578 | LIBS="$LIBS -ljpeg" |
1581 | CFLAGS="$CFLAGS" | |
1582 | 1579 | |
1583 | 1580 | AC_MSG_CHECKING(for libjpeg) |
1584 | 1581 | AC_TRY_LINK([#include <stdio.h> |
1589 | 1586 | case $have_libjpeg in |
1590 | 1587 | true) AC_DEFINE(HAVE_LIBJPEG) |
1591 | 1588 | AC_MSG_RESULT(yes) |
1592 | JPEG_LIBS=$LIBS; | |
1593 | JPEG_CFLAGS=$CFLAGS;; | |
1589 | JPEG_LIBS=$LIBS;; | |
1594 | 1590 | false) AC_MSG_RESULT(no); JPEG_LIBS=""; JPEG_CFLAGS="";; |
1595 | 1591 | * ) AC_MSG_RESULT("Somethings wrong: $have_libjpeg") ;; |
1596 | 1592 | esac |
1597 | 1593 | |
1598 | CFLAGS=$OLD_CFLAGS | |
1599 | 1594 | LIBS=$OLD_LIBS |
1600 | 1595 | |
1601 | 1596 | fi |
1638 | 1633 | dnl Search for OpenGL libraries |
1639 | 1634 | dnl |
1640 | 1635 | |
1641 | OLD_CFLAGS=$CFLAGS | |
1642 | 1636 | OLD_LIBS=$LIBS |
1643 | 1637 | |
1644 | 1638 | have_GL="true" |
1651 | 1645 | ],[],[have_GL="false"]) |
1652 | 1646 | fi |
1653 | 1647 | |
1654 | GL_CFLAGS=$CFLAGS | |
1655 | 1648 | GL_LIBS=$LIBS |
1656 | 1649 | |
1657 | CFLAGS="$OLD_CFLAGS" | |
1658 | 1650 | LIBS="$OLD_LIBS" |
1659 | 1651 | |
1660 | 1652 | dnl |
1661 | 1653 | dnl Check for GLX |
1662 | 1654 | dnl |
1663 | 1655 | |
1664 | OLD_CFLAGS=$CFLAGS | |
1665 | 1656 | OLD_LIBS=$LIBS |
1666 | 1657 | |
1667 | 1658 | have_GLX="true" |
1674 | 1665 | NULL, NULL); return 0;}],[],[have_GLX="false"]) |
1675 | 1666 | fi |
1676 | 1667 | |
1677 | GLX_CFLAGS=$CFLAGS | |
1678 | 1668 | GLX_LIBS=$LIBS |
1679 | 1669 | |
1680 | CFLAGS="$OLD_CFLAGS" | |
1681 | 1670 | LIBS="$OLD_LIBS" |
1682 | 1671 | |
1683 | 1672 | if test "x$have_GL" = "xtrue"; then |
1771 | 1760 | sem_t s; |
1772 | 1761 | result = sem_init(&s, 0, 0); |
1773 | 1762 | if(result) |
1774 | return 0; | |
1775 | return -1; | |
1763 | return -1; | |
1764 | return 0; | |
1776 | 1765 | } |
1777 | 1766 | ], |
1778 | 1767 | [ |
1810 | 1799 | esac],[test_vdpau=true]) |
1811 | 1800 | |
1812 | 1801 | if test x$test_vdpau = xtrue; then |
1813 | ||
1802 | if test x$have_x = xtrue; then | |
1803 | ||
1814 | 1804 | OLD_CFLAGS=$CFLAGS |
1815 | 1805 | OLD_LIBS=$LIBS |
1816 | 1806 | |
1838 | 1828 | LIBS=$OLD_LIBS |
1839 | 1829 | |
1840 | 1830 | fi |
1831 | fi | |
1841 | 1832 | |
1842 | 1833 | AC_SUBST(VDPAU_CFLAGS) |
1843 | 1834 | AC_SUBST(VDPAU_LIBS) |
47 | 47 | gavl_video_converter_t * cnv; |
48 | 48 | |
49 | 49 | gavl_video_format_t format_1; |
50 | gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; | |
50 | gavl_video_frame_t * frame_1 = NULL; | |
51 | 51 | |
52 | 52 | |
53 | 53 | if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) |
152 | 152 | } |
153 | 153 | |
154 | 154 | png_ptr = png_create_read_struct |
155 | (PNG_LIBPNG_VER_STRING, (png_voidp)0, | |
155 | (PNG_LIBPNG_VER_STRING, NULL, | |
156 | 156 | NULL, NULL); |
157 | 157 | |
158 | 158 | setjmp(png_jmpbuf(png_ptr)); |
260 | 260 | format->pixelformat = pixelformat; |
261 | 261 | } |
262 | 262 | else |
263 | frame_1 = (gavl_video_frame_t*)0; | |
263 | frame_1 = NULL; | |
264 | 264 | |
265 | 265 | if(frame_1) |
266 | 266 | { |
59 | 59 | * Some braindead YUV conversion (but works at least :-) |
60 | 60 | */ |
61 | 61 | |
62 | static int * r_to_y = (int*)0; | |
63 | static int * g_to_y = (int*)0; | |
64 | static int * b_to_y = (int*)0; | |
65 | ||
66 | static int * r_to_u = (int*)0; | |
67 | static int * g_to_u = (int*)0; | |
68 | static int * b_to_u = (int*)0; | |
69 | ||
70 | static int * r_to_v = (int*)0; | |
71 | static int * g_to_v = (int*)0; | |
72 | static int * b_to_v = (int*)0; | |
73 | ||
74 | static int * y_to_rgb = (int*)0; | |
75 | static int * v_to_r = (int*)0; | |
76 | static int * u_to_g = (int*)0; | |
77 | static int * v_to_g = (int*)0; | |
78 | static int * u_to_b = (int*)0; | |
62 | static int * r_to_y = NULL; | |
63 | static int * g_to_y = NULL; | |
64 | static int * b_to_y = NULL; | |
65 | ||
66 | static int * r_to_u = NULL; | |
67 | static int * g_to_u = NULL; | |
68 | static int * b_to_u = NULL; | |
69 | ||
70 | static int * r_to_v = NULL; | |
71 | static int * g_to_v = NULL; | |
72 | static int * b_to_v = NULL; | |
73 | ||
74 | static int * y_to_rgb = NULL; | |
75 | static int * v_to_r = NULL; | |
76 | static int * u_to_g = NULL; | |
77 | static int * v_to_g = NULL; | |
78 | static int * u_to_b = NULL; | |
79 | 79 | |
80 | 80 | /* JPEG Quantization */ |
81 | 81 | |
82 | static int * r_to_yj = (int*)0; | |
83 | static int * g_to_yj = (int*)0; | |
84 | static int * b_to_yj = (int*)0; | |
85 | ||
86 | static int * r_to_uj = (int*)0; | |
87 | static int * g_to_uj = (int*)0; | |
88 | static int * b_to_uj = (int*)0; | |
89 | ||
90 | static int * r_to_vj = (int*)0; | |
91 | static int * g_to_vj = (int*)0; | |
92 | static int * b_to_vj = (int*)0; | |
93 | ||
94 | static int * yj_to_rgb = (int*)0; | |
95 | static int * vj_to_r = (int*)0; | |
96 | static int * uj_to_g = (int*)0; | |
97 | static int * vj_to_g = (int*)0; | |
98 | static int * uj_to_b = (int*)0; | |
82 | static int * r_to_yj = NULL; | |
83 | static int * g_to_yj = NULL; | |
84 | static int * b_to_yj = NULL; | |
85 | ||
86 | static int * r_to_uj = NULL; | |
87 | static int * g_to_uj = NULL; | |
88 | static int * b_to_uj = NULL; | |
89 | ||
90 | static int * r_to_vj = NULL; | |
91 | static int * g_to_vj = NULL; | |
92 | static int * b_to_vj = NULL; | |
93 | ||
94 | static int * yj_to_rgb = NULL; | |
95 | static int * vj_to_r = NULL; | |
96 | static int * uj_to_g = NULL; | |
97 | static int * vj_to_g = NULL; | |
98 | static int * uj_to_b = NULL; | |
99 | 99 | |
100 | 100 | |
101 | 101 | |
1320 | 1320 | int color_type; |
1321 | 1321 | int png_transforms; |
1322 | 1322 | gavl_video_frame_t * tmp_frame; |
1323 | gavl_video_frame_t * out_frame = (gavl_video_frame_t *)0; | |
1323 | gavl_video_frame_t * out_frame = NULL; | |
1324 | 1324 | gavl_video_format_t tmp_format; |
1325 | 1325 | |
1326 | 1326 | int i; |
37 | 37 | |
38 | 38 | static void timer_init() |
39 | 39 | { |
40 | gettimeofday(&time_before, (struct timezone*)0); | |
40 | gettimeofday(&time_before, NULL); | |
41 | 41 | } |
42 | 42 | |
43 | 43 | static void timer_stop() |
44 | 44 | { |
45 | 45 | double before, after, diff; |
46 | 46 | |
47 | gettimeofday(&time_after, (struct timezone*)0); | |
47 | gettimeofday(&time_after, NULL); | |
48 | 48 | |
49 | 49 | before = time_before.tv_sec + time_before.tv_usec / 1.0e6; |
50 | 50 | after = time_after.tv_sec + time_after.tv_usec / 1.0e6; |
38 | 38 | gavl_video_converter_t * cnv; |
39 | 39 | |
40 | 40 | gavl_video_format_t format_1; |
41 | gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; | |
41 | gavl_video_frame_t * frame_1 = NULL; | |
42 | 42 | |
43 | 43 | |
44 | 44 | if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) |
38 | 38 | gavl_video_converter_t * cnv; |
39 | 39 | |
40 | 40 | gavl_video_format_t format_1; |
41 | gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; | |
41 | gavl_video_frame_t * frame_1 = NULL; | |
42 | 42 | |
43 | 43 | |
44 | 44 | if((format->pixelformat != GAVL_RGB_24) && (format->pixelformat != GAVL_RGBA_32)) |
146 | 146 | } |
147 | 147 | |
148 | 148 | png_ptr = png_create_read_struct |
149 | (PNG_LIBPNG_VER_STRING, (png_voidp)0, | |
149 | (PNG_LIBPNG_VER_STRING, NULL, | |
150 | 150 | NULL, NULL); |
151 | 151 | |
152 | 152 | setjmp(png_jmpbuf(png_ptr)); |
250 | 250 | format->pixelformat = pixelformat; |
251 | 251 | } |
252 | 252 | else |
253 | frame_1 = (gavl_video_frame_t*)0; | |
253 | frame_1 = NULL; | |
254 | 254 | |
255 | 255 | if(frame_1) |
256 | 256 | { |
72 | 72 | gavl_video_converter_t * cnv; |
73 | 73 | |
74 | 74 | gavl_video_format_t format_1; |
75 | gavl_video_frame_t * frame_1 = (gavl_video_frame_t*)0; | |
75 | gavl_video_frame_t * frame_1 = NULL; | |
76 | 76 | |
77 | 77 | |
78 | 78 | if((format->pixelformat != GAVL_RGB_24) && |
183 | 183 | } |
184 | 184 | |
185 | 185 | png_ptr = png_create_read_struct |
186 | (PNG_LIBPNG_VER_STRING, (png_voidp)0, | |
186 | (PNG_LIBPNG_VER_STRING, NULL, | |
187 | 187 | NULL, NULL); |
188 | 188 | |
189 | 189 | setjmp(png_jmpbuf(png_ptr)); |
287 | 287 | format->pixelformat = pixelformat; |
288 | 288 | } |
289 | 289 | else |
290 | frame_1 = (gavl_video_frame_t*)0; | |
290 | frame_1 = NULL; | |
291 | 291 | |
292 | 292 | if(frame_1) |
293 | 293 | { |
19 | 19 | * *****************************************************************/ |
20 | 20 | |
21 | 21 | #include <sys/time.h> |
22 | #include <stdlib.h> | |
23 | ||
22 | 24 | #include <config.h> |
23 | 25 | |
24 | 26 | #include <inttypes.h> |
29 | 31 | |
30 | 32 | void timer_init() |
31 | 33 | { |
32 | gettimeofday(&time_before, (struct timezone*)0); | |
34 | gettimeofday(&time_before, NULL); | |
33 | 35 | } |
34 | 36 | |
35 | 37 | uint64_t timer_stop() |
36 | 38 | { |
37 | 39 | uint64_t before, after, diff; |
38 | 40 | |
39 | gettimeofday(&time_after, (struct timezone*)0); | |
41 | gettimeofday(&time_after, NULL); | |
40 | 42 | |
41 | 43 | before = ((uint64_t)time_before.tv_sec)*1000000 + time_before.tv_usec; |
42 | 44 | after = ((uint64_t)time_after.tv_sec)*1000000 + time_after.tv_usec; |