foo86 / dcadec

DTS Coherent Acoustics decoder with support for HD extensions
117 stars 40 forks source link

Integrate with ffmpeg/libav #13

Closed popcornmix closed 9 years ago

popcornmix commented 9 years ago

I wonder if you are planning on submitting this to ffmpeg/libav? It would certainly be very appreciated there (and for downstream projects like kodi).

Nevcairiel commented 9 years ago

A wrapper for libdcadec is already available in ffmpeg, that way you can use it through ffmpeg just fine.

popcornmix commented 9 years ago

Can you explain exactly what to do? Are you suggesting replacing the existing dcadec decoder? E.g. copy the source files from this project to libavcodec and modify

OBJS-$(CONFIG_DCA_DECODER)             += dcadec.o dca.o dcadsp.o      \
                                          dcadata.o dca_exss.o         \
                                          synth_filter.o

to build this project's files?

Nevcairiel commented 9 years ago

Just build it with --enable-libdcadec --disable-decoder=dca, then libdcadec will be used, and the internal decoder disabled.

Note that this ability is only available in very recent versions, it was added just last week.

popcornmix commented 9 years ago

That option isn't in my stable version (n2.6). I see it went into master a few days ago. Excellent - I'll update to latest ffmpeg.

ghost commented 9 years ago

--disable-decoder=dca

That seems a bit radical, just use avcodec_alloc_context3(avcodec_find_decoder_by_name("libdcadec")).

Nevcairiel commented 9 years ago

That is assuming you don't control the code that uses it, or don't want to hardcode decoder names but make auto-selection simply work. I'm not sure what advantages avcodec dca would offer over libdcadec, so might as well turn it off!

popcornmix commented 9 years ago

Thanks for the help. I think I've got this working with kodi. It builds and reports DTS-HD MA 7.1. https://github.com/popcornmix/xbmc/commit/e653f7b6b6333881850d863c64e0ba84dda4c99c

popcornmix commented 9 years ago

I'm trying @wm4's suggestion of enabling both libraries and using avcodec_find_decoder_by_name("libdcadec") to optionally choose libdcadec. That works fine, but (I assume) the demuxer is using the old codec for parsing, as it reports 6 channels when using this scheme compared to 8 when disabling the old dca codec.

Can I at runtime make the parser use libdcadec?

kasper93 commented 9 years ago

Can we move this discussion to appropriate mailing list? This is not an issue with libdcadec.

ghost commented 9 years ago

@popcornmix: I guess that's true; you don't need to trust the demuxer's output though, just use what the decoder returns to you in AVFrame.

What kasper93 says is also true, but isn't this GH issue specifically about ffmpeg?

Nevcairiel commented 9 years ago

I think the issue can be closed. Integration in ffmpeg is available in Git, and Libav has the patches on their ML. Any further changes to how its integrated is really up to the projects, and should indeed be discussed there.

popcornmix commented 9 years ago

Yes, thanks for the pointers.