Discussion:
FFMPEG as fallback decoder.
e***@cs.umn.edu
2010-11-17 05:48:12 UTC
Permalink
Working on ape support got me thinking about this feature, so I
decided to implement it. CMUS will now use ffmpeg as the fallback
decoder for formats it otherwise doesn't recognize. If anyone else
could test this out, I'm a bit limited in the audio formats I have to
test with.

Attached are the patch files (if anyone could point me towards a good
tutorial or explanation on how to use git format-patch files better I
would love that, because I'm still not certain how I'm supposed to
send these files).

Regards,
Evan
Evan
2010-11-13 23:45:03 UTC
Permalink
In configure: Added FFMPEG_DEFAULT option, along with description in
usage() for it. Added call to config_header for FFMPEG_DEFAULT option,
pointing to config/ffmpeg.h.

In ffmpeg.c: Added include statement for config/ffmpeg.h. Added logic
to change ip_extensions[] definition between fallback mode and normal
mode.

In input.c: Added use_ffmpeg ip struct, and ffmpeg_fallback boolean.
Added logic to return the ip struct of ffmpeg for any format we can't
find an ip for.
---
configure | 3 +++
ffmpeg.c | 5 +++++
input.c | 16 +++++++++++++++-
3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 2fac032..f7761c8 100755
--- a/configure
+++ b/configure
@@ -326,6 +326,8 @@ Optional Features: y/n
CONFIG_OSS Open Sound System [auto]
CONFIG_SUN Sun Audio [auto]
CONFIG_WAVEOUT Windows Wave Out [auto]
+ FFMPEG_DEFAULT Set FFmpeg as the default decoder for [n]
+ unrecognized formats.

Also many standard variables like CC are recognized."

@@ -389,6 +391,7 @@ config_header config/tremor.h CONFIG_TREMOR
config_header config/mpc.h MPC_SV7
config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS
+config_header config/ffmpeg.h FFMPEG_DEFAULT

makefile_vars bindir datadir libdir mandir exampledir
makefile_vars CONFIG_FLAC CONFIG_MAD CONFIG_MIKMOD CONFIG_MODPLUG CONFIG_MPC CONFIG_VORBIS CONFIG_WAVPACK CONFIG_WAV CONFIG_MP4 CONFIG_AAC CONFIG_FFMPEG
diff --git a/ffmpeg.c b/ffmpeg.c
index a55c60b..601cf0a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -33,6 +33,7 @@
#include "xmalloc.h"
#include "debug.h"
#include "utils.h"
+#include "config/ffmpeg.h"

#define NUM_FFMPEG_KEYS 8

@@ -397,5 +398,9 @@ const struct input_plugin_ops ip_ops = {
.duration = ffmpeg_duration
};

+#ifdef FFMPEG_DEFAULT
+const char *const ip_extensions[] = { "any", NULL };
+#else
const char *const ip_extensions[] = { "ape", "wma", NULL };
+#endif
const char *const ip_mime_types[] = { NULL };
diff --git a/input.c b/input.c
index 38b7911..214732d 100644
--- a/input.c
+++ b/input.c
@@ -109,6 +109,11 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
{
struct ip *ip;
const char *ext;
+ struct ip *use_ffmpeg;
+ int ffmpeg_fallback;
+
+ use_ffmpeg = NULL;
+ ffmpeg_fallback = 0;

ext = get_extension(filename);
if (ext == NULL)
@@ -117,11 +122,20 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
const char * const *exts = ip->extensions;
int i;

+ if (strcasecmp("ffmpeg",ip->name) == 0)
+ use_ffmpeg = ip;
for (i = 0; exts[i]; i++) {
- if (strcasecmp(ext, exts[i]) == 0)
+ if (strcasecmp("any", exts[i]) == 0)
+ ffmpeg_fallback = 1;
+ if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
+ }
}
}
+ if(use_ffmpeg && ffmpeg_fallback){
+ return use_ffmpeg->ops;
+ }
+
return NULL;
}
--
1.7.1


