From f831c4a7cd62fed3a1b58100d7a8a6be59e12071 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Fri, 7 Jan 2005 10:15:20 +0000 Subject: ext/faac/gstfaac.*: Allow for ADTS output (#153434). Original commit message from CVS: Reviewed by: Ronald S. Bultje * ext/faac/gstfaac.c: (gst_faac_outputformat_get_type), (gst_faac_class_init), (gst_faac_init), (gst_faac_srcconnect), (gst_faac_set_property), (gst_faac_get_property): * ext/faac/gstfaac.h: Allow for ADTS output (#153434). --- ext/faac/gstfaac.c | 43 +++++++++++++++++++++++++++++++++---------- ext/faac/gstfaac.h | 3 ++- 2 files changed, 35 insertions(+), 11 deletions(-) (limited to 'ext/faac') diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c index 8d558c7a..c5148773 100644 --- a/ext/faac/gstfaac.c +++ b/ext/faac/gstfaac.c @@ -41,6 +41,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", enum { ARG_0, + ARG_OUTPUTFORMAT, ARG_BITRATE, ARG_PROFILE, ARG_TNS, @@ -156,6 +157,26 @@ gst_faac_shortctl_get_type (void) return gst_faac_shortctl_type; } +#define GST_TYPE_FAAC_OUTPUTFORMAT (gst_faac_outputformat_get_type ()) +static GType +gst_faac_outputformat_get_type (void) +{ + static GType gst_faac_outputformat_type = 0; + + if (!gst_faac_outputformat_type) { + static GEnumValue gst_faac_outputformat[] = { + {0, "OUTPUTFORMAT_RAW", "Raw AAC"}, + {1, "OUTPUTFORMAT_ADTS", "ADTS headers"}, + {0, NULL, NULL}, + }; + + gst_faac_outputformat_type = g_enum_register_static ("GstFaacOutputFormat", + gst_faac_outputformat); + } + + return gst_faac_outputformat_type; +} + static void gst_faac_class_init (GstFaacClass * klass) { @@ -181,6 +202,10 @@ gst_faac_class_init (GstFaacClass * klass) g_param_spec_enum ("shortctl", "Block type", "Block type encorcing", GST_TYPE_FAAC_SHORTCTL, MAIN, G_PARAM_READWRITE)); + g_object_class_install_property (gobject_class, ARG_OUTPUTFORMAT, + g_param_spec_enum ("outputformat", "Output format", + "Format of output frames", + GST_TYPE_FAAC_OUTPUTFORMAT, MAIN, G_PARAM_READWRITE)); /* virtual functions */ gstelement_class->change_state = gst_faac_change_state; @@ -218,6 +243,7 @@ gst_faac_init (GstFaac * faac) faac->bitrate = 1024 * 128; faac->profile = MAIN; faac->shortctl = SHORTCTL_NORMAL; + faac->outputformat = 0; faac->tns = FALSE; faac->midside = TRUE; } @@ -326,16 +352,7 @@ gst_faac_srcconnect (GstPad * pad, const GstCaps * caps) conf->useTns = faac->tns; conf->bitRate = faac->bitrate; conf->inputFormat = faac->format; - - /* FIXME: this one here means that we do not support direct - * "MPEG audio file" output (like mp3). This means we can - * only mux this into mov/qt (mp4a) or matroska or so. If - * we want to support direct AAC file output, we need ADTS - * headers, and we need to find a way in the caps to detect - * that (that the next element is filesink or any element - * that does want ADTS headers). */ - - conf->outputFormat = 0; /* raw, no ADTS headers */ + conf->outputFormat = faac->outputformat; conf->shortctl = faac->shortctl; if (!faacEncSetConfiguration (faac->handle, conf)) { GST_WARNING ("Faac doesn't support the current conf"); @@ -547,6 +564,9 @@ gst_faac_set_property (GObject * object, case ARG_SHORTCTL: faac->shortctl = g_value_get_enum (value); break; + case ARG_OUTPUTFORMAT: + faac->outputformat = g_value_get_enum (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -575,6 +595,9 @@ gst_faac_get_property (GObject * object, case ARG_SHORTCTL: g_value_set_enum (value, faac->shortctl); break; + case ARG_OUTPUTFORMAT: + g_value_set_enum (value, faac->outputformat); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/ext/faac/gstfaac.h b/ext/faac/gstfaac.h index 55daea67..b45f849e 100644 --- a/ext/faac/gstfaac.h +++ b/ext/faac/gstfaac.h @@ -49,7 +49,8 @@ typedef struct _GstFaac { bps, bitrate, profile, - shortctl; + shortctl, + outputformat; gboolean tns, midside; gulong bytes, -- cgit v1.2.1