[x264-devel] x264 can't read large file

Ikseong Bae iambaeba1 at yahoo.com
Fri Jul 15 10:06:17 CEST 2005


x264 can't read large file if the file size is greater than 2^31 (2 gbyte), 
I modifed the source code enable to read large files.
 
==> Current code
static int get_frame_total_yuv( hnd_t handle, int i_width, int i_height )
{
    FILE *f = (FILE *)handle;
    int i_frame_total = 0;
    if( !fseek( f, 0, SEEK_END ) )
    {
        int64_t i_size = ftell( f );
        fseek( f, 0, SEEK_SET );
        i_frame_total = (int)(i_size / ( i_width * i_height * 3 / 2 ));
    }
    return i_frame_total;
}
 
==> modified code
 
char gnp08FileName[1024];
/* raw 420 yuv file operation */
static int open_file_yuv( char *psz_filename, hnd_t *p_handle, x264_param_t *p_param )
{
    if ((*p_handle = fopen(psz_filename, "rb")) == NULL)
        return -1;
 
    strcpy(gnp08FileName, psz_filename);
    return 0;
}
 
static int get_frame_total_yuv( hnd_t handle, int i_width, int i_height )
{
    int i_frame_total = 0;
    int  fh;
    int64_t n64Size, n64Pos;
    if( (fh = _open(gnp08FileName, _O_RDONLY )) != -1 )
   {
      n64Pos = _lseeki64 ( fh, 0L, SEEK_END );
      if( n64Pos == -1L )
          perror( "_lseek to end failed" );
      n64Size = _telli64( fh );
       i_frame_total = (int)(n64Size / ( i_width * i_height * 3 / 2 ));
      _close( fh );
   }
    return i_frame_total;
}
 
 
Best regards
 
Bae
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.videolan.org/pipermail/x264-devel/attachments/20050715/747f090c/attachment.htm 


More information about the x264-devel mailing list