--sdtB3X0nJg68CQEu
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="0002-In-configure-added-default-value-for-FFMPEG_DEFAULT.patch"
Evan
2010-11-17 05:25:33 UTC
Permalink
---
configure | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index f7761c8..ce7072a 100755
--- a/configure
+++ b/configure
@@ -294,6 +294,7 @@ prefix=/usr/local
DEBUG=1
CONFIG_TREMOR=n
CONFIG_MIKMOD=n
+FFMPEG_DEFAULT=n
# unset CONFIG_* variables: if check succeeds 'y', otherwise 'n'

USAGE="
--
1.7.1


--sdtB3X0nJg68CQEu--
Gregory Petrosyan
2010-11-17 22:47:01 UTC
Permalink
Post by e***@cs.umn.edu
Working on ape support got me thinking about this feature, so I
decided to implement it. CMUS will now use ffmpeg as the fallback
decoder for formats it otherwise doesn't recognize. If anyone else
could test this out, I'm a bit limited in the audio formats I have to
test with.
Attached are the patch files (if anyone could point me towards a good
tutorial or explanation on how to use git format-patch files better I
would love that, because I'm still not certain how I'm supposed to
send these files).
Thanks for the patches!

On the first sight,idea seems to be OK, I'll try to look at the patches as
soon as I have a little bit of free time.

Gregory
a***@cs.umn.edu
2010-11-18 03:05:00 UTC
Permalink
I'm excited to hear feedback on it, as it's been on my mind for a
while.

-Evan
Post by Gregory Petrosyan
Post by e***@cs.umn.edu
Working on ape support got me thinking about this feature, so I
decided to implement it. CMUS will now use ffmpeg as the fallback
decoder for formats it otherwise doesn't recognize. If anyone else
could test this out, I'm a bit limited in the audio formats I have to
test with.
Attached are the patch files (if anyone could point me towards a good
tutorial or explanation on how to use git format-patch files better I
would love that, because I'm still not certain how I'm supposed to
send these files).
Thanks for the patches!
On the first sight,idea seems to be OK, I'll try to look at the patches as
soon as I have a little bit of free time.
Gregory
Gregory Petrosyan
2010-11-19 20:19:37 UTC
Permalink
Post by Evan
+#ifdef FFMPEG_DEFAULT
+const char *const ip_extensions[] = { "any", NULL };
+#else
const char *const ip_extensions[] = { "ape", "wma", NULL };
+#endif
const char *const ip_mime_types[] = { NULL };
This is OK (although FFMPEG_DEFAULT is not a very descriptive name).
Post by Evan
@@ -109,6 +109,11 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
{
struct ip *ip;
const char *ext;
+ struct ip *use_ffmpeg;
+ int ffmpeg_fallback;
+
+ use_ffmpeg = NULL;
+ ffmpeg_fallback = 0;
ext = get_extension(filename);
if (ext == NULL)
@@ -117,11 +122,20 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
const char * const *exts = ip->extensions;
int i;
+ if (strcasecmp("ffmpeg",ip->name) == 0)
+ use_ffmpeg = ip;
for (i = 0; exts[i]; i++) {
- if (strcasecmp(ext, exts[i]) == 0)
+ if (strcasecmp("any", exts[i]) == 0)
+ ffmpeg_fallback = 1;
+ if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
+ }
}
}
+ if(use_ffmpeg && ffmpeg_fallback){
+ return use_ffmpeg->ops;
+ }
I think this can be done cleaner: we can just return the first input plugin,
which contains "any" in ip->extensions, without hard-coding "ffmpeg" etc.:

if (strcasecmp("any", exts[i]) == 0)
return ip->ops;

So, ideally, this feature should be implemented as 2 tiny patches: first one
adds the 2 lines above to the get_ops_by_filename(), and second one adds (via
a default-n USE_FFMPEG_FOR_EVERY_FILE_I_HAVE) "any" to the list of ffmpeg
supported extensions.

OK?

Gregory
e***@cs.umn.edu
2010-11-20 02:40:25 UTC
Permalink
I couldn't really think of a good two word name to describe what the
variable was supposed to represent, but if I can use more than two
words that opens up the possibilities.

