PROP_0,
PROP_BIT_RATE,
PROP_RTP_PAYLOAD_SIZE,
+ PROP_COMPLIANCE,
};
/* A number of function prototypes are given so we can refer to them later. */
g_param_spec_int ("bitrate", "Bit Rate",
"Target Audio Bitrate", 0, G_MAXINT, DEFAULT_AUDIO_BITRATE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COMPLIANCE,
+ g_param_spec_enum ("compliance", "Compliance",
+ "Adherence of the encoder to the specifications",
+ GST_TYPE_FFMPEG_COMPLIANCE, FFMPEG_DEFAULT_COMPLIANCE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gobject_class->finalize = gst_ffmpegaudenc_finalize;
ffmpegaudenc->context = avcodec_alloc_context3 (klass->in_plugin);
ffmpegaudenc->opened = FALSE;
+ ffmpegaudenc->compliance = FFMPEG_DEFAULT_COMPLIANCE;
+
gst_audio_encoder_set_drainable (GST_AUDIO_ENCODER (ffmpegaudenc), TRUE);
}
}
/* if we set it in _getcaps we should set it also in _link */
- ffmpegaudenc->context->strict_std_compliance = -1;
+ ffmpegaudenc->context->strict_std_compliance = ffmpegaudenc->compliance;
/* user defined properties */
if (ffmpegaudenc->bitrate > 0) {
case PROP_RTP_PAYLOAD_SIZE:
ffmpegaudenc->rtp_payload_size = g_value_get_int (value);
break;
+ case PROP_COMPLIANCE:
+ ffmpegaudenc->compliance = g_value_get_enum (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_RTP_PAYLOAD_SIZE:
g_value_set_int (value, ffmpegaudenc->rtp_payload_size);
break;
+ case PROP_COMPLIANCE:
+ g_value_set_enum (value, ffmpegaudenc->compliance);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
/* cache */
gint bitrate;
gint rtp_payload_size;
+ gint compliance;
/* other settings are copied over straight,
* include a context here, rather than copy-and-past it from avcodec.h */
AV_CH_STEREO_RIGHT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT}
};
+GType
+gst_ffmpeg_compliance_get_type (void)
+{
+ static GType ffmpeg_compliance_type = 0;
+ static const GEnumValue compliance_types[] = {
+ {GST_FFMPEG_VERY_STRICT, "Strictly conform to older spec",
+ "verystrict"},
+ {GST_FFMPEG_STRICT, "Strictly conform to current spec", "strict"},
+ {GST_FFMPEG_NORMAL, "Normal behavior", "normal"},
+ {GST_FFMPEG_UNOFFICIAL, "Allow unofficial extensions", "unofficial"},
+ {GST_FFMPEG_EXPERIMENTAL, "Allow nonstandardized experimental things",
+ "experimental"},
+ {0, NULL, NULL}
+ };
+
+ if (!ffmpeg_compliance_type) {
+ ffmpeg_compliance_type =
+ g_enum_register_static ("GstFFMpegCompliance", compliance_types);
+ }
+ return ffmpeg_compliance_type;
+}
+
static guint64
gst_ffmpeg_channel_positions_to_layout (GstAudioChannelPosition * pos,
gint channels)
#include <gst/audio/audio.h>
#include <gst/video/video.h>
+/**
+ * GstFFMpegCompliance:
+ * @GST_FFMPEG_VERY_STRICT: Strictly conform to an older
+ * more strict version of the spec or reference software
+ * @GST_FFMPEG_STRICT: Strictly conform to all the things
+ * in the spec no matter what consequences.
+ * @GST_FFMPEG_NORMAL:
+ * @GST_FFMPEG_UNOFFICIAL: Allow unofficial extensions
+ * @GST_FFMPEG_EXPERIMENTAL: Allow nonstandardized
+ * experimental things.
+ *
+ * This setting instructs libav on how strictly it should follow the
+ * associated standard.
+ *
+ * From avcodec.h:
+ * Setting this to STRICT or higher means the encoder and decoder will
+ * generally do stupid things, whereas setting it to unofficial or lower
+ * will mean the encoder might produce output that is not supported by all
+ * spec-compliant decoders. Decoders don't differentiate between normal,
+ * unofficial and experimental (that is, they always try to decode things
+ * when they can) unless they are explicitly asked to behave stupidly
+ * (=strictly conform to the specs)
+ */
+typedef enum {
+ GST_FFMPEG_VERY_STRICT = FF_COMPLIANCE_VERY_STRICT,
+ GST_FFMPEG_STRICT = FF_COMPLIANCE_STRICT,
+ GST_FFMPEG_NORMAL = FF_COMPLIANCE_NORMAL,
+ GST_FFMPEG_UNOFFICIAL = FF_COMPLIANCE_UNOFFICIAL,
+ GST_FFMPEG_EXPERIMENTAL = FF_COMPLIANCE_EXPERIMENTAL,
+} GstFFMpegCompliance;
+
+/*
+ * _compliance_get_type () Returns an enum type that can be
+ * used as a property to indicate desired FFMpeg adherence to
+ * an associated specification
+ */
+
+GType
+gst_ffmpeg_compliance_get_type (void);
+#define GST_TYPE_FFMPEG_COMPLIANCE (gst_ffmpeg_compliance_get_type ())
+#define FFMPEG_DEFAULT_COMPLIANCE GST_FFMPEG_NORMAL
+
/*
* _codecid_to_caps () gets the GstCaps that belongs to
* a certain CodecID for a pad with compressed data.
PROP_ME_METHOD,
PROP_BUFSIZE,
PROP_RTP_PAYLOAD_SIZE,
- PROP_CFG_BASE
+ PROP_CFG_BASE,
+ PROP_COMPLIANCE,
};
#define GST_TYPE_ME_METHOD (gst_ffmpegvidenc_me_method_get_type())
"RTP Payload Size", "Target GOB length", 0, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_COMPLIANCE,
+ g_param_spec_enum ("compliance", "Compliance",
+ "Adherence of the encoder to the specifications",
+ GST_TYPE_FFMPEG_COMPLIANCE, FFMPEG_DEFAULT_COMPLIANCE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/* register additional properties, possibly dependent on the exact CODEC */
- gst_ffmpeg_cfg_install_property (klass, PROP_CFG_BASE);
+ gst_ffmpeg_cfg_install_property (klass, PROP_COMPLIANCE);
venc_class->start = gst_ffmpegvidenc_start;
venc_class->stop = gst_ffmpegvidenc_stop;
ffmpegenc->buffer_size = 512 * 1024;
ffmpegenc->gop_size = DEFAULT_VIDEO_GOP_SIZE;
ffmpegenc->rtp_payload_size = 0;
+ ffmpegenc->compliance = FFMPEG_DEFAULT_COMPLIANCE;
ffmpegenc->lmin = 2;
ffmpegenc->lmax = 31;
}
/* if we set it in _getcaps we should set it also in _link */
- ffmpegenc->context->strict_std_compliance = -1;
+ ffmpegenc->context->strict_std_compliance = ffmpegenc->compliance;
/* user defined properties */
ffmpegenc->context->bit_rate = ffmpegenc->bitrate;
case PROP_RTP_PAYLOAD_SIZE:
ffmpegenc->rtp_payload_size = g_value_get_int (value);
break;
+ case PROP_COMPLIANCE:
+ ffmpegenc->compliance = g_value_get_enum (value);
+ break;
default:
if (!gst_ffmpeg_cfg_set_property (object, value, pspec))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
case PROP_RTP_PAYLOAD_SIZE:
g_value_set_int (value, ffmpegenc->rtp_payload_size);
break;
+ case PROP_COMPLIANCE:
+ g_value_set_enum (value, ffmpegenc->compliance);
+ break;
default:
if (!gst_ffmpeg_cfg_get_property (object, value, pspec))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
gint gop_size;
gint buffer_size;
gint rtp_payload_size;
+ gint compliance;
guint8 *working_buf;
gsize working_buf_size;