Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
GNOME
Files
Commits
469047a2
Commit
469047a2
authored
Nov 30, 2007
by
Alexander Larsson
Browse files
Merge gio-branch
svn path=/trunk/; revision=13464
parent
ce669bd1
Changes
172
Expand all
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
469047a2
This diff is collapsed.
Click to expand it.
NEWS
View file @
469047a2
...
...
@@ -419,7 +419,7 @@ Major changes in 2.9.90 are:
* Better icons for burn: & computer: in the ui
* Allow eject of unmounted devices
* Better handling of DnD from mozilla
* Make connect to server dialog avail
i
ble as separate app
* Make connect to server dialog avail
a
ble as separate app
* Use GtkAboutDialog
Major changes in 2.9.2 are:
...
...
TODO-gio
0 → 100644
View file @
469047a2
Monitor for UNMOUNT file change event and close window
Break out file activation from fm-directory-view.c
File actication cancellation not implemented yet
convert delete to use trash_or_delete code
recursive deletes
progress for trash/delete
Automount location when loading it in a window and its not mounted.
"translate" gnome-vfs errors and update error handling
fm-directory-view.c: pre_copy_move stuff leaks as it waits for uris that are not in the target directory.
configure.in
View file @
469047a2
...
...
@@ -2,7 +2,6 @@ AC_PREREQ(2.54)
dnl ===========================================================================
m4_define(art_minver, 2.3.10)
m4_define(bonobo_activation_minver, 2.1.0)
m4_define(bonobo_minver, 2.1.0)
m4_define(eel_minver, 2.15.91)
...
...
@@ -22,6 +21,7 @@ m4_define(exif_minver, 0.5.12)
m4_define(beagle_minver, 0.0.12)
m4_define(tracker_minver, 0.0.1)
m4_define(exempi_minver, 1.99.2)
m4_define(exempi_minver_newapi, 1.99.5)
dnl 1. If the library code has changed at all since last release, then increment revision.
dnl 2. If any interfaces have been added, then increment current and set revision to 0.
...
...
@@ -29,7 +29,7 @@ dnl Interface break is not allowed.
m4_define(nautilus_extension_current, 2)
m4_define(nautilus_extension_revision, 0)
AC_INIT(nautilus, 2.2
0
.1
,
AC_INIT(nautilus, 2.2
1
.1
[http://bugzilla.gnome.org/enter_bug.cgi?product=nautilus])
dnl ===========================================================================
...
...
@@ -41,7 +41,6 @@ AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"])
AC_SUBST(ART_REQUIRED, [art_minver])
AC_SUBST(BONOBO_ACTIVATION_REQUIRED, [bonobo_activation_minver])
AC_SUBST(BONOBO_REQUIRED, [bonobo_minver])
AC_SUBST(EEL_REQUIRED, [eel_minver])
...
...
@@ -97,10 +96,10 @@ PKG_CHECK_MODULES(ALL, [
gnome-desktop-2.0 >= gnome_desktop_minver
gnome-vfs-2.0 >= gnome_vfs_minver
gnome-vfs-module-2.0 >= gnome_vfs_minver
gio-2.0
ORBit-2.0 >= orbit_minver
pango >= pango_minver
gtk+-2.0 >= gtk_minver
libart-2.0 >= art_minver
libbonobo-2.0 >= bonobo_minver
libgnome-2.0 >= gnome_minver
libgnomeui-2.0 >= gnome_ui_minver
...
...
@@ -266,6 +265,9 @@ PKG_CHECK_MODULES(EXEMPI, exempi-2.0 >= exempi_minver, [
AC_DEFINE(HAVE_EXEMPI, 1, [Define to enable XMP support])
], [AM_CONDITIONAL(HAVE_EXEMPI, false)])
PKG_CHECK_MODULES(EXEMPI_NEW_API, exempi-2.0 >= exempi_minver_newapi,
AC_DEFINE(HAVE_EXEMPI_NEW_API, 1, [Define if we have exempi with the new API]), true)
AC_SUBST(EXEMPI_CFLAGS)
AC_SUBST(EXEMPI_LIBS)
...
...
@@ -404,7 +406,7 @@ LIBNAUTILUS_EXTENSION_LIBS="`$PKG_CONFIG --libs $LIBNAUTILUS_EXTENSION_MODULES`"
AC_SUBST(LIBNAUTILUS_EXTENSION_LIBS)
dnl core nautilus (must list bonobo-activation and libbonobo because idldir does not respect "requires")
CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 esound gnome-desktop-2.0 gnome-vfs-module-2.0 $EXTRA_CORE_MODULES"
CORE_MODULES="eel-2.0 librsvg-2.0 bonobo-activation-2.0 libbonobo-2.0 esound gnome-desktop-2.0 gnome-vfs-module-2.0
gio-2.0
$EXTRA_CORE_MODULES"
CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $x_cflags $WARNING_CFLAGS"
AC_SUBST(CORE_CFLAGS)
CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $x_libs"
...
...
docs/key_mouse_navigation.txt
View file @
469047a2
...
...
@@ -88,7 +88,7 @@ Control can be held down while starting a drag
While doing a drag modifers affect the operation the drag causes:
Control - Copy the files
Shift - Move the files
Alt - Open a menu with the avail
i
ble alternatives
Alt - Open a menu with the avail
a
ble alternatives
All the basic clicks are typically done with the left button, but can
be done with the other buttons to. [Do we want this?] However some of
...
...
libnautilus-extension/nautilus-file-info.c
View file @
469047a2
...
...
@@ -165,21 +165,12 @@ nautilus_file_info_is_directory (NautilusFileInfo *file)
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
is_directory
(
file
);
}
GnomeVFSFileInfo
*
nautilus_file_info_get_vfs_file_info
(
NautilusFileInfo
*
file
)
{
g_return_val_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
),
NULL
);
g_return_val_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_vfs_file_info
!=
NULL
,
NULL
);
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_vfs_file_info
(
file
);
}
void
nautilus_file_info_add_emblem
(
NautilusFileInfo
*
file
,
const
char
*
emblem_name
)
{
g_return_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
));
g_return_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_vfs_file_info
!=
NULL
);
g_return_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
add_emblem
!=
NULL
);
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
add_emblem
(
file
,
emblem_name
);
}
...
...
@@ -218,39 +209,3 @@ nautilus_file_info_invalidate_extension_info (NautilusFileInfo *file)
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
invalidate_extension_info
(
file
);
}
gboolean
nautilus_file_info_has_volume
(
NautilusFileInfo
*
file
)
{
g_return_val_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
),
FALSE
);
g_return_val_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
has_volume
!=
NULL
,
FALSE
);
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
has_volume
(
file
);
}
gboolean
nautilus_file_info_has_drive
(
NautilusFileInfo
*
file
)
{
g_return_val_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
),
FALSE
);
g_return_val_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
has_drive
!=
NULL
,
FALSE
);
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
has_drive
(
file
);
}
GnomeVFSVolume
*
nautilus_file_info_get_volume
(
NautilusFileInfo
*
file
)
{
g_return_val_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
),
NULL
);
g_return_val_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_volume
!=
NULL
,
NULL
);
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_volume
(
file
);
}
GnomeVFSDrive
*
nautilus_file_info_get_drive
(
NautilusFileInfo
*
file
)
{
g_return_val_if_fail
(
NAUTILUS_IS_FILE_INFO
(
file
),
NULL
);
g_return_val_if_fail
(
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_drive
!=
NULL
,
NULL
);
return
NAUTILUS_FILE_INFO_GET_IFACE
(
file
)
->
get_drive
(
file
);
}
libnautilus-extension/nautilus-file-info.h
View file @
469047a2
...
...
@@ -27,8 +27,6 @@
#define NAUTILUS_FILE_INFO_H
#include
<glib-object.h>
#include
<libgnomevfs/gnome-vfs-file-info.h>
#include
<libgnomevfs/gnome-vfs-volume.h>
G_BEGIN_DECLS
...
...
@@ -65,8 +63,6 @@ struct _NautilusFileInfoIface
const
char
*
mime_Type
);
gboolean
(
*
is_directory
)
(
NautilusFileInfo
*
file
);
GnomeVFSFileInfo
*
(
*
get_vfs_file_info
)
(
NautilusFileInfo
*
file
);
void
(
*
add_emblem
)
(
NautilusFileInfo
*
file
,
const
char
*
emblem_name
);
char
*
(
*
get_string_attribute
)
(
NautilusFileInfo
*
file
,
...
...
@@ -76,11 +72,6 @@ struct _NautilusFileInfoIface
const
char
*
value
);
void
(
*
invalidate_extension_info
)
(
NautilusFileInfo
*
file
);
gboolean
(
*
has_volume
)
(
NautilusFileInfo
*
file
);
gboolean
(
*
has_drive
)
(
NautilusFileInfo
*
file
);
GnomeVFSVolume
*
(
*
get_volume
)
(
NautilusFileInfo
*
file
);
GnomeVFSDrive
*
(
*
get_drive
)
(
NautilusFileInfo
*
file
);
char
*
(
*
get_activation_uri
)
(
NautilusFileInfo
*
file
);
};
...
...
@@ -105,12 +96,6 @@ gboolean nautilus_file_info_is_mime_type (NautilusFileInfo *fil
gboolean
nautilus_file_info_is_directory
(
NautilusFileInfo
*
file
);
/* Other File Info */
GnomeVFSFileInfo
*
nautilus_file_info_get_vfs_file_info
(
NautilusFileInfo
*
file
);
/* Modifying the NautilusFileInfo */
void
nautilus_file_info_add_emblem
(
NautilusFileInfo
*
file
,
const
char
*
emblem_name
);
...
...
@@ -123,11 +108,6 @@ void nautilus_file_info_add_string_attribute (NautilusFileInfo *fil
/* Invalidating file info */
void
nautilus_file_info_invalidate_extension_info
(
NautilusFileInfo
*
file
);
/* Volumes and Drives */
gboolean
nautilus_file_info_has_volume
(
NautilusFileInfo
*
file
);
gboolean
nautilus_file_info_has_drive
(
NautilusFileInfo
*
file
);
GnomeVFSVolume
*
nautilus_file_info_get_volume
(
NautilusFileInfo
*
file
);
GnomeVFSDrive
*
nautilus_file_info_get_drive
(
NautilusFileInfo
*
file
);
G_END_DECLS
...
...
libnautilus-private/Makefile.am
View file @
469047a2
...
...
@@ -13,7 +13,7 @@ INCLUDES = \
-DDATADIR
=
\"
"
$(datadir)
"
\"
\
-DSYSCONFDIR
=
\"
"
$(sysconfdir)
"
\"
\
-DNAUTILUS_DATADIR
=
\"
"
$(datadir)
/nautilus"
\"
\
-DNAUTILUS_EXTENSIONDIR
=
\"
"
$(libdir)
/nautilus/extensions-
1
.0"
\"
\
-DNAUTILUS_EXTENSIONDIR
=
\"
"
$(libdir)
/nautilus/extensions-
2
.0"
\"
\
$(NULL)
dependency_static_libs
=
\
...
...
@@ -49,8 +49,6 @@ marshal_sources = \
libnautilus_private_la_SOURCES
=
\
$(nautilus_metafile_server_idl_sources)
\
nautilus-audio-player.c
\
nautilus-audio-player.h
\
nautilus-bookmark.c
\
nautilus-bookmark.h
\
nautilus-cell-renderer-pixbuf-emblem.c
\
...
...
@@ -125,10 +123,9 @@ libnautilus_private_la_SOURCES = \
nautilus-icon-container.h
\
nautilus-icon-dnd.c
\
nautilus-icon-dnd.h
\
nautilus-icon-factory-private.h
\
nautilus-icon-factory.c
\
nautilus-icon-factory.h
\
nautilus-icon-private.h
\
nautilus-icon-info.c
\
nautilus-icon-info.h
\
nautilus-idle-queue.c
\
nautilus-idle-queue.h
\
nautilus-iso9660.h
\
...
...
@@ -136,8 +133,6 @@ libnautilus_private_la_SOURCES = \
nautilus-keep-last-vertical-box.h
\
nautilus-lib-self-check-functions.c
\
nautilus-lib-self-check-functions.h
\
nautilus-link-desktop-file.c
\
nautilus-link-desktop-file.h
\
nautilus-link.c
\
nautilus-link.h
\
nautilus-marshal.c
\
...
...
@@ -151,10 +146,16 @@ libnautilus_private_la_SOURCES = \
nautilus-metafile.h
\
nautilus-mime-actions.c
\
nautilus-mime-actions.h
\
nautilus-mime-application-chooser.c
\
nautilus-mime-application-chooser.h
\
nautilus-module.c
\
nautilus-module.h
\
nautilus-monitor.c
\
nautilus-monitor.h
\
nautilus-open-with-dialog.c
\
nautilus-open-with-dialog.h
\
nautilus-progress-info.c
\
nautilus-progress-info.h
\
nautilus-program-choosing.c
\
nautilus-program-choosing.h
\
nautilus-recent.c
\
...
...
@@ -179,10 +180,6 @@ libnautilus_private_la_SOURCES = \
nautilus-query.h
\
nautilus-thumbnails.c
\
nautilus-thumbnails.h
\
nautilus-trash-directory.c
\
nautilus-trash-directory.h
\
nautilus-trash-file.c
\
nautilus-trash-file.h
\
nautilus-trash-monitor.c
\
nautilus-trash-monitor.h
\
nautilus-tree-view-drag-dest.c
\
...
...
libnautilus-private/nautilus-audio-player.c
deleted
100644 → 0
View file @
ce669bd1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* nautilus-audio-player.c - Simple threaded audio file playback.
Copyright (C) 2001 Eazel, Inc.
The Gnome 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.
The Gnome 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 the Gnome Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Authors: Gene Z. Ragan <gzr@eazel.com>
*/
#include
<config.h>
#include
"nautilus-audio-player.h"
#include
<esd.h>
#include
<glib/gmem.h>
#include
<glib/gstrfuncs.h>
#include
<stdlib.h>
#include
<string.h>
#include
<unistd.h>
/* BUFFER_FRAMES represents the size of the buffer in frames. */
#define BUFFER_FRAMES 4096
#define PLAYER_STREAM_NAME "nautilus-audio-player"
typedef
enum
{
FORMAT_U8
,
FORMAT_S8
,
FORMAT_U16_LE
,
FORMAT_U16_BE
,
FORMAT_U16_NE
,
FORMAT_S16_LE
,
FORMAT_S16_BE
,
FORMAT_S16_NE
}
AudioFormat
;
typedef
struct
{
pthread_t
buffer_thread
;
gint
fd
;
gpointer
buffer
;
gboolean
going
,
prebuffer
,
paused
;
gint
buffer_size
,
prebuffer_size
,
block_size
;
gint
rd_index
,
wr_index
;
gint
output_time_offset
;
guint64
written
,
output_bytes
;
gint
bps
,
ebps
;
gint
flush
;
gint
channels
,
frequency
,
latency
;
AudioFormat
format
;
esd_format_t
esd_format
;
gint
input_bps
,
input_format
,
input_frequency
,
input_channels
;
char
*
hostname
;
ESDConfig
esd_config
;
void
*
(
*
esd_translate
)(
void
*
,
gint
);
}
ESDInfo
;
static
gboolean
esdout_open
(
ESDInfo
*
info
,
AudioFormat
format
,
gint
rate
,
gint
nch
);
static
void
esdout_close
(
ESDInfo
*
info
);
static
void
esdout_set_audio_params
(
ESDInfo
*
info
);
static
void
esdout_write
(
ESDInfo
*
info
,
gpointer
data
,
int
length
);
static
int
esdout_used
(
ESDInfo
*
info
);
static
gboolean
esdout_playing
(
ESDInfo
*
info
);
static
void
*
player_thread
(
void
*
arg
)
{
NautilusAudioPlayerData
*
data
;
AFframecount
frames_read
;
int
sample_format
,
frame_size
,
channel_count
,
sample_width
;
double
rate
;
void
*
buffer
;
ESDInfo
info
;
data
=
arg
;
if
(
data
==
NULL
)
{
pthread_exit
(
NULL
);
return
(
void
*
)
0
;
}
/* Read information from file */
afGetSampleFormat
(
data
->
handle
,
AF_DEFAULT_TRACK
,
&
sample_format
,
&
sample_width
);
frame_size
=
afGetFrameSize
(
data
->
handle
,
AF_DEFAULT_TRACK
,
1
);
channel_count
=
afGetChannels
(
data
->
handle
,
AF_DEFAULT_TRACK
);
rate
=
afGetRate
(
data
->
handle
,
AF_DEFAULT_TRACK
);
/* Attempt to open ESD */
if
(
!
esdout_open
(
&
info
,
sample_width
==
16
?
FORMAT_S16_NE
:
FORMAT_U8
,
(
int
)
rate
,
channel_count
))
{
pthread_exit
(
NULL
);
return
(
void
*
)
0
;
}
/* Read audio data from file and send it to the esd output thread */
buffer
=
malloc
(
BUFFER_FRAMES
*
frame_size
);
frames_read
=
afReadFrames
(
data
->
handle
,
AF_DEFAULT_TRACK
,
buffer
,
BUFFER_FRAMES
);
while
(
frames_read
>
0
&&
data
->
running
)
{
esdout_write
(
&
info
,
buffer
,
frames_read
*
frame_size
);
frames_read
=
afReadFrames
(
data
->
handle
,
AF_DEFAULT_TRACK
,
buffer
,
BUFFER_FRAMES
);
}
afCloseFile
(
data
->
handle
);
/* Now wait for the esd output thread to complete it task */
while
(
esdout_playing
(
&
info
)
&&
data
->
running
)
{
usleep
(
20000
);
}
/* Shutdown esd output thread */
esdout_close
(
&
info
);
g_free
(
buffer
);
pthread_exit
(
NULL
);
return
(
void
*
)
0
;
}
NautilusAudioPlayerData
*
nautilus_audio_player_play
(
const
char
*
filename
)
{
AFfilehandle
handle
;
NautilusAudioPlayerData
*
data
;
handle
=
afOpenFile
(
filename
,
"r"
,
NULL
);
if
(
handle
==
AF_NULL_FILEHANDLE
)
{
return
NULL
;
}
data
=
g_new0
(
NautilusAudioPlayerData
,
1
);
data
->
handle
=
handle
;
data
->
running
=
TRUE
;
pthread_create
(
&
data
->
player_id
,
NULL
,
player_thread
,
data
);
return
data
;
}
void
nautilus_audio_player_stop
(
NautilusAudioPlayerData
*
data
)
{
if
(
data
==
NULL
)
{
return
;
}
data
->
running
=
FALSE
;
pthread_join
(
data
->
player_id
,
NULL
);
}
static
void
esdout_init
(
ESDInfo
*
info
)
{
memset
(
&
info
->
esd_config
,
0
,
sizeof
(
ESDConfig
));
info
->
fd
=
0
;
info
->
going
=
FALSE
;
info
->
paused
=
FALSE
;
info
->
buffer
=
NULL
;
info
->
block_size
=
BUFFER_FRAMES
;
info
->
rd_index
=
0
;
info
->
wr_index
=
0
;
info
->
output_time_offset
=
0
;
info
->
written
=
0
;
info
->
output_bytes
=
0
;
info
->
hostname
=
NULL
;
info
->
esd_config
.
port
=
ESD_DEFAULT_PORT
;
info
->
esd_config
.
buffer_size
=
3000
;
info
->
esd_config
.
prebuffer
=
25
;
}
static
void
esdout_write
(
ESDInfo
*
info
,
gpointer
data
,
int
length
)
{
int
count
,
offset
;
offset
=
0
;
info
->
written
+=
length
;
while
(
length
>
0
)
{
count
=
MIN
(
length
,
info
->
buffer_size
-
info
->
wr_index
);
memcpy
((
char
*
)
info
->
buffer
+
info
->
wr_index
,
(
char
*
)
data
+
offset
,
count
);
info
->
wr_index
=
(
info
->
wr_index
+
count
)
%
info
->
buffer_size
;
length
-=
count
;
offset
+=
count
;
}
}
static
gint
get_latency
(
ESDInfo
*
config
)
{
int
fd
,
amount
=
0
;
#ifndef HAVE_ESD_GET_LATENCY
esd_server_info_t
*
info
;
#endif
fd
=
esd_open_sound
(
config
->
hostname
);
if
(
fd
==
-
1
)
{
return
0
;
}
#ifdef HAVE_ESD_GET_LATENCY
amount
=
get_latency
(
fd
);
#else
info
=
esd_get_server_info
(
fd
);
if
(
info
!=
NULL
)
{
if
(
info
->
format
&
ESD_STEREO
)
{
if
(
info
->
format
&
ESD_BITS16
)
amount
=
(
44100
*
(
ESD_BUF_SIZE
+
64
))
/
info
->
rate
;
else
amount
=
(
44100
*
(
ESD_BUF_SIZE
+
128
))
/
info
->
rate
;
}
else
{
if
(
info
->
format
&
ESD_BITS16
)
amount
=
(
2
*
44100
*
(
ESD_BUF_SIZE
+
128
))
/
info
->
rate
;
else
amount
=
(
2
*
44100
*
(
ESD_BUF_SIZE
+
256
))
/
info
->
rate
;
}
free
(
info
);
}
amount
+=
ESD_BUF_SIZE
*
2
;
#endif
esd_close
(
fd
);
return
amount
;
}
static
void
*
esd_stou8
(
void
*
data
,
gint
length
)
{
int
len
=
length
;
unsigned
char
*
dat
=
(
unsigned
char
*
)
data
;
while
(
len
--
>
0
)
*
dat
++
^=
0x80
;
return
data
;
}
static
void
*
esd_utos16sw
(
void
*
data
,
gint
length
)
{
int
len
=
length
;
short
*
dat
=
data
;
while
(
len
>
0
)
{
*
dat
=
GUINT16_SWAP_LE_BE
(
*
dat
)
^
0x8000
;
dat
++
;
len
-=
2
;
}
return
data
;
}
static
void
*
esd_utos16
(
void
*
data
,
gint
length
)
{
int
len
=
length
;
short
*
dat
=
data
;
while
(
len
>
0
)
{
*
dat
^=
0x8000
;
dat
++
;
len
-=
2
;
}
return
data
;
}
static
void
*
esd_16sw
(
void
*
data
,
gint
length
)
{
int
len
=
length
;
short
*
dat
=
data
;
while
(
len
>
0
)
{
*
dat
=
GUINT16_SWAP_LE_BE
(
*
dat
);
dat
++
;
len
-=
2
;
}
return
data
;
}
static
void
esdout_setup_format
(
ESDInfo
*
info
,
AudioFormat
format
,
gint
rate
,
gint
nch
)
{
gboolean
swap_sign
=
FALSE
;
gboolean
swap_16
=
FALSE
;
info
->
format
=
format
;
info
->
frequency
=
rate
;
info
->
channels
=
nch
;
switch
(
format
)
{
case
FORMAT_S8
:
swap_sign
=
TRUE
;
case
FORMAT_U8
:
info
->
esd_format
=
ESD_BITS8
;
break
;
case
FORMAT_U16_LE
:
case
FORMAT_U16_BE
:
case
FORMAT_U16_NE
:
swap_sign
=
TRUE
;
case
FORMAT_S16_LE
:
case
FORMAT_S16_BE
:
case
FORMAT_S16_NE
:
info
->
esd_format
=
ESD_BITS16
;
break
;
}
#ifdef WORDS_BIGENDIAN
if
(
format
==
FORMAT_U16_LE
||
format
==
FORMAT_S16_LE
)
#else
if
(
format
==
FORMAT_U16_BE
||
format
==
FORMAT_S16_BE
)
#endif
swap_16
=
TRUE
;
info
->
esd_translate
=
(
void
*
(
*
)())
NULL
;
if
(
info
->
esd_format
==
ESD_BITS8
)
{
if
(
swap_sign
)
{
info
->
esd_translate
=
esd_stou8
;
}