Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2015
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
  2. index a28b983..ddadced 100644
  3. --- a/libavcodec/libdcadec.c
  4. +++ b/libavcodec/libdcadec.c
  5. @@ -31,9 +31,11 @@
  6. #include "internal.h"
  7.  
  8. typedef struct DCADecContext {
  9. + const AVClass *class;
  10. struct dcadec_context *ctx;
  11. uint8_t *buffer;
  12. int buffer_size;
  13. + int flags;
  14. } DCADecContext;
  15.  
  16. static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
  17. @@ -160,7 +162,7 @@ static av_cold int dcadec_init(AVCodecContext *avctx)
  18. {
  19. DCADecContext *s = avctx->priv_data;
  20.  
  21. - s->ctx = dcadec_context_create(0);
  22. + s->ctx = dcadec_context_create(s->flags);
  23. if (!s->ctx)
  24. return AVERROR(ENOMEM);
  25.  
  26. @@ -170,6 +172,27 @@ static av_cold int dcadec_init(AVCodecContext *avctx)
  27. return 0;
  28. }
  29.  
  30. +#define OFFSET(x) offsetof(DCADecContext, x)
  31. +#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
  32. +static const AVOption options[] = {
  33. + { "libdcadec_flags", "Decode DTS core only without extensions", OFFSET(flags), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, (DCADEC_FLAG_NATIVE_LAYOUT << 1) - 1, AD, "libdcadec_flags" },
  34. + { "core", "Decode DTS core only without extensions", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_CORE_ONLY }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  35. + { "bitexact", "Force bit exact DTS core decoding", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_CORE_BIT_EXACT }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  36. + { "synth_x96", "Force DTS core synthesis using X96 filter", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_CORE_SYNTH_X96 }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  37. + { "source_pcm_res", "Force DTS core bit width reducion to source PCM resolution", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_CORE_SOURCE_PCM_RES }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  38. + { "core_lfe_fir", "Use FIR filter for floating point DTS core LFE channel interpolation", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_CORE_LFE_FIR }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  39. + { "native_layout", "Output native DTS channel layout, not WAVEFORMATEX layout", 0, AV_OPT_TYPE_CONST, { .i64 = DCADEC_FLAG_NATIVE_LAYOUT }, INT_MIN, INT_MAX, AD, "libdcadec_flags" },
  40. + { NULL },
  41. +};
  42. +
  43. +static const AVClass libdcadec_class = {
  44. + .class_name = "libdcadec decoder",
  45. + .item_name = av_default_item_name,
  46. + .option = options,
  47. + .version = LIBAVUTIL_VERSION_INT,
  48. + .category = AV_CLASS_CATEGORY_DECODER,
  49. +};
  50. +
  51. static const AVProfile profiles[] = {
  52. { FF_PROFILE_DTS, "DTS" },
  53. { FF_PROFILE_DTS_ES, "DTS-ES" },
  54. @@ -193,5 +216,6 @@ AVCodec ff_libdcadec_decoder = {
  55. .capabilities = CODEC_CAP_DR1 | CODEC_CAP_CHANNEL_CONF,
  56. .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16P,
  57. AV_SAMPLE_FMT_NONE },
  58. + .priv_class = &libdcadec_class,
  59. .profiles = NULL_IF_CONFIG_SMALL(profiles),
  60. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement