优化读取fps
This commit is contained in:
parent
702cc168f3
commit
1583ffcb42
22
avs2bdnxml.c
22
avs2bdnxml.c
@ -171,20 +171,6 @@
|
|||||||
#include <vfw.h>
|
#include <vfw.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef LINUX
|
|
||||||
static int64_t gcd( int64_t a, int64_t b )
|
|
||||||
{
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
int64_t c = a % b;
|
|
||||||
if( !c )
|
|
||||||
return b;
|
|
||||||
a = b;
|
|
||||||
b = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#if !defined(LINUX)
|
#if !defined(LINUX)
|
||||||
PAVISTREAM p_avi;
|
PAVISTREAM p_avi;
|
||||||
@ -209,7 +195,6 @@ int open_file_avis( char *psz_filename, avis_input_t **p_handle, stream_info_t *
|
|||||||
avis_input_t *h = malloc(sizeof(avis_input_t));
|
avis_input_t *h = malloc(sizeof(avis_input_t));
|
||||||
#if !defined(LINUX)
|
#if !defined(LINUX)
|
||||||
AVISTREAMINFO info;
|
AVISTREAMINFO info;
|
||||||
int i;
|
|
||||||
|
|
||||||
*p_handle = h;
|
*p_handle = h;
|
||||||
|
|
||||||
@ -244,11 +229,10 @@ int open_file_avis( char *psz_filename, avis_input_t **p_handle, stream_info_t *
|
|||||||
p_param->i_width = info.rcFrame.right - info.rcFrame.left;
|
p_param->i_width = info.rcFrame.right - info.rcFrame.left;
|
||||||
h->height =
|
h->height =
|
||||||
p_param->i_height = info.rcFrame.bottom - info.rcFrame.top;
|
p_param->i_height = info.rcFrame.bottom - info.rcFrame.top;
|
||||||
i = gcd(info.dwRate, info.dwScale);
|
p_param->i_fps_den = info.dwScale;
|
||||||
p_param->i_fps_den = info.dwScale / i;
|
p_param->i_fps_num = info.dwRate;
|
||||||
p_param->i_fps_num = info.dwRate / i;
|
|
||||||
|
|
||||||
fprintf( stderr, "avis [info]: %dx%d @ %.2f fps (%d frames)\n",
|
fprintf( stderr, "avis [info]: %dx%d @ %.3f fps (%d frames)\n",
|
||||||
p_param->i_width, p_param->i_height,
|
p_param->i_width, p_param->i_height,
|
||||||
(double)p_param->i_fps_num / (double)p_param->i_fps_den,
|
(double)p_param->i_fps_num / (double)p_param->i_fps_den,
|
||||||
(int)info.dwLength );
|
(int)info.dwLength );
|
||||||
|
Loading…
Reference in New Issue
Block a user