mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
Nuke maemo (nokian800/nokian900) and [open]pandora targets
They haven't seen any work since 2013, and likely hasn't compiled in at least a couple of releases -- not that we ever "released" anything for these targets. Futhermore, upstream for both has been effectively dead for about as long, and there's been no user reports of these being used since 2017 (and even then only in passing). It isn't worth the effort to triage their current state, much less uplift into something supportable, while the maintenance burden of keeping these things in-tree can be demonstrated by the diffstat. Change-Id: Id93bd450679d1b75e2c74295b3ae1548cd241b24
This commit is contained in:
parent
c47c075bd3
commit
bbcf210c94
36 changed files with 18 additions and 1728 deletions
|
|
@ -55,7 +55,7 @@
|
|||
#if defined(HAVE_MULTIDRIVE) || defined(HAVE_SPECIAL_DIRS)
|
||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||
static const char rbhome[] = "/sdcard";
|
||||
#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) \
|
||||
#elif (CONFIG_PLATFORM & PLATFORM_SDL) \
|
||||
&& !defined(__PCTOOL__)
|
||||
static const char *rbhome;
|
||||
#elif defined(PIVOT_ROOT)
|
||||
|
|
|
|||
|
|
@ -1,172 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 by Thomas Jarosch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include <libhal.h>
|
||||
#include <libosso.h>
|
||||
#include <SDL_thread.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "kernel.h"
|
||||
#include "thread.h"
|
||||
#include "power.h"
|
||||
#include "debug.h"
|
||||
#include "button.h"
|
||||
|
||||
/* Battery status information */
|
||||
#define BME_UDI "/org/freedesktop/Hal/devices/bme"
|
||||
#define BATTERY_PERCENTAGE "battery.charge_level.percentage"
|
||||
#define BATTER_REMAINING_TIME "battery.remaining_time"
|
||||
|
||||
/* Bluetooth headset support */
|
||||
#define BT_HEADSET_UDI "/org/freedesktop/Hal/devices/computer_logicaldev_input_1"
|
||||
|
||||
GMainLoop *maemo_main_loop = NULL;
|
||||
osso_context_t *maemo_osso_ctx = NULL;
|
||||
|
||||
volatile int maemo_display_on = 1;
|
||||
volatile int maemo_battery_level = 0;
|
||||
volatile int maemo_remaining_time_sec = 0;
|
||||
|
||||
void display_status_callback(osso_display_state_t state, gpointer data)
|
||||
{
|
||||
(void)data;
|
||||
|
||||
if (state == OSSO_DISPLAY_OFF)
|
||||
maemo_display_on = 0;
|
||||
else
|
||||
maemo_display_on = 1;
|
||||
}
|
||||
|
||||
|
||||
void get_battery_values(LibHalContext *ctx)
|
||||
{
|
||||
/* Get initial battery percentage and remaining time */
|
||||
maemo_battery_level = libhal_device_get_property_int(
|
||||
ctx, BME_UDI,
|
||||
BATTERY_PERCENTAGE, NULL);
|
||||
|
||||
maemo_remaining_time_sec = libhal_device_get_property_int(
|
||||
ctx, BME_UDI,
|
||||
BATTER_REMAINING_TIME, NULL);
|
||||
|
||||
DEBUGF("[maemo] Battery percentage: %d, remaining_time_sec: %d\n", maemo_battery_level, maemo_remaining_time_sec);
|
||||
}
|
||||
|
||||
static void on_battery_changed (LibHalContext *ctx,
|
||||
const char *udi,
|
||||
const char *key,
|
||||
dbus_bool_t is_removed,
|
||||
dbus_bool_t is_added)
|
||||
{
|
||||
(void)is_removed;
|
||||
(void)is_added;
|
||||
|
||||
if (!g_str_equal (udi, BME_UDI))
|
||||
return;
|
||||
|
||||
if (!g_str_equal (key, BATTERY_PERCENTAGE) && !g_str_equal (key, BATTER_REMAINING_TIME))
|
||||
return;
|
||||
|
||||
get_battery_values(ctx);
|
||||
}
|
||||
|
||||
static void on_bt_button_pressed(LibHalContext *ctx,
|
||||
const char *udi,
|
||||
const char *condition_name,
|
||||
const char *condition_detail)
|
||||
{
|
||||
(void)ctx;
|
||||
|
||||
if (!g_str_equal (udi, BT_HEADSET_UDI) || !g_str_equal(condition_name, "ButtonPressed"))
|
||||
return;
|
||||
|
||||
sim_enter_irq_handler();
|
||||
|
||||
if (g_str_equal(condition_detail, "play-cd") || g_str_equal(condition_detail, "pause-cd"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_PLAYPAUSE, 0);
|
||||
else if (g_str_equal(condition_detail, "stop-cd"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_STOP, 0);
|
||||
else if (g_str_equal(condition_detail, "next-song"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_NEXT, 0);
|
||||
else if (g_str_equal(condition_detail, "previous-song"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_PREV, 0);
|
||||
else if (g_str_equal(condition_detail, "fast-forward"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_FFWD, 0);
|
||||
else if (g_str_equal(condition_detail, "rewind"))
|
||||
button_queue_post(BUTTON_MULTIMEDIA_REW, 0);
|
||||
|
||||
sim_exit_irq_handler();
|
||||
}
|
||||
|
||||
int maemo_thread_func (void *wait_for_osso_startup)
|
||||
{
|
||||
maemo_main_loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
/* Register display callback */
|
||||
maemo_osso_ctx = osso_initialize ("rockbox", "666", FALSE, NULL);
|
||||
osso_hw_set_display_event_cb(maemo_osso_ctx, display_status_callback, NULL);
|
||||
|
||||
/* Register battery status callback */
|
||||
LibHalContext *hal_ctx;
|
||||
hal_ctx = libhal_ctx_new();
|
||||
|
||||
DBusConnection *system_bus = (DBusConnection*)osso_get_sys_dbus_connection(maemo_osso_ctx);
|
||||
libhal_ctx_set_dbus_connection(hal_ctx, system_bus);
|
||||
|
||||
libhal_ctx_init(hal_ctx, NULL);
|
||||
libhal_ctx_set_device_property_modified (hal_ctx, on_battery_changed);
|
||||
libhal_device_add_property_watch (hal_ctx, BME_UDI, NULL);
|
||||
|
||||
/* Work around libhal API issue: We need to add a property watch
|
||||
to get the condition change callback working */
|
||||
libhal_device_add_property_watch (hal_ctx, BT_HEADSET_UDI, NULL);
|
||||
libhal_ctx_set_device_condition(hal_ctx, on_bt_button_pressed);
|
||||
|
||||
get_battery_values(hal_ctx);
|
||||
|
||||
/* let system_init proceed */
|
||||
SDL_SemPost((SDL_sem *)wait_for_osso_startup);
|
||||
|
||||
g_main_loop_run (maemo_main_loop);
|
||||
|
||||
/* Cleanup */
|
||||
osso_deinitialize (maemo_osso_ctx);
|
||||
libhal_device_remove_property_watch (hal_ctx, BT_HEADSET_UDI, NULL);
|
||||
libhal_device_remove_property_watch (hal_ctx, BME_UDI, NULL);
|
||||
libhal_ctx_shutdown (hal_ctx, NULL);
|
||||
libhal_ctx_free(hal_ctx);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns battery level in percent */
|
||||
int _battery_level(void)
|
||||
{
|
||||
return maemo_battery_level;
|
||||
}
|
||||
|
||||
/* Return remaining battery time in minutes */
|
||||
int _battery_time(void)
|
||||
{
|
||||
return maemo_remaining_time_sec / 60;
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 by Thomas Jarosch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef __MAEMO_THREAD_H__
|
||||
#define __MAEMO_THREAD_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <libosso.h>
|
||||
|
||||
extern osso_context_t *maemo_osso_ctx;
|
||||
extern GMainLoop *maemo_main_loop;
|
||||
|
||||
extern volatile int maemo_display_on;
|
||||
extern volatile int maemo_has_input_focus;
|
||||
|
||||
int maemo_thread_func(void *unused);
|
||||
void pcm_shutdown_gstreamer(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,451 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 by Thomas Jarosch
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#include "autoconf.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "sound.h"
|
||||
#include "audiohw.h"
|
||||
#include "system.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "playback.h"
|
||||
#include "kernel.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <SDL.h>
|
||||
#include <glib.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsrc.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Maemo5: N900 specific libplayback support */
|
||||
#include <libplayback/playback.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include "maemo-thread.h"
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
#include "audiohw.h"
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
#include "spdif.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "pcm.h"
|
||||
#include "pcm-internal.h"
|
||||
#include "pcm_sampr.h"
|
||||
|
||||
/*#define LOGF_ENABLE*/
|
||||
#include "logf.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
extern bool debug_audio;
|
||||
#endif
|
||||
|
||||
/* Declarations for libplayblack */
|
||||
pb_playback_t *playback = NULL;
|
||||
void playback_state_req_handler(pb_playback_t *pb,
|
||||
enum pb_state_e req_state,
|
||||
pb_req_t *ext_req,
|
||||
void *data);
|
||||
void playback_state_req_callback(pb_playback_t *pb,
|
||||
enum pb_state_e granted_state,
|
||||
const char *reason,
|
||||
pb_req_t *req,
|
||||
void *data);
|
||||
bool playback_granted = false;
|
||||
|
||||
/* Gstreamer related vars */
|
||||
GstCaps *gst_audio_caps = NULL;
|
||||
GstElement *gst_pipeline = NULL;
|
||||
GstElement *gst_appsrc = NULL;
|
||||
GstElement *gst_volume = NULL;
|
||||
GstElement *gst_pulsesink = NULL;
|
||||
GstBus *gst_bus = NULL;
|
||||
static int bus_watch_id = 0;
|
||||
GMainLoop *pcm_loop = NULL;
|
||||
|
||||
static const void* pcm_data = NULL;
|
||||
static size_t pcm_data_size = 0;
|
||||
|
||||
static int audio_locked = 0;
|
||||
static pthread_mutex_t audio_lock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int inside_feed_data = 0;
|
||||
|
||||
/*
|
||||
* mutex lock/unlock wrappers neatness' sake
|
||||
*/
|
||||
static inline void lock_audio(void)
|
||||
{
|
||||
pthread_mutex_lock(&audio_lock_mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_audio(void)
|
||||
{
|
||||
pthread_mutex_unlock(&audio_lock_mutex);
|
||||
}
|
||||
|
||||
void pcm_play_lock(void)
|
||||
{
|
||||
if (++audio_locked == 1)
|
||||
lock_audio();
|
||||
}
|
||||
|
||||
void pcm_play_unlock(void)
|
||||
{
|
||||
if (--audio_locked == 0)
|
||||
unlock_audio();
|
||||
}
|
||||
|
||||
void pcm_dma_apply_settings(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_play_dma_start(const void *addr, size_t size)
|
||||
{
|
||||
pcm_data = addr;
|
||||
pcm_data_size = size;
|
||||
|
||||
if (playback_granted)
|
||||
{
|
||||
/* Start playing now */
|
||||
if (!inside_feed_data)
|
||||
gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_PLAYING);
|
||||
else
|
||||
DEBUGF("ERROR: dma_start called while inside feed_data\n");
|
||||
} else
|
||||
{
|
||||
/* N900: Request change to playing state */
|
||||
pb_playback_req_state (playback,
|
||||
PB_STATE_PLAY,
|
||||
playback_state_req_callback,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void pcm_play_dma_stop(void)
|
||||
{
|
||||
if (inside_feed_data)
|
||||
g_signal_emit_by_name (gst_appsrc, "end-of-stream", NULL);
|
||||
else
|
||||
gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_NULL);
|
||||
}
|
||||
|
||||
static void feed_data(GstElement * appsrc, guint size_hint, void *unused)
|
||||
{
|
||||
(void)size_hint;
|
||||
(void)unused;
|
||||
|
||||
lock_audio();
|
||||
|
||||
/* Make sure we don't trigger a gst_element_set_state() call
|
||||
from inside gstreamer's stream thread as it will deadlock */
|
||||
inside_feed_data = 1;
|
||||
|
||||
if (pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data, &pcm_data_size))
|
||||
{
|
||||
GstBuffer *buffer = gst_buffer_new ();
|
||||
GstFlowReturn ret;
|
||||
|
||||
GST_BUFFER_DATA (buffer) = (__u8 *)pcm_data;
|
||||
GST_BUFFER_SIZE (buffer) = pcm_data_size;
|
||||
|
||||
g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
if (ret != 0)
|
||||
DEBUGF("push-buffer error result: %d\n", ret);
|
||||
|
||||
pcm_play_dma_status_callback(PCM_DMAST_STARTED);
|
||||
} else
|
||||
{
|
||||
DEBUGF("feed_data: No Data.\n");
|
||||
g_signal_emit_by_name (appsrc, "end-of-stream", NULL);
|
||||
}
|
||||
|
||||
inside_feed_data = 0;
|
||||
|
||||
unlock_audio();
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_bus_message (GstBus * bus, GstMessage * message, void *unused)
|
||||
{
|
||||
(void)bus;
|
||||
(void)unused;
|
||||
|
||||
DEBUGF(" [gst] got BUS message %s\n",
|
||||
gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
|
||||
|
||||
switch (GST_MESSAGE_TYPE (message)) {
|
||||
case GST_MESSAGE_ERROR:
|
||||
{
|
||||
GError *err;
|
||||
gchar *debug;
|
||||
gst_message_parse_error (message, &err, &debug);
|
||||
|
||||
DEBUGF("[gst] Received error: Src: %s, msg: %s\n", GST_MESSAGE_SRC_NAME(message), err->message);
|
||||
|
||||
g_error_free (err);
|
||||
g_free (debug);
|
||||
}
|
||||
|
||||
g_main_loop_quit (pcm_loop);
|
||||
break;
|
||||
case GST_MESSAGE_EOS:
|
||||
gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_NULL);
|
||||
break;
|
||||
case GST_MESSAGE_STATE_CHANGED:
|
||||
{
|
||||
GstState old_state, new_state;
|
||||
|
||||
gst_message_parse_state_changed (message, &old_state, &new_state, NULL);
|
||||
DEBUGF("[gst] Element %s changed state from %s to %s.\n",
|
||||
GST_MESSAGE_SRC_NAME(message),
|
||||
gst_element_state_get_name (old_state),
|
||||
gst_element_state_get_name (new_state));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void maemo_configure_appsrc(void)
|
||||
{
|
||||
/* Block push-buffer until there is enough room */
|
||||
g_object_set (G_OBJECT(gst_appsrc), "block", TRUE, NULL);
|
||||
|
||||
g_object_set(G_OBJECT(gst_appsrc), "format", GST_FORMAT_BYTES, NULL);
|
||||
|
||||
gst_audio_caps = gst_caps_new_simple("audio/x-raw-int", "width", G_TYPE_INT, (gint)16, "depth", G_TYPE_INT, (gint)16, "channels" ,G_TYPE_INT, (gint)2,
|
||||
"signed",G_TYPE_BOOLEAN,1,
|
||||
"rate",G_TYPE_INT,44100,"endianness",G_TYPE_INT,(gint)1234,NULL);
|
||||
|
||||
g_object_set (G_OBJECT(gst_appsrc), "caps", gst_audio_caps, NULL);
|
||||
|
||||
gst_app_src_set_stream_type(GST_APP_SRC(gst_appsrc),
|
||||
GST_APP_STREAM_TYPE_STREAM);
|
||||
|
||||
/* configure the appsrc, we will push data into the appsrc from the
|
||||
* mainloop. */
|
||||
g_signal_connect (gst_appsrc, "need-data", G_CALLBACK (feed_data), NULL);
|
||||
}
|
||||
|
||||
/* Init libplayback: Grant access rights to
|
||||
play audio while the phone is in silent mode */
|
||||
void maemo_init_libplayback(void)
|
||||
{
|
||||
DBusConnection *session_bus_raw = (DBusConnection*)osso_get_dbus_connection(maemo_osso_ctx);
|
||||
|
||||
playback = pb_playback_new_2(session_bus_raw,
|
||||
PB_CLASS_MEDIA,
|
||||
PB_FLAG_AUDIO,
|
||||
PB_STATE_STOP,
|
||||
playback_state_req_handler,
|
||||
NULL);
|
||||
|
||||
pb_playback_set_stream(playback, "Playback Stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets called by the policy framework if an important
|
||||
* event arrives: Incoming calls etc.
|
||||
*/
|
||||
void maemo_tell_rockbox_to_stop_audio(void)
|
||||
{
|
||||
sim_enter_irq_handler();
|
||||
queue_broadcast(SYS_CALL_INCOMING, 0);
|
||||
sim_exit_irq_handler();
|
||||
|
||||
osso_system_note_infoprint(maemo_osso_ctx, "Stopping rockbox playback", NULL);
|
||||
}
|
||||
|
||||
void playback_state_req_handler(pb_playback_t *pb,
|
||||
enum pb_state_e req_state,
|
||||
pb_req_t *ext_req,
|
||||
void *data)
|
||||
{
|
||||
(void)pb;
|
||||
(void)ext_req;
|
||||
(void)data;
|
||||
|
||||
DEBUGF("External state change request: state: %s, data: %p\n",
|
||||
pb_state_to_string(req_state), data);
|
||||
|
||||
if (req_state == PB_STATE_STOP && playback_granted)
|
||||
{
|
||||
DEBUGF("Stopping playback, might be an incoming call\n");
|
||||
|
||||
playback_granted = false;
|
||||
maemo_tell_rockbox_to_stop_audio();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for our own state change request.
|
||||
*/
|
||||
void playback_state_req_callback(pb_playback_t *pb, enum pb_state_e granted_state, const char *reason, pb_req_t *req, void *data)
|
||||
{
|
||||
(void)data;
|
||||
(void)reason;
|
||||
|
||||
DEBUGF("State request callback: granted_state: %s, reason: %s\n",
|
||||
pb_state_to_string(granted_state), reason);
|
||||
|
||||
/* We are allowed to play audio */
|
||||
if (granted_state == PB_STATE_PLAY)
|
||||
{
|
||||
DEBUGF("Playback granted. Start playing...\n");
|
||||
playback_granted = true;
|
||||
if (!inside_feed_data)
|
||||
gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_PLAYING);
|
||||
} else
|
||||
{
|
||||
DEBUGF("Can't start playing. Throwing away play request\n");
|
||||
|
||||
playback_granted = false;
|
||||
maemo_tell_rockbox_to_stop_audio();
|
||||
}
|
||||
|
||||
pb_playback_req_completed(pb, req);
|
||||
}
|
||||
|
||||
void pcm_play_dma_init(void)
|
||||
{
|
||||
maemo_init_libplayback();
|
||||
|
||||
GMainContext *ctx = g_main_loop_get_context(maemo_main_loop);
|
||||
pcm_loop = g_main_loop_new (ctx, true);
|
||||
|
||||
gst_init (NULL, NULL);
|
||||
|
||||
gst_pipeline = gst_pipeline_new ("rockbox");
|
||||
|
||||
gst_appsrc = gst_element_factory_make ("appsrc", NULL);
|
||||
gst_volume = gst_element_factory_make ("volume", NULL);
|
||||
gst_pulsesink = gst_element_factory_make ("pulsesink", NULL);
|
||||
|
||||
/* Connect elements */
|
||||
gst_bin_add_many (GST_BIN (gst_pipeline),
|
||||
gst_appsrc, gst_volume, gst_pulsesink, NULL);
|
||||
gst_element_link_many (gst_appsrc, gst_volume, gst_pulsesink, NULL);
|
||||
|
||||
/* Connect to gstreamer bus of the pipeline */
|
||||
gst_bus = gst_pipeline_get_bus (GST_PIPELINE (gst_pipeline));
|
||||
bus_watch_id = gst_bus_add_watch (gst_bus, (GstBusFunc) gst_bus_message, NULL);
|
||||
|
||||
maemo_configure_appsrc();
|
||||
}
|
||||
|
||||
void pcm_shutdown_gstreamer(void)
|
||||
{
|
||||
/* Try to stop playing */
|
||||
gst_element_set_state (GST_ELEMENT(gst_pipeline), GST_STATE_NULL);
|
||||
|
||||
/* Make sure we are really stopped. This should return almost instantly,
|
||||
so we wait up to ten seconds and just continue otherwise */
|
||||
gst_element_get_state (GST_ELEMENT(gst_pipeline), NULL, NULL, GST_SECOND * 10);
|
||||
|
||||
g_source_remove (bus_watch_id);
|
||||
g_object_unref(gst_bus);
|
||||
gst_bus = NULL;
|
||||
|
||||
gst_object_unref (gst_pipeline);
|
||||
gst_pipeline = NULL;
|
||||
|
||||
/* Shutdown libplayback and gstreamer */
|
||||
pb_playback_destroy (playback);
|
||||
gst_deinit();
|
||||
|
||||
g_main_loop_quit(pcm_loop);
|
||||
g_main_loop_unref (pcm_loop);
|
||||
|
||||
pthread_mutex_destroy(&audio_lock_mutex);
|
||||
}
|
||||
|
||||
void pcm_play_dma_postinit(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_set_mixer_volume(int volume)
|
||||
{
|
||||
/* gstreamer volume range is from 0.00 to 1.00
|
||||
* input is -990..0 */
|
||||
gdouble gst_vol = 1.0f - (gdouble)volume / -990.0f;
|
||||
g_object_set (G_OBJECT(gst_volume), "volume", gst_vol, NULL);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
void pcm_rec_lock(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_rec_unlock(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_rec_dma_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_rec_dma_close(void)
|
||||
{
|
||||
}
|
||||
|
||||
void pcm_rec_dma_start(void *start, size_t size)
|
||||
{
|
||||
(void)start;
|
||||
(void)size;
|
||||
}
|
||||
|
||||
void pcm_rec_dma_stop(void)
|
||||
{
|
||||
}
|
||||
|
||||
const void * pcm_rec_dma_get_peak_buffer(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void audiohw_set_recvol(int left, int right, int type)
|
||||
{
|
||||
(void)left;
|
||||
(void)right;
|
||||
(void)type;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
unsigned long spdif_measure_frequency(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_RECORDING */
|
||||
|
|
@ -37,9 +37,6 @@ int key_to_button(int keyboard_key)
|
|||
int new_btn = BUTTON_NONE;
|
||||
switch (keyboard_key)
|
||||
{
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO4)
|
||||
case SDLK_ESCAPE:
|
||||
#endif
|
||||
case SDLK_KP_7:
|
||||
new_btn = BUTTON_TOPLEFT;
|
||||
break;
|
||||
|
|
@ -47,36 +44,20 @@ int key_to_button(int keyboard_key)
|
|||
case SDLK_UP:
|
||||
new_btn = BUTTON_TOPMIDDLE;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO4)
|
||||
case SDLK_F7:
|
||||
#endif
|
||||
case SDLK_KP_9:
|
||||
new_btn = BUTTON_TOPRIGHT;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||
case SDLK_RSHIFT:
|
||||
#endif
|
||||
case SDLK_KP_4:
|
||||
case SDLK_LEFT:
|
||||
new_btn = BUTTON_MIDLEFT;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO|PLATFORM_PANDORA)
|
||||
case SDLK_RETURN:
|
||||
case SDLK_KP_ENTER:
|
||||
#endif
|
||||
case SDLK_KP_5:
|
||||
new_btn = BUTTON_CENTER;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||
case SDLK_RCTRL:
|
||||
#endif
|
||||
case SDLK_KP_6:
|
||||
case SDLK_RIGHT:
|
||||
new_btn = BUTTON_MIDRIGHT;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO4)
|
||||
case SDLK_F6:
|
||||
#endif
|
||||
case SDLK_KP_1:
|
||||
new_btn = BUTTON_BOTTOMLEFT;
|
||||
break;
|
||||
|
|
@ -84,9 +65,6 @@ int key_to_button(int keyboard_key)
|
|||
case SDLK_DOWN:
|
||||
new_btn = BUTTON_BOTTOMMIDDLE;
|
||||
break;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO4)
|
||||
case SDLK_F8:
|
||||
#endif
|
||||
case SDLK_KP_3:
|
||||
new_btn = BUTTON_BOTTOMRIGHT;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -81,10 +81,6 @@ SDL_Cursor *sdl_arrow_cursor = NULL;
|
|||
|
||||
int sdl_app_has_input_focus = 1;
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
static int n900_updown_key_pressed = 0;
|
||||
#endif
|
||||
|
||||
#ifdef HAS_BUTTON_HOLD
|
||||
bool hold_button_state = false;
|
||||
bool button_hold(void) {
|
||||
|
|
@ -288,28 +284,6 @@ static bool event_handler(SDL_Event *event)
|
|||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
ev_key = event->key.keysym.sym;
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO5)
|
||||
/* N900 with shared up/down cursor mapping. Seen on the German,
|
||||
Finnish, Italian, French and Russian version. Probably more. */
|
||||
if (event->key.keysym.mod & KMOD_MODE || n900_updown_key_pressed)
|
||||
{
|
||||
/* Prevent stuck up/down keys: If you release the ALT key before the cursor key,
|
||||
rockbox will see a KEYUP event for left/right instead of up/down and
|
||||
the previously pressed up/down key would stay active. */
|
||||
if (ev_key == SDLK_LEFT || ev_key == SDLK_RIGHT)
|
||||
{
|
||||
if (event->type == SDL_KEYDOWN)
|
||||
n900_updown_key_pressed = 1;
|
||||
else
|
||||
n900_updown_key_pressed = 0;
|
||||
}
|
||||
|
||||
if (ev_key == SDLK_LEFT)
|
||||
ev_key = SDLK_UP;
|
||||
else if (ev_key == SDLK_RIGHT)
|
||||
ev_key = SDLK_DOWN;
|
||||
}
|
||||
#endif
|
||||
button_event(ev_key, event->type == SDL_KEYDOWN);
|
||||
break;
|
||||
|
||||
|
|
@ -463,9 +437,6 @@ static void show_sim_help(void)
|
|||
#ifdef HAVE_HOTSWAP
|
||||
HELPTXT(EXT_KEY, "toggle external drive");
|
||||
#endif
|
||||
#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||
HELPTXT(SDLK_LCTRL, "shutdown");
|
||||
#endif
|
||||
#ifdef HAS_BUTTON_HOLD
|
||||
HELPTXT(SDLK_h, "toggle hold button");
|
||||
#endif
|
||||
|
|
@ -586,12 +557,6 @@ static void button_event(int key, bool pressed)
|
|||
return;
|
||||
#endif
|
||||
#endif
|
||||
#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||
case SDLK_LCTRL:
|
||||
/* Will post SDL_USEREVENT in shutdown_hw() if successful. */
|
||||
sys_poweroff();
|
||||
break;
|
||||
#endif
|
||||
#ifdef RG_NANO
|
||||
case SDLK_q:
|
||||
/* Use reboot to exit without shutting down */
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@
|
|||
#include "button-sdl.h"
|
||||
#include "lcd-sdl.h"
|
||||
#include "screendump.h"
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
#include "maemo-thread.h"
|
||||
#endif
|
||||
|
||||
SDL_Surface* lcd_surface;
|
||||
|
||||
|
|
@ -125,16 +122,6 @@ void lcd_update(void)
|
|||
|
||||
void lcd_update_rect(int x_start, int y_start, int width, int height)
|
||||
{
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
/* Don't update display if not shown */
|
||||
if (!maemo_display_on)
|
||||
return;
|
||||
|
||||
/* Don't update if we don't have the input focus */
|
||||
if (!sdl_app_has_input_focus)
|
||||
return;
|
||||
#endif
|
||||
|
||||
sdl_update_rect(lcd_surface, x_start, y_start, width, height,
|
||||
LCD_WIDTH, LCD_HEIGHT, get_lcd_pixel);
|
||||
sdl_gui_update(lcd_surface, x_start, y_start, width,
|
||||
|
|
|
|||
|
|
@ -151,15 +151,7 @@ void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
|
|||
|
||||
int lcd_get_dpi(void)
|
||||
{
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO5)
|
||||
return 267;
|
||||
#elif (CONFIG_PLATFORM & PLATFORM_MAEMO4)
|
||||
return 225;
|
||||
#elif (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||
return 217;
|
||||
#else
|
||||
/* TODO: find a way to query it from the OS, SDL doesn't support it
|
||||
* directly; for now assume the more or less standard 96 */
|
||||
return 96;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,12 +44,6 @@
|
|||
#include "panic.h"
|
||||
#include "debug.h"
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include "maemo-thread.h"
|
||||
#endif
|
||||
|
||||
#if defined(RG_NANO) && !defined(SIMULATOR)
|
||||
#include <signal.h>
|
||||
#include "instant_play.h"
|
||||
|
|
@ -116,14 +110,6 @@ static int sdl_event_thread(void * param)
|
|||
#endif /* !HAVE_TOUCHSCREEN */
|
||||
#endif /* !SIMULATOR */
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
/* start maemo thread: Listen to display on/off events and battery monitoring */
|
||||
SDL_sem *wait_for_maemo_startup = SDL_CreateSemaphore(0); /* 0-count so it blocks */
|
||||
SDL_Thread *maemo_thread = SDL_CreateThread(maemo_thread_func, NULL, wait_for_maemo_startup);
|
||||
SDL_SemWait(wait_for_maemo_startup);
|
||||
SDL_DestroySemaphore(wait_for_maemo_startup);
|
||||
#endif
|
||||
|
||||
#if SDL_MAJOR_VERSION == 1
|
||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
|
|
@ -151,19 +137,6 @@ static int sdl_event_thread(void * param)
|
|||
/* finally enter the button loop */
|
||||
gui_message_loop();
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO5)
|
||||
pcm_shutdown_gstreamer();
|
||||
#endif
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
g_main_loop_quit (maemo_main_loop);
|
||||
g_main_loop_unref(maemo_main_loop);
|
||||
SDL_WaitThread(maemo_thread, NULL);
|
||||
#endif
|
||||
|
||||
#if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA))
|
||||
SDL_FreeCursor(hiddenCursor);
|
||||
#endif
|
||||
|
||||
/* Order here is relevent to prevent deadlocks and use of destroyed
|
||||
sync primitives by kernel threads */
|
||||
#ifdef HAVE_SDL_THREADS
|
||||
|
|
@ -246,12 +219,6 @@ void system_init(void)
|
|||
/* fake stack, OS manages size (and growth) */
|
||||
stackbegin = stackend = (uintptr_t*)&s;
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
|
||||
/* Make glib thread safe */
|
||||
g_thread_init(NULL);
|
||||
g_type_init();
|
||||
#endif
|
||||
|
||||
#if defined(RG_NANO) && !defined(SIMULATOR)
|
||||
/* Set system volume to max with amixer */
|
||||
system("amixer -q sset 'Headphone' 63 unmute");
|
||||
|
|
|
|||
|
|
@ -212,8 +212,8 @@ void sdl_window_setup(void)
|
|||
int depth = LCD_DEPTH < 8 ? 16 : LCD_DEPTH;
|
||||
Uint32 flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
||||
|
||||
#if (CONFIG_PLATFORM & (PLATFORM_MAEMO|PLATFORM_PANDORA))
|
||||
/* Fullscreen mode for maemo app */
|
||||
#if 0
|
||||
/* Fullscreen mode might be desired */
|
||||
flags |= SDL_WINDOW_FULLSCREEN;
|
||||
#else
|
||||
if (display_zoom == 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue