gst-libs: Remove interfaces libs and mixer/tuner interfaces

The navigation interface is now in the video library.
This commit is contained in:
Sebastian Dröge 2012-04-13 11:01:03 +02:00
parent 67b29f85a2
commit 69b18ab09d
79 changed files with 59 additions and 6470 deletions

View file

@ -1,69 +0,0 @@
LOCAL_PATH:= $(call my-dir)
#----------------------------------------
# include
gst_interfaces_COPY_HEADERS_TO := gstreamer-1.0/gst/interfaces
gst_interfaces_COPY_HEADERS_BASE := \
gst-libs/gst/interfaces/colorbalance.h \
gst-libs/gst/interfaces/colorbalancechannel.h \
gst-libs/gst/interfaces/mixer.h \
gst-libs/gst/interfaces/mixeroptions.h \
gst-libs/gst/interfaces/mixertrack.h \
gst-libs/gst/interfaces/navigation.h \
gst-libs/gst/interfaces/propertyprobe.h \
gst-libs/gst/interfaces/streamvolume.h \
gst-libs/gst/interfaces/tuner.h \
gst-libs/gst/interfaces/tunerchannel.h \
gst-libs/gst/interfaces/tunernorm.h \
gst-libs/gst/interfaces/videoorientation.h \
gst-libs/gst/interfaces/videooverlay.h \
gst-libs/gst/interfaces/interfaces-enumtypes.h
gst_interfaces_COPY_HEADERS := $(addprefix ../,$(gst_interfaces_COPY_HEADERS_BASE))
include $(CLEAR_VARS)
LOCAL_ARM_MODE := arm
interfaces_LOCAL_SRC_FILES_BASE:= \
gst-libs/gst/interfaces/colorbalance.c \
gst-libs/gst/interfaces/colorbalancechannel.c \
gst-libs/gst/interfaces/mixer.c \
gst-libs/gst/interfaces/mixeroptions.c \
gst-libs/gst/interfaces/mixertrack.c \
gst-libs/gst/interfaces/navigation.c \
gst-libs/gst/interfaces/propertyprobe.c \
gst-libs/gst/interfaces/streamvolume.c \
gst-libs/gst/interfaces/tuner.c \
gst-libs/gst/interfaces/tunernorm.c \
gst-libs/gst/interfaces/tunerchannel.c \
gst-libs/gst/interfaces/videoorientation.c \
gst-libs/gst/interfaces/videooverlay.c \
gst-libs/gst/interfaces/interfaces-marshal.c \
gst-libs/gst/interfaces/interfaces-enumtypes.c
LOCAL_SRC_FILES:= $(addprefix ../,$(interfaces_LOCAL_SRC_FILES_BASE)) \
$(addprefix ../android/,$(interfaces_LOCAL_SRC_FILES_ANDROID))
LOCAL_SHARED_LIBRARIES := \
libgstreamer-1.0 \
libgstbase-1.0 \
libglib-2.0 \
libgthread-2.0 \
libgmodule-2.0 \
libgobject-2.0
LOCAL_MODULE:= libgstinterfaces-1.0
LOCAL_CFLAGS := -DHAVE_CONFIG_H -DGSTREAMER_BUILT_FOR_ANDROID \
$(GST_PLUGINS_BASE_CFLAGS)
#
# define LOCAL_PRELINK_MODULE to false to not use pre-link map
#
LOCAL_PRELINK_MODULE := false
LOCAL_COPY_HEADERS_TO := $(gst_interfaces_COPY_HEADERS_TO)
LOCAL_COPY_HEADERS := $(gst_interfaces_COPY_HEADERS)
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)

View file

@ -851,7 +851,6 @@ gst-libs/gst/Makefile
gst-libs/gst/audio/Makefile
gst-libs/gst/app/Makefile
gst-libs/gst/fft/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/riff/Makefile
gst-libs/gst/rtp/Makefile
gst-libs/gst/rtsp/Makefile
@ -868,8 +867,6 @@ pkgconfig/gstreamer-app.pc
pkgconfig/gstreamer-app-uninstalled.pc
pkgconfig/gstreamer-fft.pc
pkgconfig/gstreamer-fft-uninstalled.pc
pkgconfig/gstreamer-interfaces.pc
pkgconfig/gstreamer-interfaces-uninstalled.pc
pkgconfig/gstreamer-pbutils.pc
pkgconfig/gstreamer-pbutils-uninstalled.pc
pkgconfig/gstreamer-riff.pc

View file

@ -41,7 +41,7 @@ IGNORE_HFILES = pbutils-private.h gsttageditingprivate.h id3v2.h \
kiss_fftr_s16.h kiss_fftr_s32.h kiss_fft_s16.h kiss_fft_s32.h \
_kiss_fft_guts_f32.h _kiss_fft_guts_f64.h _kiss_fft_guts_s16.h \
_kiss_fft_guts_s16.h _kiss_fft_guts_s32.h _kiss_fft_guts_s32.h \
interfaces-marshal.h pbutils-marshal.h
pbutils-marshal.h
# Images to copy into HTML directory.
@ -57,7 +57,6 @@ extra_files =
# contains GtkObjects/GObjects and you want to document signals and properties.
GTKDOC_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) -DGST_USE_UNSTABLE_API
GTKDOC_LIBS = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_API_VERSION@.la \

View file

@ -57,9 +57,6 @@
<xi:include href="xml/gstaudioringbuffer.xml" />
<xi:include href="xml/gstaudioiec61937.xml" />
<xi:include href="xml/gststreamvolume.xml" />
<xi:include href="xml/gstmixer.xml" />
<xi:include href="xml/gstmixeroptions.xml" />
<xi:include href="xml/gstmixertrack.xml" />
</chapter>
<chapter id="gstreamer-ffft">
@ -81,19 +78,6 @@
<xi:include href="xml/gstfftf64.xml" />
</chapter>
<chapter id="gstreamer-interfaces">
<title>Interfaces Library</title>
<para>
This library should be linked to by getting cflags and libs from
<filename>gstreamer-plugins-base-&GST_API_VERSION;.pc</filename> and adding
<filename>-lgstinterfaces-&GST_API_VERSION;</filename> to the library flags.
</para>
<xi:include href="xml/gstnavigation.xml" />
<xi:include href="xml/gsttuner.xml" />
<xi:include href="xml/gsttunerchannel.xml" />
<xi:include href="xml/gsttunernorm.xml" />
</chapter>
<chapter id="gstreamer-riff">
<title>Riff Media Library</title>
<para>

View file

@ -605,96 +605,9 @@ GST_TYPE_COLOR_BALANCE_CHANNEL
gst_color_balance_channel_get_type
</SECTION>
<SECTION>
<FILE>gstmixer</FILE>
<INCLUDE>gst/audio/mixer.h</INCLUDE>
GstMixer
GstMixerType
GstMixerFlags
GstMixerMessageType
gst_mixer_list_tracks
gst_mixer_get_volume
gst_mixer_set_volume
gst_mixer_set_mute
gst_mixer_set_record
gst_mixer_set_option
gst_mixer_mute_toggled
gst_mixer_record_toggled
gst_mixer_volume_changed
gst_mixer_option_changed
gst_mixer_options_list_changed
gst_mixer_get_option
gst_mixer_mixer_changed
gst_mixer_get_mixer_flags
gst_mixer_get_mixer_type
gst_mixer_message_get_type
gst_mixer_message_parse_mute_toggled
gst_mixer_message_parse_option_changed
gst_mixer_message_parse_record_toggled
gst_mixer_message_parse_volume_changed
gst_mixer_message_parse_options_list_changed
<SUBSECTION Standard>
GstMixerClass
GST_TYPE_MIXER
GST_TYPE_MIXER_TYPE
GST_TYPE_MIXER_FLAGS
GST_TYPE_MIXER_MESSAGE_TYPE
GST_MIXER
GST_MIXER_GET_INTERFACE
GST_MIXER_TYPE
GST_IS_MIXER
GST_TYPE_STREAM_VOLUME_FORMAT
gst_mixer_get_type
gst_mixer_type_get_type
gst_mixer_flags_get_type
gst_mixer_message_type_get_type
gst_stream_volume_format_get_type
</SECTION>
<SECTION>
<FILE>gstmixeroptions</FILE>
<INCLUDE>gst/audio/mixer.h</INCLUDE>
GstMixerOptions
gst_mixer_options_get_values
<SUBSECTION Standard>
GstMixerOptionsClass
GST_TYPE_MIXER_OPTIONS
GST_MIXER_OPTIONS
GST_MIXER_OPTIONS_CLASS
GST_IS_MIXER_OPTIONS
GST_IS_MIXER_OPTIONS_CLASS
GST_MIXER_OPTIONS_GET_CLASS
gst_mixer_options_get_type
</SECTION>
<SECTION>
<FILE>gstmixertrack</FILE>
<INCLUDE>gst/audio/mixer.h</INCLUDE>
GstMixerTrack
GstMixerTrackFlags
GST_MIXER_TRACK_HAS_FLAG
<SUBSECTION Standard>
GstMixerTrackClass
GST_TYPE_MIXER_TRACK
GST_TYPE_MIXER_TRACK_FLAGS
GST_MIXER_TRACK
GST_MIXER_TRACK_CLASS
GST_IS_MIXER_TRACK
GST_IS_MIXER_TRACK_CLASS
gst_mixer_track_flags_get_type
gst_mixer_track_get_type
</SECTION>
<SECTION>
<FILE>gstnavigation</FILE>
<INCLUDE>gst/interfaces/navigation.h</INCLUDE>
<INCLUDE>gst/video/navigation.h</INCLUDE>
GstNavigation
GstNavigationInterface
GstNavigationCommand
@ -777,71 +690,6 @@ GST_IS_STREAM_VOLUME_INTERFACE
gst_stream_volume_get_type
</SECTION>
<SECTION>
<FILE>gsttuner</FILE>
<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
GstTuner
GstTunerInterface
gst_tuner_list_channels
gst_tuner_get_channel
gst_tuner_set_channel
gst_tuner_list_norms
gst_tuner_get_norm
gst_tuner_set_norm
gst_tuner_get_frequency
gst_tuner_set_frequency
gst_tuner_signal_strength
gst_tuner_find_norm_by_name
gst_tuner_find_channel_by_name
gst_tuner_channel_changed
gst_tuner_norm_changed
gst_tuner_frequency_changed
gst_tuner_signal_changed
<SUBSECTION Standard>
GST_TYPE_TUNER
GST_TUNER
GST_TUNER_GET_INTERFACE
GST_IS_TUNER
gst_tuner_get_type
</SECTION>
<SECTION>
<FILE>gsttunerchannel</FILE>
<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
GstTunerChannel
GstTunerChannelFlags
GST_TUNER_CHANNEL_HAS_FLAG
<SUBSECTION Standard>
GstTunerChannelClass
GST_TYPE_TUNER_CHANNEL
GST_TYPE_TUNER_CHANNEL_FLAGS
GST_TUNER_CHANNEL
GST_TUNER_CHANNEL_CLASS
GST_IS_TUNER_CHANNEL
GST_IS_TUNER_CHANNEL_CLASS
gst_tuner_channel_flags_get_type
gst_tuner_channel_get_type
</SECTION>
<SECTION>
<FILE>gsttunernorm</FILE>
<INCLUDE>gst/interfaces/tuner.h</INCLUDE>
GstTunerNorm
<SUBSECTION Standard>
GstTunerNormClass
GST_TYPE_TUNER_NORM
GST_TUNER_NORM
GST_TUNER_NORM_CLASS
GST_IS_TUNER_NORM
GST_IS_TUNER_NORM_CLASS
gst_tuner_norm_get_type
</SECTION>
<SECTION>
<FILE>gstvideoorientation</FILE>
<INCLUDE>gst/video/videoorientation.h</INCLUDE>

View file

@ -22,16 +22,8 @@ gst_audio_base_src_get_type
#include <gst/audio/gstaudioringbuffer.h>
gst_audio_ring_buffer_get_type
#include <gst/audio/mixer.h>
gst_mixer_get_type
gst_mixer_options_get_type
gst_mixer_track_get_type
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
gst_navigation_get_type
#include <gst/interfaces/tuner.h>
gst_tuner_get_type
gst_tuner_channel_get_type
gst_tuner_norm_get_type
#include <gst/audio/streamvolume.h>
gst_stream_volume_get_type

View file

@ -2,10 +2,6 @@ plugin_LTLIBRARIES = libgstalsa.la
libgstalsa_la_SOURCES = \
gstalsadeviceprobe.c \
gstalsamixer.c \
gstalsamixerelement.c \
gstalsamixertrack.c \
gstalsamixeroptions.c \
gstalsaplugin.c \
gstalsasink.c \
gstalsasrc.c \
@ -17,7 +13,6 @@ libgstalsa_la_CFLAGS = \
$(GST_CFLAGS) \
$(ALSA_CFLAGS)
libgstalsa_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_API_VERSION).la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_API_VERSION).la \
$(GST_BASE_LIBS) \
$(ALSA_LIBS)
@ -28,9 +23,5 @@ libgstalsa_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstalsa.h \
gstalsadeviceprobe.h \
gstalsamixer.h \
gstalsamixerelement.h \
gstalsamixertrack.h \
gstalsamixeroptions.h \
gstalsasrc.h \
gstalsasink.h

View file

