2 * block as much as possible.
3 * handle only async "usual" sigs, with sync signalfd.
4 * allow some signals to go thru though. many sync signal can only
5 * be handles with an async handler.
6 * always presume the process "controlling terminal" is different than the
7 * terminal connected on standard input and standard output
9 STATIC
void sigs_init_once(void)
14 r
= sigfillset(&sset
);
16 fatal("unable to get a full signal mask\n");
18 /* the "controlling terminal" line asks for a core dump, leave it be */
19 r
= sigdelset(&sset
, SIGQUIT
);
21 fatal("unable to remove SIGQUIT from our signal mask\n");
23 r
= pthread_sigmask(SIG_SETMASK
, &sset
, 0);
25 fatal("unable to \"block\" \"all\" signals\n");
27 /* from here, we "steal" signals with signalfd */
29 r
= sigemptyset(&sset
);
31 fatal("unable to get an empty signal mask\n");
32 /* we are asked nicely to terminate */
33 r
= sigaddset(&sset
, SIGTERM
);
35 fatal("unable to add SIGTERM to our signal mask\n");
36 /* the "controlling terminal" line (^c) asks nicely to terminate */
37 r
= sigaddset(&sset
, SIGINT
);
39 fatal("unable to add SIGINT to our signal mask\n");
41 r
= signalfd(-1, &sset
, SFD_NONBLOCK
);
43 fatal("unable to get a signalfd file descriptor\n");
46 STATIC
void prefill_wait(void) { loop
48 struct timespec wanted
;
53 npv_pipeline_limits_lock();
54 prefill_audio
= npv_pipeline_limits_p
.pkts
.prefill
.audio_bytes_rem
;
55 prefill_video
= npv_pipeline_limits_p
.pkts
.prefill
.video_bytes_rem
;
56 npv_pipeline_limits_unlock();
57 if (prefill_audio
<= 0 && prefill_video
<= 0)
59 memset(&wanted
, 0, sizeof(wanted
));
60 memset(&rem
, 0, sizeof(rem
));
61 wanted
.tv_nsec
= 100000000; /* 100 ms */
65 /* linux bug: cannot specify CLOCK_MONOTONIC_RAW */
66 r
= clock_nanosleep(CLOCK_MONOTONIC
, 0, &wanted
, &rem
);
70 fatal("prefill wait timer failed:%d\n", r
);
72 memcpy(&wanted
, &rem
, sizeof(wanted
));
73 memset(&rem
, 0, sizeof(rem
));
76 STATIC
void predecode_wait(void)
78 struct timespec wanted
;
81 memset(&wanted
, 0, sizeof(wanted
));
82 memset(&rem
, 0, sizeof(rem
));
83 /* we target ~double audio buf, namely (0.25s * 2 ~ 500ms) */
84 wanted
.tv_nsec
= 500000000;
88 /* linux bug: cannot specify CLOCK_MONOTONIC_RAW */
89 r
= clock_nanosleep(CLOCK_MONOTONIC
, 0, &wanted
, &rem
);
93 fatal("predecoding wait timer failed:%d\n", r
);
95 memcpy(&wanted
, &rem
, sizeof(wanted
));
96 memset(&rem
, 0, sizeof(rem
));
99 STATIC
void evt_init_once(void)
101 ep_fd_p
= epoll_create1(0);
103 fatal("unable to create the epoll file descriptor\n");
105 STATIC
void evt_add_all_fds(void)
109 struct epoll_event evt
;
112 evt
.events
= EPOLLIN
;
113 evt
.data
.fd
= sig_fd_l
;
114 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
, sig_fd_l
, &evt
);
116 fatal("unable to add the signalfd file descriptior to the epoll file descriptor\n");
117 /*--------------------------------------------------------------------*/
118 /* the video timer */
119 evt
.events
= EPOLLIN
;
120 evt
.data
.fd
= npv_video_timer_fd_p
;
121 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
, npv_video_timer_fd_p
, &evt
);
123 fatal("unable to add the video timer file descriptor\n");
124 /*--------------------------------------------------------------------*/
125 /* the x11 xcb file descriptor */
126 evt
.events
= EPOLLIN
;
127 evt
.data
.fd
= npv_xcb_p
.fd
;
128 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
, npv_xcb_p
.fd
, &evt
);
130 fatal("unable to add the x11 xcb file descriptor\n");
131 /*--------------------------------------------------------------------*/
132 /* alsa pcm poll file descriptors */
135 if (i
== npv_audio_pcm_pollfds_n_p
)
137 evt
.events
= npv_audio_pcm_pollfds_p
[i
].events
;
138 evt
.data
.fd
= npv_audio_pcm_pollfds_p
[i
].fd
;
139 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
,
140 npv_audio_pcm_pollfds_p
[i
].fd
, &evt
);
142 fatal("unable to add alsa poll file descriptor index %d to epoll file descriptor\n", i
);
145 /*--------------------------------------------------------------------*/
146 /* the draining timer */
147 evt
.events
= EPOLLIN
;
148 evt
.data
.fd
= npv_audio_draining_timer_fd_p
;
149 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
, npv_audio_draining_timer_fd_p
,
152 fatal("unable to add the draining timer file descriptor\n");
153 /*--------------------------------------------------------------------*/
154 /* the xcb screensaver heartbeat timer */
155 evt
.events
= EPOLLIN
;
156 evt
.data
.fd
= npv_xcb_p
.screensaver_heartbeat_timer_fd
;
157 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
,
158 npv_xcb_p
.screensaver_heartbeat_timer_fd
, &evt
);
160 fatal("unable to add the xcb screensaver heartbeat timer file descriptor\n");
161 /*--------------------------------------------------------------------*/
162 /* the xcb mouse visibility timer */
163 evt
.events
= EPOLLIN
;
164 evt
.data
.fd
= npv_xcb_p
.mouse_visibility_timer_fd
;
165 r
= epoll_ctl(ep_fd_p
, EPOLL_CTL_ADD
,
166 npv_xcb_p
.mouse_visibility_timer_fd
, &evt
);
168 fatal("unable to add the xcb screensaver heartbeat timer file descriptor\n");
170 STATIC
void evt_sigs(void)
173 struct signalfd_siginfo siginfo
;
176 r
= read(sig_fd_l
, &siginfo
, sizeof(siginfo
));
177 if (r
!= sizeof(siginfo
))
178 fatal("unable to read signal information\n");
180 switch (siginfo
.ssi_signo
) {
182 exit_ok("received SIGTERM\n");
184 exit_ok("received SIGINT\n");
186 warning("signal handle:unwanted signal %d received, discarding\n", siginfo
.ssi_signo
);
189 STATIC
void evt_accumulate(struct epoll_event
*evt
, bool *have_evt_sigs
,
190 bool *have_evt_pcm
, bool *have_evt_video
, bool *have_evt_pcm_draining
,
191 bool *have_evt_x11
, bool *have_evt_xcb_screensaver_heartbeat
,
192 bool *have_evt_xcb_mouse_visibility
)
196 if (evt
->data
.fd
== sig_fd_l
) {
197 if ((evt
->events
& EPOLLIN
) != 0) {
198 *have_evt_sigs
= true;
201 fatal("event loop wait:signal:unexpected event\n");
203 /*-------------------------------------------------------------------*/
204 /* only update alsa fds */
207 if (i
== npv_audio_pcm_pollfds_n_p
)
209 if (evt
->data
.fd
== npv_audio_pcm_pollfds_p
[i
].fd
) {
210 npv_audio_pcm_pollfds_p
[i
].revents
= evt
->events
;
211 *have_evt_pcm
= true;
216 /*-------------------------------------------------------------------*/
217 if (evt
->data
.fd
== npv_xcb_p
.fd
) {
218 if ((evt
->events
& EPOLLIN
) != 0)
219 *have_evt_x11
= true;
222 /*-------------------------------------------------------------------*/
223 if (evt
->data
.fd
== npv_video_timer_fd_p
) {
224 if ((evt
->events
& EPOLLIN
) != 0) {
225 *have_evt_video
= true;
228 fatal("event loop wait:video:unexpected event\n");
230 /*-------------------------------------------------------------------*/
231 if (evt
->data
.fd
== npv_audio_draining_timer_fd_p
) {
232 if ((evt
->events
& EPOLLIN
) != 0) {
233 *have_evt_pcm_draining
= true;
236 fatal("event loop wait:audio draining timer:unexpected event\n");
238 /*-------------------------------------------------------------------*/
239 if (evt
->data
.fd
== npv_xcb_p
.screensaver_heartbeat_timer_fd
) {
240 if ((evt
->events
& EPOLLIN
) != 0) {
241 *have_evt_xcb_screensaver_heartbeat
= true;
244 fatal("event loop wait:xcb screensaver heartbeat timer:unexpected event\n");
246 /*-------------------------------------------------------------------*/
247 if (evt
->data
.fd
== npv_xcb_p
.mouse_visibility_timer_fd
) {
248 if ((evt
->events
& EPOLLIN
) != 0) {
249 *have_evt_xcb_mouse_visibility
= true;
252 fatal("event loop wait:xcb mouse visibility timer:unexpected event\n");
256 * XXX: remember that all heavy lifting should be done in other threads.
257 * this thread should not "block" or perform "expensive" work.
258 * "blocking", "expensive" work should be offloaded to other threads.
260 #define EPOLL_EVTS_N 32 /* why not */
261 STATIC
void evts_loop(void)
265 struct epoll_event evts
[EPOLL_EVTS_N
];
269 bool have_evt_pcm_draining
;
271 bool have_evt_xcb_screensaver_heartbeat
;
272 bool have_evt_xcb_mouse_visibility
;
277 memset(evts
, 0, sizeof(evts
));
278 fds_n
= epoll_wait(ep_fd_p
, evts
, EPOLL_EVTS_N
, -1);
280 if (errno
== EINTR
) {
281 warning("event loop wait:was interrupted by a signal\n");
284 fatal("event loop wait:an error occured\n");
287 have_evt_sigs
= false;
288 have_evt_pcm
= false;
289 have_evt_video
= false;
290 have_evt_pcm_draining
= false;
291 have_evt_x11
= false;
292 have_evt_xcb_screensaver_heartbeat
= false;
293 have_evt_xcb_mouse_visibility
= false;
299 evt_accumulate(&evts
[fd_idx
], &have_evt_sigs
, &have_evt_pcm
,
300 &have_evt_video
, &have_evt_pcm_draining
,
301 &have_evt_x11
, &have_evt_xcb_screensaver_heartbeat
,
302 &have_evt_xcb_mouse_visibility
);
306 /* once we have our evts, we use a sort of priority order */
308 /* process any q-ed and we-handle sigs before anything */
312 * XXX: it may be more appropriate to break this in 2 steps: key inputs
313 * (light processing), wins resizing (heavy processing)
315 /* key input and win resizing */
318 /* XXX: once in audio draining mode, this should not really happen */
319 /* we are more sensitive to audio issues than video issues */
322 * since alsa could use several file descriptors, only once the
323 * pollfds were properly updated we can actually know we got
324 * something from alsa
326 r
= snd_pcm_poll_descriptors_revents(npv_audio_pcm_p
,
327 npv_audio_pcm_pollfds_p
, npv_audio_pcm_pollfds_n_p
,
330 fatal("alsa:error processing the poll file descriptors\n");
331 if ((pcm_evts
& ~POLLOUT
) != 0)
332 fatal("alsa:unexpected events\n");
333 if ((pcm_evts
& POLLOUT
) != 0)
334 npv_audio_evt_pcm_write();
337 npv_video_timer_evt();
338 /* while audio is draining, video fr may need to be displayed */
339 if (have_evt_pcm_draining
)
340 npv_audio_draining_state_evt();
341 if (have_evt_xcb_screensaver_heartbeat
)
342 npv_xcb_screensaver_heartbeat_timer_evt();
343 if (have_evt_xcb_mouse_visibility
)
344 npv_xcb_mouse_visibility_timer_evt();
347 STATIC
void ff_log_stdout(void *a
, int b
, const char *fmt
, va_list ap
)
351 STATIC
void usage(void)
354 npv [-f send a fullscreen message to the window manager at start] [-p alsa pcm]\n\
355 [-v volume(0..100)] [-h window height in pixels] [-w window width in pixels]\n\
356 [-b packet buffer prefill wait(0..100)] [-help] url\n");
358 STATIC
void opts_parse(int argc
, u8
**args
, u8
**url
, bool* start_fullscreen
,
359 u16
*w
, u16
*h
, u8
**pcm_str
, double *vol
, u8
*pkts_prefill_percent
)
369 if (strcmp("-f", args
[i
]) == 0) {
370 *start_fullscreen
= true;
372 } else if (strcmp("-p", args
[i
]) == 0) {
373 *pcm_str
= args
[i
+ 1];
374 pout("-p:alsa pcm \"%s\"\n", *pcm_str
);
376 } else if (strcmp("-v", args
[i
]) == 0) {
377 unsigned long vol_ul
;
380 fatal("-v:initial volume is missing\n");
381 vol_ul
= strtoul(args
[i
+ 1], 0, 10);
382 if (vol_ul
< 0 || 100 < vol_ul
)
383 fatal("-v:invalid volume value %lu (0..100)\n", vol_ul
);
384 *vol
= (double)vol_ul
/ 100.;
385 pout("-v:using initial volume %f\n", *vol
);
387 } else if (strcmp("-h", args
[i
]) == 0) {
391 fatal("-h:initial window pixel height is missing\n");
392 h_ul
= strtoul(args
[i
+ 1], 0, 10);
393 if (h_ul
== 0 || h_ul
> U16_MAX
)
394 fatal("-h:invalid window pixel height %lu (1..%lu)\n", h_ul
, U16_MAX
);
396 pout("-h:using initial window height %lu pixels\n", h_ul
);
398 } else if (strcmp("-w", args
[i
]) == 0) {
402 fatal("-h:initial window pixel width is missing\n");
403 w_ul
= strtoul(args
[i
+ 1], 0, 10);
404 if (w_ul
== 0 || w_ul
> U16_MAX
)
405 fatal("-w:invalid window pixel width %lu (1..%lu)\n", w_ul
, U16_MAX
);
407 pout("-w:using initial window width %lu pixels\n", w_ul
);
409 } else if (strcmp("-b", args
[i
]) == 0) {
411 fatal("-b:percent value for prefill of buffer of packet queues is missing\n");
412 *pkts_prefill_percent
= (u8
)strtoul(args
[i
+ 1], 0, 10);
413 pout("-v:using a %u prefilled buffer of packet queues\n", *pkts_prefill_percent
);
415 } else if (strcmp("-help", args
[i
]) == 0) {
424 fatal("missing url\n");
425 *url
= args
[url_idx
];
426 pout("url-->####%s####\n", *url
);
428 #define WIDTH_NOT_DEFINED 0
429 #define HEIGHT_NOT_DEFINED 0
430 STATIC
void init_once(u8
*url
, bool start_fullscreen
, double initial_vol
,
431 u16 win_width
, u16 win_height
, u8
*pcm_str
,
432 avcodec_params_t
**audio_codec_params
,
433 avcodec_params_t
**video_codec_params
,
436 avutil_rational_t
*audio_st_tb
;
437 avutil_rational_t
*video_st_tb
;
441 npv_vk_init_once(); /* generic plumbing */
442 npv_audio_filt_init_once(initial_vol
);
443 /* before audio_st_idx_p is actually used */
444 npv_audio_init_once(pcm_str
);
445 npv_video_init_once(); /* before video_st_idx_p is actually used */
446 npv_video_osd_init_once(faces
);
448 npv_pipeline_init_once();
450 npv_fmt_init_once(url
);
451 /* we need something to start with */
452 npv_fmt_probe_best_sts(
453 &npv_video_st_p
.idx
, &npv_video_st_p
.id
, &video_st_tb
,
454 &npv_video_st_p
.start_time
, video_codec_params
,
455 &npv_audio_st_p
.idx
, &npv_audio_st_p
.id
, &audio_st_tb
,
456 &npv_audio_st_p
.start_time
, audio_codec_params
);
457 memcpy(&npv_audio_st_p
.tb
, audio_st_tb
, sizeof(*audio_st_tb
));
458 memcpy(&npv_video_st_p
.tb
, video_st_tb
, sizeof(*video_st_tb
));
459 if (win_width
== WIDTH_NOT_DEFINED
)
460 win_width
= (*video_codec_params
)->width
;
461 if (win_height
== HEIGHT_NOT_DEFINED
)
462 win_height
= (*video_codec_params
)->height
;
463 npv_xcb_init_once(win_width
, win_height
, start_fullscreen
);
464 npv_vk_surf_init_once(npv_xcb_p
.c
, npv_xcb_p
.win_id
);
466 #undef WIDTH_NOT_DEFINED
467 #undef HEIGHT_NOT_DEFINED
468 #define PRINT_INFO true
469 STATIC
void prepare(double initial_vol
, u8 pkts_prefill_percent
,
470 avcodec_params_t
*audio_codec_params
,
471 avcodec_params_t
*video_codec_params
)
473 enum avutil_audio_fr_fmt_t dst_fmt
;
476 uint64_t dst_chans_layout
;
478 npv_pipeline_limits_reset();
479 npv_pipeline_prefill_reset(pkts_prefill_percent
);
481 npv_audio_dec_ctx_cfg(audio_codec_params
);
482 npv_video_dec_ctx_cfg(video_codec_params
);
484 * do our best to match the pcm cfg to audio ff dec output, BUT we don't
485 * expect to match it "exactly": see right below why
487 npv_audio_pcm_cfg(npv_audio_pcm_p
, npv_audio_dec_ctx_p
->chans_n
,
488 npv_audio_dec_ctx_p
->fr_rate
, npv_audio_dec_ctx_p
->fr_fmt
);
489 /* use a ff filt to fill in the gap between the pcm and audio ff dec */
490 npv_audio_pcm2ff(npv_audio_pcm_p
, &dst_fmt
, &dst_rate
, &dst_chans_n
,
491 &dst_chans_layout
, PRINT_INFO
);
493 npv_audio_dec_ctx_p
->fr_fmt
, npv_audio_dec_ctx_p
->fr_rate
,
494 npv_audio_dec_ctx_p
->chans_n
, npv_audio_dec_ctx_p
->chans_layout
,
496 dst_fmt
, dst_rate
, dst_chans_n
, dst_chans_layout
,
498 npv_audio_pcm_silence_bufs_cfg(npv_audio_pcm_p
, PRINT_INFO
);
502 STATIC
void npv_cmd_quit(void)
504 exit_ok("quit command received\n");
506 STATIC
void seek_lock(void)
508 /* see lock_hierarchy file */
509 npv_pkt_q_lock(npv_video_pkt_q_p
);
510 npv_video_dec_ctx_lock();
511 npv_video_dec_frs_lock();
512 npv_pkt_q_lock(npv_audio_pkt_q_p
);
513 npv_audio_dec_ctx_lock();
514 npv_audio_dec_sets_lock();
515 npv_pipeline_limits_lock();
518 STATIC
void seek_unlock(void)
520 /* see lock_hierarchy file */
521 npv_fmt_ctx_unlock();
522 npv_pipeline_limits_unlock();
523 npv_audio_dec_sets_unlock();
524 npv_audio_dec_ctx_unlock();
525 npv_pkt_q_unlock(npv_audio_pkt_q_p
);
526 npv_video_dec_frs_unlock();
527 npv_video_dec_ctx_unlock();
528 npv_pkt_q_unlock(npv_video_pkt_q_p
);
530 #define TS_FROM_CLK_OK 0
531 STATIC
void seek_x(s64 delta
)
539 if (npv_audio_draining_p
) {
540 warning("seek:audio is draining, seeking disable\n");
543 if (paused_p
) /* we don't seek in pause */
546 npv_thdsws_wait_for_idle(npv_video_scaler_p
.ctx
);
550 r
= npv_clk_get_audio_st_ts(&audio_now
);
551 if (r
!= TS_FROM_CLK_OK
) {
552 warning("seek:audio:clock timestamp unavailable, ignoring command\n");
556 (void)snd_pcm_drop(npv_audio_pcm_p
);
558 * XXX: a set of sts can share the same id for seeking. if they share
559 * the same id then the tbs should be the same.
561 /*--------------------------------------------------------------------*/
562 new_audio_ts
= audio_now
+ delta
* npv_audio_st_p
.tb
.den
563 / npv_audio_st_p
.tb
.num
;
564 /* rewind capping if possible */
565 if (npv_audio_st_p
.start_time
!= AV_NOPTS_VALUE
)
566 if (new_audio_ts
< npv_audio_st_p
.start_time
)
567 new_audio_ts
= npv_audio_st_p
.start_time
;
568 pout("trying to seek to %"PRId64
" audio stream time base units\n", new_audio_ts
);
569 a
= avformat_seek_pkt(npv_fmt_ctx_p
, npv_audio_st_p
.id
, new_audio_ts
,
572 pout("unable to seek to %"PRId64
" audio stream time base units\n", new_audio_ts
);
573 goto try_restore_audio
;
575 pout("global seek using audio seek to %"PRId64
" audio stream time base units\n", new_audio_ts
);
577 npv_video_dec_flush();
578 npv_audio_dec_flush();
579 npv_audio_filt_flush();
581 npv_clk_invalidate();
582 npv_pipeline_limits_reset();
583 npv_pipeline_prefill_reset(npv_pipeline_limits_p
.pkts
.prefill
.percent
);
586 pout("prefilling audio and video buffers...");
587 prefill_wait(); /* use the lock on the pipeline limits */
589 pout("predecoding audio and video...");
590 predecode_wait(); /* use the lock on the pipeline limits */
592 (void)snd_pcm_prepare(npv_audio_pcm_p
);
596 a
= avformat_seek_pkt(npv_fmt_ctx_p
, npv_audio_st_p
.id
, audio_now
, 0);
597 if (a
< 0) /* we don't send an application error */
598 exit_ok("unable to restore audio to %"PRId64
" audio stream time base units\n", audio_now
);
601 #undef TS_FROM_CLK_OK
602 STATIC
void npv_cmd_rewind(void)
604 pout("COMMAND:rewind\n");
608 STATIC
void npv_cmd_rewind_big(void)
610 pout("COMMAND:rewind big\n");
611 seek_x(-SEEK_DELTA_BIG
);
614 STATIC
void npv_cmd_fastforward(void)
616 pout("COMMAND:fastforward\n");
620 STATIC
void npv_cmd_fastforward_big(void)
622 pout("COMMAND:fastforward big\n");
623 seek_x(SEEK_DELTA_BIG
);
626 STATIC
void npv_cmd_pause(void)
628 if (npv_audio_draining_p
) {
629 warning("pause:audio is draining, toggling pause is disable\n");
635 pout("COMMAND:unpause\n");
638 avformat_read_play(npv_fmt_ctx_p
);
639 npv_fmt_ctx_unlock();
641 npv_video_timer_start();
645 pout("COMMAND:pause\n");
648 avformat_read_pause(npv_fmt_ctx_p
);
649 npv_fmt_ctx_unlock();
651 npv_video_timer_slow_start();
654 STATIC
void npv_cmd_vol_up(void)
656 npv_audio_filt_cmd_vol_up();
658 STATIC
void npv_cmd_vol_down(void)
660 npv_audio_filt_cmd_vol_down();
662 STATIC
void npv_cmd_mute(void)
664 npv_audio_filt_cmd_mute();
666 #define WIDTH_NOT_DEFINED 0
667 #define HEIGHT_NOT_DEFINED 0
668 int main(int argc
, u8
**args
)
670 bool start_fullscreen
;
676 avcodec_params_t
*audio_codec_params
;
677 avcodec_params_t
*video_codec_params
;
678 /* "turn on utf8" processing in used libs if any *AND* locale system */
679 setlocale(LC_ALL
, "");
680 /* av_log_set_level(AV_LOG_VERBOSE); */
681 /* av_log_set_level(AV_LOG_DEBUG); */
682 start_fullscreen
= false;
683 win_width
= WIDTH_NOT_DEFINED
;
684 win_height
= HEIGHT_NOT_DEFINED
;
689 npv_pipeline_limits_p
.pkts
.prefill
.percent
= 0;
690 opts_parse(argc
, args
, &url
, &start_fullscreen
, &win_width
, &win_height
,
691 &pcm_str
, &initial_vol
,
692 &npv_pipeline_limits_p
.pkts
.prefill
.percent
);
693 init_once(url
, start_fullscreen
, initial_vol
, win_width
, win_height
,
694 pcm_str
, &audio_codec_params
, &video_codec_params
, npv_faces
);
695 prepare(initial_vol
, npv_pipeline_limits_p
.pkts
.prefill
.percent
,
696 audio_codec_params
, video_codec_params
);
698 /* switch the ffmpeg log to stdout for metadata/etc dump */
699 avutil_log_set_callback(ff_log_stdout
);
700 avformat_dump_fmt(npv_fmt_ctx_p
, 0, url
, 0);
701 avutil_log_set_callback(avutil_log_default_callback
);
703 npv_pipeline_read_thd_start();
704 pout("prefilling audio and video buffers...");
707 npv_pipeline_audio_thd_start();
708 npv_pipeline_video_thd_start();
709 pout("predecoding audio and video...");
712 npv_video_timer_start();
713 npv_xcb_screensaver_heartbeat_timer_start();
718 #undef WIDTH_NOT_DEFINED
719 #undef HEIGHT_NOT_DEFINED