]> git.sesse.net Git - ffmpeg/blob - libavformat/movenc-test.c
Merge commit '34af7813f77e2b5b9dcb34f20bcf53bfcc0ba9c9'
[ffmpeg] / libavformat / movenc-test.c
1 /*
2  * Copyright (c) 2015 Martin Storsjo
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include "config.h"
22
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/mathematics.h"
25 #include "libavutil/md5.h"
26
27 #include "avformat.h"
28
29 #if HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
32
33 #if !HAVE_GETOPT
34 #include "compat/getopt.c"
35 #endif
36
37 #define HASH_SIZE 16
38
39 static const uint8_t h264_extradata[] = {
40     0x01, 0x4d, 0x40, 0x1e, 0xff, 0xe1, 0x00, 0x02, 0x67, 0x4d, 0x01, 0x00, 0x02, 0x68, 0xef
41 };
42 static const uint8_t aac_extradata[] = {
43     0x12, 0x10
44 };
45
46
47 const char *format = "mp4";
48 AVFormatContext *ctx;
49 uint8_t iobuf[32768];
50 AVDictionary *opts;
51
52 int write_file;
53 const char *cur_name;
54 FILE* out;
55 int out_size;
56 struct AVMD5* md5;
57 uint8_t hash[HASH_SIZE];
58
59 AVStream *video_st, *audio_st;
60 int64_t audio_dts, video_dts;
61
62 int bframes;
63 int64_t duration;
64 int64_t audio_duration;
65 int frames;
66 int gop_size;
67 int64_t next_p_pts;
68 enum AVPictureType last_picture;
69 int skip_write;
70 int skip_write_audio;
71 int clear_duration;
72
73 int num_warnings;
74
75 int check_faults;
76
77
78 static void count_warnings(void *avcl, int level, const char *fmt, va_list vl)
79 {
80     if (level == AV_LOG_WARNING)
81         num_warnings++;
82 }
83
84 static void init_count_warnings(void)
85 {
86     av_log_set_callback(count_warnings);
87     num_warnings = 0;
88 }
89
90 static void reset_count_warnings(void)
91 {
92     av_log_set_callback(av_log_default_callback);
93 }
94
95 static int io_write(void *opaque, uint8_t *buf, int size)
96 {
97     out_size += size;
98     av_md5_update(md5, buf, size);
99     if (out)
100         fwrite(buf, 1, size, out);
101     return size;
102 }
103
104 static void init_out(const char *name)
105 {
106     char buf[100];
107     cur_name = name;
108     snprintf(buf, sizeof(buf), "%s.%s", cur_name, format);
109
110     av_md5_init(md5);
111     if (write_file) {
112         out = fopen(buf, "wb");
113         if (!out)
114             perror(buf);
115     }
116     out_size = 0;
117 }
118
119 static void close_out(void)
120 {
121     int i;
122     av_md5_final(md5, hash);
123     for (i = 0; i < HASH_SIZE; i++)
124         printf("%02x", hash[i]);
125     printf(" %d %s\n", out_size, cur_name);
126     if (out)
127         fclose(out);
128     out = NULL;
129 }
130
131 static void check_func(int value, int line, const char *msg, ...)
132 {
133     if (!value) {
134         va_list ap;
135         va_start(ap, msg);
136         printf("%d: ", line);
137         vprintf(msg, ap);
138         printf("\n");
139         check_faults++;
140     }
141 }
142 #define check(value, ...) check_func(value, __LINE__, __VA_ARGS__)
143
144 static void init_fps(int bf, int audio_preroll, int fps)
145 {
146     AVStream *st;
147     ctx = avformat_alloc_context();
148     if (!ctx)
149         exit(1);
150     ctx->oformat = av_guess_format(format, NULL, NULL);
151     if (!ctx->oformat)
152         exit(1);
153     ctx->pb = avio_alloc_context(iobuf, sizeof(iobuf), AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL);
154     if (!ctx->pb)
155         exit(1);
156     ctx->flags |= AVFMT_FLAG_BITEXACT;
157
158     st = avformat_new_stream(ctx, NULL);
159     if (!st)
160         exit(1);
161     st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
162     st->codec->codec_id = AV_CODEC_ID_H264;
163     st->codec->width = 640;
164     st->codec->height = 480;
165     st->time_base.num = 1;
166     st->time_base.den = 30;
167     st->codec->extradata_size = sizeof(h264_extradata);
168     st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
169     if (!st->codec->extradata)
170         exit(1);
171     memcpy(st->codec->extradata, h264_extradata, sizeof(h264_extradata));
172     st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
173     video_st = st;
174
175     st = avformat_new_stream(ctx, NULL);
176     if (!st)
177         exit(1);
178     st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
179     st->codec->codec_id = AV_CODEC_ID_AAC;
180     st->codec->sample_rate = 44100;
181     st->codec->channels = 2;
182     st->time_base.num = 1;
183     st->time_base.den = 44100;
184     st->codec->extradata_size = sizeof(aac_extradata);
185     st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
186     if (!st->codec->extradata)
187         exit(1);
188     memcpy(st->codec->extradata, aac_extradata, sizeof(aac_extradata));
189     st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
190     audio_st = st;
191
192     if (avformat_write_header(ctx, &opts) < 0)
193         exit(1);
194     av_dict_free(&opts);
195
196     frames = 0;
197     gop_size = 30;
198     duration = video_st->time_base.den / fps;
199     audio_duration = 1024LL * audio_st->time_base.den / audio_st->codec->sample_rate;
200     if (audio_preroll)
201         audio_preroll = 2048LL * audio_st->time_base.den / audio_st->codec->sample_rate;
202
203     bframes = bf;
204     video_dts = bframes ? -duration : 0;
205     audio_dts = -audio_preroll;
206 }
207
208 static void init(int bf, int audio_preroll)
209 {
210     init_fps(bf, audio_preroll, 30);
211 }
212
213 static void mux_frames(int n)
214 {
215     int end_frames = frames + n;
216     while (1) {
217         AVPacket pkt;
218         uint8_t pktdata[8] = { 0 };
219         av_init_packet(&pkt);
220
221         if (av_compare_ts(audio_dts, audio_st->time_base, video_dts, video_st->time_base) < 0) {
222             pkt.dts = pkt.pts = audio_dts;
223             pkt.stream_index = 1;
224             pkt.duration = audio_duration;
225             audio_dts += audio_duration;
226         } else {
227             if (frames == end_frames)
228                 break;
229             pkt.dts = video_dts;
230             pkt.stream_index = 0;
231             pkt.duration = duration;
232             if ((frames % gop_size) == 0) {
233                 pkt.flags |= AV_PKT_FLAG_KEY;
234                 last_picture = AV_PICTURE_TYPE_I;
235                 pkt.pts = pkt.dts + duration;
236                 video_dts = pkt.pts;
237             } else {
238                 if (last_picture == AV_PICTURE_TYPE_P) {
239                     last_picture = AV_PICTURE_TYPE_B;
240                     pkt.pts = pkt.dts;
241                     video_dts = next_p_pts;
242                 } else {
243                     last_picture = AV_PICTURE_TYPE_P;
244                     if (((frames + 1) % gop_size) == 0) {
245                         pkt.pts = pkt.dts + duration;
246                         video_dts = pkt.pts;
247                     } else {
248                         next_p_pts = pkt.pts = pkt.dts + 2 * duration;
249                         video_dts += duration;
250                     }
251                 }
252             }
253             if (!bframes)
254                 pkt.pts = pkt.dts;
255             frames++;
256         }
257
258         if (clear_duration)
259             pkt.duration = 0;
260         AV_WB32(pktdata + 4, pkt.pts);
261         pkt.data = pktdata;
262         pkt.size = 8;
263         if (skip_write)
264             continue;
265         if (skip_write_audio && pkt.stream_index == 1)
266             continue;
267         av_write_frame(ctx, &pkt);
268     }
269 }
270
271 static void mux_gops(int n)
272 {
273     mux_frames(gop_size * n);
274 }
275
276 static void skip_gops(int n)
277 {
278     skip_write = 1;
279     mux_gops(n);
280     skip_write = 0;
281 }
282
283 static void signal_init_ts(void)
284 {
285     AVPacket pkt;
286     av_init_packet(&pkt);
287     pkt.size = 0;
288     pkt.data = NULL;
289
290     pkt.stream_index = 0;
291     pkt.dts = video_dts;
292     pkt.pts = 0;
293     av_write_frame(ctx, &pkt);
294
295     pkt.stream_index = 1;
296     pkt.dts = pkt.pts = audio_dts;
297     av_write_frame(ctx, &pkt);
298 }
299
300 static void finish(void)
301 {
302     av_write_trailer(ctx);
303     av_free(ctx->pb);
304     avformat_free_context(ctx);
305     ctx = NULL;
306 }
307
308 static void help(void)
309 {
310     printf("movenc-test [-w]\n"
311            "-w          write output into files\n");
312 }
313
314 int main(int argc, char **argv)
315 {
316     int c;
317     uint8_t header[HASH_SIZE];
318     uint8_t content[HASH_SIZE];
319     int empty_moov_pos;
320     int prev_pos;
321
322     for (;;) {
323         c = getopt(argc, argv, "wh");
324         if (c == -1)
325             break;
326         switch (c) {
327         case 'w':
328             write_file = 1;
329             break;
330         default:
331         case 'h':
332             help();
333             return 0;
334         }
335     }
336
337     av_register_all();
338
339     md5 = av_md5_alloc();
340     if (!md5)
341         return 1;
342
343     // Write a fragmented file with an initial moov that actually contains some
344     // samples. One moov+mdat with 1 second of data and one moof+mdat with 1
345     // second of data.
346     init_out("non-empty-moov");
347     av_dict_set(&opts, "movflags", "frag_keyframe", 0);
348     init(0, 0);
349     mux_gops(2);
350     finish();
351     close_out();
352
353     // Write a similar file, but with b-frames and audio preroll, handled
354     // via an edit list.
355     init_out("non-empty-moov-elst");
356     av_dict_set(&opts, "movflags", "frag_keyframe", 0);
357     av_dict_set(&opts, "use_editlist", "1", 0);
358     init(1, 1);
359     mux_gops(2);
360     finish();
361     close_out();
362
363     // Use b-frames but no audio-preroll, but without an edit list.
364     // Due to avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO, the dts
365     // of the first audio packet is > 0, but it is set to zero since edit
366     // lists aren't used, increasing the duration of the first packet instead.
367     init_out("non-empty-moov-no-elst");
368     av_dict_set(&opts, "movflags", "frag_keyframe", 0);
369     av_dict_set(&opts, "use_editlist", "0", 0);
370     init(1, 0);
371     mux_gops(2);
372     finish();
373     close_out();
374
375     format = "ismv";
376     // Write an ISMV, with b-frames and audio preroll.
377     init_out("ismv");
378     av_dict_set(&opts, "movflags", "frag_keyframe", 0);
379     init(1, 1);
380     mux_gops(2);
381     finish();
382     close_out();
383     format = "mp4";
384
385     // An initial moov that doesn't contain any samples, followed by two
386     // moof+mdat pairs.
387     init_out("empty-moov");
388     av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
389     av_dict_set(&opts, "use_editlist", "0", 0);
390     init(0, 0);
391     mux_gops(2);
392     finish();
393     close_out();
394     memcpy(content, hash, HASH_SIZE);
395
396     // Similar to the previous one, but with input that doesn't start at
397     // pts/dts 0. avoid_negative_ts behaves in the same way as
398     // in non-empty-moov-no-elst above.
399     init_out("empty-moov-no-elst");
400     av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
401     init(1, 0);
402     mux_gops(2);
403     finish();
404     close_out();
405
406     // Same as the previous one, but disable avoid_negative_ts (which
407     // would require using an edit list, but with empty_moov, one can't
408     // write a sensible edit list, when the start timestamps aren't known).
409     // This should trigger a warning - we check that the warning is produced.
410     init_count_warnings();
411     init_out("empty-moov-no-elst-no-adjust");
412     av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
413     av_dict_set(&opts, "avoid_negative_ts", "0", 0);
414     init(1, 0);
415     mux_gops(2);
416     finish();
417     close_out();
418
419     reset_count_warnings();
420     check(num_warnings > 0, "No warnings printed for unhandled start offset");
421
422     // Verify that delay_moov produces the same as empty_moov for
423     // simple input
424     init_out("delay-moov");
425     av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov", 0);
426     av_dict_set(&opts, "use_editlist", "0", 0);
427     init(0, 0);
428     mux_gops(2);
429     finish();
430     close_out();
431     check(!memcmp(hash, content, HASH_SIZE), "delay_moov differs from empty_moov");
432
433     // Test writing content that requires an edit list using delay_moov
434     init_out("delay-moov-elst");
435     av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov", 0);
436     init(1, 1);
437     mux_gops(2);
438     finish();
439     close_out();
440
441     // Test writing a file with one track lacking packets, with delay_moov.
442     skip_write_audio = 1;
443     init_out("delay-moov-empty-track");
444     av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov", 0);
445     init(0, 0);
446     mux_gops(2);
447     // The automatic flushing shouldn't output anything, since we're still
448     // waiting for data for some tracks
449     check(out_size == 0, "delay_moov flushed prematurely");
450     // When closed (or manually flushed), all the written data should still
451     // be output.
452     finish();
453     close_out();
454     check(out_size > 0, "delay_moov didn't output anything");
455
456     // Check that manually flushing still outputs things as expected. This
457     // produces two fragments, while the one above produces only one.
458     init_out("delay-moov-empty-track-flush");
459     av_dict_set(&opts, "movflags", "frag_custom+delay_moov", 0);
460     init(0, 0);
461     mux_gops(1);
462     av_write_frame(ctx, NULL); // Force writing the moov
463     check(out_size > 0, "No moov written");
464     av_write_frame(ctx, NULL);
465     mux_gops(1);
466     av_write_frame(ctx, NULL);
467     finish();
468     close_out();
469
470     skip_write_audio = 0;
471
472
473
474     // Verify that the header written by delay_moov when manually flushed
475     // is identical to the one by empty_moov.
476     init_out("empty-moov-header");
477     av_dict_set(&opts, "movflags", "frag_keyframe+empty_moov", 0);
478     av_dict_set(&opts, "use_editlist", "0", 0);
479     init(0, 0);
480     close_out();
481     memcpy(header, hash, HASH_SIZE);
482     init_out("empty-moov-content");
483     mux_gops(2);
484     // Written 2 seconds of content, with an automatic flush after 1 second.
485     check(out_size > 0, "No automatic flush?");
486     empty_moov_pos = prev_pos = out_size;
487     // Manually flush the second fragment
488     av_write_frame(ctx, NULL);
489     check(out_size > prev_pos, "No second fragment flushed?");
490     prev_pos = out_size;
491     // Check that an extra flush doesn't output any more data
492     av_write_frame(ctx, NULL);
493     check(out_size == prev_pos, "More data written?");
494     close_out();
495     memcpy(content, hash, HASH_SIZE);
496     // Ignore the trailer written here
497     finish();
498
499     init_out("delay-moov-header");
500     av_dict_set(&opts, "movflags", "frag_custom+delay_moov", 0);
501     av_dict_set(&opts, "use_editlist", "0", 0);
502     init(0, 0);
503     check(out_size == 0, "Output written during init with delay_moov");
504     mux_gops(1); // Write 1 second of content
505     av_write_frame(ctx, NULL); // Force writing the moov
506     close_out();
507     check(!memcmp(hash, header, HASH_SIZE), "delay_moov header differs from empty_moov");
508     init_out("delay-moov-content");
509     av_write_frame(ctx, NULL); // Flush the first fragment
510     check(out_size == empty_moov_pos, "Manually flushed content differs from automatically flushed, %d vs %d", out_size, empty_moov_pos);
511     mux_gops(1); // Write the rest of the content
512     av_write_frame(ctx, NULL); // Flush the second fragment
513     close_out();
514     check(!memcmp(hash, content, HASH_SIZE), "delay_moov content differs from empty_moov");
515     finish();
516
517
518     // Verify that we can produce an identical second fragment without
519     // writing the first one. First write the reference fragments that
520     // we want to reproduce.
521     av_dict_set(&opts, "movflags", "frag_custom+empty_moov+dash", 0);
522     init(0, 0);
523     mux_gops(1);
524     av_write_frame(ctx, NULL); // Output the first fragment
525     init_out("empty-moov-second-frag");
526     mux_gops(1);
527     av_write_frame(ctx, NULL); // Output the second fragment
528     close_out();
529     memcpy(content, hash, HASH_SIZE);
530     finish();
531
532     // Produce the same second fragment without actually writing the first
533     // one before.
534     av_dict_set(&opts, "movflags", "frag_custom+empty_moov+dash+frag_discont", 0);
535     av_dict_set(&opts, "fragment_index", "2", 0);
536     av_dict_set(&opts, "avoid_negative_ts", "0", 0);
537     av_dict_set(&opts, "use_editlist", "0", 0);
538     init(0, 0);
539     skip_gops(1);
540     init_out("empty-moov-second-frag-discont");
541     mux_gops(1);
542     av_write_frame(ctx, NULL); // Output the second fragment
543     close_out();
544     check(!memcmp(hash, content, HASH_SIZE), "discontinuously written fragment differs");
545     finish();
546
547     // Produce the same thing by using delay_moov, which requires a slightly
548     // different call sequence.
549     av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash+frag_discont", 0);
550     av_dict_set(&opts, "fragment_index", "2", 0);
551     init(0, 0);
552     skip_gops(1);
553     mux_gops(1);
554     av_write_frame(ctx, NULL); // Output the moov
555     init_out("delay-moov-second-frag-discont");
556     av_write_frame(ctx, NULL); // Output the second fragment
557     close_out();
558     check(!memcmp(hash, content, HASH_SIZE), "discontinuously written fragment differs");
559     finish();
560
561
562     // Test discontinously written fragments with b-frames (where the
563     // assumption of starting at pts=0 works) but not with audio preroll
564     // (which can't be guessed).
565     av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash", 0);
566     init(1, 0);
567     mux_gops(1);
568     init_out("delay-moov-elst-init");
569     av_write_frame(ctx, NULL); // Output the moov
570     close_out();
571     memcpy(header, hash, HASH_SIZE);
572     av_write_frame(ctx, NULL); // Output the first fragment
573     init_out("delay-moov-elst-second-frag");
574     mux_gops(1);
575     av_write_frame(ctx, NULL); // Output the second fragment
576     close_out();
577     memcpy(content, hash, HASH_SIZE);
578     finish();
579
580     av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash+frag_discont", 0);
581     av_dict_set(&opts, "fragment_index", "2", 0);
582     init(1, 0);
583     skip_gops(1);
584     mux_gops(1); // Write the second fragment
585     init_out("delay-moov-elst-init-discont");
586     av_write_frame(ctx, NULL); // Output the moov
587     close_out();
588     check(!memcmp(hash, header, HASH_SIZE), "discontinuously written header differs");
589     init_out("delay-moov-elst-second-frag-discont");
590     av_write_frame(ctx, NULL); // Output the second fragment
591     close_out();
592     check(!memcmp(hash, content, HASH_SIZE), "discontinuously written fragment differs");
593     finish();
594
595
596     // Test discontinously written fragments with b-frames and audio preroll,
597     // properly signaled.
598     av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash", 0);
599     init(1, 1);
600     mux_gops(1);
601     init_out("delay-moov-elst-signal-init");
602     av_write_frame(ctx, NULL); // Output the moov
603     close_out();
604     memcpy(header, hash, HASH_SIZE);
605     av_write_frame(ctx, NULL); // Output the first fragment
606     init_out("delay-moov-elst-signal-second-frag");
607     mux_gops(1);
608     av_write_frame(ctx, NULL); // Output the second fragment
609     close_out();
610     memcpy(content, hash, HASH_SIZE);
611     finish();
612
613     av_dict_set(&opts, "movflags", "frag_custom+delay_moov+dash+frag_discont", 0);
614     av_dict_set(&opts, "fragment_index", "2", 0);
615     init(1, 1);
616     signal_init_ts();
617     skip_gops(1);
618     mux_gops(1); // Write the second fragment
619     init_out("delay-moov-elst-signal-init-discont");
620     av_write_frame(ctx, NULL); // Output the moov
621     close_out();
622     check(!memcmp(hash, header, HASH_SIZE), "discontinuously written header differs");
623     init_out("delay-moov-elst-signal-second-frag-discont");
624     av_write_frame(ctx, NULL); // Output the second fragment
625     close_out();
626     check(!memcmp(hash, content, HASH_SIZE), "discontinuously written fragment differs");
627     finish();
628
629
630     // Test VFR content, with sidx atoms (which declare the pts duration
631     // of a fragment, forcing overriding the start pts of the next one).
632     // Here, the fragment duration in pts is significantly different from
633     // the duration in dts. The video stream starts at dts=-10,pts=0, and
634     // the second fragment starts at dts=155,pts=156. The trun duration sum
635     // of the first fragment is 165, which also is written as
636     // baseMediaDecodeTime in the tfdt in the second fragment. The sidx for
637     // the first fragment says earliest_presentation_time = 0 and
638     // subsegment_duration = 156, which also matches the sidx in the second
639     // fragment. For the audio stream, the pts and dts durations also don't
640     // match - the input stream starts at pts=-2048, but that part is excluded
641     // by the edit list.
642     init_out("vfr");
643     av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov+dash", 0);
644     init_fps(1, 1, 3);
645     mux_frames(gop_size/2);
646     duration /= 10;
647     mux_frames(gop_size/2);
648     mux_gops(1);
649     finish();
650     close_out();
651
652     // Test VFR content, with cleared duration fields. In these cases,
653     // the muxer must guess the duration of the last packet of each
654     // fragment. As long as the framerate doesn't vary (too much) at the
655     // fragment edge, it works just fine. Additionally, when automatically
656     // cutting fragments, the muxer already know the timestamps of the next
657     // packet for one stream (in most cases the video stream), avoiding
658     // having to use guesses for that one.
659     init_count_warnings();
660     clear_duration = 1;
661     init_out("vfr-noduration");
662     av_dict_set(&opts, "movflags", "frag_keyframe+delay_moov+dash", 0);
663     init_fps(1, 1, 3);
664     mux_frames(gop_size/2);
665     duration /= 10;
666     mux_frames(gop_size/2);
667     mux_gops(1);
668     finish();
669     close_out();
670     clear_duration = 0;
671     reset_count_warnings();
672     check(num_warnings > 0, "No warnings printed for filled in durations");
673
674     av_free(md5);
675
676     return check_faults > 0 ? 1 : 0;
677 }