@ -1,950 +0,0 @@
/* ALSA mixer implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:element-alsamixer
* @see_also: alsasink, alsasrc
*
* This element controls various aspects such as the volume and balance
* of an audio device using the ALSA api.
*
* The application should query and use the interfaces provided by this
* element to control the device.
*
* Last reviewed on 2006-03-01 (0.10.4)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstalsamixer.h"
#include "gst/glib-compat-private.h"
#include <errno.h>
static void gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
GstAlsaMixerOptions * alsa_opts);
static void gst_alsa_mixer_update_track (GstAlsaMixer * mixer,
GstAlsaMixerTrack * alsa_track);
static int gst_alsa_mixer_handle_callback (snd_mixer_t * handle,
unsigned int mask, snd_mixer_elem_t * elem);
/* First some utils, then the mixer implementation */
static gboolean
gst_alsa_mixer_open (GstAlsaMixer * mixer)
{
gint err;
snd_ctl_t *ctl;
snd_ctl_card_info_t *card_info;
g_return_val_if_fail (mixer->handle == NULL, FALSE);
/* open and initialize the mixer device */
err = snd_mixer_open (&mixer->handle, 0);
if (err < 0 || mixer->handle == NULL)
goto open_failed;
if ((err = snd_mixer_attach (mixer->handle, mixer->device)) < 0) {
GST_WARNING ("Cannot open mixer for sound device '%s': %s", mixer->device,
snd_strerror (err));
goto error;
}
if ((err = snd_mixer_selem_register (mixer->handle, NULL, NULL)) < 0) {
GST_WARNING ("Cannot register mixer elements: %s", snd_strerror (err));
goto error;
}
if ((err = snd_mixer_load (mixer->handle)) < 0) {
GST_WARNING ("Cannot load mixer settings: %s", snd_strerror (err));
goto error;
}
snd_mixer_set_callback_private (mixer->handle, mixer);
snd_mixer_set_callback (mixer->handle, gst_alsa_mixer_handle_callback);
/* now get the device name, any of this is not fatal */
g_free (mixer->cardname);
if ((err = snd_ctl_open (&ctl, mixer->device, 0)) < 0) {
GST_WARNING ("Cannot open CTL: %s", snd_strerror (err));
goto no_card_name;
}
snd_ctl_card_info_malloc (&card_info);
if ((err = snd_ctl_card_info (ctl, card_info)) < 0) {
GST_WARNING ("Cannot get card info: %s", snd_strerror (err));
snd_ctl_close (ctl);
goto no_card_name;
}
mixer->cardname = g_strdup (snd_ctl_card_info_get_name (card_info));
GST_DEBUG ("Card name = %s", GST_STR_NULL (mixer->cardname));
snd_ctl_card_info_free (card_info);
snd_ctl_close (ctl);
no_card_name:
if (mixer->cardname == NULL) {
mixer->cardname = g_strdup ("Unknown");
GST_DEBUG ("Cannot find card name");
}
GST_INFO ("Successfully opened mixer for device '%s'.", mixer->device);
return TRUE;
/* ERROR */
open_failed:
{
GST_WARNING ("Cannot open mixer: %s", snd_strerror (err));
mixer->handle = NULL;
return FALSE;
}
error:
{
snd_mixer_close (mixer->handle);
mixer->handle = NULL;
return FALSE;
}
}
static snd_mixer_elem_t *
gst_alsa_mixer_find_master_mixer (GstAlsaMixer * mixer, snd_mixer_t * handle)
{
snd_mixer_elem_t *element;
gint i, count;
count = snd_mixer_get_count (handle);
GST_ALSA_MIXER_LOCK (mixer);
/* Check if we have a playback mixer labelled as 'Master' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Master") == 0) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, check if we have a playback mixer labelled as 'Front' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Front") == 0) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, check if we have a playback mixer labelled as 'PCM' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "PCM") == 0) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, check if we have a playback mixer labelled as 'Speaker' */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
strcmp (snd_mixer_selem_get_name (element), "Speaker") == 0) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, check if we have a playback mixer with both volume and switch that
* is not mono */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element) &&
!snd_mixer_selem_is_playback_mono (element)) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, check if we have any playback mixer with both volume and switch */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element) &&
snd_mixer_selem_has_playback_switch (element)) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
/* If not, take any playback mixer with a volume control */
element = snd_mixer_first_elem (handle);
for (i = 0; i < count; i++) {
if (snd_mixer_selem_has_playback_volume (element)) {
GST_ALSA_MIXER_UNLOCK (mixer);
return element;
}
element = snd_mixer_elem_next (element);
}
GST_ALSA_MIXER_UNLOCK (mixer);
/* Looks like we're out of luck ... */
return NULL;
}
static void
gst_alsa_mixer_update (GstAlsaMixer * mixer, snd_mixer_elem_t * elem)
{
GList *item;
g_return_if_fail (mixer != NULL);
GST_ALSA_MIXER_LOCK (mixer);
for (item = mixer->tracklist; item != NULL; item = item->next) {
if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
if (elem && (GST_ALSA_MIXER_TRACK (item->data)->element != elem))
continue;
gst_alsa_mixer_update_track (mixer, GST_ALSA_MIXER_TRACK (item->data));
} else if (GST_IS_ALSA_MIXER_OPTIONS (item->data)) {
if (elem && (GST_ALSA_MIXER_OPTIONS (item->data)->element != elem))
continue;
gst_alsa_mixer_update_option (mixer, GST_ALSA_MIXER_OPTIONS (item->data));
}
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
static int
gst_alsa_mixer_elem_handle_callback (snd_mixer_elem_t * elem, unsigned int mask)
{
GstAlsaMixer *mixer =
(GstAlsaMixer *) snd_mixer_elem_get_callback_private (elem);
GST_LOG ("ALSA elem cb");
g_return_val_if_fail (mixer != NULL, 1);
gst_alsa_mixer_update (mixer, elem);
return 0;
}
static int
gst_alsa_mixer_handle_callback (snd_mixer_t * handle, unsigned int mask,
snd_mixer_elem_t * elem)
{
GstAlsaMixer *mixer =
(GstAlsaMixer *) snd_mixer_get_callback_private (handle);
GST_LOG ("ALSA cb");
g_return_val_if_fail (mixer != NULL, 1);
/* Hopefully won't be call recursively and will handle pending elem events */
snd_mixer_handle_events (mixer->handle);
gst_alsa_mixer_update (mixer, elem);
return 0;
}
static void
gst_alsa_mixer_ensure_track_list (GstAlsaMixer * mixer)
{
gint i, count;
snd_mixer_elem_t *element, *master;
GList *item;
g_return_if_fail (mixer->handle != NULL);
if (mixer->tracklist)
return;
GST_ALSA_MIXER_LOCK (mixer);
master = gst_alsa_mixer_find_master_mixer (mixer, mixer->handle);
count = snd_mixer_get_count (mixer->handle);
element = snd_mixer_first_elem (mixer->handle);
/* build track list
*
* Some ALSA tracks may have playback and capture capabilities.
* Here we model them as two separate GStreamer tracks.
*/
for (i = 0; i < count; i++) {
GstMixerTrack *play_track = NULL;
GstMixerTrack *cap_track = NULL;
const gchar *name;
GList *item;
gint samename = 0;
name = snd_mixer_selem_get_name (element);
/* prevent dup names */
for (item = mixer->tracklist; item != NULL; item = item->next) {
snd_mixer_elem_t *temp;
if (GST_IS_ALSA_MIXER_OPTIONS (item->data))
temp = GST_ALSA_MIXER_OPTIONS (item->data)->element;
else
temp = GST_ALSA_MIXER_TRACK (item->data)->element;
if (strcmp (name, snd_mixer_selem_get_name (temp)) == 0)
samename++;
}
GST_LOG ("[%s] probing element #%u, mixer->dir=%u", name, i, mixer->dir);
if (mixer->dir & GST_ALSA_MIXER_PLAYBACK) {
gboolean has_playback_switch, has_playback_volume;
has_playback_switch = snd_mixer_selem_has_playback_switch (element);
has_playback_volume = snd_mixer_selem_has_playback_volume (element);
GST_LOG ("[%s] PLAYBACK: has_playback_volume=%d, has_playback_switch=%d"
"%s", name, has_playback_volume, has_playback_switch,
(element == master) ? " MASTER" : "");
if (has_playback_volume) {
gint flags = GST_MIXER_TRACK_OUTPUT;
if (element == master)
flags |= GST_MIXER_TRACK_MASTER;
play_track = gst_alsa_mixer_track_new (element, samename, i,
flags, FALSE, NULL, FALSE);
} else if (has_playback_switch) {
/* simple mute switch */
play_track = gst_alsa_mixer_track_new (element, samename, i,
GST_MIXER_TRACK_OUTPUT, TRUE, NULL, FALSE);
}
if (snd_mixer_selem_is_enumerated (element)) {
GstMixerOptions *opts = gst_alsa_mixer_options_new (element, i);
GST_LOG ("[%s] is enumerated (%d)", name, i);
mixer->tracklist = g_list_append (mixer->tracklist, opts);
}
}
if (mixer->dir & GST_ALSA_MIXER_CAPTURE) {
gboolean has_capture_switch, has_common_switch;
gboolean has_capture_volume, has_common_volume;
has_capture_switch = snd_mixer_selem_has_capture_switch (element);
has_common_switch = snd_mixer_selem_has_common_switch (element);
has_capture_volume = snd_mixer_selem_has_capture_volume (element);
has_common_volume = snd_mixer_selem_has_common_volume (element);
GST_LOG ("[%s] CAPTURE: has_capture_volume=%d, has_common_volume=%d, "
"has_capture_switch=%d, has_common_switch=%d, play_track=%p", name,
has_capture_volume, has_common_volume, has_capture_switch,
has_common_switch, play_track);
if (has_capture_volume && !(play_track && has_common_volume)) {
cap_track = gst_alsa_mixer_track_new (element, samename, i,
GST_MIXER_TRACK_INPUT, FALSE, NULL, play_track != NULL);
} else if (has_capture_switch && !(play_track && has_common_switch)) {
cap_track = gst_alsa_mixer_track_new (element, samename, i,
GST_MIXER_TRACK_INPUT, TRUE, NULL, play_track != NULL);
}
}
if (play_track && cap_track) {
GST_ALSA_MIXER_TRACK (play_track)->shared_mute =
GST_ALSA_MIXER_TRACK (cap_track);
GST_ALSA_MIXER_TRACK (cap_track)->shared_mute =
GST_ALSA_MIXER_TRACK (play_track);
}
if (play_track)
mixer->tracklist = g_list_append (mixer->tracklist, play_track);
if (cap_track)
mixer->tracklist = g_list_append (mixer->tracklist, cap_track);
element = snd_mixer_elem_next (element);
}
for (item = mixer->tracklist; item != NULL; item = item->next) {
snd_mixer_elem_t *temp;
if (GST_IS_ALSA_MIXER_OPTIONS (item->data))
temp = GST_ALSA_MIXER_OPTIONS (item->data)->element;
else
temp = GST_ALSA_MIXER_TRACK (item->data)->element;
snd_mixer_elem_set_callback (temp, gst_alsa_mixer_elem_handle_callback);
snd_mixer_elem_set_callback_private (temp, mixer);
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
static void
task_monitor_alsa (gpointer data)
{
struct pollfd *pfds;
int nfds, rnfds;
unsigned short revents;
GstAlsaMixer *mixer = (GstAlsaMixer *) data;
gint ret;
GST_ALSA_MIXER_LOCK (mixer);
nfds = snd_mixer_poll_descriptors_count (mixer->handle);
if (nfds <= 0) {
GST_ERROR ("snd_mixer_poll_descriptors_count <= 0: %d", nfds);
/* FIXME: sleep ? stop monitoring ? */
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
pfds = g_newa (struct pollfd, nfds + 1);
rnfds = snd_mixer_poll_descriptors (mixer->handle, pfds, nfds);
g_assert (rnfds <= nfds);
if (rnfds < 0) {
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), ("alsa error: %s",
snd_strerror (rnfds)));
gst_task_pause (mixer->task);
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
pfds[rnfds].fd = mixer->pfd[0];
pfds[rnfds].events = POLLIN | POLLPRI | POLLHUP | POLLERR;
pfds[rnfds].revents = 0;
GST_ALSA_MIXER_UNLOCK (mixer);
GST_LOG ("task loop");
ret = poll (pfds, rnfds + 1, -1);
if (ret < 0) {
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), GST_ERROR_SYSTEM);
gst_task_pause (mixer->task);
return;
}
GST_ALSA_MIXER_LOCK (mixer);
ret =
snd_mixer_poll_descriptors_revents (mixer->handle, pfds, nfds, &revents);
if (ret < 0) {
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), ("alsa error: %s",
snd_strerror (ret)));
gst_task_pause (mixer->task);
} else if (revents & (POLLIN | POLLPRI)) {
GST_DEBUG ("Handling events");
snd_mixer_handle_events (mixer->handle);
} else if (revents & (POLLERR | POLLNVAL | POLLHUP)) {
GST_ELEMENT_ERROR (mixer, RESOURCE, READ, (NULL), (NULL));
gst_task_pause (mixer->task);
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
/* API */
GstAlsaMixer *
gst_alsa_mixer_new (const char *device, GstAlsaMixerDirection dir)
{
GstAlsaMixer *ret = NULL;
g_return_val_if_fail (device != NULL, NULL);
ret = g_new0 (GstAlsaMixer, 1);
if (pipe (ret->pfd) == -1)
goto error;
g_rec_mutex_init (&ret->rec_mutex);
g_rec_mutex_init (&ret->task_mutex);
ret->task = gst_task_new (task_monitor_alsa, ret);
gst_task_set_lock (ret->task, &ret->task_mutex);
ret->device = g_strdup (device);
ret->dir = dir;
if (!gst_alsa_mixer_open (ret))
goto error;
if (gst_task_start (ret->task) == FALSE) {
GST_WARNING ("Could not start alsamixer task");
}
return ret;
/* ERRORS */
error:
{
gst_alsa_mixer_free (ret);
return NULL;
}
}
void
gst_alsa_mixer_free (GstAlsaMixer * mixer)
{
g_return_if_fail (mixer != NULL);
if (mixer->task) {
if (write (mixer->pfd[1], "stop", 5) <= 0) {
GST_ERROR ("Cannot send " "stop" " to alsamixer task");
close (mixer->pfd[1]);
mixer->pfd[1] = -1;
}
if (gst_task_join (mixer->task) == FALSE) {
GST_ERROR ("Cannot join alsamixer task");
}
gst_object_unref (mixer->task);
mixer->task = NULL;
}
g_rec_mutex_clear (&mixer->task_mutex);
if (mixer->pfd[0] > 0) {
close (mixer->pfd[0]);
mixer->pfd[0] = -1;
}
if (mixer->pfd[1] > 0) {
close (mixer->pfd[1]);
mixer->pfd[1] = -1;
}
if (mixer->interface) {
g_object_unref (G_OBJECT (mixer->interface));
mixer->interface = NULL;
}
if (mixer->device) {
g_free (mixer->device);
mixer->device = NULL;
}
if (mixer->cardname) {
g_free (mixer->cardname);
mixer->cardname = NULL;
}
if (mixer->tracklist) {
g_list_foreach (mixer->tracklist, (GFunc) g_object_unref, NULL);
g_list_free (mixer->tracklist);
mixer->tracklist = NULL;
}
if (mixer->handle) {
snd_mixer_close (mixer->handle);
mixer->handle = NULL;
}
g_rec_mutex_clear (&mixer->rec_mutex);
g_free (mixer);
}
const GList *
gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer)
{
g_return_val_if_fail (mixer->handle != NULL, NULL);
gst_alsa_mixer_ensure_track_list (mixer);
return (const GList *) mixer->tracklist;
}
void
gst_alsa_mixer_get_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
gint * volumes)
{
gint i;
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
g_return_if_fail (mixer->handle != NULL);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (track->flags & GST_MIXER_TRACK_OUTPUT) { /* return playback volume */
/* Is emulated mute flag activated? */
if (track->flags & GST_MIXER_TRACK_MUTE &&
!(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
for (i = 0; i < track->num_channels; i++)
volumes[i] = alsa_track->volumes[i];
} else {
for (i = 0; i < track->num_channels; i++) {
long tmp = 0;
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &tmp);
alsa_track->volumes[i] = volumes[i] = (gint) tmp;
}
}
} else if (track->flags & GST_MIXER_TRACK_INPUT) { /* return capture volume */
/* Is emulated record flag activated? */
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH ||
track->flags & GST_MIXER_TRACK_RECORD) {
for (i = 0; i < track->num_channels; i++) {
long tmp = 0;
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &tmp);
alsa_track->volumes[i] = volumes[i] = (gint) tmp;
}
} else {
for (i = 0; i < track->num_channels; i++)
volumes[i] = alsa_track->volumes[i];
}
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
static gboolean
check_if_volumes_are_the_same (guint num_channels, gint * volumes)
{
guint i;
if (num_channels <= 1)
return TRUE;
for (i = 1; i < num_channels; i++) {
if (volumes[i] != volumes[0])
return FALSE;
}
return TRUE;
}
void
gst_alsa_mixer_set_volume (GstAlsaMixer * mixer, GstMixerTrack * track,
gint * volumes)
{
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
gint i;
g_return_if_fail (mixer->handle != NULL);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (track->flags & GST_MIXER_TRACK_OUTPUT) {
/* Is emulated mute flag activated? */
if (track->flags & GST_MIXER_TRACK_MUTE &&
!(alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH)) {
for (i = 0; i < track->num_channels; i++)
alsa_track->volumes[i] = volumes[i];
} else {
if (check_if_volumes_are_the_same (track->num_channels, volumes)) {
snd_mixer_selem_set_playback_volume_all (alsa_track->element,
volumes[0]);
for (i = 0; i < track->num_channels; i++)
alsa_track->volumes[i] = volumes[0];
} else {
for (i = 0; i < track->num_channels; i++) {
alsa_track->volumes[i] = volumes[i];
snd_mixer_selem_set_playback_volume (alsa_track->element, i,
volumes[i]);
}
}
}
} else if (track->flags & GST_MIXER_TRACK_INPUT) {
/* Is emulated record flag activated? */
if (track->flags & GST_MIXER_TRACK_RECORD ||
alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
if (check_if_volumes_are_the_same (track->num_channels, volumes)) {
snd_mixer_selem_set_capture_volume_all (alsa_track->element,
volumes[0]);
for (i = 0; i < track->num_channels; i++)
alsa_track->volumes[i] = volumes[0];
} else {
for (i = 0; i < track->num_channels; i++) {
alsa_track->volumes[i] = volumes[i];
snd_mixer_selem_set_capture_volume (alsa_track->element, i,
volumes[i]);
}
}
} else {
for (i = 0; i < track->num_channels; i++)
alsa_track->volumes[i] = volumes[i];
}
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
gst_alsa_mixer_set_mute (GstAlsaMixer * mixer, GstMixerTrack * track,
gboolean mute)
{
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
g_return_if_fail (mixer->handle != NULL);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(mute) == ! !(track->flags & GST_MIXER_TRACK_MUTE)) {
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
if (mute) {
track->flags |= GST_MIXER_TRACK_MUTE;
if (alsa_track->shared_mute)
((GstMixerTrack *) (alsa_track->shared_mute))->flags |=
GST_MIXER_TRACK_MUTE;
} else {
track->flags &= ~GST_MIXER_TRACK_MUTE;
if (alsa_track->shared_mute)
((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
~GST_MIXER_TRACK_MUTE;
}
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_PSWITCH) {
snd_mixer_selem_set_playback_switch_all (alsa_track->element, mute ? 0 : 1);
} else {
gint i;
GstAlsaMixerTrack *ctrl_track;
if ((track->flags & GST_MIXER_TRACK_INPUT)
&& alsa_track->shared_mute != NULL)
ctrl_track = alsa_track->shared_mute;
else
ctrl_track = alsa_track;
for (i = 0; i < ((GstMixerTrack *) ctrl_track)->num_channels; i++) {
long vol =
mute ? ((GstMixerTrack *) ctrl_track)->min_volume : ctrl_track->
volumes[i];
snd_mixer_selem_set_playback_volume (ctrl_track->element, i, vol);
}
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
GstMixerTrack * track, gboolean record)
{
GstAlsaMixerTrack *alsa_track = GST_ALSA_MIXER_TRACK (track);
g_return_if_fail (mixer->handle != NULL);
GST_ALSA_MIXER_LOCK (mixer);
gst_alsa_mixer_track_update (alsa_track);
if (! !(record) == ! !(track->flags & GST_MIXER_TRACK_RECORD)) {
GST_ALSA_MIXER_UNLOCK (mixer);
return;
}
if (record) {
track->flags |= GST_MIXER_TRACK_RECORD;
} else {
track->flags &= ~GST_MIXER_TRACK_RECORD;
}
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH) {
snd_mixer_selem_set_capture_switch_all (alsa_track->element,
record ? 1 : 0);
/* update all tracks in same exclusive cswitch group */
if (alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL) {
GList *item;
for (item = mixer->tracklist; item != NULL; item = item->next) {
if (GST_IS_ALSA_MIXER_TRACK (item->data)) {
GstAlsaMixerTrack *item_alsa_track =
GST_ALSA_MIXER_TRACK (item->data);
if (item_alsa_track->alsa_flags & GST_ALSA_MIXER_TRACK_CSWITCH_EXCL &&
item_alsa_track->capture_group == alsa_track->capture_group) {
gst_alsa_mixer_track_update (item_alsa_track);
}
}
}
}
} else {
gint i;
for (i = 0; i < track->num_channels; i++) {
long vol = record ? alsa_track->volumes[i] : track->min_volume;
snd_mixer_selem_set_capture_volume (alsa_track->element, i, vol);
}
}
GST_ALSA_MIXER_UNLOCK (mixer);
}
void
gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
GstMixerOptions * opts, gchar * value)
{
gint idx = -1, n = 0;
GList *item;
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
g_return_if_fail (mixer->handle != NULL);
for (item = opts->values; item != NULL; item = item->next, n++) {
if (!strcmp (item->data, value)) {
idx = n;
break;
}
}
if (idx == -1)
return;
GST_ALSA_MIXER_LOCK (mixer);
snd_mixer_selem_set_enum_item (alsa_opts->element, 0, idx);
GST_ALSA_MIXER_UNLOCK (mixer);
}
const gchar *
gst_alsa_mixer_get_option (GstAlsaMixer * mixer, GstMixerOptions * opts)
{
gint ret;
guint idx;
GstAlsaMixerOptions *alsa_opts = GST_ALSA_MIXER_OPTIONS (opts);
g_return_val_if_fail (mixer->handle != NULL, NULL);
GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0)
return g_list_nth_data (opts->values, idx);
else
return snd_strerror (ret); /* feeble attempt at error handling */
}
GstMixerFlags
gst_alsa_mixer_get_mixer_flags (GstAlsaMixer * mixer)
{
g_return_val_if_fail (mixer != NULL, GST_MIXER_FLAG_NONE);
return GST_MIXER_FLAG_AUTO_NOTIFICATIONS;
}
static void
gst_alsa_mixer_update_option (GstAlsaMixer * mixer,
GstAlsaMixerOptions * alsa_opts)
{
gint ret;
guint idx;
/* const */ gchar *option;
if (mixer->interface == NULL) {
GST_WARNING ("Cannot send update notifications, no GstMixer * given");
return;
}
GST_ALSA_MIXER_LOCK (mixer);
ret = snd_mixer_selem_get_enum_item (alsa_opts->element, 0, &idx);
GST_ALSA_MIXER_UNLOCK (mixer);
if (ret == 0) {
option = g_list_nth_data (GST_MIXER_OPTIONS (alsa_opts)->values, idx);
gst_mixer_option_changed (mixer->interface, GST_MIXER_OPTIONS (alsa_opts),
option);
}
}
static void
gst_alsa_mixer_update_track (GstAlsaMixer * mixer,
GstAlsaMixerTrack * alsa_track)
{
GstMixerTrack *track = (GstMixerTrack *) alsa_track;
gboolean old_mute;
gboolean old_record;
gint i, n_channels;
gint *old_volumes;
GST_DEBUG ("Updating track %" GST_PTR_FORMAT, alsa_track);
if (mixer->interface == NULL) {
GST_WARNING ("Cannot send update notifications, no GstMixer * given");
return;
}
old_mute = ! !(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
old_record = ! !(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
old_volumes = g_new (gint, track->num_channels);
n_channels = track->num_channels;
memcpy (old_volumes, alsa_track->volumes,
sizeof (gint) * track->num_channels);
gst_alsa_mixer_track_update (alsa_track);
if (old_record !=
! !(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD))) {
gst_mixer_record_toggled (mixer->interface, track,
! !GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_RECORD));
}
if (old_mute != ! !(GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE))) {
gst_mixer_mute_toggled (mixer->interface, track,
! !GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE));
}
n_channels = MIN (n_channels, track->num_channels);
for (i = 0; i < n_channels; i++) {
if (old_volumes[i] != alsa_track->volumes[i]) {
gst_mixer_volume_changed (mixer->interface, track, alsa_track->volumes);
break;
}
}
g_free (old_volumes);
}
/* utility function for gstalsamixerelement to set the interface */
void
_gst_alsa_mixer_set_interface (GstAlsaMixer * mixer, GstMixer * interface)
{
g_return_if_fail (mixer != NULL && mixer->interface == NULL);
g_return_if_fail (interface != NULL);
mixer->interface = g_object_ref (G_OBJECT (interface));
}

View file

@ -1,217 +0,0 @@
/* ALSA mixer interface implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GST_ALSA_MIXER_H__
#define __GST_ALSA_MIXER_H__
#include "gstalsa.h"
#include <gst/audio/mixer.h>
#include "gstalsamixeroptions.h"
#include "gstalsamixertrack.h"
G_BEGIN_DECLS
/* This does not get you what you think it does, use obj->mixer */
/* #define GST_ALSA_MIXER(obj) ((GstAlsaMixer*)(obj)) */
typedef struct _GstAlsaMixer GstAlsaMixer;
typedef enum {
GST_ALSA_MIXER_CAPTURE = 1<<0,
GST_ALSA_MIXER_PLAYBACK = 1<<1,
GST_ALSA_MIXER_ALL = GST_ALSA_MIXER_CAPTURE | GST_ALSA_MIXER_PLAYBACK
} GstAlsaMixerDirection;
/**
* GstAlsaMixer:
*
* Opaque data structure
*/
struct _GstAlsaMixer
{
GList * tracklist; /* list of available tracks */
snd_mixer_t * handle;
GstTask * task;
GRecMutex task_mutex;
GRecMutex rec_mutex;
int pfd[2];
GstMixer * interface;
gchar * device;
gchar * cardname;
GstAlsaMixerDirection dir;
};
#define GST_ALSA_MIXER_LOCK(mixer) g_rec_mutex_lock (&mixer->rec_mutex)
#define GST_ALSA_MIXER_UNLOCK(mixer) g_rec_mutex_unlock (&mixer->rec_mutex)
GstAlsaMixer* gst_alsa_mixer_new (const gchar *device,
GstAlsaMixerDirection dir);
void gst_alsa_mixer_free (GstAlsaMixer *mixer);
const GList* gst_alsa_mixer_list_tracks (GstAlsaMixer * mixer);
void gst_alsa_mixer_set_volume (GstAlsaMixer * mixer,
GstMixerTrack * track,
gint * volumes);
void gst_alsa_mixer_get_volume (GstAlsaMixer * mixer,
GstMixerTrack * track,
gint * volumes);
void gst_alsa_mixer_set_record (GstAlsaMixer * mixer,
GstMixerTrack * track,
gboolean record);
void gst_alsa_mixer_set_mute (GstAlsaMixer * mixer,
GstMixerTrack * track,
gboolean mute);
void gst_alsa_mixer_set_option (GstAlsaMixer * mixer,
GstMixerOptions * opts,
gchar * value);
const gchar* gst_alsa_mixer_get_option (GstAlsaMixer * mixer,
GstMixerOptions * opts);
void _gst_alsa_mixer_set_interface (GstAlsaMixer * mixer,
GstMixer * interface);
GstMixerFlags gst_alsa_mixer_get_mixer_flags (GstAlsaMixer *mixer);
#define GST_IMPLEMENT_ALSA_MIXER_METHODS(Type, interface_as_function) \
static const GList* \
interface_as_function ## _list_tracks (GstMixer * mixer) \
{ \
Type *this = (Type*) mixer; \
\
g_return_val_if_fail (this != NULL, NULL); \
g_return_val_if_fail (this->mixer != NULL, NULL); \
\
return gst_alsa_mixer_list_tracks (this->mixer); \
} \
\
static void \
interface_as_function ## _set_volume (GstMixer * mixer, GstMixerTrack * track, \
gint * volumes) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_alsa_mixer_set_volume (this->mixer, track, volumes); \
} \
\
static void \
interface_as_function ## _get_volume (GstMixer * mixer, GstMixerTrack * track, \
gint * volumes) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_alsa_mixer_get_volume (this->mixer, track, volumes); \
} \
\
static void \
interface_as_function ## _set_record (GstMixer * mixer, GstMixerTrack * track, \
gboolean record) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_alsa_mixer_set_record (this->mixer, track, record); \
} \
\
static void \
interface_as_function ## _set_mute (GstMixer * mixer, GstMixerTrack * track, \
gboolean mute) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_alsa_mixer_set_mute (this->mixer, track, mute); \
} \
\
static void \
interface_as_function ## _set_option (GstMixer * mixer, GstMixerOptions * opts, \
gchar * value) \
{ \
Type *this = (Type*) mixer; \
\
g_return_if_fail (this != NULL); \
g_return_if_fail (this->mixer != NULL); \
\
gst_alsa_mixer_set_option (this->mixer, opts, value); \
} \
\
static const gchar* \
interface_as_function ## _get_option (GstMixer * mixer, GstMixerOptions * opts) \
{ \
Type *this = (Type*) mixer; \
\
g_return_val_if_fail (this != NULL, NULL); \
g_return_val_if_fail (this->mixer != NULL, NULL); \
\
return gst_alsa_mixer_get_option (this->mixer, opts); \
} \
\
static GstMixerFlags \
interface_as_function ## _get_mixer_flags (GstMixer * mixer) \
{ \
Type *this = (Type*) mixer; \
\
g_return_val_if_fail (this != NULL, GST_MIXER_FLAG_NONE); \
g_return_val_if_fail (this->mixer != NULL, GST_MIXER_FLAG_NONE); \
\
return gst_alsa_mixer_get_mixer_flags (this->mixer); \
} \
\
static GstMixerType \
interface_as_function ## _get_mixer_type (GstMixer * mixer) \
{ \
return GST_MIXER_HARDWARE; \
} \
\
static void \
interface_as_function ## _interface_init (GstMixerInterface * iface) \
{ \
/* set up the interface hooks */ \
iface->list_tracks = interface_as_function ## _list_tracks; \
iface->set_volume = interface_as_function ## _set_volume; \
iface->get_volume = interface_as_function ## _get_volume; \
iface->set_mute = interface_as_function ## _set_mute; \
iface->set_record = interface_as_function ## _set_record; \
iface->set_option = interface_as_function ## _set_option; \
iface->get_option = interface_as_function ## _get_option; \
iface->get_mixer_flags = interface_as_function ## _get_mixer_flags; \
iface->get_mixer_type = interface_as_function ## _get_mixer_type; \
}
G_END_DECLS
#endif /* __GST_ALSA_MIXER_H__ */

View file

