Compare commits
2 Commits
1a9b32ee7a
...
4cbe796774
Author | SHA1 | Date | |
---|---|---|---|
|
4cbe796774 | ||
|
326b491fde |
@ -15,7 +15,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
# USA.
|
# USA.
|
||||||
|
|
||||||
AM_CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
|
AM_CFLAGS = -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 @libpng_CFLAGS@ @opus_CFLAGS@
|
||||||
|
|
||||||
SUBDIRS=po
|
SUBDIRS=po
|
||||||
|
|
||||||
@ -62,7 +62,8 @@ minidlnad_LDADD = \
|
|||||||
@LIBEXIF_LIBS@ \
|
@LIBEXIF_LIBS@ \
|
||||||
@LIBINTL@ \
|
@LIBINTL@ \
|
||||||
@LIBICONV@ \
|
@LIBICONV@ \
|
||||||
-lFLAC $(flacogglibs) $(vorbislibs) $(avahilibs)
|
-lFLAC $(flacogglibs) $(vorbislibs) $(avahilibs) \
|
||||||
|
@opus_LIBS@
|
||||||
|
|
||||||
testupnpdescgen_SOURCES = testupnpdescgen.c upnpdescgen.c
|
testupnpdescgen_SOURCES = testupnpdescgen.c upnpdescgen.c
|
||||||
testupnpdescgen_LDADD = \
|
testupnpdescgen_LDADD = \
|
||||||
|
@ -462,6 +462,12 @@ AC_CHECK_LIB(vorbisfile, ov_open_callbacks,
|
|||||||
AM_CONDITIONAL(HAVE_VORBISFILE, false))],
|
AM_CONDITIONAL(HAVE_VORBISFILE, false))],
|
||||||
AM_CONDITIONAL(HAVE_VORBISFILE, false),
|
AM_CONDITIONAL(HAVE_VORBISFILE, false),
|
||||||
-lvorbis -logg)
|
-lvorbis -logg)
|
||||||
|
#test if we have opus/opusfile
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES([opus], [opus opusfile],
|
||||||
|
AM_CONDITIONAL(HAVE_OPUS, true)
|
||||||
|
AC_DEFINE(HAVE_OPUS,1,[Define to 1 if you have opus/opusfile]),
|
||||||
|
AM_CONDITIONAL(HAVE_OPUS, false))
|
||||||
AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_stream,
|
AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_stream,
|
||||||
[AC_CHECK_HEADERS([FLAC/all.h],
|
[AC_CHECK_HEADERS([FLAC/all.h],
|
||||||
AM_CONDITIONAL(HAVE_FLAC, true)
|
AM_CONDITIONAL(HAVE_FLAC, true)
|
||||||
|
50
metadata.c
50
metadata.c
@ -343,11 +343,55 @@ GetAudioMetadata(const char *path, const char *name)
|
|||||||
strcpy(type, "wav");
|
strcpy(type, "wav");
|
||||||
m.mime = strdup("audio/x-wav");
|
m.mime = strdup("audio/x-wav");
|
||||||
}
|
}
|
||||||
else if( ends_with(path, ".ogg") || ends_with(path, ".oga") )
|
else if( ends_with(path,".oga") || ends_with(path,".ogg"))
|
||||||
{
|
{
|
||||||
strcpy(type, "ogg");
|
/* The .ogg/.oga file extensions present something of a problem.
|
||||||
m.mime = strdup("audio/ogg");
|
* ".ogg" has been deprecated in favor of ".oga" for some time, but
|
||||||
|
* many applications still only recognize ".ogg".
|
||||||
|
*
|
||||||
|
* This examines the file and causes .ogg to be presented for any naked
|
||||||
|
* Vorbis file (MIME type audio/ogg; codecs=vorbis) and .oga
|
||||||
|
* (audio/ogg) to be used for everything else. This is in line with
|
||||||
|
* the official ogg naming conventions and, hopefully, makes for a
|
||||||
|
* resonable compromise.
|
||||||
|
*/
|
||||||
|
uint8_t oggtestbuf[35];
|
||||||
|
FILE *oggfile = fopen (path, "rb");
|
||||||
|
|
||||||
|
if (oggfile == (FILE *)NULL)
|
||||||
|
{
|
||||||
|
DPRINTF(E_ERROR, L_METADATA, "Error opening %s\n", path);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fread (oggtestbuf, 1, 35, oggfile) != 35)
|
||||||
|
{
|
||||||
|
DPRINTF(E_WARN, L_METADATA, "Premature EOF on %s\n", path);
|
||||||
|
fclose (oggfile);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fclose (oggfile);
|
||||||
|
|
||||||
|
if (memcmp (&oggtestbuf[28], "\x01vorbis", 7))
|
||||||
|
m.mime = strdup ("audio/ogg");
|
||||||
|
else
|
||||||
|
m.mime = strdup ("audio/ogg; codecs=vorbis");
|
||||||
|
|
||||||
|
strcpy(type, "ogg");
|
||||||
|
}
|
||||||
|
else if ( ends_with(path, ".opus") )
|
||||||
|
{
|
||||||
|
strcpy(type,"ops");
|
||||||
|
m.mime = strdup("audio/ogg; codecs=opus");
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
/* Not supported yet, and probably won't be. */
|
||||||
|
else if( ends_with(path, ".ogx") )
|
||||||
|
{
|
||||||
|
strcpy(type, "ogx");
|
||||||
|
m.mime = strdup("application/ogg");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else if( ends_with(path, ".pcm") )
|
else if( ends_with(path, ".pcm") )
|
||||||
{
|
{
|
||||||
strcpy(type, "pcm");
|
strcpy(type, "pcm");
|
||||||
|
59
tagutils/opus.c
Normal file
59
tagutils/opus.c
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
//=========================================================================
|
||||||
|
// FILENAME : tagutils-opus.c
|
||||||
|
// DESCRIPTION : Opus metadata reader
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
static int
|
||||||
|
_get_opusfileinfo(char *filename, struct song_metadata *psong)
|
||||||
|
{
|
||||||
|
OggOpusFile *opusfile;
|
||||||
|
const OpusTags *tags;
|
||||||
|
char **comment;
|
||||||
|
int *commentlen;
|
||||||
|
int j, e;
|
||||||
|
|
||||||
|
|
||||||
|
opusfile = op_open_file (filename, &e);
|
||||||
|
if(!opusfile)
|
||||||
|
{
|
||||||
|
DPRINTF(E_WARN, L_SCANNER,
|
||||||
|
"Error opening input file \"%s\": %s\n", filename, opus_strerror(e));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINTF(E_MAXDEBUG, L_SCANNER, "Processing file \"%s\"...\n", filename);
|
||||||
|
|
||||||
|
psong->song_length = op_pcm_total (opusfile, -1);
|
||||||
|
if (psong->song_length < 0)
|
||||||
|
{
|
||||||
|
DPRINTF(E_WARN, L_SCANNER,
|
||||||
|
"Unable to obtain length of %s\n", filename);
|
||||||
|
psong->song_length = 0;
|
||||||
|
} else
|
||||||
|
/* Sample rate is always 48k, so length in ms is just samples/48 */
|
||||||
|
psong->song_length /= 48;
|
||||||
|
|
||||||
|
/* Note that this gives only the first link's channel count. */
|
||||||
|
psong->channels = op_channel_count (opusfile, -1);
|
||||||
|
|
||||||
|
psong->samplerate = 48000;
|
||||||
|
psong->bitrate = op_bitrate (opusfile, -1);
|
||||||
|
|
||||||
|
tags = op_tags (opusfile, -1);
|
||||||
|
|
||||||
|
if (!tags)
|
||||||
|
{
|
||||||
|
DPRINTF(E_WARN, L_SCANNER, "Unable to obtain tags from %s\n",
|
||||||
|
filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
comment = tags->user_comments;
|
||||||
|
commentlen = tags->comment_lengths;
|
||||||
|
|
||||||
|
for (j = 0; j < tags->comments; j++)
|
||||||
|
vc_scan (psong, *(comment++), *(commentlen++));
|
||||||
|
|
||||||
|
op_free (opusfile);
|
||||||
|
return 0;
|
||||||
|
}
|
6
tagutils/opus.h
Normal file
6
tagutils/opus.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//=========================================================================
|
||||||
|
// FILENAME : tagutils-opus.h
|
||||||
|
// DESCRIPTION : Opus metadata reader
|
||||||
|
//=========================================================================
|
||||||
|
|
||||||
|
static int _get_opusfileinfo(char *filename, struct song_metadata *psong);
|
@ -42,6 +42,10 @@
|
|||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
/* ADD THIS INCLUDE FOR OPUS */
|
||||||
|
#ifdef HAVE_OPUS
|
||||||
|
#include <opusfile.h>
|
||||||
|
#endif
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include "tagutils.h"
|
#include "tagutils.h"
|
||||||
#include "../metadata.h"
|
#include "../metadata.h"
|
||||||
@ -104,8 +108,9 @@ char *winamp_genre[] = {
|
|||||||
*/
|
*/
|
||||||
#include "tagutils-mp3.h"
|
#include "tagutils-mp3.h"
|
||||||
#include "tagutils-aac.h"
|
#include "tagutils-aac.h"
|
||||||
#ifdef HAVE_VORBISFILE
|
|
||||||
#include "tagutils-ogg.h"
|
#include "tagutils-ogg.h"
|
||||||
|
#ifdef HAVE_OPUS
|
||||||
|
#include "tagutils-opus.h"
|
||||||
#endif
|
#endif
|
||||||
#include "tagutils-flc.h"
|
#include "tagutils-flc.h"
|
||||||
#include "tagutils-asf.h"
|
#include "tagutils-asf.h"
|
||||||
@ -132,14 +137,15 @@ static taghandler taghandlers[] = {
|
|||||||
{ "aac", _get_aactags, _get_aacfileinfo },
|
{ "aac", _get_aactags, _get_aacfileinfo },
|
||||||
{ "mp3", _get_mp3tags, _get_mp3fileinfo },
|
{ "mp3", _get_mp3tags, _get_mp3fileinfo },
|
||||||
{ "flc", _get_flctags, _get_flcfileinfo },
|
{ "flc", _get_flctags, _get_flcfileinfo },
|
||||||
#ifdef HAVE_VORBISFILE
|
{ "ogg", 0, _get_oggfileinfo },
|
||||||
{ "ogg", NULL, _get_oggfileinfo },
|
#ifdef HAVE_OPUS
|
||||||
|
{ "ops", 0, _get_opusfileinfo },
|
||||||
#endif
|
#endif
|
||||||
{ "asf", NULL, _get_asffileinfo },
|
{ "asf", 0, _get_asffileinfo },
|
||||||
{ "wav", _get_wavtags, _get_wavfileinfo },
|
{ "wav", _get_wavtags, _get_wavfileinfo },
|
||||||
{ "pcm", NULL, _get_pcmfileinfo },
|
{ "pcm", 0, _get_pcmfileinfo },
|
||||||
{ "dsf", _get_dsftags, _get_dsffileinfo },
|
{ "dsf", _get_dsftags, _get_dsffileinfo },
|
||||||
{ "dff", NULL, _get_dfffileinfo },
|
{ "dff", 0, _get_dfffileinfo },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -149,8 +155,9 @@ static taghandler taghandlers[] = {
|
|||||||
#include "tagutils-misc.c"
|
#include "tagutils-misc.c"
|
||||||
#include "tagutils-mp3.c"
|
#include "tagutils-mp3.c"
|
||||||
#include "tagutils-aac.c"
|
#include "tagutils-aac.c"
|
||||||
#ifdef HAVE_VORBISFILE
|
|
||||||
#include "tagutils-ogg.c"
|
#include "tagutils-ogg.c"
|
||||||
|
#ifdef HAVE_OPUS
|
||||||
|
#include "tagutils-opus.c"
|
||||||
#endif
|
#endif
|
||||||
#include "tagutils-flc.c"
|
#include "tagutils-flc.c"
|
||||||
#include "tagutils-asf.c"
|
#include "tagutils-asf.c"
|
||||||
|
16
utils.c
16
utils.c
@ -345,8 +345,15 @@ mime_to_ext(const char * mime)
|
|||||||
return "pcm";
|
return "pcm";
|
||||||
else if( strcmp(mime+6, "3gpp") == 0 )
|
else if( strcmp(mime+6, "3gpp") == 0 )
|
||||||
return "3gp";
|
return "3gp";
|
||||||
else if( strcmp(mime, "application/ogg") == 0 )
|
else if( strncmp(mime+6, "ogg", 3) == 0 )
|
||||||
|
{
|
||||||
|
if( strstr(mime+9, "opus" ) != (char *)NULL )
|
||||||
|
return "opus";
|
||||||
|
else if( strstr (mime+9, "vorbis" ) != (char *)NULL )
|
||||||
return "ogg";
|
return "ogg";
|
||||||
|
|
||||||
|
return "oga";
|
||||||
|
}
|
||||||
else if( strcmp(mime+6, "x-dsd") == 0 )
|
else if( strcmp(mime+6, "x-dsd") == 0 )
|
||||||
return "dsd";
|
return "dsd";
|
||||||
break;
|
break;
|
||||||
@ -377,6 +384,8 @@ mime_to_ext(const char * mime)
|
|||||||
return "3gp";
|
return "3gp";
|
||||||
else if( strncmp(mime+6, "x-tivo-mpeg", 11) == 0 )
|
else if( strncmp(mime+6, "x-tivo-mpeg", 11) == 0 )
|
||||||
return "TiVo";
|
return "TiVo";
|
||||||
|
else if ( strcmp(mime+6, "ogg") == 0 )
|
||||||
|
return "ogv";
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
if( strcmp(mime+6, "jpeg") == 0 )
|
if( strcmp(mime+6, "jpeg") == 0 )
|
||||||
@ -401,6 +410,7 @@ is_video(const char * file)
|
|||||||
ends_with(file, ".m2t") || ends_with(file, ".mkv") ||
|
ends_with(file, ".m2t") || ends_with(file, ".mkv") ||
|
||||||
ends_with(file, ".vob") || ends_with(file, ".ts") ||
|
ends_with(file, ".vob") || ends_with(file, ".ts") ||
|
||||||
ends_with(file, ".flv") || ends_with(file, ".xvid") ||
|
ends_with(file, ".flv") || ends_with(file, ".xvid") ||
|
||||||
|
ends_with(file, ".ogv") ||
|
||||||
#ifdef TIVO_SUPPORT
|
#ifdef TIVO_SUPPORT
|
||||||
ends_with(file, ".TiVo") ||
|
ends_with(file, ".TiVo") ||
|
||||||
#endif
|
#endif
|
||||||
@ -418,6 +428,10 @@ is_audio(const char * file)
|
|||||||
ends_with(file, ".m4a") || ends_with(file, ".aac") ||
|
ends_with(file, ".m4a") || ends_with(file, ".aac") ||
|
||||||
ends_with(file, ".mp4") || ends_with(file, ".m4p") ||
|
ends_with(file, ".mp4") || ends_with(file, ".m4p") ||
|
||||||
ends_with(file, ".wav") || ends_with(file, ".ogg") ||
|
ends_with(file, ".wav") || ends_with(file, ".ogg") ||
|
||||||
|
ends_with(file, ".oga") ||
|
||||||
|
#ifdef HAVE_OPUS
|
||||||
|
ends_with(file, ".opus") ||
|
||||||
|
#endif
|
||||||
ends_with(file, ".pcm") || ends_with(file, ".3gp") ||
|
ends_with(file, ".pcm") || ends_with(file, ".3gp") ||
|
||||||
ends_with(file, ".dsf") || ends_with(file, ".dff"));
|
ends_with(file, ".dsf") || ends_with(file, ".dff"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user