I chose to only return the ffmpeg ip if we don't have any other ip's
to use because it seemed that, if there are other ip's to fit the job,
we should use them, instead of immediately using ffmpeg when it shows
up. The intent of the patch is as a failover ip, not as the one to
use immediately when you come upon it. I don't want to surprise users
when ffmpeg fails to decode a file, especially if there's a plugin
that the user thinks should handle the file.

I am also uncertain whether the list of plugins is checked in the same
order every time, so debugging could be a hassle, along with inducing
confusion ("When I try to play a song, sometimes it fails and
sometimes it doesn't.").

As far as not wanting to hardcode in ffmpeg, I like the idea of
looking for "any" in the exts[], but I would want to some how make
sure that only one plugin has "any" in it's list of extensions (maybe
we code this in, maybe we just make sure only ffmpeg has "any" in it's
list?) so we can avoid any race conditions.
....and second one adds (via
a default-n USE_FFMPEG_FOR_EVERY_FILE_I_HAVE) "any" to the list of ffmpeg
supported extensions.
specifically the 'default-n' part. Is it possible I have done this in
the ffmpeg.c portion of the first patch?

-Evan
Post by Evan
+#ifdef FFMPEG_DEFAULT
+const char *const ip_extensions[] = { "any", NULL };
+#else
const char *const ip_extensions[] = { "ape", "wma", NULL };
+#endif
const char *const ip_mime_types[] = { NULL };
This is OK (although FFMPEG_DEFAULT is not a very descriptive name).
Post by Evan
@@ -109,6 +109,11 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
{
struct ip *ip;
const char *ext;
+ struct ip *use_ffmpeg;
+ int ffmpeg_fallback;
+
+ use_ffmpeg = NULL;
+ ffmpeg_fallback = 0;
ext = get_extension(filename);
if (ext == NULL)
@@ -117,11 +122,20 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
const char * const *exts = ip->extensions;
int i;
+ if (strcasecmp("ffmpeg",ip->name) == 0)
+ use_ffmpeg = ip;
for (i = 0; exts[i]; i++) {
- if (strcasecmp(ext, exts[i]) == 0)
+ if (strcasecmp("any", exts[i]) == 0)
+ ffmpeg_fallback = 1;
+ if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
+ }
}
}
+ if(use_ffmpeg && ffmpeg_fallback){
+ return use_ffmpeg->ops;
+ }
I think this can be done cleaner: we can just return the first input plugin,
if (strcasecmp("any", exts[i]) == 0)
return ip->ops;
So, ideally, this feature should be implemented as 2 tiny patches: first one
adds the 2 lines above to the get_ops_by_filename(), and second one adds (via
a default-n USE_FFMPEG_FOR_EVERY_FILE_I_HAVE) "any" to the list of ffmpeg
supported extensions.
OK?
Gregory
Gregory Petrosyan
2010-11-28 23:43:20 UTC
Permalink
Post by e***@cs.umn.edu
I couldn't really think of a good two word name to describe what the
variable was supposed to represent, but if I can use more than two
words that opens up the possibilities.
Not only you can, you are welcome :-)
Post by e***@cs.umn.edu
I chose to only return the ffmpeg ip if we don't have any other ip's
to use because it seemed that, if there are other ip's to fit the job,
we should use them, instead of immediately using ffmpeg when it shows
up. The intent of the patch is as a failover ip, not as the one to
use immediately when you come upon it. I don't want to surprise users
when ffmpeg fails to decode a file, especially if there's a plugin
that the user thinks should handle the file.
I am also uncertain whether the list of plugins is checked in the same
order every time, so debugging could be a hassle, along with inducing
confusion ("When I try to play a song, sometimes it fails and
sometimes it doesn't.").
This definitely makes sense; I agree.

But I think something like this code is better (we get rid of any hardcoding
of "ffmpeg"):


list_for_each_entry(ip, &ip_head, node) {
const char * const *exts = ip->extensions;
int i;

for (i = 0; exts[i]; i++) {
if (strcasecmp("any", exts[i]) == 0)
fallback_ip = ip;
if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
}
}
}
if (fallback_ip)
return fallback_ip->ops;


