Skip to content

Commit

Permalink
stream_cdda: support latest libcdio version
Browse files Browse the repository at this point in the history
  • Loading branch information
Uoti Urpala committed Jan 23, 2013
1 parent a16530e commit c5dc8df
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion stream/stream_cdda.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@
*/

#include "config.h"

#include <cdio/cdio.h>

#if CDIO_API_VERSION < 6
#define OLD_API
#endif

#ifdef OLD_API
#include <cdio/cdda.h>
#include <cdio/paranoia.h>
#include <cdio/cdio.h>
#else
#include <cdio/paranoia/cdda.h>
#include <cdio/paranoia/paranoia.h>
#endif

#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -116,6 +127,7 @@ const m_option_t cdda_opts[] = {
};

static const char *cdtext_name[] = {
#ifdef OLD_API
[CDTEXT_ARRANGER] = "Arranger",
[CDTEXT_COMPOSER] = "Composer",
[CDTEXT_MESSAGE] = "Message",
Expand All @@ -124,17 +136,35 @@ static const char *cdtext_name[] = {
[CDTEXT_SONGWRITER] = "Songwriter",
[CDTEXT_TITLE] = "Title",
[CDTEXT_UPC_EAN] = "UPC_EAN",
#else
[CDTEXT_FIELD_ARRANGER] = "Arranger",
[CDTEXT_FIELD_COMPOSER] = "Composer",
[CDTEXT_FIELD_MESSAGE] = "Message",
[CDTEXT_FIELD_ISRC] = "ISRC",
[CDTEXT_FIELD_PERFORMER] = "Performer",
[CDTEXT_FIELD_SONGWRITER] = "Songwriter",
[CDTEXT_FIELD_TITLE] = "Title",
[CDTEXT_FIELD_UPC_EAN] = "UPC_EAN",
#endif
};

static bool print_cdtext(stream_t *s, int track)
{
cdda_priv* p = (cdda_priv*)s->priv;
#ifdef OLD_API
cdtext_t *text = cdio_get_cdtext(p->cd->p_cdio, track);
#else
cdtext_t *text = cdio_get_cdtext(p->cd->p_cdio);
#endif
if (text) {
mp_msg(MSGT_SEEK, MSGL_INFO, "CD-Text (%s):\n", track ? "track" : "CD");
for (int i = 0; i < sizeof(cdtext_name) / sizeof(cdtext_name[0]); i++) {
const char *name = cdtext_name[i];
#ifdef OLD_API
const char *value = cdtext_get_const(i, text);
#else
const char *value = cdtext_get_const(text, i, track);
#endif
if (name && value)
mp_msg(MSGT_SEEK, MSGL_INFO, " %s: '%s'\n", name, value);
}
Expand Down

0 comments on commit c5dc8df

Please sign in to comment.