@ -1,218 +0,0 @@
/* ALSA mixer implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstalsamixerelement.h"
#include "gstalsadeviceprobe.h"
#define DEFAULT_PROP_DEVICE "default"
#define DEFAULT_PROP_DEVICE_NAME ""
enum
{
PROP_0,
PROP_DEVICE,
PROP_DEVICE_NAME
};
static void gst_alsa_mixer_element_init_interfaces (GType type);
#define gst_alsa_mixer_element_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAlsaMixerElement, gst_alsa_mixer_element,
GST_TYPE_ELEMENT,
gst_alsa_mixer_element_init_interfaces (g_define_type_id));
/* massive macro that takes care of all the GstMixer stuff */
GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaMixerElement, gst_alsa_mixer_element);
static void gst_alsa_mixer_element_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static void gst_alsa_mixer_element_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_alsa_mixer_element_finalize (GObject * object);
static GstStateChangeReturn gst_alsa_mixer_element_change_state (GstElement
* element, GstStateChange transition);
static void
gst_alsa_mixer_element_init_interfaces (GType type)
{
static const GInterfaceInfo mixer_iface_info = {
(GInterfaceInitFunc) gst_alsa_mixer_element_interface_init,
NULL,
NULL,
};
g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
#if 0
gst_alsa_type_add_device_property_probe_interface (type);
#endif
}
static void
gst_alsa_mixer_element_class_init (GstAlsaMixerElementClass * klass)
{
GstElementClass *element_class;
GObjectClass *gobject_class;
element_class = (GstElementClass *) klass;
gobject_class = (GObjectClass *) klass;
gobject_class->finalize = gst_alsa_mixer_element_finalize;
gobject_class->get_property = gst_alsa_mixer_element_get_property;
gobject_class->set_property = gst_alsa_mixer_element_set_property;
g_object_class_install_property (gobject_class, PROP_DEVICE,
g_param_spec_string ("device", "Device",
"ALSA device, as defined in an asound configuration file",
DEFAULT_PROP_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
g_param_spec_string ("device-name", "Device name",
"Human-readable name of the sound device",
DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_static_metadata (element_class,
"Alsa mixer", "Generic/Audio",
"Control sound input and output levels with ALSA",
"Leif Johnson <leif@ambient.2y.net>");
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_alsa_mixer_element_change_state);
}
static void
gst_alsa_mixer_element_finalize (GObject * obj)
{
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (obj);
g_free (this->device);
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
static void
gst_alsa_mixer_element_init (GstAlsaMixerElement * this)
{
this->mixer = NULL;
this->device = g_strdup (DEFAULT_PROP_DEVICE);
}
static void
gst_alsa_mixer_element_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
switch (prop_id) {
case PROP_DEVICE:{
GST_OBJECT_LOCK (this);
g_free (this->device);
this->device = g_value_dup_string (value);
/* make sure we never set NULL, this is nice when we want to open the
* device. */
if (this->device == NULL)
this->device = g_strdup (DEFAULT_PROP_DEVICE);
GST_OBJECT_UNLOCK (this);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_alsa_mixer_element_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (object);
switch (prop_id) {
case PROP_DEVICE:{
GST_OBJECT_LOCK (this);
g_value_set_string (value, this->device);
GST_OBJECT_UNLOCK (this);
break;
}
case PROP_DEVICE_NAME:{
GST_OBJECT_LOCK (this);
if (this->mixer) {
g_value_set_string (value, this->mixer->cardname);
} else {
g_value_set_string (value, NULL);
}
GST_OBJECT_UNLOCK (this);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static GstStateChangeReturn
gst_alsa_mixer_element_change_state (GstElement * element,
GstStateChange transition)
{
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
GstAlsaMixerElement *this = GST_ALSA_MIXER_ELEMENT (element);
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
if (!this->mixer) {
this->mixer = gst_alsa_mixer_new (this->device, GST_ALSA_MIXER_ALL);
if (!this->mixer)
goto open_failed;
_gst_alsa_mixer_set_interface (this->mixer, GST_MIXER (element));
}
break;
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE)
return ret;
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) {
gst_alsa_mixer_free (this->mixer);
this->mixer = NULL;
}
break;
default:
break;
}
return ret;
/* ERRORS */
open_failed:
{
GST_ELEMENT_ERROR (element, RESOURCE, OPEN_READ_WRITE, (NULL),
("Failed to open alsa mixer device '%s'", this->device));
return GST_STATE_CHANGE_FAILURE;
}
}

View file

@ -1,61 +0,0 @@
/* ALSA mixer interface implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GST_ALSA_MIXER_ELEMENT_H__
#define __GST_ALSA_MIXER_ELEMENT_H__
#include "gstalsa.h"
#include "gstalsamixer.h"
G_BEGIN_DECLS
#define GST_ALSA_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_ELEMENT,GstAlsaMixerElement))
#define GST_ALSA_MIXER_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_ELEMENT,GstAlsaMixerElementClass))
#define GST_IS_ALSA_MIXER_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_ELEMENT))
#define GST_IS_ALSA_MIXER_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_ELEMENT))
#define GST_TYPE_ALSA_MIXER_ELEMENT (gst_alsa_mixer_element_get_type())
typedef struct _GstAlsaMixerElement GstAlsaMixerElement;
typedef struct _GstAlsaMixerElementClass GstAlsaMixerElementClass;
/**
* GstAlsaMixerElement
*
* Opaque datastructure.
*/
struct _GstAlsaMixerElement {
GstElement parent;
GstAlsaMixer *mixer;
gchar *device;
};
struct _GstAlsaMixerElementClass {
GstElementClass parent;
};
GType gst_alsa_mixer_element_get_type (void);
G_END_DECLS
#endif /* __GST_ALSA_MIXER_ELEMENT_H__ */

View file

@ -1,109 +0,0 @@
/* ALSA mixer object implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstalsamixeroptions.h"
static void gst_alsa_mixer_options_init (GstAlsaMixerOptions * alsa_opts);
static void gst_alsa_mixer_options_class_init (gpointer g_class,
gpointer class_data);
static GstMixerOptionsClass *parent_class = NULL;
GType
gst_alsa_mixer_options_get_type (void)
{
static GType opts_type = 0;
if (!opts_type) {
static const GTypeInfo opts_info = {
sizeof (GstAlsaMixerOptionsClass),
NULL,
NULL,
gst_alsa_mixer_options_class_init,
NULL,
NULL,
sizeof (GstAlsaMixerOptions),
0,
(GInstanceInitFunc) gst_alsa_mixer_options_init,
};
opts_type =
g_type_register_static (GST_TYPE_MIXER_OPTIONS, "GstAlsaMixerOptions",
&opts_info, 0);
}
return opts_type;
}
static void
gst_alsa_mixer_options_class_init (gpointer g_class, gpointer class_data)
{
parent_class = g_type_class_peek_parent (g_class);
}
static void
gst_alsa_mixer_options_init (GstAlsaMixerOptions * alsa_opts)
{
}
GstMixerOptions *
gst_alsa_mixer_options_new (snd_mixer_elem_t * element, gint track_num)
{
GstMixerOptions *opts;
GstAlsaMixerOptions *alsa_opts;
GstMixerTrack *track;
const gchar *label;
guint index;
gint num, i;
gchar str[256];
label = snd_mixer_selem_get_name (element);
index = snd_mixer_selem_get_index (element);
GST_LOG ("[%s,%u]", label, index);
opts = g_object_new (GST_ALSA_MIXER_OPTIONS_TYPE,
"untranslated-label", label, "index", index, NULL);
alsa_opts = (GstAlsaMixerOptions *) opts;
track = (GstMixerTrack *) opts;
/* set basic information */
track->label = g_strdup (label); /* FIXME: translate this? */
track->num_channels = 0;
track->flags = 0;
alsa_opts->element = element;
alsa_opts->track_num = track_num;
/* get enumerations for switch/options object */
num = snd_mixer_selem_get_enum_items (element);
for (i = 0; i < num; i++) {
if (snd_mixer_selem_get_enum_item_name (element, i, 255, str) < 0) {
g_object_unref (G_OBJECT (alsa_opts));
return NULL;
}
opts->values = g_list_append (opts->values, g_strdup (str));
}
return opts;
}

View file

@ -1,62 +0,0 @@
/* ALSA mixer options object.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GST_ALSA_MIXER_OPTIONS_H__
#define __GST_ALSA_MIXER_OPTIONS_H__
#include "gstalsa.h"
#include <gst/audio/mixeroptions.h>
G_BEGIN_DECLS
#define GST_ALSA_MIXER_OPTIONS_TYPE (gst_alsa_mixer_options_get_type ())
#define GST_ALSA_MIXER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_OPTIONS,GstAlsaMixerOptions))
#define GST_ALSA_MIXER_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_OPTIONS,GstAlsaMixerOptionsClass))
#define GST_IS_ALSA_MIXER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_OPTIONS))
#define GST_IS_ALSA_MIXER_OPTIONS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_OPTIONS))
#define GST_TYPE_ALSA_MIXER_OPTIONS (gst_alsa_mixer_options_get_type())
typedef struct _GstAlsaMixerOptions GstAlsaMixerOptions;
typedef struct _GstAlsaMixerOptionsClass GstAlsaMixerOptionsClass;
struct _GstAlsaMixerOptions {
GstMixerOptions parent;
snd_mixer_elem_t *element; /* the ALSA mixer element for this track */
gint track_num;
};
struct _GstAlsaMixerOptionsClass {
GstMixerOptionsClass parent;
};
GType gst_alsa_mixer_options_get_type (void);
GstMixerOptions *gst_alsa_mixer_options_new (snd_mixer_elem_t * element,
gint track_num);
G_END_DECLS
#endif /* __GST_ALSA_MIXER_OPTIONS_H__ */

View file

@ -1,356 +0,0 @@
/* ALSA mixer track implementation.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst-i18n-plugin.h>
#include "gstalsamixertrack.h"
static void gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track);
static void gst_alsa_mixer_track_class_init (gpointer g_class,
gpointer class_data);
static GstMixerTrackClass *parent_class = NULL;
GType
gst_alsa_mixer_track_get_type (void)
{
static GType track_type = 0;
if (!track_type) {
static const GTypeInfo track_info = {
sizeof (GstAlsaMixerTrackClass),
NULL,
NULL,
gst_alsa_mixer_track_class_init,
NULL,
NULL,
sizeof (GstAlsaMixerTrack),
0,
(GInstanceInitFunc) gst_alsa_mixer_track_init,
NULL
};
track_type =
g_type_register_static (GST_TYPE_MIXER_TRACK, "GstAlsaMixerTrack",
&track_info, 0);
}
return track_type;
}
static void
gst_alsa_mixer_track_class_init (gpointer g_class, gpointer class_data)
{
parent_class = g_type_class_peek_parent (g_class);
}
static void
gst_alsa_mixer_track_init (GstAlsaMixerTrack * alsa_track)
{
}
static void
gst_alsa_mixer_track_update_alsa_capabilities (GstAlsaMixerTrack * alsa_track)
{
alsa_track->alsa_flags = 0;
alsa_track->capture_group = -1;
/* common flags */
if (snd_mixer_selem_has_common_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_VOLUME;
if (snd_mixer_selem_has_common_switch (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_SWITCH;
/* Since we create two separate mixer track objects for alsa elements that
* support both playback and capture, we're going to 'hide' the alsa flags
* that don't pertain to this mixer track from alsa_flags, otherwise
* gst_alsa_mixer_track_update() is going to do things we don't want */
/* playback flags */
if ((GST_MIXER_TRACK (alsa_track)->flags & GST_MIXER_TRACK_OUTPUT)) {
if (snd_mixer_selem_has_playback_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PVOLUME;
if (snd_mixer_selem_has_playback_switch (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_PSWITCH;
}
/* capture flags */
if ((GST_MIXER_TRACK (alsa_track)->flags & GST_MIXER_TRACK_INPUT)) {
if (snd_mixer_selem_has_capture_volume (alsa_track->element))
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CVOLUME;
if (snd_mixer_selem_has_capture_switch (alsa_track->element)) {
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH;
if (snd_mixer_selem_has_capture_switch_exclusive (alsa_track->element)) {
alsa_track->alsa_flags |= GST_ALSA_MIXER_TRACK_CSWITCH_EXCL;
alsa_track->capture_group =
snd_mixer_selem_get_capture_group (alsa_track->element);
}
}
}
GST_LOG ("[%s] alsa_flags=0x%08x, capture_group=%d",
snd_mixer_selem_get_name (alsa_track->element),
alsa_track->alsa_flags, alsa_track->capture_group);
}
inline static gboolean
alsa_track_has_cap (GstAlsaMixerTrack * alsa_track, guint32 flag)
{
return ((alsa_track->alsa_flags & flag) != 0);
}
GstMixerTrack *
gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
gint num, gint track_num, gint flags, gboolean sw,
GstAlsaMixerTrack * shared_mute_track, gboolean append_capture)
{
GstAlsaMixerTrack *alsa_track;
GstMixerTrack *track;
const gchar *name;
guint index;
const gchar *label;
gint i;
long min = 0, max = 0;
const struct
{
const gchar orig[12];
const gchar trans[12];
} alsa_track_labels[] = {
{
"Master", N_("Master")}, {
"Bass", N_("Bass")}, {
"Treble", N_("Treble")}, {
"PCM", N_("PCM")}, {
"Synth", N_("Synth")}, {
"Line", N_("Line-in")}, {
"CD", N_("CD")}, {
"Mic", N_("Microphone")}, {
"PC Speaker", N_("PC Speaker")}, {
"Playback", N_("Playback")}, {
"Capture", N_("Capture")}
};
name = snd_mixer_selem_get_name (element);
index = snd_mixer_selem_get_index (element);
GST_LOG
("[%s,%u] num=%d,track_num=%d,flags=0x%08x,sw=%s,shared_mute_track=%p",
name, index, num, track_num, flags, (sw) ? "true" : "false",
shared_mute_track);
track = (GstMixerTrack *) g_object_new (GST_ALSA_MIXER_TRACK_TYPE,
"untranslated-label", name, "index", index, NULL);
alsa_track = (GstAlsaMixerTrack *) track;
GST_LOG ("[%s] created new mixer track %p", name, track);
/* This reflects the assumptions used for GstAlsaMixerTrack */
if (!(! !(flags & GST_MIXER_TRACK_OUTPUT) ^ ! !(flags &
GST_MIXER_TRACK_INPUT))) {
GST_ERROR ("Mixer track must be either output or input!");
g_return_val_if_reached (NULL);
}
track->flags = flags;
alsa_track->element = element;
alsa_track->shared_mute = shared_mute_track;
alsa_track->track_num = track_num;
alsa_track->alsa_channels = 0;
gst_alsa_mixer_track_update_alsa_capabilities (alsa_track);
if (flags & GST_MIXER_TRACK_OUTPUT) {
while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
snd_mixer_selem_has_playback_channel (element,
alsa_track->alsa_channels)) {
alsa_track->alsa_channels++;
}
GST_LOG ("[%s] %d output channels", name, alsa_track->alsa_channels);
} else if (flags & GST_MIXER_TRACK_INPUT) {
while (alsa_track->alsa_channels < GST_ALSA_MAX_CHANNELS &&
snd_mixer_selem_has_capture_channel (element,
alsa_track->alsa_channels)) {
alsa_track->alsa_channels++;
}
GST_LOG ("[%s] %d input channels", name, alsa_track->alsa_channels);
} else {
g_assert_not_reached ();
}
if (sw)
track->num_channels = 0;
else
track->num_channels = alsa_track->alsa_channels;
/* translate the name if we can */
label = name;
for (i = 0; i < G_N_ELEMENTS (alsa_track_labels); ++i) {
if (g_utf8_collate (label, alsa_track_labels[i].orig) == 0) {
label = _(alsa_track_labels[i].trans);
break;
}
}
if (num == 0) {
track->label = g_strdup_printf ("%s%s%s", label,
append_capture ? " " : "", append_capture ? _("Capture") : "");
} else {
track->label = g_strdup_printf ("%s%s%s %d", label,
append_capture ? " " : "", append_capture ? _("Capture") : "", num);
}
/* set volume information */
if (track->num_channels > 0) {
if ((flags & GST_MIXER_TRACK_OUTPUT))
snd_mixer_selem_get_playback_volume_range (element, &min, &max);
else
snd_mixer_selem_get_capture_volume_range (element, &min, &max);
}
track->min_volume = (gint) min;
track->max_volume = (gint) max;
for (i = 0; i < track->num_channels; i++) {
long tmp = 0;
if (flags & GST_MIXER_TRACK_OUTPUT)
snd_mixer_selem_get_playback_volume (element, i, &tmp);
else
snd_mixer_selem_get_capture_volume (element, i, &tmp);
alsa_track->volumes[i] = (gint) tmp;
}
gst_alsa_mixer_track_update (alsa_track);
return track;
}
void
gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track)
{
GstMixerTrack *track = (GstMixerTrack *) alsa_track;
gint i;
gint audible = !(track->flags & GST_MIXER_TRACK_MUTE);
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME)) {
/* update playback volume */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
alsa_track->volumes[i] = (gint) vol;
}
}
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME)) {
/* update capture volume */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
alsa_track->volumes[i] = (gint) vol;
}
}
/* Any updates in flags? */
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PSWITCH)) {
int v = 0;
audible = 0;
for (i = 0; i < alsa_track->alsa_channels; ++i) {
snd_mixer_selem_get_playback_switch (alsa_track->element, i, &v);
audible += v;
}
} else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_PVOLUME) &&
track->flags & GST_MIXER_TRACK_MUTE) {
/* check if user has raised volume with a parallel running application */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_playback_volume (alsa_track->element, i, &vol);
if (vol > track->min_volume) {
audible = 1;
break;
}
}
}
if (! !(audible) != !(track->flags & GST_MIXER_TRACK_MUTE)) {
if (audible) {
track->flags &= ~GST_MIXER_TRACK_MUTE;
if (alsa_track->shared_mute)
((GstMixerTrack *) (alsa_track->shared_mute))->flags &=
~GST_MIXER_TRACK_MUTE;
} else {
track->flags |= GST_MIXER_TRACK_MUTE;
if (alsa_track->shared_mute)
((GstMixerTrack *) (alsa_track->shared_mute))->flags |=
GST_MIXER_TRACK_MUTE;
}
}
if (track->flags & GST_MIXER_TRACK_INPUT) {
gint recording = track->flags & GST_MIXER_TRACK_RECORD;
if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CSWITCH)) {
int v = 0;
recording = 0;
for (i = 0; i < alsa_track->alsa_channels; ++i) {
snd_mixer_selem_get_capture_switch (alsa_track->element, i, &v);
recording += v;
}
} else if (alsa_track_has_cap (alsa_track, GST_ALSA_MIXER_TRACK_CVOLUME) &&
!(track->flags & GST_MIXER_TRACK_RECORD)) {
/* check if user has raised volume with a parallel running application */
for (i = 0; i < track->num_channels; i++) {
long vol = 0;
snd_mixer_selem_get_capture_volume (alsa_track->element, i, &vol);
if (vol > track->min_volume) {
recording = 1;
break;
}
}
}
if (recording)
track->flags |= GST_MIXER_TRACK_RECORD;
else
track->flags &= ~GST_MIXER_TRACK_RECORD;
}
}

View file

@ -1,79 +0,0 @@
/* ALSA mixer track object.
* Copyright (C) 2003 Leif Johnson <leif@ambient.2y.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __GST_ALSA_MIXER_TRACK_H__
#define __GST_ALSA_MIXER_TRACK_H__
#include "gstalsa.h"
#include <gst/audio/mixertrack.h>
G_BEGIN_DECLS
#define GST_ALSA_MIXER_TRACK_TYPE (gst_alsa_mixer_track_get_type ())
#define GST_ALSA_MIXER_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_MIXER_TRACK,GstAlsaMixerTrack))
#define GST_ALSA_MIXER_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_MIXER_TRACK,GstAlsaMixerTrackClass))
#define GST_IS_ALSA_MIXER_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_MIXER_TRACK))
#define GST_IS_ALSA_MIXER_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_MIXER_TRACK))
#define GST_TYPE_ALSA_MIXER_TRACK (gst_alsa_mixer_track_get_type())
typedef struct _GstAlsaMixerTrack GstAlsaMixerTrack;
typedef struct _GstAlsaMixerTrackClass GstAlsaMixerTrackClass;
#define GST_ALSA_MIXER_TRACK_VOLUME (1<<0) /* common volume */
#define GST_ALSA_MIXER_TRACK_PVOLUME (1<<1)
#define GST_ALSA_MIXER_TRACK_CVOLUME (1<<2)
#define GST_ALSA_MIXER_TRACK_SWITCH (1<<3) /* common switch */
#define GST_ALSA_MIXER_TRACK_PSWITCH (1<<4)
#define GST_ALSA_MIXER_TRACK_CSWITCH (1<<5)
#define GST_ALSA_MIXER_TRACK_CSWITCH_EXCL (1<<6)
#define GST_ALSA_MAX_CHANNELS (SND_MIXER_SCHN_LAST+1)
struct _GstAlsaMixerTrack {
GstMixerTrack parent;
snd_mixer_elem_t *element; /* the ALSA mixer element for this track */
GstAlsaMixerTrack *shared_mute;
gint track_num;
guint32 alsa_flags; /* alsa track capabilities */
gint alsa_channels;
gint capture_group;
gint volumes[GST_ALSA_MAX_CHANNELS];
};
struct _GstAlsaMixerTrackClass {
GstMixerTrackClass parent;
};
GType gst_alsa_mixer_track_get_type (void);
GstMixerTrack * gst_alsa_mixer_track_new (snd_mixer_elem_t * element,
gint num,
gint track_num,
gint flags,
gboolean sw, /* is simple switch? */
GstAlsaMixerTrack * shared_mute_track,
gboolean label_append_capture);
void gst_alsa_mixer_track_update (GstAlsaMixerTrack * alsa_track);
G_END_DECLS
#endif /* __GST_ALSA_MIXER_TRACK_H__ */

View file

@ -25,7 +25,6 @@
#include "gstalsasink.h"
#include "gstalsasrc.h"
#include "gstalsamixerelement.h"
#include <gst/gst-i18n-plugin.h>
@ -58,9 +57,6 @@ plugin_init (GstPlugin * plugin)
{
int err;
if (!gst_element_register (plugin, "alsamixer", GST_RANK_NONE,
GST_TYPE_ALSA_MIXER_ELEMENT))
return FALSE;
if (!gst_element_register (plugin, "alsasrc", GST_RANK_PRIMARY,
GST_TYPE_ALSA_SRC))
return FALSE;

View file

@ -22,7 +22,7 @@
/**
* SECTION:element-alsasink
* @see_also: alsasrc, alsamixer
* @see_also: alsasrc
*
* This element renders raw audio samples using the ALSA api.
*

View file

@ -21,7 +21,7 @@
/**
* SECTION:element-alsasrc
* @see_also: alsasink, alsamixer
* @see_also: alsasink
*
* This element reads data from an audio card using the ALSA API.
*
@ -65,12 +65,8 @@ enum
PROP_LAST
};
static void gst_alsasrc_init_interfaces (GType type);
#define gst_alsasrc_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstAlsaSrc, gst_alsasrc,
GST_TYPE_AUDIO_SRC, gst_alsasrc_init_interfaces (g_define_type_id));
GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaSrc, gst_alsasrc_mixer);
G_DEFINE_TYPE (GstAlsaSrc, gst_alsasrc, GST_TYPE_AUDIO_SRC);
static void gst_alsasrc_finalize (GObject * object);
static void gst_alsasrc_set_property (GObject * object,
@ -122,22 +118,6 @@ gst_alsasrc_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gst_alsasrc_init_interfaces (GType type)
{
static const GInterfaceInfo mixer_iface_info = {
(GInterfaceInitFunc) gst_alsasrc_mixer_interface_init,
NULL,
NULL,
};
g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
#if 0
gst_alsa_type_add_device_property_probe_interface (type);
#endif
}
static void
gst_alsasrc_class_init (GstAlsaSrcClass * klass)
{
@ -667,9 +647,6 @@ gst_alsasrc_open (GstAudioSrc * asrc)
CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE,
SND_PCM_NONBLOCK), open_error);
if (!alsa->mixer)
alsa->mixer = gst_alsa_mixer_new (alsa->device, GST_ALSA_MIXER_CAPTURE);
return TRUE;
/* ERRORS */
@ -768,11 +745,6 @@ gst_alsasrc_close (GstAudioSrc * asrc)
snd_pcm_close (alsa->handle);
alsa->handle = NULL;
if (alsa->mixer) {
gst_alsa_mixer_free (alsa->mixer);
alsa->mixer = NULL;
}
gst_caps_replace (&alsa->cached_caps, NULL);
return TRUE;

View file

@ -25,7 +25,6 @@
#include <gst/audio/gstaudiosrc.h>
#include "gstalsa.h"
#include "gstalsamixer.h"
G_BEGIN_DECLS
@ -72,8 +71,6 @@ struct _GstAlsaSrc {
snd_pcm_uframes_t buffer_size;
snd_pcm_uframes_t period_size;
GstAlsaMixer *mixer;
GMutex *alsa_lock;
};

View file

@ -1,8 +1,4 @@
# The interfaces directory has to be built before the others,
# otherwise some generated header files will be missing for the
# plugins in the other directories.
SUBDIRS = \
interfaces \
tag \
fft \
rtp \
@ -17,7 +13,7 @@ SUBDIRS = \
noinst_HEADERS = gettext.h gst-i18n-plugin.h glib-compat-private.h
# dependencies:
audio: interfaces tag
audio: tag
riff: tag audio
@ -26,7 +22,7 @@ rtsp: sdp
pbutils: video audio
INDEPENDENT_SUBDIRS = \
interfaces tag audio fft rtp sdp video app
tag audio fft rtp sdp video app
.PHONY: independent-subdirs $(INDEPENDENT_SUBDIRS)

View file

@ -22,10 +22,6 @@ libgstaudio_@GST_API_VERSION@_la_SOURCES = \
audio.c \
gstaudioringbuffer.c \
gstaudioclock.c \
mixer.c \
mixeroptions.c \
mixertrack.c \
mixerutils.c \
gstaudiocdsrc.c \
gstaudiodecoder.c \
gstaudioencoder.c \
@ -54,10 +50,6 @@ libgstaudio_@GST_API_VERSION@include_HEADERS = \
gstaudiometa.h \
gstaudiosink.h \
gstaudiosrc.h \
mixer.h \
mixeroptions.h \
mixertrack.h \
mixerutils.h \
streamvolume.h \
gstaudioiec61937.h
@ -66,7 +58,6 @@ nodist_libgstaudio_@GST_API_VERSION@include_HEADERS = \
libgstaudio_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstaudio_@GST_API_VERSION@_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
libgstaudio_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
@ -93,18 +84,15 @@ GstAudio-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstaudio-@GST_API_VE
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
$(gir_cincludes) \
--add-include-path=$(builddir)/../interfaces \
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
--library=$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
--library=libgstaudio-@GST_API_VERSION@.la \
--include=Gst-@GST_API_VERSION@ \
--include=GstBase-@GST_API_VERSION@ \
--include=GstInterfaces-@GST_API_VERSION@ \
--libtool="$(top_builddir)/libtool" \
--pkg gstreamer-@GST_API_VERSION@ \
--pkg gstreamer-base-@GST_API_VERSION@ \
--pkg gstreamer-interfaces-@GST_API_VERSION@ \
--pkg-export gstreamer-audio-@GST_API_VERSION@ \
--add-init-section="gst_init(NULL,NULL);" \
--output $@ \
@ -125,7 +113,6 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
$(INTROSPECTION_COMPILER) \
--includedir=$(srcdir) \
--includedir=$(builddir) \
--includedir=$(builddir)/../interfaces \
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)

View file