Am I missing something? (Almost 3 a.m. here :-)

(Yes, this code assumes that only one plugin has "any" specified, or order of
readdir() entires is always the same — I think these are reasonable
assumptions).
Post by e***@cs.umn.edu
....and second one adds (via
a default-n USE_FFMPEG_FOR_EVERY_FILE_I_HAVE) "any" to the list of ffmpeg
supported extensions.
specifically the 'default-n' part. Is it possible I have done this in
the ffmpeg.c portion of the first patch?
Yes, exactly. This was only about a possible way to split the patch that I
had in mind.

Gregory
e***@cs.umn.edu
2010-12-14 05:02:47 UTC
Permalink
OK, I think I've got this down now (I say "I think" because I only
have two formats to play with, but both work fine for me). I
incorporated some (or perhaps all, it's been a bit of time since I've
been able to stare hard at the status of this patch) of your
suggestions in terms of naming. Let me know if I missed anything and
I'll sit down and sort it out, but I'm fairly confident I've got it
all.

-Evan
Gregory Petrosyan
2010-12-15 19:42:50 UTC
Permalink
Post by e***@cs.umn.edu
OK, I think I've got this down now (I say "I think" because I only
have two formats to play with, but both work fine for me).  I
incorporated some (or perhaps all, it's been a bit of time since I've
been able to stare hard at the status of this patch) of your
suggestions in terms of naming. Let me know if I missed anything and
I'll sit down and sort it out, but I'm fairly confident I've got it
all.
Thanks,

I'm trying to apply your patches to -master (with "git am") but for
some reason that is not working. Can you please resend the patches
rebased on top of the master branch?

                Gregory
e***@cs.umn.edu
2010-12-18 05:53:39 UTC
Permalink
Ok, I hope rebasing did the trick. I ran into an issue where it had
trouble merging patch 0003, in regards to the ./configure file, so I had to
hand edit that. I'm not sure if that will happen again, but if so,
keep the version that includes the variable USE_FALLBACK_IP. Let me
know how it goes.

Regards,
F.
Gregory Petrosyan
2010-12-20 09:20:15 UTC
Permalink
Post by e***@cs.umn.edu
Ok, I hope rebasing did the trick. I ran into an issue where it had
trouble merging patch 0003, in regards to the ./configure file, so I had to
hand edit that. I'm not sure if that will happen again, but if so,
keep the version that includes the variable USE_FALLBACK_IP. Let me
know how it goes.
Thanks Evan!

I've merged the paches together and cleaned up a couple of whitespace etc.
errors. I've pushed the patch to the new ffmpeg-fallback branch, which is now
also a part of -pu.

If no problems will be discovered, it will be merged into -master soon.

Gregory
Gregory Petrosyan
2010-12-24 00:28:37 UTC
Permalink
On Mon, Dec 20, 2010 at 12:20 PM, Gregory Petrosyan
Post by Gregory Petrosyan
Ok, I hope rebasing did the trick.  I ran into an issue where it had
trouble merging patch 0003, in regards to the ./configure file, so I had to
hand edit that.  I'm not sure if that will happen again, but if so,
keep the version that includes the variable USE_FALLBACK_IP.  Let me
know how it goes.
Thanks Evan!
I've merged the paches together and cleaned up a couple of whitespace etc.
errors. I've pushed the patch to the new ffmpeg-fallback branch, which is now
also a part of -pu.
If no problems will be discovered, it will be merged into -master soon.
Merged.

                Gregory
e***@cs.umn.edu
2010-12-24 01:47:21 UTC
Permalink
Hurray! What a great Festivus!

F.
Post by Gregory Petrosyan
On Mon, Dec 20, 2010 at 12:20 PM, Gregory Petrosyan
Post by Gregory Petrosyan
Ok, I hope rebasing did the trick.  I ran into an issue where it had
trouble merging patch 0003, in regards to the ./configure file, so I had to
hand edit that.  I'm not sure if that will happen again, but if so,
keep the version that includes the variable USE_FALLBACK_IP.  Let me
know how it goes.
Thanks Evan!
I've merged the paches together and cleaned up a couple of whitespace etc..
errors. I've pushed the patch to the new ffmpeg-fallback branch, which is now
also a part of -pu.
If no problems will be discovered, it will be merged into -master soon.
Merged.
                Gregory
