mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
avvidenc: Classify image encoders with "Image" instead of "Video"
This allows gst_video_convert_sample*() to work with codecs for which we have libav encoders (such as BMP). https://bugzilla.gnome.org/show_bug.cgi?id=780317
This commit is contained in:
parent
fecf973bc9
commit
2e25f166fc
3 changed files with 35 additions and 1 deletions
|
@ -721,6 +721,30 @@ gst_ff_aud_caps_new (AVCodecContext * context, AVCodec * codec,
|
|||
return caps;
|
||||
}
|
||||
|
||||
/* Check if the given codec ID is an image format -- for now this is just
|
||||
* anything whose caps is image/... */
|
||||
gboolean
|
||||
gst_ffmpeg_codecid_is_image (enum AVCodecID codec_id)
|
||||
{
|
||||
switch (codec_id) {
|
||||
case AV_CODEC_ID_MJPEG:
|
||||
case AV_CODEC_ID_LJPEG:
|
||||
case AV_CODEC_ID_GIF:
|
||||
case AV_CODEC_ID_PPM:
|
||||
case AV_CODEC_ID_PBM:
|
||||
case AV_CODEC_ID_PCX:
|
||||
case AV_CODEC_ID_SGI:
|
||||
case AV_CODEC_ID_TARGA:
|
||||
case AV_CODEC_ID_TIFF:
|
||||
case AV_CODEC_ID_SUNRAST:
|
||||
case AV_CODEC_ID_BMP:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -67,6 +67,12 @@ gst_ffmpeg_compliance_get_type (void);
|
|||
#define GST_TYPE_FFMPEG_COMPLIANCE (gst_ffmpeg_compliance_get_type ())
|
||||
#define FFMPEG_DEFAULT_COMPLIANCE GST_FFMPEG_NORMAL
|
||||
|
||||
/*
|
||||
* _codecid_is_image() returns TRUE for image formats
|
||||
*/
|
||||
gboolean
|
||||
gst_ffmpeg_codecid_is_image (enum AVCodecID codec_id);
|
||||
|
||||
/*
|
||||
* _codecid_to_caps () gets the GstCaps that belongs to
|
||||
* a certain CodecID for a pad with compressed data.
|
||||
|
|
|
@ -126,6 +126,7 @@ gst_ffmpegvidenc_base_init (GstFFMpegVidEncClass * klass)
|
|||
GstPadTemplate *srctempl = NULL, *sinktempl = NULL;
|
||||
GstCaps *srccaps = NULL, *sinkcaps = NULL;
|
||||
gchar *longname, *description;
|
||||
const gchar *klass;
|
||||
|
||||
in_plugin =
|
||||
(AVCodec *) g_type_get_qdata (G_OBJECT_CLASS_TYPE (klass),
|
||||
|
@ -135,8 +136,11 @@ gst_ffmpegvidenc_base_init (GstFFMpegVidEncClass * klass)
|
|||
/* construct the element details struct */
|
||||
longname = g_strdup_printf ("libav %s encoder", in_plugin->long_name);
|
||||
description = g_strdup_printf ("libav %s encoder", in_plugin->name);
|
||||
klass =
|
||||
gst_ffmpeg_codecid_is_image (in_plugin->id) ? "Codec/Encoder/Image" :
|
||||
"Codec/Encoder/Video";
|
||||
gst_element_class_set_metadata (element_class, longname,
|
||||
"Codec/Encoder/Video", description,
|
||||
klass, description,
|
||||
"Wim Taymans <wim.taymans@gmail.com>, "
|
||||
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
||||
g_free (longname);
|
||||
|
|
Loading…
Reference in a new issue