npv:_reasonable_ "pedanticage" of the code
[nyanmp.git] / npv / fmt / local / code.frag.c
bloba547139ba3f913ef84e75e2f5fc2c015a6169ed2
1 STATIC void fatal(u8 *fmt, ...)
3 va_list ap;
5 npv_perr("format:");
6 va_start(ap, fmt);
7 npv_vfatal(fmt, ap);
8 va_end(ap); /* unreachable */
10 STATIC void pout(u8 *fmt, ...)
12 va_list ap;
14 npv_pout("format:");
15 va_start(ap, fmt);
16 npv_vpout(fmt, ap);
17 va_end(ap);
19 STATIC bool did_reached_limits(void)
21 bool r;
23 npv_pipeline_limits_lock();
24 if (npv_pipeline_limits_p.pkts.audio_bytes_n
25 >= npv_pipeline_limits_p.pkts.limit.audio_bytes_n
26 && npv_pipeline_limits_p.pkts.video_bytes_n
27 >= npv_pipeline_limits_p.pkts.limit.video_bytes_n)
28 r = true;
29 else
30 r = false;
31 npv_pipeline_limits_unlock();
32 return false;
34 STATIC void init_once_public(u8 *url)
36 int r;
38 ctx_p = 0;
39 r = avformat_open_input(&ctx_p, url, NULL, NULL);
40 if (r < 0)
41 fatal("ffmpeg:unable to open \"%s\"\n", url);
42 r = pthread_mutex_init(&ctx_mutex_l, 0);
43 if (r != 0)
44 fatal("unable to init the format mutex\n");
46 STATIC void init_once_local(void)
48 pkt_l = avcodec_pkt_ref_alloc();
49 if (pkt_l == 0)
50 fatal("ffmpeg:unable to allocate a reference on a packet for encoded/compressed audio/video\n");