[Ffmpeg-devel] [PATCH] FAAC profile selection
Nicolas George
nicolas.george
Sun Apr 29 12:53:03 CEST 2007
Le nonidi 9 flor?al, an CCXV, Michael Niedermayer a ?crit?:
> iam not disagreeing with your argumentation but i prefer the simplest/most
> minimal code which gets the job done optimally and theres no real gain with
> the #ifdef IMHO
>
> also various other parts of AVOption are not under #ifdef
> i mean arithmetic coding, the various mpeg4 options, ...
> and if they all where under ifdefs the AVOption list would contain 3 times
> more ifdefs then actual code ...
That is quite convincing indeed. Here is an updated version of the patch to
take your remarks into account.
Regards,
--
Nicolas George
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c (revision 8856)
+++ libavcodec/utils.c (working copy)
@@ -670,6 +670,10 @@
{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
+{"aac_main", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_MAIN, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_low", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LOW, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ssr", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_SSR, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_AAC_LTP, INT_MIN, INT_MAX, A|E, "profile"},
{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D},
Index: libavcodec/faac.c
===================================================================
--- libavcodec/faac.c (revision 8856)
+++ libavcodec/faac.c (working copy)
@@ -54,7 +54,25 @@
}
/* put the options in the configuration struct */
- faac_cfg->aacObjectType = LOW;
+ switch(avctx->profile) {
+ case FF_PROFILE_AAC_MAIN:
+ faac_cfg->aacObjectType = MAIN;
+ break;
+ case FF_PROFILE_UNKNOWN:
+ case FF_PROFILE_AAC_LOW:
+ faac_cfg->aacObjectType = LOW;
+ break;
+ case FF_PROFILE_AAC_SSR:
+ faac_cfg->aacObjectType = SSR;
+ break;
+ case FF_PROFILE_AAC_LTP:
+ faac_cfg->aacObjectType = LTP;
+ break;
+ default:
+ av_log(avctx, AV_LOG_ERROR, "invalid AAC profile\n");
+ faacEncClose(s->faac_handle);
+ return -1;
+ }
faac_cfg->mpegVersion = MPEG4;
faac_cfg->useTns = 0;
faac_cfg->allowMidside = 1;
Index: libavcodec/avcodec.h
===================================================================
--- libavcodec/avcodec.h (revision 8856)
+++ libavcodec/avcodec.h (working copy)
@@ -1820,6 +1820,10 @@
*/
int profile;
#define FF_PROFILE_UNKNOWN -99
+#define FF_PROFILE_AAC_MAIN 0
+#define FF_PROFILE_AAC_LOW 1
+#define FF_PROFILE_AAC_SSR 2
+#define FF_PROFILE_AAC_LTP 3
/**
* level
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070429/ebb0f22e/attachment.pgp>
More information about the ffmpeg-devel
mailing list