@ -1,821 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixer.c: mixer design virtual class function wrappers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mixer.h"
#include "audio-marshal.h"
#define GST_MIXER_MESSAGE_NAME "gst-mixer-message"
/**
* SECTION:gstmixer
* @short_description: Interface for elements that provide mixer operations
* @see_also: alsamixer, oss4mixer, sunaudiomixer
*
* Basic interface for hardware mixer controls.
*
* Applications rarely need to use this interface, it is provided mainly
* for system-level mixer applets and the like. Volume control in playback
* applications should be done using a <classname>volume</classname>
* element or, if available, using the <quote>volume</quote> property of
* the audio sink element used (as provided by <classname>pulsesink</classname>
* for example), or even better: just use the <classname>playbin2</classname>
* element's <quote>volume</quote> property.
*
* Usage: In order to use the <classname>GstMixer</classname> interface, the
* element needs to be at least in READY state (so that the element has opened
* the mixer device). Once the element has been set to READY state or higher,
* it can be cast to a <classname>GstMixer</classname> using the GST_MIXER
* macro (in C) and the mixer API can be used.
*/
/* FIXME 0.11: check if we need to add API for sometimes-supportedness
* (aka making up for GstImplementsInterface removal) */
static void gst_mixer_class_init (GstMixerInterface * iface);
GType
gst_mixer_get_type (void)
{
static GType gst_mixer_type = 0;
if (!gst_mixer_type) {
static const GTypeInfo gst_mixer_info = {
sizeof (GstMixerInterface),
(GBaseInitFunc) gst_mixer_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_mixer_type = g_type_register_static (G_TYPE_INTERFACE,
"GstMixer", &gst_mixer_info, 0);
}
return gst_mixer_type;
}
static void
gst_mixer_class_init (GstMixerInterface * iface)
{
/* default virtual functions */
iface->get_mixer_type = NULL;
iface->list_tracks = NULL;
iface->set_volume = NULL;
iface->get_volume = NULL;
iface->set_mute = NULL;
iface->set_record = NULL;
iface->set_option = NULL;
iface->get_option = NULL;
}
/**
* gst_mixer_list_tracks:
* @mixer: the #GstMixer (a #GstElement) to get the tracks from.
*
* Returns a list of available tracks for this mixer/element. Note
* that it is allowed for sink (output) elements to only provide
* the output tracks in this list. Likewise, for sources (inputs),
* it is allowed to only provide input elements in this list.
*
* Returns: A #GList consisting of zero or more #GstMixerTracks.
* The list is owned by the #GstMixer instance and must not be freed
* or modified.
*/
const GList *
gst_mixer_list_tracks (GstMixer * mixer)
{
GstMixerInterface *iface;
g_return_val_if_fail (mixer != NULL, NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->list_tracks) {
return iface->list_tracks (mixer);
}
return NULL;
}
/**
* gst_mixer_set_volume:
* @mixer: The #GstMixer (a #GstElement) that owns the track.
* @track: The #GstMixerTrack to set the volume on.
* @volumes: an array of integers (of size track->num_channels)
* that gives the wanted volume for each channel in
* this track.
*
* Sets the volume on each channel in a track. Short note about
* naming: a track is defined as one separate stream owned by
* the mixer/element, such as 'Line-in' or 'Microphone'. A
* channel is said to be a mono-stream inside this track. A
* stereo track thus contains two channels.
*/
void
gst_mixer_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerInterface *iface;
g_return_if_fail (mixer != NULL);
g_return_if_fail (track != NULL);
g_return_if_fail (volumes != NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->set_volume) {
iface->set_volume (mixer, track, volumes);
}
}
/**
* gst_mixer_get_volume:
* @mixer: the #GstMixer (a #GstElement) that owns the track
* @track: the GstMixerTrack to get the volume from.
* @volumes: a pre-allocated array of integers (of size
* track->num_channels) to store the current volume
* of each channel in the given track in.
*
* Get the current volume(s) on the given track.
*/
void
gst_mixer_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstMixerInterface *iface;
g_return_if_fail (mixer != NULL);
g_return_if_fail (track != NULL);
g_return_if_fail (volumes != NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->get_volume) {
iface->get_volume (mixer, track, volumes);
} else {
gint i;
for (i = 0; i < track->num_channels; i++) {
volumes[i] = 0;
}
}
}
/**
* gst_mixer_set_mute:
* @mixer: the #GstMixer (a #GstElement) that owns the track.
* @track: the #GstMixerTrack to operate on.
* @mute: a boolean value indicating whether to turn on or off
* muting.
*
* Mutes or unmutes the given channel. To find out whether a
* track is currently muted, use GST_MIXER_TRACK_HAS_FLAG ().
*/
void
gst_mixer_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
GstMixerInterface *iface;
g_return_if_fail (mixer != NULL);
g_return_if_fail (track != NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->set_mute) {
iface->set_mute (mixer, track, mute);
}
}
/**
* gst_mixer_set_record:
* @mixer: The #GstMixer (a #GstElement) that owns the track.
* @track: the #GstMixerTrack to operate on.
* @record: a boolean value that indicates whether to turn on
* or off recording.
*
* Enables or disables recording on the given track. Note that
* this is only possible on input tracks, not on output tracks
* (see GST_MIXER_TRACK_HAS_FLAG () and the GST_MIXER_TRACK_INPUT
* flag).
*/
void
gst_mixer_set_record (GstMixer * mixer, GstMixerTrack * track, gboolean record)
{
GstMixerInterface *iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->set_record) {
iface->set_record (mixer, track, record);
}
}
/**
* gst_mixer_set_option:
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
* @opts: The #GstMixerOptions that we operate on.
* @value: The requested new option value.
*
* Sets a name/value option in the mixer to the requested value.
*/
void
gst_mixer_set_option (GstMixer * mixer, GstMixerOptions * opts, gchar * value)
{
GstMixerInterface *iface;
g_return_if_fail (mixer != NULL);
g_return_if_fail (opts != NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->set_option) {
iface->set_option (mixer, opts, value);
}
}
/**
* gst_mixer_get_option:
* @mixer: The #GstMixer (a #GstElement) that owns the optionlist.
* @opts: The #GstMixerOptions that we operate on.
*
* Get the current value of a name/value option in the mixer.
*
* Returns: current value of the name/value option.
*/
const gchar *
gst_mixer_get_option (GstMixer * mixer, GstMixerOptions * opts)
{
GstMixerInterface *iface;
g_return_val_if_fail (mixer != NULL, NULL);
g_return_val_if_fail (opts != NULL, NULL);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->get_option) {
return iface->get_option (mixer, opts);
}
return NULL;
}
/**
* gst_mixer_get_mixer_type:
* @mixer: The #GstMixer implementation
*
* Get the #GstMixerType of this mixer implementation.
*
* Returns: A the #GstMixerType.
*
* Since: 0.10.24
*/
GstMixerType
gst_mixer_get_mixer_type (GstMixer * mixer)
{
GstMixerInterface *iface = GST_MIXER_GET_INTERFACE (mixer);
g_return_val_if_fail (iface->get_mixer_type != NULL, GST_MIXER_SOFTWARE);
return iface->get_mixer_type (mixer);
}
/**
* gst_mixer_get_mixer_flags:
* @mixer: The #GstMixer implementation
*
* Get the set of supported flags for this mixer implementation.
*
* Returns: A set of or-ed GstMixerFlags for supported features.
*/
GstMixerFlags
gst_mixer_get_mixer_flags (GstMixer * mixer)
{
GstMixerInterface *iface;
g_return_val_if_fail (mixer != NULL, FALSE);
iface = GST_MIXER_GET_INTERFACE (mixer);
if (iface->get_mixer_flags) {
return iface->get_mixer_flags (mixer);
}
return GST_MIXER_FLAG_NONE;
}
/**
* gst_mixer_mute_toggled:
* @mixer: the #GstMixer (a #GstElement) that owns the track
* @track: the GstMixerTrack that has change mute state.
* @mute: the new state of the mute flag on the track
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the given track
* has changed mute state.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus.
*/
void
gst_mixer_mute_toggled (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
GstStructure *s;
GstMessage *m;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
g_return_if_fail (track != NULL);
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "mute-toggled",
"track", GST_TYPE_MIXER_TRACK, track, "mute", G_TYPE_BOOLEAN, mute, NULL);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
/**
* gst_mixer_record_toggled:
* @mixer: the #GstMixer (a #GstElement) that owns the track
* @track: the GstMixerTrack that has changed recording state.
* @record: the new state of the record flag on the track
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the given track
* has changed recording state.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus.
*/
void
gst_mixer_record_toggled (GstMixer * mixer,
GstMixerTrack * track, gboolean record)
{
GstStructure *s;
GstMessage *m;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
g_return_if_fail (track != NULL);
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "record-toggled",
"track", GST_TYPE_MIXER_TRACK, track,
"record", G_TYPE_BOOLEAN, record, NULL);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
/**
* gst_mixer_volume_changed:
* @mixer: the #GstMixer (a #GstElement) that owns the track
* @track: the GstMixerTrack that has changed.
* @volumes: Array of volume values, one per channel on the mixer track.
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the volume(s) for the
* given track have changed.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus.
*/
void
gst_mixer_volume_changed (GstMixer * mixer,
GstMixerTrack * track, gint * volumes)
{
GstStructure *s;
GstMessage *m;
GValue l = { 0, };
GValue v = { 0, };
gint i;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
g_return_if_fail (track != NULL);
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "volume-changed",
"track", GST_TYPE_MIXER_TRACK, track, NULL);
g_value_init (&l, GST_TYPE_ARRAY);
g_value_init (&v, G_TYPE_INT);
/* FIXME 0.11: pass track->num_channels to the function */
for (i = 0; i < track->num_channels; ++i) {
g_value_set_int (&v, volumes[i]);
gst_value_array_append_value (&l, &v);
}
g_value_unset (&v);
gst_structure_set_value (s, "volumes", &l);
g_value_unset (&l);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
/**
* gst_mixer_option_changed:
* @mixer: the #GstMixer (a #GstElement) that owns the options
* @opts: the GstMixerOptions that has changed value.
* @value: the new value of the GstMixerOptions.
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the given options
* object has changed state.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus.
*/
void
gst_mixer_option_changed (GstMixer * mixer,
GstMixerOptions * opts, const gchar * value)
{
GstStructure *s;
GstMessage *m;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
g_return_if_fail (opts != NULL);
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "option-changed",
"options", GST_TYPE_MIXER_OPTIONS, opts,
"value", G_TYPE_STRING, value, NULL);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
/**
* gst_mixer_options_list_changed:
* @mixer: the #GstMixer (a #GstElement) that owns the options
* @opts: the GstMixerOptions whose list of values has changed
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the list of possible
* options of a given options object has changed.
*
* The new options are not contained in the message on purpose. Applications
* should call gst_mixer_options_get_values() on @opts to make @opts update
* its internal state and obtain the new list of values.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus
* for this to work.
*
* Since: 0.10.18
*/
void
gst_mixer_options_list_changed (GstMixer * mixer, GstMixerOptions * opts)
{
GstStructure *s;
GstMessage *m;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
g_return_if_fail (opts != NULL);
g_return_if_fail (GST_IS_MIXER_OPTIONS (opts));
/* we do not include the new list here on purpose, so that the application
* has to use gst_mixer_options_get_values() to get the new list, which then
* allows the mixer options object to update the internal GList in a somewhat
* thread-safe way at least */
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "options-list-changed",
"options", GST_TYPE_MIXER_OPTIONS, opts, NULL);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
/**
* gst_mixer_mixer_changed:
* @mixer: the #GstMixer (a #GstElement) which has changed
*
* This function is called by the mixer implementation to produce
* a notification message on the bus indicating that the list of available
* mixer tracks for a given mixer object has changed. Applications should
* rebuild their interface when they receive this message.
*
* This function only works for GstElements that are implementing the
* GstMixer interface, and the element needs to have been provided a bus.
*
* Since: 0.10.18
*/
void
gst_mixer_mixer_changed (GstMixer * mixer)
{
GstStructure *s;
GstMessage *m;
g_return_if_fail (mixer != NULL);
g_return_if_fail (GST_IS_ELEMENT (mixer));
s = gst_structure_new (GST_MIXER_MESSAGE_NAME,
"type", G_TYPE_STRING, "mixer-changed", NULL);
m = gst_message_new_element (GST_OBJECT (mixer), s);
if (gst_element_post_message (GST_ELEMENT (mixer), m) == FALSE) {
GST_WARNING ("This element has no bus, therefore no message sent!");
}
}
static gboolean
gst_mixer_message_is_mixer_message (GstMessage * message)
{
const GstStructure *s;
if (message == NULL)
return FALSE;
if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
return FALSE;
s = gst_message_get_structure (message);
return gst_structure_has_name (s, GST_MIXER_MESSAGE_NAME);
}
/**
* gst_mixer_message_get_type:
* @message: A GstMessage to inspect.
*
* Check a bus message to see if it is a GstMixer notification
* message and return the GstMixerMessageType identifying which
* type of notification it is.
*
* Returns: The type of the GstMixerMessage, or GST_MIXER_MESSAGE_INVALID
* if the message is not a GstMixer notification.
*
* Since: 0.10.14
*/
GstMixerMessageType
gst_mixer_message_get_type (GstMessage * message)
{
const GstStructure *s;
const gchar *m_type;
if (!gst_mixer_message_is_mixer_message (message))
return GST_MIXER_MESSAGE_INVALID;
s = gst_message_get_structure (message);
m_type = gst_structure_get_string (s, "type");
g_return_val_if_fail (m_type != NULL, GST_MIXER_MESSAGE_INVALID);
if (g_str_equal (m_type, "mute-toggled"))
return GST_MIXER_MESSAGE_MUTE_TOGGLED;
else if (g_str_equal (m_type, "record-toggled"))
return GST_MIXER_MESSAGE_RECORD_TOGGLED;
else if (g_str_equal (m_type, "volume-changed"))
return GST_MIXER_MESSAGE_VOLUME_CHANGED;
else if (g_str_equal (m_type, "option-changed"))
return GST_MIXER_MESSAGE_OPTION_CHANGED;
else if (g_str_equal (m_type, "options-list-changed"))
return GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED;
else if (g_str_equal (m_type, "mixer-changed"))
return GST_MIXER_MESSAGE_MIXER_CHANGED;
return GST_MIXER_MESSAGE_INVALID;
}
#define GST_MIXER_MESSAGE_HAS_TYPE(msg,msg_type) \
(gst_mixer_message_get_type (msg) == GST_MIXER_MESSAGE_ ## msg_type)
/**
* gst_mixer_message_parse_mute_toggled:
* @message: A mute-toggled change notification message.
* @track: Pointer to hold a GstMixerTrack object, or NULL.
* @mute: A pointer to a gboolean variable, or NULL.
*
* Extracts the contents of a mute-toggled bus message. Reads
* the GstMixerTrack that has changed, and the new value of the mute
* flag.
*
* The GstMixerTrack remains valid until the message is freed.
*
* Since: 0.10.14
*/
void
gst_mixer_message_parse_mute_toggled (GstMessage * message,
GstMixerTrack ** track, gboolean * mute)
{
const GstStructure *s;
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, MUTE_TOGGLED));
s = gst_message_get_structure (message);
if (track) {
const GValue *v = gst_structure_get_value (s, "track");
g_return_if_fail (v != NULL);
*track = (GstMixerTrack *) g_value_get_object (v);
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
}
if (mute)
g_return_if_fail (gst_structure_get_boolean (s, "mute", mute));
}
/**
* gst_mixer_message_parse_record_toggled:
* @message: A record-toggled change notification message.
* @track: Pointer to hold a GstMixerTrack object, or NULL.
* @record: A pointer to a gboolean variable, or NULL.
*
* Extracts the contents of a record-toggled bus message. Reads
* the GstMixerTrack that has changed, and the new value of the
* recording flag.
*
* The GstMixerTrack remains valid until the message is freed.
*
* Since: 0.10.14
*/
void
gst_mixer_message_parse_record_toggled (GstMessage * message,
GstMixerTrack ** track, gboolean * record)
{
const GstStructure *s;
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, RECORD_TOGGLED));
s = gst_message_get_structure (message);
if (track) {
const GValue *v = gst_structure_get_value (s, "track");
g_return_if_fail (v != NULL);
*track = (GstMixerTrack *) g_value_get_object (v);
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
}
if (record)
g_return_if_fail (gst_structure_get_boolean (s, "record", record));
}
/**
* gst_mixer_message_parse_volume_changed:
* @message: A volume-changed change notification message.
* @track: Pointer to hold a GstMixerTrack object, or NULL.
* @volumes: A pointer to receive an array of gint values, or NULL.
* @num_channels: Result location to receive the number of channels, or NULL.
*
* Parses a volume-changed notification message and extracts the track object
* it refers to, as well as an array of volumes and the size of the volumes array.
*
* The track object remains valid until the message is freed.
*
* The caller must free the array returned in the volumes parameter using g_free
* when they are done with it.
*
* Since: 0.10.14
*/
void
gst_mixer_message_parse_volume_changed (GstMessage * message,
GstMixerTrack ** track, gint ** volumes, gint * num_channels)
{
const GstStructure *s;
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, VOLUME_CHANGED));
s = gst_message_get_structure (message);
if (track) {
const GValue *v = gst_structure_get_value (s, "track");
g_return_if_fail (v != NULL);
*track = (GstMixerTrack *) g_value_get_object (v);
g_return_if_fail (GST_IS_MIXER_TRACK (*track));
}
if (volumes || num_channels) {
gint n_chans, i;
const GValue *v = gst_structure_get_value (s, "volumes");
g_return_if_fail (v != NULL);
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (v));
n_chans = gst_value_array_get_size (v);
if (num_channels)
*num_channels = n_chans;
if (volumes) {
*volumes = g_new (gint, n_chans);
for (i = 0; i < n_chans; i++) {
const GValue *e = gst_value_array_get_value (v, i);
g_return_if_fail (e != NULL && G_VALUE_HOLDS_INT (e));
(*volumes)[i] = g_value_get_int (e);
}
}
}
}
/**
* gst_mixer_message_parse_option_changed:
* @message: A volume-changed change notification message.
* @options: Pointer to hold a GstMixerOptions object, or NULL.
* @value: Result location to receive the new options value, or NULL.
*
* Extracts the GstMixerOptions and new value from a option-changed bus notification
* message.
*
* The options and value returned remain valid until the message is freed.
*
* Since: 0.10.14
*/
void
gst_mixer_message_parse_option_changed (GstMessage * message,
GstMixerOptions ** options, const gchar ** value)
{
const GstStructure *s;
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTION_CHANGED));
s = gst_message_get_structure (message);
if (options) {
const GValue *v = gst_structure_get_value (s, "options");
g_return_if_fail (v != NULL);
*options = (GstMixerOptions *) g_value_get_object (v);
g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
}
if (value)
*value = gst_structure_get_string (s, "value");
}
/**
* gst_mixer_message_parse_options_list_changed:
* @message: A volume-changed change notification message.
* @options: Pointer to hold a GstMixerOptions object, or NULL.
*
* Extracts the GstMixerOptions whose value list has changed from an
* options-list-changed bus notification message.
*
* The options object returned remains valid until the message is freed. You
* do not need to unref it.
*
* Since: 0.10.18
*/
void
gst_mixer_message_parse_options_list_changed (GstMessage * message,
GstMixerOptions ** options)
{
const GstStructure *s;
g_return_if_fail (gst_mixer_message_is_mixer_message (message));
g_return_if_fail (GST_MIXER_MESSAGE_HAS_TYPE (message, OPTIONS_LIST_CHANGED));
s = gst_message_get_structure (message);
if (options) {
const GValue *v = gst_structure_get_value (s, "options");
g_return_if_fail (v != NULL);
*options = (GstMixerOptions *) g_value_get_object (v);
g_return_if_fail (GST_IS_MIXER_OPTIONS (*options));
}
}

View file

