Am Samstag, den 25.06.2016, 12:52 +0200 schrieb Michael Niedermayer:
> On Fri, Jun 24, 2016 at 06:27:38PM +0200, Jens Ziller wrote:
> > 
> > Hello,
> > 
> > deinterlacing need frame->interlaced_frame and format struct. This
> > patch added this to AVFrame.
> > 
> > Regards Jens.
> > 
> >  mmaldec.c |   16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 6351a54c36d98d1f6ffdaeea96af8c0db1305358  0001-for-deinterlacing-
> > needed.patch
> > From 8a8961a4fab0da2bd98ef6cbfaf55462a00d3450 Mon Sep 17 00:00:00
> > 2001
> > From: Jens Ziller <zille...@gmx.de>
> > Date: Fri, 24 Jun 2016 18:18:12 +0200
> > 
> > Subject: [PATCH] for deinterlacing needed
> This commit message is not ok
> 
> The message should describe
> 1. what is changed
> 2. why it is changed
> 3. how it is changed
> 
> When in doubt always write a longer commit message than a short one
> 
> [...]
> > 
> >      if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
> >          if (!ctx->pool_out)
> > +        // in data[2] give the format struct for configure
> > deinterlacer and renderer
> > +        frame->data[2] = ctx->decoder->output[0]->format;
> This is not how AV_PIX_FMT_MMAL is documented:
> 
>     /**
>      * HW acceleration though MMAL, data[3] contains a pointer to the
>      * MMAL_BUFFER_HEADER_T structure.
>      */
>     AV_PIX_FMT_MMAL,
> 
> also where is the code that uses data[2] ?
> 
> [...]
> 

Attached is the new Version. Hints and comments are welcome.

Regards Jens.

> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From eb6b4d03b258789b4b7baafe89fec1a8feae00f7 Mon Sep 17 00:00:00 2001
From: Jens Ziller <zille...@gmx.de>
Date: Sun, 26 Jun 2016 17:01:34 +0200
Subject: [PATCH] v2 fill AVFrame->interlaced_frame with
 MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T, add a pointer data[2] to
 MMAL_ES_FORMAT_T that user application can invoke MMAL components like
 deinterlacer and renderer with it

---
 libavcodec/mmaldec.c | 16 ++++++++++++++++
 libavutil/pixfmt.h   |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c
index 099a8c5..b38a3bd 100644
--- a/libavcodec/mmaldec.c
+++ b/libavcodec/mmaldec.c
@@ -88,6 +88,7 @@ typedef struct MMALDecodeContext {
     int eos_received;
     int eos_sent;
     int extradata_sent;
+    int interlaced_frame;
 } MMALDecodeContext;
 
 // Assume decoder is guaranteed to produce output after at least this many
@@ -274,6 +275,7 @@ static int ffmal_update_format(AVCodecContext *avctx)
     int ret = 0;
     MMAL_COMPONENT_T *decoder = ctx->decoder;
     MMAL_ES_FORMAT_T *format_out = decoder->output[0]->format;
+    MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T interlace_type;
 
     ffmmal_poolref_unref(ctx->pool_out);
     if (!(ctx->pool_out = av_mallocz(sizeof(*ctx->pool_out)))) {
@@ -300,6 +302,15 @@ static int ffmal_update_format(AVCodecContext *avctx)
     if ((status = mmal_port_format_commit(decoder->output[0])))
         goto fail;
 
+    interlace_type.hdr.id = MMAL_PARAMETER_VIDEO_INTERLACE_TYPE;
+    interlace_type.hdr.size = sizeof(MMAL_PARAMETER_VIDEO_INTERLACE_TYPE_T);
+    status = mmal_port_parameter_get(decoder->output[0], &interlace_type.hdr);
+    if (status != MMAL_SUCCESS) {
+        av_log(avctx, AV_LOG_ERROR, "Cannot read MMAL interlace information!\n");
+    } else {
+        ctx->interlaced_frame = !(interlace_type.eMode == MMAL_InterlaceProgressive);
+    }
+
     if ((ret = ff_set_dimensions(avctx, format_out->es->video.crop.x + format_out->es->video.crop.width,
                                         format_out->es->video.crop.y + format_out->es->video.crop.height)) < 0)
         goto fail;
@@ -609,8 +620,13 @@ static int ffmal_copy_frame(AVCodecContext *avctx,  AVFrame *frame,
     MMALDecodeContext *ctx = avctx->priv_data;
     int ret = 0;
 
+    frame->interlaced_frame = ctx->interlaced_frame;
+
     if (avctx->pix_fmt == AV_PIX_FMT_MMAL) {
         if (!ctx->pool_out)
+        // in data[2] give the format struct for configure deinterlacer and renderer
+        frame->data[2] = ctx->decoder->output[0]->format;
+
             return AVERROR_UNKNOWN; // format change code failed with OOM previously
 
         if ((ret = ff_decode_frame_props(avctx, frame)) < 0)
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 0ed01c4..98982f8 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -235,7 +235,8 @@ enum AVPixelFormat {
     AV_PIX_FMT_QSV,
     /**
      * HW acceleration though MMAL, data[3] contains a pointer to the
-     * MMAL_BUFFER_HEADER_T structure.
+     * MMAL_BUFFER_HEADER_T structure and data[2] contains a pointer to the
+     * MMAL_ES_FORMAT_T structure.
      */
     AV_PIX_FMT_MMAL,
 
-- 
2.7.3

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to