More fixes from upstream..

- Don't flush buffers on DISCONT.
- Channel layouts are now set for DTS and (E)AC3 by libav.
- Add support for 10-bit YUV color formats.
- Add decode support for prores.

ok ajacoutot@
This commit is contained in:
brad 2013-03-27 11:41:11 +00:00
parent f64fc1c8e0
commit ccd3ab6d96
4 changed files with 218 additions and 10 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.33 2013/03/25 16:09:41 zhuk Exp $
# $OpenBSD: Makefile,v 1.34 2013/03/27 11:41:11 brad Exp $
COMMENT= ffmpeg element for GStreamer
V= 0.10.13
DISTNAME= gst-ffmpeg-${V}
PKGNAME= gstreamer-ffmpeg-${V}
REVISION= 6
REVISION= 7
# sync with graphics/ffmpeg
PERMIT_PACKAGE_CDROM= patents

View File

@ -1,10 +1,40 @@
$OpenBSD: patch-ext_ffmpeg_gstffmpegcodecmap_c,v 1.6 2012/03/03 10:33:42 ajacoutot Exp $
$OpenBSD: patch-ext_ffmpeg_gstffmpegcodecmap_c,v 1.7 2013/03/27 11:41:11 brad Exp $
From upstream: add mapping for Indeo 4 video codec.
From upstream:
- Channel layouts are now set for DTS and (E)AC3 by libav.
- Add mapping for Indeo 4 video codec.
- Add support for 10-bit YUV color formats.
- Add decode support for prores.
--- ext/ffmpeg/gstffmpegcodecmap.c.orig Mon Oct 31 06:14:03 2011
+++ ext/ffmpeg/gstffmpegcodecmap.c Fri Mar 2 17:20:56 2012
@@ -925,6 +925,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
+++ ext/ffmpeg/gstffmpegcodecmap.c Mon Mar 25 22:41:45 2013
@@ -340,25 +340,6 @@ gst_ff_aud_caps_new (AVCodecContext * context, enum Co
GstAudioChannelPosition *pos;
guint64 channel_layout = context->channel_layout;
- if (channel_layout == 0) {
- const guint64 default_channel_set[] = {
- 0, 0, CH_LAYOUT_SURROUND, CH_LAYOUT_QUAD, CH_LAYOUT_5POINT0,
- CH_LAYOUT_5POINT1, 0, CH_LAYOUT_7POINT1
- };
-
- switch (codec_id) {
- case CODEC_ID_EAC3:
- case CODEC_ID_AC3:
- case CODEC_ID_DTS:
- if (context->channels > 0
- && context->channels < G_N_ELEMENTS (default_channel_set))
- channel_layout = default_channel_set[context->channels - 1];
- break;
- default:
- break;
- }
- }
-
caps = gst_caps_new_simple (mimetype,
"rate", G_TYPE_INT, context->sample_rate,
"channels", G_TYPE_INT, context->channels, NULL);
@@ -925,6 +906,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
"indeoversion", G_TYPE_INT, 5, NULL);
break;
@ -16,7 +46,75 @@ From upstream: add mapping for Indeo 4 video codec.
case CODEC_ID_INDEO3:
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo",
"indeoversion", G_TYPE_INT, 3, NULL);
@@ -3180,6 +3185,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCo
@@ -1214,6 +1200,11 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id,
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dnxhd", NULL);
break;
+ case CODEC_ID_PRORES:
+ caps =
+ gst_ff_vid_caps_new (context, codec_id, encode, "video/x-prores",
+ NULL);
+
case CODEC_ID_MIMIC:
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mimic", NULL);
break;
@@ -1775,6 +1766,24 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, A
case PIX_FMT_YUV411P:
fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B');
break;
+ case PIX_FMT_YUV420P10BE:
+ fmt = GST_MAKE_FOURCC ('D', '4', '2', '0');
+ break;
+ case PIX_FMT_YUV420P10LE:
+ fmt = GST_MAKE_FOURCC ('d', '4', '2', '0');
+ break;
+ case PIX_FMT_YUV422P10BE:
+ fmt = GST_MAKE_FOURCC ('D', '4', '2', '2');
+ break;
+ case PIX_FMT_YUV422P10LE:
+ fmt = GST_MAKE_FOURCC ('d', '4', '2', '2');
+ break;
+ case PIX_FMT_YUV444P10BE:
+ fmt = GST_MAKE_FOURCC ('D', '4', '4', '4');
+ break;
+ case PIX_FMT_YUV444P10LE:
+ fmt = GST_MAKE_FOURCC ('d', '4', '4', '4');
+ break;
case PIX_FMT_RGB565:
bpp = depth = 16;
endianness = G_BYTE_ORDER;
@@ -2146,11 +2155,27 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'):
context->pix_fmt = PIX_FMT_YUV410P;
break;
-#if 0
- case FIXME:
+ case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
context->pix_fmt = PIX_FMT_YUV444P;
break;
-#endif
+ case GST_MAKE_FOURCC ('D', '4', '2', '0'):
+ context->pix_fmt = PIX_FMT_YUV420P10BE;
+ break;
+ case GST_MAKE_FOURCC ('d', '4', '2', '0'):
+ context->pix_fmt = PIX_FMT_YUV420P10LE;
+ break;
+ case GST_MAKE_FOURCC ('D', '4', '2', '2'):
+ context->pix_fmt = PIX_FMT_YUV422P10BE;
+ break;
+ case GST_MAKE_FOURCC ('d', '4', '2', '2'):
+ context->pix_fmt = PIX_FMT_YUV422P10BE;
+ break;
+ case GST_MAKE_FOURCC ('D', '4', '4', '4'):
+ context->pix_fmt = PIX_FMT_YUV444P10BE;
+ break;
+ case GST_MAKE_FOURCC ('d', '4', '4', '4'):
+ context->pix_fmt = PIX_FMT_YUV444P10BE;
+ break;
}
}
} else if (strcmp (gst_structure_get_name (structure),
@@ -3180,6 +3205,9 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCo
switch (indeoversion) {
case 5:
id = CODEC_ID_INDEO5;

View File

@ -1,6 +1,7 @@
$OpenBSD: patch-ext_ffmpeg_gstffmpegdec_c,v 1.5 2013/03/25 16:09:41 zhuk Exp $
$OpenBSD: patch-ext_ffmpeg_gstffmpegdec_c,v 1.6 2013/03/27 11:41:11 brad Exp $
From upstream:
- Don't flush buffers on DISCONT.
- Report latency if B-frames are present.
- Give the (E)AC3/DTS decoders a rank of marginal.
- Only set get_buffer() function for video.
@ -13,7 +14,7 @@ Date: Tue, 10 Jul 2012 14:10:14 +0000
Subject: avdec: ignore AAC errors instead of erroring out
--- ext/ffmpeg/gstffmpegdec.c.orig Wed Nov 2 09:04:05 2011
+++ ext/ffmpeg/gstffmpegdec.c Fri Mar 2 17:23:48 2012
+++ ext/ffmpeg/gstffmpegdec.c Mon Mar 25 22:17:30 2013
@@ -477,36 +477,44 @@ static gboolean
gst_ffmpegdec_query (GstPad * pad, GstQuery * query)
{
@ -126,7 +127,7 @@ Subject: avdec: ignore AAC errors instead of erroring out
GST_DEBUG_OBJECT (ffmpegdec,
"Buffer interlacing does not match pad, updating");
buffer = gst_buffer_make_metadata_writable (buffer);
@@ -2205,15 +2205,6 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
@@ -2205,15 +2220,6 @@ gst_ffmpegdec_audio_frame (GstFFMpegDec * ffmpegdec,
*outbuf = NULL;
}
@ -142,6 +143,26 @@ Subject: avdec: ignore AAC errors instead of erroring out
beach:
GST_DEBUG_OBJECT (ffmpegdec, "return flow %d, out %p, len %d",
*ret, *outbuf, len);
@@ -2542,15 +2548,15 @@ gst_ffmpegdec_chain (GstPad * pad, GstBuffer * inbuf)
discont = GST_BUFFER_IS_DISCONT (inbuf);
/* The discont flags marks a buffer that is not continuous with the previous
- * buffer. This means we need to clear whatever data we currently have. We
- * currently also wait for a new keyframe, which might be suboptimal in the
- * case of a network error, better show the errors than to drop all data.. */
+ * buffer. This means we need to clear whatever data we currently have. We let
+ * ffmpeg continue with the data that it has. We currently drain the old
+ * frames that might be inside the decoder and we clear any partial data in
+ * the pcache, we might be able to remove the drain and flush too. */
if (G_UNLIKELY (discont)) {
GST_DEBUG_OBJECT (ffmpegdec, "received DISCONT");
/* drain what we have queued */
gst_ffmpegdec_drain (ffmpegdec);
gst_ffmpegdec_flush_pcache (ffmpegdec);
- avcodec_flush_buffers (ffmpegdec->context);
ffmpegdec->discont = TRUE;
gst_ffmpegdec_reset_ts (ffmpegdec);
}
@@ -3043,14 +3049,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
rank = GST_RANK_SECONDARY;
break;

View File

@ -0,0 +1,89 @@
$OpenBSD: patch-ext_ffmpeg_gstffmpegutils_c,v 1.1 2013/03/27 11:41:11 brad Exp $
From upstream:
- Add support for 10-bit YUV color formats.
--- ext/ffmpeg/gstffmpegutils.c.orig Mon Mar 25 22:42:00 2013
+++ ext/ffmpeg/gstffmpegutils.c Mon Mar 25 22:52:39 2013
@@ -250,6 +250,54 @@ gst_ffmpeg_init_pix_fmt_info (void)
pix_fmt_info[PIX_FMT_YUVA420P].depth = 8,
pix_fmt_info[PIX_FMT_YUVA420P].x_chroma_shift = 1,
pix_fmt_info[PIX_FMT_YUVA420P].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUV420P10BE].name = g_strdup ("yuv420p10be");
+ pix_fmt_info[PIX_FMT_YUV420P10BE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV420P10BE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV420P10BE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV420P10BE].depth = 10,
+ pix_fmt_info[PIX_FMT_YUV420P10BE].x_chroma_shift = 1,
+ pix_fmt_info[PIX_FMT_YUV420P10BE].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUV420P10LE].name = g_strdup ("yuv420p10le");
+ pix_fmt_info[PIX_FMT_YUV420P10LE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV420P10LE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV420P10LE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV420P10LE].depth = 10,
+ pix_fmt_info[PIX_FMT_YUV420P10LE].x_chroma_shift = 1,
+ pix_fmt_info[PIX_FMT_YUV420P10LE].y_chroma_shift = 1;
+
+ pix_fmt_info[PIX_FMT_YUV422P10BE].name = g_strdup ("yuv422p10be");
+ pix_fmt_info[PIX_FMT_YUV422P10BE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV422P10BE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV422P10BE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV422P10BE].depth = 10;
+ pix_fmt_info[PIX_FMT_YUV422P10BE].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUV422P10BE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV422P10LE].name = g_strdup ("yuv422p10le");
+ pix_fmt_info[PIX_FMT_YUV422P10LE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV422P10LE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV422P10LE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV422P10LE].depth = 10;
+ pix_fmt_info[PIX_FMT_YUV422P10LE].x_chroma_shift = 1;
+ pix_fmt_info[PIX_FMT_YUV422P10LE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV444P10BE].name = g_strdup ("yuv444p10be");
+ pix_fmt_info[PIX_FMT_YUV444P10BE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV444P10BE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV444P10BE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV444P10BE].depth = 10;
+ pix_fmt_info[PIX_FMT_YUV444P10BE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUV444P10BE].y_chroma_shift = 0;
+
+ pix_fmt_info[PIX_FMT_YUV444P10LE].name = g_strdup ("yuv444p10le");
+ pix_fmt_info[PIX_FMT_YUV444P10LE].nb_channels = 3;
+ pix_fmt_info[PIX_FMT_YUV444P10LE].color_type = FF_COLOR_YUV;
+ pix_fmt_info[PIX_FMT_YUV444P10LE].pixel_type = FF_PIXEL_PLANAR;
+ pix_fmt_info[PIX_FMT_YUV444P10LE].depth = 10;
+ pix_fmt_info[PIX_FMT_YUV444P10LE].x_chroma_shift = 0;
+ pix_fmt_info[PIX_FMT_YUV444P10LE].y_chroma_shift = 0;
};
int
@@ -418,6 +466,26 @@ gst_ffmpeg_avpicture_fill (AVPicture * picture,
picture->linesize[2] = 0;
picture->linesize[3] = 0;
return size + 256 * 4;
+ case PIX_FMT_YUV420P10BE:
+ case PIX_FMT_YUV420P10LE:
+ case PIX_FMT_YUV422P10BE:
+ case PIX_FMT_YUV422P10LE:
+ case PIX_FMT_YUV444P10BE:
+ case PIX_FMT_YUV444P10LE:
+ stride = GST_ROUND_UP_4 (width * 2);
+ h2 = ROUND_UP_X (height, pinfo->y_chroma_shift);
+ size = stride * h2;
+ w2 = DIV_ROUND_UP_X (width, pinfo->x_chroma_shift);
+ stride2 = GST_ROUND_UP_4 (w2 * 2);
+ h2 = DIV_ROUND_UP_X (height, pinfo->y_chroma_shift);
+ size2 = stride2 * h2;
+ picture->data[0] = ptr;
+ picture->data[1] = picture->data[0] + size;
+ picture->data[2] = picture->data[1] + size2;
+ picture->linesize[0] = stride;
+ picture->linesize[1] = stride2;
+ picture->linesize[2] = stride2;
+ return size + 2 * size2;
default:
picture->data[0] = NULL;
picture->data[1] = NULL;