@ -1,205 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixer.h: mixer interface design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MIXER_H__
#define __GST_MIXER_H__
#include <gst/gst.h>
#include <gst/audio/mixeroptions.h>
#include <gst/audio/mixertrack.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER \
(gst_mixer_get_type ())
#define GST_MIXER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER, GstMixer))
#define GST_IS_MIXER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER))
#define GST_MIXER_GET_INTERFACE(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_MIXER, GstMixerInterface))
typedef struct _GstMixer GstMixer;
typedef struct _GstMixerInterface GstMixerInterface;
/**
* GstMixerType:
* @GST_MIXER_HARDWARE: mixing is implemented with dedicated hardware.
* @GST_MIXER_SOFTWARE: mixing is implemented via software processing.
*
* Mixer classification.
*/
typedef enum
{
GST_MIXER_HARDWARE,
GST_MIXER_SOFTWARE
} GstMixerType;
/**
* GstMixerMessageType:
* @GST_MIXER_MESSAGE_INVALID: Not a GstMixer message
* @GST_MIXER_MESSAGE_MUTE_TOGGLED: A mute-toggled GstMixer message
* @GST_MIXER_MESSAGE_RECORD_TOGGLED: A record-toggled GstMixer message
* @GST_MIXER_MESSAGE_VOLUME_CHANGED: A volume-changed GstMixer message
* @GST_MIXER_MESSAGE_OPTION_CHANGED: An option-changed GstMixer message
* @GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED: An options-list-changed
* GstMixer message, posted when the list of available options for a
* GstMixerOptions object has changed (Since: 0.10.18)
* @GST_MIXER_MESSAGE_MIXER_CHANGED: A mixer-changed GstMixer message, posted
* when the list of available mixer tracks has changed. The application
* should re-build its interface in this case (Since: 0.10.18)
*
* An enumeration for the type of a GstMixer message received on the bus
*
* Since: 0.10.14
*/
typedef enum
{
GST_MIXER_MESSAGE_INVALID,
GST_MIXER_MESSAGE_MUTE_TOGGLED,
GST_MIXER_MESSAGE_RECORD_TOGGLED,
GST_MIXER_MESSAGE_VOLUME_CHANGED,
GST_MIXER_MESSAGE_OPTION_CHANGED,
GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED,
GST_MIXER_MESSAGE_MIXER_CHANGED
} GstMixerMessageType;
/**
* GstMixerFlags:
* @GST_MIXER_FLAG_NONE: No flags
* @GST_MIXER_FLAG_AUTO_NOTIFICATIONS: The mixer implementation automatically
* sends notification messages.
* @GST_MIXER_FLAG_HAS_WHITELIST: The mixer implementation flags tracks that
* should be displayed by default (whitelisted). Since: 0.10.23
* @GST_MIXER_FLAG_GROUPING: The mixer implementation will leave some controls
* marked without either input or output. Controls marked as input or
* output should be grouped with input & output sliders, even if they
* are options or bare switches. Since: 0.10.23
*
* Flags indicating which optional features are supported by a mixer
* implementation.
*
* Since: 0.10.14
*/
typedef enum
{
GST_MIXER_FLAG_NONE = 0,
GST_MIXER_FLAG_AUTO_NOTIFICATIONS = (1<<0),
GST_MIXER_FLAG_HAS_WHITELIST = (1<<1),
GST_MIXER_FLAG_GROUPING = (1<<2),
} GstMixerFlags;
struct _GstMixerInterface {
GTypeInterface iface;
/* virtual functions */
const GList * (* list_tracks) (GstMixer *mixer);
void (* set_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* get_volume) (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void (* set_mute) (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void (* set_record) (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void (* set_option) (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * (* get_option) (GstMixer *mixer,
GstMixerOptions *opts);
GstMixerFlags (* get_mixer_flags) (GstMixer *mixer);
GstMixerType (* get_mixer_type) (GstMixer *mixer);
};
GType gst_mixer_get_type (void);
/* virtual class function wrappers */
const GList * gst_mixer_list_tracks (GstMixer *mixer);
void gst_mixer_set_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_get_volume (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_set_mute (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_set_record (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_set_option (GstMixer *mixer,
GstMixerOptions *opts,
gchar *value);
const gchar * gst_mixer_get_option (GstMixer *mixer,
GstMixerOptions *opts);
/* trigger bus messages */
void gst_mixer_mute_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean mute);
void gst_mixer_record_toggled (GstMixer *mixer,
GstMixerTrack *track,
gboolean record);
void gst_mixer_volume_changed (GstMixer *mixer,
GstMixerTrack *track,
gint *volumes);
void gst_mixer_option_changed (GstMixer *mixer,
GstMixerOptions *opts,
const gchar *value);
void gst_mixer_mixer_changed (GstMixer *mixer);
void gst_mixer_options_list_changed (GstMixer *mixer,
GstMixerOptions *opts);
GstMixerType gst_mixer_get_mixer_type (GstMixer *mixer);
GstMixerFlags gst_mixer_get_mixer_flags (GstMixer *mixer);
/* Functions for recognising and parsing GstMixerMessages on the bus */
GstMixerMessageType gst_mixer_message_get_type (GstMessage *message);
void gst_mixer_message_parse_mute_toggled (GstMessage *message,
GstMixerTrack **track,
gboolean *mute);
void gst_mixer_message_parse_record_toggled (GstMessage *message,
GstMixerTrack **track,
gboolean *record);
void gst_mixer_message_parse_volume_changed (GstMessage *message,
GstMixerTrack **track,
gint **volumes,
gint *num_channels);
void gst_mixer_message_parse_option_changed (GstMessage *message,
GstMixerOptions **options,
const gchar **value);
void gst_mixer_message_parse_options_list_changed (GstMessage *message,
GstMixerOptions **options);
G_END_DECLS
#endif /* __GST_MIXER_H__ */

View file

@ -1,146 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixeroptions.c: mixer track options object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstmixeroptions
* @short_description: Multi-option mixer control
* @see_also: GstMixer, GstMixerTrack
*
* Mixer control object that allows switching between multiple options.
* Note that <classname>GstMixerOptions</classname> is a subclass of
* <classname>GstMixerTrack</classname>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mixeroptions.h"
#if 0
enum
{
/* FILL ME */
SIGNAL_OPTION_CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
#endif
static void gst_mixer_options_class_init (GstMixerOptionsClass * klass);
static void gst_mixer_options_init (GstMixerOptions * mixer);
static void gst_mixer_options_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
GType
gst_mixer_options_get_type (void)
{
static GType gst_mixer_options_type = 0;
if (!gst_mixer_options_type) {
static const GTypeInfo mixer_options_info = {
sizeof (GstMixerOptionsClass),
NULL,
NULL,
(GClassInitFunc) gst_mixer_options_class_init,
NULL,
NULL,
sizeof (GstMixerOptions),
0,
(GInstanceInitFunc) gst_mixer_options_init,
NULL
};
gst_mixer_options_type =
g_type_register_static (GST_TYPE_MIXER_TRACK,
"GstMixerOptions", &mixer_options_info, 0);
}
return gst_mixer_options_type;
}
static void
gst_mixer_options_class_init (GstMixerOptionsClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
#if 0
signals[SIGNAL_OPTION_CHANGED] =
g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
NULL, NULL, g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
#endif
object_klass->dispose = gst_mixer_options_dispose;
}
static void
gst_mixer_options_init (GstMixerOptions * mixer_options)
{
mixer_options->values = NULL;
}
/**
* gst_mixer_options_get_values:
* @mixer_options: The #GstMixerOptions item that owns the values.
*
* Get the values for the mixer option.
*
* Returns: A list of strings with all the possible values for the mixer
* option. You must not free or modify the list or its contents, it belongs
* to the @mixer_options object.
*/
GList *
gst_mixer_options_get_values (GstMixerOptions * mixer_options)
{
GstMixerOptionsClass *klass;
GList *ret = NULL;
g_return_val_if_fail (GST_IS_MIXER_OPTIONS (mixer_options), NULL);
klass = GST_MIXER_OPTIONS_GET_CLASS (mixer_options);
if (klass->get_values != NULL) {
ret = klass->get_values (mixer_options);
} else {
ret = mixer_options->values;
}
return ret;
}
static void
gst_mixer_options_dispose (GObject * object)
{
GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
g_list_foreach (opts->values, (GFunc) g_free, NULL);
g_list_free (opts->values);
opts->values = NULL;
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,88 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixeroptions.h: mixer track options object
* This should be a subclass of MixerItem, along with MixerOptions,
* but that's not possible because of API/ABI in 0.8.x. FIXME.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MIXER_OPTIONS_H__
#define __GST_MIXER_OPTIONS_H__
#include <gst/gst.h>
#include <gst/audio/mixertrack.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_OPTIONS \
(gst_mixer_options_get_type ())
#define GST_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptions))
#define GST_MIXER_OPTIONS_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MIXER_OPTIONS, GstMixerOptionsClass))
#define GST_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_OPTIONS, \
GstMixerOptionsClass))
#define GST_IS_MIXER_OPTIONS(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_OPTIONS))
#define GST_IS_MIXER_OPTIONS_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_OPTIONS))
typedef struct _GstMixerOptions GstMixerOptions;
typedef struct _GstMixerOptionsClass GstMixerOptionsClass;
/**
* GstMixerOptions:
* @values: List of option strings. Do not access this member directly,
* always use gst_mixer_options_get_values() instead.
*
* Mixer control object.
*/
struct _GstMixerOptions {
GstMixerTrack parent;
/*< public >*/
/* list of strings (do not access directly) (FIXME 0.11: make private) */
GList *values;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
/**
* GstMixerOptionsClass:
* @parent: the parent class
* @get_values: Optional implementation of gst_mixer_options_get_values().
* (Since: 0.10.18)
*/
struct _GstMixerOptionsClass {
GstMixerTrackClass parent;
GList * (* get_values) (GstMixerOptions *opts);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_options_get_type (void);
GList * gst_mixer_options_get_values (GstMixerOptions *mixer_options);
G_END_DECLS
#endif /* __GST_MIXER_OPTIONS_H__ */

View file

@ -1,288 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixertrack.c: mixer track object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstmixertrack
* @short_description: Basic mixer control object (volume slider, switch)
* @see_also: GstMixer, GstMixerOptions
*
* Basic mixer control object (note that it is a GObject and not a GstObject).
*
* A mixer track represents a single slider control of none, one or more
* channels. A mixer track with no channels is usually interpreted as a
* on/off switch control.
*
* Note the presence of both min_volume and max_volume fields. Applications
* must not assume that min_volume is 0 or max_volume is any particular
* value.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mixertrack.h"
#if 0
enum
{
/* FILL ME */
SIGNAL_VOLUME_CHANGED,
SIGNAL_RECORD_TOGGLED,
SIGNAL_MUTE_TOGGLED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
#endif
enum
{
ARG_0,
ARG_LABEL,
ARG_UNTRANSLATED_LABEL,
ARG_INDEX,
ARG_MIN_VOLUME,
ARG_MAX_VOLUME,
ARG_FLAGS,
ARG_NUM_CHANNELS
};
static void gst_mixer_track_class_init (GstMixerTrackClass * klass);
static void gst_mixer_track_init (GstMixerTrack * mixer);
static void gst_mixer_track_dispose (GObject * object);
static void gst_mixer_track_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_mixer_track_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static GObjectClass *parent_class = NULL;
GType
gst_mixer_track_get_type (void)
{
static GType gst_mixer_track_type = 0;
if (!gst_mixer_track_type) {
static const GTypeInfo mixer_track_info = {
sizeof (GstMixerTrackClass),
NULL,
NULL,
(GClassInitFunc) gst_mixer_track_class_init,
NULL,
NULL,
sizeof (GstMixerTrack),
0,
(GInstanceInitFunc) gst_mixer_track_init,
NULL
};
gst_mixer_track_type =
g_type_register_static (G_TYPE_OBJECT,
"GstMixerTrack", &mixer_track_info, 0);
}
return gst_mixer_track_type;
}
static void
gst_mixer_track_class_init (GstMixerTrackClass * klass)
{
GObjectClass *object_klass = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_klass->get_property = gst_mixer_track_get_property;
object_klass->set_property = gst_mixer_track_set_property;
g_object_class_install_property (object_klass, ARG_LABEL,
g_param_spec_string ("label", "Track label",
"The label assigned to the track (may be translated)", NULL,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS));
/**
* GstMixerTrack:untranslated-label
*
* The untranslated label of the mixer track, if available. Mixer track
* implementations must set this at construct time. Applications may find
* this useful to determine icons for various kind of tracks. However,
* applications mustn't make any assumptions about the naming of tracks,
* the untranslated labels are purely informational and may change.
*
* Since: 0.10.13
**/
g_object_class_install_property (object_klass, ARG_UNTRANSLATED_LABEL,
g_param_spec_string ("untranslated-label", "Untranslated track label",
"The untranslated label assigned to the track (since 0.10.13)",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GstMixerTrack:index
*
* Index of the mixer track, if available. Mixer track implementations
* must set this at construct time. This can be used to discern between
* multiple tracks with identical labels.
*
* Since: 0.10.21
*/
g_object_class_install_property (object_klass, ARG_INDEX,
g_param_spec_uint ("index", "Index",
"Track index", 0, G_MAXUINT,
0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_klass, ARG_MIN_VOLUME,
g_param_spec_int ("min-volume", "Minimum volume level",
"The minimum possible volume level", G_MININT, G_MAXINT,
0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_klass, ARG_MAX_VOLUME,
g_param_spec_int ("max-volume", "Maximum volume level",
"The maximum possible volume level", G_MININT, G_MAXINT,
0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_klass, ARG_FLAGS,
g_param_spec_uint ("flags", "Flags",
"Flags indicating the type of mixer track",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_klass, ARG_NUM_CHANNELS,
g_param_spec_int ("num-channels", "Number of channels",
"The number of channels contained within the track",
0, G_MAXINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#if 0
signals[SIGNAL_RECORD_TOGGLED] =
g_signal_new ("record_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
record_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_MUTE_TOGGLED] =
g_signal_new ("mute_toggled", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
mute_toggled),
NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
signals[SIGNAL_VOLUME_CHANGED] =
g_signal_new ("volume_changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstMixerTrackClass,
volume_changed),
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
#endif
object_klass->dispose = gst_mixer_track_dispose;
}
static void
gst_mixer_track_init (GstMixerTrack * mixer_track)
{
mixer_track->label = NULL;
mixer_track->min_volume = mixer_track->max_volume = 0;
mixer_track->flags = 0;
mixer_track->num_channels = 0;
}
/* FIXME 0.11: move these as members into the mixer track structure */
#define MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL "gst-mixer-track-ulabel"
#define MIXER_TRACK_OBJECT_DATA_KEY_INDEX "index"
static void
gst_mixer_track_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec)
{
GstMixerTrack *mixer_track;
mixer_track = GST_MIXER_TRACK (object);
switch (prop_id) {
case ARG_LABEL:
g_value_set_string (value, mixer_track->label);
break;
case ARG_UNTRANSLATED_LABEL:
g_value_set_string (value,
(const gchar *) g_object_get_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL));
break;
case ARG_INDEX:
g_value_set_uint (value,
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_INDEX)));
break;
case ARG_MIN_VOLUME:
g_value_set_int (value, mixer_track->min_volume);
break;
case ARG_MAX_VOLUME:
g_value_set_int (value, mixer_track->max_volume);
break;
case ARG_FLAGS:
g_value_set_uint (value, (guint32) mixer_track->flags);
break;
case ARG_NUM_CHANNELS:
g_value_set_int (value, mixer_track->num_channels);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_mixer_track_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstMixerTrack *mixer_track;
mixer_track = GST_MIXER_TRACK (object);
switch (prop_id) {
case ARG_UNTRANSLATED_LABEL:
g_object_set_data_full (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_UNTRANSLATED_LABEL,
g_value_dup_string (value), (GDestroyNotify) g_free);
break;
case ARG_INDEX:
g_object_set_data (G_OBJECT (mixer_track),
MIXER_TRACK_OBJECT_DATA_KEY_INDEX,
GINT_TO_POINTER (g_value_get_uint (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gst_mixer_track_dispose (GObject * object)
{
GstMixerTrack *channel = GST_MIXER_TRACK (object);
if (channel->label) {
g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,121 +0,0 @@
/* GStreamer Mixer
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* mixertrack.h: mixer track object
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_MIXER_TRACK_H__
#define __GST_MIXER_TRACK_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_MIXER_TRACK \
(gst_mixer_track_get_type ())
#define GST_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MIXER_TRACK, \
GstMixerTrack))
#define GST_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MIXER_TRACK, \
GstMixerTrackClass))
#define GST_IS_MIXER_TRACK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MIXER_TRACK))
#define GST_IS_MIXER_TRACK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MIXER_TRACK))
/*
* Naming:
*
* A track is a single input/output stream (e.g. line-in,
* microphone, etc.). Channels are then single streams
* within a track. A mono stream has one channel, a stereo
* stream has two, etc.
*
* Input tracks can have 'recording' enabled, which means
* that any input will be hearable into the speakers that
* are attached to the output. Mute is obvious. A track
* flagged as master is the master volume track on this
* mixer, which means that setting this track will change
* the hearable volume on any output.
*/
/**
* GstMixerTrackFlags:
* @GST_MIXER_TRACK_INPUT: mixer track is for input
* @GST_MIXER_TRACK_OUTPUT: mixer track is for output
* @GST_MIXER_TRACK_MUTE: input or output is muted
* @GST_MIXER_TRACK_RECORD: input is audible in speakers attached to output
* (for #GST_MIXER_TRACK_INPUT mixer tracks only)
* @GST_MIXER_TRACK_MASTER: this mixer track is likely to be the master control
* @GST_MIXER_TRACK_SOFTWARE: mixer track's' volume control is implemented
* in software (as opposed to a hardware control)
* @GST_MIXER_TRACK_NO_RECORD: input track lacks support for recordable.
* Since: 0.10.23
* @GST_MIXER_TRACK_NO_MUTE: play track doesn't support mute. Since: 0.10.23
* @GST_MIXER_TRACK_WHITELIST: track should be displayed "by default" in apps.
* Since: 0.10.23
* @GST_MIXER_TRACK_READABLE: track is read-only. Since: 0.10.25
* @GST_MIXER_TRACK_WRITABLE: track is write-only. Since: 0.10.25
*
* Mixer track flags.
*/
typedef enum {
GST_MIXER_TRACK_INPUT = (1 << 0),
GST_MIXER_TRACK_OUTPUT = (1 << 1),
GST_MIXER_TRACK_MUTE = (1 << 2),
GST_MIXER_TRACK_RECORD = (1 << 3),
GST_MIXER_TRACK_MASTER = (1 << 4),
GST_MIXER_TRACK_SOFTWARE = (1 << 5),
GST_MIXER_TRACK_NO_RECORD = (1 << 6),
GST_MIXER_TRACK_NO_MUTE = (1 << 7),
GST_MIXER_TRACK_WHITELIST = (1 << 8),
GST_MIXER_TRACK_READABLE = (1 << 9),
GST_MIXER_TRACK_WRITABLE = (1 << 10)
} GstMixerTrackFlags;
#define GST_MIXER_TRACK_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
typedef struct _GstMixerTrack GstMixerTrack;
typedef struct _GstMixerTrackClass GstMixerTrackClass;
struct _GstMixerTrack {
GObject parent;
gchar *label;
GstMixerTrackFlags flags;
gint num_channels;
gint min_volume;
gint max_volume;
gpointer _gst_reserved[GST_PADDING];
};
struct _GstMixerTrackClass {
GObjectClass parent;
gpointer _gst_reserved[GST_PADDING];
};
GType gst_mixer_track_get_type (void);
G_END_DECLS
#endif /* __GST_MIXER_TRACK_H__ */

View file

@ -1,251 +0,0 @@
/* GStreamer
* Copyright (C) 2003-2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
* Copyright (C) 2005-2006 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstaudiomixerutils
* @short_description: utility functions to find available audio mixers
* from the plugin registry
*
* <refsect2>
* <para>
* Provides some utility functions to detect available audio mixers
* on the system.
* </para>
* </refsect2>
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mixerutils.h"
#include <string.h>
static void
gst_audio_mixer_filter_do_filter (GstAudioMixerFilterFunc filter_func,
GstElementFactory * factory,
GstElement ** p_element, GList ** p_collection, gpointer user_data)
{
/* so, the element is a mixer, let's see if the caller wants it */
if (filter_func != NULL) {
if (filter_func (GST_MIXER (*p_element), user_data) == TRUE) {
*p_collection = g_list_prepend (*p_collection, *p_element);
/* do not set state back to NULL here on purpose, caller
* might want to keep the mixer open */
*p_element = NULL;
}
} else {
gst_element_set_state (*p_element, GST_STATE_NULL);
*p_collection = g_list_prepend (*p_collection, *p_element);
*p_element = NULL;
}
/* create new element for further probing if the old one was cleared */
if (*p_element == NULL) {
*p_element = gst_element_factory_create (factory, NULL);
}
}
static gboolean
gst_audio_mixer_filter_check_element (GstElement * element)
{
GstStateChangeReturn ret;
/* open device (only then we can know for sure whether it is a mixer) */
gst_element_set_state (element, GST_STATE_READY);
ret = gst_element_get_state (element, NULL, NULL, 1 * GST_SECOND);
if (ret != GST_STATE_CHANGE_SUCCESS) {
GST_DEBUG ("could not open device / set element to READY");
gst_element_set_state (element, GST_STATE_NULL);
return FALSE;
}
/* is this device a mixer? */
if (!GST_IS_MIXER (element)) {
GST_DEBUG ("element is not a mixer");
gst_element_set_state (element, GST_STATE_NULL);
return FALSE;
}
/* any tracks? */
if (!gst_mixer_list_tracks (GST_MIXER (element))) {
GST_DEBUG ("element is a mixer, but has no tracks");
gst_element_set_state (element, GST_STATE_NULL);
return FALSE;
}
GST_DEBUG ("element is a mixer with mixer tracks");
return TRUE;
}
static void
gst_audio_mixer_filter_probe_feature (GstAudioMixerFilterFunc filter_func,
GstElementFactory * factory,
GList ** p_collection, gboolean first, gpointer user_data)
{
GstElement *element;
GST_DEBUG ("probing %s ...", gst_element_factory_get_longname (factory));
/* create element */
element = gst_element_factory_create (factory, NULL);
if (element == NULL) {
GST_DEBUG ("could not create element from factory");
return;
}
GST_DEBUG ("created element %s (%p)", GST_ELEMENT_NAME (element), element);
#if 0
if (GST_IS_PROPERTY_PROBE (element)) {
GstPropertyProbe *probe;
const GParamSpec *devspec;
probe = GST_PROPERTY_PROBE (element);
GST_DEBUG ("probing available devices ...");
if ((devspec = gst_property_probe_get_property (probe, "device"))) {
GValueArray *array;
if ((array = gst_property_probe_probe_and_get_values (probe, devspec))) {
guint n;
GST_DEBUG ("there are %d available devices", array->n_values);
/* set all devices and test for mixer */
for (n = 0; n < array->n_values; n++) {
GValue *device;
/* set this device */
device = g_value_array_get_nth (array, n);
g_object_set_property (G_OBJECT (element), "device", device);
GST_DEBUG ("trying device %s ..", g_value_get_string (device));
if (gst_audio_mixer_filter_check_element (element)) {
gst_audio_mixer_filter_do_filter (filter_func, factory, &element,
p_collection, user_data);
if (first && *p_collection != NULL) {
GST_DEBUG ("Stopping after first found mixer, as requested");
break;
}
}
}
g_value_array_free (array);
}
}
} else
#endif
{
GST_DEBUG ("element does not support the property probe interface");
if (gst_audio_mixer_filter_check_element (element)) {
gst_audio_mixer_filter_do_filter (filter_func, factory, &element,
p_collection, user_data);
}
}
if (element) {
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref (element);
}
}
static gint
element_factory_rank_compare_func (gconstpointer a, gconstpointer b)
{
gint rank_a = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (a));
gint rank_b = gst_plugin_feature_get_rank (GST_PLUGIN_FEATURE (b));
/* make order chosen in the end more determinable */
if (rank_a == rank_b) {
const gchar *name_a = GST_OBJECT_NAME (GST_PLUGIN_FEATURE (a));
const gchar *name_b = GST_OBJECT_NAME (GST_PLUGIN_FEATURE (b));
return g_ascii_strcasecmp (name_a, name_b);
}
return rank_b - rank_a;
}
/**
* gst_audio_default_registry_mixer_filter:
* @filter_func: filter function, or #NULL
* @first: set to #TRUE if you only want the first suitable mixer element
* @user_data: user data to pass to the filter function
*
* Utility function to find audio mixer elements.
*
* Will traverse the default plugin registry in order of plugin rank and
* find usable audio mixer elements. The caller may optionally fine-tune
* the selection by specifying a filter function.
*
* Returns: a #GList of audio mixer #GstElement<!-- -->s. You must free each
* element in the list by setting it to NULL state and calling
* gst_object_unref(). After that the list itself should be freed
* using g_list_free().
*
* Since: 0.10.2
*/
GList *
gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func,
gboolean first, gpointer data)
{
GList *mixer_list = NULL;
GList *feature_list;
GList *walk;
/* go through all elements of a certain class and check whether
* they implement a mixer. If so, add it to the list. */
feature_list = gst_registry_get_feature_list (gst_registry_get (),
GST_TYPE_ELEMENT_FACTORY);
feature_list = g_list_sort (feature_list, element_factory_rank_compare_func);
for (walk = feature_list; walk != NULL; walk = walk->next) {
GstElementFactory *factory;
const gchar *klass;
factory = GST_ELEMENT_FACTORY (walk->data);
/* check category */
klass = gst_element_factory_get_klass (factory);
if (strcmp (klass, "Generic/Audio") == 0) {
gst_audio_mixer_filter_probe_feature (filter_func, factory,
&mixer_list, first, data);
}
if (first && mixer_list != NULL) {
GST_DEBUG ("Stopping after first found mixer, as requested");
break;
}
}
gst_plugin_feature_list_free (feature_list);
return g_list_reverse (mixer_list);
}

View file

@ -1,50 +0,0 @@
/* GStreamer
* Copyright (C) 2005-2006 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_MIXERUTILS_H__
#define __GST_AUDIO_MIXERUTILS_H__
#include <gst/gst.h>
#include <gst/audio/mixer.h>
G_BEGIN_DECLS
/**
* GstAudioMixerFilterFunc:
* @mixer: a #GstElement implementing the #GstMixer interface
* @user_data: user data
*
* Function that will be called by gst_audio_default_registry_mixer_filter()
* so the caller can decide which mixer elements should be kept and returned.
* When the mixer element is passed to the callback function, it is opened
* and in READY state. If you decide to keep the element, you need to set it
* back to NULL state yourself (unless you want to keep it opened of course).
*
* Returns: TRUE if the element should be kept, FALSE otherwise.
*/
typedef gboolean (*GstAudioMixerFilterFunc) (GstMixer * mixer, gpointer user_data);
GList * gst_audio_default_registry_mixer_filter (GstAudioMixerFilterFunc filter_func,
gboolean first,
gpointer user_data);
G_END_DECLS
#endif /* __GST_AUDIO_MIXERUTILS_H__ */

View file

@ -1,5 +0,0 @@
interfaces-enumtypes.c
interfaces-enumtypes.h
interfaces-marshal.c
interfaces-marshal.h

View file

@ -1,121 +0,0 @@
lib_LTLIBRARIES = libgstinterfaces-@GST_API_VERSION@.la
libgstinterfacesincludedir = \
$(includedir)/gstreamer-@GST_API_VERSION@/gst/interfaces
headers_interfaces = \
navigation.h \
tuner.h \
tunernorm.h \
tunerchannel.h
# variables used for enum/marshal generation
glib_enum_headers = $(headers_interfaces)
glib_enum_define = GST_INTERFACES
glib_gen_prefix = gst_interfaces
glib_gen_basename = interfaces
built_sources = \
interfaces-marshal.c \
interfaces-enumtypes.c
built_headers = \
interfaces-marshal.h \
interfaces-enumtypes.h
libgstinterfacesinclude_HEADERS = \
$(headers_interfaces)
nodist_libgstinterfacesinclude_HEADERS = \
interfaces-enumtypes.h
libgstinterfaces_@GST_API_VERSION@_la_SOURCES = \
navigation.c \
tuner.c \
tunernorm.c \
tunerchannel.c
nodist_libgstinterfaces_@GST_API_VERSION@_la_SOURCES = \
$(built_sources) \
interfaces-marshal.h
libgstinterfaces_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
libgstinterfaces_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM)
libgstinterfaces_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
BUILT_SOURCES = \
$(built_sources) \
$(built_headers)
EXTRA_DIST = interfaces-marshal.list
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/common/gst-glib-gen.mak
if HAVE_INTROSPECTION
BUILT_GIRSOURCES = GstInterfaces-@GST_API_VERSION@.gir
gir_headers=$(patsubst %,$(srcdir)/%, $(libgstinterfacesinclude_HEADERS))
gir_headers+=$(patsubst %,$(builddir)/%, $(nodist_libgstinterfacesinclude_HEADERS))
gir_sources=$(patsubst %,$(srcdir)/%, $(libgstinterfaces_@GST_API_VERSION@_la_SOURCES))
gir_sources+=$(patsubst %,$(builddir)/%, $(nodist_libgstinterfaces_@GST_API_VERSION@_la_SOURCES))
gir_cincludes=$(patsubst %,--c-include='gst/interfaces/%',$(libgstinterfacesinclude_HEADERS))
gir_cincludes+=$(patsubst %,--c-include='gst/interfaces/%',$(nodist_libgstinterfacesinclude_HEADERS))
GstInterfaces-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstinterfaces-@GST_API_VERSION@.la
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
GST_PLUGIN_SYSTEM_PATH="" GST_PLUGIN_PATH="" GST_REGISTRY_UPDATE=no \
$(INTROSPECTION_SCANNER) -v --namespace GstInterfaces \
--nsversion=@GST_API_VERSION@ \
--strip-prefix=Gst \
--warn-all \
$(gir_cincludes) \
-DGST_USE_UNSTABLE_API \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--library=libgstinterfaces-@GST_API_VERSION@.la \
--include=Gst-@GST_API_VERSION@ \
--libtool="$(top_builddir)/libtool" \
--pkg gstreamer-@GST_API_VERSION@ \
--pkg-export gstreamer-interfaces-@GST_API_VERSION@ \
--add-init-section="gst_init(NULL,NULL);" \
--output $@ \
$(gir_headers) \
$(gir_sources)
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
%.typelib: %.gir $(INTROSPECTION_COMPILER)
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
$(INTROSPECTION_COMPILER) \
--includedir=$(srcdir) \
--includedir=$(builddir) \
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer -:PROJECT libgstinterfaces -:SHARED libgstinterfaces-@GST_API_VERSION@ \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstinterfaces_@GST_API_VERSION@_la_SOURCES) \
$(nodist_libgstinterfaces_@GST_API_VERSION@_la_SOURCES) \
-:CFLAGS $(DEFS) $(libgstinterfaces_@GST_API_VERSION@_la_CFLAGS) \
-:LDFLAGS $(libgstinterfaces_@GST_API_VERSION@_la_LDFLAGS) \
$(libgstinterfaces_@GST_API_VERSION@_la_LIBADD) \
-ldl \
-:HEADER_TARGET gstreamer-@GST_API_VERSION@/gst/interfaces \
-:HEADERS $(libgstinterfacesinclude_HEADERS) \
$(nodist_libgstinterfacesinclude_HEADERS) \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
> $@

View file

@ -1,2 +0,0 @@
VOID:OBJECT,ULONG
VOID:OBJECT,INT

View file

@ -1,577 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tuner.c: tuner design virtual class function wrappers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tuner.h"
#include "interfaces-marshal.h"
#include <string.h>
/**
* SECTION:gsttuner
* @short_description: Interface for elements providing tuner operations
*
* <refsect2>
* <para>
* The GstTuner interface is provided by elements that have the ability to
* tune into multiple input signals, for example TV or radio capture cards.
* </para><para>
* The interpretation of 'tuning into' an input stream depends on the element
* implementing the interface. For v4lsrc, it might imply selection of an
* input source and/or frequency to be configured on a TV card. Another
* GstTuner implementation might be to allow selection of an active input pad
* from multiple input pads.
* </para><para>
* That said, the GstTuner interface functions are biased toward the
* TV capture scenario.
* </para><para>
* The general parameters provided are for configuration are:
* <itemizedlist>
* <listitem>Selection of a current #GstTunerChannel. The current channel
* represents the input source (e.g. Composite, S-Video etc for TV capture).
* </listitem>
* <listitem>The #GstTunerNorm for the channel. The norm chooses the
* interpretation of the incoming signal for the current channel. For example,
* PAL or NTSC, or more specific variants there-of.
* </listitem>
* <listitem>Channel frequency. If the current channel has the ability to tune
* between multiple frequencies (if it has the GST_TUNER_CHANNEL_FREQUENCY flag)
* then the frequency can be changed/retrieved via the
* gst_tuner_set_frequency() and gst_tuner_get_frequency() methods.
* </listitem>
* </itemizedlist>
* </para>
* <para>
* Where applicable, the signal strength can be retrieved and/or monitored
* via a signal.
* </para>
* </refsect2>
*/
/* FIXME 0.11: check if we need to add API for sometimes-supportedness
* (aka making up for GstImplementsInterface removal) */
/* FIXME 0.11: replace signals with messages (+ make API thread-safe) */
enum
{
NORM_CHANGED,
CHANNEL_CHANGED,
FREQUENCY_CHANGED,
SIGNAL_CHANGED,
LAST_SIGNAL
};
static void gst_tuner_class_init (GstTunerInterface * iface);
static guint gst_tuner_signals[LAST_SIGNAL] = { 0 };
GType
gst_tuner_get_type (void)
{
static GType gst_tuner_type = 0;
if (!gst_tuner_type) {
static const GTypeInfo gst_tuner_info = {
sizeof (GstTunerInterface),
(GBaseInitFunc) gst_tuner_class_init,
NULL,
NULL,
NULL,
NULL,
0,
0,
NULL,
};
gst_tuner_type = g_type_register_static (G_TYPE_INTERFACE,
"GstTuner", &gst_tuner_info, 0);
}
return gst_tuner_type;
}
static void
gst_tuner_class_init (GstTunerInterface * iface)
{
static gboolean initialized = FALSE;
if (!initialized) {
/**
* GstTuner::norm-changed:
* @tuner: The element providing the GstTuner interface
* @norm: The new configured norm.
*
* Reports that the current #GstTunerNorm has changed.
*/
gst_tuner_signals[NORM_CHANGED] =
g_signal_new ("norm-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerInterface, norm_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_TUNER_NORM);
/**
* GstTuner::channel-changed:
* @tuner: The element providing the GstTuner interface
* @channel: The new configured channel.
*
* Reports that the current #GstTunerChannel has changed.
*/
gst_tuner_signals[CHANNEL_CHANGED] =
g_signal_new ("channel-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerInterface, channel_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1,
GST_TYPE_TUNER_CHANNEL);
/**
* GstTuner::frequency-changed:
* @tuner: The element providing the GstTuner interface
* @frequency: The new frequency (an unsigned long)
*
* Reports that the current frequency has changed.
*/
gst_tuner_signals[FREQUENCY_CHANGED] =
g_signal_new ("frequency-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerInterface, frequency_changed),
NULL, NULL,
gst_interfaces_marshal_VOID__OBJECT_ULONG, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_ULONG);
/**
* GstTuner::signal-changed:
* @tuner: The element providing the GstTuner interface
* @channel: The current #GstTunerChannel
* @signal: The new signal strength (an integer)
*
* Reports that the signal strength has changed.
*
* See Also: gst_tuner_signal_strength()
*/
gst_tuner_signals[SIGNAL_CHANGED] =
g_signal_new ("signal-changed",
GST_TYPE_TUNER, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerInterface, signal_changed),
NULL, NULL,
gst_interfaces_marshal_VOID__OBJECT_INT, G_TYPE_NONE, 2,
GST_TYPE_TUNER_CHANNEL, G_TYPE_INT);
initialized = TRUE;
}
/* default virtual functions */
iface->list_channels = NULL;
iface->set_channel = NULL;
iface->get_channel = NULL;
iface->list_norms = NULL;
iface->set_norm = NULL;
iface->get_norm = NULL;
iface->set_frequency = NULL;
iface->get_frequency = NULL;
iface->signal_strength = NULL;
}
/**
* gst_tuner_list_channels:
* @tuner: the #GstTuner (a #GstElement) to get the channels from.
*
* Retrieve a #GList of #GstTunerChannels available
* (e.g. 'composite', 's-video', ...) from the given tuner object.
*
* Returns: A list of channels available on this tuner. The list is
* owned by the GstTuner and must not be freed.
*/
const GList *
gst_tuner_list_channels (GstTuner * tuner)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->list_channels) {
return iface->list_channels (tuner);
}
return NULL;
}
/**
* gst_tuner_set_channel:
* @tuner: the #GstTuner (a #GstElement) that owns the channel.
* @channel: the channel to tune to.
*
* Tunes the object to the given channel, which should be one of the
* channels returned by gst_tuner_list_channels().
*/
void
gst_tuner_set_channel (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerInterface *iface;
g_return_if_fail (GST_IS_TUNER (tuner));
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->set_channel) {
iface->set_channel (tuner, channel);
}
}
/**
* gst_tuner_get_channel:
* @tuner: the #GstTuner (a #GstElement) to get the current channel from.
*
* Retrieve the current channel from the tuner.
*
* Returns: the current channel of the tuner object.
*/
GstTunerChannel *
gst_tuner_get_channel (GstTuner * tuner)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->get_channel) {
return iface->get_channel (tuner);
}
return NULL;
}
/**
* gst_tuner_list_norms:
* @tuner: the #GstTuner (*a #GstElement) to get the list of norms from.
*
* Retrieve a GList of available #GstTunerNorm settings for the currently
* tuned channel on the given tuner object.
*
* Returns: A list of norms available on the current channel for this
* tuner object. The list is owned by the GstTuner and must not
* be freed.
*/
const GList *
gst_tuner_list_norms (GstTuner * tuner)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->list_norms) {
return iface->list_norms (tuner);
}
return NULL;
}
/**
* gst_tuner_set_norm:
* @tuner: the #GstTuner (a #GstElement) to set the norm on.
* @norm: the norm to use for the current channel.
*
* Changes the video norm on this tuner to the given norm, which should be
* one of the norms returned by gst_tuner_list_norms().
*/
void
gst_tuner_set_norm (GstTuner * tuner, GstTunerNorm * norm)
{
GstTunerInterface *iface;
g_return_if_fail (GST_IS_TUNER (tuner));
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->set_norm) {
iface->set_norm (tuner, norm);
}
}
/**
* gst_tuner_get_norm:
* @tuner: the #GstTuner (a #GstElement) to get the current norm from.
*
* Get the current video norm from the given tuner object for the
* currently selected channel.
*
* Returns: the current norm.
*/
GstTunerNorm *
gst_tuner_get_norm (GstTuner * tuner)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->get_norm) {
return iface->get_norm (tuner);
}
return NULL;
}
/**
* gst_tuner_set_frequency:
* @tuner: The #GstTuner (a #GstElement) that owns the given channel.
* @channel: The #GstTunerChannel to set the frequency on.
* @frequency: The frequency to tune in to.
*
* Sets a tuning frequency on the given tuner/channel. Note that this
* requires the given channel to be a "tuning" channel, which can be
* checked using GST_TUNER_CHANNEL_HAS_FLAG (), with the proper flag
* being GST_TUNER_CHANNEL_FREQUENCY.
*
* The frequency is in Hz, with minimum steps indicated by the
* frequency_multiplicator provided in the #GstTunerChannel. The
* valid range is provided in the min_frequency and max_frequency properties
* of the #GstTunerChannel.
*/
void
gst_tuner_set_frequency (GstTuner * tuner,
GstTunerChannel * channel, gulong frequency)
{
GstTunerInterface *iface;
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY));
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->set_frequency) {
iface->set_frequency (tuner, channel, frequency);
}
}
/**
* gst_tuner_get_frequency:
* @tuner: The #GstTuner (a #GstElement) that owns the given channel.
* @channel: The #GstTunerChannel to retrieve the frequency from.
*
* Retrieve the current frequency from the given channel. As for
* gst_tuner_set_frequency(), the #GstTunerChannel must support frequency
* operations, as indicated by the GST_TUNER_CHANNEL_FREQUENCY flag.
*
* Returns: The current frequency, or 0 on error.
*/
gulong
gst_tuner_get_frequency (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), 0);
g_return_val_if_fail (GST_IS_TUNER_CHANNEL (channel), 0);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->get_frequency) {
return iface->get_frequency (tuner, channel);
}
return 0;
}
/**
* gst_tuner_signal_strength:
* @tuner: the #GstTuner (a #GstElement) that owns the given channel.
* @channel: the #GstTunerChannel to get the signal strength from.
*
* Get the strength of the signal on this channel. Note that this
* requires the current channel to be a "tuning" channel, i.e. a
* channel on which frequency can be set. This can be checked using
* GST_TUNER_CHANNEL_HAS_FLAG (), and the appropriate flag to check
* for is GST_TUNER_CHANNEL_FREQUENCY.
*
* The valid range of the signal strength is indicated in the
* min_signal and max_signal properties of the #GstTunerChannel.
*
* Returns: Signal strength, or 0 on error.
*/
gint
gst_tuner_signal_strength (GstTuner * tuner, GstTunerChannel * channel)
{
GstTunerInterface *iface;
g_return_val_if_fail (GST_IS_TUNER (tuner), 0);
g_return_val_if_fail (GST_IS_TUNER_CHANNEL (channel), 0);
g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel,
GST_TUNER_CHANNEL_FREQUENCY), 0);
iface = GST_TUNER_GET_INTERFACE (tuner);
if (iface->signal_strength) {
return iface->signal_strength (tuner, channel);
}
return 0;
}
/**
* gst_tuner_find_norm_by_name:
* @tuner: A #GstTuner instance
* @norm: A string containing the name of a #GstTunerNorm
*
* Look up a #GstTunerNorm by name.
*
* Returns: A #GstTunerNorm, or NULL if no norm with the provided name
* is available.
*/
GstTunerNorm *
gst_tuner_find_norm_by_name (GstTuner * tuner, gchar * norm)
{
GList *walk;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
g_return_val_if_fail (norm != NULL, NULL);
walk = (GList *) gst_tuner_list_norms (tuner);
while (walk) {
if (strcmp (GST_TUNER_NORM (walk->data)->label, norm) == 0)
return GST_TUNER_NORM (walk->data);
walk = g_list_next (walk);
}
return NULL;
}
/**
* gst_tuner_find_channel_by_name:
* @tuner: A #GstTuner instance
* @channel: A string containing the name of a #GstTunerChannel
*
* Look up a #GstTunerChannel by name.
*
* Returns: A #GstTunerChannel, or NULL if no channel with the provided name
* is available.
*/
GstTunerChannel *
gst_tuner_find_channel_by_name (GstTuner * tuner, gchar * channel)
{
GList *walk;
g_return_val_if_fail (GST_IS_TUNER (tuner), NULL);
g_return_val_if_fail (channel != NULL, NULL);
walk = (GList *) gst_tuner_list_channels (tuner);
while (walk) {
if (strcmp (GST_TUNER_CHANNEL (walk->data)->label, channel) == 0)
return GST_TUNER_CHANNEL (walk->data);
walk = g_list_next (walk);
}
return NULL;
}
/**
* gst_tuner_channel_changed:
* @tuner: A #GstTuner instance
* @channel: A #GstTunerChannel instance
*
* Called by elements implementing the #GstTuner interface when the
* current channel changes. Fires the #GstTuner::channel-changed signal.
*/
void
gst_tuner_channel_changed (GstTuner * tuner, GstTunerChannel * channel)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[CHANNEL_CHANGED], 0, channel);
}
/**
* gst_tuner_norm_changed:
* @tuner: A #GstTuner instance
* @norm: A #GstTunerNorm instance
*
* Called by elements implementing the #GstTuner interface when the
* current norm changes. Fires the #GstTuner::norm-changed signal.
*
*/
void
gst_tuner_norm_changed (GstTuner * tuner, GstTunerNorm * norm)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_NORM (norm));
g_signal_emit (G_OBJECT (tuner), gst_tuner_signals[NORM_CHANGED], 0, norm);
}
/**
* gst_tuner_frequency_changed:
* @tuner: A #GstTuner instance
* @channel: The current #GstTunerChannel
* @frequency: The new frequency setting
*
* Called by elements implementing the #GstTuner interface when the
* configured frequency changes. Fires the #GstTuner::frequency-changed
* signal on the tuner, and the #GstTunerChannel::frequency-changed signal
* on the channel.
*/
void
gst_tuner_frequency_changed (GstTuner * tuner,
GstTunerChannel * channel, gulong frequency)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[FREQUENCY_CHANGED], 0, channel, frequency);
g_signal_emit_by_name (G_OBJECT (channel), "frequency_changed", frequency);
}
/**
* gst_tuner_signal_changed:
* @tuner: A #GstTuner instance
* @channel: The current #GstTunerChannel
* @signal: The new signal strength
*
* Called by elements implementing the #GstTuner interface when the
* incoming signal strength changes. Fires the #GstTuner::signal-changed
* signal on the tuner and the #GstTunerChannel::signal-changed signal on
* the channel.
*/
void
gst_tuner_signal_changed (GstTuner * tuner,
GstTunerChannel * channel, gint signal)
{
g_return_if_fail (GST_IS_TUNER (tuner));
g_return_if_fail (GST_IS_TUNER_CHANNEL (channel));
g_signal_emit (G_OBJECT (tuner),
gst_tuner_signals[SIGNAL_CHANGED], 0, channel, signal);
g_signal_emit_by_name (G_OBJECT (channel), "signal_changed", signal);
}

