Commit 2e25f166 authored by Arun Raghavan's avatar Arun Raghavan

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
parent fecf973b
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment