mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
-good: port to new audio caps
This commit is contained in:
parent
24df106272
commit
e204c5934c
15 changed files with 106 additions and 146 deletions
|
@ -50,9 +50,9 @@ typedef jack_default_audio_sample_t sample_t;
|
||||||
#define GST_TYPE_JACK_CLIENT (gst_jack_client_get_type ())
|
#define GST_TYPE_JACK_CLIENT (gst_jack_client_get_type ())
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define GST_JACK_FORMAT_STR "F32_LE"
|
#define GST_JACK_FORMAT_STR "F32LE"
|
||||||
#else
|
#else
|
||||||
#define GST_JACK_FORMAT_STR "F32_BE"
|
#define GST_JACK_FORMAT_STR "F32BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GType gst_jack_client_get_type(void);
|
GType gst_jack_client_get_type(void);
|
||||||
|
|
|
@ -1717,11 +1717,11 @@ static GstStateChangeReturn gst_pulsesink_change_state (GstElement * element,
|
||||||
GstStateChange transition);
|
GstStateChange transition);
|
||||||
|
|
||||||
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
||||||
# define FORMATS "{ S16_LE, S16_BE, F32_LE, F32_BE, S32_LE, S32_BE, " \
|
# define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, " \
|
||||||
"S24_3LE, S24_3BE, S24_LE, S24_BE, S8 }"
|
"S24LE, S24BE, S24_32LE, S24_32BE, S8 }"
|
||||||
#else
|
#else
|
||||||
# define FORMATS "{ S16_BE, S16_LE, F32_BE, F32_LE, S32_BE, S32_LE, " \
|
# define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, " \
|
||||||
"S24_3BE, S24_3LE, S24_BE, S24_LE, S8 }"
|
"S24BE, S24LE, S24_32BE, S24_32LE, S8 }"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
|
|
@ -99,9 +99,9 @@ static GstStateChangeReturn gst_pulsesrc_change_state (GstElement *
|
||||||
element, GstStateChange transition);
|
element, GstStateChange transition);
|
||||||
|
|
||||||
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
||||||
# define FORMATS "{ S16_LE, S16_BE, F32_LE, F32_BE, S32_LE, S32_BE, U8 }"
|
# define FORMATS "{ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, U8 }"
|
||||||
#else
|
#else
|
||||||
# define FORMATS "{ S16_BE, S16_LE, F32_BE, F32_LE, S32_BE, S32_LE, U8 }"
|
# define FORMATS "{ S16BE, S16LE, F32BE, F32LE, S32BE, S32LE, U8 }"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate pad_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
@ -1084,7 +1084,7 @@ gst_pulsesrc_success_cb (pa_stream * s, int success, void *userdata)
|
||||||
{
|
{
|
||||||
GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (userdata);
|
GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (userdata);
|
||||||
|
|
||||||
pulsesrc->operation_success = ! !success;
|
pulsesrc->operation_success = !!success;
|
||||||
pa_threaded_mainloop_signal (pulsesrc->mainloop, 0);
|
pa_threaded_mainloop_signal (pulsesrc->mainloop, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,34 +98,34 @@ gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss)
|
||||||
case GST_AUDIO_FORMAT_U8:
|
case GST_AUDIO_FORMAT_U8:
|
||||||
ss->format = PA_SAMPLE_U8;
|
ss->format = PA_SAMPLE_U8;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S16_LE:
|
case GST_AUDIO_FORMAT_S16LE:
|
||||||
ss->format = PA_SAMPLE_S16LE;
|
ss->format = PA_SAMPLE_S16LE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S16_BE:
|
case GST_AUDIO_FORMAT_S16BE:
|
||||||
ss->format = PA_SAMPLE_S16BE;
|
ss->format = PA_SAMPLE_S16BE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_F32_LE:
|
case GST_AUDIO_FORMAT_F32LE:
|
||||||
ss->format = PA_SAMPLE_FLOAT32LE;
|
ss->format = PA_SAMPLE_FLOAT32LE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_F32_BE:
|
case GST_AUDIO_FORMAT_F32BE:
|
||||||
ss->format = PA_SAMPLE_FLOAT32BE;
|
ss->format = PA_SAMPLE_FLOAT32BE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S32_LE:
|
case GST_AUDIO_FORMAT_S32LE:
|
||||||
ss->format = PA_SAMPLE_S32LE;
|
ss->format = PA_SAMPLE_S32LE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S32_BE:
|
case GST_AUDIO_FORMAT_S32BE:
|
||||||
ss->format = PA_SAMPLE_S32BE;
|
ss->format = PA_SAMPLE_S32BE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S24_3LE:
|
case GST_AUDIO_FORMAT_S24LE:
|
||||||
ss->format = PA_SAMPLE_S24LE;
|
ss->format = PA_SAMPLE_S24LE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S24_3BE:
|
case GST_AUDIO_FORMAT_S24BE:
|
||||||
ss->format = PA_SAMPLE_S24BE;
|
ss->format = PA_SAMPLE_S24BE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S24_LE:
|
case GST_AUDIO_FORMAT_S24_32LE:
|
||||||
ss->format = PA_SAMPLE_S24_32LE;
|
ss->format = PA_SAMPLE_S24_32LE;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S24_BE:
|
case GST_AUDIO_FORMAT_S24_32BE:
|
||||||
ss->format = PA_SAMPLE_S24_32BE;
|
ss->format = PA_SAMPLE_S24_32BE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -92,29 +92,17 @@ gst_audio_panorama_method_get_type (void)
|
||||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"format = (string) { " GST_AUDIO_NE (S32) ", " GST_AUDIO_NE (S16) "}, "
|
||||||
"channels = (int) [ 1, 2 ], "
|
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 32; "
|
|
||||||
"audio/x-raw-int, "
|
|
||||||
"rate = (int) [ 1, MAX ], "
|
|
||||||
"channels = (int) [ 1, 2 ], "
|
|
||||||
"endianness = (int) BYTE_ORDER, "
|
|
||||||
"width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-float, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"rate = (int) [ 1, MAX ], "
|
"format = (string) { " GST_AUDIO_NE (S32) ", " GST_AUDIO_NE (S16) "}, "
|
||||||
"channels = (int) 2, "
|
"rate = (int) [ 1, MAX ], " "channels = (int) 2")
|
||||||
"endianness = (int) BYTE_ORDER, " "width = (int) 32; "
|
|
||||||
"audio/x-raw-int, "
|
|
||||||
"rate = (int) [ 1, MAX ], "
|
|
||||||
"channels = (int) 2, "
|
|
||||||
"endianness = (int) BYTE_ORDER, "
|
|
||||||
"width = (int) 16, " "depth = (int) 16, " "signed = (boolean) true")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstAudioPanorama, gst_audio_panorama, GST_TYPE_BASE_TRANSFORM);
|
G_DEFINE_TYPE (GstAudioPanorama, gst_audio_panorama, GST_TYPE_BASE_TRANSFORM);
|
||||||
|
@ -237,27 +225,27 @@ gst_audio_panorama_init (GstAudioPanorama * filter)
|
||||||
|
|
||||||
filter->panorama = 0;
|
filter->panorama = 0;
|
||||||
filter->method = METHOD_PSYCHOACOUSTIC;
|
filter->method = METHOD_PSYCHOACOUSTIC;
|
||||||
filter->width = 0;
|
gst_audio_info_init (&filter->info);
|
||||||
filter->channels = 0;
|
|
||||||
filter->format_float = FALSE;
|
|
||||||
filter->process = NULL;
|
filter->process = NULL;
|
||||||
|
|
||||||
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (filter), TRUE);
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (filter), TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_audio_panorama_set_process_function (GstAudioPanorama * filter)
|
gst_audio_panorama_set_process_function (GstAudioPanorama * filter,
|
||||||
|
GstAudioInfo * info)
|
||||||
{
|
{
|
||||||
gint channel_index, format_index, method_index;
|
gint channel_index, format_index, method_index;
|
||||||
|
const GstAudioFormatInfo *finfo = info->finfo;
|
||||||
|
|
||||||
/* set processing function */
|
/* set processing function */
|
||||||
channel_index = filter->channels - 1;
|
channel_index = GST_AUDIO_INFO_CHANNELS (info) - 1;
|
||||||
if (channel_index > 1 || channel_index < 0) {
|
if (channel_index > 1 || channel_index < 0) {
|
||||||
filter->process = NULL;
|
filter->process = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
format_index = (filter->format_float) ? 1 : 0;
|
format_index = GST_AUDIO_FORMAT_INFO_IS_FLOAT (finfo) ? 1 : 0;
|
||||||
|
|
||||||
method_index = filter->method;
|
method_index = filter->method;
|
||||||
if (method_index >= NUM_METHODS || method_index < 0)
|
if (method_index >= NUM_METHODS || method_index < 0)
|
||||||
|
@ -280,7 +268,7 @@ gst_audio_panorama_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
case PROP_METHOD:
|
case PROP_METHOD:
|
||||||
filter->method = g_value_get_enum (value);
|
filter->method = g_value_get_enum (value);
|
||||||
gst_audio_panorama_set_process_function (filter);
|
gst_audio_panorama_set_process_function (filter, &filter->info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -356,44 +344,27 @@ gst_audio_panorama_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
||||||
GstCaps * outcaps)
|
GstCaps * outcaps)
|
||||||
{
|
{
|
||||||
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
|
GstAudioPanorama *filter = GST_AUDIO_PANORAMA (base);
|
||||||
const GstStructure *structure;
|
GstAudioInfo info;
|
||||||
gboolean ret;
|
|
||||||
gint width;
|
|
||||||
const gchar *fmt;
|
|
||||||
|
|
||||||
/*GST_INFO ("incaps are %" GST_PTR_FORMAT, incaps); */
|
/*GST_INFO ("incaps are %" GST_PTR_FORMAT, incaps); */
|
||||||
|
if (!gst_audio_info_from_caps (&info, incaps))
|
||||||
|
goto no_format;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
GST_DEBUG ("try to process %d input with %d channels",
|
||||||
ret = gst_structure_get_int (structure, "channels", &filter->channels);
|
GST_AUDIO_INFO_FORMAT (&info), GST_AUDIO_INFO_CHANNELS (&info));
|
||||||
if (!ret)
|
|
||||||
goto no_channels;
|
|
||||||
|
|
||||||
ret = gst_structure_get_int (structure, "width", &width);
|
if (!gst_audio_panorama_set_process_function (filter, &info))
|
||||||
if (!ret)
|
goto no_format;
|
||||||
goto no_width;
|
|
||||||
filter->width = width / 8;
|
|
||||||
|
|
||||||
fmt = gst_structure_get_name (structure);
|
filter->info = info;
|
||||||
if (!strcmp (fmt, "audio/x-raw-int"))
|
|
||||||
filter->format_float = FALSE;
|
|
||||||
else
|
|
||||||
filter->format_float = TRUE;
|
|
||||||
|
|
||||||
GST_DEBUG ("try to process %s input with %d channels", fmt, filter->channels);
|
return TRUE;
|
||||||
|
|
||||||
ret = gst_audio_panorama_set_process_function (filter);
|
no_format:
|
||||||
|
{
|
||||||
if (!ret)
|
GST_DEBUG ("invalid caps");
|
||||||
GST_WARNING ("can't process input with %d channels", filter->channels);
|
return FALSE;
|
||||||
|
}
|
||||||
return ret;
|
|
||||||
|
|
||||||
no_channels:
|
|
||||||
GST_DEBUG ("no channels in caps");
|
|
||||||
return ret;
|
|
||||||
no_width:
|
|
||||||
GST_DEBUG ("no width in caps");
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* psychoacoustic processing functions */
|
/* psychoacoustic processing functions */
|
||||||
|
@ -672,7 +643,7 @@ gst_audio_panorama_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_GAP);
|
||||||
memset (outdata, 0, outsize);
|
memset (outdata, 0, outsize);
|
||||||
} else {
|
} else {
|
||||||
guint num_samples = outsize / (2 * filter->width);
|
guint num_samples = outsize / GST_AUDIO_INFO_BPF (&filter->info);
|
||||||
|
|
||||||
filter->process (filter, indata, outdata, num_samples);
|
filter->process (filter, indata, outdata, num_samples);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define __GST_AUDIO_PANORAMA_H__
|
#define __GST_AUDIO_PANORAMA_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/base/gstbasetransform.h>
|
#include <gst/base/gstbasetransform.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
@ -45,9 +46,8 @@ struct _GstAudioPanorama {
|
||||||
|
|
||||||
/* < private > */
|
/* < private > */
|
||||||
GstAudioPanoramaProcessFunc process;
|
GstAudioPanoramaProcessFunc process;
|
||||||
gint channels;
|
|
||||||
gboolean format_float;
|
GstAudioInfo info;
|
||||||
gint width;
|
|
||||||
gint method;
|
gint method;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,9 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
|
|
||||||
#define GST_AU_PARSE_RAW_PAD_TEMPLATE_CAPS \
|
#define GST_AU_PARSE_RAW_PAD_TEMPLATE_CAPS \
|
||||||
"audio/x-raw, " \
|
"audio/x-raw, " \
|
||||||
"format= (string) { S8, S16_LE, S16_BE, S24_3LE, S24_3BE, " \
|
"format= (string) { S8, S16LE, S16BE, S24LE, S24BE, " \
|
||||||
"S32_LE, S32_BE, F32_LE, F32_BE, " \
|
"S32LE, S32BE, F32LE, F32BE, " \
|
||||||
"F64_LE, F64_BE }, " \
|
"F64LE, F64BE }, " \
|
||||||
"rate = (int) [ 8000, 192000 ], " \
|
"rate = (int) [ 8000, 192000 ], " \
|
||||||
"channels = (int) [ 1, 2 ]"
|
"channels = (int) [ 1, 2 ]"
|
||||||
|
|
||||||
|
@ -257,38 +257,38 @@ gst_au_parse_parse_header (GstAuParse * auparse)
|
||||||
break;
|
break;
|
||||||
case 3: /* 16-bit linear PCM */
|
case 3: /* 16-bit linear PCM */
|
||||||
if (endianness == G_LITTLE_ENDIAN)
|
if (endianness == G_LITTLE_ENDIAN)
|
||||||
format = GST_AUDIO_FORMAT_S16_LE;
|
format = GST_AUDIO_FORMAT_S16LE;
|
||||||
else
|
else
|
||||||
format = GST_AUDIO_FORMAT_S16_BE;
|
format = GST_AUDIO_FORMAT_S16BE;
|
||||||
auparse->sample_size = auparse->channels * 2;
|
auparse->sample_size = auparse->channels * 2;
|
||||||
break;
|
break;
|
||||||
case 4: /* 24-bit linear PCM */
|
case 4: /* 24-bit linear PCM */
|
||||||
if (endianness == G_LITTLE_ENDIAN)
|
if (endianness == G_LITTLE_ENDIAN)
|
||||||
format = GST_AUDIO_FORMAT_S24_3LE;
|
format = GST_AUDIO_FORMAT_S24LE;
|
||||||
else
|
else
|
||||||
format = GST_AUDIO_FORMAT_S24_3BE;
|
format = GST_AUDIO_FORMAT_S24BE;
|
||||||
auparse->sample_size = auparse->channels * 3;
|
auparse->sample_size = auparse->channels * 3;
|
||||||
break;
|
break;
|
||||||
case 5: /* 32-bit linear PCM */
|
case 5: /* 32-bit linear PCM */
|
||||||
if (endianness == G_LITTLE_ENDIAN)
|
if (endianness == G_LITTLE_ENDIAN)
|
||||||
format = GST_AUDIO_FORMAT_S32_LE;
|
format = GST_AUDIO_FORMAT_S32LE;
|
||||||
else
|
else
|
||||||
format = GST_AUDIO_FORMAT_S32_BE;
|
format = GST_AUDIO_FORMAT_S32BE;
|
||||||
auparse->sample_size = auparse->channels * 4;
|
auparse->sample_size = auparse->channels * 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: /* 32-bit IEEE floating point */
|
case 6: /* 32-bit IEEE floating point */
|
||||||
if (endianness == G_LITTLE_ENDIAN)
|
if (endianness == G_LITTLE_ENDIAN)
|
||||||
format = GST_AUDIO_FORMAT_F32_LE;
|
format = GST_AUDIO_FORMAT_F32LE;
|
||||||
else
|
else
|
||||||
format = GST_AUDIO_FORMAT_F32_BE;
|
format = GST_AUDIO_FORMAT_F32BE;
|
||||||
auparse->sample_size = auparse->channels * 4;
|
auparse->sample_size = auparse->channels * 4;
|
||||||
break;
|
break;
|
||||||
case 7: /* 64-bit IEEE floating point */
|
case 7: /* 64-bit IEEE floating point */
|
||||||
if (endianness == G_LITTLE_ENDIAN)
|
if (endianness == G_LITTLE_ENDIAN)
|
||||||
format = GST_AUDIO_FORMAT_F64_LE;
|
format = GST_AUDIO_FORMAT_F64LE;
|
||||||
else
|
else
|
||||||
format = GST_AUDIO_FORMAT_F64_BE;
|
format = GST_AUDIO_FORMAT_F64BE;
|
||||||
auparse->sample_size = auparse->channels * 8;
|
auparse->sample_size = auparse->channels * 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
* ! 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \
|
* ! 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \
|
||||||
* ! queue ! mux. \
|
* ! queue ! mux. \
|
||||||
* audiotestsrc num-buffers=440 ! audioconvert \
|
* audiotestsrc num-buffers=440 ! audioconvert \
|
||||||
* ! 'audio/x-raw-int,rate=44100,channels=2' ! queue ! mux. \
|
* ! 'audio/x-raw,rate=44100,channels=2' ! queue ! mux. \
|
||||||
* avimux name=mux ! filesink location=test.avi
|
* avimux name=mux ! filesink location=test.avi
|
||||||
* ]| This will create an .AVI file containing an uncompressed video stream
|
* ]| This will create an .AVI file containing an uncompressed video stream
|
||||||
* with a test picture and an uncompressed audio stream containing a
|
* with a test picture and an uncompressed audio stream containing a
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
* gst-launch videotestsrc num-buffers=250 \
|
* gst-launch videotestsrc num-buffers=250 \
|
||||||
* ! 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \
|
* ! 'video/x-raw,format=(string)I420,width=320,height=240,framerate=(fraction)25/1' \
|
||||||
* ! xvidenc ! queue ! mux. \
|
* ! xvidenc ! queue ! mux. \
|
||||||
* audiotestsrc num-buffers=440 ! audioconvert ! 'audio/x-raw-int,rate=44100,channels=2' \
|
* audiotestsrc num-buffers=440 ! audioconvert ! 'audio/x-raw,rate=44100,channels=2' \
|
||||||
* ! lame ! queue ! mux. \
|
* ! lame ! queue ! mux. \
|
||||||
* avimux name=mux ! filesink location=test.avi
|
* avimux name=mux ! filesink location=test.avi
|
||||||
* ]| This will create an .AVI file containing the same test video and sound
|
* ]| This will create an .AVI file containing the same test video and sound
|
||||||
|
@ -66,6 +66,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
#include <gst/audio/audio.h>
|
||||||
#include <gst/base/gstbytewriter.h>
|
#include <gst/base/gstbytewriter.h>
|
||||||
|
|
||||||
#include "gstavimux.h"
|
#include "gstavimux.h"
|
||||||
|
@ -160,11 +161,8 @@ static GstStaticPadTemplate audio_sink_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE ("audio_%d",
|
GST_STATIC_PAD_TEMPLATE ("audio_%d",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_REQUEST,
|
GST_PAD_REQUEST,
|
||||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
GST_STATIC_CAPS ("audio/x-raw, "
|
||||||
"endianness = (int) LITTLE_ENDIAN, "
|
"format = (string) { U8, S16LE }, "
|
||||||
"signed = (boolean) { TRUE, FALSE }, "
|
|
||||||
"width = (int) { 8, 16 }, "
|
|
||||||
"depth = (int) { 8, 16 }, "
|
|
||||||
"rate = (int) [ 1000, 96000 ], "
|
"rate = (int) [ 1000, 96000 ], "
|
||||||
"channels = (int) [ 1, 2 ]; "
|
"channels = (int) [ 1, 2 ]; "
|
||||||
"audio/mpeg, "
|
"audio/mpeg, "
|
||||||
|
@ -758,36 +756,27 @@ gst_avi_mux_audsink_set_caps (GstPad * pad, GstCaps * vscaps)
|
||||||
avimux->codec_data_size += gst_buffer_get_size (avipad->auds_codec_data);
|
avimux->codec_data_size += gst_buffer_get_size (avipad->auds_codec_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp (mimetype, "audio/x-raw-int")) {
|
if (!strcmp (mimetype, "audio/x-raw")) {
|
||||||
gint width, depth;
|
const gchar *format;
|
||||||
gboolean signedness;
|
GstAudioFormat fmt;
|
||||||
|
|
||||||
|
format = gst_structure_get_string (structure, "format");
|
||||||
|
fmt = gst_audio_format_from_string (format);
|
||||||
|
|
||||||
|
switch (fmt) {
|
||||||
|
case GST_AUDIO_FORMAT_U8:
|
||||||
|
avipad->auds.blockalign = 8;
|
||||||
|
avipad->auds.size = 8;
|
||||||
|
break;
|
||||||
|
case GST_AUDIO_FORMAT_S16:
|
||||||
|
avipad->auds.blockalign = 16;
|
||||||
|
avipad->auds.size = 16;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto refuse_caps;
|
||||||
|
}
|
||||||
|
|
||||||
avipad->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
|
avipad->auds.format = GST_RIFF_WAVE_FORMAT_PCM;
|
||||||
|
|
||||||
if (!gst_structure_get_int (structure, "width", &width) ||
|
|
||||||
!gst_structure_get_int (structure, "depth", &depth) ||
|
|
||||||
!gst_structure_get_boolean (structure, "signed", &signedness)) {
|
|
||||||
GST_DEBUG_OBJECT (avimux,
|
|
||||||
"broken caps, width/depth/signed field missing");
|
|
||||||
goto refuse_caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* no clear place to put different values for these while keeping to spec */
|
|
||||||
if (width != depth) {
|
|
||||||
GST_DEBUG_OBJECT (avimux, "width must be same as depth!");
|
|
||||||
goto refuse_caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* because that's the way the caps will be recreated from riff data */
|
|
||||||
if ((width == 8 && signedness) || (width == 16 && !signedness)) {
|
|
||||||
GST_DEBUG_OBJECT (avimux,
|
|
||||||
"8-bit PCM must be unsigned, 16-bit PCM signed");
|
|
||||||
goto refuse_caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
avipad->auds.blockalign = width;
|
|
||||||
avipad->auds.size = (width == 8) ? 8 : depth;
|
|
||||||
|
|
||||||
/* set some more info straight */
|
/* set some more info straight */
|
||||||
avipad->auds.blockalign /= 8;
|
avipad->auds.blockalign /= 8;
|
||||||
avipad->auds.blockalign *= avipad->auds.channels;
|
avipad->auds.blockalign *= avipad->auds.channels;
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
* <refsect2>
|
* <refsect2>
|
||||||
* <title>Example pipelines</title>
|
* <title>Example pipelines</title>
|
||||||
* |[
|
* |[
|
||||||
* gst-launch v4l2src num-buffers=500 ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! qtmux ! filesink location=video.mov
|
* gst-launch v4l2src num-buffers=500 ! video/x-raw,width=320,height=240 ! ffmpegcolorspace ! qtmux ! filesink location=video.mov
|
||||||
* ]|
|
* ]|
|
||||||
* Records a video stream captured from a v4l2 device and muxes it into a qt file.
|
* Records a video stream captured from a v4l2 device and muxes it into a qt file.
|
||||||
* </refsect2>
|
* </refsect2>
|
||||||
|
|
|
@ -5256,7 +5256,7 @@ qtdemux_stbl_init (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * stbl)
|
||||||
/* sync sample atom */
|
/* sync sample atom */
|
||||||
stream->stps_present = FALSE;
|
stream->stps_present = FALSE;
|
||||||
if ((stream->stss_present =
|
if ((stream->stss_present =
|
||||||
! !qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stss,
|
!!qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stss,
|
||||||
&stream->stss) ? TRUE : FALSE) == TRUE) {
|
&stream->stss) ? TRUE : FALSE) == TRUE) {
|
||||||
/* copy atom data into a new buffer for later use */
|
/* copy atom data into a new buffer for later use */
|
||||||
stream->stss.data = g_memdup (stream->stss.data, stream->stss.size);
|
stream->stss.data = g_memdup (stream->stss.data, stream->stss.size);
|
||||||
|
@ -5274,7 +5274,7 @@ qtdemux_stbl_init (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * stbl)
|
||||||
|
|
||||||
/* partial sync sample atom */
|
/* partial sync sample atom */
|
||||||
if ((stream->stps_present =
|
if ((stream->stps_present =
|
||||||
! !qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stps,
|
!!qtdemux_tree_get_child_by_type_full (stbl, FOURCC_stps,
|
||||||
&stream->stps) ? TRUE : FALSE) == TRUE) {
|
&stream->stps) ? TRUE : FALSE) == TRUE) {
|
||||||
/* copy atom data into a new buffer for later use */
|
/* copy atom data into a new buffer for later use */
|
||||||
stream->stps.data = g_memdup (stream->stps.data, stream->stps.size);
|
stream->stps.data = g_memdup (stream->stps.data, stream->stps.size);
|
||||||
|
@ -5393,7 +5393,7 @@ qtdemux_stbl_init (GstQTDemux * qtdemux, QtDemuxStream * stream, GNode * stbl)
|
||||||
|
|
||||||
/* composition time-to-sample */
|
/* composition time-to-sample */
|
||||||
if ((stream->ctts_present =
|
if ((stream->ctts_present =
|
||||||
! !qtdemux_tree_get_child_by_type_full (stbl, FOURCC_ctts,
|
!!qtdemux_tree_get_child_by_type_full (stbl, FOURCC_ctts,
|
||||||
&stream->ctts) ? TRUE : FALSE) == TRUE) {
|
&stream->ctts) ? TRUE : FALSE) == TRUE) {
|
||||||
/* copy atom data into a new buffer for later use */
|
/* copy atom data into a new buffer for later use */
|
||||||
stream->ctts.data = g_memdup (stream->ctts.data, stream->ctts.size);
|
stream->ctts.data = g_memdup (stream->ctts.data, stream->ctts.size);
|
||||||
|
@ -9382,24 +9382,24 @@ qtdemux_audio_caps (GstQTDemux * qtdemux, QtDemuxStream * stream,
|
||||||
case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
|
case GST_MAKE_FOURCC ('f', 'l', '6', '4'):
|
||||||
_codec ("Raw 64-bit floating-point audio");
|
_codec ("Raw 64-bit floating-point audio");
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, "F64_BE", NULL);
|
"format", G_TYPE_STRING, "F64BE", NULL);
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
|
case GST_MAKE_FOURCC ('f', 'l', '3', '2'):
|
||||||
_codec ("Raw 32-bit floating-point audio");
|
_codec ("Raw 32-bit floating-point audio");
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, "F32_BE", NULL);
|
"format", G_TYPE_STRING, "F32BE", NULL);
|
||||||
break;
|
break;
|
||||||
case FOURCC_in24:
|
case FOURCC_in24:
|
||||||
_codec ("Raw 24-bit PCM audio");
|
_codec ("Raw 24-bit PCM audio");
|
||||||
/* we assume BIG ENDIAN, an enda box will tell us to change this to little
|
/* we assume BIG ENDIAN, an enda box will tell us to change this to little
|
||||||
* endian later */
|
* endian later */
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, "S24_3BE", NULL);
|
"format", G_TYPE_STRING, "S24BE", NULL);
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('i', 'n', '3', '2'):
|
case GST_MAKE_FOURCC ('i', 'n', '3', '2'):
|
||||||
_codec ("Raw 32-bit PCM audio");
|
_codec ("Raw 32-bit PCM audio");
|
||||||
caps = gst_caps_new_simple ("audio/x-raw",
|
caps = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, "S32_BE", NULL);
|
"format", G_TYPE_STRING, "S32BE", NULL);
|
||||||
break;
|
break;
|
||||||
case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'):
|
case GST_MAKE_FOURCC ('u', 'l', 'a', 'w'):
|
||||||
_codec ("Mu-law audio");
|
_codec ("Mu-law audio");
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include "alaw-decode.h"
|
#include "alaw-decode.h"
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define INT_FORMAT "S16_LE"
|
#define INT_FORMAT "S16LE"
|
||||||
#else
|
#else
|
||||||
#define INT_FORMAT "S16_BE"
|
#define INT_FORMAT "S16BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
GstStaticPadTemplate alaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
#include "mulaw-conversion.h"
|
#include "mulaw-conversion.h"
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define INT_FORMAT "S16_LE"
|
#define INT_FORMAT "S16LE"
|
||||||
#else
|
#else
|
||||||
#define INT_FORMAT "S16_BE"
|
#define INT_FORMAT "S16BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern GstStaticPadTemplate mulaw_dec_src_factory;
|
extern GstStaticPadTemplate mulaw_dec_src_factory;
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
#include "mulaw-decode.h"
|
#include "mulaw-decode.h"
|
||||||
|
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
#define INT_FORMAT "S16_LE"
|
#define INT_FORMAT "S16LE"
|
||||||
#else
|
#else
|
||||||
#define INT_FORMAT "S16_BE"
|
#define INT_FORMAT "S16BE"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
GstStaticPadTemplate mulaw_dec_src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
|
|
|
@ -111,9 +111,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_spectrum_debug);
|
||||||
|
|
||||||
/* elementfactory information */
|
/* elementfactory information */
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
# define FORMATS "{ S16_LE, S24_3LE, S32_LE, F32_LE, F64_LE }"
|
# define FORMATS "{ S16LE, S24LE, S32LE, F32LE, F64LE }"
|
||||||
#else
|
#else
|
||||||
# define FORMATS "{ S16_BE, S24_3BE, S32_BE, F32_BE, F64_BE }"
|
# define FORMATS "{ S16BE, S24BE, S32BE, F32BE, F64BE }"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ALLOWED_CAPS \
|
#define ALLOWED_CAPS \
|
||||||
|
@ -626,7 +626,7 @@ gst_spectrum_setup (GstAudioFilter * base, const GstAudioInfo * info)
|
||||||
input_data =
|
input_data =
|
||||||
multi_channel ? input_data_int16_max : input_data_mixed_int16_max;
|
multi_channel ? input_data_int16_max : input_data_mixed_int16_max;
|
||||||
break;
|
break;
|
||||||
case GST_AUDIO_FORMAT_S24_3:
|
case GST_AUDIO_FORMAT_S24:
|
||||||
input_data =
|
input_data =
|
||||||
multi_channel ? input_data_int24_max : input_data_mixed_int24_max;
|
multi_channel ? input_data_int24_max : input_data_mixed_int24_max;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1743,7 +1743,7 @@ gst_wavparse_add_src_pad (GstWavParse * wav, GstBuffer * buf)
|
||||||
|
|
||||||
if (wav->caps) {
|
if (wav->caps) {
|
||||||
s = gst_caps_get_structure (wav->caps, 0);
|
s = gst_caps_get_structure (wav->caps, 0);
|
||||||
if (s && gst_structure_has_name (s, "audio/x-raw-int") && buf != NULL) {
|
if (s && gst_structure_has_name (s, "audio/x-raw") && buf != NULL) {
|
||||||
GstTypeFindProbability prob;
|
GstTypeFindProbability prob;
|
||||||
GstCaps *tf_caps;
|
GstCaps *tf_caps;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue