Leandro Dorileo [Mon, 19 Jan 2015 20:37:00 +0000 (18:37 -0200)]
LMS has got a new release.
Leandro Dorileo [Thu, 8 Jan 2015 18:29:56 +0000 (16:29 -0200)]
upstream rebase + packaging maintenance
Leandro Dorileo [Thu, 8 Jan 2015 18:20:13 +0000 (16:20 -0200)]
spec: specify the media directory
As of issue TC-2085, we need to specify tell LMS the directory it should
scan - since tizen doesn't understand XDG directories, the default ones
used by LMS daemon.
Issue: TC-2085
Philippe Coval [Wed, 26 Nov 2014 15:16:07 +0000 (16:16 +0100)]
Porting to libav v11
Change-Id: I6047f44dd46843160a2259e56fc937dd407f7b07
Bug-Tizen: TC-2106/related
Signed-off-by: Philippe Coval <philippe.coval@open.eurogiciel.org>
Geoffroy Van Cutsem [Mon, 24 Mar 2014 10:43:07 +0000 (11:43 +0100)]
Move main binary and daemon to main package (TIVI-2209)
Change-Id: If11d2ba74dfe0155f0430e985bc6fd9f79885b2b
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Leandro Dorileo [Thu, 13 Feb 2014 18:24:55 +0000 (16:24 -0200)]
upstream rebase
Change-Id: I4e36c23f54b4025e7871a28c01c9ae175a609a20
Leandro Dorileo [Tue, 11 Feb 2014 17:59:30 +0000 (15:59 -0200)]
upstream rebase
Change-Id: Ib9a32d53d77d7302f23b7aab4e049b42a047c697
Leandro Dorileo [Tue, 21 Jan 2014 16:54:36 +0000 (14:54 -0200)]
packaging: added theora dep
So we can build the ogg plugin.
Change-Id: Idd59d26c5a7293d9c8334cda36e189fcc8839589
Leandro Dorileo [Tue, 7 Jan 2014 20:08:49 +0000 (18:08 -0200)]
update packaging
Change-Id: I62c9ea11b23080ef1cd89f3095c30ed323807ea8
Leandro Dorileo [Fri, 20 Dec 2013 20:17:18 +0000 (18:17 -0200)]
packaging: update spec and upstream rebased
Dependencies added:
- glib-2.0
- libavcodec (enables generic parser)
- libavformat (enables generic parser)
Install service files and update the upstream URL.
Change-Id: Ic1a38ae113d6e95003669f470f8684cbb2a57ea0
Mikko Ylinen [Fri, 16 Aug 2013 09:36:58 +0000 (12:36 +0300)]
Update .changes
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Mikko Ylinen [Thu, 15 Aug 2013 08:00:26 +0000 (11:00 +0300)]
Install test binaries. Fixes TIVI-1428
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Mikko Ylinen [Thu, 15 Aug 2013 06:40:35 +0000 (09:40 +0300)]
Fix rpmlint errors
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Mikko Ylinen [Tue, 9 Jul 2013 17:29:13 +0000 (20:29 +0300)]
Update .changes
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Mikko Ylinen [Tue, 9 Jul 2013 17:22:09 +0000 (20:22 +0300)]
Remove .spec from .gitignore
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Mikko Ylinen [Tue, 9 Jul 2013 17:21:35 +0000 (20:21 +0300)]
Add Tizen packaging
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
Gustavo Sverzut Barbieri [Tue, 20 Jan 2015 18:51:34 +0000 (16:51 -0200)]
release 0.5.1 removing zlib dependency.
Leandro Dorileo [Tue, 20 Jan 2015 15:43:17 +0000 (13:43 -0200)]
remove zlib dependency
libmagic doesn't need zlib any more so we don't need to check for it with
ac_check_lib macro. Requiring zlib (an unused dependency) will force us
to install zlib on tizen-ivi, since we don't need/use it we better remove
the explicit dependency from configure.ac.
Leandro Dorileo [Fri, 16 Jan 2015 12:59:15 +0000 (10:59 -0200)]
release fixes
Need to add a revision number, otherwise libtool will tell us that revision
must not be a negative number, like:
error: REVISION '' must be a nonnegative integer
Also fix a typo on NEWS file.
Gustavo Sverzut Barbieri [Thu, 15 Jan 2015 22:32:04 +0000 (20:32 -0200)]
Release 0.5
Leandro Dorileo [Thu, 15 Jan 2015 20:38:59 +0000 (18:38 -0200)]
daemon: handle LMS_PROGRESS_STATUS_UNKNOWN value on switch
Since lms_progress_status_t has a new value we need to handle that case
within scan_progress_cb and make the compiler a bit happier.
Leandro Dorileo [Wed, 14 Jan 2015 13:18:15 +0000 (11:18 -0200)]
dlna: implement a mime type selector fallback
Since rygel will always want to have a mime type computed for every
single file in the lms database we must provide one even if it's not a
dlna recognized file.
This patch implements a fallback option, when we can't determine the
mime type based on dlna rules we still try to compute it using libmagic.
Gustavo Sverzut Barbieri [Thu, 15 Jan 2015 22:12:09 +0000 (20:12 -0200)]
move strings and declarations so they are local.
Leandro Dorileo [Thu, 15 Jan 2015 13:24:57 +0000 (11:24 -0200)]
test: fix buffer overrun issue
Make sure we don't run o buffer overrun by setting the status if we
don't know the passed value:
Pointed out by coverity tests: https://bugs.tizen.org/jira/browse/TC-2097
Leandro Dorileo [Thu, 15 Jan 2015 13:23:36 +0000 (11:23 -0200)]
jpeg: fix non null-terminated string issue
Pointed out by coverity tests: https://bugs.tizen.org/jira/browse/TC-2097
Leandro Dorileo [Thu, 15 Jan 2015 13:22:05 +0000 (11:22 -0200)]
png: fix non null-terminated string issue
Pointed out by coverity tests: https://bugs.tizen.org/jira/browse/TC-2097
Leandro Dorileo [Tue, 13 Jan 2015 18:52:20 +0000 (16:52 -0200)]
generic: make it parse ogg files
Leandro Dorileo [Mon, 12 Jan 2015 19:35:34 +0000 (17:35 -0200)]
generic: do not use AV_OPT_SEARCH_FAKE_OBJ flag
The current tizen libav package has a bug when we provide AV_OPT_SEARCH_FAKE_OBJ
flag to av_opt_*() calls, it segfault's. Since we don't need it at all
I'm dropping the flag.
Leandro Dorileo [Wed, 7 Jan 2015 18:20:04 +0000 (16:20 -0200)]
dlna: don't match if no profile/level identified
Instead of providing an empty string for profile and level if we haven't
parsed one from codec identifier initialize it to NULL and only use
it to match the rules if we found the respective identifiers.
Leandro Dorileo [Wed, 7 Jan 2015 18:10:36 +0000 (16:10 -0200)]
mp4: change codec identifier mpeg1audio to mpeg4aac-lc
To keep consistence between the identified audio codec by mp4 plugin
and the dlna rules we need to make the plugin code know we expect
mpeg4aac-lc instead of mpeg1audio.
Gustavo Sverzut Barbieri [Wed, 19 Nov 2014 18:56:04 +0000 (16:56 -0200)]
fix unsigned integer comparison in read() == size statements.
Gustavo Sverzut Barbieri [Wed, 19 Nov 2014 18:51:06 +0000 (16:51 -0200)]
include "itime" in the master/slave communication.
Gustavo Sverzut Barbieri [Wed, 19 Nov 2014 18:44:09 +0000 (16:44 -0200)]
fix test for SKIPPED entries.
Gustavo Sverzut Barbieri [Wed, 19 Nov 2014 18:43:02 +0000 (16:43 -0200)]
fix buffer overflow if slen = 32.
Gustavo Sverzut Barbieri [Wed, 20 Aug 2014 23:38:15 +0000 (20:38 -0300)]
mp4 and generic: produce codec string with "p" prefix for profile.
we do match for "-p" to search profile, thus we must prefix the
profile string with "p" otherwise it won't match in DLNA processing.
Gustavo Sverzut Barbieri [Wed, 20 Aug 2014 23:09:39 +0000 (20:09 -0300)]
dlna_rules: add missing array sentinel.
these would trigger an invalid memory access during loop that looks
for curr->dlna_profile != NULL as the pointer would be undefined.
Carsten (The Rasterman) Haitzler [Mon, 17 Mar 2014 23:15:01 +0000 (20:15 -0300)]
id3: avoid divide by zero if no bitrate specified in header.
If variable bitrate the header may contain zero as bitrate, resulting
in a divide by zero fault.
Gustavo Sverzut Barbieri [Thu, 13 Feb 2014 16:02:22 +0000 (14:02 -0200)]
daemon: warning and behave properly if no xdg-user-dirs setup.
Leandro Dorileo [Thu, 13 Feb 2014 13:24:44 +0000 (11:24 -0200)]
libav: compatibility issues between libav and ffmpeg
For compatibility issues we must try to get channels using the
codec->channels field if it's 0 we try using the function
av_get_channel_layout_cb_channels().
Leandro Dorileo [Thu, 13 Feb 2014 15:17:47 +0000 (13:17 -0200)]
dlna: fix audio sentinel check
Gustavo Sverzut Barbieri [Wed, 12 Feb 2014 14:40:08 +0000 (12:40 -0200)]
Record if the file was already parsed, ignore them in the generic.
Generic parser is more like a fallback, then if the file was already
parsed by some other parser it should ignore that entry.
Leandro Dorileo [Tue, 11 Feb 2014 17:26:51 +0000 (15:26 -0200)]
generic: minimal libav adjustments
Since libav doesn't implement the avcodec_get_name() util function we
need to implement the AVCodecDescriptor handling in our side.
Libav will also need the AV_OPT_SEARCH_FAKE_OBJ flag to retrieve the
ts_packetsize.
Leandro Dorileo [Fri, 17 Jan 2014 12:45:28 +0000 (10:45 -0200)]
generic: remove the dlna stuff and add codec container handlers
This patch removes the dlna stuffs from generic plugin and for backward
compatibility we have introduce some container and codec handlers so we
can result in the same identifiers as the other plugins, if a handler
is not found we go with what we can extract from the file using the
libavformat api.
The mp4 codec implementation lacks on some profiles/levels parsing by
no a smaller subset - not a minimal, but a smaller subset.
Leandro Dorileo [Fri, 17 Jan 2014 12:43:47 +0000 (10:43 -0200)]
wave: remove the dlna stuffs from plugin
Leandro Dorileo [Fri, 17 Jan 2014 12:41:41 +0000 (10:41 -0200)]
png: remove all the dlna stuff
Remove all the dlna sutff and likewise the jpeg plugin we set the
container field so we can know - in the dlna layer - the rules to
apply.
Leandro Dorileo [Fri, 17 Jan 2014 12:41:10 +0000 (10:41 -0200)]
mp4: remove all the dlna stuff from plugin
Leandro Dorileo [Fri, 17 Jan 2014 12:40:06 +0000 (10:40 -0200)]
jpeg: remove all the dlna stuff
Remove all the dlna stuff and make use of the container field so
we can know the rules to apply.
Leandro Dorileo [Fri, 17 Jan 2014 12:38:04 +0000 (10:38 -0200)]
id3: remove all the dlna stuff from plugin
Leandro Dorileo [Fri, 17 Jan 2014 12:37:19 +0000 (10:37 -0200)]
asf: remove all the dlna stuff from plugin
Leandro Dorileo [Fri, 17 Jan 2014 12:48:53 +0000 (10:48 -0200)]
db layer: call the lms_dlna_* functions
Call the lms_dlna_* functions to properly set the dlna_profile and dlna_mime
fields. The plugins can still set/define their own dlna_mime and dlna_profile,
if so, we're not going to overwrite it and the plugin's will have priority.
Leandro Dorileo [Fri, 17 Jan 2014 12:21:19 +0000 (10:21 -0200)]
dlna: introduce a dlna lower layer
A small change on how the dlna profile and mime are defined, now LMS
knows about the rules and aplies it wherever possible.
In the next patches we make use of it.
Leandro Dorileo [Fri, 17 Jan 2014 12:28:31 +0000 (10:28 -0200)]
image/video db: new fields added
New fields were introduced, they should go through the lower layers
to be used on dlna source code, they are:
+ image:
container: a string carrying the container information, used
to determine which dlna set of rules should be applied.
+ video:
packet_size: without the packet_size we can not apply the
meg1/2 rules.
Leandro Dorileo [Wed, 8 Jan 2014 17:03:10 +0000 (15:03 -0200)]
configure: use pkg check instead of headers
Use pkg check for vorbis/tremor instead of headers and libs.
Gustavo Sverzut Barbieri [Tue, 7 Jan 2014 01:01:14 +0000 (23:01 -0200)]
daemon monitors mounts and triggers scans.
Gustavo Sverzut Barbieri [Fri, 27 Dec 2013 14:01:47 +0000 (12:01 -0200)]
prepare for next release, for now bumped version to 0.4.5.99
Still need to define if it will be a 1.0 or 0.5 release.
Gustavo Sverzut Barbieri [Wed, 11 Dec 2013 16:29:05 +0000 (14:29 -0200)]
change project url to github.
Garage.maemo is no more for a while, now we'll have everything in github.
Leandro Dorileo [Thu, 19 Dec 2013 16:55:38 +0000 (14:55 -0200)]
generic: implemente a generic parser plugin
A generic parser plugin based on libavcoded, initially supporting
mpeg1, mpeg2 and mp3.
Leandro Dorileo [Thu, 19 Dec 2013 16:52:39 +0000 (14:52 -0200)]
plugin: implement parser sorting
Sort the parsers based on its defined order field. The smaller "ordered"
plugin will atempt to parse first.
Leandro Dorileo [Tue, 3 Dec 2013 16:10:47 +0000 (14:10 -0200)]
mp4: implement dlna profile and mime computation
Lucas De Marchi [Mon, 9 Dec 2013 17:51:42 +0000 (15:51 -0200)]
build: Disable static library by default
Static library isn't enabled by default anymore. It can be enabled back
by passing --enable-static.
Gustavo Sverzut Barbieri [Fri, 6 Dec 2013 21:17:19 +0000 (19:17 -0200)]
document daemon in the readme.
Gustavo Sverzut Barbieri [Fri, 6 Dec 2013 21:03:17 +0000 (19:03 -0200)]
lightmediascannerctl: start daemon if not running.
While the service would be activated if we did call some method we are
checking for the current nameowner to do some operations (status, etc)
and it would exit if there was no server at that time.
Now we launch the service and make sure it's there.
Lucas De Marchi [Wed, 4 Dec 2013 19:58:15 +0000 (17:58 -0200)]
Fix warnings on 64 bits
Use the glib-provided macros to print 64 bit values.
lightmediascannerd.c:212:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘gint64’ [-Wformat=]
g_warning("Couldn't bind delete old dtime '%lld'from %s: %s",
lightmediascannerctl.c:280:16: warning: format ‘%llu’ expects argument
of type ‘long long unsigned int’, but argument 4 has type ‘guint64’
[-Wformat=]
category, path, uptodate, processed, deleted, skipped,
errors);
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 19:19:31 +0000 (17:19 -0200)]
daemon/ctl: introduce ScanProgress signal.
The ScanProgress signal will notify what the daemon is doing so
clients can provide better status to the user and look responsive,
giving a clue of what is happening and not just a spinning wheel that
may look like something is stuck if media/system is slow enough.
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 19:16:12 +0000 (17:16 -0200)]
ctl: fix g_variant leak.
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 18:59:13 +0000 (16:59 -0200)]
process: properly report status for dual-process mode.
we should report the status we got in "reply", such as processed,
uptodate, skipped... not the return of _master_recv_reply() that is 1
during timeout or 0 on success (everything was being reported as 0
(LMS_PROGRESS_STATUS_UP_TO_DATE).
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 18:58:22 +0000 (16:58 -0200)]
process: do not change update_id on skipped files.
if we skipped a file it doesn't go to DB and thus we shouldn't mess
with counter and thus update_id. It is the same case as the file was
up to date.
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 17:25:26 +0000 (15:25 -0200)]
daemon: remove from db files with dtime older than a given date.
LightMediaScanner will not delete the database entries for files that
are gone, instead it will mark the 'dtime' column with current
timestamp. This allows fast restore of files from a removable media,
but can grow the database too much if these are never purged from time
to time.
This commit introduces --delete-older-than=DAYS (-d=DAYS) that will
always purge entries older than the given number of days, or negative
value to disable this behavior.
Gustavo Sverzut Barbieri [Wed, 4 Dec 2013 13:58:02 +0000 (11:58 -0200)]
daemon: export read-only property DataBasePath.
This is useful for users to know where is the database instead of
negotiating this in another way (like configuration files of both
lightmediascannerd and clients).
Gustavo Sverzut Barbieri [Wed, 11 Sep 2013 17:28:22 +0000 (14:28 -0300)]
minor: remove left over "#undef STR_FIELD_FROM_TAG"
Lucas De Marchi [Tue, 10 Sep 2013 23:52:00 +0000 (20:52 -0300)]
flac: fix wrong prefix length
Fix copy and paste from other items.
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 23:04:20 +0000 (20:04 -0300)]
utils refactor.
move parser specific stuff from src/lib/shared/util.h to
src/plugin/shared/util.h, still not to be installed and without "lms_"
prefix.
the aspect_ratio calculation was moved into lightmediascanner_util.h
and lightmediascanner_db.h to be simpler to use.
extract name from path is also too common, now in
lightmediascanner_util.h as lms_name_from_path().
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 22:11:01 +0000 (19:11 -0300)]
introduce and use helpers lms_string_size_strndup() and lms_string_size_dup()
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 21:25:43 +0000 (18:25 -0300)]
asf: register new fields (container, sampling_rate)
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 20:50:21 +0000 (17:50 -0300)]
mp4: fix audio codec lookup, add video codec and extra information.
* audio codec needed an spare NULL position before _codec_audio_mpeg4_tssi;
* audio codec must lookup type if different from MP4_MPEG4_AUDIO_TYPE;
* register stream language;
* register audio stream sampling_rate;
* register video stream framerate if it matches a known value;
* register video stream bitrate;
* register video stream codec;
* register container as "mp4";
* added authors.
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 17:51:56 +0000 (14:51 -0300)]
mp4: remove support for deprecated library.
the new 2.0 api is already old enough, remove support for the previous
deprecated.
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 17:50:49 +0000 (14:50 -0300)]
id3: fix extra linking with mp4v2.
copy & paste bug :-(
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 14:42:11 +0000 (11:42 -0300)]
ogg: register new fields (container, sampling_rate)
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 14:38:47 +0000 (11:38 -0300)]
ogg: add ".oga" extension.
Gustavo Sverzut Barbieri [Tue, 10 Sep 2013 14:28:53 +0000 (11:28 -0300)]
video: add missing fields (container, sampling_rate)
We must remember the video file container and the audio stream sampling_rate.
Lucas De Marchi [Tue, 3 Sep 2013 19:05:45 +0000 (16:05 -0300)]
plugins/mp4: Add audio codec
Lucas De Marchi [Tue, 3 Sep 2013 19:22:35 +0000 (16:22 -0300)]
plugins/mp4: Add tracks information
Lucas De Marchi [Tue, 3 Sep 2013 19:05:45 +0000 (16:05 -0300)]
plugins/mp4: convert to mp4v2 2.0 API
Gustavo Sverzut Barbieri [Fri, 30 Aug 2013 16:25:48 +0000 (13:25 -0300)]
id3: fix bitrate to be multiple of 1000.
Gustavo Sverzut Barbieri [Fri, 30 Aug 2013 16:24:11 +0000 (13:24 -0300)]
wave: provide dlna information.
Gustavo Sverzut Barbieri [Fri, 30 Aug 2013 15:36:31 +0000 (12:36 -0300)]
asf: : provide dlna information for wma.
Gustavo Sverzut Barbieri [Wed, 28 Aug 2013 00:15:45 +0000 (21:15 -0300)]
id3: provide dlna information.
Gustavo Sverzut Barbieri [Tue, 27 Aug 2013 21:51:06 +0000 (18:51 -0300)]
png: provide dlna information.
Gustavo Sverzut Barbieri [Tue, 27 Aug 2013 21:50:45 +0000 (18:50 -0300)]
jpeg: provide dlna information.
Gustavo Sverzut Barbieri [Fri, 30 Aug 2013 15:28:58 +0000 (12:28 -0300)]
add dlna fields to video table.
Add new fields dlna_profile and dlna_mime to provide simple
information for applications that use it.
Gustavo Sverzut Barbieri [Fri, 30 Aug 2013 15:33:30 +0000 (12:33 -0300)]
asf: better bitrate for variable bit rate.
The spec says the following:
Alternate Data Bitrate:
Specifies the leak rate RAlt, in bits per second, of a leaky
bucket that contains the data portion of the stream without
overflowing, excluding all ASF Data Packet overhead. The size of
the leaky bucket is specified by the value of the Alternate Buffer
Size field. This value is relevant in most scenarios where the bit
rate is not exactly constant, but it is especially useful for
streams that have highly variable bit rates. This field can
optionally be set to the same value as the Data Bitrate field.
Alternate Buffer Size:
Specifies the size BAlt, in milliseconds, of the leaky bucket used
in the Alternate Data Bitrate definition. This value is relevant
in most scenarios where the bit rate is not exactly constant, but
it is especially useful for streams that have highly variable bit
rates. This field can optionally be set to the same value as the
Buffer Size field.
Alternate Initial Buffer Fullness:
Specifies the initial fullness, in milliseconds, of the leaky
bucket used in the Alternate Data Bitrate definition. This is the
fullness of the buffer at the instant before the first bit in the
stream is dumped into the bucket. Typically, this value is set to
0. This value shall not exceed the value of the Alternate Buffer
Size field.
Gustavo Sverzut Barbieri [Wed, 28 Aug 2013 00:14:35 +0000 (21:14 -0300)]
db_audio: add dlna_mime column.
this column pairs with dlna_profile.
Gustavo Sverzut Barbieri [Tue, 27 Aug 2013 21:50:05 +0000 (18:50 -0300)]
add dlna fields to image table.
Add new fields dlna_profile and dlna_mime to provide simple
information for applications that use it.
Gustavo Sverzut Barbieri [Tue, 27 Aug 2013 03:37:50 +0000 (00:37 -0300)]
add lightmediascannerd and lightmediascannerctl
The daemon and control client are provided as a way to make usage of
lightmediascanner easier in a platform. It will scan directories based
on the startup configuration of categories, their parsers and
directories.
One can request a write lock, avoiding the server to scan and also
report to others that they should not write to DB.
Scanning status, Write Lock and global Update ID are provided as
properties.
The scan method will take a dict of categories and their respective
scan paths. This allows to reduce the scan scope to just few
categories and paths. The categories must exist previously and paths
must be inside the previously known categories directories, this
avoids people doing mistakes. If a category is provided as an empty
list, all directories will be used. If there are no categories
provided, then all categories with all directories will be used.
Gustavo Sverzut Barbieri [Tue, 27 Aug 2013 18:21:37 +0000 (15:21 -0300)]
allow scanning a single file instead of a directory.
The previous code assumed we always scan a directory, this is
cumbersome if we know just one file changed and want to scan only that
instance and not the whole dir recursively.
It is now allowed to check a non-existent directory or file, this will
mark any existing entry as deleted in the database.
Lucas De Marchi [Fri, 30 Aug 2013 14:20:29 +0000 (11:20 -0300)]
plugins/id3: Add loop on frames to estimate bitrate
Estimate the bitrate and length when there's no additional header we
can rely on to get these numbers. This is done by parsing the initial
frames of the file.
This has an impact on performance, since now we are parsing much more
than before. There's a define N_FRAMES_BITRATE_ESTIMATE and
N_FRAMES_CBR_ESTIMATE that need to be tuned in order to obtain the best
compromise between performance and accuracy.
Lucas De Marchi [Thu, 29 Aug 2013 12:51:07 +0000 (09:51 -0300)]
plugins/id3: parse VBR headers
Parse VBR headers: Xing and VBRI. We use the number of frames and stream
size we find in these headers in order to calculate length and bitrate.
We also parse the "Info" header, which is the same as "Xing", but in
this case we assume the file has constant bitrate.
Now the only case in which bitrate is wrong is when the file is VBR but
it has no headers to indicate so.
Lucas De Marchi [Wed, 28 Aug 2013 14:05:51 +0000 (11:05 -0300)]
plugins/id3: Add bitrate and length for CBR files
Lucas De Marchi [Wed, 28 Aug 2013 21:45:55 +0000 (18:45 -0300)]
plugins/id3: Fix id3v2 not skipping CRC if present
If there's a CRC field after the extended header, we need to skip it,
too. The worst thing that could happen here is the CRC containing a sync
byte and having no other frames in the ID3v2. In this case our parser
would not find correct mp3 information.
Lucas De Marchi [Wed, 28 Aug 2013 04:24:35 +0000 (01:24 -0300)]
plugins/id3: Fix id3v2 header size calculation
_parse_id3v2() was not getting the size of the frame correctly. Since
the number uses at most 7 bits, we can't use _to_uint() function. For
example, 0x00000201 should be translated as 257, not 513.
We were also relying on _parse_id3v2() letting the fd in the right
position to look for the sync byte. However if this function read too
little and ave up parsing we were left in the middle of some ID3 frame.
Also, if there are other mistakes in the tag, we could end up reading
too much and losing the first sync byte.
Be safe and skip the amount of bytes as written into the ID3 header (or
skip just the ID3 tag if _parse_id3v2() fails badly).
We also skip the extended header if it exists and rename the
syncframe_offset to sync_offset everywhere.
Reference: Section 3.1 of ID3v2 tag specification
(http://id3.org/id3v2.3.0)