Evan
2010-11-13 23:45:03 UTC
Permalink
In configure: Added FFMPEG_DEFAULT option, along with description in
usage() for it. Added call to config_header for FFMPEG_DEFAULT option,
pointing to config/ffmpeg.h.

In ffmpeg.c: Added include statement for config/ffmpeg.h. Added logic
to change ip_extensions[] definition between fallback mode and normal
mode.

In input.c: Added use_ffmpeg ip struct, and ffmpeg_fallback boolean.
Added logic to return the ip struct of ffmpeg for any format we can't
find an ip for.
---
configure | 3 +++
ffmpeg.c | 5 +++++
input.c | 16 +++++++++++++++-
3 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index 2fac032..f7761c8 100755
--- a/configure
+++ b/configure
@@ -326,6 +326,8 @@ Optional Features: y/n
CONFIG_OSS Open Sound System [auto]
CONFIG_SUN Sun Audio [auto]
CONFIG_WAVEOUT Windows Wave Out [auto]
+ FFMPEG_DEFAULT Set FFmpeg as the default decoder for [n]
+ unrecognized formats.

Also many standard variables like CC are recognized."

@@ -389,6 +391,7 @@ config_header config/tremor.h CONFIG_TREMOR
config_header config/mpc.h MPC_SV7
config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS
+config_header config/ffmpeg.h FFMPEG_DEFAULT

makefile_vars bindir datadir libdir mandir exampledir
makefile_vars CONFIG_FLAC CONFIG_MAD CONFIG_MIKMOD CONFIG_MODPLUG CONFIG_MPC CONFIG_VORBIS CONFIG_WAVPACK CONFIG_WAV CONFIG_MP4 CONFIG_AAC CONFIG_FFMPEG
diff --git a/ffmpeg.c b/ffmpeg.c
index a55c60b..601cf0a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -33,6 +33,7 @@
#include "xmalloc.h"
#include "debug.h"
#include "utils.h"
+#include "config/ffmpeg.h"

#define NUM_FFMPEG_KEYS 8

@@ -397,5 +398,9 @@ const struct input_plugin_ops ip_ops = {
.duration = ffmpeg_duration
};

+#ifdef FFMPEG_DEFAULT
+const char *const ip_extensions[] = { "any", NULL };
+#else
const char *const ip_extensions[] = { "ape", "wma", NULL };
+#endif
const char *const ip_mime_types[] = { NULL };
diff --git a/input.c b/input.c
index 38b7911..214732d 100644
--- a/input.c
+++ b/input.c
@@ -109,6 +109,11 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
{
struct ip *ip;
const char *ext;
+ struct ip *use_ffmpeg;
+ int ffmpeg_fallback;
+
+ use_ffmpeg = NULL;
+ ffmpeg_fallback = 0;

ext = get_extension(filename);
if (ext == NULL)
@@ -117,11 +122,20 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
const char * const *exts = ip->extensions;
int i;

+ if (strcasecmp("ffmpeg",ip->name) == 0)
+ use_ffmpeg = ip;
for (i = 0; exts[i]; i++) {
- if (strcasecmp(ext, exts[i]) == 0)
+ if (strcasecmp("any", exts[i]) == 0)
+ ffmpeg_fallback = 1;
+ if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
+ }
}
}
+ if(use_ffmpeg && ffmpeg_fallback){
+ return use_ffmpeg->ops;
+ }
+
return NULL;
}
--
1.7.2.3


--6c2NcOVqGQ03X4Wi
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="0002-In-configure-added-default-value-for-FFMPEG_DEFAULT.patch"
Evan
2010-11-17 05:25:33 UTC
Permalink
---
configure | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index f7761c8..ce7072a 100755
--- a/configure
+++ b/configure
@@ -294,6 +294,7 @@ prefix=/usr/local
DEBUG=1
CONFIG_TREMOR=n
CONFIG_MIKMOD=n
+FFMPEG_DEFAULT=n
# unset CONFIG_* variables: if check succeeds 'y', otherwise 'n'

