Ejemplo n.º 1
0
static int open_file( char *psz_filename, hnd_t *p_handle, x264_param_t *p_param )
{
    thread_hnd_t *h = malloc( sizeof(thread_hnd_t) );
    if( !h || input.picture_alloc( &h->pic, p_param->i_csp, p_param->i_width, p_param->i_height ) )
    {
        fprintf( stderr, "x264 [error]: malloc failed\n" );
        return -1;
    }
    h->input = input;
    h->p_handle = *p_handle;
    h->in_progress = 0;
    h->next_frame = -1;
    h->next_args = malloc( sizeof(thread_input_arg_t) );
    if( !h->next_args )
        return -1;
    h->next_args->h = h;
    h->next_args->status = 0;
    h->frame_total = input.get_frame_total( h->p_handle );
    thread_input.picture_alloc = h->input.picture_alloc;
    thread_input.picture_clean = h->input.picture_clean;

    *p_handle = h;
    return 0;
}