[chromecast] Support for most basic functionality

This commit is contained in:
ejurgensen 2016-02-02 12:02:14 +01:00
parent 7d6c670fee
commit e4d209f8a0
3 changed files with 564 additions and 318 deletions

View File

@ -34,9 +34,9 @@ enum output_types
/* Output session state */
// Session is starting up
#define OUTPUT_STATE_F_STARTUP (1 << 15)
#define OUTPUT_STATE_F_STARTUP (1 << 14)
// Streaming is up (connection established)
#define OUTPUT_STATE_F_CONNECTED (1 << 16)
#define OUTPUT_STATE_F_CONNECTED (1 << 15)
enum output_device_state
{
OUTPUT_STATE_STOPPED = 0,
@ -48,6 +48,8 @@ enum output_device_state
OUTPUT_STATE_SETUP = OUTPUT_STATE_F_STARTUP | 0x03,
OUTPUT_STATE_RECORD = OUTPUT_STATE_F_STARTUP | 0x04,
OUTPUT_STATE_STARTUP = OUTPUT_STATE_F_STARTUP,
// Session established
// - streaming ready (RECORD sent and acked, connection established)
// - commands (SET_PARAMETER) are possible

File diff suppressed because it is too large Load Diff

View File

@ -1883,6 +1883,8 @@ device_streaming_cb(struct output_device *device, struct output_session *session
{
int ret;
DPRINTF(E_DBG, L_PLAYER, "CALLBACK streaming_cb %d\n", status);
if (status == OUTPUT_STATE_FAILED)
{
output_sessions--;
@ -1924,11 +1926,15 @@ device_streaming_cb(struct output_device *device, struct output_session *session
if (!device->advertised)
device_remove(device);
}
else
outputs_status_cb(session, device_streaming_cb);
}
static void
device_command_cb(struct output_device *device, struct output_session *session, enum output_device_state status)
{
DPRINTF(E_DBG, L_PLAYER, "CALLBACK command_cb %d %d\n", status, cur_cmd->raop_pending);
cur_cmd->raop_pending--;
outputs_status_cb(session, device_streaming_cb);
@ -1952,6 +1958,8 @@ device_shutdown_cb(struct output_device *device, struct output_session *session,
{
int ret;
DPRINTF(E_DBG, L_PLAYER, "CALLBACK shutdown_cb %d\n", status);
cur_cmd->raop_pending--;
if (output_sessions)
@ -1986,6 +1994,8 @@ device_shutdown_cb(struct output_device *device, struct output_session *session,
static void
device_lost_cb(struct output_device *device, struct output_session *session, enum output_device_state status)
{
DPRINTF(E_DBG, L_PLAYER, "CALLBACK lost_cb %d\n", status);
/* We lost that device during startup for some reason, not much we can do here */
if (status == OUTPUT_STATE_FAILED)
DPRINTF(E_WARN, L_PLAYER, "Failed to stop lost device\n");
@ -1999,6 +2009,8 @@ device_activate_cb(struct output_device *device, struct output_session *session,
struct timespec ts;
int ret;
DPRINTF(E_DBG, L_PLAYER, "CALLBACK activate_cb %d %d\n", status, OUTPUT_STATE_F_STARTUP);
cur_cmd->raop_pending--;
ret = device_check(device);
@ -2070,6 +2082,8 @@ device_probe_cb(struct output_device *device, struct output_session *session, en
{
int ret;
DPRINTF(E_DBG, L_PLAYER, "CALLBACK probe_cb %d\n", status);
cur_cmd->raop_pending--;
ret = device_check(device);
@ -2117,6 +2131,8 @@ device_restart_cb(struct output_device *device, struct output_session *session,
{
int ret;
DPRINTF(E_DBG, L_PLAYER, "CALLBACK restart_cb %d %d\n", status, OUTPUT_STATE_F_STARTUP);
cur_cmd->raop_pending--;
ret = device_check(device);
@ -2336,7 +2352,6 @@ playback_stop(struct player_command *cmd)
* full stop just yet; this saves time when restarting, which is nicer
* for the user.
*/
//TODO Flush will give wrong result for raop_pending when CAST is also included
cmd->raop_pending = outputs_flush(device_command_cb, last_rtptime + AIRTUNES_V2_PACKET_SAMPLES);
pb_timer_stop();