Commit a5529601 authored by IOhannes m zmölnig's avatar IOhannes m zmölnig

Imported Upstream version 1.2.0

parent 91526e79
This diff is collapsed.
......@@ -2,7 +2,7 @@ AC_INIT
AC_CONFIG_SRCDIR([include/gmerlin_encoders.h])
AM_CONFIG_HEADER(include/config.h)
AM_INIT_AUTOMAKE(gmerlin-encoders, 1.0.0)
AM_INIT_AUTOMAKE(gmerlin-encoders, 1.2.0)
SAVE_CFLAGS=$CFLAGS
AC_DISABLE_STATIC
......@@ -44,7 +44,7 @@ dnl
dnl Required libraries
dnl
GMERLIN_REQUIRED="1.0.0"
GMERLIN_REQUIRED="1.2.0"
PKG_CHECK_MODULES(GMERLIN, gmerlin >= $GMERLIN_REQUIRED, , AC_MSG_ERROR("gmerlin not found"))
gmerlin_plugindir='$(libdir)/gmerlin/plugins'
......
......@@ -19,31 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* *****************************************************************/
#define MAKE_VERSION(maj,min,pat) ((maj<<16)|(min<<8)|pat)
#define BGAV_FLAC_VERSION_INT MAKE_VERSION(BGAV_FLAC_MAJOR,BGAV_FLAC_MINOR,BGAV_FLAC_PATCHLEVEL)
/* Dirty hack to support different FLAC API versions */
#if BGAV_FLAC_VERSION_INT <= MAKE_VERSION(1, 1, 2)
#include <FLAC/file_encoder.h>
#include <FLAC/file_decoder.h> /* For creating the seektable */
#else
#define FLAC__FileEncoder FLAC__StreamEncoder
#define FLAC__FileDecoder FLAC__StreamDecoder
#define FLAC__file_encoder_new FLAC__stream_encoder_new
#define FLAC__file_encoder_set_metadata FLAC__stream_encoder_set_metadata
#define FLAC__file_encoder_process FLAC__stream_encoder_process
#define FLAC__FileDecoderWriteStatus FLAC__StreamDecoderWriteStatus
#define FLAC__file_decoder_get_decode_position FLAC__stream_decoder_get_decode_position
#define FLAC__file_decoder_new FLAC__stream_decoder_new
#define FLAC__file_decoder_set_md5_checking FLAC__stream_decoder_set_md5_checking
#define FLAC__file_decoder_set_metadata_ignore_all FLAC__stream_decoder_set_metadata_ignore_all
#define FLAC__file_decoder_process_until_end_of_metadata FLAC__stream_decoder_process_until_end_of_metadata
#define FLAC__file_decoder_process_until_end_of_file FLAC__stream_decoder_process_until_end_of_stream
#define FLAC__file_decoder_delete FLAC__stream_decoder_delete
#define FLAC__file_encoder_finish FLAC__stream_encoder_finish
#define FLAC__file_encoder_delete FLAC__stream_encoder_delete
#endif
// #define MAKE_VERSION(maj,min,pat) ((maj<<16)|(min<<8)|pat)
// #define BGAV_FLAC_VERSION_INT MAKE_VERSION(BGAV_FLAC_MAJOR,BGAV_FLAC_MINOR,BGAV_FLAC_PATCHLEVEL)
#include <FLAC/stream_encoder.h> /* Flac in Ogg */
#include <FLAC/metadata.h>
......@@ -77,13 +54,8 @@ void bg_flac_set_parameter(void * data, const char * name, const bg_parameter_va
void bg_flac_init_stream_encoder(bg_flac_t * flac, FLAC__StreamEncoder * enc);
#if BGAV_FLAC_VERSION_INT <= MAKE_VERSION(1, 1, 2)
void bg_flac_init_file_encoder(bg_flac_t * flac, FLAC__FileEncoder * enc);
#else
#define bg_flac_init_file_encoder(a,b) bg_flac_init_stream_encoder(a,b)
#endif
void bg_flac_init_metadata(bg_flac_t * flac, const bg_metadata_t * metadata);
void bg_flac_init_metadata(bg_flac_t * flac,
const gavl_metadata_t * metadata);
void bg_flac_prepare_audio_frame(bg_flac_t * flac, gavl_audio_frame_t * frame);
void bg_flac_free(bg_flac_t * flac);
......
......@@ -25,16 +25,17 @@ typedef struct bg_shout_s bg_shout_t;
bg_shout_t * bg_shout_create(int format);
const bg_parameter_info_t * bg_shout_get_parameters(bg_shout_t *);
const bg_parameter_info_t * bg_shout_get_parameters(void);
void bg_shout_set_parameter(void * data, const char * name,
const bg_parameter_value_t * val);
void bg_shout_set_metadata(bg_shout_t * s, const bg_metadata_t * m);
void bg_shout_set_metadata(bg_shout_t * s, const gavl_metadata_t * m);
int bg_shout_open(bg_shout_t *);
void bg_shout_update_metadata(bg_shout_t *, const char * name,
const gavl_metadata_t * m);
void bg_shout_destroy(bg_shout_t *);
......
......@@ -55,6 +55,9 @@
/* Do we have libavcodec installed? */
#undef HAVE_LIBAVCODEC
/* Define to 1 if you have the <libavcore/avcore.h> header file. */
#undef HAVE_LIBAVCORE_AVCORE_H
/* Do we have libavformat installed? */
#undef HAVE_LIBAVFORMAT
......@@ -134,5 +137,8 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Header for vdpau */
#undef VDPAU_HEADER
/* Version number of package */
#undef VERSION
......@@ -27,8 +27,8 @@
typedef struct bgen_id3v1_s bgen_id3v1_t;
typedef struct bgen_id3v2_s bgen_id3v2_t;
bgen_id3v1_t * bgen_id3v1_create(const bg_metadata_t*);
bgen_id3v2_t * bgen_id3v2_create(const bg_metadata_t*);
bgen_id3v1_t * bgen_id3v1_create(const gavl_metadata_t*);
bgen_id3v2_t * bgen_id3v2_create(const gavl_metadata_t*);
#define ID3_ENCODING_LATIN1 0x00
#define ID3_ENCODING_UTF16_BOM 0x01
......
......@@ -24,6 +24,7 @@
#include <gmerlin/plugin.h>
#include <gmerlin/utils.h>
#include <gmerlin/translation.h>
#include <gavl/metatags.h>
#include <config.h>
......@@ -88,7 +89,7 @@ static void do_shift(int32_t * dst[], int num_channels, int num_samples,
* the options -0 through -8 of the flac commandline
* encoder
*/
#if 0
static struct
{
int blocksize; // -b
......@@ -192,6 +193,7 @@ clevels[] =
.do_exhaustive_model_search = 1, // -e
}
};
#endif
static const bg_parameter_info_t audio_parameters[] =
{
......@@ -200,7 +202,7 @@ static const bg_parameter_info_t audio_parameters[] =
.long_name = TRS("Bits"),
.type = BG_PARAMETER_STRINGLIST,
.val_default = { .val_str = "16" },
.multi_names = (char const *[]){ "8", "12", "16", "20", "24", (char*)0 },
.multi_names = (char const *[]){ "8", "12", "16", "20", "24", NULL },
},
{
.name = "compression_level",
......@@ -223,7 +225,7 @@ const bg_parameter_info_t * bg_flac_get_parameters(void * data)
void bg_flac_set_parameter(void * data, const char * name, const bg_parameter_value_t * val)
{
bg_flac_t * flac;
flac = (bg_flac_t*)data;
flac = data;
if(!name)
{
......@@ -241,8 +243,9 @@ void bg_flac_set_parameter(void * data, const char * name, const bg_parameter_va
// fprintf(stderr, "set_audio_parameter_flac %s\n", name);
}
static void init_common(bg_flac_t * flac)
void bg_flac_init_stream_encoder(bg_flac_t * flac, FLAC__StreamEncoder * enc)
{
/* Common initialization */
flac->format->interleave_mode = GAVL_INTERLEAVE_NONE;
/* Samplerates which are no multiples of 10 are invalid */
......@@ -250,7 +253,9 @@ static void init_common(bg_flac_t * flac)
/* Bits per sample */
flac->samples_per_block = clevels[flac->clevel].blocksize;
/* bits_per_sample is zero when writing compressed packets */
if(!flac->bits_per_sample)
flac->bits_per_sample = 16;
if(flac->bits_per_sample <= 8)
{
......@@ -271,75 +276,19 @@ static void init_common(bg_flac_t * flac)
flac->format->sample_format = GAVL_SAMPLE_S32;
}
flac->divisor = (1 << flac->shift_bits);
}
#if BGAV_FLAC_VERSION_INT <= MAKE_VERSION(1, 1, 2)
void bg_flac_init_file_encoder(bg_flac_t * flac, FLAC__FileEncoder * enc)
{
init_common(flac);
/* Set compression parameters from presets */
FLAC__file_encoder_set_sample_rate(enc, flac->format->samplerate);
FLAC__file_encoder_set_channels(enc, flac->format->num_channels);
FLAC__file_encoder_set_blocksize(enc,
clevels[flac->clevel].blocksize);
FLAC__file_encoder_set_max_lpc_order(enc,
clevels[flac->clevel].max_lpc_order);
FLAC__file_encoder_set_min_residual_partition_order(enc,
clevels[flac->clevel].min_residual_partition_order);
FLAC__file_encoder_set_max_residual_partition_order(enc,
clevels[flac->clevel].max_residual_partition_order);
if(flac->format->num_channels == 2)
{
FLAC__file_encoder_set_do_mid_side_stereo(enc,
clevels[flac->clevel].do_mid_side);
FLAC__file_encoder_set_loose_mid_side_stereo(enc,
clevels[flac->clevel].loose_mid_side);
}
FLAC__file_encoder_set_do_exhaustive_model_search(enc,
clevels[flac->clevel].do_exhaustive_model_search);
FLAC__file_encoder_set_bits_per_sample(enc, flac->bits_per_sample);
}
#endif
void bg_flac_init_stream_encoder(bg_flac_t * flac, FLAC__StreamEncoder * enc)
{
init_common(flac);
/* Set compression parameters from presets */
FLAC__stream_encoder_set_sample_rate(enc, flac->format->samplerate);
FLAC__stream_encoder_set_channels(enc, flac->format->num_channels);
FLAC__stream_encoder_set_blocksize(enc,
clevels[flac->clevel].blocksize);
FLAC__stream_encoder_set_max_lpc_order(enc,
clevels[flac->clevel].max_lpc_order);
FLAC__stream_encoder_set_min_residual_partition_order(enc,
clevels[flac->clevel].min_residual_partition_order);
FLAC__stream_encoder_set_max_residual_partition_order(enc,
clevels[flac->clevel].max_residual_partition_order);
if(flac->format->num_channels == 2)
{
FLAC__stream_encoder_set_do_mid_side_stereo(enc,
clevels[flac->clevel].do_mid_side);
FLAC__stream_encoder_set_loose_mid_side_stereo(enc,
clevels[flac->clevel].loose_mid_side);
}
FLAC__stream_encoder_set_do_exhaustive_model_search(enc,
clevels[flac->clevel].do_exhaustive_model_search);
/* */
FLAC__stream_encoder_set_compression_level(enc, flac->clevel);
FLAC__stream_encoder_set_bits_per_sample(enc, flac->bits_per_sample);
}
void bg_flac_prepare_audio_frame(bg_flac_t * flac, gavl_audio_frame_t * frame)
......@@ -385,12 +334,12 @@ void bg_flac_free(bg_flac_t * flac)
/* Metadata -> vorbis comment */
#define STR_COMMENT(str, key) \
if(m->str) \
#define STR_COMMENT(gavl_name, key) \
if((val = gavl_metadata_get(m, gavl_name))) \
{ \
memset(&entry, 0, sizeof(entry)); \
entry.entry = (uint8_t*)bg_sprintf("%s=%s", key, m->str); \
entry.length = strlen((char*)(entry.entry)); \
entry.entry = (uint8_t*)bg_sprintf("%s=%s", key, val); \
entry.length = strlen((char*)entry.entry); \
FLAC__metadata_object_vorbiscomment_insert_comment(flac->vorbis_comment, \
num_comments++, \
entry, \
......@@ -398,18 +347,17 @@ void bg_flac_free(bg_flac_t * flac)
free(entry.entry); \
}
#define INT_COMMENT(i, key) \
if(m->i) \
{ \
memset(&entry, 0, sizeof(entry)); \
entry.entry = (uint8_t*)bg_sprintf("%s=%d", key, m->i); \
entry.length = strlen((char*)(entry.entry)); \
FLAC__metadata_object_vorbiscomment_insert_comment(flac->vorbis_comment, \
num_comments++, \
entry, \
1); \
free(entry.entry); \
}
#define INT_COMMENT(num, key) \
{\
memset(&entry, 0, sizeof(entry)); \
entry.entry = (uint8_t*)bg_sprintf("%s=%d", key, num); \
entry.length = strlen((char*)entry.entry); \
FLAC__metadata_object_vorbiscomment_insert_comment(flac->vorbis_comment, \
num_comments++, \
entry, \
1); \
free(entry.entry); \
}
#define RAW_COMMENT(str) \
if(m->str) \
......@@ -424,20 +372,29 @@ void bg_flac_free(bg_flac_t * flac)
free(entry.entry); \
}
void bg_flac_init_metadata(bg_flac_t * flac, const bg_metadata_t * m)
void bg_flac_init_metadata(bg_flac_t * flac, const gavl_metadata_t * m)
{
FLAC__StreamMetadata_VorbisComment_Entry entry;
const char * val;
int num_comments = 0;
int year;
flac->vorbis_comment =
FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
STR_COMMENT(artist, "ARTIST");
STR_COMMENT(title, "TITLE");
STR_COMMENT(album, "ALBUM");
STR_COMMENT(genre, "GENRE");
STR_COMMENT(date, "DATE");
STR_COMMENT(copyright, "COPYRIGHT");
INT_COMMENT(track, "TRACKNUMBER");
RAW_COMMENT(comment);
STR_COMMENT(GAVL_META_ARTIST, "ARTIST");
STR_COMMENT(GAVL_META_TITLE, "TITLE");
STR_COMMENT(GAVL_META_ALBUM, "ALBUM");
STR_COMMENT(GAVL_META_ALBUMARTIST, "ALBUM ARTIST");
STR_COMMENT(GAVL_META_ALBUMARTIST, "ALBUMARTIST");
STR_COMMENT(GAVL_META_GENRE, "GENRE");
/* TODO: Get year */
year = bg_metadata_get_year(m);
if(year > 0)
{
INT_COMMENT(year, "DATE");
}
STR_COMMENT(GAVL_META_COPYRIGHT, "COPYRIGHT");
STR_COMMENT(GAVL_META_TRACKNUMBER, "TRACKNUMBER");
STR_COMMENT(GAVL_META_COMMENT, "COMMENT");
}
......@@ -26,16 +26,26 @@
#include <gmerlin/plugin.h>
#include <gmerlin/translation.h>
#include <gmerlin/charset.h>
#include <gmerlin/log.h>
#define LOG_DOMAIN "shout"
#include <gavl/metatags.h>
#include <bgshout.h>
struct bg_shout_s
{
shout_t * s;
shout_metadata_t * met;
int metadata_sent;
int64_t bytes_sent;
int format;
bg_charset_converter_t * cnv;
};
bg_shout_t * bg_shout_create(int format)
{
......@@ -44,6 +54,11 @@ bg_shout_t * bg_shout_create(int format)
shout_init();
ret->s = shout_new();
ret->format = format;
if(ret->format != SHOUT_FORMAT_OGG)
ret->cnv = bg_charset_converter_create("UTF-8", "ISO-8859-1");
shout_set_format(ret->s, format);
return ret;
}
......@@ -85,16 +100,18 @@ static const bg_parameter_info_t parameters[] =
.name = "name",
.long_name = TRS("Name"),
.type = BG_PARAMETER_STRING,
.val_default = { .val_str = "Test stream" },
},
{
.name = "description",
.long_name = TRS("Description"),
.type = BG_PARAMETER_STRING,
.val_default = { .val_str = "Brought to you by gmerlin" },
},
{ /* */ },
};
const bg_parameter_info_t * bg_shout_get_parameters(bg_shout_t * s)
const bg_parameter_info_t * bg_shout_get_parameters(void)
{
return parameters;
}
......@@ -154,10 +171,11 @@ int bg_shout_open(bg_shout_t * s)
return 1;
}
void bg_shout_set_metadata(bg_shout_t * s, const bg_metadata_t * m)
void bg_shout_set_metadata(bg_shout_t * s, const gavl_metadata_t * m)
{
if(m->genre)
shout_set_genre(s->s, m->genre);
const char * genre;
if((genre = gavl_metadata_get(m, GAVL_META_GENRE)))
shout_set_genre(s->s, genre);
}
void bg_shout_destroy(bg_shout_t * s)
......@@ -165,12 +183,84 @@ void bg_shout_destroy(bg_shout_t * s)
if(shout_get_connected(s->s) == SHOUTERR_CONNECTED)
shout_close(s->s);
shout_free(s->s);
if(s->cnv)
bg_charset_converter_destroy(s->cnv);
free(s);
}
static void flush_metadata(bg_shout_t * s)
{
if(shout_set_metadata(s->s, s->met) != SHOUTERR_SUCCESS)
{
bg_log(BG_LOG_ERROR, LOG_DOMAIN, "Sending metadata failed: %s",
shout_get_error(s->s));
}
shout_metadata_free(s->met);
s->met = NULL;
}
int bg_shout_write(bg_shout_t * s, const uint8_t * data, int len)
{
// fprintf(stderr, "Shout send: %d %ld %p\n", len, s->bytes_sent, s->met);
if(shout_send(s->s, data, len) != SHOUTERR_SUCCESS)
{
bg_log(BG_LOG_ERROR, LOG_DOMAIN, "Sending data failed: %s",
shout_get_error(s->s));
return 0;
}
s->bytes_sent += len;
// if(s->met && (s->bytes_sent > 32000))
// flush_metadata(s);
return len;
}
static void metadata_add(bg_shout_t * s,
const char * name,
const char * val)
{
if(!s->cnv)
shout_metadata_add(s->met, name, val);
else
{
char * tmp_string = bg_convert_string(s->cnv, val, -1, NULL);
shout_metadata_add(s->met, name, tmp_string);
free(tmp_string);
}
}
void bg_shout_update_metadata(bg_shout_t * s, const char * name,
const gavl_metadata_t * m)
{
const char * artist = NULL;
const char * title = NULL;
if(s->met)
shout_metadata_free(s->met);
s->met = shout_metadata_new();
if(m)
{
artist = gavl_metadata_get(m, GAVL_META_ARTIST);
title = gavl_metadata_get(m, GAVL_META_TITLE);
}
if(artist && title)
{
metadata_add(s, "artist", artist);
metadata_add(s, "title", title);
}
else if(name)
{
metadata_add(s, "song", name);
}
else /* Clear everything */
{
metadata_add(s, "song", shout_get_name(s->s));
}
flush_metadata(s);
}
......@@ -25,6 +25,7 @@
#include <gmerlin/utils.h>
#include <gmerlin/charset.h>
#include <gavl/metatags.h>
#define GENRE_MAX 0x94
......@@ -99,19 +100,22 @@ struct bgen_id3v1_s
char data[128];
};
static void set_string(char * dst, char * src, int max_len,
static void set_string(char * dst, const gavl_metadata_t * m,
const char * key, int max_len,
bg_charset_converter_t * cnv)
{
int out_len;
char * tmp_string;
const char * src = gavl_metadata_get(m, key);
if(!src)
return;
tmp_string =
bg_convert_string(cnv,
src, -1, &out_len);
src, -1, &out_len);
if(!tmp_string) /* String could not be converted */
return;
......@@ -122,13 +126,15 @@ static void set_string(char * dst, char * src, int max_len,
free(tmp_string);
}
bgen_id3v1_t * bgen_id3v1_create(const bg_metadata_t * m)
bgen_id3v1_t * bgen_id3v1_create(const gavl_metadata_t * m)
{
int track;
int i;
char * tmp_string;
int year;
bg_charset_converter_t * cnv;
bgen_id3v1_t * ret;
const char * genre;
ret = calloc(1, sizeof(*ret));
ret->data[0] = 'T';
......@@ -137,9 +143,9 @@ bgen_id3v1_t * bgen_id3v1_create(const bg_metadata_t * m)
cnv = bg_charset_converter_create("UTF-8", "ISO-8859-1");
set_string(&ret->data[TITLE_POS], m->title, TITLE_LEN, cnv);
set_string(&ret->data[ARTIST_POS], m->artist, ARTIST_LEN, cnv);
set_string(&ret->data[ALBUM_POS], m->album, ALBUM_LEN, cnv);
set_string(&ret->data[TITLE_POS], m, GAVL_META_TITLE, TITLE_LEN, cnv);
set_string(&ret->data[ARTIST_POS], m, GAVL_META_ARTIST, ARTIST_LEN, cnv);
set_string(&ret->data[ALBUM_POS], m, GAVL_META_ALBUM, ALBUM_LEN, cnv);
/* Year */
......@@ -156,29 +162,32 @@ bgen_id3v1_t * bgen_id3v1_create(const bg_metadata_t * m)
/* Comment */
set_string(&ret->data[COMMENT_POS], m->comment, COMMENT_LEN, cnv);
set_string(&ret->data[COMMENT_POS], m, GAVL_META_COMMENT, COMMENT_LEN, cnv);
/* Track */
if((m->track > 0) && (m->track < 255))
ret->data[TRACK_POS] = m->track;
if(gavl_metadata_get_int(m, GAVL_META_TRACKNUMBER, &track) &&
(track > 0) && (track < 255))
ret->data[TRACK_POS] = track;
/* Genre */
ret->data[GENRE_POS] = 0xff;
if(m->genre)
genre = gavl_metadata_get(m, GAVL_META_GENRE);
if(genre)
{
for(i = 0; i < GENRE_MAX; i++)
{
if(!strcasecmp(m->genre, id3_genres[i]))
if(!strcasecmp(genre, id3_genres[i]))
{
ret->data[GENRE_POS] = i;
break;
}
}
}
bg_charset_converter_destroy(cnv);
return ret;
......
......@@ -25,6 +25,7 @@
#include <gmerlin/charset.h>
#include <gmerlin_encoders.h>
#include <gavl/metatags.h>
/* Simple ID3 writer.
We do the following:
......@@ -90,7 +91,8 @@ struct bgen_id3v2_s
};
static void add_frame(bgen_id3v2_t * tag, uint32_t fourcc, char * string)
static void add_frame(bgen_id3v2_t * tag, uint32_t fourcc,
const char * string)
{
tag->frames = realloc(tag->frames,
(tag->num_frames+1)*sizeof(*(tag->frames)));
......@@ -113,34 +115,36 @@ static void add_frame(bgen_id3v2_t * tag, uint32_t fourcc, char * string)
char * copyright;
*/
#define TEXT_FRAME(str, fcc) if(m->str) { add_frame(ret, fcc, m->str); }
#define INT_FRAME(i, fcc) if(m->i) \
#define TEXT_FRAME(str, key, fcc) \
val = gavl_metadata_get(m, key); \
if(val) \
{ \
tmp_string = bg_sprintf("%d", m->i);\
add_frame(ret, fcc, tmp_string);\
free(tmp_string); \
add_frame(ret, fcc, val); \
}
bgen_id3v2_t * bgen_id3v2_create(const bg_metadata_t * m)
bgen_id3v2_t * bgen_id3v2_create(const gavl_metadata_t * m)
{
int year;
char * tmp_string;
bgen_id3v2_t * ret;
const char * val;
ret = calloc(1, sizeof(*ret));
ret->header.major_version = 4;
ret->header.minor_version = 4;
ret->header.flags = 0;
TEXT_FRAME(artist, MK_FOURCC('T', 'P', 'E', '1'));
TEXT_FRAME(title, MK_FOURCC('T', 'I', 'T', '2'));
TEXT_FRAME(album, MK_FOURCC('T', 'A', 'L', 'B'));
INT_FRAME(track, MK_FOURCC('T', 'R', 'C', 'K'));
TEXT_FRAME(genre, MK_FOURCC('T', 'C', 'O', 'N'));
TEXT_FRAME(author, MK_FOURCC('T', 'C', 'O', 'M'));
TEXT_FRAME(copyright, MK_FOURCC('T', 'C', 'O', 'P'));
TEXT_FRAME(artist, GAVL_META_ARTIST, MK_FOURCC('T', 'P', 'E', '1'));
TEXT_FRAME(albumartist, GAVL_META_ALBUMARTIST, MK_FOURCC('T', 'P', 'E', '2'));
TEXT_FRAME(title, GAVL_META_TITLE, MK_FOURCC('T', 'I', 'T', '2'));
TEXT_FRAME(album, GAVL_META_ALBUM, MK_FOURCC('T', 'A', 'L', 'B'));
TEXT_FRAME(track, GAVL_META_TRACKNUMBER, MK_FOURCC('T', 'R', 'C', 'K'));
TEXT_FRAME(genre, GAVL_META_GENRE, MK_FOURCC('T', 'C', 'O', 'N'));
TEXT_FRAME(author, GAVL_META_AUTHOR, MK_FOURCC('T', 'C', 'O', 'M'));
TEXT_FRAME(copyright, GAVL_META_COPYRIGHT, MK_FOURCC('T', 'C', 'O', 'P'));
year = bg_metadata_get_year(m);
if(year)
......@@ -150,7 +154,7 @@ bgen_id3v2_t * bgen_id3v2_create(const bg_metadata_t * m)
free(tmp_string); \
}
TEXT_FRAME(comment, MK_FOURCC('C', 'O', 'M', 'M'));
TEXT_FRAME(comment, GAVL_META_COMMENT, MK_FOURCC('C', 'O', 'M', 'M'));
return ret;
}
......@@ -219,7 +223,7 @@ static int write_frame(FILE * output, id3v2_frame_t * frame,
return 0;
}
cnv = bg_charset_converter_create("UTF-8", "ISO-8859-1");
str = bg_convert_string(cnv, frame->str, -1, (int*)0);
str = bg_convert_string(cnv, frame->str, -1, NULL );
len = strlen(str)+1;
if(fwrite(str, 1, len, output) < len)
return 0;
......
......@@ -17,18 +17,20 @@ dnl Look for header
found_header="false"
AC_TRY_COMPILE([
#include <libavcodec/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<libavcodec/avcodec.h>" ],)
#include <libavcodec/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<libavcodec/avcodec.h>";VDPAU_HEADER="<libavcodec/vdpau.h>" ],)
if test $found_header = "false"; then
AC_TRY_COMPILE([
#include <avcodec.h>],[],[found_header="true";AVCODEC_HEADER="<avcodec.h>"])
#include <avcodec.h>],[],[found_header="true";AVCODEC_HEADER="<avcodec.h>";VDPAU_HEADER="<vdpau.h>"])
fi
if test $found_header = "false"; then
AC_TRY_COMPILE([
#include <ffmpeg/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<ffmpeg/avcodec.h>" ],)
#include <ffmpeg/avcodec.h>],[], [found_header="true";AVCODEC_HEADER="<ffmpeg/avcodec.h>";VDPAU_HEADER="<vdpau.h>" ],)
fi
AC_CHECK_HEADERS([libavcore/avcore.h])
avcodec_ok="false"
AC_TRY_RUN([
#include <stdio.h>
......@@ -57,6 +59,29 @@ AC_TRY_RUN([
# program could not be run
AC_MSG_RESULT(failed)
])
have_avcodec_img_convert="false"
if test "x$avcodec_ok" = "xtrue"; then
avcodec_swscale_missing="false"
AC_MSG_CHECKING(for img_convert)
AC_TRY_LINK([#include <avcodec.h>],
[img_convert(NULL, 0, NULL, 0, 0, 0);
return 0;],
have_avcodec_img_convert=true
AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
if test "x$have_avcodec_img_convert" != "xtrue"; then
if test "x$have_libswscale" != xtrue; then
avcodec_swscale_missing="true"
avcodec_ok="false"
fi
fi
fi