File npv/local/code.frag.c changed (mode: 100644) (index 72c1ff8..5540b8c) |
... |
... |
STATIC void usage(void) |
430 |
430 |
|
|
431 |
431 |
pout("\ |
pout("\ |
432 |
432 |
npv [-f send a fullscreen message to the window manager at start]\n\ |
npv [-f send a fullscreen message to the window manager at start]\n\ |
|
433 |
|
[-l live mode (seek/pause are disabled)]\n\ |
433 |
434 |
[-p alsa pcm]\n\ |
[-p alsa pcm]\n\ |
434 |
435 |
[-fc override initial ffmpeg count of channels used to approximate the alsa\n\ |
[-fc override initial ffmpeg count of channels used to approximate the alsa\n\ |
435 |
436 |
pcm configuration]\n\ |
pcm configuration]\n\ |
|
... |
... |
the ffmpeg audio frame formats which intersect alsa pcm audio formats are:\n" |
454 |
455 |
++fmt; |
++fmt; |
455 |
456 |
} |
} |
456 |
457 |
} |
} |
457 |
|
STATIC void opts_parse(int argc, u8 **args, u8 **url, bool* start_fullscreen, |
|
458 |
|
u16 *w, u16 *h, u8 **pcm_str, int *override_initial_ff_chans_n, |
|
459 |
|
int *override_initial_ff_rate, |
|
|
458 |
|
STATIC void opts_parse(int argc, u8 **args, u8 **url, bool *live, |
|
459 |
|
bool* start_fullscreen, u16 *w, u16 *h, u8 **pcm_str, |
|
460 |
|
int *override_initial_ff_chans_n, int *override_initial_ff_rate, |
460 |
461 |
enum avutil_audio_fr_fmt_t *override_initial_ff_audio_fr_fmt, |
enum avutil_audio_fr_fmt_t *override_initial_ff_audio_fr_fmt, |
461 |
462 |
double *vol, u8 *pkts_prefill_percent) |
double *vol, u8 *pkts_prefill_percent) |
462 |
463 |
{ |
{ |
|
... |
... |
STATIC void opts_parse(int argc, u8 **args, u8 **url, bool* start_fullscreen, |
471 |
472 |
if (strcmp("-f", args[i]) == 0) { |
if (strcmp("-f", args[i]) == 0) { |
472 |
473 |
*start_fullscreen = true; |
*start_fullscreen = true; |
473 |
474 |
++i; |
++i; |
|
475 |
|
} else if (strcmp("-l", args[i]) == 0) { |
|
476 |
|
*live = true; |
|
477 |
|
++i; |
474 |
478 |
} else if (strcmp("-v", args[i]) == 0) { |
} else if (strcmp("-v", args[i]) == 0) { |
475 |
479 |
unsigned long vol_ul; |
unsigned long vol_ul; |
476 |
480 |
|
|
|
... |
... |
STATIC void states_init_once(void) |
606 |
610 |
#undef PREFILL |
#undef PREFILL |
607 |
611 |
#define WIDTH_NOT_DEFINED 0 |
#define WIDTH_NOT_DEFINED 0 |
608 |
612 |
#define HEIGHT_NOT_DEFINED 0 |
#define HEIGHT_NOT_DEFINED 0 |
609 |
|
STATIC void init_once(u8 *url, bool start_fullscreen, double initial_vol, |
|
610 |
|
u16 win_width, u16 win_height, u8 *pcm_str, |
|
|
613 |
|
STATIC void init_once(u8 *url, bool live, bool start_fullscreen, |
|
614 |
|
double initial_vol, u16 win_width, u16 win_height, u8 *pcm_str, |
611 |
615 |
avcodec_params_t **audio_codec_params, |
avcodec_params_t **audio_codec_params, |
612 |
616 |
avcodec_params_t **video_codec_params, |
avcodec_params_t **video_codec_params, |
613 |
617 |
u8 **faces) |
u8 **faces) |
|
... |
... |
STATIC void init_once(u8 *url, bool start_fullscreen, double initial_vol, |
615 |
619 |
avutil_rational_t *audio_st_tb; |
avutil_rational_t *audio_st_tb; |
616 |
620 |
avutil_rational_t *video_st_tb; |
avutil_rational_t *video_st_tb; |
617 |
621 |
|
|
|
622 |
|
live_p = live; |
618 |
623 |
states_init_once(); |
states_init_once(); |
619 |
624 |
evt_init_once(); |
evt_init_once(); |
620 |
625 |
sigs_init_once(); |
sigs_init_once(); |
|
... |
... |
STATIC void seek_x(s64 delta) |
704 |
709 |
warning("seek:audio is draining, seeking disable\n"); |
warning("seek:audio is draining, seeking disable\n"); |
705 |
710 |
return; |
return; |
706 |
711 |
} |
} |
707 |
|
if (paused_p) /* we don't seek in pause */ |
|
|
712 |
|
if (paused_p) {/* we don't seek in pause */ |
|
713 |
|
warning("seek:disabled while paused\n"); |
|
714 |
|
return; |
|
715 |
|
} |
|
716 |
|
if (live_p) {/* we don't seek in live mode */ |
|
717 |
|
warning("seek:disabled in live mode\n"); |
708 |
718 |
return; |
return; |
|
719 |
|
} |
709 |
720 |
|
|
710 |
721 |
npv_thdsws_wait_for_idle(npv_video_scaler_p.ctx); |
npv_thdsws_wait_for_idle(npv_video_scaler_p.ctx); |
711 |
722 |
|
|
|
... |
... |
STATIC void npv_cmd_pause(void) |
789 |
800 |
warning("pause:audio is draining, toggling pause is disable\n"); |
warning("pause:audio is draining, toggling pause is disable\n"); |
790 |
801 |
return; |
return; |
791 |
802 |
} |
} |
|
803 |
|
if (live_p) { |
|
804 |
|
warning("pause:disabled in live mode\n"); |
|
805 |
|
return; |
|
806 |
|
} |
792 |
807 |
if (paused_p) { |
if (paused_p) { |
793 |
808 |
int r; |
int r; |
794 |
809 |
|
|
|
... |
... |
STATIC void npv_cmd_mute(void) |
830 |
845 |
#define AUDIO_FR_FMT_NOT_OVERRIDDEN AVUTIL_AUDIO_FR_FMT_NONE |
#define AUDIO_FR_FMT_NOT_OVERRIDDEN AVUTIL_AUDIO_FR_FMT_NONE |
831 |
846 |
int main(int argc, u8 **args) |
int main(int argc, u8 **args) |
832 |
847 |
{ |
{ |
|
848 |
|
bool live; |
833 |
849 |
bool start_fullscreen; |
bool start_fullscreen; |
834 |
850 |
u16 win_width; |
u16 win_width; |
835 |
851 |
u16 win_height; |
u16 win_height; |
|
... |
... |
int main(int argc, u8 **args) |
858 |
874 |
#ifdef NPV_DEBUG |
#ifdef NPV_DEBUG |
859 |
875 |
npv_debug_p = false; |
npv_debug_p = false; |
860 |
876 |
#endif |
#endif |
|
877 |
|
live = false; |
861 |
878 |
start_fullscreen = false; |
start_fullscreen = false; |
862 |
879 |
win_width = WIDTH_NOT_DEFINED; |
win_width = WIDTH_NOT_DEFINED; |
863 |
880 |
win_height = HEIGHT_NOT_DEFINED; |
win_height = HEIGHT_NOT_DEFINED; |
|
... |
... |
int main(int argc, u8 **args) |
869 |
886 |
url = 0; |
url = 0; |
870 |
887 |
initial_vol = 1.; |
initial_vol = 1.; |
871 |
888 |
npv_pipeline_limits_p.pkts.prefill.percent = 0; |
npv_pipeline_limits_p.pkts.prefill.percent = 0; |
872 |
|
opts_parse(argc, args, &url, &start_fullscreen, &win_width, &win_height, |
|
|
889 |
|
opts_parse(argc, args, &url, &live, &start_fullscreen, |
|
890 |
|
&win_width, &win_height, |
873 |
891 |
&pcm_str, &override_initial_ff_chans_n, |
&pcm_str, &override_initial_ff_chans_n, |
874 |
892 |
&override_initial_ff_rate, |
&override_initial_ff_rate, |
875 |
893 |
&override_initial_ff_audio_fr_fmt, |
&override_initial_ff_audio_fr_fmt, |
876 |
894 |
&initial_vol, |
&initial_vol, |
877 |
895 |
&npv_pipeline_limits_p.pkts.prefill.percent); |
&npv_pipeline_limits_p.pkts.prefill.percent); |
878 |
|
init_once(url, start_fullscreen, initial_vol, win_width, win_height, |
|
879 |
|
pcm_str, &audio_codec_params, &video_codec_params, npv_faces); |
|
|
896 |
|
init_once(url, live, start_fullscreen, initial_vol, win_width, |
|
897 |
|
win_height, pcm_str, &audio_codec_params, &video_codec_params, |
|
898 |
|
npv_faces); |
880 |
899 |
prepare(initial_vol, override_initial_ff_chans_n, |
prepare(initial_vol, override_initial_ff_chans_n, |
881 |
900 |
override_initial_ff_rate, override_initial_ff_audio_fr_fmt, |
override_initial_ff_rate, override_initial_ff_audio_fr_fmt, |
882 |
901 |
npv_pipeline_limits_p.pkts.prefill.percent, audio_codec_params, |
npv_pipeline_limits_p.pkts.prefill.percent, audio_codec_params, |
File npv/video/namespace/main.c changed (mode: 100644) (index 1a5ae0e..91c569b) |
24 |
24 |
#define img_mem_barrier_run_once npv_video_img_mem_barrier_run_once |
#define img_mem_barrier_run_once npv_video_img_mem_barrier_run_once |
25 |
25 |
#define init_once_local npv_video_init_once_local |
#define init_once_local npv_video_init_once_local |
26 |
26 |
#define init_once_public npv_video_init_once_public |
#define init_once_public npv_video_init_once_public |
|
27 |
|
#define interrupted_rendering npv_video_iinterrupted_rendering |
27 |
28 |
#define is_swpchn_sem_consistent npv_video_is_swpchn_sem_consistent |
#define is_swpchn_sem_consistent npv_video_is_swpchn_sem_consistent |
28 |
29 |
#define is_swpchn_sem_fence_submitted_l npv_video_is_swpchn_sem_fence_submitted_l |
#define is_swpchn_sem_fence_submitted_l npv_video_is_swpchn_sem_fence_submitted_l |
29 |
30 |
#define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l |
#define last_fr_sent_to_pe_l npv_video_last_fr_sent_to_pe_l |
30 |
31 |
#define match_mem_type npv_video_match_mem_type |
#define match_mem_type npv_video_match_mem_type |
|
32 |
|
#define normal_rendering npv_video_normal_rendering |
31 |
33 |
#define poutff npv_video_poutff |
#define poutff npv_video_poutff |
32 |
34 |
#define receive_fr_l npv_video_receive_fr_l |
#define receive_fr_l npv_video_receive_fr_l |
33 |
35 |
#define scaler_img_create npv_video_scaler_img_create |
#define scaler_img_create npv_video_scaler_img_create |
|
74 |
76 |
#undef img_mem_barrier_run_once |
#undef img_mem_barrier_run_once |
75 |
77 |
#undef init_once_local |
#undef init_once_local |
76 |
78 |
#undef init_once_public |
#undef init_once_public |
|
79 |
|
#undef interrupted_rendering |
77 |
80 |
#undef is_swpchn_sem_consistent |
#undef is_swpchn_sem_consistent |
78 |
81 |
#undef is_swpchn_sem_fence_submitted_l |
#undef is_swpchn_sem_fence_submitted_l |
79 |
82 |
#undef last_fr_sent_to_pe_l |
#undef last_fr_sent_to_pe_l |
80 |
83 |
#undef match_mem_type |
#undef match_mem_type |
|
84 |
|
#undef normal_rendering |
81 |
85 |
#undef poutff |
#undef poutff |
82 |
86 |
#undef receive_fr_l |
#undef receive_fr_l |
83 |
87 |
#undef scaler_img_create |
#undef scaler_img_create |
File npv/video/public/code.frag.c changed (mode: 100644) (index 5636117..fe609ce) |
... |
... |
STATIC void dec_frs_unlock(void) |
199 |
199 |
#define READY 0 |
#define READY 0 |
200 |
200 |
#define NOT_READY 1 |
#define NOT_READY 1 |
201 |
201 |
#define SENT 0 |
#define SENT 0 |
202 |
|
#define NONE 0 |
|
203 |
202 |
/* XXX: we do want to lock the frs q the least amount of time as possible */ |
/* XXX: we do want to lock the frs q the least amount of time as possible */ |
204 |
|
STATIC void timer_evt(void) |
|
|
203 |
|
STATIC void normal_rendering(void) |
205 |
204 |
{ |
{ |
206 |
|
u8 pre_x; |
|
207 |
205 |
u8 r; |
u8 r; |
208 |
206 |
s64 now; |
s64 now; |
209 |
207 |
avutil_video_fr_ref_t *fr; |
avutil_video_fr_ref_t *fr; |
210 |
208 |
struct dec_fr_priv_t *fr_priv; |
struct dec_fr_priv_t *fr_priv; |
211 |
209 |
u32 swpchn_img; |
u32 swpchn_img; |
212 |
210 |
|
|
213 |
|
timer_ack(); |
|
214 |
|
/* |
|
215 |
|
* XXX: it is how that pre[fill|decode] indicators should be implemented |
|
216 |
|
*/ |
|
217 |
|
pre_x = atomic_load(&npv_pre_x_p); |
|
218 |
|
if (pre_x != NONE) |
|
219 |
|
return; |
|
220 |
211 |
r = npv_clk_get_video_st_ts(&now); |
r = npv_clk_get_video_st_ts(&now); |
221 |
212 |
if (r != TS_FROM_CLK_OK) |
if (r != TS_FROM_CLK_OK) |
222 |
213 |
return; |
return; |
|
... |
... |
STATIC void timer_evt(void) |
243 |
234 |
return; |
return; |
244 |
235 |
} |
} |
245 |
236 |
if (npv_paused_p) |
if (npv_paused_p) |
246 |
|
npv_video_osd_rop_restore(); |
|
247 |
|
npv_video_osd_rop_blend(now); |
|
|
237 |
|
npv_video_osd_rop_restore(); /* subtitles will happen here */ |
|
238 |
|
npv_video_osd_rop_blend(now); /* subtitles will happen here */ |
248 |
239 |
if (!is_swpchn_sem_consistent()) |
if (!is_swpchn_sem_consistent()) |
249 |
240 |
return; |
return; |
250 |
241 |
loop { /* because the swpchn can change for many reasons */ |
loop { /* because the swpchn can change for many reasons */ |
|
... |
... |
STATIC void timer_evt(void) |
265 |
256 |
#undef READY |
#undef READY |
266 |
257 |
#undef NOT_READY |
#undef NOT_READY |
267 |
258 |
#undef SENT |
#undef SENT |
|
259 |
|
STATIC void interrupted_rendering(void) |
|
260 |
|
{ |
|
261 |
|
/* |
|
262 |
|
* XXX: it is where that pre[fill|decode] indicators ("interrupted") |
|
263 |
|
* should be implemented with with an alternative code path. Here, |
|
264 |
|
* merging "normal" and "interrupted" code path would probably lead to |
|
265 |
|
* excessive code factorization at a pathological scale. |
|
266 |
|
*/ |
|
267 |
|
return; |
|
268 |
|
} |
|
269 |
|
#define NONE 0 |
|
270 |
|
STATIC void timer_evt(void) |
|
271 |
|
{ |
|
272 |
|
u8 pre_x; |
|
273 |
|
|
|
274 |
|
timer_ack(); |
|
275 |
|
pre_x = atomic_load(&npv_pre_x_p); |
|
276 |
|
if (pre_x == NONE) |
|
277 |
|
normal_rendering(); |
|
278 |
|
else /* pre[fill|decode] */ |
|
279 |
|
interrupted_rendering(); |
|
280 |
|
} |
268 |
281 |
#undef NONE |
#undef NONE |
269 |
282 |
/* we do per-loop fine-grained locking */ |
/* we do per-loop fine-grained locking */ |
270 |
283 |
#define sz size |
#define sz size |