mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
flac: require a 'newer' flac and remove support for the legacy flac API
This commit is contained in:
parent
fd18185d44
commit
11a8aa91b8
6 changed files with 9 additions and 524 deletions
|
@ -697,7 +697,7 @@ AG_GST_CHECK_FEATURE(ESD, [ESounD sound daemon], esdsink, [
|
|||
dnl *** FLAC ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_FLAC, true)
|
||||
AG_GST_CHECK_FEATURE(FLAC, [FLAC lossless audio], flac, [
|
||||
AG_GST_PKG_CHECK_MODULES(FLAC, flac >= 1.1.3)
|
||||
AG_GST_PKG_CHECK_MODULES(FLAC, flac >= 1.1.4)
|
||||
])
|
||||
|
||||
dnl *** GConf ***
|
||||
|
|
|
@ -660,7 +660,6 @@ GST_FLAC_DEC_CLASS
|
|||
GST_IS_FLAC_DEC
|
||||
GST_IS_FLAC_DEC_CLASS
|
||||
gst_flac_dec_get_type
|
||||
LEGACY_FLAC
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
|
|
@ -130,45 +130,6 @@ static void gst_flac_dec_setup_seekable_decoder (GstFlacDec * flacdec);
|
|||
|
||||
static void gst_flac_dec_setup_stream_decoder (GstFlacDec * flacdec);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamDecoderReadStatus
|
||||
gst_flac_dec_read_seekable (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
||||
static FLAC__SeekableStreamDecoderSeekStatus
|
||||
gst_flac_dec_seek (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 position, void *client_data);
|
||||
static FLAC__SeekableStreamDecoderTellStatus
|
||||
gst_flac_dec_tell (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 * position, void *client_data);
|
||||
static FLAC__SeekableStreamDecoderLengthStatus
|
||||
gst_flac_dec_length (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 * length, void *client_data);
|
||||
static FLAC__bool gst_flac_dec_eof (const FLAC__SeekableStreamDecoder * decoder,
|
||||
void *client_data);
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__byte buffer[], unsigned *bytes, void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus
|
||||
gst_flac_dec_write_seekable (const FLAC__SeekableStreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
const FLAC__int32 * const buffer[], void *client_data);
|
||||
static FLAC__StreamDecoderWriteStatus
|
||||
gst_flac_dec_write_stream (const FLAC__StreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
const FLAC__int32 * const buffer[], void *client_data);
|
||||
static void gst_flac_dec_metadata_callback_seekable (const
|
||||
FLAC__SeekableStreamDecoder * decoder,
|
||||
const FLAC__StreamMetadata * metadata, void *client_data);
|
||||
static void gst_flac_dec_metadata_callback_stream (const FLAC__StreamDecoder *
|
||||
decoder, const FLAC__StreamMetadata * metadata, void *client_data);
|
||||
static void gst_flac_dec_metadata_callback (GstFlacDec * flacdec,
|
||||
const FLAC__StreamMetadata * metadata);
|
||||
static void gst_flac_dec_error_callback_seekable (const
|
||||
FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
static void gst_flac_dec_error_callback_stream (const FLAC__StreamDecoder *
|
||||
decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
#else
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__byte buffer[], size_t * bytes, void *client_data);
|
||||
|
@ -194,7 +155,6 @@ static void gst_flac_dec_metadata_callback_stream (const FLAC__StreamDecoder *
|
|||
decoder, const FLAC__StreamMetadata * metadata, void *client_data);
|
||||
static void gst_flac_dec_error_callback_stream (const FLAC__StreamDecoder *
|
||||
decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
|
||||
#endif
|
||||
|
||||
GST_BOILERPLATE (GstFlacDec, gst_flac_dec, GstElement, GST_TYPE_ELEMENT);
|
||||
|
||||
|
@ -299,11 +259,7 @@ static void
|
|||
gst_flac_dec_reset_decoders (GstFlacDec * flacdec)
|
||||
{
|
||||
if (flacdec->seekable_decoder) {
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_decoder_delete (flacdec->seekable_decoder);
|
||||
#else
|
||||
FLAC__stream_decoder_delete (flacdec->seekable_decoder);
|
||||
#endif
|
||||
flacdec->seekable_decoder = NULL;
|
||||
}
|
||||
|
||||
|
@ -350,36 +306,12 @@ gst_flac_dec_setup_seekable_decoder (GstFlacDec * dec)
|
|||
gst_tag_list_add (dec->tags, GST_TAG_MERGE_REPLACE,
|
||||
GST_TAG_AUDIO_CODEC, "FLAC", NULL);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
dec->seekable_decoder = FLAC__seekable_stream_decoder_new ();
|
||||
|
||||
FLAC__seekable_stream_decoder_set_read_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_read_seekable);
|
||||
FLAC__seekable_stream_decoder_set_seek_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_seek);
|
||||
FLAC__seekable_stream_decoder_set_tell_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_tell);
|
||||
FLAC__seekable_stream_decoder_set_length_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_length);
|
||||
FLAC__seekable_stream_decoder_set_eof_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_eof);
|
||||
FLAC__seekable_stream_decoder_set_write_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_write_seekable);
|
||||
FLAC__seekable_stream_decoder_set_metadata_respond (dec->seekable_decoder,
|
||||
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__seekable_stream_decoder_set_metadata_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_metadata_callback_seekable);
|
||||
FLAC__seekable_stream_decoder_set_error_callback (dec->seekable_decoder,
|
||||
gst_flac_dec_error_callback_seekable);
|
||||
FLAC__seekable_stream_decoder_set_client_data (dec->seekable_decoder, dec);
|
||||
#else
|
||||
dec->seekable_decoder = FLAC__stream_decoder_new ();
|
||||
FLAC__stream_decoder_set_metadata_respond (dec->seekable_decoder,
|
||||
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__stream_decoder_set_metadata_respond (dec->seekable_decoder,
|
||||
FLAC__METADATA_TYPE_PICTURE);
|
||||
FLAC__stream_decoder_set_md5_checking (dec->seekable_decoder, false); /* no point calculating since it's never checked here */
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -395,25 +327,11 @@ gst_flac_dec_setup_stream_decoder (GstFlacDec * dec)
|
|||
|
||||
dec->stream_decoder = FLAC__stream_decoder_new ();
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__stream_decoder_set_read_callback (dec->stream_decoder,
|
||||
gst_flac_dec_read_stream);
|
||||
FLAC__stream_decoder_set_write_callback (dec->stream_decoder,
|
||||
gst_flac_dec_write_stream);
|
||||
FLAC__stream_decoder_set_metadata_respond (dec->stream_decoder,
|
||||
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__stream_decoder_set_metadata_callback (dec->stream_decoder,
|
||||
gst_flac_dec_metadata_callback_stream);
|
||||
FLAC__stream_decoder_set_error_callback (dec->stream_decoder,
|
||||
gst_flac_dec_error_callback_stream);
|
||||
FLAC__stream_decoder_set_client_data (dec->stream_decoder, dec);
|
||||
#else
|
||||
FLAC__stream_decoder_set_md5_checking (dec->stream_decoder, false); /* no point calculating since it's never checked here */
|
||||
FLAC__stream_decoder_set_metadata_respond (dec->stream_decoder,
|
||||
FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
FLAC__stream_decoder_set_metadata_respond (dec->stream_decoder,
|
||||
FLAC__METADATA_TYPE_PICTURE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -637,8 +555,6 @@ gst_flac_dec_scan_for_last_block (GstFlacDec * flacdec, gint64 * samples)
|
|||
}
|
||||
}
|
||||
|
||||
/* FIXME: remove ifndef once we depend on flac >= 1.2.x */
|
||||
#ifndef LEGACY_FLAC
|
||||
static void
|
||||
gst_flac_extract_picture_buffer (GstFlacDec * dec,
|
||||
const FLAC__StreamMetadata * metadata)
|
||||
|
@ -667,7 +583,6 @@ gst_flac_extract_picture_buffer (GstFlacDec * dec,
|
|||
gst_tag_list_free (tags);
|
||||
}
|
||||
}
|
||||
#endif /* LEGACY_FLAC */
|
||||
|
||||
static void
|
||||
gst_flac_dec_metadata_callback (GstFlacDec * flacdec,
|
||||
|
@ -715,14 +630,10 @@ gst_flac_dec_metadata_callback (GstFlacDec * flacdec,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* FIXME: remove ifndef once we depend on flac >= 1.2.x */
|
||||
#ifndef LEGACY_FLAC
|
||||
case FLAC__METADATA_TYPE_PICTURE:{
|
||||
gst_flac_extract_picture_buffer (flacdec, metadata);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case FLAC__METADATA_TYPE_VORBIS_COMMENT:
|
||||
gst_flac_dec_update_metadata (flacdec, metadata);
|
||||
break;
|
||||
|
@ -731,17 +642,6 @@ gst_flac_dec_metadata_callback (GstFlacDec * flacdec,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static void
|
||||
gst_flac_dec_metadata_callback_seekable (const FLAC__SeekableStreamDecoder * d,
|
||||
const FLAC__StreamMetadata * metadata, void *client_data)
|
||||
{
|
||||
GstFlacDec *dec = GST_FLAC_DEC (client_data);
|
||||
|
||||
gst_flac_dec_metadata_callback (dec, metadata);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gst_flac_dec_metadata_callback_stream (const FLAC__StreamDecoder * decoder,
|
||||
const FLAC__StreamMetadata * metadata, void *client_data)
|
||||
|
@ -776,15 +676,6 @@ gst_flac_dec_error_callback (GstFlacDec * dec,
|
|||
dec->last_flow = GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static void
|
||||
gst_flac_dec_error_callback_seekable (const FLAC__SeekableStreamDecoder * d,
|
||||
FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||
{
|
||||
gst_flac_dec_error_callback (GST_FLAC_DEC (client_data), status);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
gst_flac_dec_error_callback_stream (const FLAC__StreamDecoder * d,
|
||||
FLAC__StreamDecoderErrorStatus status, void *client_data)
|
||||
|
@ -792,15 +683,9 @@ gst_flac_dec_error_callback_stream (const FLAC__StreamDecoder * d,
|
|||
gst_flac_dec_error_callback (GST_FLAC_DEC (client_data), status);
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamDecoderSeekStatus
|
||||
gst_flac_dec_seek (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 position, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamDecoderSeekStatus
|
||||
gst_flac_dec_seek (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__uint64 position, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
|
||||
|
@ -809,22 +694,12 @@ gst_flac_dec_seek (const FLAC__StreamDecoder * decoder,
|
|||
GST_DEBUG_OBJECT (flacdec, "seek %" G_GINT64_FORMAT, position);
|
||||
flacdec->offset = position;
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_SEEK_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamDecoderTellStatus
|
||||
gst_flac_dec_tell (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 * position, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamDecoderTellStatus
|
||||
gst_flac_dec_tell (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__uint64 * position, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
|
||||
|
@ -834,22 +709,12 @@ gst_flac_dec_tell (const FLAC__StreamDecoder * decoder,
|
|||
|
||||
GST_DEBUG_OBJECT (flacdec, "tell %" G_GINT64_FORMAT, *position);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_TELL_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamDecoderLengthStatus
|
||||
gst_flac_dec_length (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__uint64 * length, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamDecoderLengthStatus
|
||||
gst_flac_dec_length (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__uint64 * length, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
GstFormat fmt = GST_FORMAT_BYTES;
|
||||
|
@ -859,39 +724,22 @@ gst_flac_dec_length (const FLAC__StreamDecoder * decoder,
|
|||
flacdec = GST_FLAC_DEC (client_data);
|
||||
|
||||
if (!(peer = gst_pad_get_peer (flacdec->sinkpad)))
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
|
||||
#endif
|
||||
|
||||
gst_pad_query_duration (peer, &fmt, &len);
|
||||
gst_object_unref (peer);
|
||||
if (fmt != GST_FORMAT_BYTES || len == -1)
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_ERROR;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
|
||||
#endif
|
||||
|
||||
*length = len;
|
||||
|
||||
GST_DEBUG_OBJECT (flacdec, "encoded byte length %" G_GINT64_FORMAT, *length);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_LENGTH_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__bool
|
||||
gst_flac_dec_eof (const FLAC__SeekableStreamDecoder * decoder,
|
||||
void *client_data)
|
||||
#else
|
||||
static FLAC__bool
|
||||
gst_flac_dec_eof (const FLAC__StreamDecoder * decoder, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
GstFormat fmt;
|
||||
|
@ -920,15 +768,9 @@ gst_flac_dec_eof (const FLAC__StreamDecoder * decoder, void *client_data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamDecoderReadStatus
|
||||
gst_flac_dec_read_seekable (const FLAC__SeekableStreamDecoder * decoder,
|
||||
FLAC__byte buffer[], unsigned *bytes, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__byte buffer[], size_t * bytes, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
|
||||
|
@ -938,11 +780,7 @@ gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
|||
|
||||
if (gst_pad_pull_range (flacdec->sinkpad, flacdec->offset, *bytes,
|
||||
&buf) != GST_FLOW_OK)
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_ERROR;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
|
||||
#endif
|
||||
|
||||
GST_DEBUG_OBJECT (flacdec, "Read %d bytes at %" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_SIZE (buf), flacdec->offset);
|
||||
|
@ -951,22 +789,12 @@ gst_flac_dec_read_seekable (const FLAC__StreamDecoder * decoder,
|
|||
gst_buffer_unref (buf);
|
||||
flacdec->offset += *bytes;
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__byte buffer[], unsigned *bytes, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamDecoderReadStatus
|
||||
gst_flac_dec_read_stream (const FLAC__StreamDecoder * decoder,
|
||||
FLAC__byte buffer[], size_t * bytes, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacDec *dec = GST_FLAC_DEC (client_data);
|
||||
guint len;
|
||||
|
@ -1201,16 +1029,6 @@ done:
|
|||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__StreamDecoderWriteStatus
|
||||
gst_flac_dec_write_seekable (const FLAC__SeekableStreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
const FLAC__int32 * const buffer[], void *client_data)
|
||||
{
|
||||
return gst_flac_dec_write (GST_FLAC_DEC (client_data), frame, buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
static FLAC__StreamDecoderWriteStatus
|
||||
gst_flac_dec_write_stream (const FLAC__StreamDecoder * decoder,
|
||||
const FLAC__Frame * frame,
|
||||
|
@ -1223,24 +1041,14 @@ static void
|
|||
gst_flac_dec_loop (GstPad * sinkpad)
|
||||
{
|
||||
GstFlacDec *flacdec;
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__SeekableStreamDecoderState s;
|
||||
#else
|
||||
FLAC__StreamDecoderState s;
|
||||
FLAC__StreamDecoderInitStatus is;
|
||||
#endif
|
||||
|
||||
flacdec = GST_FLAC_DEC (GST_OBJECT_PARENT (sinkpad));
|
||||
|
||||
GST_LOG_OBJECT (flacdec, "entering loop");
|
||||
|
||||
if (flacdec->init) {
|
||||
#ifdef LEGACY_FLAC
|
||||
GST_DEBUG_OBJECT (flacdec, "initializing legacy decoder");
|
||||
s = FLAC__seekable_stream_decoder_init (flacdec->seekable_decoder);
|
||||
if (s != FLAC__SEEKABLE_STREAM_DECODER_OK)
|
||||
goto analyze_state;
|
||||
#else
|
||||
GST_DEBUG_OBJECT (flacdec, "initializing new decoder");
|
||||
is = FLAC__stream_decoder_init_stream (flacdec->seekable_decoder,
|
||||
gst_flac_dec_read_seekable, gst_flac_dec_seek, gst_flac_dec_tell,
|
||||
|
@ -1249,7 +1057,7 @@ gst_flac_dec_loop (GstPad * sinkpad)
|
|||
gst_flac_dec_error_callback_stream, flacdec);
|
||||
if (is != FLAC__STREAM_DECODER_INIT_STATUS_OK)
|
||||
goto analyze_state;
|
||||
#endif
|
||||
|
||||
/* FLAC__seekable_stream_decoder_process_metadata (flacdec->seekable_decoder); */
|
||||
flacdec->init = FALSE;
|
||||
}
|
||||
|
@ -1259,29 +1067,17 @@ gst_flac_dec_loop (GstPad * sinkpad)
|
|||
flacdec->last_flow = GST_FLOW_OK;
|
||||
|
||||
GST_LOG_OBJECT (flacdec, "processing single");
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_decoder_process_single (flacdec->seekable_decoder);
|
||||
#else
|
||||
FLAC__stream_decoder_process_single (flacdec->seekable_decoder);
|
||||
#endif
|
||||
|
||||
analyze_state:
|
||||
|
||||
GST_LOG_OBJECT (flacdec, "done processing, checking encoder state");
|
||||
#ifdef LEGACY_FLAC
|
||||
s = FLAC__seekable_stream_decoder_get_state (flacdec->seekable_decoder);
|
||||
#else
|
||||
s = FLAC__stream_decoder_get_state (flacdec->seekable_decoder);
|
||||
#endif
|
||||
switch (s) {
|
||||
#ifdef LEGACY_FLAC
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_OK:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_SEEKING:
|
||||
#else
|
||||
case FLAC__STREAM_DECODER_SEARCH_FOR_METADATA:
|
||||
case FLAC__STREAM_DECODER_READ_METADATA:
|
||||
case FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC:
|
||||
case FLAC__STREAM_DECODER_READ_FRAME:
|
||||
#endif
|
||||
{
|
||||
GST_DEBUG_OBJECT (flacdec, "everything ok");
|
||||
|
||||
|
@ -1314,17 +1110,9 @@ analyze_state:
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM:{
|
||||
#else
|
||||
case FLAC__STREAM_DECODER_END_OF_STREAM:{
|
||||
#endif
|
||||
GST_DEBUG_OBJECT (flacdec, "EOS");
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_decoder_reset (flacdec->seekable_decoder);
|
||||
#else
|
||||
FLAC__stream_decoder_reset (flacdec->seekable_decoder);
|
||||
#endif
|
||||
|
||||
if ((flacdec->segment.flags & GST_SEEK_FLAG_SEGMENT) != 0) {
|
||||
if (flacdec->segment.duration > 0) {
|
||||
|
@ -1338,31 +1126,16 @@ analyze_state:
|
|||
goto eos_and_pause;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_INVALID_CALLBACK:
|
||||
case FLAC__SEEKABLE_STREAM_DECODER_UNINITIALIZED:
|
||||
#else
|
||||
case FLAC__STREAM_DECODER_OGG_ERROR:
|
||||
case FLAC__STREAM_DECODER_SEEK_ERROR:
|
||||
case FLAC__STREAM_DECODER_ABORTED:
|
||||
case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR:
|
||||
case FLAC__STREAM_DECODER_UNINITIALIZED:
|
||||
#endif
|
||||
default:{
|
||||
/* fixme: this error sucks -- should try to figure out when/if an more
|
||||
specific error was already sent via the callback */
|
||||
#ifdef LEGACY_FLAC
|
||||
GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, (NULL),
|
||||
("%s", FLAC__SeekableStreamDecoderStateString[s]));
|
||||
#else
|
||||
GST_ELEMENT_ERROR (flacdec, STREAM, DECODE, (NULL),
|
||||
("%s", FLAC__StreamDecoderStateString[s]));
|
||||
#endif
|
||||
goto eos_and_pause;
|
||||
}
|
||||
}
|
||||
|
@ -1461,8 +1234,8 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
|
|||
gst_adapter_available (dec->adapter));
|
||||
if (dec->init == FALSE) {
|
||||
if (gst_adapter_available (dec->adapter) > 0) {
|
||||
FLAC__stream_decoder_process_until_end_of_stream (dec->
|
||||
stream_decoder);
|
||||
FLAC__stream_decoder_process_until_end_of_stream
|
||||
(dec->stream_decoder);
|
||||
}
|
||||
FLAC__stream_decoder_flush (dec->stream_decoder);
|
||||
}
|
||||
|
@ -1483,11 +1256,7 @@ gst_flac_dec_sink_event (GstPad * pad, GstEvent * event)
|
|||
static GstFlowReturn
|
||||
gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||
{
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__StreamDecoderState s;
|
||||
#else
|
||||
FLAC__StreamDecoderInitStatus s;
|
||||
#endif
|
||||
GstFlacDec *dec;
|
||||
gboolean got_audio_frame;
|
||||
|
||||
|
@ -1499,13 +1268,6 @@ gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
|
|||
|
||||
if (dec->init) {
|
||||
GST_DEBUG_OBJECT (dec, "initializing decoder");
|
||||
#ifdef LEGACY_FLAC
|
||||
s = FLAC__stream_decoder_init (dec->stream_decoder);
|
||||
if (s != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) {
|
||||
GST_ELEMENT_ERROR (GST_ELEMENT (dec), LIBRARY, INIT, (NULL), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
#else
|
||||
s = FLAC__stream_decoder_init_stream (dec->stream_decoder,
|
||||
gst_flac_dec_read_stream, NULL, NULL, NULL, NULL,
|
||||
gst_flac_dec_write_stream, gst_flac_dec_metadata_callback_stream,
|
||||
|
@ -1514,7 +1276,6 @@ gst_flac_dec_chain (GstPad * pad, GstBuffer * buf)
|
|||
GST_ELEMENT_ERROR (GST_ELEMENT (dec), LIBRARY, INIT, (NULL), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
#endif
|
||||
GST_DEBUG_OBJECT (dec, "initialized (framed=%d)", dec->framed);
|
||||
dec->init = FALSE;
|
||||
}
|
||||
|
@ -1995,14 +1756,8 @@ gst_flac_dec_handle_seek_event (GstFlacDec * flacdec, GstEvent * event)
|
|||
* callbacks that need to behave differently when seeking */
|
||||
flacdec->seeking = TRUE;
|
||||
|
||||
seek_ok =
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_decoder_seek_absolute (flacdec->seekable_decoder,
|
||||
seek_ok = FLAC__stream_decoder_seek_absolute (flacdec->seekable_decoder,
|
||||
flacdec->segment.last_stop);
|
||||
#else
|
||||
FLAC__stream_decoder_seek_absolute (flacdec->seekable_decoder,
|
||||
flacdec->segment.last_stop);
|
||||
#endif
|
||||
|
||||
flacdec->seeking = FALSE;
|
||||
|
||||
|
|
|
@ -27,12 +27,6 @@
|
|||
|
||||
#include <FLAC/all.h>
|
||||
|
||||
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
|
||||
#define LEGACY_FLAC
|
||||
#else
|
||||
#undef LEGACY_FLAC
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_FLAC_DEC gst_flac_dec_get_type()
|
||||
|
|
|
@ -178,18 +178,6 @@ static void gst_flac_enc_get_property (GObject * object, guint prop_id,
|
|||
static GstStateChangeReturn gst_flac_enc_change_state (GstElement * element,
|
||||
GstStateChange transition);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__StreamEncoderWriteStatus
|
||||
gst_flac_enc_write_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
const FLAC__byte buffer[], unsigned bytes,
|
||||
unsigned samples, unsigned current_frame, void *client_data);
|
||||
static FLAC__SeekableStreamEncoderSeekStatus
|
||||
gst_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
FLAC__uint64 absolute_byte_offset, void *client_data);
|
||||
static FLAC__SeekableStreamEncoderTellStatus
|
||||
gst_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
FLAC__uint64 * absolute_byte_offset, void *client_data);
|
||||
#else
|
||||
static FLAC__StreamEncoderWriteStatus
|
||||
gst_flac_enc_write_callback (const FLAC__StreamEncoder * encoder,
|
||||
const FLAC__byte buffer[], size_t bytes,
|
||||
|
@ -200,7 +188,6 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder,
|
|||
static FLAC__StreamEncoderTellStatus
|
||||
gst_flac_enc_tell_callback (const FLAC__StreamEncoder * encoder,
|
||||
FLAC__uint64 * absolute_byte_offset, void *client_data);
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -392,11 +379,7 @@ gst_flac_enc_init (GstFlacEnc * flacenc, GstFlacEncClass * klass)
|
|||
gst_pad_use_fixed_caps (flacenc->srcpad);
|
||||
gst_element_add_pad (GST_ELEMENT (flacenc), flacenc->srcpad);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
flacenc->encoder = FLAC__seekable_stream_encoder_new ();
|
||||
#else
|
||||
flacenc->encoder = FLAC__stream_encoder_new ();
|
||||
#endif
|
||||
|
||||
flacenc->offset = 0;
|
||||
flacenc->samples_written = 0;
|
||||
|
@ -414,11 +397,7 @@ gst_flac_enc_finalize (GObject * object)
|
|||
GstFlacEnc *flacenc = GST_FLAC_ENC (object);
|
||||
|
||||
gst_tag_list_free (flacenc->tags);
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_delete (flacenc->encoder);
|
||||
#else
|
||||
FLAC__stream_encoder_delete (flacenc->encoder);
|
||||
#endif
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -463,13 +442,9 @@ gst_flac_enc_set_metadata (GstFlacEnc * flacenc)
|
|||
FLAC__metadata_object_new (FLAC__METADATA_TYPE_VORBIS_COMMENT);
|
||||
gst_tag_list_foreach (copy, add_one_tag, flacenc);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
if (FLAC__seekable_stream_encoder_set_metadata (flacenc->encoder,
|
||||
flacenc->meta, 1) != true)
|
||||
#else
|
||||
if (FLAC__stream_encoder_set_metadata (flacenc->encoder,
|
||||
flacenc->meta, 1) != true)
|
||||
#endif
|
||||
|
||||
g_warning ("Dude, i'm already initialized!");
|
||||
gst_tag_list_free (copy);
|
||||
}
|
||||
|
@ -606,24 +581,13 @@ gst_flac_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
GstFlacEnc *flacenc;
|
||||
GstStructure *structure;
|
||||
guint64 total_samples = GST_CLOCK_TIME_NONE;
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__SeekableStreamEncoderState state;
|
||||
#else
|
||||
FLAC__StreamEncoderInitStatus init_status;
|
||||
#endif
|
||||
gint depth, chans, rate, width;
|
||||
|
||||
flacenc = GST_FLAC_ENC (gst_pad_get_parent (pad));
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) !=
|
||||
FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED)
|
||||
#else
|
||||
if (FLAC__stream_encoder_get_state (flacenc->encoder) !=
|
||||
FLAC__STREAM_ENCODER_UNINITIALIZED)
|
||||
#endif
|
||||
|
||||
goto encoder_already_initialized;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
@ -652,27 +616,6 @@ gst_flac_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
total_samples = gst_flac_enc_query_peer_total_samples (flacenc, pad);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_bits_per_sample (flacenc->encoder,
|
||||
flacenc->depth);
|
||||
FLAC__seekable_stream_encoder_set_sample_rate (flacenc->encoder,
|
||||
flacenc->sample_rate);
|
||||
FLAC__seekable_stream_encoder_set_channels (flacenc->encoder,
|
||||
flacenc->channels);
|
||||
|
||||
if (total_samples != GST_CLOCK_TIME_NONE)
|
||||
FLAC__seekable_stream_encoder_set_total_samples_estimate (flacenc->encoder,
|
||||
total_samples);
|
||||
|
||||
FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder,
|
||||
gst_flac_enc_write_callback);
|
||||
FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder,
|
||||
gst_flac_enc_seek_callback);
|
||||
FLAC__seekable_stream_encoder_set_tell_callback (flacenc->encoder,
|
||||
gst_flac_enc_tell_callback);
|
||||
|
||||
FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc);
|
||||
#else
|
||||
FLAC__stream_encoder_set_bits_per_sample (flacenc->encoder, flacenc->depth);
|
||||
FLAC__stream_encoder_set_sample_rate (flacenc->encoder, flacenc->sample_rate);
|
||||
FLAC__stream_encoder_set_channels (flacenc->encoder, flacenc->channels);
|
||||
|
@ -680,21 +623,14 @@ gst_flac_enc_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
if (total_samples != GST_CLOCK_TIME_NONE)
|
||||
FLAC__stream_encoder_set_total_samples_estimate (flacenc->encoder,
|
||||
total_samples);
|
||||
#endif
|
||||
|
||||
gst_flac_enc_set_metadata (flacenc);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
state = FLAC__seekable_stream_encoder_init (flacenc->encoder);
|
||||
if (state != FLAC__STREAM_ENCODER_OK)
|
||||
goto failed_to_initialize;
|
||||
#else
|
||||
init_status = FLAC__stream_encoder_init_stream (flacenc->encoder,
|
||||
gst_flac_enc_write_callback, gst_flac_enc_seek_callback,
|
||||
gst_flac_enc_tell_callback, NULL, flacenc);
|
||||
if (init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
|
||||
goto failed_to_initialize;
|
||||
#endif
|
||||
|
||||
gst_object_unref (flacenc);
|
||||
|
||||
|
@ -728,18 +664,6 @@ gst_flac_enc_update_quality (GstFlacEnc * flacenc, gint quality)
|
|||
{
|
||||
flacenc->quality = quality;
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
#define DO_UPDATE(name, val, str) \
|
||||
G_STMT_START { \
|
||||
if (FLAC__seekable_stream_encoder_get_##name (flacenc->encoder) != \
|
||||
flacenc_params[quality].val) { \
|
||||
FLAC__seekable_stream_encoder_set_##name (flacenc->encoder, \
|
||||
flacenc_params[quality].val); \
|
||||
g_object_notify (G_OBJECT (flacenc), str); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#else
|
||||
#define DO_UPDATE(name, val, str) \
|
||||
G_STMT_START { \
|
||||
if (FLAC__stream_encoder_get_##name (flacenc->encoder) != \
|
||||
|
@ -750,8 +674,6 @@ gst_flac_enc_update_quality (GstFlacEnc * flacenc, gint quality)
|
|||
} \
|
||||
} G_STMT_END
|
||||
|
||||
#endif
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (flacenc));
|
||||
|
||||
if (flacenc->channels == 2 || flacenc->channels == 0) {
|
||||
|
@ -781,15 +703,9 @@ gst_flac_enc_update_quality (GstFlacEnc * flacenc, gint quality)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamEncoderSeekStatus
|
||||
gst_flac_enc_seek_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamEncoderSeekStatus
|
||||
gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder,
|
||||
FLAC__uint64 absolute_byte_offset, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacEnc *flacenc;
|
||||
GstEvent *event;
|
||||
|
@ -798,11 +714,8 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder,
|
|||
flacenc = GST_FLAC_ENC (client_data);
|
||||
|
||||
if (flacenc->stopped)
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
|
||||
#endif
|
||||
|
||||
event = gst_event_new_new_segment (TRUE, 1.0, GST_FORMAT_BYTES,
|
||||
absolute_byte_offset, GST_BUFFER_OFFSET_NONE, 0);
|
||||
|
||||
|
@ -817,12 +730,7 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder,
|
|||
} else {
|
||||
GST_DEBUG ("Seek to %" G_GUINT64_FORMAT " %s", absolute_byte_offset,
|
||||
"failed");
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_ERROR;
|
||||
#else
|
||||
return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
|
||||
#endif
|
||||
|
||||
}
|
||||
} else {
|
||||
GST_DEBUG ("Seek to %" G_GUINT64_FORMAT " failed (no peer pad)",
|
||||
|
@ -830,11 +738,7 @@ gst_flac_enc_seek_callback (const FLAC__StreamEncoder * encoder,
|
|||
}
|
||||
|
||||
flacenc->offset = absolute_byte_offset;
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -959,17 +863,10 @@ push_headers:
|
|||
gst_caps_unref (caps);
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__StreamEncoderWriteStatus
|
||||
gst_flac_enc_write_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
const FLAC__byte buffer[], unsigned bytes,
|
||||
unsigned samples, unsigned current_frame, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamEncoderWriteStatus
|
||||
gst_flac_enc_write_callback (const FLAC__StreamEncoder * encoder,
|
||||
const FLAC__byte buffer[], size_t bytes,
|
||||
unsigned samples, unsigned current_frame, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstFlacEnc *flacenc;
|
||||
|
@ -1048,25 +945,15 @@ out:
|
|||
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
|
||||
}
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
static FLAC__SeekableStreamEncoderTellStatus
|
||||
gst_flac_enc_tell_callback (const FLAC__SeekableStreamEncoder * encoder,
|
||||
FLAC__uint64 * absolute_byte_offset, void *client_data)
|
||||
#else
|
||||
static FLAC__StreamEncoderTellStatus
|
||||
gst_flac_enc_tell_callback (const FLAC__StreamEncoder * encoder,
|
||||
FLAC__uint64 * absolute_byte_offset, void *client_data)
|
||||
#endif
|
||||
{
|
||||
GstFlacEnc *flacenc = GST_FLAC_ENC (client_data);
|
||||
|
||||
*absolute_byte_offset = flacenc->offset;
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK;
|
||||
#else
|
||||
return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1110,11 +997,7 @@ gst_flac_enc_sink_event (GstPad * pad, GstEvent * event)
|
|||
break;
|
||||
}
|
||||
case GST_EVENT_EOS:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
#else
|
||||
FLAC__stream_encoder_finish (flacenc->encoder);
|
||||
#endif
|
||||
ret = gst_pad_event_default (pad, event);
|
||||
break;
|
||||
case GST_EVENT_TAG:
|
||||
|
@ -1230,13 +1113,8 @@ gst_flac_enc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
res = FLAC__seekable_stream_encoder_process_interleaved (flacenc->encoder,
|
||||
(const FLAC__int32 *) data, samples / flacenc->channels);
|
||||
#else
|
||||
res = FLAC__stream_encoder_process_interleaved (flacenc->encoder,
|
||||
(const FLAC__int32 *) data, samples / flacenc->channels);
|
||||
#endif
|
||||
|
||||
g_free (data);
|
||||
|
||||
|
@ -1263,112 +1141,52 @@ gst_flac_enc_set_property (GObject * object, guint prop_id,
|
|||
gst_flac_enc_update_quality (this, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_STREAMABLE_SUBSET:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_streamable_subset (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_streamable_subset (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MID_SIDE_STEREO:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_do_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_do_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_LOOSE_MID_SIDE_STEREO:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_loose_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_loose_mid_side_stereo (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_BLOCKSIZE:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_blocksize (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_blocksize (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MAX_LPC_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_max_lpc_order (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_max_lpc_order (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_QLP_COEFF_PRECISION:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_qlp_coeff_precision (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_qlp_coeff_precision (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_QLP_COEFF_PREC_SEARCH:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_do_qlp_coeff_prec_search (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_ESCAPE_CODING:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_do_escape_coding (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_do_escape_coding (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_EXHAUSTIVE_MODEL_SEARCH:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_do_exhaustive_model_search
|
||||
(this->encoder, g_value_get_boolean (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_do_exhaustive_model_search (this->encoder,
|
||||
g_value_get_boolean (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MIN_RESIDUAL_PARTITION_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_min_residual_partition_order
|
||||
(this->encoder, g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_min_residual_partition_order (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MAX_RESIDUAL_PARTITION_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_max_residual_partition_order
|
||||
(this->encoder, g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_max_residual_partition_order (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
case PROP_RICE_PARAMETER_SEARCH_DIST:
|
||||
#ifdef LEGACY_FLAC
|
||||
FLAC__seekable_stream_encoder_set_rice_parameter_search_dist
|
||||
(this->encoder, g_value_get_uint (value));
|
||||
#else
|
||||
FLAC__stream_encoder_set_rice_parameter_search_dist (this->encoder,
|
||||
g_value_get_uint (value));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -1391,121 +1209,54 @@ gst_flac_enc_get_property (GObject * object, guint prop_id,
|
|||
g_value_set_enum (value, this->quality);
|
||||
break;
|
||||
case PROP_STREAMABLE_SUBSET:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_streamable_subset (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MID_SIDE_STEREO:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_do_mid_side_stereo (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_LOOSE_MID_SIDE_STEREO:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_loose_mid_side_stereo
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_loose_mid_side_stereo (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_BLOCKSIZE:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_blocksize (this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_blocksize (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MAX_LPC_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_max_lpc_order (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_QLP_COEFF_PRECISION:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_qlp_coeff_precision
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_qlp_coeff_precision (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_QLP_COEFF_PREC_SEARCH:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_do_qlp_coeff_prec_search (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_ESCAPE_CODING:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_do_escape_coding (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_EXHAUSTIVE_MODEL_SEARCH:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_boolean (value,
|
||||
FLAC__seekable_stream_encoder_get_do_exhaustive_model_search
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_boolean (value,
|
||||
FLAC__stream_encoder_get_do_exhaustive_model_search (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MIN_RESIDUAL_PARTITION_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_min_residual_partition_order
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_min_residual_partition_order
|
||||
(this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_MAX_RESIDUAL_PARTITION_ORDER:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_max_residual_partition_order
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_max_residual_partition_order
|
||||
(this->encoder));
|
||||
#endif
|
||||
break;
|
||||
case PROP_RICE_PARAMETER_SEARCH_DIST:
|
||||
#ifdef LEGACY_FLAC
|
||||
g_value_set_uint (value,
|
||||
FLAC__seekable_stream_encoder_get_rice_parameter_search_dist
|
||||
(this->encoder));
|
||||
#else
|
||||
g_value_set_uint (value,
|
||||
FLAC__stream_encoder_get_rice_parameter_search_dist (this->encoder));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -1540,19 +1291,11 @@ gst_flac_enc_change_state (GstElement * element, GstStateChange transition)
|
|||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||
break;
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
#ifdef LEGACY_FLAC
|
||||
if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) !=
|
||||
FLAC__STREAM_ENCODER_UNINITIALIZED) {
|
||||
flacenc->stopped = TRUE;
|
||||
FLAC__seekable_stream_encoder_finish (flacenc->encoder);
|
||||
}
|
||||
#else
|
||||
if (FLAC__stream_encoder_get_state (flacenc->encoder) !=
|
||||
FLAC__STREAM_ENCODER_UNINITIALIZED) {
|
||||
flacenc->stopped = TRUE;
|
||||
FLAC__stream_encoder_finish (flacenc->encoder);
|
||||
}
|
||||
#endif
|
||||
flacenc->offset = 0;
|
||||
flacenc->samples_written = 0;
|
||||
flacenc->channels = 0;
|
||||
|
|
|
@ -25,12 +25,6 @@
|
|||
|
||||
#include <FLAC/all.h>
|
||||
|
||||
#if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT < 8
|
||||
#define LEGACY_FLAC
|
||||
#else
|
||||
#undef LEGACY_FLAC
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_FLAC_ENC (gst_flac_enc_get_type())
|
||||
|
|
Loading…
Reference in a new issue