Lines Matching defs:avctx
151 static void ffmmal_stop_decoder(AVCodecContext *avctx)
153 MMALDecodeContext *ctx = avctx->priv_data;
186 static av_cold int ffmmal_close_decoder(AVCodecContext *avctx)
188 MMALDecodeContext *ctx = avctx->priv_data;
191 ffmmal_stop_decoder(avctx);
206 AVCodecContext *avctx = (AVCodecContext*)port->userdata;
207 MMALDecodeContext *ctx = avctx->priv_data;
221 AVCodecContext *avctx = (AVCodecContext*)port->userdata;
222 MMALDecodeContext *ctx = avctx->priv_data;
229 AVCodecContext *avctx = (AVCodecContext*)port->userdata;
234 av_log(avctx, AV_LOG_ERROR, "MMAL error %d on control port\n", (int)status);
236 av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on control port\n",
244 static int ffmmal_fill_output_port(AVCodecContext *avctx)
246 MMALDecodeContext *ctx = avctx->priv_data;
256 av_log(avctx, AV_LOG_ERROR, "MMAL error %d when sending output buffer.\n", (int)status);
277 static int ffmal_update_format(AVCodecContext *avctx)
279 MMALDecodeContext *ctx = avctx->priv_data;
302 if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
315 av_log(avctx, AV_LOG_ERROR, "Cannot read MMAL interlace information!\n");
321 if ((ret = ff_set_dimensions(avctx, format_out->es->video.crop.x + format_out->es->video.crop.width,
326 avctx->sample_aspect_ratio.num = format_out->es->video.par.num;
327 avctx->sample_aspect_ratio.den = format_out->es->video.par.den;
330 avctx->framerate.num = format_out->es->video.frame_rate.num;
331 avctx->framerate.den = format_out->es->video.frame_rate.den;
334 avctx->colorspace = ffmmal_csp_to_av_csp(format_out->es->video.color_space);
353 static av_cold int ffmmal_init_decoder(AVCodecContext *avctx)
355 MMALDecodeContext *ctx = avctx->priv_data;
361 ctx->pkt = avctx->internal->in_pkt;
366 av_log(avctx, AV_LOG_ERROR, "Cannot initialize MMAL VC driver!\n");
370 if ((ret = ff_get_format(avctx, avctx->codec->pix_fmts)) < 0)
373 avctx->pix_fmt = ret;
382 switch (avctx->codec_id) {
397 format_in->es->video.width = FFALIGN(avctx->width, 32);
398 format_in->es->video.height = FFALIGN(avctx->height, 16);
399 format_in->es->video.crop.width = avctx->width;
400 format_in->es->video.crop.height = avctx->height;
403 format_in->es->video.par.num = avctx->sample_aspect_ratio.num;
404 format_in->es->video.par.den = avctx->sample_aspect_ratio.den;
407 av_log(avctx, AV_LOG_DEBUG, "Using MMAL %s encoding.\n",
413 av_log(avctx, AV_LOG_WARNING, "Could not set input buffering limit.\n");
430 if ((ret = ffmal_update_format(avctx)) < 0)
437 decoder->input[0]->userdata = (void*)avctx;
438 decoder->output[0]->userdata = (void*)avctx;
439 decoder->control->userdata = (void*)avctx;
454 ffmmal_close_decoder(avctx);
458 static void ffmmal_flush(AVCodecContext *avctx)
460 MMALDecodeContext *ctx = avctx->priv_data;
464 ffmmal_stop_decoder(avctx);
476 av_log(avctx, AV_LOG_ERROR, "MMAL flush error: %i\n", (int)status);
485 static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt,
488 MMALDecodeContext *ctx = avctx->priv_data;
572 static int ffmmal_fill_input_port(AVCodecContext *avctx)
574 MMALDecodeContext *ctx = avctx->priv_data;
611 av_log(avctx, AV_LOG_ERROR, "MMAL error %d when sending input\n", (int)status);
619 static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame,
622 MMALDecodeContext *ctx = avctx->priv_data;
628 if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
632 if ((ret = ff_decode_frame_props(avctx, frame)) < 0)
638 int w = FFALIGN(avctx->width, 32);
639 int h = FFALIGN(avctx->height, 16);
643 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
648 avctx->pix_fmt, w, h, 1);
650 avctx->pix_fmt, avctx->width, avctx->height);
653 frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
654 frame->width = avctx->width;
655 frame->width = avctx->width;
656 frame->height = avctx->height;
657 frame->format = avctx->pix_fmt;
667 static int ffmmal_read_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame)
669 MMALDecodeContext *ctx = avctx->priv_data;
697 av_log(avctx, AV_LOG_ERROR, "Did not get output frame from MMAL.\n");
716 av_log(avctx, AV_LOG_INFO, "Changing output format.\n");
726 if ((ret = ffmal_update_format(avctx)) < 0)
732 if ((ret = ffmmal_fill_output_port(avctx)) < 0)
735 if ((ret = ffmmal_fill_input_port(avctx)) < 0)
741 av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n",
752 if ((ret = ffmal_copy_frame(avctx, frame, buffer)) < 0)
767 static int ffmmal_receive_frame(AVCodecContext *avctx, AVFrame *frame)
769 MMALDecodeContext *ctx = avctx->priv_data;
774 if (avctx->extradata_size && !ctx->extradata_sent) {
775 avpkt->data = avctx->extradata;
776 avpkt->size = avctx->extradata_size;
778 if ((ret = ffmmal_add_packet(avctx, avpkt, 1)) < 0)
782 ret = ff_decode_get_packet(avctx, avpkt);
784 if ((ret = ffmmal_add_packet(avctx, avpkt, 0)) < 0)
789 if ((ret = ffmmal_fill_input_port(avctx)) < 0)
792 if ((ret = ffmmal_fill_output_port(avctx)) < 0)
795 if ((ret = ffmmal_read_frame(avctx, frame, &got_frame)) < 0)
801 if ((ret = ffmmal_fill_output_port(avctx)) < 0)
804 if ((ret = ffmmal_fill_input_port(avctx)) < 0)