libav: drop unused FFMPEG_LIBS and move libpostproc only to 0.8.11
RFC PATCH 1/1 libav: drop unused FFMPEG_LIBS and move libpostproc only to 0.8.11
* standalone libpostproc recipe depends on libav, but current PACKAGES_DYNAMIC indicated that libav-9.13 also provides libpostproc
--- meta/recipes-multimedia/libav/libav.inc | 5 ----- meta/recipes-multimedia/libav/libav_0.8.11.bb | 2 ++ meta/recipes-multimedia/libav/libav_9.13.bb | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)
meta/recipes-multimedia/libav/libav.inc +0 -5
@@ -87,9 +87,6 @@ do_install_append() { install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/ } -FFMPEG_LIBS = "libavcodec libavdevice libavformat \ - libavutil libpostproc libswscale libavfilter" - PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" RSUGGESTS_${PN} = "mplayer"
@@ -142,5 +139,3 @@ python populate_packages_prepend() { for pkg in pkgs: d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel') } - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_0.8.11.bb +2 -0
@@ -16,3 +16,5 @@ PROVIDES += "libpostproc" EXTRA_OECONF += " \ --enable-postproc \ " + +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.13.bb +3 -0
@@ -11,3 +11,6 @@ SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" DEFAULT_PREFERENCE = "-1" + +# unlike 0.8.11 we don't provide libpostproc +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.0.0
PATCH 1/2 gst-ffmpeg: add dependency on libpostproc
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
--- meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1 -1
@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" LICENSE_FLAGS = "commercial" HOMEPAGE = "http://www.gstreamer.net/" -DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native" +DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native libpostproc" inherit autotools pkgconfig
Signature · 1 line
2.0.4
PATCH 2/2 libav: drop unused FFMPEG_LIBS and move libpostproc only to 0.8.11
* standalone libpostproc recipe depends on libav, but current PACKAGES_DYNAMIC indicated that libav-9.13 also provides libpostproc
--- meta/recipes-multimedia/libav/libav.inc | 5 ----- meta/recipes-multimedia/libav/libav_0.8.11.bb | 2 ++ meta/recipes-multimedia/libav/libav_9.13.bb | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)
meta/recipes-multimedia/libav/libav.inc +0 -5
@@ -85,9 +85,6 @@ do_install_append() { install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/ } -FFMPEG_LIBS = "libavcodec libavdevice libavformat \ - libavutil libpostproc libswscale libavfilter" - PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" RSUGGESTS_${PN} = "mplayer"
@@ -140,5 +137,3 @@ python populate_packages_prepend() { for pkg in pkgs: d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel') } - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_0.8.11.bb +2 -0
@@ -16,3 +16,5 @@ PROVIDES += "libpostproc" EXTRA_OECONF += " \ --enable-postproc \ " + +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.13.bb +3 -0
@@ -11,3 +11,6 @@ SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" DEFAULT_PREFERENCE = "-1" + +# unlike 0.8.11 we don't provide libpostproc +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.0.4
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
In reply to Martin JansaQuoted 5 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
Does gst-ffmpeg actually work with libav > 0.8?
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
Quoted 8 lines · Paul Eggleton
Quoted 5 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' foundDoes gst-ffmpeg actually work with libav > 0.8?
No, not yet (see world status e-mails), but at least this is step in right direction IMHO and doesn't harm libav-0.8 users.
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
Quoted 8 lines · On Wednesday 06 August 2014 16:37:34 Martin Jansa wrote:
Quoted 7 lines · Paul Eggleton
Quoted 5 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
Quoted 4 lines
Quoted 1 line
Does gst-ffmpeg actually work with libav > 0.8?
No, not yet (see world status e-mails), but at least this is step in right direction IMHO and doesn't harm libav-0.8 users.
I'm just not sure gst-ffmpeg should be allowed to get past this at all if it's not currently expected to work. The known working configuration is either gst-ffmpeg + libav 0.8.x, or gstreamer1.0-libav + libav > 0.8.x.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
Quoted 9 lines · Paul Eggleton
Quoted 8 lines · On Wednesday 06 August 2014 16:37:34 Martin Jansa wrote:
Quoted 7 lines · Paul Eggleton
Quoted 5 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Does gst-ffmpeg actually work with libav > 0.8?
No, not yet (see world status e-mails), but at least this is step in right direction IMHO and doesn't harm libav-0.8 users.
I'm just not sure gst-ffmpeg should be allowed to get past this at all if it's
It gets past this when libpostproc is built before gst-ffmpeg, adding the dependency only makes the failure with libav-9 to be deterministic (always in the same piece of code).
Quoted 2 lines
not currently expected to work. The known working configuration is either gst-ffmpeg + libav 0.8.x, or gstreamer1.0-libav + libav > 0.8.x.
FWIW here is patchset used by gentoo to make gst-ffmpeg-0.10.13 compatible with libav-9:
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
PATCH 1/1 gst-ffmpeg: add PACKAGECONFIG for libav9 and patch from Gentoo
* apply the patch only when PACKAGECONFIG is selected, because the changes aren't backwards compatible
--- .../gstreamer/gst-ffmpeg-0.10.13/libav-9.patch | 9304 ++++++++++++++++++++ .../gstreamer/gst-ffmpeg_0.10.13.bb | 2 + 2 files changed, 9306 insertions(+) create mode 100644 meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/libav-9.patch
meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/libav-9.patch new file +9304 -0
@@ -0,0 +1,9304 @@ +Taken from gentoo patchset: +http://dev.gentoo.org/~tetromino/distfiles/gst-plugins-ffmpeg/gst-ffmpeg-0.10.13_p2012.11-libav-9-patches.tar.xz + +Upstream-Status: Pending + +Contains following changes, rebased to apply on top of our changes +0002-Fix-includes-for-systemwide-build.patch +0003-libav-Switch-to-non-deprecated-symbols.patch +0005-av-Update-for-some-constant-changes.patch +0006-av-Remove-palette-support-for-now.patch +0007-av-Port-remaining-simple-bits.patch +0008-av-Use-av_codec_is_-en-de-coder-API-instead-of-priva.patch +0009-avprotocol-Port-from-the-URL-protocol-handler-to-san.patch +0010-avdec-don-t-wait-for-keyframe.patch + +Following changes were skipped: +0001-Partially-revert-commit-0300801b.patch +0004-av-update-to-use-AVOption-variants.patch +0011-av_get_bits_per_sample_format-was-removed-in-libav-9.patch + +Signed-off-by: Martin Jansa <[email protected]> + +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.c 2011-10-31 11:14:03.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.c 2014-08-08 15:26:07.872857555 +0200 +@@ -151,9 +151,6 @@ + #endif + gst_ffmpegaudioresample_register (plugin); + +- av_register_protocol2 (&gstreamer_protocol, sizeof (URLProtocol)); +- av_register_protocol2 (&gstpipe_protocol, sizeof (URLProtocol)); +- + /* Now we can return the pointer to the newly created Plugin object. */ + return TRUE; + } +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.h gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.h +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.h 2011-05-17 10:53:16.000000000 +0200 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.h 2014-08-08 15:26:07.872857555 +0200 +@@ -58,10 +58,13 @@ + int gst_ffmpeg_avcodec_close (AVCodecContext *avctx); + int gst_ffmpeg_av_find_stream_info(AVFormatContext *ic); + +-G_END_DECLS ++int gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context); ++int gst_ffmpegdata_close (AVIOContext * h); ++typedef struct _GstFFMpegPipe GstFFMpegPipe; ++int gst_ffmpeg_pipe_open (GstFFMpegPipe *ffpipe, int flags, AVIOContext ** context); ++int gst_ffmpeg_pipe_close (AVIOContext * h); + +-extern URLProtocol gstreamer_protocol; +-extern URLProtocol gstpipe_protocol; ++G_END_DECLS + + /* use GST_FFMPEG URL_STREAMHEADER with URL_WRONLY if the first + * buffer should be used as streamheader property on the pad's caps. */ +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcfg.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcfg.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcfg.c 2011-07-12 16:35:27.000000000 +0200 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcfg.c 2014-08-08 15:24:17.899853612 +0200 +@@ -147,7 +147,6 @@ + {FF_DCT_FASTINT, "Fast Integer", "fastint"}, + {FF_DCT_INT, "Accurate Integer", "int"}, + {FF_DCT_MMX, "MMX", "mmx"}, +- {FF_DCT_MLIB, "MLIB", "mlib"}, + {FF_DCT_ALTIVEC, "ALTIVEC", "altivec"}, + {FF_DCT_FAAN, "FAAN", "faan"}, + {0, NULL, NULL}, +@@ -173,8 +172,6 @@ + {FF_IDCT_SIMPLE, "Simple", "simple"}, + {FF_IDCT_SIMPLEMMX, "Simple MMX", "simplemmx"}, + {FF_IDCT_LIBMPEG2MMX, "LIBMPEG2MMX", "libmpeg2mmx"}, +- {FF_IDCT_PS2, "PS2", "ps2"}, +- {FF_IDCT_MLIB, "MLIB", "mlib"}, + {FF_IDCT_ARM, "ARM", "arm"}, + {FF_IDCT_ALTIVEC, "ALTIVEC", "altivec"}, + {FF_IDCT_SH4, "SH4", "sh4"}, +@@ -263,16 +260,11 @@ + + if (!ffmpeg_flags_type) { + static const GFlagsValue ffmpeg_flags[] = { +- {CODEC_FLAG_OBMC, "Use overlapped block motion compensation (h263+)", +- "obmc"}, + {CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"}, + {CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"}, +- {CODEC_FLAG_H263P_AIV, "H.263 alternative inter VLC", "aiv"}, + {CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"}, + {CODEC_FLAG_GMC, "GMC", "gmc"}, + {CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"}, +- {CODEC_FLAG_PART, +- "Store MV, DC and AC coefficients in seperate partitions", "part"}, + {CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"}, + {CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"}, + {CODEC_FLAG_NORMALIZE_AQP, +@@ -282,13 +274,9 @@ + "global-headers"}, + {CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction", + "aic"}, +- {CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"}, + {CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"}, + {CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection", + "qp-rd"}, +- {CODEC_FLAG_H263P_SLICE_STRUCT, "H263 slice struct", "ss"}, +- {CODEC_FLAG_SVCD_SCAN_OFFSET, +- "Reserve space for SVCD scan offset user data", "scanoffset"}, + {CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"}, + {0, NULL, NULL}, + }; +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c 2011-10-31 11:14:03.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c 2014-08-08 15:31:30.968869139 +0200 +@@ -25,8 +25,10 @@ + #include <gst/gst.h> + #ifdef HAVE_FFMPEG_UNINSTALLED + #include <avcodec.h> ++#include <channel_layout.h>> + #else + #include <libavcodec/avcodec.h> ++#include <libavutil/channel_layout.h> + #endif + #include <string.h> + +@@ -35,43 +37,6 @@ + + #include <gst/pbutils/codec-utils.h> + +-/* +- * Read a palette from a caps. +- */ +- +-static void +-gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context) +-{ +- GstStructure *str = gst_caps_get_structure (caps, 0); +- const GValue *palette_v; +- const GstBuffer *palette; +- +- /* do we have a palette? */ +- if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) { +- palette = gst_value_get_buffer (palette_v); +- if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) { +- if (context->palctrl) +- av_free (context->palctrl); +- context->palctrl = av_malloc (sizeof (AVPaletteControl)); +- context->palctrl->palette_changed = 1; +- memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette), +- AVPALETTE_SIZE); +- } +- } +-} +- +-static void +-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context) +-{ +- if (context->palctrl) { +- GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE); +- +- memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette, +- AVPALETTE_SIZE); +- gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL); +- } +-} +- + /* IMPORTANT: Keep this sorted by the ffmpeg channel masks */ + static const struct + { +@@ -79,26 +44,26 @@ + GstAudioChannelPosition gst; + } _ff_to_gst_layout[] = { + { +- CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { +- CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { +- CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { +- CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { +- CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { +- CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { +- CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { +- CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { +- CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { +- CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { +- CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { +- CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { +- CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} ++ AV_CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { ++ AV_CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { ++ AV_CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { ++ AV_CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { ++ AV_CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { ++ AV_CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { ++ AV_CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { ++ AV_CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { ++ AV_CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { ++ AV_CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { ++ AV_CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} + }; + + static GstAudioChannelPosition * +@@ -342,8 +307,8 @@ + + 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 ++ 0, 0, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_5POINT0, ++ AV_CH_LAYOUT_5POINT1, 0, AV_CH_LAYOUT_7POINT1 + }; + + switch (codec_id) { +@@ -1267,8 +1232,6 @@ + case CODEC_ID_FLIC: + case CODEC_ID_VMDVIDEO: + case CODEC_ID_VMDAUDIO: +- case CODEC_ID_SONIC: +- case CODEC_ID_SONIC_LS: + case CODEC_ID_SNOW: + case CODEC_ID_VIXL: + case CODEC_ID_QPEG: +@@ -1689,11 +1652,6 @@ + gst_buffer_unref (data); + } + +- /* palette */ +- if (context) { +- gst_ffmpeg_set_palette (caps, context); +- } +- + GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps); + + } else { +@@ -1830,9 +1788,6 @@ + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "endianness", G_TYPE_INT, endianness, NULL); +- if (caps && context) { +- gst_ffmpeg_set_palette (caps, context); +- } + } + } else if (fmt) { + caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-yuv", +@@ -1857,7 +1812,7 @@ + */ + + static GstCaps * +-gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt, ++gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt, + AVCodecContext * context, enum CodecID codec_id) + { + GstCaps *caps = NULL; +@@ -1867,22 +1822,22 @@ + gboolean signedness = FALSE; + + switch (sample_fmt) { +- case SAMPLE_FMT_S16: ++ case AV_SAMPLE_FMT_S16: + signedness = TRUE; + bpp = 16; + break; + +- case SAMPLE_FMT_S32: ++ case AV_SAMPLE_FMT_S32: + signedness = TRUE; + bpp = 32; + break; + +- case SAMPLE_FMT_FLT: ++ case AV_SAMPLE_FMT_FLT: + integer = FALSE; + bpp = 32; + break; + +- case SAMPLE_FMT_DBL: ++ case AV_SAMPLE_FMT_DBL: + integer = FALSE; + bpp = 64; + break; +@@ -1941,12 +1896,12 @@ + } + } else { + GstCaps *temp; +- enum SampleFormat i; ++ enum AVSampleFormat i; + AVCodecContext ctx = { 0, }; + + ctx.channels = -1; + caps = gst_caps_new_empty (); +- for (i = 0; i <= SAMPLE_FMT_DBL; i++) { ++ for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) { + temp = gst_ffmpeg_smpfmt_to_caps (i, encode ? &ctx : NULL, codec_id); + if (temp != NULL) { + gst_caps_append (caps, temp); +@@ -2049,9 +2004,9 @@ + gst_structure_get_int (structure, "endianness", &endianness)) { + if (endianness == G_BYTE_ORDER) { + if (width == 32) +- context->sample_fmt = SAMPLE_FMT_FLT; ++ context->sample_fmt = AV_SAMPLE_FMT_FLT; + else if (width == 64) +- context->sample_fmt = SAMPLE_FMT_DBL; ++ context->sample_fmt = AV_SAMPLE_FMT_DBL; + } + } + } else { +@@ -2062,9 +2017,9 @@ + gst_structure_get_int (structure, "endianness", &endianness)) { + if ((endianness == G_BYTE_ORDER) && (signedness == TRUE)) { + if ((width == 16) && (depth == 16)) +- context->sample_fmt = SAMPLE_FMT_S16; ++ context->sample_fmt = AV_SAMPLE_FMT_S16; + else if ((width == 32) && (depth == 32)) +- context->sample_fmt = SAMPLE_FMT_S32; ++ context->sample_fmt = AV_SAMPLE_FMT_S32; + } + } + } +@@ -2190,7 +2145,6 @@ + } else { + if (bpp == 8) { + context->pix_fmt = PIX_FMT_PAL8; +- gst_ffmpeg_get_palette (caps, context); + } + } + } +@@ -2576,7 +2530,6 @@ + switch (codec_type) { + case AVMEDIA_TYPE_VIDEO: + gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); +- gst_ffmpeg_get_palette (caps, context); + break; + case AVMEDIA_TYPE_AUDIO: + gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c.orig gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c.orig +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c.orig 2014-08-08 15:30:34.006867097 +0200 +@@ -0,0 +1,3447 @@ ++/* GStreamer ++ * Copyright (C) <1999> Erik Walthinsen <[email protected]> ++ * This file: ++ * Copyright (c) 2002-2004 Ronald Bultje <[email protected]> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++#include <gst/gst.h> ++#ifdef HAVE_FFMPEG_UNINSTALLED ++#include <avcodec.h> ++#include <channel_layout.h>> ++#else ++#include <libavcodec/avcodec.h> ++#include <libavutil/channel_layout.h> ++#endif ++#include <string.h> ++ ++#include "gstffmpeg.h" ++#include "gstffmpegcodecmap.h" ++ ++#include <gst/pbutils/codec-utils.h> ++ ++/* ++ * Read a palette from a caps. ++ */ ++ ++static void ++gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context) ++{ ++ GstStructure *str = gst_caps_get_structure (caps, 0); ++ const GValue *palette_v; ++ const GstBuffer *palette; ++ ++ /* do we have a palette? */ ++ if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) { ++ palette = gst_value_get_buffer (palette_v); ++ if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) { ++ if (context->palctrl) ++ av_free (context->palctrl); ++ context->palctrl = av_malloc (sizeof (AVPaletteControl)); ++ context->palctrl->palette_changed = 1; ++ memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette), ++ AVPALETTE_SIZE); ++ } ++ } ++} ++ ++static void ++gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context) ++{ ++ if (context->palctrl) { ++ GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE); ++ ++ memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette, ++ AVPALETTE_SIZE); ++ gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL); ++ } ++} ++ ++/* IMPORTANT: Keep this sorted by the ffmpeg channel masks */ ++static const struct ++{ ++ guint64 ff; ++ GstAudioChannelPosition gst; ++} _ff_to_gst_layout[] = { ++ { ++ AV_CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { ++ AV_CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { ++ AV_CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { ++ AV_CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { ++ AV_CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { ++ AV_CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { ++ AV_CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { ++ AV_CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { ++ AV_CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { ++ AV_CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { ++ AV_CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} ++}; ++ ++static GstAudioChannelPosition * ++gst_ff_channel_layout_to_gst (guint64 channel_layout, guint channels) ++{ ++ guint nchannels = 0, i, j; ++ GstAudioChannelPosition *pos = NULL; ++ gboolean none_layout = FALSE; ++ ++ for (i = 0; i < 64; i++) { ++ if ((channel_layout & (G_GUINT64_CONSTANT (1) << i)) != 0) { ++ nchannels++; ++ } ++ } ++ ++ if (channel_layout == 0) { ++ nchannels = channels; ++ none_layout = TRUE; ++ } ++ ++ if (nchannels != channels) { ++ GST_ERROR ("Number of channels is different (%u != %u)", channels, ++ nchannels); ++ return NULL; ++ } ++ ++ pos = g_new (GstAudioChannelPosition, nchannels); ++ ++ for (i = 0, j = 0; i < G_N_ELEMENTS (_ff_to_gst_layout); i++) { ++ if ((channel_layout & _ff_to_gst_layout[i].ff) != 0) { ++ pos[j++] = _ff_to_gst_layout[i].gst; ++ ++ if (_ff_to_gst_layout[i].gst == GST_AUDIO_CHANNEL_POSITION_NONE) ++ none_layout = TRUE; ++ } ++ } ++ ++ if (j != nchannels) { ++ GST_WARNING ("Unknown channels in channel layout - assuming NONE layout"); ++ none_layout = TRUE; ++ } ++ ++ if (!none_layout && !gst_audio_check_channel_positions (pos, nchannels)) { ++ GST_ERROR ("Invalid channel layout %" G_GUINT64_FORMAT ++ " - assuming NONE layout", channel_layout); ++ none_layout = TRUE; ++ } ++ ++ if (none_layout) { ++ if (nchannels == 1) { ++ pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO; ++ } else if (nchannels == 2) { ++ pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; ++ pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; ++ } else if (channel_layout == 0) { ++ g_free (pos); ++ pos = NULL; ++ } else { ++ for (i = 0; i < nchannels; i++) ++ pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE; ++ } ++ } ++ ++ if (nchannels == 1 && pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER) { ++ GST_DEBUG ("mono common case; won't set channel positions"); ++ g_free (pos); ++ pos = NULL; ++ } else if (nchannels == 2 && pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT ++ && pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) { ++ GST_DEBUG ("stereo common case; won't set channel positions"); ++ g_free (pos); ++ pos = NULL; ++ } ++ ++ return pos; ++} ++ ++/* this macro makes a caps width fixed or unfixed width/height ++ * properties depending on whether we've got a context. ++ * ++ * See below for why we use this. ++ * ++ * We should actually do this stuff at the end, like in riff-media.c, ++ * but I'm too lazy today. Maybe later. ++ */ ++static GstCaps * ++gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, ++ const char *mimetype, const char *fieldname, ...) ++{ ++ GstStructure *structure = NULL; ++ GstCaps *caps = NULL; ++ va_list var_args; ++ gint i; ++ ++ GST_LOG ("context:%p, codec_id:%d, mimetype:%s", context, codec_id, mimetype); ++ ++ /* fixed, non probing context */ ++ if (context != NULL && context->width != -1) { ++ gint num, denom; ++ ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, context->width, ++ "height", G_TYPE_INT, context->height, NULL); ++ ++ num = context->time_base.den / context->ticks_per_frame; ++ denom = context->time_base.num; ++ ++ if (!denom) { ++ GST_LOG ("invalid framerate: %d/0, -> %d/1", num, num); ++ denom = 1; ++ } ++ if (gst_util_fraction_compare (num, denom, 1000, 1) > 0) { ++ GST_LOG ("excessive framerate: %d/%d, -> 0/1", num, denom); ++ num = 0; ++ denom = 1; ++ } ++ GST_LOG ("setting framerate: %d/%d", num, denom); ++ gst_caps_set_simple (caps, ++ "framerate", GST_TYPE_FRACTION, num, denom, NULL); ++ } else { ++ /* so we are after restricted caps in this case */ ++ switch (codec_id) { ++ case CODEC_ID_H261: ++ { ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 352, ++ "height", G_TYPE_INT, 288, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ gst_caps_append (caps, gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 176, ++ "height", G_TYPE_INT, 144, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL)); ++ break; ++ } ++ case CODEC_ID_H263: ++ { ++ /* 128x96, 176x144, 352x288, 704x576, and 1408x1152. slightly reordered ++ * because we want automatic negotiation to go as close to 320x240 as ++ * possible. */ ++ const static gint widths[] = { 352, 704, 176, 1408, 128 }; ++ const static gint heights[] = { 288, 576, 144, 1152, 96 }; ++ GstCaps *temp; ++ gint n_sizes = G_N_ELEMENTS (widths); ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < n_sizes; i++) { ++ temp = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, widths[i], ++ "height", G_TYPE_INT, heights[i], ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ ++ gst_caps_append (caps, temp); ++ } ++ break; ++ } ++ case CODEC_ID_DVVIDEO: ++ { ++ static struct ++ { ++ guint32 csp; ++ gint width, height; ++ gint par_n, par_d; ++ gint framerate_n, framerate_d; ++ } profiles[] = { ++ { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 10, 11, 30000, 1001}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 40, 33, 30000, 1001}, { ++ GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 59, 54, 25, 1}, { ++ GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 118, 81, 25, 1}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 59, 54, 25, 1}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 118, 81, 25, 1} ++ }; ++ GstCaps *temp; ++ gint n_sizes = G_N_ELEMENTS (profiles); ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < n_sizes; i++) { ++ temp = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, profiles[i].width, ++ "height", G_TYPE_INT, profiles[i].height, ++ "framerate", GST_TYPE_FRACTION, profiles[i].framerate_n, ++ profiles[i].framerate_d, "pixel-aspect-ratio", GST_TYPE_FRACTION, ++ profiles[i].par_n, profiles[i].par_d, NULL); ++ ++ gst_caps_append (caps, temp); ++ } ++ break; ++ } ++ case CODEC_ID_DNXHD: ++ { ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 1920, ++ "height", G_TYPE_INT, 1080, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ gst_caps_append (caps, gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 1280, ++ "height", G_TYPE_INT, 720, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL)); ++ break; ++ } ++ default: ++ break; ++ } ++ } ++ ++ /* no fixed caps or special restrictions applied; ++ * default unfixed setting */ ++ if (!caps) { ++ GST_DEBUG ("Creating default caps"); ++ caps = gst_caps_new_simple (mimetype, ++ "width", GST_TYPE_INT_RANGE, 16, 4096, ++ "height", GST_TYPE_INT_RANGE, 16, 4096, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ } ++ ++ for (i = 0; i < gst_caps_get_size (caps); i++) { ++ va_start (var_args, fieldname); ++ structure = gst_caps_get_structure (caps, i); ++ gst_structure_set_valist (structure, fieldname, var_args); ++ va_end (var_args); ++ } ++ ++ return caps; ++} ++ ++/* same for audio - now with channels/sample rate ++ */ ++static GstCaps * ++gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id, ++ const char *mimetype, const char *fieldname, ...) ++{ ++ GstCaps *caps = NULL; ++ GstStructure *structure = NULL; ++ gint i; ++ va_list var_args; ++ ++ /* fixed, non-probing context */ ++ if (context != NULL && context->channels != -1) { ++ GstAudioChannelPosition *pos; ++ guint64 channel_layout = context->channel_layout; ++ ++ if (channel_layout == 0) { ++ const guint64 default_channel_set[] = { ++ 0, 0, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_5POINT0, ++ AV_CH_LAYOUT_5POINT1, 0, AV_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); ++ ++ pos = gst_ff_channel_layout_to_gst (channel_layout, context->channels); ++ if (pos != NULL) { ++ gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos); ++ g_free (pos); ++ } ++ } else { ++ gint maxchannels = 2; ++ const gint *rates = NULL; ++ gint n_rates = 0; ++ ++ /* so we must be after restricted caps in this case */ ++ switch (codec_id) { ++ case CODEC_ID_AAC: ++ case CODEC_ID_AAC_LATM: ++ case CODEC_ID_DTS: ++ maxchannels = 6; ++ break; ++ case CODEC_ID_MP2: ++ { ++ const static gint l_rates[] = ++ { 48000, 44100, 32000, 24000, 22050, 16000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_EAC3: ++ case CODEC_ID_AC3: ++ { ++ const static gint l_rates[] = { 48000, 44100, 32000 }; ++ maxchannels = 6; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_ADPCM_G722: ++ { ++ const static gint l_rates[] = { 16000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ maxchannels = 1; ++ break; ++ } ++ case CODEC_ID_ADPCM_G726: ++ { ++ const static gint l_rates[] = { 8000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ maxchannels = 1; ++ break; ++ } ++ case CODEC_ID_ADPCM_SWF: ++ { ++ const static gint l_rates[] = { 11025, 22050, 44100 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_ROQ_DPCM: ++ { ++ const static gint l_rates[] = { 22050 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_AMR_NB: ++ { ++ const static gint l_rates[] = { 8000 }; ++ maxchannels = 1; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_AMR_WB: ++ { ++ const static gint l_rates[] = { 16000 }; ++ maxchannels = 1; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ default: ++ break; ++ } ++ ++ /* TODO: handle context->channel_layouts here to set ++ * the list of channel layouts supported by the encoder. ++ * Unfortunately no encoder uses this yet.... ++ */ ++ /* regardless of encode/decode, open up channels if applicable */ ++ /* Until decoders/encoders expose the maximum number of channels ++ * they support, we whitelist them here. */ ++ switch (codec_id) { ++ case CODEC_ID_WMAPRO: ++ case CODEC_ID_TRUEHD: ++ maxchannels = 8; ++ break; ++ default: ++ break; ++ } ++ ++ if (maxchannels == 1) ++ caps = gst_caps_new_simple (mimetype, ++ "channels", G_TYPE_INT, maxchannels, NULL); ++ else ++ caps = gst_caps_new_simple (mimetype, ++ "channels", GST_TYPE_INT_RANGE, 1, maxchannels, NULL); ++ if (n_rates) { ++ GValue list = { 0, }; ++ GstStructure *structure; ++ ++ g_value_init (&list, GST_TYPE_LIST); ++ for (i = 0; i < n_rates; i++) { ++ GValue v = { 0, }; ++ ++ g_value_init (&v, G_TYPE_INT); ++ g_value_set_int (&v, rates[i]); ++ gst_value_list_append_value (&list, &v); ++ g_value_unset (&v); ++ } ++ structure = gst_caps_get_structure (caps, 0); ++ gst_structure_set_value (structure, "rate", &list); ++ g_value_unset (&list); ++ } else ++ gst_caps_set_simple (caps, "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL); ++ } ++ ++ for (i = 0; i < gst_caps_get_size (caps); i++) { ++ va_start (var_args, fieldname); ++ structure = gst_caps_get_structure (caps, i); ++ gst_structure_set_valist (structure, fieldname, var_args); ++ va_end (var_args); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG codec ID and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * CodecID is primarily meant for compressed data GstCaps! ++ * ++ * encode is a special parameter. gstffmpegdec will say ++ * FALSE, gstffmpegenc will say TRUE. The output caps ++ * depends on this, in such a way that it will be very ++ * specific, defined, fixed and correct caps for encoders, ++ * yet very wide, "forgiving" caps for decoders. Example ++ * for mp3: decode: audio/mpeg,mpegversion=1,layer=[1-3] ++ * but encode: audio/mpeg,mpegversion=1,layer=3,bitrate=x, ++ * rate=x,channels=x. ++ */ ++ ++GstCaps * ++gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, ++ AVCodecContext * context, gboolean encode) ++{ ++ GstCaps *caps = NULL; ++ gboolean buildcaps = FALSE; ++ ++ GST_LOG ("codec_id:%d, context:%p, encode:%d", codec_id, context, encode); ++ ++ switch (codec_id) { ++ case CODEC_ID_MPEG1VIDEO: ++ /* FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 1, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ break; ++ ++ case CODEC_ID_MPEG2VIDEO: ++ if (encode) { ++ /* FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 2, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } else { ++ /* decode both MPEG-1 and MPEG-2; width/height/fps are all in ++ * the MPEG video stream headers, so may be omitted from caps. */ ++ caps = gst_caps_new_simple ("video/mpeg", ++ "mpegversion", GST_TYPE_INT_RANGE, 1, 2, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MPEG2VIDEO_XVMC: ++ /* this is a special ID - don't need it in GStreamer, I think */ ++ break; ++ ++ case CODEC_ID_H263: ++ if (encode) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", ++ "h263version", G_TYPE_STRING, "h263", NULL); ++ } else { ++ /* don't pass codec_id, we can decode other variants with the H263 ++ * decoder that don't have specific size requirements ++ */ ++ caps = gst_ff_vid_caps_new (context, CODEC_ID_NONE, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", NULL); ++ } ++ break; ++ ++ case CODEC_ID_H263P: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", ++ "h263version", G_TYPE_STRING, "h263p", NULL); ++ if (encode && context) { ++ ++ gst_caps_set_simple (caps, ++ "annex-f", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_4MV, ++ "annex-j", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_LOOP_FILTER, ++ "annex-i", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED, ++ "annex-t", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED, ++ NULL); ++ } ++ break; ++ ++ case CODEC_ID_H263I: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-intel-h263", ++ "variant", G_TYPE_STRING, "intel", NULL); ++ break; ++ ++ case CODEC_ID_H261: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h261", NULL); ++ break; ++ ++ case CODEC_ID_RV10: ++ case CODEC_ID_RV20: ++ case CODEC_ID_RV30: ++ case CODEC_ID_RV40: ++ { ++ gint version; ++ ++ switch (codec_id) { ++ case CODEC_ID_RV40: ++ version = 4; ++ break; ++ case CODEC_ID_RV30: ++ version = 3; ++ break; ++ case CODEC_ID_RV20: ++ version = 2; ++ break; ++ default: ++ version = 1; ++ break; ++ } ++ ++ /* FIXME: context->sub_id must be filled in during decoding */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-pn-realvideo", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, ++ "rmversion", G_TYPE_INT, version, NULL); ++ if (context) { ++ gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL); ++ if (context->extradata_size >= 8) { ++ gst_caps_set_simple (caps, ++ "subformat", G_TYPE_INT, GST_READ_UINT32_BE (context->extradata), ++ NULL); ++ } ++ } ++ } ++ break; ++ ++ case CODEC_ID_MP1: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_MP2: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_MP3: ++ if (encode) { ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); ++ } else { ++ /* Decodes MPEG-1 layer 1/2/3. Samplerate, channels et al are ++ * in the MPEG audio header, so may be omitted from caps. */ ++ caps = gst_caps_new_simple ("audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, ++ "layer", GST_TYPE_INT_RANGE, 1, 3, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MUSEPACK7: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, ++ "audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 7, ++ NULL); ++ break; ++ ++ case CODEC_ID_MUSEPACK8: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, ++ "audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 8, ++ NULL); ++ break; ++ ++ case CODEC_ID_AC3: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-ac3", NULL); ++ break; ++ ++ case CODEC_ID_EAC3: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-eac3", NULL); ++ break; ++ ++ case CODEC_ID_TRUEHD: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-true-hd", NULL); ++ break; ++ ++ case CODEC_ID_ATRAC1: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-vnd.sony.atrac1", ++ NULL); ++ break; ++ ++ case CODEC_ID_ATRAC3: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-vnd.sony.atrac3", ++ NULL); ++ break; ++ ++ case CODEC_ID_DTS: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dts", NULL); ++ break; ++ ++ case CODEC_ID_APE: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-ffmpeg-parsed-ape", ++ NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MLP: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mlp", NULL); ++ break; ++ ++ case CODEC_ID_IMC: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-imc", NULL); ++ break; ++ ++ /* MJPEG is normal JPEG, Motion-JPEG and Quicktime MJPEG-A. MJPEGB ++ * is Quicktime's MJPEG-B. LJPEG is lossless JPEG. I don't know what ++ * sp5x is, but it's apparently something JPEG... We don't separate ++ * between those in GStreamer. Should we (at least between MJPEG, ++ * MJPEG-B and sp5x decoding...)? */ ++ case CODEC_ID_MJPEG: ++ case CODEC_ID_LJPEG: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/jpeg", NULL); ++ break; ++ ++ case CODEC_ID_SP5X: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/sp5x", NULL); ++ break; ++ ++ case CODEC_ID_MJPEGB: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mjpeg-b", NULL); ++ break; ++ ++ case CODEC_ID_MPEG4: ++ if (encode && context != NULL) { ++ /* I'm not exactly sure what ffmpeg outputs... ffmpeg itself uses ++ * the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */ ++ switch (context->codec_tag) { ++ case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): ++ caps = gst_ff_vid_caps_new (context, codec_id, "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 (context, codec_id, "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 (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 4, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ if (encode) { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL)); ++ } else { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, 4, 5, ++ NULL)); ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-xvid", NULL)); ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-3ivx", NULL)); ++ } ++ } ++ break; ++ ++ case CODEC_ID_RAWVIDEO: ++ caps = ++ gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id, ++ encode); ++ break; ++ ++ case CODEC_ID_MSMPEG4V1: ++ case CODEC_ID_MSMPEG4V2: ++ case CODEC_ID_MSMPEG4V3: ++ { ++ gint version = 41 + codec_id - CODEC_ID_MSMPEG4V1; ++ ++ /* encode-FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msmpeg", ++ "msmpegversion", G_TYPE_INT, version, NULL); ++ if (!encode && codec_id == CODEC_ID_MSMPEG4V3) { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL)); ++ } ++ } ++ break; ++ ++ case CODEC_ID_WMV1: ++ case CODEC_ID_WMV2: ++ { ++ gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2; ++ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, version, NULL); ++ } ++ break; ++ ++ case CODEC_ID_FLV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-flash-video", ++ "flvversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_SVQ1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", ++ "svqversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_SVQ3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", ++ "svqversion", G_TYPE_INT, 3, NULL); ++ break; ++ ++ case CODEC_ID_DVAUDIO: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dv", NULL); ++ break; ++ ++ case CODEC_ID_DVVIDEO: ++ { ++ if (encode && context) { ++ guint32 fourcc; ++ ++ switch (context->pix_fmt) { ++ case PIX_FMT_YUYV422: ++ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); ++ break; ++ case PIX_FMT_YUV420P: ++ fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUVA420P: ++ fourcc = GST_MAKE_FOURCC ('A', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUV411P: ++ fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); ++ break; ++ case PIX_FMT_YUV422P: ++ fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B'); ++ break; ++ case PIX_FMT_YUV410P: ++ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); ++ break; ++ default: ++ GST_WARNING ++ ("Couldnt' find fourcc for pixfmt %d, defaulting to I420", ++ context->pix_fmt); ++ fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ } ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, ++ "format", GST_TYPE_FOURCC, fourcc, NULL); ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_WMAV1: ++ case CODEC_ID_WMAV2: ++ { ++ gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2; ++ ++ if (context) { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, version, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } else { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, version, ++ "block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT, ++ "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL); ++ } ++ } ++ break; ++ case CODEC_ID_WMAPRO: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, 3, NULL); ++ break; ++ } ++ ++ case CODEC_ID_WMAVOICE: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wms", NULL); ++ break; ++ } ++ ++ case CODEC_ID_MACE3: ++ case CODEC_ID_MACE6: ++ { ++ gint version = (codec_id == CODEC_ID_MACE3) ? 3 : 6; ++ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mace", ++ "maceversion", G_TYPE_INT, version, NULL); ++ } ++ break; ++ ++ case CODEC_ID_HUFFYUV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-huffyuv", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "bpp", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_CYUV: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-compressed-yuv", ++ NULL); ++ break; ++ ++ case CODEC_ID_H264: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h264", NULL); ++ break; ++ ++ case CODEC_ID_INDEO5: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 5, NULL); ++ break; ++ ++ case CODEC_ID_INDEO3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 3, NULL); ++ break; ++ ++ case CODEC_ID_INDEO2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_FLASHSV: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-flash-screen", NULL); ++ break; ++ ++ case CODEC_ID_VP3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp3", NULL); ++ break; ++ ++ case CODEC_ID_VP5: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp5", NULL); ++ break; ++ ++ case CODEC_ID_VP6: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6", NULL); ++ break; ++ ++ case CODEC_ID_VP6F: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-flash", NULL); ++ break; ++ ++ case CODEC_ID_VP6A: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-alpha", NULL); ++ break; ++ ++ case CODEC_ID_VP8: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp8", NULL); ++ break; ++ ++ case CODEC_ID_THEORA: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-theora", NULL); ++ break; ++ ++ case CODEC_ID_AAC: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", NULL); ++ ++ if (!encode) { ++ GValue arr = { 0, }; ++ GValue item = { 0, }; ++ ++ g_value_init (&arr, GST_TYPE_LIST); ++ g_value_init (&item, G_TYPE_INT); ++ g_value_set_int (&item, 2); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_int (&item, 4); ++ gst_value_list_append_value (&arr, &item); ++ g_value_unset (&item); ++ ++ gst_caps_set_value (caps, "mpegversion", &arr); ++ g_value_unset (&arr); ++ ++ g_value_init (&arr, GST_TYPE_LIST); ++ g_value_init (&item, G_TYPE_STRING); ++ g_value_set_string (&item, "raw"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_string (&item, "adts"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_string (&item, "adif"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_unset (&item); ++ ++ gst_caps_set_value (caps, "stream-format", &arr); ++ g_value_unset (&arr); ++ } else { ++ gst_caps_set_simple (caps, "mpegversion", G_TYPE_INT, 4, ++ "stream-format", G_TYPE_STRING, "raw", ++ "base-profile", G_TYPE_STRING, "lc", NULL); ++ ++ if (context && context->extradata_size > 0) ++ gst_codec_utils_aac_caps_set_level_and_profile (caps, ++ context->extradata, context->extradata_size); ++ } ++ ++ break; ++ } ++ case CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "loas", ++ NULL); ++ break; ++ ++ case CODEC_ID_ASV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", ++ "asusversion", G_TYPE_INT, 1, NULL); ++ break; ++ case CODEC_ID_ASV2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", ++ "asusversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_FFV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ffv", ++ "ffvversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_4XM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-4xm", NULL); ++ break; ++ ++ case CODEC_ID_XAN_WC3: ++ case CODEC_ID_XAN_WC4: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-xan", ++ "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL); ++ break; ++ ++ case CODEC_ID_CLJR: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, ++ "video/x-cirrus-logic-accupak", NULL); ++ break; ++ ++ case CODEC_ID_FRAPS: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-fraps", NULL); ++ break; ++ ++ 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 (context, codec_id, "video/x-ati-vcr", ++ "vcrversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_RPZA: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-apple-video", NULL); ++ break; ++ ++ case CODEC_ID_CINEPAK: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-cinepak", NULL); ++ break; ++ ++ /* WS_VQA belogns here (order) */ ++ ++ case CODEC_ID_MSRLE: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", ++ "layout", G_TYPE_STRING, "microsoft", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL); ++ } ++ break; ++ ++ case CODEC_ID_QTRLE: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", ++ "layout", G_TYPE_STRING, "quicktime", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MSVIDEO1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msvideocodec", ++ "msvideoversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_WMV3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, 3, NULL); ++ break; ++ case CODEC_ID_VC1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, ++ GST_MAKE_FOURCC ('W', 'V', 'C', '1'), NULL); ++ break; ++ case CODEC_ID_QDM2: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-qdm2", NULL); ++ break; ++ ++ case CODEC_ID_MSZH: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mszh", NULL); ++ break; ++ ++ case CODEC_ID_ZLIB: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zlib", NULL); ++ break; ++ ++ case CODEC_ID_TRUEMOTION1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", ++ "trueversion", G_TYPE_INT, 1, NULL); ++ break; ++ case CODEC_ID_TRUEMOTION2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", ++ "trueversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_ULTI: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ultimotion", ++ NULL); ++ break; ++ ++ case CODEC_ID_TSCC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camtasia", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 8, 32, NULL); ++ } ++ break; ++ ++ case CODEC_ID_KMVC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-kmvc", NULL); ++ break; ++ ++ case CODEC_ID_NUV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-nuv", NULL); ++ break; ++ ++ case CODEC_ID_GIF: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/gif", NULL); ++ break; ++ ++ case CODEC_ID_PNG: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/png", NULL); ++ break; ++ ++ case CODEC_ID_PPM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/ppm", NULL); ++ break; ++ ++ case CODEC_ID_PBM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/pbm", NULL); ++ break; ++ ++ case CODEC_ID_PAM: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-portable-anymap", ++ NULL); ++ break; ++ ++ case CODEC_ID_PGM: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-portable-graymap", ++ NULL); ++ break; ++ ++ case CODEC_ID_PCX: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-pcx", NULL); ++ break; ++ ++ case CODEC_ID_SGI: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-sgi", NULL); ++ break; ++ ++ case CODEC_ID_TARGA: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-tga", NULL); ++ break; ++ ++ case CODEC_ID_TIFF: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/tiff", NULL); ++ break; ++ ++ case CODEC_ID_SUNRAST: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-sun-raster", NULL); ++ break; ++ ++ case CODEC_ID_SMC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-smc", NULL); ++ break; ++ ++ case CODEC_ID_QDRAW: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-qdrw", NULL); ++ break; ++ ++ case CODEC_ID_DNXHD: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dnxhd", NULL); ++ break; ++ ++ case CODEC_ID_MIMIC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mimic", NULL); ++ break; ++ ++ case CODEC_ID_VMNC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vmnc", NULL); ++ break; ++ ++ case CODEC_ID_TRUESPEECH: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-truespeech", NULL); ++ break; ++ ++ case CODEC_ID_QCELP: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/qcelp", NULL); ++ break; ++ ++ case CODEC_ID_AMV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-amv", NULL); ++ break; ++ ++ case CODEC_ID_AASC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-aasc", NULL); ++ break; ++ ++ case CODEC_ID_LOCO: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-loco", NULL); ++ break; ++ ++ case CODEC_ID_ZMBV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zmbv", NULL); ++ break; ++ ++ case CODEC_ID_LAGARITH: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-lagarith", NULL); ++ break; ++ ++ case CODEC_ID_CSCD: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camstudio", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 8, 32, NULL); ++ } ++ break; ++ ++ case CODEC_ID_WS_VQA: ++ case CODEC_ID_IDCIN: ++ case CODEC_ID_8BPS: ++ case CODEC_ID_FLIC: ++ case CODEC_ID_VMDVIDEO: ++ case CODEC_ID_VMDAUDIO: ++ case CODEC_ID_SNOW: ++ case CODEC_ID_VIXL: ++ case CODEC_ID_QPEG: ++ case CODEC_ID_PGMYUV: ++ case CODEC_ID_FFVHUFF: ++ case CODEC_ID_WNV1: ++ case CODEC_ID_MP3ADU: ++ case CODEC_ID_MP3ON4: ++ case CODEC_ID_WESTWOOD_SND1: ++ case CODEC_ID_MMVIDEO: ++ case CODEC_ID_AVS: ++ case CODEC_ID_CAVS: ++ buildcaps = TRUE; ++ break; ++ ++ /* weird quasi-codecs for the demuxers only */ ++ case CODEC_ID_PCM_S16LE: ++ case CODEC_ID_PCM_S16BE: ++ case CODEC_ID_PCM_U16LE: ++ case CODEC_ID_PCM_U16BE: ++ case CODEC_ID_PCM_S8: ++ case CODEC_ID_PCM_U8: ++ { ++ gint width = 0, depth = 0, endianness = 0; ++ gboolean signedness = FALSE; /* blabla */ ++ ++ switch (codec_id) { ++ case CODEC_ID_PCM_S16LE: ++ width = 16; ++ depth = 16; ++ endianness = G_LITTLE_ENDIAN; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_S16BE: ++ width = 16; ++ depth = 16; ++ endianness = G_BIG_ENDIAN; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_U16LE: ++ width = 16; ++ depth = 16; ++ endianness = G_LITTLE_ENDIAN; ++ signedness = FALSE; ++ break; ++ case CODEC_ID_PCM_U16BE: ++ width = 16; ++ depth = 16; ++ endianness = G_BIG_ENDIAN; ++ signedness = FALSE; ++ break; ++ case CODEC_ID_PCM_S8: ++ width = 8; ++ depth = 8; ++ endianness = G_BYTE_ORDER; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_U8: ++ width = 8; ++ depth = 8; ++ endianness = G_BYTE_ORDER; ++ signedness = FALSE; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-int", ++ "width", G_TYPE_INT, width, ++ "depth", G_TYPE_INT, depth, ++ "endianness", G_TYPE_INT, endianness, ++ "signed", G_TYPE_BOOLEAN, signedness, NULL); ++ } ++ break; ++ ++ case CODEC_ID_PCM_MULAW: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mulaw", NULL); ++ break; ++ ++ case CODEC_ID_PCM_ALAW: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-alaw", NULL); ++ break; ++ ++ case CODEC_ID_ADPCM_G722: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/G722", NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ break; ++ ++ case CODEC_ID_ADPCM_G726: ++ { ++ /* the G726 decoder can also handle G721 */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-adpcm", ++ "layout", G_TYPE_STRING, "g726", NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ ++ if (!encode) { ++ gst_caps_append (caps, gst_caps_new_simple ("audio/x-adpcm", ++ "layout", G_TYPE_STRING, "g721", ++ "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL)); ++ } ++ break; ++ } ++ case CODEC_ID_ADPCM_IMA_QT: ++ case CODEC_ID_ADPCM_IMA_WAV: ++ case CODEC_ID_ADPCM_IMA_DK3: ++ case CODEC_ID_ADPCM_IMA_DK4: ++ case CODEC_ID_ADPCM_IMA_WS: ++ case CODEC_ID_ADPCM_IMA_SMJPEG: ++ case CODEC_ID_ADPCM_IMA_AMV: ++ case CODEC_ID_ADPCM_IMA_ISS: ++ case CODEC_ID_ADPCM_IMA_EA_EACS: ++ case CODEC_ID_ADPCM_IMA_EA_SEAD: ++ case CODEC_ID_ADPCM_MS: ++ case CODEC_ID_ADPCM_4XM: ++ case CODEC_ID_ADPCM_XA: ++ case CODEC_ID_ADPCM_ADX: ++ case CODEC_ID_ADPCM_EA: ++ case CODEC_ID_ADPCM_CT: ++ case CODEC_ID_ADPCM_SWF: ++ case CODEC_ID_ADPCM_YAMAHA: ++ case CODEC_ID_ADPCM_SBPRO_2: ++ case CODEC_ID_ADPCM_SBPRO_3: ++ case CODEC_ID_ADPCM_SBPRO_4: ++ case CODEC_ID_ADPCM_EA_R1: ++ case CODEC_ID_ADPCM_EA_R2: ++ case CODEC_ID_ADPCM_EA_R3: ++ case CODEC_ID_ADPCM_EA_MAXIS_XA: ++ case CODEC_ID_ADPCM_EA_XAS: ++ case CODEC_ID_ADPCM_THP: ++ { ++ const gchar *layout = NULL; ++ ++ switch (codec_id) { ++ case CODEC_ID_ADPCM_IMA_QT: ++ layout = "quicktime"; ++ break; ++ case CODEC_ID_ADPCM_IMA_WAV: ++ layout = "dvi"; ++ break; ++ case CODEC_ID_ADPCM_IMA_DK3: ++ layout = "dk3"; ++ break; ++ case CODEC_ID_ADPCM_IMA_DK4: ++ layout = "dk4"; ++ break; ++ case CODEC_ID_ADPCM_IMA_WS: ++ layout = "westwood"; ++ break; ++ case CODEC_ID_ADPCM_IMA_SMJPEG: ++ layout = "smjpeg"; ++ break; ++ case CODEC_ID_ADPCM_IMA_AMV: ++ layout = "amv"; ++ break; ++ case CODEC_ID_ADPCM_IMA_ISS: ++ layout = "iss"; ++ break; ++ case CODEC_ID_ADPCM_IMA_EA_EACS: ++ layout = "ea-eacs"; ++ break; ++ case CODEC_ID_ADPCM_IMA_EA_SEAD: ++ layout = "ea-sead"; ++ break; ++ case CODEC_ID_ADPCM_MS: ++ layout = "microsoft"; ++ break; ++ case CODEC_ID_ADPCM_4XM: ++ layout = "4xm"; ++ break; ++ case CODEC_ID_ADPCM_XA: ++ layout = "xa"; ++ break; ++ case CODEC_ID_ADPCM_ADX: ++ layout = "adx"; ++ break; ++ case CODEC_ID_ADPCM_EA: ++ layout = "ea"; ++ break; ++ case CODEC_ID_ADPCM_CT: ++ layout = "ct"; ++ break; ++ case CODEC_ID_ADPCM_SWF: ++ layout = "swf"; ++ break; ++ case CODEC_ID_ADPCM_YAMAHA: ++ layout = "yamaha"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_2: ++ layout = "sbpro2"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_3: ++ layout = "sbpro3"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_4: ++ layout = "sbpro4"; ++ break; ++ case CODEC_ID_ADPCM_EA_R1: ++ layout = "ea-r1"; ++ break; ++ case CODEC_ID_ADPCM_EA_R2: ++ layout = "ea-r3"; ++ break; ++ case CODEC_ID_ADPCM_EA_R3: ++ layout = "ea-r3"; ++ break; ++ case CODEC_ID_ADPCM_EA_MAXIS_XA: ++ layout = "ea-maxis-xa"; ++ break; ++ case CODEC_ID_ADPCM_EA_XAS: ++ layout = "ea-xas"; ++ break; ++ case CODEC_ID_ADPCM_THP: ++ layout = "thp"; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ /* FIXME: someone please check whether we need additional properties ++ * in this caps definition. */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-adpcm", ++ "layout", G_TYPE_STRING, layout, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ break; ++ ++ case CODEC_ID_AMR_NB: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/AMR", NULL); ++ break; ++ ++ case CODEC_ID_AMR_WB: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/AMR-WB", NULL); ++ break; ++ ++ case CODEC_ID_GSM: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-gsm", NULL); ++ break; ++ ++ case CODEC_ID_GSM_MS: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/ms-gsm", NULL); ++ break; ++ ++ case CODEC_ID_NELLYMOSER: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-nellymoser", NULL); ++ break; ++ ++ case CODEC_ID_SIPR: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-sipro", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "leaf_size", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_RA_144: ++ case CODEC_ID_RA_288: ++ case CODEC_ID_COOK: ++ { ++ gint version = 0; ++ ++ switch (codec_id) { ++ case CODEC_ID_RA_144: ++ version = 1; ++ break; ++ case CODEC_ID_RA_288: ++ version = 2; ++ break; ++ case CODEC_ID_COOK: ++ version = 8; ++ break; ++ default: ++ break; ++ } ++ ++ /* FIXME: properties? */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-pn-realaudio", ++ "raversion", G_TYPE_INT, version, NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "leaf_size", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_ROQ_DPCM: ++ case CODEC_ID_INTERPLAY_DPCM: ++ case CODEC_ID_XAN_DPCM: ++ case CODEC_ID_SOL_DPCM: ++ { ++ const gchar *layout = NULL; ++ ++ switch (codec_id) { ++ case CODEC_ID_ROQ_DPCM: ++ layout = "roq"; ++ break; ++ case CODEC_ID_INTERPLAY_DPCM: ++ layout = "interplay"; ++ break; ++ case CODEC_ID_XAN_DPCM: ++ layout = "xan"; ++ break; ++ case CODEC_ID_SOL_DPCM: ++ layout = "sol"; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ /* FIXME: someone please check whether we need additional properties ++ * in this caps definition. */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dpcm", ++ "layout", G_TYPE_STRING, layout, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ break; ++ ++ case CODEC_ID_SHORTEN: ++ caps = gst_caps_new_simple ("audio/x-shorten", NULL); ++ break; ++ ++ case CODEC_ID_ALAC: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-alac", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_FLAC: ++ /* Note that ffmpeg has no encoder yet, but just for safety. In the ++ * encoder case, we want to add things like samplerate, channels... */ ++ if (!encode) { ++ caps = gst_caps_new_simple ("audio/x-flac", NULL); ++ } ++ break; ++ ++ case CODEC_ID_DVD_SUBTITLE: ++ case CODEC_ID_DVB_SUBTITLE: ++ caps = NULL; ++ break; ++ case CODEC_ID_BMP: ++ caps = gst_caps_new_simple ("image/bmp", NULL); ++ break; ++ case CODEC_ID_TTA: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-tta", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ case CODEC_ID_TWINVQ: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-twin-vq", NULL); ++ break; ++ default: ++ GST_DEBUG ("Unknown codec ID %d, please add mapping here", codec_id); ++ break; ++ } ++ ++ if (buildcaps) { ++ AVCodec *codec; ++ ++ if ((codec = avcodec_find_decoder (codec_id)) || ++ (codec = avcodec_find_encoder (codec_id))) { ++ gchar *mime = NULL; ++ ++ GST_LOG ("Could not create stream format caps for %s", codec->name); ++ ++ switch (codec->type) { ++ case AVMEDIA_TYPE_VIDEO: ++ mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); ++ caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL); ++ g_free (mime); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name); ++ caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ g_free (mime); ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++ if (caps != NULL) { ++ ++ /* set private data */ ++ if (context && context->extradata_size > 0) { ++ GstBuffer *data = gst_buffer_new_and_alloc (context->extradata_size); ++ ++ memcpy (GST_BUFFER_DATA (data), context->extradata, ++ context->extradata_size); ++ gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, data, NULL); ++ gst_buffer_unref (data); ++ } ++ ++ /* palette */ ++ if (context) { ++ gst_ffmpeg_set_palette (caps, context); ++ } ++ ++ GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps); ++ ++ } else { ++ GST_LOG ("No caps found for codec_id=%d", codec_id); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG Pixel Format and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * See below for usefullness ++ */ ++ ++GstCaps * ++gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, ++ enum CodecID codec_id) ++{ ++ GstCaps *caps = NULL; ++ ++ int bpp = 0, depth = 0, endianness = 0; ++ gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0; ++ guint32 fmt = 0; ++ ++ switch (pix_fmt) { ++ case PIX_FMT_YUVJ420P: ++ case PIX_FMT_YUV420P: ++ fmt = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUVA420P: ++ fmt = GST_MAKE_FOURCC ('A', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUYV422: ++ fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); ++ break; ++ case PIX_FMT_RGB24: ++ bpp = depth = 24; ++ endianness = G_BIG_ENDIAN; ++ r_mask = 0xff0000; ++ g_mask = 0x00ff00; ++ b_mask = 0x0000ff; ++ break; ++ case PIX_FMT_BGR24: ++ bpp = depth = 24; ++ endianness = G_BIG_ENDIAN; ++ r_mask = 0x0000ff; ++ g_mask = 0x00ff00; ++ b_mask = 0xff0000; ++ break; ++ case PIX_FMT_YUVJ422P: ++ case PIX_FMT_YUV422P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B'); ++ break; ++ case PIX_FMT_YUVJ444P: ++ case PIX_FMT_YUV444P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '4', '4'); ++ break; ++ case PIX_FMT_RGB32: ++ bpp = 32; ++ depth = 32; ++ endianness = G_BIG_ENDIAN; ++#if (G_BYTE_ORDER == G_BIG_ENDIAN) ++ r_mask = 0x00ff0000; ++ g_mask = 0x0000ff00; ++ b_mask = 0x000000ff; ++ a_mask = 0xff000000; ++#else ++ r_mask = 0x0000ff00; ++ g_mask = 0x00ff0000; ++ b_mask = 0xff000000; ++ a_mask = 0x000000ff; ++#endif ++ break; ++ case PIX_FMT_YUV410P: ++ fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); ++ break; ++ case PIX_FMT_YUV411P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); ++ break; ++ case PIX_FMT_RGB565: ++ bpp = depth = 16; ++ endianness = G_BYTE_ORDER; ++ r_mask = 0xf800; ++ g_mask = 0x07e0; ++ b_mask = 0x001f; ++ break; ++ case PIX_FMT_RGB555: ++ bpp = 16; ++ depth = 15; ++ endianness = G_BYTE_ORDER; ++ r_mask = 0x7c00; ++ g_mask = 0x03e0; ++ b_mask = 0x001f; ++ break; ++ case PIX_FMT_PAL8: ++ bpp = depth = 8; ++ endianness = G_BYTE_ORDER; ++ break; ++ case PIX_FMT_GRAY8: ++ bpp = depth = 8; ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-gray", ++ "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL); ++ break; ++ default: ++ /* give up ... */ ++ break; ++ } ++ ++ if (caps == NULL) { ++ if (bpp != 0) { ++ if (r_mask != 0) { ++ if (a_mask) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "red_mask", G_TYPE_INT, r_mask, ++ "green_mask", G_TYPE_INT, g_mask, ++ "blue_mask", G_TYPE_INT, b_mask, ++ "alpha_mask", G_TYPE_INT, a_mask, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "red_mask", G_TYPE_INT, r_mask, ++ "green_mask", G_TYPE_INT, g_mask, ++ "blue_mask", G_TYPE_INT, b_mask, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ } ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ if (caps && context) { ++ gst_ffmpeg_set_palette (caps, context); ++ } ++ } ++ } else if (fmt) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-yuv", ++ "format", GST_TYPE_FOURCC, fmt, NULL); ++ } ++ } ++ ++ if (caps != NULL) { ++ GST_DEBUG ("caps for pix_fmt=%d: %" GST_PTR_FORMAT, pix_fmt, caps); ++ } else { ++ GST_LOG ("No caps found for pix_fmt=%d", pix_fmt); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG Sample Format and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * See below for usefullness ++ */ ++ ++static GstCaps * ++gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt, ++ AVCodecContext * context, enum CodecID codec_id) ++{ ++ GstCaps *caps = NULL; ++ ++ int bpp = 0; ++ gboolean integer = TRUE; ++ gboolean signedness = FALSE; ++ ++ switch (sample_fmt) { ++ case AV_SAMPLE_FMT_S16: ++ signedness = TRUE; ++ bpp = 16; ++ break; ++ ++ case AV_SAMPLE_FMT_S32: ++ signedness = TRUE; ++ bpp = 32; ++ break; ++ ++ case AV_SAMPLE_FMT_FLT: ++ integer = FALSE; ++ bpp = 32; ++ break; ++ ++ case AV_SAMPLE_FMT_DBL: ++ integer = FALSE; ++ bpp = 64; ++ break; ++ default: ++ /* .. */ ++ break; ++ } ++ ++ if (bpp) { ++ if (integer) { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-int", ++ "signed", G_TYPE_BOOLEAN, signedness, ++ "endianness", G_TYPE_INT, G_BYTE_ORDER, ++ "width", G_TYPE_INT, bpp, "depth", G_TYPE_INT, bpp, NULL); ++ } else { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-float", ++ "endianness", G_TYPE_INT, G_BYTE_ORDER, ++ "width", G_TYPE_INT, bpp, NULL); ++ } ++ } ++ ++ if (caps != NULL) { ++ GST_LOG ("caps for sample_fmt=%d: %" GST_PTR_FORMAT, sample_fmt, caps); ++ } else { ++ GST_LOG ("No caps found for sample_fmt=%d", sample_fmt); ++ } ++ ++ return caps; ++} ++ ++GstCaps * ++gst_ffmpeg_codectype_to_audio_caps (AVCodecContext * context, ++ enum CodecID codec_id, gboolean encode, AVCodec * codec) ++{ ++ GstCaps *caps = NULL; ++ ++ GST_DEBUG ("context:%p, codec_id:%d, encode:%d, codec:%p", ++ context, codec_id, encode, codec); ++ if (codec) ++ GST_DEBUG ("sample_fmts:%p, samplerates:%p", ++ codec->sample_fmts, codec->supported_samplerates); ++ ++ if (context) { ++ /* Specific codec context */ ++ caps = gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context, codec_id); ++ } else if (codec && codec->sample_fmts) { ++ GstCaps *temp; ++ int i; ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; codec->sample_fmts[i] != -1; i++) { ++ temp = ++ gst_ffmpeg_smpfmt_to_caps (codec->sample_fmts[i], context, codec_id); ++ if (temp != NULL) ++ gst_caps_append (caps, temp); ++ } ++ } else { ++ GstCaps *temp; ++ enum AVSampleFormat i; ++ AVCodecContext ctx = { 0, }; ++ ++ ctx.channels = -1; ++ caps = gst_caps_new_empty (); ++ for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) { ++ temp = gst_ffmpeg_smpfmt_to_caps (i, encode ? &ctx : NULL, codec_id); ++ if (temp != NULL) { ++ gst_caps_append (caps, temp); ++ } ++ } ++ } ++ return caps; ++} ++ ++GstCaps * ++gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, ++ enum CodecID codec_id, gboolean encode, AVCodec * codec) ++{ ++ GstCaps *caps; ++ ++ GST_LOG ("context:%p, codec_id:%d, encode:%d, codec:%p", ++ context, codec_id, encode, codec); ++ ++ if (context) { ++ caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt, context, codec_id); ++ } else { ++ GstCaps *temp; ++ enum PixelFormat i; ++ AVCodecContext ctx = { 0, }; ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < PIX_FMT_NB; i++) { ++ ctx.width = -1; ++ ctx.pix_fmt = i; ++ temp = gst_ffmpeg_pixfmt_to_caps (i, encode ? &ctx : NULL, codec_id); ++ if (temp != NULL) { ++ gst_caps_append (caps, temp); ++ } ++ } ++ } ++ return caps; ++} ++ ++/* Convert a FFMPEG codec Type and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * AVMediaType is primarily meant for uncompressed data GstCaps! ++ */ ++ ++GstCaps * ++gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, ++ AVCodecContext * context, enum CodecID codec_id, gboolean encode) ++{ ++ GstCaps *caps; ++ ++ switch (codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ caps = ++ gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ caps = ++ gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL); ++ break; ++ default: ++ caps = NULL; ++ break; ++ } ++ ++ return caps; ++} ++ ++/* Convert a GstCaps (audio/raw) to a FFMPEG SampleFmt ++ * and other audio properties in a AVCodecContext. ++ * ++ * For usefullness, see below ++ */ ++ ++static void ++gst_ffmpeg_caps_to_smpfmt (const GstCaps * caps, ++ AVCodecContext * context, gboolean raw) ++{ ++ GstStructure *structure; ++ gint depth = 0, width = 0, endianness = 0; ++ gboolean signedness = FALSE; ++ const gchar *name; ++ ++ g_return_if_fail (gst_caps_get_size (caps) == 1); ++ structure = gst_caps_get_structure (caps, 0); ++ ++ gst_structure_get_int (structure, "channels", &context->channels); ++ gst_structure_get_int (structure, "rate", &context->sample_rate); ++ gst_structure_get_int (structure, "block_align", &context->block_align); ++ gst_structure_get_int (structure, "bitrate", &context->bit_rate); ++ ++ if (!raw) ++ return; ++ ++ name = gst_structure_get_name (structure); ++ ++ if (!strcmp (name, "audio/x-raw-float")) { ++ /* FLOAT */ ++ if (gst_structure_get_int (structure, "width", &width) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if (endianness == G_BYTE_ORDER) { ++ if (width == 32) ++ context->sample_fmt = AV_SAMPLE_FMT_FLT; ++ else if (width == 64) ++ context->sample_fmt = AV_SAMPLE_FMT_DBL; ++ } ++ } ++ } else { ++ /* INT */ ++ if (gst_structure_get_int (structure, "width", &width) && ++ gst_structure_get_int (structure, "depth", &depth) && ++ gst_structure_get_boolean (structure, "signed", &signedness) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if ((endianness == G_BYTE_ORDER) && (signedness == TRUE)) { ++ if ((width == 16) && (depth == 16)) ++ context->sample_fmt = AV_SAMPLE_FMT_S16; ++ else if ((width == 32) && (depth == 32)) ++ context->sample_fmt = AV_SAMPLE_FMT_S32; ++ } ++ } ++ } ++} ++ ++ ++/* Convert a GstCaps (video/raw) to a FFMPEG PixFmt ++ * and other video properties in a AVCodecContext. ++ * ++ * For usefullness, see below ++ */ ++ ++static void ++gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, ++ AVCodecContext * context, gboolean raw) ++{ ++ GstStructure *structure; ++ const GValue *fps; ++ const GValue *par = NULL; ++ ++ GST_DEBUG ("converting caps %" GST_PTR_FORMAT, caps); ++ g_return_if_fail (gst_caps_get_size (caps) == 1); ++ structure = gst_caps_get_structure (caps, 0); ++ ++ gst_structure_get_int (structure, "width", &context->width); ++ gst_structure_get_int (structure, "height", &context->height); ++ gst_structure_get_int (structure, "bpp", &context->bits_per_coded_sample); ++ ++ fps = gst_structure_get_value (structure, "framerate"); ++ if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) { ++ ++ /* somehow these seem mixed up.. */ ++ context->time_base.den = gst_value_get_fraction_numerator (fps); ++ context->time_base.num = gst_value_get_fraction_denominator (fps); ++ context->ticks_per_frame = 1; ++ ++ GST_DEBUG ("setting framerate %d/%d = %lf", ++ context->time_base.den, context->time_base.num, ++ 1. * context->time_base.den / context->time_base.num); ++ } ++ ++ par = gst_structure_get_value (structure, "pixel-aspect-ratio"); ++ if (par && GST_VALUE_HOLDS_FRACTION (par)) { ++ ++ context->sample_aspect_ratio.num = gst_value_get_fraction_numerator (par); ++ context->sample_aspect_ratio.den = gst_value_get_fraction_denominator (par); ++ ++ GST_DEBUG ("setting pixel-aspect-ratio %d/%d = %lf", ++ context->sample_aspect_ratio.den, context->sample_aspect_ratio.num, ++ 1. * context->sample_aspect_ratio.den / ++ context->sample_aspect_ratio.num); ++ } ++ ++ if (!raw) ++ return; ++ ++ g_return_if_fail (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)); ++ ++ if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) { ++ guint32 fourcc; ++ ++ if (gst_structure_get_fourcc (structure, "format", &fourcc)) { ++ switch (fourcc) { ++ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): ++ context->pix_fmt = PIX_FMT_YUYV422; ++ break; ++ case GST_MAKE_FOURCC ('I', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUV420P; ++ break; ++ case GST_MAKE_FOURCC ('A', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUVA420P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): ++ context->pix_fmt = PIX_FMT_YUV411P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): ++ context->pix_fmt = PIX_FMT_YUV422P; ++ break; ++ case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): ++ context->pix_fmt = PIX_FMT_YUV410P; ++ break; ++#if 0 ++ case FIXME: ++ context->pix_fmt = PIX_FMT_YUV444P; ++ break; ++#endif ++ } ++ } ++ } else if (strcmp (gst_structure_get_name (structure), ++ "video/x-raw-rgb") == 0) { ++ gint bpp = 0, rmask = 0, endianness = 0; ++ ++ if (gst_structure_get_int (structure, "bpp", &bpp) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if (gst_structure_get_int (structure, "red_mask", &rmask)) { ++ switch (bpp) { ++ case 32: ++#if (G_BYTE_ORDER == G_BIG_ENDIAN) ++ if (rmask == 0x00ff0000) ++#else ++ if (rmask == 0x0000ff00) ++#endif ++ context->pix_fmt = PIX_FMT_RGB32; ++ break; ++ case 24: ++ if (rmask == 0x0000FF) ++ context->pix_fmt = PIX_FMT_BGR24; ++ else ++ context->pix_fmt = PIX_FMT_RGB24; ++ break; ++ case 16: ++ if (endianness == G_BYTE_ORDER) ++ context->pix_fmt = PIX_FMT_RGB565; ++ break; ++ case 15: ++ if (endianness == G_BYTE_ORDER) ++ context->pix_fmt = PIX_FMT_RGB555; ++ break; ++ default: ++ /* nothing */ ++ break; ++ } ++ } else { ++ if (bpp == 8) { ++ context->pix_fmt = PIX_FMT_PAL8; ++ gst_ffmpeg_get_palette (caps, context); ++ } ++ } ++ } ++ } else if (strcmp (gst_structure_get_name (structure), ++ "video/x-raw-gray") == 0) { ++ gint bpp = 0; ++ ++ if (gst_structure_get_int (structure, "bpp", &bpp)) { ++ switch (bpp) { ++ case 8: ++ context->pix_fmt = PIX_FMT_GRAY8; ++ break; ++ } ++ } ++ } ++} ++ ++/* Convert a GstCaps and a FFMPEG codec Type to a ++ * AVCodecContext. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the context ++ * ++ * AVMediaType is primarily meant for uncompressed data GstCaps! ++ */ ++ ++void ++gst_ffmpeg_caps_with_codectype (enum AVMediaType type, ++ const GstCaps * caps, AVCodecContext * context) ++{ ++ if (context == NULL) ++ return; ++ ++ switch (type) { ++ case AVMEDIA_TYPE_VIDEO: ++ gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE); ++ break; ++ ++ case AVMEDIA_TYPE_AUDIO: ++ gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE); ++ break; ++ ++ default: ++ /* unknown */ ++ break; ++ } ++} ++ ++#if 0 ++static void ++nal_escape (guint8 * dst, guint8 * src, guint size, guint * destsize) ++{ ++ guint8 *dstp = dst; ++ guint8 *srcp = src; ++ guint8 *end = src + size; ++ gint count = 0; ++ ++ while (srcp < end) { ++ if (count == 2 && *srcp <= 0x03) { ++ GST_DEBUG ("added escape code"); ++ *dstp++ = 0x03; ++ count = 0; ++ } ++ if (*srcp == 0) ++ count++; ++ else ++ count = 0; ++ ++ GST_DEBUG ("copy %02x, count %d", *srcp, count); ++ *dstp++ = *srcp++; ++ } ++ *destsize = dstp - dst; ++} ++ ++/* copy the config, escaping NAL units as we iterate them, if something fails we ++ * copy everything and hope for the best. */ ++static void ++copy_config (guint8 * dst, guint8 * src, guint size, guint * destsize) ++{ ++ guint8 *dstp = dst; ++ guint8 *srcp = src; ++ gint cnt, i; ++ guint nalsize, esize; ++ ++ /* check size */ ++ if (size < 7) ++ goto full_copy; ++ ++ /* check version */ ++ if (*srcp != 1) ++ goto full_copy; ++ ++ cnt = *(srcp + 5) & 0x1f; /* Number of sps */ ++ ++ GST_DEBUG ("num SPS %d", cnt); ++ ++ memcpy (dstp, srcp, 6); ++ srcp += 6; ++ dstp += 6; ++ ++ for (i = 0; i < cnt; i++) { ++ GST_DEBUG ("copy SPS %d", i); ++ nalsize = (srcp[0] << 8) | srcp[1]; ++ nal_escape (dstp + 2, srcp + 2, nalsize, &esize); ++ dstp[0] = esize >> 8; ++ dstp[1] = esize & 0xff; ++ dstp += esize + 2; ++ srcp += nalsize + 2; ++ } ++ ++ cnt = *(dstp++) = *(srcp++); /* Number of pps */ ++ ++ GST_DEBUG ("num PPS %d", cnt); ++ ++ for (i = 0; i < cnt; i++) { ++ GST_DEBUG ("copy PPS %d", i); ++ nalsize = (srcp[0] << 8) | srcp[1]; ++ nal_escape (dstp + 2, srcp + 2, nalsize, &esize); ++ dstp[0] = esize >> 8; ++ dstp[1] = esize & 0xff; ++ dstp += esize + 2; ++ srcp += nalsize + 2; ++ } ++ *destsize = dstp - dst; ++ ++ return; ++ ++full_copy: ++ { ++ GST_DEBUG ("something unexpected, doing full copy"); ++ memcpy (dst, src, size); ++ *destsize = size; ++ return; ++ } ++} ++#endif ++ ++/* ++ * caps_with_codecid () transforms a GstCaps for a known codec ++ * ID into a filled-in context. ++ * codec_data from caps will override possible extradata already in the context ++ */ ++ ++void ++gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, ++ enum AVMediaType codec_type, const GstCaps * caps, AVCodecContext * context) ++{ ++ GstStructure *str; ++ const GValue *value; ++ const GstBuffer *buf; ++ ++ GST_LOG ("codec_id:%d, codec_type:%d, caps:%" GST_PTR_FORMAT " context:%p", ++ codec_id, codec_type, caps, context); ++ ++ if (!context || !gst_caps_get_size (caps)) ++ return; ++ ++ str = gst_caps_get_structure (caps, 0); ++ ++ /* extradata parsing (esds [mpeg4], wma/wmv, msmpeg4v1/2/3, etc.) */ ++ if ((value = gst_structure_get_value (str, "codec_data"))) { ++ guint size; ++ guint8 *data; ++ ++ buf = GST_BUFFER_CAST (gst_value_get_mini_object (value)); ++ size = GST_BUFFER_SIZE (buf); ++ data = GST_BUFFER_DATA (buf); ++ ++ /* free the old one if it is there */ ++ if (context->extradata) ++ av_free (context->extradata); ++ ++#if 0 ++ if (codec_id == CODEC_ID_H264) { ++ guint extrasize; ++ ++ GST_DEBUG ("copy, escaping codec_data %d", size); ++ /* ffmpeg h264 expects the codec_data to be escaped, there is no real ++ * reason for this but let's just escape it for now. Start by allocating ++ * enough space, x2 is more than enough. ++ * ++ * FIXME, we disabled escaping because some file already contain escaped ++ * codec_data and then we escape twice and fail. It's better to leave it ++ * as is, as that is what most players do. */ ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (size * 2 + ++ FF_INPUT_BUFFER_PADDING_SIZE)); ++ copy_config (context->extradata, data, size, &extrasize); ++ GST_DEBUG ("escaped size: %d", extrasize); ++ context->extradata_size = extrasize; ++ } else ++#endif ++ { ++ /* allocate with enough padding */ ++ GST_DEBUG ("copy codec_data"); ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (size + FF_INPUT_BUFFER_PADDING_SIZE)); ++ memcpy (context->extradata, data, size); ++ context->extradata_size = size; ++ } ++ ++ /* Hack for VC1. Sometimes the first (length) byte is 0 for some files */ ++ if (codec_id == CODEC_ID_VC1 && size > 0 && data[0] == 0) { ++ context->extradata[0] = (guint8) size; ++ } ++ ++ GST_DEBUG ("have codec data of size %d", size); ++ } else if (context->extradata == NULL && codec_id != CODEC_ID_AAC_LATM && ++ codec_id != CODEC_ID_FLAC) { ++ /* no extradata, alloc dummy with 0 sized, some codecs insist on reading ++ * extradata anyway which makes then segfault. */ ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (FF_INPUT_BUFFER_PADDING_SIZE)); ++ context->extradata_size = 0; ++ GST_DEBUG ("no codec data"); ++ } ++ ++ switch (codec_id) { ++ case CODEC_ID_MPEG4: ++ { ++ const gchar *mime = gst_structure_get_name (str); ++ ++ if (!strcmp (mime, "video/x-divx")) ++ context->codec_tag = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); ++ else if (!strcmp (mime, "video/x-xvid")) ++ context->codec_tag = GST_MAKE_FOURCC ('X', 'V', 'I', 'D'); ++ else if (!strcmp (mime, "video/x-3ivx")) ++ context->codec_tag = GST_MAKE_FOURCC ('3', 'I', 'V', '1'); ++ else if (!strcmp (mime, "video/mpeg")) ++ context->codec_tag = GST_MAKE_FOURCC ('m', 'p', '4', 'v'); ++ } ++ break; ++ ++ case CODEC_ID_SVQ3: ++ /* FIXME: this is a workaround for older gst-plugins releases ++ * (<= 0.8.9). This should be removed at some point, because ++ * it causes wrong decoded frame order. */ ++ if (!context->extradata) { ++ gint halfpel_flag, thirdpel_flag, low_delay, unknown_svq3_flag; ++ guint16 flags; ++ ++ if (gst_structure_get_int (str, "halfpel_flag", &halfpel_flag) || ++ gst_structure_get_int (str, "thirdpel_flag", &thirdpel_flag) || ++ gst_structure_get_int (str, "low_delay", &low_delay) || ++ gst_structure_get_int (str, "unknown_svq3_flag", ++ &unknown_svq3_flag)) { ++ context->extradata = (guint8 *) av_mallocz (0x64); ++ g_stpcpy ((gchar *) context->extradata, "SVQ3"); ++ flags = 1 << 3; ++ flags |= low_delay; ++ flags = flags << 2; ++ flags |= unknown_svq3_flag; ++ flags = flags << 6; ++ flags |= halfpel_flag; ++ flags = flags << 1; ++ flags |= thirdpel_flag; ++ flags = flags << 3; ++ ++ flags = GUINT16_FROM_LE (flags); ++ ++ memcpy ((gchar *) context->extradata + 0x62, &flags, 2); ++ context->extradata_size = 0x64; ++ } ++ } ++ break; ++ ++ case CODEC_ID_MSRLE: ++ case CODEC_ID_QTRLE: ++ case CODEC_ID_TSCC: ++ case CODEC_ID_CSCD: ++ case CODEC_ID_APE: ++ { ++ gint depth; ++ ++ if (gst_structure_get_int (str, "depth", &depth)) { ++ context->bits_per_coded_sample = depth; ++ } else { ++ GST_WARNING ("No depth field in caps %" GST_PTR_FORMAT, caps); ++ } ++ ++ } ++ break; ++ ++ case CODEC_ID_RV10: ++ case CODEC_ID_RV20: ++ case CODEC_ID_RV30: ++ case CODEC_ID_RV40: ++ { ++ gint format; ++ ++ if (gst_structure_get_int (str, "format", &format)) ++ context->sub_id = format; ++ ++ break; ++ } ++ case CODEC_ID_COOK: ++ case CODEC_ID_RA_288: ++ case CODEC_ID_RA_144: ++ case CODEC_ID_SIPR: ++ { ++ gint leaf_size; ++ gint bitrate; ++ ++ if (gst_structure_get_int (str, "leaf_size", &leaf_size)) ++ context->block_align = leaf_size; ++ if (gst_structure_get_int (str, "bitrate", &bitrate)) ++ context->bit_rate = bitrate; ++ } ++ case CODEC_ID_ALAC: ++ gst_structure_get_int (str, "samplesize", ++ &context->bits_per_coded_sample); ++ break; ++ ++ case CODEC_ID_DVVIDEO: ++ { ++ guint32 fourcc; ++ ++ if (gst_structure_get_fourcc (str, "format", &fourcc)) ++ switch (fourcc) { ++ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): ++ context->pix_fmt = PIX_FMT_YUYV422; ++ break; ++ case GST_MAKE_FOURCC ('I', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUV420P; ++ break; ++ case GST_MAKE_FOURCC ('A', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUVA420P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): ++ context->pix_fmt = PIX_FMT_YUV411P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): ++ context->pix_fmt = PIX_FMT_YUV422P; ++ break; ++ case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): ++ context->pix_fmt = PIX_FMT_YUV410P; ++ break; ++ default: ++ GST_WARNING ("couldn't convert fourcc %" GST_FOURCC_FORMAT ++ " to a pixel format", GST_FOURCC_ARGS (fourcc)); ++ break; ++ } ++ break; ++ } ++ case CODEC_ID_H263P: ++ { ++ gboolean val; ++ ++ if (!gst_structure_get_boolean (str, "annex-f", &val) || val) ++ context->flags |= CODEC_FLAG_4MV; ++ else ++ context->flags &= ~CODEC_FLAG_4MV; ++ if ((!gst_structure_get_boolean (str, "annex-i", &val) || val) && ++ (!gst_structure_get_boolean (str, "annex-t", &val) || val)) ++ context->flags |= CODEC_FLAG_AC_PRED; ++ else ++ context->flags &= ~CODEC_FLAG_AC_PRED; ++ if (!gst_structure_get_boolean (str, "annex-j", &val) || val) ++ context->flags |= CODEC_FLAG_LOOP_FILTER; ++ else ++ context->flags &= ~CODEC_FLAG_LOOP_FILTER; ++ break; ++ } ++ case CODEC_ID_ADPCM_G726: ++ { ++ const gchar *layout; ++ ++ if ((layout = gst_structure_get_string (str, "layout"))) { ++ if (!strcmp (layout, "g721")) { ++ context->sample_rate = 8000; ++ context->channels = 1; ++ context->bit_rate = 32000; ++ } ++ } ++ break; ++ } ++ default: ++ break; ++ } ++ ++ if (!gst_caps_is_fixed (caps)) ++ return; ++ ++ /* common properties (width, height, fps) */ ++ switch (codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); ++ gst_ffmpeg_get_palette (caps, context); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); ++ break; ++ default: ++ break; ++ } ++ ++ /* fixup of default settings */ ++ switch (codec_id) { ++ case CODEC_ID_QCELP: ++ /* QCELP is always mono, no matter what the caps say */ ++ context->channels = 1; ++ break; ++ default: ++ break; ++ } ++} ++ ++/* _formatid_to_caps () is meant for muxers/demuxers, it ++ * transforms a name (ffmpeg way of ID'ing these, why don't ++ * they have unique numerical IDs?) to the corresponding ++ * caps belonging to that mux-format ++ * ++ * Note: we don't need any additional info because the caps ++ * isn't supposed to contain any useful info besides the ++ * media type anyway ++ */ ++ ++GstCaps * ++gst_ffmpeg_formatid_to_caps (const gchar * format_name) ++{ ++ GstCaps *caps = NULL; ++ ++ if (!strcmp (format_name, "mpeg")) { ++ caps = gst_caps_new_simple ("video/mpeg", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "mpegts")) { ++ caps = gst_caps_new_simple ("video/mpegts", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "rm")) { ++ caps = gst_caps_new_simple ("application/x-pn-realmedia", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "asf")) { ++ caps = gst_caps_new_simple ("video/x-ms-asf", NULL); ++ } else if (!strcmp (format_name, "avi")) { ++ caps = gst_caps_new_simple ("video/x-msvideo", NULL); ++ } else if (!strcmp (format_name, "wav")) { ++ caps = gst_caps_new_simple ("audio/x-wav", NULL); ++ } else if (!strcmp (format_name, "ape")) { ++ caps = gst_caps_new_simple ("application/x-ape", NULL); ++ } else if (!strcmp (format_name, "swf")) { ++ caps = gst_caps_new_simple ("application/x-shockwave-flash", NULL); ++ } else if (!strcmp (format_name, "au")) { ++ caps = gst_caps_new_simple ("audio/x-au", NULL); ++ } else if (!strcmp (format_name, "dv")) { ++ caps = gst_caps_new_simple ("video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "4xm")) { ++ caps = gst_caps_new_simple ("video/x-4xm", NULL); ++ } else if (!strcmp (format_name, "matroska")) { ++ caps = gst_caps_new_simple ("video/x-matroska", NULL); ++ } else if (!strcmp (format_name, "mp3")) { ++ caps = gst_caps_new_simple ("application/x-id3", NULL); ++ } else if (!strcmp (format_name, "flic")) { ++ caps = gst_caps_new_simple ("video/x-fli", NULL); ++ } else if (!strcmp (format_name, "flv")) { ++ caps = gst_caps_new_simple ("video/x-flv", NULL); ++ } else if (!strcmp (format_name, "tta")) { ++ caps = gst_caps_new_simple ("audio/x-ttafile", NULL); ++ } else if (!strcmp (format_name, "aiff")) { ++ caps = gst_caps_new_simple ("audio/x-aiff", NULL); ++ } else if (!strcmp (format_name, "mov_mp4_m4a_3gp_3g2")) {
Lines of this file are not shown. View the raw message.
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +2 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.0.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH] gst-ffmpeg: add PACKAGECONFIG for libav9 and patch from Gentoo
Quoted 2 lines · Martin Jansa
* apply the patch only when PACKAGECONFIG is selected, because the changes aren't backwards compatible
ping
Quoted 9,340 lines
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg-0.10.13/libav-9.patch | 9304 ++++++++++++++++++++ .../gstreamer/gst-ffmpeg_0.10.13.bb | 2 + 2 files changed, 9306 insertions(+) create mode 100644 meta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/libav-9.patchmeta/recipes-multimedia/gstreamer/gst-ffmpeg-0.10.13/libav-9.patch new file +9304
-0@@ -0,0 +1,9304 @@ +Taken from gentoo patchset: +http://dev.gentoo.org/~tetromino/distfiles/gst-plugins-ffmpeg/gst-ffmpeg-0.10.13_p2012.11-libav-9-patches.tar.xz + +Upstream-Status: Pending + +Contains following changes, rebased to apply on top of our changes +0002-Fix-includes-for-systemwide-build.patch +0003-libav-Switch-to-non-deprecated-symbols.patch +0005-av-Update-for-some-constant-changes.patch +0006-av-Remove-palette-support-for-now.patch +0007-av-Port-remaining-simple-bits.patch +0008-av-Use-av_codec_is_-en-de-coder-API-instead-of-priva.patch +0009-avprotocol-Port-from-the-URL-protocol-handler-to-san.patch +0010-avdec-don-t-wait-for-keyframe.patch + +Following changes were skipped: +0001-Partially-revert-commit-0300801b.patch +0004-av-update-to-use-AVOption-variants.patch +0011-av_get_bits_per_sample_format-was-removed-in-libav-9.patch + +Signed-off-by: Martin Jansa <[email protected]> + +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.c 2011-10-31 11:14:03.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.c 2014-08-08 15:26:07.872857555 +0200 +@@ -151,9 +151,6 @@ + #endif + gst_ffmpegaudioresample_register (plugin); + +- av_register_protocol2 (&gstreamer_protocol, sizeof (URLProtocol)); +- av_register_protocol2 (&gstpipe_protocol, sizeof (URLProtocol)); +- + /* Now we can return the pointer to the newly created Plugin object. */ + return TRUE; + } +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.h gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.h +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpeg.h 2011-05-17 10:53:16.000000000 +0200 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpeg.h 2014-08-08 15:26:07.872857555 +0200 +@@ -58,10 +58,13 @@ + int gst_ffmpeg_avcodec_close (AVCodecContext *avctx); + int gst_ffmpeg_av_find_stream_info(AVFormatContext *ic); + +-G_END_DECLS ++int gst_ffmpegdata_open (GstPad * pad, int flags, AVIOContext ** context); ++int gst_ffmpegdata_close (AVIOContext * h); ++typedef struct _GstFFMpegPipe GstFFMpegPipe; ++int gst_ffmpeg_pipe_open (GstFFMpegPipe *ffpipe, int flags, AVIOContext ** context); ++int gst_ffmpeg_pipe_close (AVIOContext * h); + +-extern URLProtocol gstreamer_protocol; +-extern URLProtocol gstpipe_protocol; ++G_END_DECLS + + /* use GST_FFMPEG URL_STREAMHEADER with URL_WRONLY if the first + * buffer should be used as streamheader property on the pad's caps. */ +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcfg.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcfg.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcfg.c 2011-07-12 16:35:27.000000000 +0200 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcfg.c 2014-08-08 15:24:17.899853612 +0200 +@@ -147,7 +147,6 @@ + {FF_DCT_FASTINT, "Fast Integer", "fastint"}, + {FF_DCT_INT, "Accurate Integer", "int"}, + {FF_DCT_MMX, "MMX", "mmx"}, +- {FF_DCT_MLIB, "MLIB", "mlib"}, + {FF_DCT_ALTIVEC, "ALTIVEC", "altivec"}, + {FF_DCT_FAAN, "FAAN", "faan"}, + {0, NULL, NULL}, +@@ -173,8 +172,6 @@ + {FF_IDCT_SIMPLE, "Simple", "simple"}, + {FF_IDCT_SIMPLEMMX, "Simple MMX", "simplemmx"}, + {FF_IDCT_LIBMPEG2MMX, "LIBMPEG2MMX", "libmpeg2mmx"}, +- {FF_IDCT_PS2, "PS2", "ps2"}, +- {FF_IDCT_MLIB, "MLIB", "mlib"}, + {FF_IDCT_ARM, "ARM", "arm"}, + {FF_IDCT_ALTIVEC, "ALTIVEC", "altivec"}, + {FF_IDCT_SH4, "SH4", "sh4"}, +@@ -263,16 +260,11 @@ + + if (!ffmpeg_flags_type) { + static const GFlagsValue ffmpeg_flags[] = { +- {CODEC_FLAG_OBMC, "Use overlapped block motion compensation (h263+)", +- "obmc"}, + {CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"}, + {CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"}, +- {CODEC_FLAG_H263P_AIV, "H.263 alternative inter VLC", "aiv"}, + {CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"}, + {CODEC_FLAG_GMC, "GMC", "gmc"}, + {CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"}, +- {CODEC_FLAG_PART, +- "Store MV, DC and AC coefficients in seperate partitions", "part"}, + {CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"}, + {CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"}, + {CODEC_FLAG_NORMALIZE_AQP, +@@ -282,13 +274,9 @@ + "global-headers"}, + {CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction", + "aic"}, +- {CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"}, + {CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"}, + {CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection", + "qp-rd"}, +- {CODEC_FLAG_H263P_SLICE_STRUCT, "H263 slice struct", "ss"}, +- {CODEC_FLAG_SVCD_SCAN_OFFSET, +- "Reserve space for SVCD scan offset user data", "scanoffset"}, + {CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"}, + {0, NULL, NULL}, + }; +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c 2011-10-31 11:14:03.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c 2014-08-08 15:31:30.968869139 +0200 +@@ -25,8 +25,10 @@ + #include <gst/gst.h> + #ifdef HAVE_FFMPEG_UNINSTALLED + #include <avcodec.h> ++#include <channel_layout.h>> + #else + #include <libavcodec/avcodec.h> ++#include <libavutil/channel_layout.h> + #endif + #include <string.h> + +@@ -35,43 +37,6 @@ + + #include <gst/pbutils/codec-utils.h> + +-/* +- * Read a palette from a caps. +- */ +- +-static void +-gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context) +-{ +- GstStructure *str = gst_caps_get_structure (caps, 0); +- const GValue *palette_v; +- const GstBuffer *palette; +- +- /* do we have a palette? */ +- if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) { +- palette = gst_value_get_buffer (palette_v); +- if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) { +- if (context->palctrl) +- av_free (context->palctrl); +- context->palctrl = av_malloc (sizeof (AVPaletteControl)); +- context->palctrl->palette_changed = 1; +- memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette), +- AVPALETTE_SIZE); +- } +- } +-} +- +-static void +-gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context) +-{ +- if (context->palctrl) { +- GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE); +- +- memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette, +- AVPALETTE_SIZE); +- gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL); +- } +-} +- + /* IMPORTANT: Keep this sorted by the ffmpeg channel masks */ + static const struct + { +@@ -79,26 +44,26 @@ + GstAudioChannelPosition gst; + } _ff_to_gst_layout[] = { + { +- CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { +- CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { +- CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { +- CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { +- CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { +- CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { +- CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { +- CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { +- CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { +- CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { +- CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { +- CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { +- CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { +- CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} ++ AV_CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { ++ AV_CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { ++ AV_CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { ++ AV_CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { ++ AV_CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { ++ AV_CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { ++ AV_CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { ++ AV_CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { ++ AV_CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { ++ AV_CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { ++ AV_CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} + }; + + static GstAudioChannelPosition * +@@ -342,8 +307,8 @@ + + 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 ++ 0, 0, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_5POINT0, ++ AV_CH_LAYOUT_5POINT1, 0, AV_CH_LAYOUT_7POINT1 + }; + + switch (codec_id) { +@@ -1267,8 +1232,6 @@ + case CODEC_ID_FLIC: + case CODEC_ID_VMDVIDEO: + case CODEC_ID_VMDAUDIO: +- case CODEC_ID_SONIC: +- case CODEC_ID_SONIC_LS: + case CODEC_ID_SNOW: + case CODEC_ID_VIXL: + case CODEC_ID_QPEG: +@@ -1689,11 +1652,6 @@ + gst_buffer_unref (data); + } + +- /* palette */ +- if (context) { +- gst_ffmpeg_set_palette (caps, context); +- } +- + GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps); + + } else { +@@ -1830,9 +1788,6 @@ + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "endianness", G_TYPE_INT, endianness, NULL); +- if (caps && context) { +- gst_ffmpeg_set_palette (caps, context); +- } + } + } else if (fmt) { + caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-yuv", +@@ -1857,7 +1812,7 @@ + */ + + static GstCaps * +-gst_ffmpeg_smpfmt_to_caps (enum SampleFormat sample_fmt, ++gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt, + AVCodecContext * context, enum CodecID codec_id) + { + GstCaps *caps = NULL; +@@ -1867,22 +1822,22 @@ + gboolean signedness = FALSE; + + switch (sample_fmt) { +- case SAMPLE_FMT_S16: ++ case AV_SAMPLE_FMT_S16: + signedness = TRUE; + bpp = 16; + break; + +- case SAMPLE_FMT_S32: ++ case AV_SAMPLE_FMT_S32: + signedness = TRUE; + bpp = 32; + break; + +- case SAMPLE_FMT_FLT: ++ case AV_SAMPLE_FMT_FLT: + integer = FALSE; + bpp = 32; + break; + +- case SAMPLE_FMT_DBL: ++ case AV_SAMPLE_FMT_DBL: + integer = FALSE; + bpp = 64; + break; +@@ -1941,12 +1896,12 @@ + } + } else { + GstCaps *temp; +- enum SampleFormat i; ++ enum AVSampleFormat i; + AVCodecContext ctx = { 0, }; + + ctx.channels = -1; + caps = gst_caps_new_empty (); +- for (i = 0; i <= SAMPLE_FMT_DBL; i++) { ++ for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) { + temp = gst_ffmpeg_smpfmt_to_caps (i, encode ? &ctx : NULL, codec_id); + if (temp != NULL) { + gst_caps_append (caps, temp); +@@ -2049,9 +2004,9 @@ + gst_structure_get_int (structure, "endianness", &endianness)) { + if (endianness == G_BYTE_ORDER) { + if (width == 32) +- context->sample_fmt = SAMPLE_FMT_FLT; ++ context->sample_fmt = AV_SAMPLE_FMT_FLT; + else if (width == 64) +- context->sample_fmt = SAMPLE_FMT_DBL; ++ context->sample_fmt = AV_SAMPLE_FMT_DBL; + } + } + } else { +@@ -2062,9 +2017,9 @@ + gst_structure_get_int (structure, "endianness", &endianness)) { + if ((endianness == G_BYTE_ORDER) && (signedness == TRUE)) { + if ((width == 16) && (depth == 16)) +- context->sample_fmt = SAMPLE_FMT_S16; ++ context->sample_fmt = AV_SAMPLE_FMT_S16; + else if ((width == 32) && (depth == 32)) +- context->sample_fmt = SAMPLE_FMT_S32; ++ context->sample_fmt = AV_SAMPLE_FMT_S32; + } + } + } +@@ -2190,7 +2145,6 @@ + } else { + if (bpp == 8) { + context->pix_fmt = PIX_FMT_PAL8; +- gst_ffmpeg_get_palette (caps, context); + } + } + } +@@ -2576,7 +2530,6 @@ + switch (codec_type) { + case AVMEDIA_TYPE_VIDEO: + gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); +- gst_ffmpeg_get_palette (caps, context); + break; + case AVMEDIA_TYPE_AUDIO: + gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); +diff -uNr gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c.orig gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c.orig +--- gst-ffmpeg-0.10.13.orig/ext/ffmpeg/gstffmpegcodecmap.c.orig 1970-01-01 01:00:00.000000000 +0100 ++++ gst-ffmpeg-0.10.13/ext/ffmpeg/gstffmpegcodecmap.c.orig 2014-08-08 15:30:34.006867097 +0200 +@@ -0,0 +1,3447 @@ ++/* GStreamer ++ * Copyright (C) <1999> Erik Walthinsen <[email protected]> ++ * This file: ++ * Copyright (c) 2002-2004 Ronald Bultje <[email protected]> ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Library General Public ++ * License as published by the Free Software Foundation; either ++ * version 2 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Library General Public License for more details. ++ * ++ * You should have received a copy of the GNU Library General Public ++ * License along with this library; if not, write to the ++ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ * Boston, MA 02111-1307, USA. ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++#include <gst/gst.h> ++#ifdef HAVE_FFMPEG_UNINSTALLED ++#include <avcodec.h> ++#include <channel_layout.h>> ++#else ++#include <libavcodec/avcodec.h> ++#include <libavutil/channel_layout.h> ++#endif ++#include <string.h> ++ ++#include "gstffmpeg.h" ++#include "gstffmpegcodecmap.h" ++ ++#include <gst/pbutils/codec-utils.h> ++ ++/* ++ * Read a palette from a caps. ++ */ ++ ++static void ++gst_ffmpeg_get_palette (const GstCaps * caps, AVCodecContext * context) ++{ ++ GstStructure *str = gst_caps_get_structure (caps, 0); ++ const GValue *palette_v; ++ const GstBuffer *palette; ++ ++ /* do we have a palette? */ ++ if ((palette_v = gst_structure_get_value (str, "palette_data")) && context) { ++ palette = gst_value_get_buffer (palette_v); ++ if (GST_BUFFER_SIZE (palette) >= AVPALETTE_SIZE) { ++ if (context->palctrl) ++ av_free (context->palctrl); ++ context->palctrl = av_malloc (sizeof (AVPaletteControl)); ++ context->palctrl->palette_changed = 1; ++ memcpy (context->palctrl->palette, GST_BUFFER_DATA (palette), ++ AVPALETTE_SIZE); ++ } ++ } ++} ++ ++static void ++gst_ffmpeg_set_palette (GstCaps * caps, AVCodecContext * context) ++{ ++ if (context->palctrl) { ++ GstBuffer *palette = gst_buffer_new_and_alloc (AVPALETTE_SIZE); ++ ++ memcpy (GST_BUFFER_DATA (palette), context->palctrl->palette, ++ AVPALETTE_SIZE); ++ gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, palette, NULL); ++ } ++} ++ ++/* IMPORTANT: Keep this sorted by the ffmpeg channel masks */ ++static const struct ++{ ++ guint64 ff; ++ GstAudioChannelPosition gst; ++} _ff_to_gst_layout[] = { ++ { ++ AV_CH_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}, { ++ AV_CH_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER}, { ++ AV_CH_LOW_FREQUENCY, GST_AUDIO_CHANNEL_POSITION_LFE}, { ++ AV_CH_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_REAR_LEFT}, { ++ AV_CH_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT}, { ++ AV_CH_FRONT_LEFT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER}, { ++ AV_CH_FRONT_RIGHT_OF_CENTER, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER}, { ++ AV_CH_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_REAR_CENTER}, { ++ AV_CH_SIDE_LEFT, GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT}, { ++ AV_CH_SIDE_RIGHT, GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT}, { ++ AV_CH_TOP_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_FRONT_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_LEFT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_CENTER, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_TOP_BACK_RIGHT, GST_AUDIO_CHANNEL_POSITION_NONE}, { ++ AV_CH_STEREO_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT}, { ++ AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT} ++}; ++ ++static GstAudioChannelPosition * ++gst_ff_channel_layout_to_gst (guint64 channel_layout, guint channels) ++{ ++ guint nchannels = 0, i, j; ++ GstAudioChannelPosition *pos = NULL; ++ gboolean none_layout = FALSE; ++ ++ for (i = 0; i < 64; i++) { ++ if ((channel_layout & (G_GUINT64_CONSTANT (1) << i)) != 0) { ++ nchannels++; ++ } ++ } ++ ++ if (channel_layout == 0) { ++ nchannels = channels; ++ none_layout = TRUE; ++ } ++ ++ if (nchannels != channels) { ++ GST_ERROR ("Number of channels is different (%u != %u)", channels, ++ nchannels); ++ return NULL; ++ } ++ ++ pos = g_new (GstAudioChannelPosition, nchannels); ++ ++ for (i = 0, j = 0; i < G_N_ELEMENTS (_ff_to_gst_layout); i++) { ++ if ((channel_layout & _ff_to_gst_layout[i].ff) != 0) { ++ pos[j++] = _ff_to_gst_layout[i].gst; ++ ++ if (_ff_to_gst_layout[i].gst == GST_AUDIO_CHANNEL_POSITION_NONE) ++ none_layout = TRUE; ++ } ++ } ++ ++ if (j != nchannels) { ++ GST_WARNING ("Unknown channels in channel layout - assuming NONE layout"); ++ none_layout = TRUE; ++ } ++ ++ if (!none_layout && !gst_audio_check_channel_positions (pos, nchannels)) { ++ GST_ERROR ("Invalid channel layout %" G_GUINT64_FORMAT ++ " - assuming NONE layout", channel_layout); ++ none_layout = TRUE; ++ } ++ ++ if (none_layout) { ++ if (nchannels == 1) { ++ pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO; ++ } else if (nchannels == 2) { ++ pos[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT; ++ pos[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT; ++ } else if (channel_layout == 0) { ++ g_free (pos); ++ pos = NULL; ++ } else { ++ for (i = 0; i < nchannels; i++) ++ pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE; ++ } ++ } ++ ++ if (nchannels == 1 && pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER) { ++ GST_DEBUG ("mono common case; won't set channel positions"); ++ g_free (pos); ++ pos = NULL; ++ } else if (nchannels == 2 && pos[0] == GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT ++ && pos[1] == GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT) { ++ GST_DEBUG ("stereo common case; won't set channel positions"); ++ g_free (pos); ++ pos = NULL; ++ } ++ ++ return pos; ++} ++ ++/* this macro makes a caps width fixed or unfixed width/height ++ * properties depending on whether we've got a context. ++ * ++ * See below for why we use this. ++ * ++ * We should actually do this stuff at the end, like in riff-media.c, ++ * but I'm too lazy today. Maybe later. ++ */ ++static GstCaps * ++gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id, ++ const char *mimetype, const char *fieldname, ...) ++{ ++ GstStructure *structure = NULL; ++ GstCaps *caps = NULL; ++ va_list var_args; ++ gint i; ++ ++ GST_LOG ("context:%p, codec_id:%d, mimetype:%s", context, codec_id, mimetype); ++ ++ /* fixed, non probing context */ ++ if (context != NULL && context->width != -1) { ++ gint num, denom; ++ ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, context->width, ++ "height", G_TYPE_INT, context->height, NULL); ++ ++ num = context->time_base.den / context->ticks_per_frame; ++ denom = context->time_base.num; ++ ++ if (!denom) { ++ GST_LOG ("invalid framerate: %d/0, -> %d/1", num, num); ++ denom = 1; ++ } ++ if (gst_util_fraction_compare (num, denom, 1000, 1) > 0) { ++ GST_LOG ("excessive framerate: %d/%d, -> 0/1", num, denom); ++ num = 0; ++ denom = 1; ++ } ++ GST_LOG ("setting framerate: %d/%d", num, denom); ++ gst_caps_set_simple (caps, ++ "framerate", GST_TYPE_FRACTION, num, denom, NULL); ++ } else { ++ /* so we are after restricted caps in this case */ ++ switch (codec_id) { ++ case CODEC_ID_H261: ++ { ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 352, ++ "height", G_TYPE_INT, 288, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ gst_caps_append (caps, gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 176, ++ "height", G_TYPE_INT, 144, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL)); ++ break; ++ } ++ case CODEC_ID_H263: ++ { ++ /* 128x96, 176x144, 352x288, 704x576, and 1408x1152. slightly reordered ++ * because we want automatic negotiation to go as close to 320x240 as ++ * possible. */ ++ const static gint widths[] = { 352, 704, 176, 1408, 128 }; ++ const static gint heights[] = { 288, 576, 144, 1152, 96 }; ++ GstCaps *temp; ++ gint n_sizes = G_N_ELEMENTS (widths); ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < n_sizes; i++) { ++ temp = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, widths[i], ++ "height", G_TYPE_INT, heights[i], ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ ++ gst_caps_append (caps, temp); ++ } ++ break; ++ } ++ case CODEC_ID_DVVIDEO: ++ { ++ static struct ++ { ++ guint32 csp; ++ gint width, height; ++ gint par_n, par_d; ++ gint framerate_n, framerate_d; ++ } profiles[] = { ++ { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 10, 11, 30000, 1001}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 480, 40, 33, 30000, 1001}, { ++ GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 59, 54, 25, 1}, { ++ GST_MAKE_FOURCC ('I', '4', '2', '0'), 720, 576, 118, 81, 25, 1}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 59, 54, 25, 1}, { ++ GST_MAKE_FOURCC ('Y', '4', '1', 'B'), 720, 576, 118, 81, 25, 1} ++ }; ++ GstCaps *temp; ++ gint n_sizes = G_N_ELEMENTS (profiles); ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < n_sizes; i++) { ++ temp = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, profiles[i].width, ++ "height", G_TYPE_INT, profiles[i].height, ++ "framerate", GST_TYPE_FRACTION, profiles[i].framerate_n, ++ profiles[i].framerate_d, "pixel-aspect-ratio", GST_TYPE_FRACTION, ++ profiles[i].par_n, profiles[i].par_d, NULL); ++ ++ gst_caps_append (caps, temp); ++ } ++ break; ++ } ++ case CODEC_ID_DNXHD: ++ { ++ caps = gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 1920, ++ "height", G_TYPE_INT, 1080, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ gst_caps_append (caps, gst_caps_new_simple (mimetype, ++ "width", G_TYPE_INT, 1280, ++ "height", G_TYPE_INT, 720, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL)); ++ break; ++ } ++ default: ++ break; ++ } ++ } ++ ++ /* no fixed caps or special restrictions applied; ++ * default unfixed setting */ ++ if (!caps) { ++ GST_DEBUG ("Creating default caps"); ++ caps = gst_caps_new_simple (mimetype, ++ "width", GST_TYPE_INT_RANGE, 16, 4096, ++ "height", GST_TYPE_INT_RANGE, 16, 4096, ++ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); ++ } ++ ++ for (i = 0; i < gst_caps_get_size (caps); i++) { ++ va_start (var_args, fieldname); ++ structure = gst_caps_get_structure (caps, i); ++ gst_structure_set_valist (structure, fieldname, var_args); ++ va_end (var_args); ++ } ++ ++ return caps; ++} ++ ++/* same for audio - now with channels/sample rate ++ */ ++static GstCaps * ++gst_ff_aud_caps_new (AVCodecContext * context, enum CodecID codec_id, ++ const char *mimetype, const char *fieldname, ...) ++{ ++ GstCaps *caps = NULL; ++ GstStructure *structure = NULL; ++ gint i; ++ va_list var_args; ++ ++ /* fixed, non-probing context */ ++ if (context != NULL && context->channels != -1) { ++ GstAudioChannelPosition *pos; ++ guint64 channel_layout = context->channel_layout; ++ ++ if (channel_layout == 0) { ++ const guint64 default_channel_set[] = { ++ 0, 0, AV_CH_LAYOUT_SURROUND, AV_CH_LAYOUT_QUAD, AV_CH_LAYOUT_5POINT0, ++ AV_CH_LAYOUT_5POINT1, 0, AV_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); ++ ++ pos = gst_ff_channel_layout_to_gst (channel_layout, context->channels); ++ if (pos != NULL) { ++ gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos); ++ g_free (pos); ++ } ++ } else { ++ gint maxchannels = 2; ++ const gint *rates = NULL; ++ gint n_rates = 0; ++ ++ /* so we must be after restricted caps in this case */ ++ switch (codec_id) { ++ case CODEC_ID_AAC: ++ case CODEC_ID_AAC_LATM: ++ case CODEC_ID_DTS: ++ maxchannels = 6; ++ break; ++ case CODEC_ID_MP2: ++ { ++ const static gint l_rates[] = ++ { 48000, 44100, 32000, 24000, 22050, 16000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_EAC3: ++ case CODEC_ID_AC3: ++ { ++ const static gint l_rates[] = { 48000, 44100, 32000 }; ++ maxchannels = 6; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_ADPCM_G722: ++ { ++ const static gint l_rates[] = { 16000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ maxchannels = 1; ++ break; ++ } ++ case CODEC_ID_ADPCM_G726: ++ { ++ const static gint l_rates[] = { 8000 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ maxchannels = 1; ++ break; ++ } ++ case CODEC_ID_ADPCM_SWF: ++ { ++ const static gint l_rates[] = { 11025, 22050, 44100 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_ROQ_DPCM: ++ { ++ const static gint l_rates[] = { 22050 }; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_AMR_NB: ++ { ++ const static gint l_rates[] = { 8000 }; ++ maxchannels = 1; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ case CODEC_ID_AMR_WB: ++ { ++ const static gint l_rates[] = { 16000 }; ++ maxchannels = 1; ++ n_rates = G_N_ELEMENTS (l_rates); ++ rates = l_rates; ++ break; ++ } ++ default: ++ break; ++ } ++ ++ /* TODO: handle context->channel_layouts here to set ++ * the list of channel layouts supported by the encoder. ++ * Unfortunately no encoder uses this yet.... ++ */ ++ /* regardless of encode/decode, open up channels if applicable */ ++ /* Until decoders/encoders expose the maximum number of channels ++ * they support, we whitelist them here. */ ++ switch (codec_id) { ++ case CODEC_ID_WMAPRO: ++ case CODEC_ID_TRUEHD: ++ maxchannels = 8; ++ break; ++ default: ++ break; ++ } ++ ++ if (maxchannels == 1) ++ caps = gst_caps_new_simple (mimetype, ++ "channels", G_TYPE_INT, maxchannels, NULL); ++ else ++ caps = gst_caps_new_simple (mimetype, ++ "channels", GST_TYPE_INT_RANGE, 1, maxchannels, NULL); ++ if (n_rates) { ++ GValue list = { 0, }; ++ GstStructure *structure; ++ ++ g_value_init (&list, GST_TYPE_LIST); ++ for (i = 0; i < n_rates; i++) { ++ GValue v = { 0, }; ++ ++ g_value_init (&v, G_TYPE_INT); ++ g_value_set_int (&v, rates[i]); ++ gst_value_list_append_value (&list, &v); ++ g_value_unset (&v); ++ } ++ structure = gst_caps_get_structure (caps, 0); ++ gst_structure_set_value (structure, "rate", &list); ++ g_value_unset (&list); ++ } else ++ gst_caps_set_simple (caps, "rate", GST_TYPE_INT_RANGE, 4000, 96000, NULL); ++ } ++ ++ for (i = 0; i < gst_caps_get_size (caps); i++) { ++ va_start (var_args, fieldname); ++ structure = gst_caps_get_structure (caps, i); ++ gst_structure_set_valist (structure, fieldname, var_args); ++ va_end (var_args); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG codec ID and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * CodecID is primarily meant for compressed data GstCaps! ++ * ++ * encode is a special parameter. gstffmpegdec will say ++ * FALSE, gstffmpegenc will say TRUE. The output caps ++ * depends on this, in such a way that it will be very ++ * specific, defined, fixed and correct caps for encoders, ++ * yet very wide, "forgiving" caps for decoders. Example ++ * for mp3: decode: audio/mpeg,mpegversion=1,layer=[1-3] ++ * but encode: audio/mpeg,mpegversion=1,layer=3,bitrate=x, ++ * rate=x,channels=x. ++ */ ++ ++GstCaps * ++gst_ffmpeg_codecid_to_caps (enum CodecID codec_id, ++ AVCodecContext * context, gboolean encode) ++{ ++ GstCaps *caps = NULL; ++ gboolean buildcaps = FALSE; ++ ++ GST_LOG ("codec_id:%d, context:%p, encode:%d", codec_id, context, encode); ++ ++ switch (codec_id) { ++ case CODEC_ID_MPEG1VIDEO: ++ /* FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 1, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ break; ++ ++ case CODEC_ID_MPEG2VIDEO: ++ if (encode) { ++ /* FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 2, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } else { ++ /* decode both MPEG-1 and MPEG-2; width/height/fps are all in ++ * the MPEG video stream headers, so may be omitted from caps. */ ++ caps = gst_caps_new_simple ("video/mpeg", ++ "mpegversion", GST_TYPE_INT_RANGE, 1, 2, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MPEG2VIDEO_XVMC: ++ /* this is a special ID - don't need it in GStreamer, I think */ ++ break; ++ ++ case CODEC_ID_H263: ++ if (encode) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", ++ "h263version", G_TYPE_STRING, "h263", NULL); ++ } else { ++ /* don't pass codec_id, we can decode other variants with the H263 ++ * decoder that don't have specific size requirements ++ */ ++ caps = gst_ff_vid_caps_new (context, CODEC_ID_NONE, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", NULL); ++ } ++ break; ++ ++ case CODEC_ID_H263P: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h263", ++ "variant", G_TYPE_STRING, "itu", ++ "h263version", G_TYPE_STRING, "h263p", NULL); ++ if (encode && context) { ++ ++ gst_caps_set_simple (caps, ++ "annex-f", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_4MV, ++ "annex-j", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_LOOP_FILTER, ++ "annex-i", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED, ++ "annex-t", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED, ++ NULL); ++ } ++ break; ++ ++ case CODEC_ID_H263I: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-intel-h263", ++ "variant", G_TYPE_STRING, "intel", NULL); ++ break; ++ ++ case CODEC_ID_H261: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h261", NULL); ++ break; ++ ++ case CODEC_ID_RV10: ++ case CODEC_ID_RV20: ++ case CODEC_ID_RV30: ++ case CODEC_ID_RV40: ++ { ++ gint version; ++ ++ switch (codec_id) { ++ case CODEC_ID_RV40: ++ version = 4; ++ break; ++ case CODEC_ID_RV30: ++ version = 3; ++ break; ++ case CODEC_ID_RV20: ++ version = 2; ++ break; ++ default: ++ version = 1; ++ break; ++ } ++ ++ /* FIXME: context->sub_id must be filled in during decoding */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-pn-realvideo", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, ++ "rmversion", G_TYPE_INT, version, NULL); ++ if (context) { ++ gst_caps_set_simple (caps, "format", G_TYPE_INT, context->sub_id, NULL); ++ if (context->extradata_size >= 8) { ++ gst_caps_set_simple (caps, ++ "subformat", G_TYPE_INT, GST_READ_UINT32_BE (context->extradata), ++ NULL); ++ } ++ } ++ } ++ break; ++ ++ case CODEC_ID_MP1: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_MP2: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_MP3: ++ if (encode) { ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); ++ } else { ++ /* Decodes MPEG-1 layer 1/2/3. Samplerate, channels et al are ++ * in the MPEG audio header, so may be omitted from caps. */ ++ caps = gst_caps_new_simple ("audio/mpeg", ++ "mpegversion", G_TYPE_INT, 1, ++ "layer", GST_TYPE_INT_RANGE, 1, 3, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MUSEPACK7: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, ++ "audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 7, ++ NULL); ++ break; ++ ++ case CODEC_ID_MUSEPACK8: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, ++ "audio/x-ffmpeg-parsed-musepack", "streamversion", G_TYPE_INT, 8, ++ NULL); ++ break; ++ ++ case CODEC_ID_AC3: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-ac3", NULL); ++ break; ++ ++ case CODEC_ID_EAC3: ++ /* FIXME: bitrate */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-eac3", NULL); ++ break; ++ ++ case CODEC_ID_TRUEHD: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-true-hd", NULL); ++ break; ++ ++ case CODEC_ID_ATRAC1: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-vnd.sony.atrac1", ++ NULL); ++ break; ++ ++ case CODEC_ID_ATRAC3: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-vnd.sony.atrac3", ++ NULL); ++ break; ++ ++ case CODEC_ID_DTS: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dts", NULL); ++ break; ++ ++ case CODEC_ID_APE: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-ffmpeg-parsed-ape", ++ NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MLP: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mlp", NULL); ++ break; ++ ++ case CODEC_ID_IMC: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-imc", NULL); ++ break; ++ ++ /* MJPEG is normal JPEG, Motion-JPEG and Quicktime MJPEG-A. MJPEGB ++ * is Quicktime's MJPEG-B. LJPEG is lossless JPEG. I don't know what ++ * sp5x is, but it's apparently something JPEG... We don't separate ++ * between those in GStreamer. Should we (at least between MJPEG, ++ * MJPEG-B and sp5x decoding...)? */ ++ case CODEC_ID_MJPEG: ++ case CODEC_ID_LJPEG: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/jpeg", NULL); ++ break; ++ ++ case CODEC_ID_SP5X: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/sp5x", NULL); ++ break; ++ ++ case CODEC_ID_MJPEGB: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mjpeg-b", NULL); ++ break; ++ ++ case CODEC_ID_MPEG4: ++ if (encode && context != NULL) { ++ /* I'm not exactly sure what ffmpeg outputs... ffmpeg itself uses ++ * the AVI fourcc 'DIVX', but 'mp4v' for Quicktime... */ ++ switch (context->codec_tag) { ++ case GST_MAKE_FOURCC ('D', 'I', 'V', 'X'): ++ caps = gst_ff_vid_caps_new (context, codec_id, "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 (context, codec_id, "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 (context, codec_id, "video/mpeg", ++ "mpegversion", G_TYPE_INT, 4, ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ if (encode) { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", G_TYPE_INT, 5, NULL)); ++ } else { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", GST_TYPE_INT_RANGE, 4, 5, ++ NULL)); ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-xvid", NULL)); ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-3ivx", NULL)); ++ } ++ } ++ break; ++ ++ case CODEC_ID_RAWVIDEO: ++ caps = ++ gst_ffmpeg_codectype_to_caps (AVMEDIA_TYPE_VIDEO, context, codec_id, ++ encode); ++ break; ++ ++ case CODEC_ID_MSMPEG4V1: ++ case CODEC_ID_MSMPEG4V2: ++ case CODEC_ID_MSMPEG4V3: ++ { ++ gint version = 41 + codec_id - CODEC_ID_MSMPEG4V1; ++ ++ /* encode-FIXME: bitrate */ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msmpeg", ++ "msmpegversion", G_TYPE_INT, version, NULL); ++ if (!encode && codec_id == CODEC_ID_MSMPEG4V3) { ++ gst_caps_append (caps, gst_ff_vid_caps_new (context, codec_id, ++ "video/x-divx", "divxversion", G_TYPE_INT, 3, NULL)); ++ } ++ } ++ break; ++ ++ case CODEC_ID_WMV1: ++ case CODEC_ID_WMV2: ++ { ++ gint version = (codec_id == CODEC_ID_WMV1) ? 1 : 2; ++ ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, version, NULL); ++ } ++ break; ++ ++ case CODEC_ID_FLV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-flash-video", ++ "flvversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_SVQ1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", ++ "svqversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_SVQ3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-svq", ++ "svqversion", G_TYPE_INT, 3, NULL); ++ break; ++ ++ case CODEC_ID_DVAUDIO: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dv", NULL); ++ break; ++ ++ case CODEC_ID_DVVIDEO: ++ { ++ if (encode && context) { ++ guint32 fourcc; ++ ++ switch (context->pix_fmt) { ++ case PIX_FMT_YUYV422: ++ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); ++ break; ++ case PIX_FMT_YUV420P: ++ fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUVA420P: ++ fourcc = GST_MAKE_FOURCC ('A', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUV411P: ++ fourcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); ++ break; ++ case PIX_FMT_YUV422P: ++ fourcc = GST_MAKE_FOURCC ('Y', '4', '2', 'B'); ++ break; ++ case PIX_FMT_YUV410P: ++ fourcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); ++ break; ++ default: ++ GST_WARNING ++ ("Couldnt' find fourcc for pixfmt %d, defaulting to I420", ++ context->pix_fmt); ++ fourcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ } ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, ++ "format", GST_TYPE_FOURCC, fourcc, NULL); ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_WMAV1: ++ case CODEC_ID_WMAV2: ++ { ++ gint version = (codec_id == CODEC_ID_WMAV1) ? 1 : 2; ++ ++ if (context) { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, version, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } else { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, version, ++ "block_align", GST_TYPE_INT_RANGE, 0, G_MAXINT, ++ "bitrate", GST_TYPE_INT_RANGE, 0, G_MAXINT, NULL); ++ } ++ } ++ break; ++ case CODEC_ID_WMAPRO: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wma", ++ "wmaversion", G_TYPE_INT, 3, NULL); ++ break; ++ } ++ ++ case CODEC_ID_WMAVOICE: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-wms", NULL); ++ break; ++ } ++ ++ case CODEC_ID_MACE3: ++ case CODEC_ID_MACE6: ++ { ++ gint version = (codec_id == CODEC_ID_MACE3) ? 3 : 6; ++ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mace", ++ "maceversion", G_TYPE_INT, version, NULL); ++ } ++ break; ++ ++ case CODEC_ID_HUFFYUV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-huffyuv", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "bpp", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_CYUV: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-compressed-yuv", ++ NULL); ++ break; ++ ++ case CODEC_ID_H264: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-h264", NULL); ++ break; ++ ++ case CODEC_ID_INDEO5: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 5, NULL); ++ break; ++ ++ case CODEC_ID_INDEO3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 3, NULL); ++ break; ++ ++ case CODEC_ID_INDEO2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-indeo", ++ "indeoversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_FLASHSV: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-flash-screen", NULL); ++ break; ++ ++ case CODEC_ID_VP3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp3", NULL); ++ break; ++ ++ case CODEC_ID_VP5: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp5", NULL); ++ break; ++ ++ case CODEC_ID_VP6: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6", NULL); ++ break; ++ ++ case CODEC_ID_VP6F: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-flash", NULL); ++ break; ++ ++ case CODEC_ID_VP6A: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp6-alpha", NULL); ++ break; ++ ++ case CODEC_ID_VP8: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vp8", NULL); ++ break; ++ ++ case CODEC_ID_THEORA: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-theora", NULL); ++ break; ++ ++ case CODEC_ID_AAC: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", NULL); ++ ++ if (!encode) { ++ GValue arr = { 0, }; ++ GValue item = { 0, }; ++ ++ g_value_init (&arr, GST_TYPE_LIST); ++ g_value_init (&item, G_TYPE_INT); ++ g_value_set_int (&item, 2); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_int (&item, 4); ++ gst_value_list_append_value (&arr, &item); ++ g_value_unset (&item); ++ ++ gst_caps_set_value (caps, "mpegversion", &arr); ++ g_value_unset (&arr); ++ ++ g_value_init (&arr, GST_TYPE_LIST); ++ g_value_init (&item, G_TYPE_STRING); ++ g_value_set_string (&item, "raw"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_string (&item, "adts"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_set_string (&item, "adif"); ++ gst_value_list_append_value (&arr, &item); ++ g_value_unset (&item); ++ ++ gst_caps_set_value (caps, "stream-format", &arr); ++ g_value_unset (&arr); ++ } else { ++ gst_caps_set_simple (caps, "mpegversion", G_TYPE_INT, 4, ++ "stream-format", G_TYPE_STRING, "raw", ++ "base-profile", G_TYPE_STRING, "lc", NULL); ++ ++ if (context && context->extradata_size > 0) ++ gst_codec_utils_aac_caps_set_level_and_profile (caps, ++ context->extradata, context->extradata_size); ++ } ++ ++ break; ++ } ++ case CODEC_ID_AAC_LATM: /* LATM/LOAS AAC syntax */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/mpeg", ++ "mpegversion", G_TYPE_INT, 4, "stream-format", G_TYPE_STRING, "loas", ++ NULL); ++ break; ++ ++ case CODEC_ID_ASV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", ++ "asusversion", G_TYPE_INT, 1, NULL); ++ break; ++ case CODEC_ID_ASV2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-asus", ++ "asusversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_FFV1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ffv", ++ "ffvversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_4XM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-4xm", NULL); ++ break; ++ ++ case CODEC_ID_XAN_WC3: ++ case CODEC_ID_XAN_WC4: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-xan", ++ "wcversion", G_TYPE_INT, 3 - CODEC_ID_XAN_WC3 + codec_id, NULL); ++ break; ++ ++ case CODEC_ID_CLJR: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, ++ "video/x-cirrus-logic-accupak", NULL); ++ break; ++ ++ case CODEC_ID_FRAPS: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-fraps", NULL); ++ break; ++ ++ 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 (context, codec_id, "video/x-ati-vcr", ++ "vcrversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_RPZA: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "video/x-apple-video", NULL); ++ break; ++ ++ case CODEC_ID_CINEPAK: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-cinepak", NULL); ++ break; ++ ++ /* WS_VQA belogns here (order) */ ++ ++ case CODEC_ID_MSRLE: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", ++ "layout", G_TYPE_STRING, "microsoft", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL); ++ } ++ break; ++ ++ case CODEC_ID_QTRLE: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-rle", ++ "layout", G_TYPE_STRING, "quicktime", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 1, 64, NULL); ++ } ++ break; ++ ++ case CODEC_ID_MSVIDEO1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-msvideocodec", ++ "msvideoversion", G_TYPE_INT, 1, NULL); ++ break; ++ ++ case CODEC_ID_WMV3: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, 3, NULL); ++ break; ++ case CODEC_ID_VC1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-wmv", ++ "wmvversion", G_TYPE_INT, 3, "format", GST_TYPE_FOURCC, ++ GST_MAKE_FOURCC ('W', 'V', 'C', '1'), NULL); ++ break; ++ case CODEC_ID_QDM2: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-qdm2", NULL); ++ break; ++ ++ case CODEC_ID_MSZH: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mszh", NULL); ++ break; ++ ++ case CODEC_ID_ZLIB: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zlib", NULL); ++ break; ++ ++ case CODEC_ID_TRUEMOTION1: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", ++ "trueversion", G_TYPE_INT, 1, NULL); ++ break; ++ case CODEC_ID_TRUEMOTION2: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-truemotion", ++ "trueversion", G_TYPE_INT, 2, NULL); ++ break; ++ ++ case CODEC_ID_ULTI: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-ultimotion", ++ NULL); ++ break; ++ ++ case CODEC_ID_TSCC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camtasia", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 8, 32, NULL); ++ } ++ break; ++ ++ case CODEC_ID_KMVC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-kmvc", NULL); ++ break; ++ ++ case CODEC_ID_NUV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-nuv", NULL); ++ break; ++ ++ case CODEC_ID_GIF: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/gif", NULL); ++ break; ++ ++ case CODEC_ID_PNG: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/png", NULL); ++ break; ++ ++ case CODEC_ID_PPM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/ppm", NULL); ++ break; ++ ++ case CODEC_ID_PBM: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/pbm", NULL); ++ break; ++ ++ case CODEC_ID_PAM: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-portable-anymap", ++ NULL); ++ break; ++ ++ case CODEC_ID_PGM: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-portable-graymap", ++ NULL); ++ break; ++ ++ case CODEC_ID_PCX: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-pcx", NULL); ++ break; ++ ++ case CODEC_ID_SGI: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-sgi", NULL); ++ break; ++ ++ case CODEC_ID_TARGA: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/x-tga", NULL); ++ break; ++ ++ case CODEC_ID_TIFF: ++ caps = gst_ff_vid_caps_new (context, codec_id, "image/tiff", NULL); ++ break; ++ ++ case CODEC_ID_SUNRAST: ++ caps = ++ gst_ff_vid_caps_new (context, codec_id, "image/x-sun-raster", NULL); ++ break; ++ ++ case CODEC_ID_SMC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-smc", NULL); ++ break; ++ ++ case CODEC_ID_QDRAW: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-qdrw", NULL); ++ break; ++ ++ case CODEC_ID_DNXHD: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-dnxhd", NULL); ++ break; ++ ++ case CODEC_ID_MIMIC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-mimic", NULL); ++ break; ++ ++ case CODEC_ID_VMNC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-vmnc", NULL); ++ break; ++ ++ case CODEC_ID_TRUESPEECH: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-truespeech", NULL); ++ break; ++ ++ case CODEC_ID_QCELP: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/qcelp", NULL); ++ break; ++ ++ case CODEC_ID_AMV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-amv", NULL); ++ break; ++ ++ case CODEC_ID_AASC: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-aasc", NULL); ++ break; ++ ++ case CODEC_ID_LOCO: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-loco", NULL); ++ break; ++ ++ case CODEC_ID_ZMBV: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-zmbv", NULL); ++ break; ++ ++ case CODEC_ID_LAGARITH: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-lagarith", NULL); ++ break; ++ ++ case CODEC_ID_CSCD: ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-camstudio", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "depth", G_TYPE_INT, (gint) context->bits_per_coded_sample, NULL); ++ } else { ++ gst_caps_set_simple (caps, "depth", GST_TYPE_INT_RANGE, 8, 32, NULL); ++ } ++ break; ++ ++ case CODEC_ID_WS_VQA: ++ case CODEC_ID_IDCIN: ++ case CODEC_ID_8BPS: ++ case CODEC_ID_FLIC: ++ case CODEC_ID_VMDVIDEO: ++ case CODEC_ID_VMDAUDIO: ++ case CODEC_ID_SNOW: ++ case CODEC_ID_VIXL: ++ case CODEC_ID_QPEG: ++ case CODEC_ID_PGMYUV: ++ case CODEC_ID_FFVHUFF: ++ case CODEC_ID_WNV1: ++ case CODEC_ID_MP3ADU: ++ case CODEC_ID_MP3ON4: ++ case CODEC_ID_WESTWOOD_SND1: ++ case CODEC_ID_MMVIDEO: ++ case CODEC_ID_AVS: ++ case CODEC_ID_CAVS: ++ buildcaps = TRUE; ++ break; ++ ++ /* weird quasi-codecs for the demuxers only */ ++ case CODEC_ID_PCM_S16LE: ++ case CODEC_ID_PCM_S16BE: ++ case CODEC_ID_PCM_U16LE: ++ case CODEC_ID_PCM_U16BE: ++ case CODEC_ID_PCM_S8: ++ case CODEC_ID_PCM_U8: ++ { ++ gint width = 0, depth = 0, endianness = 0; ++ gboolean signedness = FALSE; /* blabla */ ++ ++ switch (codec_id) { ++ case CODEC_ID_PCM_S16LE: ++ width = 16; ++ depth = 16; ++ endianness = G_LITTLE_ENDIAN; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_S16BE: ++ width = 16; ++ depth = 16; ++ endianness = G_BIG_ENDIAN; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_U16LE: ++ width = 16; ++ depth = 16; ++ endianness = G_LITTLE_ENDIAN; ++ signedness = FALSE; ++ break; ++ case CODEC_ID_PCM_U16BE: ++ width = 16; ++ depth = 16; ++ endianness = G_BIG_ENDIAN; ++ signedness = FALSE; ++ break; ++ case CODEC_ID_PCM_S8: ++ width = 8; ++ depth = 8; ++ endianness = G_BYTE_ORDER; ++ signedness = TRUE; ++ break; ++ case CODEC_ID_PCM_U8: ++ width = 8; ++ depth = 8; ++ endianness = G_BYTE_ORDER; ++ signedness = FALSE; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-int", ++ "width", G_TYPE_INT, width, ++ "depth", G_TYPE_INT, depth, ++ "endianness", G_TYPE_INT, endianness, ++ "signed", G_TYPE_BOOLEAN, signedness, NULL); ++ } ++ break; ++ ++ case CODEC_ID_PCM_MULAW: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-mulaw", NULL); ++ break; ++ ++ case CODEC_ID_PCM_ALAW: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-alaw", NULL); ++ break; ++ ++ case CODEC_ID_ADPCM_G722: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/G722", NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ break; ++ ++ case CODEC_ID_ADPCM_G726: ++ { ++ /* the G726 decoder can also handle G721 */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-adpcm", ++ "layout", G_TYPE_STRING, "g726", NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ ++ if (!encode) { ++ gst_caps_append (caps, gst_caps_new_simple ("audio/x-adpcm", ++ "layout", G_TYPE_STRING, "g721", ++ "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL)); ++ } ++ break; ++ } ++ case CODEC_ID_ADPCM_IMA_QT: ++ case CODEC_ID_ADPCM_IMA_WAV: ++ case CODEC_ID_ADPCM_IMA_DK3: ++ case CODEC_ID_ADPCM_IMA_DK4: ++ case CODEC_ID_ADPCM_IMA_WS: ++ case CODEC_ID_ADPCM_IMA_SMJPEG: ++ case CODEC_ID_ADPCM_IMA_AMV: ++ case CODEC_ID_ADPCM_IMA_ISS: ++ case CODEC_ID_ADPCM_IMA_EA_EACS: ++ case CODEC_ID_ADPCM_IMA_EA_SEAD: ++ case CODEC_ID_ADPCM_MS: ++ case CODEC_ID_ADPCM_4XM: ++ case CODEC_ID_ADPCM_XA: ++ case CODEC_ID_ADPCM_ADX: ++ case CODEC_ID_ADPCM_EA: ++ case CODEC_ID_ADPCM_CT: ++ case CODEC_ID_ADPCM_SWF: ++ case CODEC_ID_ADPCM_YAMAHA: ++ case CODEC_ID_ADPCM_SBPRO_2: ++ case CODEC_ID_ADPCM_SBPRO_3: ++ case CODEC_ID_ADPCM_SBPRO_4: ++ case CODEC_ID_ADPCM_EA_R1: ++ case CODEC_ID_ADPCM_EA_R2: ++ case CODEC_ID_ADPCM_EA_R3: ++ case CODEC_ID_ADPCM_EA_MAXIS_XA: ++ case CODEC_ID_ADPCM_EA_XAS: ++ case CODEC_ID_ADPCM_THP: ++ { ++ const gchar *layout = NULL; ++ ++ switch (codec_id) { ++ case CODEC_ID_ADPCM_IMA_QT: ++ layout = "quicktime"; ++ break; ++ case CODEC_ID_ADPCM_IMA_WAV: ++ layout = "dvi"; ++ break; ++ case CODEC_ID_ADPCM_IMA_DK3: ++ layout = "dk3"; ++ break; ++ case CODEC_ID_ADPCM_IMA_DK4: ++ layout = "dk4"; ++ break; ++ case CODEC_ID_ADPCM_IMA_WS: ++ layout = "westwood"; ++ break; ++ case CODEC_ID_ADPCM_IMA_SMJPEG: ++ layout = "smjpeg"; ++ break; ++ case CODEC_ID_ADPCM_IMA_AMV: ++ layout = "amv"; ++ break; ++ case CODEC_ID_ADPCM_IMA_ISS: ++ layout = "iss"; ++ break; ++ case CODEC_ID_ADPCM_IMA_EA_EACS: ++ layout = "ea-eacs"; ++ break; ++ case CODEC_ID_ADPCM_IMA_EA_SEAD: ++ layout = "ea-sead"; ++ break; ++ case CODEC_ID_ADPCM_MS: ++ layout = "microsoft"; ++ break; ++ case CODEC_ID_ADPCM_4XM: ++ layout = "4xm"; ++ break; ++ case CODEC_ID_ADPCM_XA: ++ layout = "xa"; ++ break; ++ case CODEC_ID_ADPCM_ADX: ++ layout = "adx"; ++ break; ++ case CODEC_ID_ADPCM_EA: ++ layout = "ea"; ++ break; ++ case CODEC_ID_ADPCM_CT: ++ layout = "ct"; ++ break; ++ case CODEC_ID_ADPCM_SWF: ++ layout = "swf"; ++ break; ++ case CODEC_ID_ADPCM_YAMAHA: ++ layout = "yamaha"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_2: ++ layout = "sbpro2"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_3: ++ layout = "sbpro3"; ++ break; ++ case CODEC_ID_ADPCM_SBPRO_4: ++ layout = "sbpro4"; ++ break; ++ case CODEC_ID_ADPCM_EA_R1: ++ layout = "ea-r1"; ++ break; ++ case CODEC_ID_ADPCM_EA_R2: ++ layout = "ea-r3"; ++ break; ++ case CODEC_ID_ADPCM_EA_R3: ++ layout = "ea-r3"; ++ break; ++ case CODEC_ID_ADPCM_EA_MAXIS_XA: ++ layout = "ea-maxis-xa"; ++ break; ++ case CODEC_ID_ADPCM_EA_XAS: ++ layout = "ea-xas"; ++ break; ++ case CODEC_ID_ADPCM_THP: ++ layout = "thp"; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ /* FIXME: someone please check whether we need additional properties ++ * in this caps definition. */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-adpcm", ++ "layout", G_TYPE_STRING, layout, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ break; ++ ++ case CODEC_ID_AMR_NB: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/AMR", NULL); ++ break; ++ ++ case CODEC_ID_AMR_WB: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/AMR-WB", NULL); ++ break; ++ ++ case CODEC_ID_GSM: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-gsm", NULL); ++ break; ++ ++ case CODEC_ID_GSM_MS: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/ms-gsm", NULL); ++ break; ++ ++ case CODEC_ID_NELLYMOSER: ++ caps = ++ gst_ff_aud_caps_new (context, codec_id, "audio/x-nellymoser", NULL); ++ break; ++ ++ case CODEC_ID_SIPR: ++ { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-sipro", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "leaf_size", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_RA_144: ++ case CODEC_ID_RA_288: ++ case CODEC_ID_COOK: ++ { ++ gint version = 0; ++ ++ switch (codec_id) { ++ case CODEC_ID_RA_144: ++ version = 1; ++ break; ++ case CODEC_ID_RA_288: ++ version = 2; ++ break; ++ case CODEC_ID_COOK: ++ version = 8; ++ break; ++ default: ++ break; ++ } ++ ++ /* FIXME: properties? */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-pn-realaudio", ++ "raversion", G_TYPE_INT, version, NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "leaf_size", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ } ++ break; ++ ++ case CODEC_ID_ROQ_DPCM: ++ case CODEC_ID_INTERPLAY_DPCM: ++ case CODEC_ID_XAN_DPCM: ++ case CODEC_ID_SOL_DPCM: ++ { ++ const gchar *layout = NULL; ++ ++ switch (codec_id) { ++ case CODEC_ID_ROQ_DPCM: ++ layout = "roq"; ++ break; ++ case CODEC_ID_INTERPLAY_DPCM: ++ layout = "interplay"; ++ break; ++ case CODEC_ID_XAN_DPCM: ++ layout = "xan"; ++ break; ++ case CODEC_ID_SOL_DPCM: ++ layout = "sol"; ++ break; ++ default: ++ g_assert (0); /* don't worry, we never get here */ ++ break; ++ } ++ ++ /* FIXME: someone please check whether we need additional properties ++ * in this caps definition. */ ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-dpcm", ++ "layout", G_TYPE_STRING, layout, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ } ++ break; ++ ++ case CODEC_ID_SHORTEN: ++ caps = gst_caps_new_simple ("audio/x-shorten", NULL); ++ break; ++ ++ case CODEC_ID_ALAC: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-alac", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ ++ case CODEC_ID_FLAC: ++ /* Note that ffmpeg has no encoder yet, but just for safety. In the ++ * encoder case, we want to add things like samplerate, channels... */ ++ if (!encode) { ++ caps = gst_caps_new_simple ("audio/x-flac", NULL); ++ } ++ break; ++ ++ case CODEC_ID_DVD_SUBTITLE: ++ case CODEC_ID_DVB_SUBTITLE: ++ caps = NULL; ++ break; ++ case CODEC_ID_BMP: ++ caps = gst_caps_new_simple ("image/bmp", NULL); ++ break; ++ case CODEC_ID_TTA: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-tta", NULL); ++ if (context) { ++ gst_caps_set_simple (caps, ++ "samplesize", G_TYPE_INT, context->bits_per_coded_sample, NULL); ++ } ++ break; ++ case CODEC_ID_TWINVQ: ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-twin-vq", NULL); ++ break; ++ default: ++ GST_DEBUG ("Unknown codec ID %d, please add mapping here", codec_id); ++ break; ++ } ++ ++ if (buildcaps) { ++ AVCodec *codec; ++ ++ if ((codec = avcodec_find_decoder (codec_id)) || ++ (codec = avcodec_find_encoder (codec_id))) { ++ gchar *mime = NULL; ++ ++ GST_LOG ("Could not create stream format caps for %s", codec->name); ++ ++ switch (codec->type) { ++ case AVMEDIA_TYPE_VIDEO: ++ mime = g_strdup_printf ("video/x-gst_ff-%s", codec->name); ++ caps = gst_ff_vid_caps_new (context, codec_id, mime, NULL); ++ g_free (mime); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ mime = g_strdup_printf ("audio/x-gst_ff-%s", codec->name); ++ caps = gst_ff_aud_caps_new (context, codec_id, mime, NULL); ++ if (context) ++ gst_caps_set_simple (caps, ++ "block_align", G_TYPE_INT, context->block_align, ++ "bitrate", G_TYPE_INT, context->bit_rate, NULL); ++ g_free (mime); ++ break; ++ default: ++ break; ++ } ++ } ++ } ++ ++ if (caps != NULL) { ++ ++ /* set private data */ ++ if (context && context->extradata_size > 0) { ++ GstBuffer *data = gst_buffer_new_and_alloc (context->extradata_size); ++ ++ memcpy (GST_BUFFER_DATA (data), context->extradata, ++ context->extradata_size); ++ gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, data, NULL); ++ gst_buffer_unref (data); ++ } ++ ++ /* palette */ ++ if (context) { ++ gst_ffmpeg_set_palette (caps, context); ++ } ++ ++ GST_LOG ("caps for codec_id=%d: %" GST_PTR_FORMAT, codec_id, caps); ++ ++ } else { ++ GST_LOG ("No caps found for codec_id=%d", codec_id); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG Pixel Format and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * See below for usefullness ++ */ ++ ++GstCaps * ++gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context, ++ enum CodecID codec_id) ++{ ++ GstCaps *caps = NULL; ++ ++ int bpp = 0, depth = 0, endianness = 0; ++ gulong g_mask = 0, r_mask = 0, b_mask = 0, a_mask = 0; ++ guint32 fmt = 0; ++ ++ switch (pix_fmt) { ++ case PIX_FMT_YUVJ420P: ++ case PIX_FMT_YUV420P: ++ fmt = GST_MAKE_FOURCC ('I', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUVA420P: ++ fmt = GST_MAKE_FOURCC ('A', '4', '2', '0'); ++ break; ++ case PIX_FMT_YUYV422: ++ fmt = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); ++ break; ++ case PIX_FMT_RGB24: ++ bpp = depth = 24; ++ endianness = G_BIG_ENDIAN; ++ r_mask = 0xff0000; ++ g_mask = 0x00ff00; ++ b_mask = 0x0000ff; ++ break; ++ case PIX_FMT_BGR24: ++ bpp = depth = 24; ++ endianness = G_BIG_ENDIAN; ++ r_mask = 0x0000ff; ++ g_mask = 0x00ff00; ++ b_mask = 0xff0000; ++ break; ++ case PIX_FMT_YUVJ422P: ++ case PIX_FMT_YUV422P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '2', 'B'); ++ break; ++ case PIX_FMT_YUVJ444P: ++ case PIX_FMT_YUV444P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '4', '4'); ++ break; ++ case PIX_FMT_RGB32: ++ bpp = 32; ++ depth = 32; ++ endianness = G_BIG_ENDIAN; ++#if (G_BYTE_ORDER == G_BIG_ENDIAN) ++ r_mask = 0x00ff0000; ++ g_mask = 0x0000ff00; ++ b_mask = 0x000000ff; ++ a_mask = 0xff000000; ++#else ++ r_mask = 0x0000ff00; ++ g_mask = 0x00ff0000; ++ b_mask = 0xff000000; ++ a_mask = 0x000000ff; ++#endif ++ break; ++ case PIX_FMT_YUV410P: ++ fmt = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); ++ break; ++ case PIX_FMT_YUV411P: ++ fmt = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); ++ break; ++ case PIX_FMT_RGB565: ++ bpp = depth = 16; ++ endianness = G_BYTE_ORDER; ++ r_mask = 0xf800; ++ g_mask = 0x07e0; ++ b_mask = 0x001f; ++ break; ++ case PIX_FMT_RGB555: ++ bpp = 16; ++ depth = 15; ++ endianness = G_BYTE_ORDER; ++ r_mask = 0x7c00; ++ g_mask = 0x03e0; ++ b_mask = 0x001f; ++ break; ++ case PIX_FMT_PAL8: ++ bpp = depth = 8; ++ endianness = G_BYTE_ORDER; ++ break; ++ case PIX_FMT_GRAY8: ++ bpp = depth = 8; ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-gray", ++ "bpp", G_TYPE_INT, bpp, "depth", G_TYPE_INT, depth, NULL); ++ break; ++ default: ++ /* give up ... */ ++ break; ++ } ++ ++ if (caps == NULL) { ++ if (bpp != 0) { ++ if (r_mask != 0) { ++ if (a_mask) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "red_mask", G_TYPE_INT, r_mask, ++ "green_mask", G_TYPE_INT, g_mask, ++ "blue_mask", G_TYPE_INT, b_mask, ++ "alpha_mask", G_TYPE_INT, a_mask, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "red_mask", G_TYPE_INT, r_mask, ++ "green_mask", G_TYPE_INT, g_mask, ++ "blue_mask", G_TYPE_INT, b_mask, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ } ++ } else { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb", ++ "bpp", G_TYPE_INT, bpp, ++ "depth", G_TYPE_INT, depth, ++ "endianness", G_TYPE_INT, endianness, NULL); ++ if (caps && context) { ++ gst_ffmpeg_set_palette (caps, context); ++ } ++ } ++ } else if (fmt) { ++ caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-yuv", ++ "format", GST_TYPE_FOURCC, fmt, NULL); ++ } ++ } ++ ++ if (caps != NULL) { ++ GST_DEBUG ("caps for pix_fmt=%d: %" GST_PTR_FORMAT, pix_fmt, caps); ++ } else { ++ GST_LOG ("No caps found for pix_fmt=%d", pix_fmt); ++ } ++ ++ return caps; ++} ++ ++/* Convert a FFMPEG Sample Format and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * See below for usefullness ++ */ ++ ++static GstCaps * ++gst_ffmpeg_smpfmt_to_caps (enum AVSampleFormat sample_fmt, ++ AVCodecContext * context, enum CodecID codec_id) ++{ ++ GstCaps *caps = NULL; ++ ++ int bpp = 0; ++ gboolean integer = TRUE; ++ gboolean signedness = FALSE; ++ ++ switch (sample_fmt) { ++ case AV_SAMPLE_FMT_S16: ++ signedness = TRUE; ++ bpp = 16; ++ break; ++ ++ case AV_SAMPLE_FMT_S32: ++ signedness = TRUE; ++ bpp = 32; ++ break; ++ ++ case AV_SAMPLE_FMT_FLT: ++ integer = FALSE; ++ bpp = 32; ++ break; ++ ++ case AV_SAMPLE_FMT_DBL: ++ integer = FALSE; ++ bpp = 64; ++ break; ++ default: ++ /* .. */ ++ break; ++ } ++ ++ if (bpp) { ++ if (integer) { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-int", ++ "signed", G_TYPE_BOOLEAN, signedness, ++ "endianness", G_TYPE_INT, G_BYTE_ORDER, ++ "width", G_TYPE_INT, bpp, "depth", G_TYPE_INT, bpp, NULL); ++ } else { ++ caps = gst_ff_aud_caps_new (context, codec_id, "audio/x-raw-float", ++ "endianness", G_TYPE_INT, G_BYTE_ORDER, ++ "width", G_TYPE_INT, bpp, NULL); ++ } ++ } ++ ++ if (caps != NULL) { ++ GST_LOG ("caps for sample_fmt=%d: %" GST_PTR_FORMAT, sample_fmt, caps); ++ } else { ++ GST_LOG ("No caps found for sample_fmt=%d", sample_fmt); ++ } ++ ++ return caps; ++} ++ ++GstCaps * ++gst_ffmpeg_codectype_to_audio_caps (AVCodecContext * context, ++ enum CodecID codec_id, gboolean encode, AVCodec * codec) ++{ ++ GstCaps *caps = NULL; ++ ++ GST_DEBUG ("context:%p, codec_id:%d, encode:%d, codec:%p", ++ context, codec_id, encode, codec); ++ if (codec) ++ GST_DEBUG ("sample_fmts:%p, samplerates:%p", ++ codec->sample_fmts, codec->supported_samplerates); ++ ++ if (context) { ++ /* Specific codec context */ ++ caps = gst_ffmpeg_smpfmt_to_caps (context->sample_fmt, context, codec_id); ++ } else if (codec && codec->sample_fmts) { ++ GstCaps *temp; ++ int i; ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; codec->sample_fmts[i] != -1; i++) { ++ temp = ++ gst_ffmpeg_smpfmt_to_caps (codec->sample_fmts[i], context, codec_id); ++ if (temp != NULL) ++ gst_caps_append (caps, temp); ++ } ++ } else { ++ GstCaps *temp; ++ enum AVSampleFormat i; ++ AVCodecContext ctx = { 0, }; ++ ++ ctx.channels = -1; ++ caps = gst_caps_new_empty (); ++ for (i = 0; i <= AV_SAMPLE_FMT_DBL; i++) { ++ temp = gst_ffmpeg_smpfmt_to_caps (i, encode ? &ctx : NULL, codec_id); ++ if (temp != NULL) { ++ gst_caps_append (caps, temp); ++ } ++ } ++ } ++ return caps; ++} ++ ++GstCaps * ++gst_ffmpeg_codectype_to_video_caps (AVCodecContext * context, ++ enum CodecID codec_id, gboolean encode, AVCodec * codec) ++{ ++ GstCaps *caps; ++ ++ GST_LOG ("context:%p, codec_id:%d, encode:%d, codec:%p", ++ context, codec_id, encode, codec); ++ ++ if (context) { ++ caps = gst_ffmpeg_pixfmt_to_caps (context->pix_fmt, context, codec_id); ++ } else { ++ GstCaps *temp; ++ enum PixelFormat i; ++ AVCodecContext ctx = { 0, }; ++ ++ caps = gst_caps_new_empty (); ++ for (i = 0; i < PIX_FMT_NB; i++) { ++ ctx.width = -1; ++ ctx.pix_fmt = i; ++ temp = gst_ffmpeg_pixfmt_to_caps (i, encode ? &ctx : NULL, codec_id); ++ if (temp != NULL) { ++ gst_caps_append (caps, temp); ++ } ++ } ++ } ++ return caps; ++} ++ ++/* Convert a FFMPEG codec Type and optional AVCodecContext ++ * to a GstCaps. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the GstCaps ++ * ++ * AVMediaType is primarily meant for uncompressed data GstCaps! ++ */ ++ ++GstCaps * ++gst_ffmpeg_codectype_to_caps (enum AVMediaType codec_type, ++ AVCodecContext * context, enum CodecID codec_id, gboolean encode) ++{ ++ GstCaps *caps; ++ ++ switch (codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ caps = ++ gst_ffmpeg_codectype_to_video_caps (context, codec_id, encode, NULL); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ caps = ++ gst_ffmpeg_codectype_to_audio_caps (context, codec_id, encode, NULL); ++ break; ++ default: ++ caps = NULL; ++ break; ++ } ++ ++ return caps; ++} ++ ++/* Convert a GstCaps (audio/raw) to a FFMPEG SampleFmt ++ * and other audio properties in a AVCodecContext. ++ * ++ * For usefullness, see below ++ */ ++ ++static void ++gst_ffmpeg_caps_to_smpfmt (const GstCaps * caps, ++ AVCodecContext * context, gboolean raw) ++{ ++ GstStructure *structure; ++ gint depth = 0, width = 0, endianness = 0; ++ gboolean signedness = FALSE; ++ const gchar *name; ++ ++ g_return_if_fail (gst_caps_get_size (caps) == 1); ++ structure = gst_caps_get_structure (caps, 0); ++ ++ gst_structure_get_int (structure, "channels", &context->channels); ++ gst_structure_get_int (structure, "rate", &context->sample_rate); ++ gst_structure_get_int (structure, "block_align", &context->block_align); ++ gst_structure_get_int (structure, "bitrate", &context->bit_rate); ++ ++ if (!raw) ++ return; ++ ++ name = gst_structure_get_name (structure); ++ ++ if (!strcmp (name, "audio/x-raw-float")) { ++ /* FLOAT */ ++ if (gst_structure_get_int (structure, "width", &width) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if (endianness == G_BYTE_ORDER) { ++ if (width == 32) ++ context->sample_fmt = AV_SAMPLE_FMT_FLT; ++ else if (width == 64) ++ context->sample_fmt = AV_SAMPLE_FMT_DBL; ++ } ++ } ++ } else { ++ /* INT */ ++ if (gst_structure_get_int (structure, "width", &width) && ++ gst_structure_get_int (structure, "depth", &depth) && ++ gst_structure_get_boolean (structure, "signed", &signedness) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if ((endianness == G_BYTE_ORDER) && (signedness == TRUE)) { ++ if ((width == 16) && (depth == 16)) ++ context->sample_fmt = AV_SAMPLE_FMT_S16; ++ else if ((width == 32) && (depth == 32)) ++ context->sample_fmt = AV_SAMPLE_FMT_S32; ++ } ++ } ++ } ++} ++ ++ ++/* Convert a GstCaps (video/raw) to a FFMPEG PixFmt ++ * and other video properties in a AVCodecContext. ++ * ++ * For usefullness, see below ++ */ ++ ++static void ++gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps, ++ AVCodecContext * context, gboolean raw) ++{ ++ GstStructure *structure; ++ const GValue *fps; ++ const GValue *par = NULL; ++ ++ GST_DEBUG ("converting caps %" GST_PTR_FORMAT, caps); ++ g_return_if_fail (gst_caps_get_size (caps) == 1); ++ structure = gst_caps_get_structure (caps, 0); ++ ++ gst_structure_get_int (structure, "width", &context->width); ++ gst_structure_get_int (structure, "height", &context->height); ++ gst_structure_get_int (structure, "bpp", &context->bits_per_coded_sample); ++ ++ fps = gst_structure_get_value (structure, "framerate"); ++ if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) { ++ ++ /* somehow these seem mixed up.. */ ++ context->time_base.den = gst_value_get_fraction_numerator (fps); ++ context->time_base.num = gst_value_get_fraction_denominator (fps); ++ context->ticks_per_frame = 1; ++ ++ GST_DEBUG ("setting framerate %d/%d = %lf", ++ context->time_base.den, context->time_base.num, ++ 1. * context->time_base.den / context->time_base.num); ++ } ++ ++ par = gst_structure_get_value (structure, "pixel-aspect-ratio"); ++ if (par && GST_VALUE_HOLDS_FRACTION (par)) { ++ ++ context->sample_aspect_ratio.num = gst_value_get_fraction_numerator (par); ++ context->sample_aspect_ratio.den = gst_value_get_fraction_denominator (par); ++ ++ GST_DEBUG ("setting pixel-aspect-ratio %d/%d = %lf", ++ context->sample_aspect_ratio.den, context->sample_aspect_ratio.num, ++ 1. * context->sample_aspect_ratio.den / ++ context->sample_aspect_ratio.num); ++ } ++ ++ if (!raw) ++ return; ++ ++ g_return_if_fail (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)); ++ ++ if (strcmp (gst_structure_get_name (structure), "video/x-raw-yuv") == 0) { ++ guint32 fourcc; ++ ++ if (gst_structure_get_fourcc (structure, "format", &fourcc)) { ++ switch (fourcc) { ++ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): ++ context->pix_fmt = PIX_FMT_YUYV422; ++ break; ++ case GST_MAKE_FOURCC ('I', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUV420P; ++ break; ++ case GST_MAKE_FOURCC ('A', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUVA420P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): ++ context->pix_fmt = PIX_FMT_YUV411P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): ++ context->pix_fmt = PIX_FMT_YUV422P; ++ break; ++ case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): ++ context->pix_fmt = PIX_FMT_YUV410P; ++ break; ++#if 0 ++ case FIXME: ++ context->pix_fmt = PIX_FMT_YUV444P; ++ break; ++#endif ++ } ++ } ++ } else if (strcmp (gst_structure_get_name (structure), ++ "video/x-raw-rgb") == 0) { ++ gint bpp = 0, rmask = 0, endianness = 0; ++ ++ if (gst_structure_get_int (structure, "bpp", &bpp) && ++ gst_structure_get_int (structure, "endianness", &endianness)) { ++ if (gst_structure_get_int (structure, "red_mask", &rmask)) { ++ switch (bpp) { ++ case 32: ++#if (G_BYTE_ORDER == G_BIG_ENDIAN) ++ if (rmask == 0x00ff0000) ++#else ++ if (rmask == 0x0000ff00) ++#endif ++ context->pix_fmt = PIX_FMT_RGB32; ++ break; ++ case 24: ++ if (rmask == 0x0000FF) ++ context->pix_fmt = PIX_FMT_BGR24; ++ else ++ context->pix_fmt = PIX_FMT_RGB24; ++ break; ++ case 16: ++ if (endianness == G_BYTE_ORDER) ++ context->pix_fmt = PIX_FMT_RGB565; ++ break; ++ case 15: ++ if (endianness == G_BYTE_ORDER) ++ context->pix_fmt = PIX_FMT_RGB555; ++ break; ++ default: ++ /* nothing */ ++ break; ++ } ++ } else { ++ if (bpp == 8) { ++ context->pix_fmt = PIX_FMT_PAL8; ++ gst_ffmpeg_get_palette (caps, context); ++ } ++ } ++ } ++ } else if (strcmp (gst_structure_get_name (structure), ++ "video/x-raw-gray") == 0) { ++ gint bpp = 0; ++ ++ if (gst_structure_get_int (structure, "bpp", &bpp)) { ++ switch (bpp) { ++ case 8: ++ context->pix_fmt = PIX_FMT_GRAY8; ++ break; ++ } ++ } ++ } ++} ++ ++/* Convert a GstCaps and a FFMPEG codec Type to a ++ * AVCodecContext. If the context is ommitted, no fixed values ++ * for video/audio size will be included in the context ++ * ++ * AVMediaType is primarily meant for uncompressed data GstCaps! ++ */ ++ ++void ++gst_ffmpeg_caps_with_codectype (enum AVMediaType type, ++ const GstCaps * caps, AVCodecContext * context) ++{ ++ if (context == NULL) ++ return; ++ ++ switch (type) { ++ case AVMEDIA_TYPE_VIDEO: ++ gst_ffmpeg_caps_to_pixfmt (caps, context, TRUE); ++ break; ++ ++ case AVMEDIA_TYPE_AUDIO: ++ gst_ffmpeg_caps_to_smpfmt (caps, context, TRUE); ++ break; ++ ++ default: ++ /* unknown */ ++ break; ++ } ++} ++ ++#if 0 ++static void ++nal_escape (guint8 * dst, guint8 * src, guint size, guint * destsize) ++{ ++ guint8 *dstp = dst; ++ guint8 *srcp = src; ++ guint8 *end = src + size; ++ gint count = 0; ++ ++ while (srcp < end) { ++ if (count == 2 && *srcp <= 0x03) { ++ GST_DEBUG ("added escape code"); ++ *dstp++ = 0x03; ++ count = 0; ++ } ++ if (*srcp == 0) ++ count++; ++ else ++ count = 0; ++ ++ GST_DEBUG ("copy %02x, count %d", *srcp, count); ++ *dstp++ = *srcp++; ++ } ++ *destsize = dstp - dst; ++} ++ ++/* copy the config, escaping NAL units as we iterate them, if something fails we ++ * copy everything and hope for the best. */ ++static void ++copy_config (guint8 * dst, guint8 * src, guint size, guint * destsize) ++{ ++ guint8 *dstp = dst; ++ guint8 *srcp = src; ++ gint cnt, i; ++ guint nalsize, esize; ++ ++ /* check size */ ++ if (size < 7) ++ goto full_copy; ++ ++ /* check version */ ++ if (*srcp != 1) ++ goto full_copy; ++ ++ cnt = *(srcp + 5) & 0x1f; /* Number of sps */ ++ ++ GST_DEBUG ("num SPS %d", cnt); ++ ++ memcpy (dstp, srcp, 6); ++ srcp += 6; ++ dstp += 6; ++ ++ for (i = 0; i < cnt; i++) { ++ GST_DEBUG ("copy SPS %d", i); ++ nalsize = (srcp[0] << 8) | srcp[1]; ++ nal_escape (dstp + 2, srcp + 2, nalsize, &esize); ++ dstp[0] = esize >> 8; ++ dstp[1] = esize & 0xff; ++ dstp += esize + 2; ++ srcp += nalsize + 2; ++ } ++ ++ cnt = *(dstp++) = *(srcp++); /* Number of pps */ ++ ++ GST_DEBUG ("num PPS %d", cnt); ++ ++ for (i = 0; i < cnt; i++) { ++ GST_DEBUG ("copy PPS %d", i); ++ nalsize = (srcp[0] << 8) | srcp[1]; ++ nal_escape (dstp + 2, srcp + 2, nalsize, &esize); ++ dstp[0] = esize >> 8; ++ dstp[1] = esize & 0xff; ++ dstp += esize + 2; ++ srcp += nalsize + 2; ++ } ++ *destsize = dstp - dst; ++ ++ return; ++ ++full_copy: ++ { ++ GST_DEBUG ("something unexpected, doing full copy"); ++ memcpy (dst, src, size); ++ *destsize = size; ++ return; ++ } ++} ++#endif ++ ++/* ++ * caps_with_codecid () transforms a GstCaps for a known codec ++ * ID into a filled-in context. ++ * codec_data from caps will override possible extradata already in the context ++ */ ++ ++void ++gst_ffmpeg_caps_with_codecid (enum CodecID codec_id, ++ enum AVMediaType codec_type, const GstCaps * caps, AVCodecContext * context) ++{ ++ GstStructure *str; ++ const GValue *value; ++ const GstBuffer *buf; ++ ++ GST_LOG ("codec_id:%d, codec_type:%d, caps:%" GST_PTR_FORMAT " context:%p", ++ codec_id, codec_type, caps, context); ++ ++ if (!context || !gst_caps_get_size (caps)) ++ return; ++ ++ str = gst_caps_get_structure (caps, 0); ++ ++ /* extradata parsing (esds [mpeg4], wma/wmv, msmpeg4v1/2/3, etc.) */ ++ if ((value = gst_structure_get_value (str, "codec_data"))) { ++ guint size; ++ guint8 *data; ++ ++ buf = GST_BUFFER_CAST (gst_value_get_mini_object (value)); ++ size = GST_BUFFER_SIZE (buf); ++ data = GST_BUFFER_DATA (buf); ++ ++ /* free the old one if it is there */ ++ if (context->extradata) ++ av_free (context->extradata); ++ ++#if 0 ++ if (codec_id == CODEC_ID_H264) { ++ guint extrasize; ++ ++ GST_DEBUG ("copy, escaping codec_data %d", size); ++ /* ffmpeg h264 expects the codec_data to be escaped, there is no real ++ * reason for this but let's just escape it for now. Start by allocating ++ * enough space, x2 is more than enough. ++ * ++ * FIXME, we disabled escaping because some file already contain escaped ++ * codec_data and then we escape twice and fail. It's better to leave it ++ * as is, as that is what most players do. */ ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (size * 2 + ++ FF_INPUT_BUFFER_PADDING_SIZE)); ++ copy_config (context->extradata, data, size, &extrasize); ++ GST_DEBUG ("escaped size: %d", extrasize); ++ context->extradata_size = extrasize; ++ } else ++#endif ++ { ++ /* allocate with enough padding */ ++ GST_DEBUG ("copy codec_data"); ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (size + FF_INPUT_BUFFER_PADDING_SIZE)); ++ memcpy (context->extradata, data, size); ++ context->extradata_size = size; ++ } ++ ++ /* Hack for VC1. Sometimes the first (length) byte is 0 for some files */ ++ if (codec_id == CODEC_ID_VC1 && size > 0 && data[0] == 0) { ++ context->extradata[0] = (guint8) size; ++ } ++ ++ GST_DEBUG ("have codec data of size %d", size); ++ } else if (context->extradata == NULL && codec_id != CODEC_ID_AAC_LATM && ++ codec_id != CODEC_ID_FLAC) { ++ /* no extradata, alloc dummy with 0 sized, some codecs insist on reading ++ * extradata anyway which makes then segfault. */ ++ context->extradata = ++ av_mallocz (GST_ROUND_UP_16 (FF_INPUT_BUFFER_PADDING_SIZE)); ++ context->extradata_size = 0; ++ GST_DEBUG ("no codec data"); ++ } ++ ++ switch (codec_id) { ++ case CODEC_ID_MPEG4: ++ { ++ const gchar *mime = gst_structure_get_name (str); ++ ++ if (!strcmp (mime, "video/x-divx")) ++ context->codec_tag = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); ++ else if (!strcmp (mime, "video/x-xvid")) ++ context->codec_tag = GST_MAKE_FOURCC ('X', 'V', 'I', 'D'); ++ else if (!strcmp (mime, "video/x-3ivx")) ++ context->codec_tag = GST_MAKE_FOURCC ('3', 'I', 'V', '1'); ++ else if (!strcmp (mime, "video/mpeg")) ++ context->codec_tag = GST_MAKE_FOURCC ('m', 'p', '4', 'v'); ++ } ++ break; ++ ++ case CODEC_ID_SVQ3: ++ /* FIXME: this is a workaround for older gst-plugins releases ++ * (<= 0.8.9). This should be removed at some point, because ++ * it causes wrong decoded frame order. */ ++ if (!context->extradata) { ++ gint halfpel_flag, thirdpel_flag, low_delay, unknown_svq3_flag; ++ guint16 flags; ++ ++ if (gst_structure_get_int (str, "halfpel_flag", &halfpel_flag) || ++ gst_structure_get_int (str, "thirdpel_flag", &thirdpel_flag) || ++ gst_structure_get_int (str, "low_delay", &low_delay) || ++ gst_structure_get_int (str, "unknown_svq3_flag", ++ &unknown_svq3_flag)) { ++ context->extradata = (guint8 *) av_mallocz (0x64); ++ g_stpcpy ((gchar *) context->extradata, "SVQ3"); ++ flags = 1 << 3; ++ flags |= low_delay; ++ flags = flags << 2; ++ flags |= unknown_svq3_flag; ++ flags = flags << 6; ++ flags |= halfpel_flag; ++ flags = flags << 1; ++ flags |= thirdpel_flag; ++ flags = flags << 3; ++ ++ flags = GUINT16_FROM_LE (flags); ++ ++ memcpy ((gchar *) context->extradata + 0x62, &flags, 2); ++ context->extradata_size = 0x64; ++ } ++ } ++ break; ++ ++ case CODEC_ID_MSRLE: ++ case CODEC_ID_QTRLE: ++ case CODEC_ID_TSCC: ++ case CODEC_ID_CSCD: ++ case CODEC_ID_APE: ++ { ++ gint depth; ++ ++ if (gst_structure_get_int (str, "depth", &depth)) { ++ context->bits_per_coded_sample = depth; ++ } else { ++ GST_WARNING ("No depth field in caps %" GST_PTR_FORMAT, caps); ++ } ++ ++ } ++ break; ++ ++ case CODEC_ID_RV10: ++ case CODEC_ID_RV20: ++ case CODEC_ID_RV30: ++ case CODEC_ID_RV40: ++ { ++ gint format; ++ ++ if (gst_structure_get_int (str, "format", &format)) ++ context->sub_id = format; ++ ++ break; ++ } ++ case CODEC_ID_COOK: ++ case CODEC_ID_RA_288: ++ case CODEC_ID_RA_144: ++ case CODEC_ID_SIPR: ++ { ++ gint leaf_size; ++ gint bitrate; ++ ++ if (gst_structure_get_int (str, "leaf_size", &leaf_size)) ++ context->block_align = leaf_size; ++ if (gst_structure_get_int (str, "bitrate", &bitrate)) ++ context->bit_rate = bitrate; ++ } ++ case CODEC_ID_ALAC: ++ gst_structure_get_int (str, "samplesize", ++ &context->bits_per_coded_sample); ++ break; ++ ++ case CODEC_ID_DVVIDEO: ++ { ++ guint32 fourcc; ++ ++ if (gst_structure_get_fourcc (str, "format", &fourcc)) ++ switch (fourcc) { ++ case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): ++ context->pix_fmt = PIX_FMT_YUYV422; ++ break; ++ case GST_MAKE_FOURCC ('I', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUV420P; ++ break; ++ case GST_MAKE_FOURCC ('A', '4', '2', '0'): ++ context->pix_fmt = PIX_FMT_YUVA420P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '1', 'B'): ++ context->pix_fmt = PIX_FMT_YUV411P; ++ break; ++ case GST_MAKE_FOURCC ('Y', '4', '2', 'B'): ++ context->pix_fmt = PIX_FMT_YUV422P; ++ break; ++ case GST_MAKE_FOURCC ('Y', 'U', 'V', '9'): ++ context->pix_fmt = PIX_FMT_YUV410P; ++ break; ++ default: ++ GST_WARNING ("couldn't convert fourcc %" GST_FOURCC_FORMAT ++ " to a pixel format", GST_FOURCC_ARGS (fourcc)); ++ break; ++ } ++ break; ++ } ++ case CODEC_ID_H263P: ++ { ++ gboolean val; ++ ++ if (!gst_structure_get_boolean (str, "annex-f", &val) || val) ++ context->flags |= CODEC_FLAG_4MV; ++ else ++ context->flags &= ~CODEC_FLAG_4MV; ++ if ((!gst_structure_get_boolean (str, "annex-i", &val) || val) && ++ (!gst_structure_get_boolean (str, "annex-t", &val) || val)) ++ context->flags |= CODEC_FLAG_AC_PRED; ++ else ++ context->flags &= ~CODEC_FLAG_AC_PRED; ++ if (!gst_structure_get_boolean (str, "annex-j", &val) || val) ++ context->flags |= CODEC_FLAG_LOOP_FILTER; ++ else ++ context->flags &= ~CODEC_FLAG_LOOP_FILTER; ++ break; ++ } ++ case CODEC_ID_ADPCM_G726: ++ { ++ const gchar *layout; ++ ++ if ((layout = gst_structure_get_string (str, "layout"))) { ++ if (!strcmp (layout, "g721")) { ++ context->sample_rate = 8000; ++ context->channels = 1; ++ context->bit_rate = 32000; ++ } ++ } ++ break; ++ } ++ default: ++ break; ++ } ++ ++ if (!gst_caps_is_fixed (caps)) ++ return; ++ ++ /* common properties (width, height, fps) */ ++ switch (codec_type) { ++ case AVMEDIA_TYPE_VIDEO: ++ gst_ffmpeg_caps_to_pixfmt (caps, context, codec_id == CODEC_ID_RAWVIDEO); ++ gst_ffmpeg_get_palette (caps, context); ++ break; ++ case AVMEDIA_TYPE_AUDIO: ++ gst_ffmpeg_caps_to_smpfmt (caps, context, FALSE); ++ break; ++ default: ++ break; ++ } ++ ++ /* fixup of default settings */ ++ switch (codec_id) { ++ case CODEC_ID_QCELP: ++ /* QCELP is always mono, no matter what the caps say */ ++ context->channels = 1; ++ break; ++ default: ++ break; ++ } ++} ++ ++/* _formatid_to_caps () is meant for muxers/demuxers, it ++ * transforms a name (ffmpeg way of ID'ing these, why don't ++ * they have unique numerical IDs?) to the corresponding ++ * caps belonging to that mux-format ++ * ++ * Note: we don't need any additional info because the caps ++ * isn't supposed to contain any useful info besides the ++ * media type anyway ++ */ ++ ++GstCaps * ++gst_ffmpeg_formatid_to_caps (const gchar * format_name) ++{ ++ GstCaps *caps = NULL; ++ ++ if (!strcmp (format_name, "mpeg")) { ++ caps = gst_caps_new_simple ("video/mpeg", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "mpegts")) { ++ caps = gst_caps_new_simple ("video/mpegts", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "rm")) { ++ caps = gst_caps_new_simple ("application/x-pn-realmedia", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "asf")) { ++ caps = gst_caps_new_simple ("video/x-ms-asf", NULL); ++ } else if (!strcmp (format_name, "avi")) { ++ caps = gst_caps_new_simple ("video/x-msvideo", NULL); ++ } else if (!strcmp (format_name, "wav")) { ++ caps = gst_caps_new_simple ("audio/x-wav", NULL); ++ } else if (!strcmp (format_name, "ape")) { ++ caps = gst_caps_new_simple ("application/x-ape", NULL); ++ } else if (!strcmp (format_name, "swf")) { ++ caps = gst_caps_new_simple ("application/x-shockwave-flash", NULL); ++ } else if (!strcmp (format_name, "au")) { ++ caps = gst_caps_new_simple ("audio/x-au", NULL); ++ } else if (!strcmp (format_name, "dv")) { ++ caps = gst_caps_new_simple ("video/x-dv", ++ "systemstream", G_TYPE_BOOLEAN, TRUE, NULL); ++ } else if (!strcmp (format_name, "4xm")) { ++ caps = gst_caps_new_simple ("video/x-4xm", NULL); ++ } else if (!strcmp (format_name, "matroska")) { ++ caps = gst_caps_new_simple ("video/x-matroska", NULL); ++ } else if (!strcmp (format_name, "mp3")) { ++ caps = gst_caps_new_simple ("application/x-id3", NULL); ++ } else if (!strcmp (format_name, "flic")) { ++ caps = gst_caps_new_simple ("video/x-fli", NULL); ++ } else if (!strcmp (format_name, "flv")) { ++ caps = gst_caps_new_simple ("video/x-flv", NULL); ++ } else if (!strcmp (format_name, "tta")) { ++ caps = gst_caps_new_simple ("audio/x-ttafile", NULL); ++ } else if (!strcmp (format_name, "aiff")) { ++ caps = gst_caps_new_simple ("audio/x-aiff", NULL); ++ } else if (!strcmp (format_name, "mov_mp4_m4a_3gp_3g2")) {Lines of this file are not shown. View the raw message.
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +2
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.0.4
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Part of the diff is not shown here. View the raw message.
RFC PATCH 1/1 libav: drop older 0.8.11 and use libav-9 by default
In reply to Martin Jansa--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.11.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.13.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.11.bb
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1 -2
@@ -53,7 +53,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-qdm2-check-array-index-before-use-fix-out-of-array-a.patch \ file://0001-lavf-compute-probe-buffer-size-more-reliably.patch \ file://0001-ffserver-set-oformat.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"
@@ -80,7 +80,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
meta/recipes-multimedia/libav/libav.inc +8 -0
@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"
@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"
meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch deleted +0 -23
@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)
meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0 -20
@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "cdc9b53c56a375baf73ea38cf7ade4f9" -SRC_URI[sha256sum] = "5934e4f0dbf6e0fc4987de86cdd079f1d11a1410ae275e9f46472af17f05155a" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.13.bb +0 -12
@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" - -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.0.4
Re: [RFC][PATCH] libav: drop older 0.8.11 and use libav-9 by default
Quoted 10 lines · Martin Jansa
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.11.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.13.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.11.bb
There is at least one missing piece:
gst-ffmpeg_0.10.13.bb:DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native libpostproc"
so libpostproc recipe from meta-oe would need to be imported to oe-core
Quoted 126 lines
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1
-2@@ -53,7 +53,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-qdm2-check-array-index-before-use-fix-out-of-array-a.patch \ file://0001-lavf-compute-probe-buffer-size-more-reliably.patch \ file://0001-ffserver-set-oformat.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"@@ -80,7 +80,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"meta/recipes-multimedia/libav/libav.inc +8
-0@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch deleted +0
-23@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0
-20@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "cdc9b53c56a375baf73ea38cf7ade4f9" -SRC_URI[sha256sum] = "5934e4f0dbf6e0fc4987de86cdd079f1d11a1410ae275e9f46472af17f05155a" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"meta/recipes-multimedia/libav/libav_9.13.bb +0
-12@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" - -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"Signature · 1 line
2.0.4
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [RFC][PATCH] libav: drop older 0.8.11 and use libav-9 by default
In reply to Martin JansaQuoted 141 lines · On Friday 08 August 2014 16:06:27 Martin Jansa wrote:
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.11.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.13.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.p atch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.11.bb
(quoted diff) +0
-0b/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb index bd7b8ce..04c08cc 100644
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +0
-2@@ -53,7 +53,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-qdm2-check-array-index-before-use-fix-out-of-array-a.patch \ file://0001-lavf-compute-probe-buffer-size-more-reliably.patch \ file://0001-ffserver-set-oformat.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"@@ -80,7 +80,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"(quoted diff) +0
-0b/meta/recipes-multimedia/libav/libav.inc index 8b470c1..21c29fc 100644
meta/recipes-multimedia/libav/libav.inc +1
-0@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ +
file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ +file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" +
meta/recipes-multimedia/libav/libav.inc +3
-0+SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"diff --git a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch b/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch deleted file mode 100644
index d9b22b9..0000000
---
a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch +++/dev/nullmeta/recipes-multimedia/libav/libav.inc +0
-23@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)(quoted diff) +0
-0b/meta/recipes-multimedia/libav/libav_0.8.11.bb deleted file mode 100644 index 1344a2a..0000000
meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0
-7@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "cdc9b53c56a375baf73ea38cf7ade4f9" -SRC_URI[sha256sum] ="
5934e4f0dbf6e0fc4987de86cdd079f1d11a1410ae275e9f46472af17f05155a" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ -file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ -file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" -
meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0
-7-PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC +="^lib(av(codec|device|filter|format|util)|postproc|swscale).*" diff --git a/meta/recipes-multimedia/libav/libav_9.13.bb b/meta/recipes-multimedia/libav/libav_9.13.bb index f9c413f..e922403 100644
meta/recipes-multimedia/libav/libav_9.13.bb +0
-1@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ -
file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ -file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" -
meta/recipes-multimedia/libav/libav_9.13.bb +0
-2-SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] ="
2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" -
meta/recipes-multimedia/libav/libav_9.13.bb line 16
Quoted 4 lines
meta/recipes-multimedia/libav/libav_9.13.bb +0
-4-DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
If this works I'm definitely in favour of it.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Re: [RFC][PATCH] libav: drop older 0.8.11 and use libav-9 by default
Quoted 136 lines · Paul Eggleton
Quoted 135 lines · On Friday 08 August 2014 16:06:27 Martin Jansa wrote:
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.11.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.13.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.p atch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.11.bb
(quoted diff) +0
-0b/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb index bd7b8ce..04c08cc 100644
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +0
-2@@ -53,7 +53,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-qdm2-check-array-index-before-use-fix-out-of-array-a.patch \ file://0001-lavf-compute-probe-buffer-size-more-reliably.patch \ file://0001-ffserver-set-oformat.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"@@ -80,7 +80,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"(quoted diff) +0
-0b/meta/recipes-multimedia/libav/libav.inc index 8b470c1..21c29fc 100644
meta/recipes-multimedia/libav/libav.inc +1
-0@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ +
file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ +file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" +
meta/recipes-multimedia/libav/libav.inc +3
-0+SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"diff --git a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch b/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch deleted file mode 100644
index d9b22b9..0000000
---
a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64 .patch +++/dev/nullmeta/recipes-multimedia/libav/libav.inc +0
-23@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)(quoted diff) +0
-0b/meta/recipes-multimedia/libav/libav_0.8.11.bb deleted file mode 100644 index 1344a2a..0000000
meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0
-7@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "cdc9b53c56a375baf73ea38cf7ade4f9" -SRC_URI[sha256sum] ="
5934e4f0dbf6e0fc4987de86cdd079f1d11a1410ae275e9f46472af17f05155a" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ -file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ -file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" -
meta/recipes-multimedia/libav/libav_0.8.11.bb deleted +0
-7-PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC +="^lib(av(codec|device|filter|format|util)|postproc|swscale).*" diff --git a/meta/recipes-multimedia/libav/libav_9.13.bb b/meta/recipes-multimedia/libav/libav_9.13.bb index f9c413f..e922403 100644
meta/recipes-multimedia/libav/libav_9.13.bb +0
-1@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ -
file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ -
Quoted 13 lines
meta/recipes-multimedia/libav/libav_9.13.bb line 16
Quoted 10 lines
file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" -
meta/recipes-multimedia/libav/libav_9.13.bb +0
-2-SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] ="
2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" -meta/recipes-multimedia/libav/libav_9.13.bb +0
-4-DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"If this works I'm definitely in favour of it.
So far I've only build tested it and it builds fine.
The question is, do we want to move libpostproc in or gst-ffmpeg out?
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
In reply to Paul EggletonQuoted 12 lines · Paul Eggleton
Quoted 10 lines · On Wednesday 06 August 2014 16:37:34 Martin Jansa wrote:
Quoted 8 lines · Paul Eggleton
Quoted 6 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
Does gst-ffmpeg actually work with libav > 0.8?
No, not yet (see world status e-mails), but at least this is step in right direction IMHO and doesn't harm libav-0.8 users.
I'm just not sure gst-ffmpeg should be allowed to get past this at all if it's not currently expected to work. The known working configuration is either gst-ffmpeg + libav 0.8.x, or gstreamer1.0-libav + libav > 0.8.x.
I commented some time ago that 0.8/gst-ffmpeg should just go away... (Along with X but that's another subject). It just doesn't fit in the trend of multimedia FOSS anymore... Not that xbmc or vlc are ready for ffmpeg to go away... Sigh. Libpostproc is also an orphan in libav world, no activity since 2012. Schisms suck. But we seem to be committed to the libav bus, so keep calm and ride on.
--Tim
Re: [PATCH 1/2] gst-ffmpeg: add dependency on libpostproc
Quoted 1 line · On Friday 08 August 2014 20:00:30 Tim Orling wrote:
Quoted 1 line
On Aug 6, 2014, at 7:42 AM, Paul Eggleton <[email protected]>
Quoted 19 lines · wrote:
Quoted 10 lines
Quoted 10 lines · On Wednesday 06 August 2014 16:37:34 Martin Jansa wrote:
Quoted 9 lines · Paul Eggleton
Quoted 7 lines · On Wednesday 06 August 2014 13:41:56 Martin Jansa wrote:
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements | (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' foundQuoted 8 lines
Quoted 4 lines
Quoted 1 line
Does gst-ffmpeg actually work with libav > 0.8?
No, not yet (see world status e-mails), but at least this is step in right direction IMHO and doesn't harm libav-0.8 users.
I'm just not sure gst-ffmpeg should be allowed to get past this at all if it's not currently expected to work. The known working configuration is either gst-ffmpeg + libav 0.8.x, or gstreamer1.0-libav + libav > 0.8.x.
Quoted 6 lines
I commented some time ago that 0.8/gst-ffmpeg should just go away... (Along with X but that's another subject). It just doesn't fit in the trend of multimedia FOSS anymore... Not that xbmc or vlc are ready for ffmpeg to go away... Sigh. Libpostproc is also an orphan in libav world, no activity since 2012. Schisms suck. But we seem to be committed to the libav bus, so keep calm and ride on.
Unfortunately I don't think we can really get rid of this until we can get rid of gstreamer 0.10, and that has to stay because not everyone has moved over to gstreamer 1.0.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 2 lines · Martin Jansa
* standalone libpostproc recipe depends on libav, but current
PACKAGES_DYNAMICindicated that libav-9.13 also provides libpostproc
ping
Quoted 52 lines
Signed-off-by Martin Jansa <[email protected]>--- meta/recipes-multimedia/libav/libav.inc | 5 ----- meta/recipes-multimedia/libav/libav_0.8.11.bb | 2 ++ meta/recipes-multimedia/libav/libav_9.13.bb | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)meta/recipes-multimedia/libav/libav.inc +0
-5@@ -87,9 +87,6 @@ do_install_append() { install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/ } -FFMPEG_LIBS = "libavcodec libavdevice libavformat \ - libavutil libpostproc libswscale libavfilter" - PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" RSUGGESTS_${PN} = "mplayer"@@ -142,5 +139,3 @@ python populate_packages_prepend() { for pkg in pkgs: d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel') } - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"meta/recipes-multimedia/libav/libav_0.8.11.bb +2
-0@@ -16,3 +16,5 @@ PROVIDES += "libpostproc" EXTRA_OECONF += " \ --enable-postproc \ " + +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"meta/recipes-multimedia/libav/libav_9.13.bb +3
-0@@ -11,3 +11,6 @@ SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" DEFAULT_PREFERENCE = "-1" + +# unlike 0.8.11 we don't provide libpostproc +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"Signature · 1 line
2.0.0
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Quoted 2 lines · Martin Jansa
* standalone libpostproc recipe depends on libav, but current
PACKAGES_DYNAMICindicated that libav-9.13 also provides libpostproc
ping
Quoted 52 lines
Signed-off-by Martin Jansa <[email protected]>--- meta/recipes-multimedia/libav/libav.inc | 5 ----- meta/recipes-multimedia/libav/libav_0.8.11.bb | 2 ++ meta/recipes-multimedia/libav/libav_9.13.bb | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)meta/recipes-multimedia/libav/libav.inc +0
-5@@ -87,9 +87,6 @@ do_install_append() { install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/ } -FFMPEG_LIBS = "libavcodec libavdevice libavformat \ - libavutil libpostproc libswscale libavfilter" - PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" RSUGGESTS_${PN} = "mplayer"@@ -142,5 +139,3 @@ python populate_packages_prepend() { for pkg in pkgs: d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel') } - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"meta/recipes-multimedia/libav/libav_0.8.11.bb +2
-0@@ -16,3 +16,5 @@ PROVIDES += "libpostproc" EXTRA_OECONF += " \ --enable-postproc \ " + +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"meta/recipes-multimedia/libav/libav_9.13.bb +3
-0@@ -11,3 +11,6 @@ SRC_URI[md5sum] = "23b9e34bffdaee366710fdf20157a570" SRC_URI[sha256sum] = "2ff05df6cd2259b3bb277eb16c234214f8e0530700d0c774d033eba23edde6ca" DEFAULT_PREFERENCE = "-1" + +# unlike 0.8.11 we don't provide libpostproc +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"Signature · 1 line
2.0.0
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
PATCH v2 1/4 gst-ffmpeg: add dependency on libpostproc
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' found
--- meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1 -1
@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" LICENSE_FLAGS = "commercial" HOMEPAGE = "http://www.gstreamer.net/" -DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native" +DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native libpostproc" inherit autotools pkgconfig
Signature · 1 line
2.1.3
PATCH v2 2/4 libav: drop unused FFMPEG_LIBS and move libpostproc only to 0.8.11
* standalone libpostproc recipe depends on libav, but current PACKAGES_DYNAMIC indicated that libav-9.13 also provides libpostproc
--- meta/recipes-multimedia/libav/libav.inc | 5 ----- meta/recipes-multimedia/libav/libav_0.8.15.bb | 2 ++ meta/recipes-multimedia/libav/libav_9.16.bb | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-)
meta/recipes-multimedia/libav/libav.inc +0 -5
@@ -85,9 +85,6 @@ do_install_append() { install -m 0644 ${S}/libavfilter/*.h ${D}${includedir}/libavfilter/ } -FFMPEG_LIBS = "libavcodec libavdevice libavformat \ - libavutil libpostproc libswscale libavfilter" - PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" RSUGGESTS_${PN} = "mplayer"
@@ -140,5 +137,3 @@ python populate_packages_prepend() { for pkg in pkgs: d.appendVar('INSANE_SKIP_%s' % pkg, ' textrel') } - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_0.8.15.bb +2 -0
@@ -16,3 +16,5 @@ PROVIDES += "libpostproc" EXTRA_OECONF += " \ --enable-postproc \ " + +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.16.bb +3 -0
@@ -11,3 +11,6 @@ SRC_URI[md5sum] = "7b44b75cec24b8e7545e5029e76917e0" SRC_URI[sha256sum] = "ca846473b0b8ed8e3404c52e5e92df6d35cb5fa487eec498525de3ffda4367a0" DEFAULT_PREFERENCE = "-1" + +# unlike 0.8.11 we don't provide libpostproc +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.1.3
PATCH v2 3/4 libav: drop older 0.8.11 and use libav-9 by default
In reply to Martin Jansa--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.15.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.16.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.15.bb
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1 -2
@@ -57,7 +57,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-h264-skip-error-concealment-when-SPS-and-slices-are-.patch \ file://0001-avcodec-smc-fix-off-by-1-error.patch \ file://0002-avcodec-mjpegdec-check-bits-per-pixel-for-changes-si.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"
@@ -84,7 +84,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
meta/recipes-multimedia/libav/libav.inc +8 -0
@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"
@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"
meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch deleted +0 -23
@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)
meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0 -20
@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "e483ea8f482b5ecd65ee1d09251b0a5b" -SRC_URI[sha256sum] = "495789ec547e93632937f0f36b06f4dd3180bc61518181f124af6746c6218710" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.16.bb +0 -12
@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "7b44b75cec24b8e7545e5029e76917e0" SRC_URI[sha256sum] = "ca846473b0b8ed8e3404c52e5e92df6d35cb5fa487eec498525de3ffda4367a0" - -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.1.3
Re: [PATCHv2 3/4] libav: drop older 0.8.11 and use libav-9 by default
Hi Martin,
Can this be squashed with the previous patch which makes changes to libav 0.8? Merging the .inc and .bb together seems sensible too, especially as the .inc contains the checksums so isn't actually useful for multiple versions. Also theres a version typo in the commit shortlog.
Ross
Quoted 173 lines · Martin Jansa
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.15.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.16.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.15.bbmeta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +0
-1@@ -57,7 +57,7 @@ SRC_URI = " http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-h264-skip-error-concealment-when-SPS-and-slices-are-.patch \ file://0001-avcodec-smc-fix-off-by-1-error.patch \ file://0002-avcodec-mjpegdec-check-bits-per-pixel-for-changes-si.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9','file://libav-9.patch', '', d)} \
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1
-1+ file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"@@ -84,7 +84,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"meta/recipes-multimedia/libav/libav.inc +4
-0@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ +file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
meta/recipes-multimedia/libav/libav.inc +4
-0+ +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"diff --git
a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patchb/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patchdeleted file mode 100644
index d9b22b9..0000000
---a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch+++/dev/nullmeta/recipes-multimedia/libav/libav.inc +0
-23@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-7@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "e483ea8f482b5ecd65ee1d09251b0a5b" -SRC_URI[sha256sum] ="
495789ec547e93632937f0f36b06f4dd3180bc61518181f124af6746c6218710"meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-2- -LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
- file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \
- file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-8- -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC +="^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.16.bb +0
-3@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ -file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
- file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"meta/recipes-multimedia/libav/libav_9.16.bb +0
-3- -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "7b44b75cec24b8e7545e5029e76917e0" SRC_URI[sha256sum] ="
ca846473b0b8ed8e3404c52e5e92df6d35cb5fa487eec498525de3ffda4367a0"meta/recipes-multimedia/libav/libav_9.16.bb +0
-6- -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" --2.1.3
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCHv2 3/4] libav: drop older 0.8.11 and use libav-9 by default
Quoted 4 lines · Ross
Hi Martin,
Can this be squashed with the previous patch which makes changes to libav 0.8?
I would prefer to keep it separate, because 0.8 fix can be applied even without removing 0.8* version.
Quoted 3 lines
Merging the .inc and .bb together seems sensible too, especially as the .inc contains the checksums so isn't actually useful for multiple versions.
If I see correctly it only has LIC_FILES_CHKSUMs which can be shared for multiple versions and with some people being afraid about 9* compatibility with other projects I would keep .inc (in case someone will need to restore 0.8 in own layer for some weird dependency.
Quoted 1 line
Also theres a version typo in the commit shortlog.
You mean 0.8.11 version instead of 0.8.15? It's not a typo, I just forgot to update it when rebasing (there wasn't 0.8.15 when I was sending this patch on Aug 8)
http://lists.openembedded.org/pipermail/openembedded-core/2014-August/095507.html
Quoted 176 lines
Ross
Quoted 173 lines · Martin Jansa
Signed-off-by Martin Jansa <[email protected]>--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.15.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.16.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.15.bbmeta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +0
-1@@ -57,7 +57,7 @@ SRC_URI = " http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-h264-skip-error-concealment-when-SPS-and-slices-are-.patch \ file://0001-avcodec-smc-fix-off-by-1-error.patch \ file://0002-avcodec-mjpegdec-check-bits-per-pixel-for-changes-si.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9','file://libav-9.patch', '', d)} \
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1
-1+ file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"@@ -84,7 +84,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"meta/recipes-multimedia/libav/libav.inc +4
-0@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ +file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"
meta/recipes-multimedia/libav/libav.inc +4
-0+ +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"diff --git
a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patchb/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patchdeleted file mode 100644
index d9b22b9..0000000
---a/meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch+++/dev/nullmeta/recipes-multimedia/libav/libav.inc +0
-23@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-7@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "e483ea8f482b5ecd65ee1d09251b0a5b" -SRC_URI[sha256sum] ="
495789ec547e93632937f0f36b06f4dd3180bc61518181f124af6746c6218710"meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-2- -LIC_FILES_CHKSUM ="file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
- file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \
- file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \
- file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0
-8- -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC +="^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.16.bb +0
-3@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ -file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \
- file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02"meta/recipes-multimedia/libav/libav_9.16.bb +0
-3- -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "7b44b75cec24b8e7545e5029e76917e0" SRC_URI[sha256sum] ="
ca846473b0b8ed8e3404c52e5e92df6d35cb5fa487eec498525de3ffda4367a0"meta/recipes-multimedia/libav/libav_9.16.bb +0
-6- -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" --2.1.3
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
PATCH v3 1/1 libav: drop older 0.8.* and use libav-9 by default
In reply to Burton, Ross--- .../gstreamer/gst-ffmpeg_0.10.13.bb | 3 +-- meta/recipes-multimedia/libav/libav.inc | 8 ++++++++ .../0001-configure-enable-pic-for-AArch64.patch | 23 ---------------------- meta/recipes-multimedia/libav/libav_0.8.15.bb | 20 ------------------- meta/recipes-multimedia/libav/libav_9.16.bb | 12 ----------- 5 files changed, 9 insertions(+), 57 deletions(-) delete mode 100644 meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch delete mode 100644 meta/recipes-multimedia/libav/libav_0.8.15.bb
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1 -2
@@ -57,7 +57,7 @@ SRC_URI = "http://gstreamer.freedesktop.org/src/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0001-h264-skip-error-concealment-when-SPS-and-slices-are-.patch \ file://0001-avcodec-smc-fix-off-by-1-error.patch \ file://0002-avcodec-mjpegdec-check-bits-per-pixel-for-changes-si.patch \ - ${@bb.utils.contains('PACKAGECONFIG', 'libav9', 'file://libav-9.patch', '', d)} \ + file://libav-9.patch \ " SRC_URI[md5sum] = "7f5beacaf1312db2db30a026b36888c4"
@@ -84,7 +84,6 @@ EXTRA_OECONF = "${FFMPEG_EXTRA_CONFIGURE_COMMON}" PACKAGECONFIG ??= "external-libav" PACKAGECONFIG[external-libav] = "--with-system-ffmpeg,,libav" PACKAGECONFIG[orc] = "--enable-orc,--disable-orc,orc" -PACKAGECONFIG[libav9] = ",,," FILES_${PN} += "${libdir}/gstreamer-0.10/*.so" FILES_${PN}-dbg += "${libdir}/gstreamer-0.10/.debug"
meta/recipes-multimedia/libav/libav.inc +8 -0
@@ -10,6 +10,13 @@ SECTION = "libs" LICENSE = "GPLv2+" LICENSE_FLAGS = "commercial" +LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ + file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ + file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" + +SRC_URI = "http://libav.org/releases/${BP}.tar.xz" + # Provides ffmpeg compat, see http://libav.org/about.html PROVIDES = "ffmpeg"
@@ -86,6 +93,7 @@ do_install_append() { } PACKAGES += "${PN}-vhook-dbg ${PN}-vhook ffmpeg-x264-presets" +PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*" RSUGGESTS_${PN} = "mplayer" FILES_${PN} = "${bindir}"
meta/recipes-multimedia/libav/libav/0001-configure-enable-pic-for-AArch64.patch deleted +0 -23
@@ -1,23 +0,0 @@ -From 58db99e98f615d79ea90cac8f4bcf11c94e3e7c7 Mon Sep 17 00:00:00 2001 -From: Marcin Juszkiewicz <[email protected]> -Date: Thu, 10 Jan 2013 12:42:19 +0100 -Subject: [PATCH] configure: enable pic for AArch64 - -Signed-off-by: Marcin Juszkiewicz <[email protected]> - -Upstream-Status: Backport ---- - configure | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- git.orig/configure -+++ git/configure -@@ -2393,7 +2393,7 @@ check_host_cflags -std=c99 - check_host_cflags -Wall - - case "$arch" in -- alpha|ia64|mips|parisc|ppc|sparc) -+ alpha|ia64|mips|parisc|ppc|sparc|aarch64) - spic=$shared - ;; - x86)
meta/recipes-multimedia/libav/libav_0.8.15.bb deleted +0 -20
@@ -1,20 +0,0 @@ -require libav.inc - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz \ - file://0001-configure-enable-pic-for-AArch64.patch" - -SRC_URI[md5sum] = "e483ea8f482b5ecd65ee1d09251b0a5b" -SRC_URI[sha256sum] = "495789ec547e93632937f0f36b06f4dd3180bc61518181f124af6746c6218710" - -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=e344c8fa836c3a41c4cbd79d7bd3a379 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -PROVIDES += "libpostproc" - -EXTRA_OECONF += " \ - --enable-postproc \ -" - -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|postproc|swscale).*"
meta/recipes-multimedia/libav/libav_9.16.bb +0 -12
@@ -1,16 +1,4 @@ require libav.inc -LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ - file://COPYING.GPLv3;md5=d32239bcb673463ab874e80d47fae504 \ - file://COPYING.LGPLv2.1;md5=bd7a443320af8c812e4c18d1b79df004 \ - file://COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" - -SRC_URI = "http://libav.org/releases/${BP}.tar.xz" - SRC_URI[md5sum] = "7b44b75cec24b8e7545e5029e76917e0" SRC_URI[sha256sum] = "ca846473b0b8ed8e3404c52e5e92df6d35cb5fa487eec498525de3ffda4367a0" - -DEFAULT_PREFERENCE = "-1" - -# unlike 0.8.11 we don't provide libpostproc -PACKAGES_DYNAMIC += "^lib(av(codec|device|filter|format|util)|swscale).*"
Signature · 1 line
2.2.0
PATCH v2 4/4 libpostproc: import from meta-oe
In reply to Martin Jansa--- meta/recipes-multimedia/libav/libpostproc_git.bb | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 meta/recipes-multimedia/libav/libpostproc_git.bb
meta/recipes-multimedia/libav/libpostproc_git.bb new file +43 -0
@@ -0,0 +1,43 @@ +SUMMARY = "FFmpeg derived postprocessing library" +HOMEPAGE = "http://git.videolan.org/?p=libpostproc.git;a=summary" +SECTION = "libs" +DEPENDS = "libav" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" + +PV = "52.3.0+git${SRCPV}" + +SRCREV = "811db3b957dfde24aef2d0f82e297e5bf552d873" +SRC_URI = "git://github.com/lu-zero/postproc;protocol=https" + +S = "${WORKDIR}/git" + +inherit autotools lib_package pkgconfig + +FULL_OPTIMIZATION_armv7a = "-fexpensive-optimizations -fomit-frame-pointer -O4 -ffast-math" +BUILD_OPTIMIZATION = "${FULL_OPTIMIZATION}" + +EXTRA_FFCONF_armv7a = "--cpu=cortex-a8" +EXTRA_FFCONF ?= "" + +EXTRA_OECONF = " \ + --enable-shared \ + --enable-pthreads \ + --enable-gpl \ + --enable-postproc \ + \ + --cross-prefix=${TARGET_PREFIX} \ + --prefix=${prefix} \ + \ + --arch=${TARGET_ARCH} \ + --target-os="linux" \ + --enable-cross-compile \ + --extra-cflags="${TARGET_CFLAGS} ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}" \ + --extra-ldflags="${TARGET_LDFLAGS}" \ + --sysroot="${STAGING_DIR_TARGET}" \ + ${EXTRA_FFCONF} \ +" + +do_configure() { + ${S}/configure ${EXTRA_OECONF} +}
Signature · 1 line
2.1.3
Re: [PATCHv2 4/4] libpostproc: import from meta-oe
Quoted 2 lines · Martin Jansa
+DEPENDS = "libav"
In a world build:
ERROR: Nothing PROVIDES 'libav' (but /home/pokybuild/yocto-autobuilder/yocto-worker/nightly-intel-gpl/build/meta/recipes-multimedia/libav/ libpostproc_git.bb DEPENDS on or otherwise requires it)
ERROR: libav was skipped: because it has a restricted license not
whitelisted in LICENSE_FLAGS_WHITELIST
Not sure what's best here: maybe add the commercial license to libpostproc with a comment explaining why?
Ross
Re: [PATCHv2 1/4] gst-ffmpeg: add dependency on libpostproc
In reply to Martin JansaQuoted 15 lines · Martin Jansa
* building with libav-9 fails with:
| checking for POSTPROC... configure: error: Package requirements (libpostproc libavcodec libavutil) were not met: | | No package 'libpostproc' foundSigned-off-by Martin Jansa <[email protected]>--- meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +0
-0
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ · line 17
Quoted 7 lines
meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb +1
-1@@ -12,7 +12,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ file://gst-libs/ext/libav/COPYING.LGPLv3;md5=e6a600fd5e1d9cbde2d983680233ad02" LICENSE_FLAGS = "commercial" HOMEPAGE = "http://www.gstreamer.net/" -DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native" +DEPENDS = "gstreamer gst-plugins-base zlib bzip2 yasm-native libpostproc" inherit autotools pkgconfig
Ping, this patchset is stalled since August 2014 :/
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]