libtizchromecast

group libtizchromecast

library.

A C/C++ library to access and control a Chromecast device.

Typedefs

typedef struct tiz_chromecast tiz_chromecast_t

The Tizonia Chromecast opaque handle.

Functions

tiz_chromecast_error_t tiz_chromecast_init(tiz_chromecast_ptr_t *app_chromecast, const tiz_chromecast_ctx_t *p_cc_ctx_, const char *ap_name_or_ip, const tiz_chromecast_callbacks_t *ap_cbacks, void *ap_user_data)

Initialize the tiz_chromecast_t handle.

Return

ETizCcErrorNoError on success.

Parameters
  • app_chromecast: A pointer to the Tizonia Chromecast handle to be initialised.

  • p_cc_ctx: A pointer to an already initialised global context.

  • ap_name_or_ip: A Chromecast device’s name or ip address.

  • ap_cbacks: A structure with callbacks to inform the client of the various events (cast and media status changes and error events).

  • ap_user_data: User’s data that is returned in each callback.

tiz_chromecast_error_t tiz_chromecast_poll(tiz_chromecast_t *ap_chromecast, int a_poll_time_ms)

Poll to read any events received on the chromecast socket. This function needs to be called periodically (e.g. from the client’s event loop).

Return

ETizCcErrorNoError on success.

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

  • a_poll_time_ms: The polling time, in milliseconds.

tiz_chromecast_error_t tiz_chromecast_load_url(tiz_chromecast_t *ap_chromecast, const char *ap_url, const char *ap_content_type, const char *ap_title, const char *ap_album_art)

Load a new audio stream URL on the Chromecast device’s default media application.

After calling this method, the various playback methods (pause, stop, volume, etc) can be used to interact with the media application in the Chromecast device.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

  • ap_url: The stream’s URL.

  • ap_content_type: MIME content type of the stream being loaded.

  • ap_title: The title of the stream being loaded.

  • ap_album_art: The stream’s album art URL.

tiz_chromecast_error_t tiz_chromecast_play(tiz_chromecast_t *ap_chromecast)

Resume media playback.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_stop(tiz_chromecast_t *ap_chromecast)

Stop media playback.

After this command the content will no longer remain loaded.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_pause(tiz_chromecast_t *ap_chromecast)

Pause media playback.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_volume(tiz_chromecast_t *ap_chromecast, int a_volume)

Set a volume level (0-100).

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

  • a_volume: The volume level (0-100).

tiz_chromecast_error_t tiz_chromecast_volume_up(tiz_chromecast_t *ap_chromecast)

Increase playback volumen.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_volume_down(tiz_chromecast_t *ap_chromecast)

Decrease playback volume.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_mute(tiz_chromecast_t *ap_chromecast)

Mute playback.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

tiz_chromecast_error_t tiz_chromecast_unmute(tiz_chromecast_t *ap_chromecast)

Unmute playback.

Return

ETizCcErrorNoError on success

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

void tiz_chromecast_destroy(tiz_chromecast_t *ap_chromecast)

Destroy the Tizonia Chromecast object.

Parameters
  • ap_chromecast: The Tizonia Chromecast handle.

const char *tiz_chromecast_error_str(const tiz_chromecast_error_t error)

Return an error code string.

Parameters
  • error: The Tizonia Chromecast error code.