From 72333e34f673d25dba75c61db65d9840da903895 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 23 Apr 2004 00:49:10 +0000 Subject: [PATCH] ext/ffmpeg/gstffmpegcodecmap.c: WAV/IMA-ADPCM -> DVI ADPCM. Original commit message from CVS: * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), (gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid): WAV/IMA-ADPCM -> DVI ADPCM. --- ChangeLog | 6 ++++++ ext/ffmpeg/gstffmpegcodecmap.c | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36b2527..d44d7c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-04-22 Ronald Bultje + + * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps), + (gst_ffmpeg_caps_with_codecid), (gst_ffmpeg_caps_to_codecid): + WAV/IMA-ADPCM -> DVI ADPCM. + 2004-04-22 Benjamin Otte * ext/ffmpeg/gstffmpegcolorspace.c: diff --git a/ext/ffmpeg/gstffmpegcodecmap.c b/ext/ffmpeg/gstffmpegcodecmap.c index b070d73..1e6929a 100644 --- a/ext/ffmpeg/gstffmpegcodecmap.c +++ b/ext/ffmpeg/gstffmpegcodecmap.c @@ -240,10 +240,24 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, if (encode) { /* I'm not exactly sure what ffmpeg outputs... ffmpeg itself uses * the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */ - /* FIXME: bitrate */ - caps = GST_FF_VID_CAPS_NEW ("video/mpeg", - "systemstream", G_TYPE_BOOLEAN, FALSE, - "mpegversion", G_TYPE_INT, 4, NULL); + guint32 fourcc = 0; + + if (context) + fourcc = context->codec_tag; + + switch (fourcc) { + case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): + caps = GST_FF_VID_CAPS_NEW ("video/x-divx", + "divxversion", G_TYPE_INT, 5, NULL); + break; + case GST_MAKE_FOURCC ('m', 'p', '4', 'v'): + default: + /* FIXME: bitrate */ + caps = GST_FF_VID_CAPS_NEW ("video/mpeg", + "systemstream", G_TYPE_BOOLEAN, FALSE, + "mpegversion", G_TYPE_INT, 4, NULL); + break; + } } else { /* The trick here is to separate xvid, divx, mpeg4, 3ivx et al */ caps = GST_FF_VID_CAPS_NEW ("video/mpeg", @@ -523,7 +537,7 @@ gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, layout = "quicktime"; break; case CODEC_ID_ADPCM_IMA_WAV: - layout = "wav"; + layout = "dvi"; break; case CODEC_ID_ADPCM_IMA_DK3: layout = "dk3"; @@ -1057,9 +1071,19 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, else if (!strcmp (mime, "video/x-3ivx")) context->codec_tag = GST_MAKE_FOURCC ('3', 'I', 'V', '1'); else if (!strcmp (mime, "video/mpeg")) { + const GValue *value; + const GstBuffer *buf; + context->codec_tag = GST_MAKE_FOURCC ('m', 'p', '4', 'v'); - /* FIXME: esds atom parsing */ + /* esds atom parsing */ + if ((value = gst_structure_get_value (str, "codec_data"))) { + buf = g_value_get_boxed (value); + context->extradata = av_mallocz (GST_BUFFER_SIZE (buf)); + memcpy (context->extradata, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf)); + context->extradata_size = GST_BUFFER_SIZE (buf); + } } } while (0); break; @@ -1142,6 +1166,9 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, gst_ffmpeg_get_palette (caps, context); } while (0); break; + + default: + break; } /* common properties (width, height, fps) */ @@ -1482,7 +1509,7 @@ gst_ffmpeg_caps_to_codecid (const GstCaps * caps, AVCodecContext * context) id = CODEC_ID_ADPCM_IMA_QT; } else if (!strcmp (layout, "microsoft")) { id = CODEC_ID_ADPCM_MS; - } else if (!strcmp (layout, "wav")) { + } else if (!strcmp (layout, "dvi")) { id = CODEC_ID_ADPCM_IMA_WAV; } else if (!strcmp (layout, "4xm")) { id = CODEC_ID_ADPCM_4XM; -- 2.7.4