static int prepare_video_decoding( lsmash_handler_t *h, video_option_t *opt ) { avs_handler_t *hp = (avs_handler_t *)h->video_private; h->video_sample_count = hp->vi->num_frames; h->framerate_num = hp->vi->fps_numerator; h->framerate_den = hp->vi->fps_denominator; /* Set up video rendering. */ int input_width = hp->vi->width; enum AVPixelFormat input_pixel_format = as_to_av_input_pixel_format( hp->vi->pixel_type, opt->avs.bit_depth, &input_width ); return au_setup_video_rendering( &hp->voh, opt, &h->video_format, input_width, hp->vi->height, input_pixel_format ); }
static int prepare_video_decoding ( lsmash_handler_t *h, video_option_t *opt ) { vpy_handler_t *hp = (vpy_handler_t *)h->video_private; h->video_sample_count = hp->vi->numFrames; h->framerate_num = hp->vi->fpsNum; h->framerate_den = hp->vi->fpsDen; /* Set up the initial input format. */ hp->ctx->width = hp->vi->width; hp->ctx->height = hp->vi->height; hp->ctx->pix_fmt = vs_to_av_input_pixel_format( hp->vi->format->id ); hp->ctx->color_range = AVCOL_RANGE_UNSPECIFIED; hp->ctx->colorspace = AVCOL_SPC_UNSPECIFIED; /* Set up video rendering. */ if( !au_setup_video_rendering( &hp->voh, hp->ctx, opt, &h->video_format, hp->vi->width, hp->vi->height ) ) return -1; return 0; }
static int prepare_video_decoding( lsmash_handler_t *h, video_option_t *opt ) { libav_handler_t *hp = (libav_handler_t *)h->video_private; lwlibav_video_decode_handler_t *vdhp = &hp->vdh; if( !vdhp->ctx ) return 0; vdhp->seek_mode = opt->seek_mode; vdhp->forward_seek_threshold = opt->forward_seek_threshold; lwlibav_video_output_handler_t *vohp = &hp->voh; h->video_sample_count = vohp->frame_count; /* Import AVIndexEntrys. */ if( lwlibav_import_av_index_entry( (lwlibav_decode_handler_t *)vdhp ) < 0 ) return -1; /* Set up timestamp info. */ hp->uType = MB_OK; lwlibav_setup_timestamp_info( &hp->lwh, vdhp, vohp, &h->framerate_num, &h->framerate_den ); hp->uType = MB_ICONERROR | MB_OK; /* Set up the initial input format. */ vdhp->ctx->width = vdhp->initial_width; vdhp->ctx->height = vdhp->initial_height; vdhp->ctx->pix_fmt = vdhp->initial_pix_fmt; vdhp->ctx->colorspace = vdhp->initial_colorspace; /* Set up video rendering. */ vdhp->exh.get_buffer = au_setup_video_rendering( vohp, vdhp->ctx, opt, &h->video_format, vdhp->max_width, vdhp->max_height ); if( !vdhp->exh.get_buffer ) return -1; #ifndef DEBUG_VIDEO vdhp->lh.level = LW_LOG_FATAL; #endif /* Find the first valid video frame. */ if( lwlibav_find_first_valid_video_frame( vdhp ) < 0 ) return -1; /* Force seeking at the first reading. */ vdhp->last_frame_number = h->video_sample_count + 1; return 0; }