alaw-encode.c (gst-plugins-good-1.18.6.tar.xz) | : | alaw-encode.c (gst-plugins-good-1.20.0.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
* @title: alawenc | * @title: alawenc | |||
* | * | |||
* This element encode alaw audio. Alaw coding is also known as G.711. | * This element encode alaw audio. Alaw coding is also known as G.711. | |||
*/ | */ | |||
#ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | |||
#include "config.h" | #include "config.h" | |||
#endif | #endif | |||
#include <gst/audio/audio.h> | #include <gst/audio/audio.h> | |||
#include "alaw-encode.h" | #include "alaw-encode.h" | |||
GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug); | GST_DEBUG_CATEGORY_STATIC (alaw_enc_debug); | |||
#define GST_CAT_DEFAULT alaw_enc_debug | #define GST_CAT_DEFAULT alaw_enc_debug | |||
extern GstStaticPadTemplate alaw_enc_src_factory; | extern GstStaticPadTemplate alaw_enc_src_factory; | |||
extern GstStaticPadTemplate alaw_enc_sink_factory; | extern GstStaticPadTemplate alaw_enc_sink_factory; | |||
G_DEFINE_TYPE (GstALawEnc, gst_alaw_enc, GST_TYPE_AUDIO_ENCODER); | G_DEFINE_TYPE (GstALawEnc, gst_alaw_enc, GST_TYPE_AUDIO_ENCODER); | |||
GST_ELEMENT_REGISTER_DEFINE (alawenc, "alawenc", GST_RANK_PRIMARY, | ||||
GST_TYPE_ALAW_ENC); | ||||
static gboolean gst_alaw_enc_start (GstAudioEncoder * audioenc); | static gboolean gst_alaw_enc_start (GstAudioEncoder * audioenc); | |||
static gboolean gst_alaw_enc_set_format (GstAudioEncoder * enc, | static gboolean gst_alaw_enc_set_format (GstAudioEncoder * enc, | |||
GstAudioInfo * info); | GstAudioInfo * info); | |||
static GstFlowReturn gst_alaw_enc_handle_frame (GstAudioEncoder * enc, | static GstFlowReturn gst_alaw_enc_handle_frame (GstAudioEncoder * enc, | |||
GstBuffer * buffer); | GstBuffer * buffer); | |||
/* some day we might have defines in gstconfig.h that tell us about the | /* some day we might have defines in gstconfig.h that tell us about the | |||
* desired cpu/memory/binary size trade-offs */ | * desired cpu/memory/binary size trade-offs */ | |||
#define GST_ALAW_ENC_USE_TABLE | #define GST_ALAW_ENC_USE_TABLE | |||
skipping to change at line 305 | skipping to change at line 308 | |||
else { | else { | |||
/* Convert the scaled magnitude to segment number. */ | /* Convert the scaled magnitude to segment number. */ | |||
seg = val_seg (pcm_val); | seg = val_seg (pcm_val); | |||
aval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0x0f); | aval = (seg << 4) | ((pcm_val >> (seg + 3)) & 0x0f); | |||
} | } | |||
return aval ^ mask; | return aval ^ mask; | |||
} | } | |||
#endif /* GST_ALAW_ENC_USE_TABLE */ | #endif /* GST_ALAW_ENC_USE_TABLE */ | |||
GstStaticPadTemplate alaw_enc_sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", | ||||
GST_PAD_SINK, | ||||
GST_PAD_ALWAYS, | ||||
GST_STATIC_CAPS ("audio/x-raw, " | ||||
"format = (string) " GST_AUDIO_NE (S16) ", " | ||||
"layout = (string) interleaved, " | ||||
"rate = (int) [ 8000, 192000 ], " "channels = (int) [ 1, 2 ]") | ||||
); | ||||
GstStaticPadTemplate alaw_enc_src_factory = GST_STATIC_PAD_TEMPLATE ("src", | ||||
GST_PAD_SRC, | ||||
GST_PAD_ALWAYS, | ||||
GST_STATIC_CAPS ("audio/x-alaw, " | ||||
"rate = [ 8000 , 192000 ], " "channels = [ 1 , 2 ]") | ||||
); | ||||
static gboolean | static gboolean | |||
gst_alaw_enc_start (GstAudioEncoder * audioenc) | gst_alaw_enc_start (GstAudioEncoder * audioenc) | |||
{ | { | |||
GstALawEnc *alawenc = GST_ALAW_ENC (audioenc); | GstALawEnc *alawenc = GST_ALAW_ENC (audioenc); | |||
alawenc->channels = 0; | alawenc->channels = 0; | |||
alawenc->rate = 0; | alawenc->rate = 0; | |||
return TRUE; | return TRUE; | |||
} | } | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 19 lines changed or added |