This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit bdde570
1 parent e1729c0 commit bdde570 Copy full SHA for bdde570
File tree 4 files changed +28
-3
lines changed
4 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ static void help_encoder(void)
71
71
puts ("encoder on - enable encoder" );
72
72
puts ("encoder off - disable encoder" );
73
73
puts ("encoder quality <quality> - select quality" );
74
+ puts ("encoder fps <fps> - configure target fps" );
74
75
}
75
76
#endif
76
77
@@ -375,6 +376,11 @@ static void encoder_configure_quality(int quality)
375
376
encoder_set_quality (quality );
376
377
}
377
378
379
+ static void encoder_configure_fps (int fps )
380
+ {
381
+ printf ("Setting encoder fps to %d\r\n" , fps );
382
+ encoder_set_fps (fps );
383
+ }
378
384
379
385
static void encoder_off (void )
380
386
{
@@ -593,6 +599,8 @@ void ci_service(void)
593
599
encoder_off ();
594
600
else if (strcmp (token , "quality ") == 0 )
595
601
encoder_configure_quality (atoi (get_token (& str )));
602
+ else if (strcmp (token , "fps ") == 0 )
603
+ encoder_configure_fps (atoi (get_token (& str )));
596
604
else
597
605
help_encoder ();
598
606
}
Original file line number Diff line number Diff line change @@ -160,21 +160,35 @@ int encoder_set_quality(int quality) {
160
160
return 1 ;
161
161
}
162
162
163
+ int encoder_set_fps (int fps ) {
164
+ if (encoder_target_fps > 0 && encoder_target_fps <= 60 ) {
165
+ encoder_target_fps = fps ;
166
+ return 0 ;
167
+ }
168
+ else {
169
+ encoder_target_fps = 30 ;
170
+ return 1 ;
171
+ }
172
+ }
173
+
163
174
void encoder_service (void ) {
164
175
165
176
static int last_event ;
166
177
static int last_fps_event ;
167
178
static int frame_cnt ;
179
+ static int can_start ;
168
180
169
181
if (encoder_enabled ) {
170
- if (elapsed (& last_event , identifier_frequency_read ()/30 )) {
171
- if (encoder_done () == 1 ) {
182
+ if (elapsed (& last_event , identifier_frequency_read ()/encoder_target_fps )) {
183
+ can_start = 1 ;
184
+ }
185
+ if (can_start & encoder_done ()) {
172
186
encoder_init (encoder_quality );
173
187
encoder_start (processor_h_active , processor_v_active );
174
188
encoder_reader_dma_length_write (processor_h_active * processor_v_active * 2 );
175
189
encoder_reader_dma_shoot_write (1 );
176
190
frame_cnt ++ ;
177
- }
191
+ }
178
192
}
179
193
if (elapsed (& last_fps_event , identifier_frequency_read ())) {
180
194
encoder_fps = frame_cnt ;
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ const char chroma_rom_75[64];
23
23
const char chroma_rom_50 [64 ];
24
24
25
25
char encoder_enabled ;
26
+ int encoder_target_fps ;
26
27
int encoder_fps ;
27
28
int encoder_quality ;
28
29
@@ -33,6 +34,7 @@ void encoder_start(short resx, short resy);
33
34
int encoder_done (void );
34
35
void encoder_enable (char enable );
35
36
int encoder_set_quality (int quality );
37
+ int encoder_set_fps (int fps );
36
38
void encoder_service (void );
37
39
38
40
#endif
Original file line number Diff line number Diff line change @@ -371,6 +371,7 @@ void processor_init(void)
371
371
processor_encoder_source = VIDEO_IN_HDMI_IN0 ;
372
372
#ifdef ENCODER_BASE
373
373
encoder_enable (0 );
374
+ encoder_target_fps = 30 ;
374
375
#endif
375
376
}
376
377
You can’t perform that action at this time.
0 commit comments