static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) { CropContext *crop = link->dst->priv; AVFilterPicRef *ref2 = avfilter_ref_pic(picref, ~0); #ifdef _MSC_VER AVPixFmtDescriptor *av_pix_fmt_descriptors = get_av_pix_fmt_descriptors(); #endif int i; ref2->w = crop->w; ref2->h = crop->h; ref2->data[0] += crop->y * ref2->linesize[0]; ref2->data[0] += (crop->x * crop->bpp) >> 3; if (!(av_pix_fmt_descriptors[link->format].flags & PIX_FMT_PAL)) { for (i = 1; i < 3; i ++) { if (ref2->data[i]) { ref2->data[i] += (crop->y >> crop->vsub) * ref2->linesize[i]; ref2->data[i] += ((crop->x * crop->bpp) >> 3) >> crop->hsub; } } }
void show_pix_fmts(void) { enum PixelFormat pix_fmt; AVPixFmtDescriptor *av_pix_fmt_descriptors = get_av_pix_fmt_descriptors(); printf( "Pixel formats:\n" "I.... = Supported Input format for conversion\n" ".O... = Supported Output format for conversion\n" "..H.. = Hardware accelerated format\n" "...P. = Paletted format\n" "....B = Bitstream format\n" "FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL\n" "-----\n"); #if !CONFIG_SWSCALE # define sws_isSupportedInput(x) 0 # define sws_isSupportedOutput(x) 0 #endif for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++) { const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt]; printf("%c%c%c%c%c %-16s %d %2d\n", sws_isSupportedInput (pix_fmt) ? 'I' : '.', sws_isSupportedOutput(pix_fmt) ? 'O' : '.', pix_desc->flags & PIX_FMT_HWACCEL ? 'H' : '.', pix_desc->flags & PIX_FMT_PAL ? 'P' : '.', pix_desc->flags & PIX_FMT_BITSTREAM ? 'B' : '.', pix_desc->name, pix_desc->nb_components, av_get_bits_per_pixel(pix_desc)); } }
static av_cold int raw_init_encoder(AVCodecContext *avctx) { #ifdef _MSC_VER AVPixFmtDescriptor *av_pix_fmt_descriptors = get_av_pix_fmt_descriptors(); #endif avctx->coded_frame = (AVFrame *)avctx->priv_data; avctx->coded_frame->pict_type = FF_I_TYPE; avctx->coded_frame->key_frame = 1; avctx->bits_per_coded_sample = av_get_bits_per_pixel(&av_pix_fmt_descriptors[avctx->pix_fmt]); if(!avctx->codec_tag) avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt); return 0; }