View file

@ -1,141 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tuner.h: tuner interface design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TUNER_H__
#define __GST_TUNER_H__
#include <gst/gst.h>
#include <gst/interfaces/tunernorm.h>
#include <gst/interfaces/tunerchannel.h>
#include <gst/interfaces/interfaces-enumtypes.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER \
(gst_tuner_get_type ())
#define GST_TUNER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER, GstTuner))
#define GST_IS_TUNER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER))
#define GST_TUNER_GET_INTERFACE(inst) \
(G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_TUNER, GstTunerInterface))
typedef struct _GstTuner GstTuner;
typedef struct _GstTunerInterface GstTunerInterface;
/**
* GstTunerInterface:
* @iface: the parent interface
* @list_channels: list available channels
* @set_channel: set to a channel
* @get_channel: return the current channel
* @list_norms: list available norms
* @set_norm: set a norm
* @get_norm: return the current norm
* @set_frequency: set the frequency
* @get_frequency: return the current frequency
* @signal_strength: get the signal strength
* @channel_changed: default handler for channel changed notification
* @norm_changed: default handler for norm changed notification
* @frequency_changed: default handler for frequency changed notification
* @signal_changed: default handler for signal-strength changed notification
*
* Tuner interface.
*/
struct _GstTunerInterface {
GTypeInterface iface;
/* virtual functions */
const GList * (* list_channels) (GstTuner *tuner);
void (* set_channel) (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
(* get_channel) (GstTuner *tuner);
const GList * (* list_norms) (GstTuner *tuner);
void (* set_norm) (GstTuner *tuner,
GstTunerNorm *norm);
GstTunerNorm *(* get_norm) (GstTuner *tuner);
void (* set_frequency) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong (* get_frequency) (GstTuner *tuner,
GstTunerChannel *channel);
gint (* signal_strength) (GstTuner *tuner,
GstTunerChannel *channel);
/* signals */
void (*channel_changed) (GstTuner *tuner,
GstTunerChannel *channel);
void (*norm_changed) (GstTuner *tuner,
GstTunerNorm *norm);
void (*frequency_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
};
GType gst_tuner_get_type (void);
/* virtual class function wrappers */
const GList * gst_tuner_list_channels (GstTuner *tuner);
void gst_tuner_set_channel (GstTuner *tuner,
GstTunerChannel *channel);
GstTunerChannel *
gst_tuner_get_channel (GstTuner *tuner);
const GList * gst_tuner_list_norms (GstTuner *tuner);
void gst_tuner_set_norm (GstTuner *tuner,
GstTunerNorm *norm);
GstTunerNorm * gst_tuner_get_norm (GstTuner *tuner);
void gst_tuner_set_frequency (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
gulong gst_tuner_get_frequency (GstTuner *tuner,
GstTunerChannel *channel);
gint gst_tuner_signal_strength (GstTuner *tuner,
GstTunerChannel *channel);
/* helper functions */
GstTunerNorm * gst_tuner_find_norm_by_name (GstTuner *tuner,
gchar *norm);
GstTunerChannel *gst_tuner_find_channel_by_name (GstTuner *tuner,
gchar *channel);
/* trigger signals */
void gst_tuner_channel_changed (GstTuner *tuner,
GstTunerChannel *channel);
void gst_tuner_norm_changed (GstTuner *tuner,
GstTunerNorm *norm);
void gst_tuner_frequency_changed (GstTuner *tuner,
GstTunerChannel *channel,
gulong frequency);
void gst_tuner_signal_changed (GstTuner *tuner,
GstTunerChannel *channel,
gint signal);
G_END_DECLS
#endif /* __GST_TUNER_H__ */

View file

@ -1,148 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunerchannel.c: tuner channel object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tunerchannel.h"
/**
* SECTION:gsttunerchannel
* @short_description: A channel from an element implementing the #GstTuner
* interface.
*
* <refsect2>
* <para>The #GstTunerChannel object is provided by an element implementing
* the #GstTuner interface.
* </para>
* <para>
* GstTunerChannel provides a name and flags to determine the type and
* capabilities of the channel. If the GST_TUNER_CHANNEL_FREQUENCY flag is
* set, then the channel also information about the minimum and maximum
* frequency, and range of the reported signal strength.
* </para>
* </refsect2>
*/
enum
{
/* FILL ME */
SIGNAL_FREQUENCY_CHANGED,
SIGNAL_SIGNAL_CHANGED,
LAST_SIGNAL
};
static void gst_tuner_channel_class_init (GstTunerChannelClass * klass);
static void gst_tuner_channel_init (GstTunerChannel * channel);
static void gst_tuner_channel_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
static guint signals[LAST_SIGNAL] = { 0 };
GType
gst_tuner_channel_get_type (void)
{
static GType gst_tuner_channel_type = 0;
if (!gst_tuner_channel_type) {
static const GTypeInfo tuner_channel_info = {
sizeof (GstTunerChannelClass),
NULL,
NULL,
(GClassInitFunc) gst_tuner_channel_class_init,
NULL,
NULL,
sizeof (GstTunerChannel),
0,
(GInstanceInitFunc) gst_tuner_channel_init,
NULL
};
gst_tuner_channel_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerChannel", &tuner_channel_info, 0);
}
return gst_tuner_channel_type;
}
static void
gst_tuner_channel_class_init (GstTunerChannelClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
/**
* GstTunerChannel::frequency-changed:
* @tunerchannel: The #GstTunerChannel
* @frequency: The new frequency (an unsigned long)
*
* Reports that the current frequency has changed.
*/
signals[SIGNAL_FREQUENCY_CHANGED] =
g_signal_new ("frequency-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
frequency_changed),
NULL, NULL, g_cclosure_marshal_VOID__ULONG, G_TYPE_NONE, 1, G_TYPE_ULONG);
/**
* GstTunerChannel::signal-changed:
* @tunerchannel: The #GstTunerChannel
* @signal: The new signal strength (an integer)
*
* Reports that the signal strength has changed.
*
* See Also: gst_tuner_signal_strength()
*/
signals[SIGNAL_SIGNAL_CHANGED] =
g_signal_new ("signal-changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GstTunerChannelClass,
signal_changed),
NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
object_klass->dispose = gst_tuner_channel_dispose;
}
static void
gst_tuner_channel_init (GstTunerChannel * channel)
{
channel->label = NULL;
channel->flags = 0;
channel->min_frequency = channel->max_frequency = 0;
channel->min_signal = channel->max_signal = 0;
}
static void
gst_tuner_channel_dispose (GObject * object)
{
GstTunerChannel *channel = GST_TUNER_CHANNEL (object);
if (channel->label) {
g_free (channel->label);
channel->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,116 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunerchannel.h: tuner channel object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TUNER_CHANNEL_H__
#define __GST_TUNER_CHANNEL_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_CHANNEL \
(gst_tuner_channel_get_type ())
#define GST_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannel))
#define GST_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_CHANNEL, \
GstTunerChannelClass))
#define GST_IS_TUNER_CHANNEL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_CHANNEL))
#define GST_IS_TUNER_CHANNEL_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_CHANNEL))
typedef struct _GstTunerChannel GstTunerChannel;
typedef struct _GstTunerChannelClass GstTunerChannelClass;
/**
* GstTunerChannelFlags:
* @GST_TUNER_CHANNEL_INPUT: The channel is for input
* @GST_TUNER_CHANNEL_OUTPUT: The channel is for output
* @GST_TUNER_CHANNEL_FREQUENCY: The channel has a frequency setting
* and signal strength.
* @GST_TUNER_CHANNEL_AUDIO: The channel carries audio.
*
* An enumeration for flags indicating the available capabilities
* of a #GstTunerChannel.
*/
typedef enum {
GST_TUNER_CHANNEL_INPUT = (1<<0),
GST_TUNER_CHANNEL_OUTPUT = (1<<1),
GST_TUNER_CHANNEL_FREQUENCY = (1<<2),
GST_TUNER_CHANNEL_AUDIO = (1<<3)
} GstTunerChannelFlags;
/**
* GST_TUNER_CHANNEL_HAS_FLAG:
* @channel: A #GstTunerChannel
* @flag: The flag to check for
*
* Macro to check if the given flag is set on a channel
*/
#define GST_TUNER_CHANNEL_HAS_FLAG(channel, flag) \
((channel)->flags & flag)
/**
* GstTunerChannel:
* @label: A string containing a descriptive name for this channel
* @flags: A set of #GstTunerChannelFlags for this channel
* @freq_multiplicator: The step size (in Hz) for the frequency setting.
* @min_frequency: Minimum valid frequency setting (in Hz).
* @max_frequency: Maximum valid frequency setting (in Hz).
* @min_signal: Minimum reported signal strength value.
* @max_signal: Maximum reported signal strength value.
*/
struct _GstTunerChannel {
GObject parent;
/*< public >*/
gchar *label;
GstTunerChannelFlags flags;
gfloat freq_multiplicator;
gulong min_frequency;
gulong max_frequency;
gint min_signal;
gint max_signal;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstTunerChannelClass {
GObjectClass parent;
/*< private >*/
/* signals */
void (*frequency_changed) (GstTunerChannel *channel,
gulong frequency);
void (*signal_changed) (GstTunerChannel *channel,
gint signal);
gpointer _gst_reserved[GST_PADDING];
};
GType gst_tuner_channel_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_CHANNEL_H__ */

View file

@ -1,111 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunernorm.c: tuner norm object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tunernorm.h"
/**
* SECTION:gsttunernorm
* @short_description: Encapsulates information about the data format(s)
* for a #GstTunerChannel.
*
* <refsect2>
* <para>The #GstTunerNorm object is created by an element implementing the
* #GstTuner interface and encapsulates the selection of a capture/output format
* for a selected #GstTunerChannel.
* </para>
* </refsect2>
*/
enum
{
/* FILL ME */
LAST_SIGNAL
};
static void gst_tuner_norm_class_init (GstTunerNormClass * klass);
static void gst_tuner_norm_init (GstTunerNorm * norm);
static void gst_tuner_norm_dispose (GObject * object);
static GObjectClass *parent_class = NULL;
/*static guint signals[LAST_SIGNAL] = { 0 };*/
GType
gst_tuner_norm_get_type (void)
{
static GType gst_tuner_norm_type = 0;
if (!gst_tuner_norm_type) {
static const GTypeInfo tuner_norm_info = {
sizeof (GstTunerNormClass),
NULL,
NULL,
(GClassInitFunc) gst_tuner_norm_class_init,
NULL,
NULL,
sizeof (GstTunerNorm),
0,
(GInstanceInitFunc) gst_tuner_norm_init,
NULL
};
gst_tuner_norm_type =
g_type_register_static (G_TYPE_OBJECT,
"GstTunerNorm", &tuner_norm_info, 0);
}
return gst_tuner_norm_type;
}
static void
gst_tuner_norm_class_init (GstTunerNormClass * klass)
{
GObjectClass *object_klass = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
object_klass->dispose = gst_tuner_norm_dispose;
}
static void
gst_tuner_norm_init (GstTunerNorm * norm)
{
norm->label = NULL;
g_value_init (&norm->framerate, GST_TYPE_FRACTION);
}
static void
gst_tuner_norm_dispose (GObject * object)
{
GstTunerNorm *norm = GST_TUNER_NORM (object);
if (norm->label) {
g_free (norm->label);
norm->label = NULL;
}
if (parent_class->dispose)
parent_class->dispose (object);
}

View file

@ -1,70 +0,0 @@
/* GStreamer Tuner
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* tunernorm.h: tuner norm object design
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_TUNER_NORM_H__
#define __GST_TUNER_NORM_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_TUNER_NORM \
(gst_tuner_norm_get_type ())
#define GST_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TUNER_NORM, GstTunerNorm))
#define GST_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_TUNER_NORM, GstTunerNormClass))
#define GST_IS_TUNER_NORM(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TUNER_NORM))
#define GST_IS_TUNER_NORM_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TUNER_NORM))
typedef struct _GstTunerNorm GstTunerNorm;
typedef struct _GstTunerNormClass GstTunerNormClass;
/**
* GstTunerNorm:
* @label: A string containing a descriptive name for the norm
* @framerate: A GValue containing the framerate associated with this norm,
* if any. (May be unset).
*/
struct _GstTunerNorm {
GObject parent;
/*< public >*/
gchar *label;
GValue framerate;
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};
struct _GstTunerNormClass {
GObjectClass parent;
gpointer _gst_reserved[GST_PADDING];
};
GType gst_tuner_norm_get_type (void);
G_END_DECLS
#endif /* __GST_TUNER_NORM_H__ */

View file

@ -37,7 +37,6 @@ GstRiff-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstriff-@GST_API_VERS
-DGST_USE_UNSTABLE_API \
--add-include-path=$(builddir)/../tag \
--add-include-path=$(builddir)/../audio \
--add-include-path=$(builddir)/../interfaces \
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--add-include-path=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
--library=libgstriff-@GST_API_VERSION@.la \
@ -48,7 +47,6 @@ GstRiff-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstriff-@GST_API_VERS
--pkg gstreamer-@GST_API_VERSION@ \
--pkg gstreamer-tag-@GST_API_VERSION@ \
--pkg gstreamer-audio-@GST_API_VERSION@ \
--pkg gstreamer-interfaces-@GST_API_VERSION@ \
--pkg-export gstreamer-riff-@GST_API_VERSION@ \
--add-init-section="gst_init(NULL,NULL);" \
--output $@ \
@ -71,7 +69,6 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
--includedir=$(builddir) \
--includedir=$(builddir)/../tag \
--includedir=$(builddir)/../audio \
--includedir=$(builddir)/../interfaces \
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--includedir=`$(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)

View file

@ -1,5 +1,5 @@
# variables used for enum/marshal generation
glib_enum_headers = video.h colorbalance.h
glib_enum_headers = video.h colorbalance.h navigation.h
glib_enum_define = GST_VIDEO
glib_gen_prefix = gst_video
glib_gen_basename = video
@ -17,6 +17,7 @@ EXTRA_DIST = video-marshal.list
libgstvideo_@GST_API_VERSION@_la_SOURCES = \
colorbalance.c \
colorbalancechannel.c \
navigation.c \
video.c \
gstvideosink.c \
gstvideofilter.c \
@ -32,6 +33,7 @@ libgstvideo_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSI
libgstvideo_@GST_API_VERSION@include_HEADERS = \
colorbalance.h \
colorbalancechannel.h \
navigation.h \
video.h \
gstvideosink.h \
gstvideofilter.h \

View file

@ -63,8 +63,8 @@
#include "config.h"
#endif
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/interfaces-enumtypes.h>
#include <gst/video/navigation.h>
#include <gst/video/video-enumtypes.h>
static void gst_navigation_class_init (GstNavigationInterface * iface);

View file

@ -23,7 +23,6 @@
#define __GST_VIDEO_ORIENTATION_H__
#include <gst/gst.h>
#include <gst/interfaces/interfaces-enumtypes.h>
G_BEGIN_DECLS

View file

@ -140,7 +140,7 @@
* <title>GstVideoOverlay and Gtk+</title>
* <para>
* |[
* #include &lt;gst/interfaces/xoverlay.h&gt;
* #include &lt;gst/video/xoverlay.h&gt;
* #include &lt;gtk/gtk.h&gt;
* #ifdef GDK_WINDOWING_X11
* #include &lt;gdk/gdkx.h&gt; // for GDK_WINDOW_XID
@ -244,7 +244,7 @@
* |[
* #include &lt;glib.h&gt;
* #include &lt;gst/gst.h&gt;
* #include &lt;gst/interfaces/videooverlay.h&gt;
* #include &lt;gst/video/videooverlay.h&gt;
*
* #include &lt;QApplication&gt;
* #include &lt;QTimer&gt;

View file

@ -22,7 +22,6 @@ libgstplayback_la_LIBADD = \
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_LIBS)
libgstplayback_la_LIBTOOLFLAGS = --tag=disable-static

View file

@ -230,7 +230,7 @@
#include <gst/pbutils/pbutils.h>
#include <gst/audio/streamvolume.h>
#include <gst/video/videooverlay.h>
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
#include <gst/video/colorbalance.h>
#include "gstplay-enum.h"
#include "gstplayback.h"

View file

@ -31,7 +31,7 @@
#include <gst/audio/streamvolume.h>
#include <gst/video/colorbalance.h>
#include <gst/video/videooverlay.h>
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
#include "gstplaysink.h"
#include "gststreamsynchronizer.h"

View file

@ -8,7 +8,6 @@ nodist_libgstvolume_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstvolume_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
libgstvolume_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvolume_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_API_VERSION).la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-$(GST_API_VERSION).la \
$(GST_BASE_LIBS) \
$(GST_LIBS) \

View file

@ -45,7 +45,6 @@
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/audio/audio.h>
#include <gst/audio/mixer.h>
#include <gst/audio/gstaudiofilter.h>
#ifdef HAVE_ORC
@ -79,9 +78,6 @@
#define VOLUME_MAX_INT32 G_MAXINT32
#define VOLUME_MIN_INT32 G_MININT32
/* number of steps we use for the mixer interface to go from 0.0 to 1.0 */
# define VOLUME_STEPS 100
#define GST_CAT_DEFAULT gst_volume_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@ -112,12 +108,9 @@ enum
", layout = (string) { interleaved, non-interleaved }"
#endif
static void gst_volume_mixer_init (GstMixerInterface * iface);
#define gst_volume_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE (GstVolume, gst_volume,
GST_TYPE_AUDIO_FILTER,
G_IMPLEMENT_INTERFACE (GST_TYPE_MIXER, gst_volume_mixer_init);
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
static void volume_set_property (GObject * object, guint prop_id,
@ -280,75 +273,6 @@ volume_update_volume (GstVolume * self, const GstAudioInfo * info,
return res;
}
/* Mixer interface */
static const GList *
gst_volume_list_tracks (GstMixer * mixer)
{
GstVolume *self = GST_VOLUME (mixer);
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (GST_IS_VOLUME (self), NULL);
return self->tracklist;
}
static void
gst_volume_set_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstVolume *self = GST_VOLUME (mixer);
g_return_if_fail (self != NULL);
g_return_if_fail (GST_IS_VOLUME (self));
GST_OBJECT_LOCK (self);
self->volume = (gfloat) volumes[0] / VOLUME_STEPS;
GST_OBJECT_UNLOCK (self);
}
static void
gst_volume_get_volume (GstMixer * mixer, GstMixerTrack * track, gint * volumes)
{
GstVolume *self = GST_VOLUME (mixer);
g_return_if_fail (self != NULL);
g_return_if_fail (GST_IS_VOLUME (self));
GST_OBJECT_LOCK (self);
volumes[0] = (gint) self->volume * VOLUME_STEPS;
GST_OBJECT_UNLOCK (self);
}
static void
gst_volume_set_mute (GstMixer * mixer, GstMixerTrack * track, gboolean mute)
{
GstVolume *self = GST_VOLUME (mixer);
g_return_if_fail (self != NULL);
g_return_if_fail (GST_IS_VOLUME (self));
GST_OBJECT_LOCK (self);
self->mute = mute;
GST_OBJECT_UNLOCK (self);
}
static GstMixerType
gst_volume_get_mixer_type (GstMixer * mixer)
{
return GST_MIXER_SOFTWARE;
}
static void
gst_volume_mixer_init (GstMixerInterface * iface)
{
/* default virtual functions */
iface->list_tracks = gst_volume_list_tracks;
iface->set_volume = gst_volume_set_volume;
iface->get_volume = gst_volume_get_volume;
iface->set_mute = gst_volume_set_mute;
iface->get_mixer_type = gst_volume_get_mixer_type;
}
/* Element class */
static void
@ -413,25 +337,12 @@ gst_volume_class_init (GstVolumeClass * klass)
static void
gst_volume_init (GstVolume * self)
{
GstMixerTrack *track = NULL;
self->mute = DEFAULT_PROP_MUTE;;
self->volume = DEFAULT_PROP_VOLUME;
self->tracklist = NULL;
self->negotiated = FALSE;
track = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
if (GST_IS_MIXER_TRACK (track)) {
track->label = g_strdup ("volume");
track->num_channels = 1;
track->min_volume = 0;
track->max_volume = VOLUME_STEPS;
track->flags = GST_MIXER_TRACK_SOFTWARE;
self->tracklist = g_list_append (self->tracklist, track);
}
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (self), TRUE);
}
@ -961,10 +872,6 @@ plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "volume", 0, "Volume gain");
/* ref class from a thread-safe context to work around missing bit of
* thread-safety in GObject */
g_type_class_ref (GST_TYPE_MIXER_TRACK);
return gst_element_register (plugin, "volume", GST_RANK_NONE,
GST_TYPE_VOLUME);
}

View file

@ -3,7 +3,6 @@ pcverfiles = \
gstreamer-audio-@GST_API_VERSION@.pc \
gstreamer-app-@GST_API_VERSION@.pc \
gstreamer-fft-@GST_API_VERSION@.pc \
gstreamer-interfaces-@GST_API_VERSION@.pc \
gstreamer-pbutils-@GST_API_VERSION@.pc \
gstreamer-riff-@GST_API_VERSION@.pc \
gstreamer-rtp-@GST_API_VERSION@.pc \
@ -16,7 +15,6 @@ pcverfiles_uninstalled = \
gstreamer-audio-@GST_API_VERSION@-uninstalled.pc \
gstreamer-app-@GST_API_VERSION@-uninstalled.pc \
gstreamer-fft-@GST_API_VERSION@-uninstalled.pc \
gstreamer-interfaces-@GST_API_VERSION@-uninstalled.pc \
gstreamer-pbutils-@GST_API_VERSION@-uninstalled.pc \
gstreamer-riff-@GST_API_VERSION@-uninstalled.pc \
gstreamer-rtp-@GST_API_VERSION@-uninstalled.pc \
@ -46,7 +44,6 @@ pcinfiles = \
gstreamer-audio.pc.in gstreamer-audio-uninstalled.pc.in \
gstreamer-app.pc.in gstreamer-app-uninstalled.pc.in \
gstreamer-fft.pc.in gstreamer-fft-uninstalled.pc.in \
gstreamer-interfaces.pc.in gstreamer-interfaces-uninstalled.pc.in \
gstreamer-pbutils.pc.in gstreamer-pbutils-uninstalled.pc.in \
gstreamer-riff.pc.in gstreamer-riff-uninstalled.pc.in \
gstreamer-rtp.pc.in gstreamer-rtp-uninstalled.pc.in \

View file

@ -10,7 +10,7 @@ typelibdir=@abs_top_builddir@/gst-libs/gst/audio
Name: GStreamer Audio Library, Uninstalled
Description: Audio helper functions and base classes, uninstalled
Version: @VERSION@
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@ gstreamer-interfaces-@GST_API_VERSION@
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@
Libs: @abs_top_builddir@/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la
Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs

View file

@ -9,7 +9,7 @@ typelibdir=${libdir}/girepository-1.0
Name: GStreamer Audio library
Description: Audio helper functions and base classes
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@ gstreamer-interfaces-@GST_API_VERSION@
Requires: gstreamer-@GST_API_VERSION@ gstreamer-base-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} -lgstaudio-@GST_API_VERSION@
Cflags: -I${includedir}

View file

@ -1,16 +0,0 @@
# the standard variables don't make sense for an uninstalled copy
prefix=
exec_prefix=
libdir=
# includedir is builddir because it is used to find gstconfig.h in places
includedir=@abs_top_builddir@/gst-libs
girdir=@abs_top_builddir@/gst-libs/gst/interfaces
typelibdir=@abs_top_builddir@/gst-libs/gst/interfaces
Name: GStreamer Interfaces Library, Uninstalled
Description: Interfaces for GStreamer elements, uninstalled
Version: @VERSION@
Requires: gstreamer-@GST_API_VERSION@
Libs: @abs_top_builddir@/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la
Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs

View file

@ -1,16 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/gstreamer-@GST_API_VERSION@
datarootdir=${prefix}/share
datadir=${datarootdir}
girdir=${datadir}/gir-1.0
typelibdir=${libdir}/girepository-1.0
Name: GStreamer Interfaces Library
Description: Interfaces for GStreamer elements
Requires: gstreamer-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} -lgstinterfaces-@GST_API_VERSION@
Cflags: -I${includedir}

View file

@ -10,7 +10,7 @@ Name: GStreamer Base Plugins Libraries, Uninstalled
Description: Streaming media framework, base plugins libraries, uninstalled
Version: @VERSION@
Requires: gstreamer-@GST_API_VERSION@
Libs: -L@abs_top_builddir@/gst-libs/gst/audio -L@abs_top_builddir@/gst-libs/gst/fft -L@abs_top_builddir@/gst-libs/gst/interfaces -L@abs_top_builddir@/gst-libs/gst/riff -L@abs_top_builddir@/gst-libs/gst/rtp -L@abs_top_builddir@/gst-libs/gst/rtsp -L@abs_top_builddir@/gst-libs/gst/sdp -L@abs_top_builddir@/gst-libs/gst/tag -L@abs_top_builddir@/gst-libs/gst/pbutils -L@abs_top_builddir@/gst-libs/gst/video -L@abs_top_builddir@/gst-libs/gst/app
Libs: -L@abs_top_builddir@/gst-libs/gst/audio -L@abs_top_builddir@/gst-libs/gst/fft -L@abs_top_builddir@/gst-libs/gst/riff -L@abs_top_builddir@/gst-libs/gst/rtp -L@abs_top_builddir@/gst-libs/gst/rtsp -L@abs_top_builddir@/gst-libs/gst/sdp -L@abs_top_builddir@/gst-libs/gst/tag -L@abs_top_builddir@/gst-libs/gst/pbutils -L@abs_top_builddir@/gst-libs/gst/video -L@abs_top_builddir@/gst-libs/gst/app
Cflags: -I@abs_top_srcdir@/gst-libs -I@abs_top_builddir@/gst-libs
libraries=app audio fft interfaces riff rtp rtsp sdp tag pbutils video
libraries=app audio fft riff rtp rtsp sdp tag pbutils video

View file

@ -11,4 +11,4 @@ Version: @VERSION@
Libs: -L${libdir}
Cflags: -I${includedir}
libraries=audio fft interfaces riff rtp tag pbutils video
libraries=audio fft riff rtp tag pbutils video

View file

@ -3,7 +3,6 @@ plugin_LTLIBRARIES = libgstximagesink.la
libgstximagesink_la_SOURCES = ximagesink.c ximage.c ximagepool.c
libgstximagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
libgstximagesink_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_API_VERSION).la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_BASE_LIBS) \
$(X_LIBS) $(XSHM_LIBS)

View file

@ -104,7 +104,7 @@
#endif
/* Our interfaces */
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
#include <gst/video/videooverlay.h>
#include <gst/video/gstvideometa.h>

View file

@ -3,7 +3,6 @@ plugin_LTLIBRARIES = libgstxvimagesink.la
libgstxvimagesink_la_SOURCES = xvimagesink.c xvimage.c xvimagepool.c
libgstxvimagesink_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS)
libgstxvimagesink_la_LIBADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_API_VERSION).la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_BASE_LIBS) \
$(GST_LIBS) \

View file

@ -118,7 +118,7 @@
#endif
/* Our interfaces */
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
#include <gst/video/videooverlay.h>
#include <gst/video/colorbalance.h>
/* Helper functions */

View file

@ -25,16 +25,10 @@ $(CHECK_REGISTRY):
$(TESTS_ENVIRONMENT)
# elements to ignore for the state tests
STATE_IGNORE_ELEMENTS = cdio cdparanoiasrc libvisual_ alsasrc alsamixer alsasink
STATE_IGNORE_ELEMENTS = cdio cdparanoiasrc libvisual_ alsasrc alsasink
TESTS = $(check_PROGRAMS)
if USE_ALSA
check_alsa = elements/alsa
else
check_alsa =
endif
if USE_LIBVISUAL
check_libvisual = elements/libvisual
else
@ -95,7 +89,6 @@ cxx_checks =
endif
check_PROGRAMS = \
$(check_alsa) \
$(check_ogg) \
$(check_vorbis) \
elements/audioconvert \
@ -110,7 +103,6 @@ check_PROGRAMS = \
libs/audiocdsrc \
libs/discoverer \
libs/fft \
libs/mixer \
libs/navigation \
libs/pbutils \
libs/profile \
@ -186,7 +178,6 @@ libs_libsabi_LDADD = \
$(top_builddir)/gst-libs/gst/app/libgstapp-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/rtp/libgstrtp-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/rtsp/libgstrtsp-@GST_API_VERSION@.la \
@ -202,7 +193,6 @@ libs_audio_CFLAGS = \
libs_audio_LDADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
@ -235,23 +225,13 @@ libs_fft_LDADD = \
$(GST_BASE_LIBS) \
$(LDADD)
libs_mixer_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(AM_CFLAGS)
libs_mixer_LDADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
libs_navigation_CFLAGS = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(AM_CFLAGS)
libs_navigation_LDADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
@ -320,15 +300,6 @@ elements_appsrc_LDADD = \
$(top_builddir)/gst-libs/gst/app/libgstapp-@GST_API_VERSION@.la \
$(LDADD)
elements_alsa_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(AM_CFLAGS)
elements_alsa_LDADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(LDADD)
elements_audioconvert_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) \
@ -336,13 +307,11 @@ elements_audioconvert_CFLAGS = \
elements_audioconvert_LDADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
elements_audiorate_LDADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
elements_audiorate_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
@ -376,7 +345,6 @@ elements_audioresample_CFLAGS = \
elements_audioresample_LDADD = \
$(top_builddir)/gst-libs/gst/fft/libgstfft-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)
@ -468,7 +436,6 @@ pipelines_simple_launch_lines_CFLAGS = \
pipelines_simple_launch_lines_LDADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_BASE_LIBS) \
$(LDADD)

View file

@ -1,139 +0,0 @@
/* GStreamer
*
* unit test for alsa elements
*
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* FIXME 0.11: suppress warnings for deprecated API such as GValueArray
* with newer GLib versions (>= 2.31.0) */
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#include <unistd.h>
#include <gst/check/gstcheck.h>
#include <gst/audio/mixer.h>
#if 0
/* just a simple test that runs device probing on
* an alsasrc, alsasink and alsamixer instance */
GST_START_TEST (test_device_property_probe)
{
const gchar *elements[] = { "alsasink", "alsasrc", "alsamixer" };
gint n;
for (n = 0; n < G_N_ELEMENTS (elements); ++n) {
GstPropertyProbe *probe;
GValueArray *arr;
GstElement *element;
gint i;
element = gst_element_factory_make (elements[n], elements[n]);
fail_unless (element != NULL);
probe = GST_PROPERTY_PROBE (element);
fail_unless (probe != NULL);
arr = gst_property_probe_probe_and_get_values_name (probe, "device");
if (arr) {
for (i = 0; i < arr->n_values; ++i) {
const gchar *device;
GValue *val;
val = g_value_array_get_nth (arr, i);
fail_unless (val != NULL);
fail_unless (G_VALUE_HOLDS_STRING (val));
device = g_value_get_string (val);
fail_unless (device != NULL);
GST_LOG_OBJECT (element, "device[%d] = %s", i, device);
}
g_value_array_free (arr);
} else {
GST_LOG_OBJECT (element, "no devices found");
}
gst_object_unref (element);
}
}
GST_END_TEST;
#endif
GST_START_TEST (test_alsa_mixer_track)
{
GstStateChangeReturn state_ret;
GstElement *mixer;
GList *tracks, *l;
mixer = gst_element_factory_make ("alsamixer", "alsamixer");
fail_unless (mixer != NULL, "Failed to create 'alsamixer' element!");
state_ret = gst_element_set_state (mixer, GST_STATE_READY);
if (state_ret != GST_STATE_CHANGE_SUCCESS) {
gst_object_unref (mixer);
return;
}
GST_LOG ("opened alsamixer");
fail_unless (GST_IS_MIXER (mixer), "is not a GstMixer?!");
tracks = (GList *) gst_mixer_list_tracks (GST_MIXER (mixer));
for (l = tracks; l != NULL; l = l->next) {
GstMixerTrack *track;
gchar *ulabel = NULL, *label = NULL;
track = GST_MIXER_TRACK (l->data);
g_object_get (track, "label", &label, "untranslated-label", &ulabel, NULL);
fail_unless (label == NULL || g_utf8_validate (label, -1, NULL));
if (ulabel != NULL) {
gchar *p;
for (p = ulabel; p != NULL && *p != '\0'; ++p) {
fail_unless (g_ascii_isprint (*p),
"untranslated label '%s' not printable ASCII", ulabel);
}
}
GST_DEBUG ("%s: %s", GST_STR_NULL (ulabel), GST_STR_NULL (label));
g_free (label);
g_free (ulabel);
}
fail_unless_equals_int (gst_element_set_state (mixer, GST_STATE_NULL),
GST_STATE_CHANGE_SUCCESS);
gst_object_unref (mixer);
}
GST_END_TEST;
static Suite *
alsa_suite (void)
{
Suite *s = suite_create ("alsa");
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
/* tcase_add_test (tc_chain, test_device_property_probe); */
tcase_add_test (tc_chain, test_alsa_mixer_track);
return s;
}
GST_CHECK_MAIN (alsa)

View file

@ -38,10 +38,6 @@
#include <gst/audio/gstaudiobasesink.h>
#include <gst/audio/gstaudiobasesrc.h>
#include <gst/audio/gstaudioringbuffer.h>
#include <gst/audio/mixerutils.h>
#include <gst/audio/mixer.h>
#include <gst/audio/mixeroptions.h>
#include <gst/audio/mixertrack.h>
#include <gst/audio/streamvolume.h>
#include <gst/fft/gstfftf32.h>
@ -50,13 +46,6 @@
#include <gst/fft/gstffts16.h>
#include <gst/fft/gstffts32.h>
#include <gst/interfaces/interfaces-enumtypes.h>
#include <gst/interfaces/interfaces-marshal.h>
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/tunerchannel.h>
#include <gst/interfaces/tuner.h>
#include <gst/interfaces/tunernorm.h>
#include <gst/pbutils/codec-utils.h>
#include <gst/pbutils/descriptions.h>
#include <gst/pbutils/encoding-profile.h>
@ -106,6 +95,7 @@
#include <gst/video/colorbalance.h>
#include <gst/video/videoorientation.h>
#include <gst/video/videooverlay.h>
#include <gst/video/navigation.h>
/* we mostly just want to make sure that our library headers don't
* contain anything a C++ compiler might not like */

View file

@ -32,15 +32,12 @@
#include <gst/audio/gstaudiosrc.h>
#include <gst/audio/gstaudiosink.h>
#include <gst/audio/gstaudioringbuffer.h>
#include <gst/audio/mixer.h>
#include <gst/audio/streamvolume.h>
#include <gst/fft/gstfft.h>
#include <gst/fft/gstffts16.h>
#include <gst/fft/gstffts32.h>
#include <gst/fft/gstfftf32.h>
#include <gst/fft/gstfftf64.h>
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/tuner.h>
#include <gst/pbutils/pbutils.h>
#include <gst/riff/riff-media.h>
#include <gst/riff/riff-read.h>
@ -67,6 +64,7 @@
#include <gst/video/colorbalance.h>
#include <gst/video/videoorientation.h>
#include <gst/video/videooverlay.h>
#include <gst/video/navigation.h>
/* initial version of the file was generated using:
* grep -A1 "<STRUCT>" ../../docs/libs/gst-plugins-base-libs-decl.txt | \

View file

@ -1,216 +0,0 @@
/* GStreamer
*
* unit tests for audio support library
*
* Copyright (C) 2007 Jan Schmidt <thaytan@noraisin.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h>
#include <gst/audio/mixer.h>
#include <string.h>
#define TEST_ELEMENT_TYPE (test_element_get_type())
/* FIXME 0.11: possibly remove mixer interface entirely, or simplify, or
* radically change */
typedef struct TestElement TestElement;
typedef struct TestElementClass TestElementClass;
struct TestElement
{
GstElement parent;
};
struct TestElementClass
{
GstElementClass parent_class;
};
GType test_element_get_type (void);
static void init_interface (GType type);
G_DEFINE_TYPE_WITH_CODE (TestElement, test_element, GST_TYPE_ELEMENT,
init_interface (g_define_type_id));
static void
test_element_mixer_interface_init (GstMixerInterface * iface)
{
/* Not actually implementing any interfaces for this test atm */
}
static void
init_interface (GType type)
{
static const GInterfaceInfo mixer_iface_info = {
(GInterfaceInitFunc) test_element_mixer_interface_init,
NULL,
NULL,
};
g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
}
static void
test_element_class_init (TestElementClass * klass)
{
}
static void
test_element_init (TestElement * this)
{
}
GST_START_TEST (test_messages)
{
/* Create an empty GstElement that has a GstMixer interface and then
* send some notifications and validate them */
GstElement *test_element =
(GstElement *) g_object_new (TEST_ELEMENT_TYPE, NULL);
GstBus *bus = gst_bus_new ();
GstMixerTrack *mtrack = g_object_new (GST_TYPE_MIXER_TRACK, NULL);
GstMixerOptions *mopts = g_object_new (GST_TYPE_MIXER_OPTIONS, NULL);
GstMixerTrack *t;
GstMixerOptions *o;
gint vols_in[2] = { 50, 75 };
gboolean mute, record;
gint *vols_out;
gint n_chans, i;
const gchar *val;
GstMessage *message;
mtrack->num_channels = 2;
mtrack->flags = GST_MIXER_TRACK_MUTE | GST_MIXER_TRACK_RECORD;
gst_element_set_bus (test_element, bus);
/* Test mute-toggled */
gst_mixer_mute_toggled (GST_MIXER (test_element), mtrack, TRUE);
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_MUTE_TOGGLED);
/* Test that we can pass NULL args */
gst_mixer_message_parse_mute_toggled (message, NULL, NULL);
/* Test the parsing */
gst_mixer_message_parse_mute_toggled (message, &t, &mute);
fail_unless (t == mtrack);
fail_unless (mute == TRUE);
gst_message_unref (message);
/* Test record-toggled */
gst_mixer_record_toggled (GST_MIXER (test_element), mtrack, TRUE);
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_RECORD_TOGGLED);
gst_mixer_message_parse_record_toggled (message, NULL, NULL);
gst_mixer_message_parse_record_toggled (message, &t, &record);
fail_unless (t == mtrack);
fail_unless (record == TRUE);
gst_message_unref (message);
/* Test volume-changed */
gst_mixer_volume_changed (GST_MIXER (test_element), mtrack, vols_in);
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_VOLUME_CHANGED);
gst_mixer_message_parse_volume_changed (message, NULL, NULL, NULL);
gst_mixer_message_parse_volume_changed (message, NULL, NULL, &n_chans);
fail_unless (n_chans == 2);
gst_mixer_message_parse_volume_changed (message, &t, &vols_out, &n_chans);
fail_unless (mtrack == t);
for (i = 0; i < n_chans; i++)
fail_unless (vols_out[i] == vols_in[i]);
gst_message_unref (message);
g_free (vols_out);
/* Test option-changed */
gst_mixer_option_changed (GST_MIXER (test_element), mopts, "TESTING");
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_OPTION_CHANGED);
gst_mixer_message_parse_option_changed (message, NULL, NULL);
gst_mixer_message_parse_option_changed (message, &o, &val);
fail_unless (o == mopts);
fail_unless (g_str_equal (val, "TESTING"));
gst_message_unref (message);
/* Test options-list-changed */
gst_mixer_options_list_changed (GST_MIXER (test_element), mopts);
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_OPTIONS_LIST_CHANGED);
gst_mixer_message_parse_options_list_changed (message, &o);
fail_unless (o == mopts);
gst_message_unref (message);
/* Test mixer-changed */
gst_mixer_mixer_changed (GST_MIXER (test_element));
message = gst_bus_poll (bus, GST_MESSAGE_ELEMENT, GST_CLOCK_TIME_NONE);
fail_if (message == NULL);
fail_unless (gst_mixer_message_get_type (message) ==
GST_MIXER_MESSAGE_MIXER_CHANGED);
gst_message_unref (message);
gst_object_unref (mtrack);
gst_object_unref (mopts);
gst_object_unref (bus);
gst_object_unref (test_element);
}
GST_END_TEST;
static Suite *
mixer_suite (void)
{
Suite *s = suite_create ("mixer interface");
TCase *tc_chain = tcase_create ("notifications");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_messages);
return s;
}
int
main (int argc, char **argv)
{
int nf;
Suite *s = mixer_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -26,7 +26,7 @@
#include <gst/check/gstcheck.h>
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
#include <string.h>

View file

@ -36,11 +36,6 @@ GstCheckABIStruct list[] = {
{"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16},
{"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4},
{"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8},
{"GstMixerInterface", sizeof (GstMixerInterface), 72},
{"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 100},
{"GstMixerOptions", sizeof (GstMixerOptions), 52},
{"GstMixerTrackClass", sizeof (GstMixerTrackClass), 84},
{"GstMixerTrack", sizeof (GstMixerTrack), 32},
{"GstNavigationInterface", sizeof (GstNavigationInterface), 28},
{"gst_riff_acid", sizeof (gst_riff_acid), 24},
{"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
@ -74,11 +69,6 @@ GstCheckABIStruct list[] = {
{"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 24},
{"GstTagDemuxClass", sizeof (GstTagDemuxClass), 284},
{"GstTagDemux", sizeof (GstTagDemux), 160},
{"GstTunerChannelClass", sizeof (GstTunerChannelClass), 92},
{"GstTunerChannel", sizeof (GstTunerChannel), 40},
{"GstTunerInterface", sizeof (GstTunerInterface), 76},
{"GstTunerNormClass", sizeof (GstTunerNormClass), 84},
{"GstTunerNorm", sizeof (GstTunerNorm), 40},
{"GstVideoFilterClass", sizeof (GstVideoFilterClass), 376},
{"GstVideoFilter", sizeof (GstVideoFilter), 376},
{"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 56},

View file

@ -36,11 +36,6 @@ GstCheckABIStruct list[] = {
{"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16},
{"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4},
{"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8},
{"GstMixerInterface", sizeof (GstMixerInterface), 72},
{"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 100},
{"GstMixerOptions", sizeof (GstMixerOptions), 52},
{"GstMixerTrackClass", sizeof (GstMixerTrackClass), 84},
{"GstMixerTrack", sizeof (GstMixerTrack), 32},
{"GstNavigationInterface", sizeof (GstNavigationInterface), 28},
{"gst_riff_acid", sizeof (gst_riff_acid), 24},
{"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
@ -74,11 +69,6 @@ GstCheckABIStruct list[] = {
{"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 24},
{"GstTagDemuxClass", sizeof (GstTagDemuxClass), 284},
{"GstTagDemux", sizeof (GstTagDemux), 148},
{"GstTunerChannelClass", sizeof (GstTunerChannelClass), 92},
{"GstTunerChannel", sizeof (GstTunerChannel), 40},
{"GstTunerInterface", sizeof (GstTunerInterface), 76},
{"GstTunerNormClass", sizeof (GstTunerNormClass), 84},
{"GstTunerNorm", sizeof (GstTunerNorm), 36},
{"GstVideoFilterClass", sizeof (GstVideoFilterClass), 376},
{"GstVideoFilter", sizeof (GstVideoFilter), 356},
{"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 56},

View file

@ -38,11 +38,6 @@ GstCheckABIStruct list[] = {
{"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16},
{"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4},
{"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8},
{"GstMixerInterface", sizeof (GstMixerInterface), 72},
{"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 100},
{"GstMixerOptions", sizeof (GstMixerOptions), 52},
{"GstMixerTrackClass", sizeof (GstMixerTrackClass), 84},
{"GstMixerTrack", sizeof (GstMixerTrack), 32},
{"GstNavigationInterface", sizeof (GstNavigationInterface), 28},
{"gst_riff_acid", sizeof (gst_riff_acid), 24},
{"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
@ -76,11 +71,6 @@ GstCheckABIStruct list[] = {
{"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 24},
{"GstTagDemuxClass", sizeof (GstTagDemuxClass), 284},
{"GstTagDemux", sizeof (GstTagDemux), 148},
{"GstTunerChannelClass", sizeof (GstTunerChannelClass), 92},
{"GstTunerChannel", sizeof (GstTunerChannel), 40},
{"GstTunerInterface", sizeof (GstTunerInterface), 76},
{"GstTunerNormClass", sizeof (GstTunerNormClass), 84},
{"GstTunerNorm", sizeof (GstTunerNorm), 36},
{"GstVideoFilterClass", sizeof (GstVideoFilterClass), 376},
{"GstVideoFilter", sizeof (GstVideoFilter), 356},
{"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 56},

View file

@ -36,11 +36,6 @@ GstCheckABIStruct list[] = {
{"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16},
{"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4},
{"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8},
{"GstMixerInterface", sizeof (GstMixerInterface), 88},
{"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 208},
{"GstMixerOptions", sizeof (GstMixerOptions), 120},
{"GstMixerTrackClass", sizeof (GstMixerTrackClass), 168},
{"GstMixerTrack", sizeof (GstMixerTrack), 80},
{"GstNavigationInterface", sizeof (GstNavigationInterface), 24},
{"gst_riff_acid", sizeof (gst_riff_acid), 24},
{"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
@ -74,11 +69,6 @@ GstCheckABIStruct list[] = {
{"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 16},
{"GstTagDemuxClass", sizeof (GstTagDemuxClass), 552},
{"GstTagDemux", sizeof (GstTagDemux), 304},
{"GstTunerChannelClass", sizeof (GstTunerChannelClass), 184},
{"GstTunerChannel", sizeof (GstTunerChannel), 96},
{"GstTunerInterface", sizeof (GstTunerInterface), 120},
{"GstTunerNormClass", sizeof (GstTunerNormClass), 168},
{"GstTunerNorm", sizeof (GstTunerNorm), 88},
{"GstVideoFilterClass", sizeof (GstVideoFilterClass), 872},
{"GstVideoFilter", sizeof (GstVideoFilter), 864},
{"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 80},

View file

@ -1,7 +1,6 @@
noinst_PROGRAMS = playback-test
LDADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
$(GST_LIBS) $(GTK_LIBS) $(LIBM)

View file

@ -49,7 +49,7 @@
#include <gst/video/videooverlay.h>
#include <gst/video/colorbalance.h>
#include <gst/interfaces/navigation.h>
#include <gst/video/navigation.h>
GST_DEBUG_CATEGORY_STATIC (playback_debug);
#define GST_CAT_DEFAULT (playback_debug)

View file

@ -12,7 +12,6 @@ noinst_PROGRAMS = $(examples)
LDADD = \
$(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_API_VERSION@.la \
$(GST_LIBS) $(GTK_LIBS) $(LIBM)
AM_CFLAGS = -I$(top_builddir)/gst-libs $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(GTK_CFLAGS)

View file

@ -18,7 +18,6 @@ test_colorkey_SOURCES = test-colorkey.c
test_colorkey_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
$(GST_BASE_CFLAGS) $(GST_CFLAGS) $(X_CFLAGS) $(GTK_CFLAGS)
test_colorkey_LDADD = \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-$(GST_API_VERSION).la \
$(top_builddir)/gst-libs/gst/video/libgstvideo-$(GST_API_VERSION).la \
$(GST_LIBS) $(X_LIBS) $(LIBM) $(GTK_LIBS)

View file

@ -1,134 +0,0 @@
#include "interfaces-enumtypes.h"
#include "navigation.h"
#include "tuner.h"
#include "tunernorm.h"
#include "tunerchannel.h"
/* enumerations from "navigation.h" */
GType
gst_navigation_command_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{GST_NAVIGATION_COMMAND_INVALID, "GST_NAVIGATION_COMMAND_INVALID",
"invalid"},
{GST_NAVIGATION_COMMAND_MENU1, "GST_NAVIGATION_COMMAND_MENU1", "menu1"},
{GST_NAVIGATION_COMMAND_MENU2, "GST_NAVIGATION_COMMAND_MENU2", "menu2"},
{GST_NAVIGATION_COMMAND_MENU3, "GST_NAVIGATION_COMMAND_MENU3", "menu3"},
{GST_NAVIGATION_COMMAND_MENU4, "GST_NAVIGATION_COMMAND_MENU4", "menu4"},
{GST_NAVIGATION_COMMAND_MENU5, "GST_NAVIGATION_COMMAND_MENU5", "menu5"},
{GST_NAVIGATION_COMMAND_MENU6, "GST_NAVIGATION_COMMAND_MENU6", "menu6"},
{GST_NAVIGATION_COMMAND_MENU7, "GST_NAVIGATION_COMMAND_MENU7", "menu7"},
{GST_NAVIGATION_COMMAND_LEFT, "GST_NAVIGATION_COMMAND_LEFT", "left"},
{GST_NAVIGATION_COMMAND_RIGHT, "GST_NAVIGATION_COMMAND_RIGHT", "right"},
{GST_NAVIGATION_COMMAND_UP, "GST_NAVIGATION_COMMAND_UP", "up"},
{GST_NAVIGATION_COMMAND_DOWN, "GST_NAVIGATION_COMMAND_DOWN", "down"},
{GST_NAVIGATION_COMMAND_ACTIVATE, "GST_NAVIGATION_COMMAND_ACTIVATE",
"activate"},
{GST_NAVIGATION_COMMAND_PREV_ANGLE, "GST_NAVIGATION_COMMAND_PREV_ANGLE",
"prev-angle"},
{GST_NAVIGATION_COMMAND_NEXT_ANGLE, "GST_NAVIGATION_COMMAND_NEXT_ANGLE",
"next-angle"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_enum_register_static ("GstNavigationCommand", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
gst_navigation_query_type_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{GST_NAVIGATION_QUERY_INVALID, "GST_NAVIGATION_QUERY_INVALID", "invalid"},
{GST_NAVIGATION_QUERY_COMMANDS, "GST_NAVIGATION_QUERY_COMMANDS",
"commands"},
{GST_NAVIGATION_QUERY_ANGLES, "GST_NAVIGATION_QUERY_ANGLES", "angles"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_enum_register_static ("GstNavigationQueryType", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
gst_navigation_message_type_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{GST_NAVIGATION_MESSAGE_INVALID, "GST_NAVIGATION_MESSAGE_INVALID",
"invalid"},
{GST_NAVIGATION_MESSAGE_MOUSE_OVER, "GST_NAVIGATION_MESSAGE_MOUSE_OVER",
"mouse-over"},
{GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
"GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED", "commands-changed"},
{GST_NAVIGATION_MESSAGE_ANGLES_CHANGED,
"GST_NAVIGATION_MESSAGE_ANGLES_CHANGED", "angles-changed"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_enum_register_static ("GstNavigationMessageType", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
GType
gst_navigation_event_type_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GEnumValue values[] = {
{GST_NAVIGATION_EVENT_INVALID, "GST_NAVIGATION_EVENT_INVALID", "invalid"},
{GST_NAVIGATION_EVENT_KEY_PRESS, "GST_NAVIGATION_EVENT_KEY_PRESS",
"key-press"},
{GST_NAVIGATION_EVENT_KEY_RELEASE, "GST_NAVIGATION_EVENT_KEY_RELEASE",
"key-release"},
{GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS,
"GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS", "mouse-button-press"},
{GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE,
"GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE",
"mouse-button-release"},
{GST_NAVIGATION_EVENT_MOUSE_MOVE, "GST_NAVIGATION_EVENT_MOUSE_MOVE",
"mouse-move"},
{GST_NAVIGATION_EVENT_COMMAND, "GST_NAVIGATION_EVENT_COMMAND", "command"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_enum_register_static ("GstNavigationEventType", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}
/* enumerations from "tunerchannel.h" */
GType
gst_tuner_channel_flags_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
if (g_once_init_enter (&g_define_type_id__volatile)) {
static const GFlagsValue values[] = {
{GST_TUNER_CHANNEL_INPUT, "GST_TUNER_CHANNEL_INPUT", "input"},
{GST_TUNER_CHANNEL_OUTPUT, "GST_TUNER_CHANNEL_OUTPUT", "output"},
{GST_TUNER_CHANNEL_FREQUENCY, "GST_TUNER_CHANNEL_FREQUENCY", "frequency"},
{GST_TUNER_CHANNEL_AUDIO, "GST_TUNER_CHANNEL_AUDIO", "audio"},
{0, NULL, NULL}
};
GType g_define_type_id =
g_flags_register_static ("GstTunerChannelFlags", values);
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
}
return g_define_type_id__volatile;
}

View file

@ -1,29 +0,0 @@
#ifndef __GST_INTERFACES_ENUM_TYPES_H__
#define __GST_INTERFACES_ENUM_TYPES_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* enumerations from "navigation.h" */
GType gst_navigation_command_get_type (void);
#define GST_TYPE_NAVIGATION_COMMAND (gst_navigation_command_get_type())
GType gst_navigation_query_type_get_type (void);
#define GST_TYPE_NAVIGATION_QUERY_TYPE (gst_navigation_query_type_get_type())
GType gst_navigation_message_type_get_type (void);
#define GST_TYPE_NAVIGATION_MESSAGE_TYPE (gst_navigation_message_type_get_type())
GType gst_navigation_event_type_get_type (void);
#define GST_TYPE_NAVIGATION_EVENT_TYPE (gst_navigation_event_type_get_type())
/* enumerations from "tunerchannel.h" */
GType gst_tuner_channel_flags_get_type (void);
#define GST_TYPE_TUNER_CHANNEL_FLAGS (gst_tuner_channel_flags_get_type())
G_END_DECLS
#endif /* __GST_INTERFACES_ENUM_TYPES_H__ */

View file

@ -61,7 +61,6 @@ EXPORTS
gst_audio_decoder_set_plc
gst_audio_decoder_set_plc_aware
gst_audio_decoder_set_tolerance
gst_audio_default_registry_mixer_filter
gst_audio_downmix_meta_api_get_type
gst_audio_downmix_meta_get_info
gst_audio_encoder_finish_frame
@ -155,31 +154,6 @@ EXPORTS
gst_audio_src_get_type
gst_buffer_add_audio_downmix_meta
gst_buffer_get_audio_downmix_meta_for_channels
gst_mixer_get_mixer_flags
gst_mixer_get_mixer_type
gst_mixer_get_option
gst_mixer_get_type
gst_mixer_get_volume
gst_mixer_list_tracks
gst_mixer_message_get_type
gst_mixer_message_parse_mute_toggled
gst_mixer_message_parse_option_changed
gst_mixer_message_parse_options_list_changed
gst_mixer_message_parse_record_toggled
gst_mixer_message_parse_volume_changed
gst_mixer_mixer_changed
gst_mixer_mute_toggled
gst_mixer_option_changed
gst_mixer_options_get_type
gst_mixer_options_get_values
gst_mixer_options_list_changed
gst_mixer_record_toggled
gst_mixer_set_mute
gst_mixer_set_option
gst_mixer_set_record
gst_mixer_set_volume
gst_mixer_track_get_type
gst_mixer_volume_changed
gst_stream_volume_convert_volume
gst_stream_volume_get_mute
gst_stream_volume_get_type

View file

@ -1,51 +0,0 @@
EXPORTS
gst_interfaces_marshal_VOID__OBJECT_INT
gst_interfaces_marshal_VOID__OBJECT_ULONG
gst_navigation_command_get_type
gst_navigation_event_get_type
gst_navigation_event_parse_command
gst_navigation_event_parse_key_event
gst_navigation_event_parse_mouse_button_event
gst_navigation_event_parse_mouse_move_event
gst_navigation_event_type_get_type
gst_navigation_get_type
gst_navigation_message_get_type
gst_navigation_message_new_angles_changed
gst_navigation_message_new_commands_changed
gst_navigation_message_new_mouse_over
gst_navigation_message_parse_angles_changed
gst_navigation_message_parse_mouse_over
gst_navigation_message_type_get_type
gst_navigation_query_get_type
gst_navigation_query_new_angles
gst_navigation_query_new_commands
gst_navigation_query_parse_angles
gst_navigation_query_parse_commands_length
gst_navigation_query_parse_commands_nth
gst_navigation_query_set_angles
gst_navigation_query_set_commands
gst_navigation_query_set_commandsv
gst_navigation_query_type_get_type
gst_navigation_send_command
gst_navigation_send_event
gst_navigation_send_key_event
gst_navigation_send_mouse_event
gst_tuner_channel_changed
gst_tuner_channel_flags_get_type
gst_tuner_channel_get_type
gst_tuner_find_channel_by_name
gst_tuner_find_norm_by_name
gst_tuner_frequency_changed
gst_tuner_get_channel
gst_tuner_get_frequency
gst_tuner_get_norm
gst_tuner_get_type
gst_tuner_list_channels
gst_tuner_list_norms
gst_tuner_norm_changed
gst_tuner_norm_get_type
gst_tuner_set_channel
gst_tuner_set_frequency
gst_tuner_set_norm
gst_tuner_signal_changed
gst_tuner_signal_strength

View file

@ -13,6 +13,35 @@ EXPORTS
gst_color_balance_type_get_type
gst_color_balance_value_changed
gst_is_video_overlay_prepare_window_handle_message
gst_navigation_command_get_type
gst_navigation_event_get_type
gst_navigation_event_parse_command
gst_navigation_event_parse_key_event
gst_navigation_event_parse_mouse_button_event
gst_navigation_event_parse_mouse_move_event
gst_navigation_event_type_get_type
gst_navigation_get_type
gst_navigation_message_get_type
gst_navigation_message_new_angles_changed
gst_navigation_message_new_commands_changed
gst_navigation_message_new_mouse_over
gst_navigation_message_parse_angles_changed
gst_navigation_message_parse_mouse_over
gst_navigation_message_type_get_type
gst_navigation_query_get_type
gst_navigation_query_new_angles
gst_navigation_query_new_commands
gst_navigation_query_parse_angles
gst_navigation_query_parse_commands_length
gst_navigation_query_parse_commands_nth
gst_navigation_query_set_angles
gst_navigation_query_set_commands
gst_navigation_query_set_commandsv
gst_navigation_query_type_get_type
gst_navigation_send_command
gst_navigation_send_event
gst_navigation_send_key_event
gst_navigation_send_mouse_event
gst_video_alignment_reset
gst_video_buffer_flags_get_type
gst_video_buffer_pool_get_type