USAGE="
--
1.7.2.3


--6c2NcOVqGQ03X4Wi
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0003-Patch-cleanup.patch"
Evan
2010-12-05 00:42:51 UTC
Permalink
In configure: Changed variable name FFMPEG_DEFAULT to USE_FALLBACK_IP.
Changed format of usage() to accomodate longer variable name.

In ffmpeg.c: Changed variable name FFMPEG_DEFAULT to USE_FALLBACK_IP.

In input.c: Removed variable 'int ffmpeg_fallback'. Changed variable
'struct ip *use_ffmpeg' to 'struct ip *fallback_ip'. Removed ffmpeg
specific code.
---
configure | 46 +++++++++++++++++++++++-----------------------
ffmpeg.c | 2 +-
input.c | 15 +++++----------
3 files changed, 29 insertions(+), 34 deletions(-)

diff --git a/configure b/configure
index ce7072a..75df040 100755
--- a/configure
+++ b/configure
@@ -294,7 +294,7 @@ prefix=/usr/local
DEBUG=1
CONFIG_TREMOR=n
CONFIG_MIKMOD=n
-FFMPEG_DEFAULT=n
+USE_FALLBACK_IP=n
# unset CONFIG_* variables: if check succeeds 'y', otherwise 'n'

USAGE="
@@ -308,27 +308,27 @@ Options:
DEBUG Debugging level (0-2) [$DEBUG]

Optional Features: y/n
- CONFIG_FLAC Free Lossless Audio Codec (.flac, .fla) [auto]
- CONFIG_MAD MPEG Audio Decoder (.mp3, .mp2, streams) [auto]
- CONFIG_MODPLUG libmodplug (.mod, .x3m, ...) [auto]
- CONFIG_MIKMOD libmikmod (.mod, .x3m, ...) [n]
- CONFIG_MPC libmpcdec (Musepack .mpc, .mpp, .mp+) [auto]
- CONFIG_VORBIS Ogg/Vorbis (.ogg, application/ogg, audio/x-ogg) [auto]
- CONFIG_TREMOR Use Tremor as Ogg/Vorbis input plugin [n]
- CONFIG_WAV WAV [y]
- CONFIG_WAVPACK WavPack (.wv, audio/x-wavpack) [auto]
- CONFIG_MP4 MPEG-4 AAC (.mp4, .m4a, .m4b) [auto]
- CONFIG_AAC AAC (.aac, audio/aac, audio/aacp) [auto]
- CONFIG_FFMPEG FFMPEG (.shn, .wma) [auto]
- CONFIG_PULSE native PulseAudio output [auto]
- CONFIG_ALSA ALSA [auto]
- CONFIG_AO Libao cross-platform audio library [auto]
- CONFIG_ARTS ARTS [auto]
- CONFIG_OSS Open Sound System [auto]
- CONFIG_SUN Sun Audio [auto]
- CONFIG_WAVEOUT Windows Wave Out [auto]
- FFMPEG_DEFAULT Set FFmpeg as the default decoder for [n]
- unrecognized formats.
+ CONFIG_FLAC Free Lossless Audio Codec (.flac, .fla) [auto]
+ CONFIG_MAD MPEG Audio Decoder (.mp3, .mp2, streams) [auto]
+ CONFIG_MODPLUG libmodplug (.mod, .x3m, ...) [auto]
+ CONFIG_MIKMOD libmikmod (.mod, .x3m, ...) [n]
+ CONFIG_MPC libmpcdec (Musepack .mpc, .mpp, .mp+) [auto]
+ CONFIG_VORBIS Ogg/Vorbis (.ogg, application/ogg, audio/x-ogg) [auto]
+ CONFIG_TREMOR Use Tremor as Ogg/Vorbis input plugin [n]
+ CONFIG_WAV WAV [y]
+ CONFIG_WAVPACK WavPack (.wv, audio/x-wavpack) [auto]
+ CONFIG_MP4 MPEG-4 AAC (.mp4, .m4a, .m4b) [auto]
+ CONFIG_AAC AAC (.aac, audio/aac, audio/aacp) [auto]
+ CONFIG_FFMPEG FFMPEG (.shn, .wma) [auto]
+ CONFIG_PULSE native PulseAudio output [auto]
+ CONFIG_ALSA ALSA [auto]
+ CONFIG_AO Libao cross-platform audio library [auto]
+ CONFIG_ARTS ARTS [auto]
+ CONFIG_OSS Open Sound System [auto]
+ CONFIG_SUN Sun Audio [auto]
+ CONFIG_WAVEOUT Windows Wave Out [auto]
+ USE_FALLBACK_IP Use a specific IP for every unrecognized [n]
+ format. Currently set to ffmpeg.

