From b4e1a5610445750eaf90d7a9ece97a945a0915b8 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 19 Dec 2005 15:47:13 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegcodecmap.c: Update ffmpeg_codec_id <=> mimetype conversions Original commit message from CVS: * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps): Update ffmpeg_codec_id <=> mimetype conversions * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): Finer grained keyframe detection --- ChangeLog | 7 +++++ common | 2 +- ext/ffmpeg/gstffmpegcodecmap.c | 61 +++++++++++++++++++++++++++++++++--------- ext/ffmpeg/gstffmpegdec.c | 12 ++++++--- 4 files changed, 66 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43ecb19..5e92a5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-12-19 Edward Hervey + + * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps): + Update ffmpeg_codec_id <=> mimetype conversions + * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_frame): + Finer grained keyframe detection + 2005-12-16 Tim-Philipp Müller * ext/ffmpeg/gstffmpeg.c: (gst_ffmpeg_avcodec_open), diff --git a/common b/common index 4edc214..d1911d4 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 4edc214072fe07d2aade96bc336493425654d7b4 +Subproject commit d1911d4b3d6267f9cd9dfb68fcef2afe4d098092 diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index 6fe04b0..4f7e34b 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -244,10 +244,13 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, * MJPEG-B and sp5x decoding...)? */ case CODEC_ID_MJPEG: case CODEC_ID_LJPEG: - case CODEC_ID_SP5X: caps = GST_FF_VID_CAPS_NEW ("image/jpeg", NULL); break; + case CODEC_ID_SP5X: + caps = GST_FF_VID_CAPS_NEW ("video/sp5x", NULL); + break; + case CODEC_ID_MJPEGB: caps = GST_FF_VID_CAPS_NEW ("video/x-mjpeg-b", NULL); break; @@ -378,7 +381,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, break; case CODEC_ID_CYUV: - buildcaps = TRUE; + caps = GST_FF_VID_CAPS_NEW ("video/x-compressed-yuv", NULL); break; case CODEC_ID_H264: @@ -410,8 +413,12 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, break; case CODEC_ID_ASV1: + caps = GST_FF_VID_CAPS_NEW ("video/x-asus", + "asusversion", G_TYPE_INT, 1, NULL); + break; case CODEC_ID_ASV2: - buildcaps = TRUE; + caps = GST_FF_VID_CAPS_NEW ("video/x-asus", + "asusversion", G_TYPE_INT, 2, NULL); break; case CODEC_ID_FFV1: @@ -429,15 +436,22 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL); break; - case CODEC_ID_FRAPS: - case CODEC_ID_VCR1: case CODEC_ID_CLJR: + caps = GST_FF_VID_CAPS_NEW ("video/x-cirrus-logic-accupak", NULL); + break; + + case CODEC_ID_FRAPS: case CODEC_ID_MDEC: case CODEC_ID_ROQ: case CODEC_ID_INTERPLAY_VIDEO: buildcaps = TRUE; break; + case CODEC_ID_VCR1: + caps = GST_FF_VID_CAPS_NEW ("video/x-ati-vcr", + "vcrversion", G_TYPE_INT, 1, NULL); + break; + case CODEC_ID_RPZA: caps = GST_FF_VID_CAPS_NEW ("video/x-apple-video", NULL); break; @@ -484,27 +498,50 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, caps = GST_FF_AUD_CAPS_NEW ("audio/x-qdm2", NULL); break; + case CODEC_ID_MSZH: + caps = GST_FF_VID_CAPS_NEW ("video/x-mszh", NULL); + break; + + case CODEC_ID_ZLIB: + caps = GST_FF_VID_CAPS_NEW ("video/x-zlib", NULL); + break; + + case CODEC_ID_TRUEMOTION1: + caps = GST_FF_VID_CAPS_NEW ("video/x-truemotion", + "trueversion", G_TYPE_INT, 1, NULL); + break; + case CODEC_ID_TRUEMOTION2: + caps = GST_FF_VID_CAPS_NEW ("video/x-truemotion", + "trueversion", G_TYPE_INT, 2, NULL); + break; + + case CODEC_ID_ULTI: + caps = GST_FF_VID_CAPS_NEW ("video/x-ultimotion", + NULL); + break; + + case CODEC_ID_TSCC: + caps = GST_FF_VID_CAPS_NEW ("video/x-camtasia", NULL); + break; + + case CODEC_ID_PNG: + caps = GST_FF_VID_CAPS_NEW ("image/png", NULL); + break; + case CODEC_ID_WS_VQA: case CODEC_ID_IDCIN: case CODEC_ID_8BPS: case CODEC_ID_SMC: case CODEC_ID_FLIC: - case CODEC_ID_TRUEMOTION1: - case CODEC_ID_TRUEMOTION2: case CODEC_ID_VMDVIDEO: case CODEC_ID_VMDAUDIO: - case CODEC_ID_MSZH: - case CODEC_ID_ZLIB: case CODEC_ID_SONIC: case CODEC_ID_SONIC_LS: case CODEC_ID_SNOW: - case CODEC_ID_TSCC: - case CODEC_ID_ULTI: case CODEC_ID_QDRAW: case CODEC_ID_VIXL: case CODEC_ID_QPEG: case CODEC_ID_XVID: - case CODEC_ID_PNG: case CODEC_ID_PPM: case CODEC_ID_PBM: case CODEC_ID_PGM: diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 3027865..e4223fd 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -807,6 +807,8 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, case CODEC_TYPE_VIDEO: { gboolean iskeyframe = FALSE; + gboolean is_itype = FALSE; + gboolean is_reference = FALSE; ffmpegdec->picture->pict_type = -1; /* in case we skip frames */ @@ -814,10 +816,14 @@ gst_ffmpegdec_frame (GstFFMpegDec * ffmpegdec, len = avcodec_decode_video (ffmpegdec->context, ffmpegdec->picture, &have_data, data, size); - iskeyframe = ((ffmpegdec->picture->pict_type == FF_I_TYPE) || (ffmpegdec->picture->reference)); + is_itype = (ffmpegdec->picture->pict_type == FF_I_TYPE); + is_reference = (ffmpegdec->picture->reference == 1); + iskeyframe = ( is_itype || is_reference ) + || (oclass->in_plugin->id == CODEC_ID_MSZH) + || (oclass->in_plugin->id == CODEC_ID_ZLIB); GST_DEBUG_OBJECT (ffmpegdec, - "Decoded video: len=%d, have_data=%d, is_keyframe:%d", - len, have_data, iskeyframe); + "Decoded video: len=%d, have_data=%d, is_keyframe:%d, is_itype:%d, is_reference:%d", + len, have_data, iskeyframe, is_itype, is_reference); if (ffmpegdec->waiting_for_key) { if (iskeyframe) { -- 2.7.4