Also many standard variables like CC are recognized."

@@ -392,7 +392,7 @@ config_header config/tremor.h CONFIG_TREMOR
config_header config/mpc.h MPC_SV7
config_header config/mp4.h USE_MPEG4IP
config_header config/curses.h HAVE_RESIZETERM HAVE_USE_DEFAULT_COLORS
-config_header config/ffmpeg.h FFMPEG_DEFAULT
+config_header config/ffmpeg.h USE_FALLBACK_IP

makefile_vars bindir datadir libdir mandir exampledir
makefile_vars CONFIG_FLAC CONFIG_MAD CONFIG_MIKMOD CONFIG_MODPLUG CONFIG_MPC CONFIG_VORBIS CONFIG_WAVPACK CONFIG_WAV CONFIG_MP4 CONFIG_AAC CONFIG_FFMPEG
diff --git a/ffmpeg.c b/ffmpeg.c
index 601cf0a..3f2077d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -398,7 +398,7 @@ const struct input_plugin_ops ip_ops = {
.duration = ffmpeg_duration
};

-#ifdef FFMPEG_DEFAULT
+#ifdef USE_FALLBACK_IP
const char *const ip_extensions[] = { "any", NULL };
#else
const char *const ip_extensions[] = { "ape", "wma", NULL };
diff --git a/input.c b/input.c
index 214732d..cf6a75d 100644
--- a/input.c
+++ b/input.c
@@ -109,11 +109,9 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
{
struct ip *ip;
const char *ext;
- struct ip *use_ffmpeg;
- int ffmpeg_fallback;
+ struct ip *fallback_ip;

- use_ffmpeg = NULL;
- ffmpeg_fallback = 0;
+ fallback_ip = NULL;

ext = get_extension(filename);
if (ext == NULL)
@@ -122,19 +120,16 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)
const char * const *exts = ip->extensions;
int i;

- if (strcasecmp("ffmpeg",ip->name) == 0)
- use_ffmpeg = ip;
for (i = 0; exts[i]; i++) {
if (strcasecmp("any", exts[i]) == 0)
- ffmpeg_fallback = 1;
+ fallback_ip = 1;
if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
}
}
}
- if(use_ffmpeg && ffmpeg_fallback){
- return use_ffmpeg->ops;
- }
+ if (fallback_ip)
+ return fallback_ip;

return NULL;
}
--
1.7.2.3


--6c2NcOVqGQ03X4Wi
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0004-Polishing.patch"
Evan
2010-12-14 04:34:14 UTC
Permalink
In input.c: Fixed ip struct assignment and return value for fallback_ip
variable.
---
input.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/input.c b/input.c
index cf6a75d..88d2436 100644
--- a/input.c
+++ b/input.c
@@ -122,14 +122,14 @@ static const struct input_plugin_ops *get_ops_by_filename(const char *filename)

for (i = 0; exts[i]; i++) {
if (strcasecmp("any", exts[i]) == 0)
- fallback_ip = 1;
+ fallback_ip = ip;
if (strcasecmp(ext, exts[i]) == 0){
return ip->ops;
}
}
}
if (fallback_ip)
- return fallback_ip;
+ return fallback_ip->ops;

return NULL;
}
--
1.7.2.3


--6c2NcOVqGQ03X4Wi--
Loading...