summaryrefslogtreecommitdiffstats
path: root/libhb/decavcodec.c
Commit message (Collapse)AuthorAgeFilesLines
* Use more correct check to detect 6.0/6.1 input.Rodeo2012-02-011-1/+1
| | | | | | | | The old check didn't cause any issues in practice, but wasn't 100% correct. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4429 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update hb_ff_dts_request_5point1 to work with DTS-ES 6.0 Distcrete sources ↵Rodeo2012-01-311-11/+14
| | | | | | | | | | | | | | | | | | | | | (decode the DTS 5.0 core). Rename it to hb_ff_dts_disable_xch. Tested with: M2TS -> regular DTS 5.1 -> DTS-ES 6.1 Discrete MKV -> regular DTS 5.1 -> DTS-ES 6.0 Discrete -> DTS-ES 6.1 Discrete git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4428 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Disable multi-threaded decoding of ProResjstebbins2011-11-131-2/+5
| | | | | | | It causes artifacts in some videos git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4346 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg to v0.7-1470-gb95fbbajstebbins2011-10-261-2/+6
| | | | | | | | | Fixes problem setting dsur_mode in ac3 encoder that caused encode failures if using ac3 encoder and mixdown is dolby or dplii. Fixes a VC-1 decode issue that caused scattered misplaced blocks. Fixes swscale bug that caused banding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4322 b64f7644-9d1e-0410-96f1-a4d463321fa5
* initialize wait_for_keyframe in the right placejstebbins2011-10-251-1/+1
| | | | | | | It was in in the wrong initialization function. So wasn't doing anything very useful :p git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4317 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a problem with resolution changes in h.264jstebbins2011-10-171-7/+25
| | | | | | | | | | | | First, the scaling code in decavcodec.c was broken and didn't properly compensate for frames that had a different resolution than the rest of the stream. Second, libav can not handle resolution changes when doing frame based multi-threading. So disable threading when resolution changes are detected. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4295 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump Libav from v0.7.1 to v0.7-1241-g5f3fb59jstebbins2011-10-151-7/+8
| | | | | | | | | | | | Fixes VC-1 decode issue Adds partial support for interlaced VC-1 decode Adds ProRes decoder Fixes ac3 encoder dolby flag Fixes DCA frame size setting (delete patch A04) Fixes VC-1 repeat field processing (delete patch A05) Numerous other bug fixes and enhancements git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4291 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix framerate detection for AVCHD-Litejstebbins2011-09-241-1/+5
| | | | | | | | The AVCHD-Lite specification only supports 50 or 60 fps. So to get 25 or 30 fps, they double every frame using repeat flags. Detect this and adjust the framerate accordingly. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4242 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Force title dimensions to be evenjstebbins2011-09-191-8/+13
| | | | | | | | HandBrake's video pipeline uses yuv420 color which requires even dimensions. The input video may be a diffent color space that allows odd dimensions. So crop a row or colomn if necessary. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4239 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix corrupt first frame in BD point-to-pointjstebbins2011-09-191-3/+24
| | | | | | | | | | | Seek point may be a recovery point which will not be a complete clean frame. So consume frames till we reach the recovery frame count. Patches Libav so it can tell us when the recovery point has been reached. Also improves detection of recovery points in TS files. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4231 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve mpeg PS supportjstebbins2011-09-141-14/+43
| | | | | | | | | | | | | | | | | | | | | | Adds support for MPEG-1 PS, HDDVD EVOB, and video codecs other than mpeg1/2 in PS Improves probing of unknown stream types by using Libav's probing utilities Use Libav to probe for dts profile in TS and PS files when profile is unknown Improves framerate detection (improved telecine detection) Fixes preview generation for mpeg video that has only a single sequence header Patches Libav to handle VC-1 pulldown flags properly Improve PS and TS stream log information git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4220 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: work around the lack of 6.1 support for DTS sourcesRodeo2011-09-091-0/+23
| | | | | | | | | | | | libhb doesn't support 6.1 sources and assumes they're 7.0 instead. This breaks downmixing. Libav can decode the DTS-ES 6.1 core of DTS-HD 6.1 audio tracks; tell it to not process the additional channel so that such tracks can be re-encoded correctly. See https://reviews.handbrake.fr/r/200/ for more information. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4209 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add more audio passthru optionsjstebbins2011-08-011-0/+6
| | | | | | | | | | | | | | | | | adds aac and mp3 passthru for mp4 and mkv containers adds dts and dtshd for mp4 container (mkv already had it) Note: The only player known (to me) to support dts(hd) in mp4 is ff/avplay In LinGui there is a new option to limit which passthru codecs will be used by the "Auto Passthru" audio codec options. The CLI already has this ability with "--audio_copy-mask" which is use in conjunction with the "copy" audio codec option. Also corrects some A/V sync issues when video frames are dropped due to a gap detected in the audio. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4149 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix or simplify several hacks involved with Libav supportjstebbins2011-07-271-593/+286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For files that are demuxed by Libav, we must share the format context with the decoder iso that it can obtain the codec context for each stream. The code that did this was very convoluted and difficult to understand. It is simplified by simply passing the context in hb_title_t. Reader was closing stream files before the decoder was finished with the context. This created the need to delay the actual close and cache the context. Changed reader so it behaves more like the rest of handbrake's work objects which lets us explicitly close after the decoders are finished. Libav does some probing of the file when av_find_stream_info is called. This probing leaves the format context in a bad state for some files and causes subsequent reads or seeks to misbehave. So open 2 contexts in ffmpeg_open. One is used only for probing, and the other only for reading. decavcodec.c had 2 separate decoders for files demuxed by hb and files demuxed by Libav. They have been combined and simplified. Previously, it was not possible to decode one source audio track multiple times in order to fan it out to multiple output tracks if the file is demuxed by Libav. We were using the codec context from the format context. Since there is only one of these for each stream, we could only do one decode for each stream. Use avcodec_copy_context to make copies of the codec context and allow multiple decodes. This allows removal of a lot of special case code for Libav streams that was necessary to duplicate the output of the decoder. Patch Libav's mkv demux to fix a seek problem. This has been pushed upstreams, so the next time we update Libav, we must remove this patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4141 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: plug a few memory leaksjstebbins2011-07-191-5/+31
| | | | | | | Noticed when debugging a memory corruption issue with valgrind git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4122 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: flush frame re-ordering delay queue properly when there are < 8 framesjstebbins2011-06-211-1/+3
| | | | | | | If the queue never completely filled, it would not be flushed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4070 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add DTS-HD passthru \o/jstebbins2011-06-141-38/+45
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4055 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: generalize channel remapping between decoders and encodersjstebbins2011-06-121-55/+7
| | | | | | | | Decoders set the channel map of their output in hb_audio_config_t. Encoders use this information to remap while encoding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4052 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: clean up AVCodecContext initializationsjstebbins2011-06-101-6/+5
| | | | | | | | also fixes warning message generated by libav when initializing "silence" sample about channel layout setting. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4038 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: disable threaded ffmpeg decoding for scanjstebbins2011-06-101-2/+4
| | | | | | | | There is a bug in ffmpeg that causes a crash if you call avcodec_open and avcodec_close repeatedly on the same AVCodecContext. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4037 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: Enable multi-threaded decode in ffmpegjstebbins2011-06-081-5/+7
| | | | | | | | Enable both slice and frame based mutli-threaded decode in ffmpeg. Uses cpu_count/2 + 1 threads. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4034 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix up usage of deprecated libav symbols and clean up patch fuzzjstebbins2011-06-071-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4030 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Bump FFmpeg from git-0b32da9 to git-v0.7b2-406-g7b20d35 (from Libav)jstebbins2011-06-071-1/+6
| | | | | | | | | | | | | | | | Highlights: - Sources with more than 20 streams (video, audio and subtitles combined) are now supported - Adds decoding support for 10-bit H.264 - Adds frame-based threading for H.264 and VP8 Not yet enabled in HB. See experimental patch on RB to enable. - Quality tweaks for the AC3 encoder - AAC encoder improvements Not yet enabled in HB. See experimental patch on RB to enable. - Miscellaneous other fixes and improvements git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4028 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: don't use deprecated elements of the FFmpeg/Libav APIjstebbins2011-04-281-1/+1
| | | | | | | | | | | | | HandBrake uses many attributes of the FFmpeg API that are were deprecated when we did the last bump. Many of them no longer exist in current FFmpeg/Libav git, or are going to be removed soon. Replaces them with non-deprecated attributes that already exist in the build we currently use. Thanks to Rodeo for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3964 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix stall due due to propagation of incorrect audio timestampjstebbins2011-04-241-0/+2
| | | | | | | | Was passing AV_NOPTS_VALUE that is generated by libav. Needed to translate to -1 which is what we use to designate invalid timestamps. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3955 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add support for TrueHD and DTS-HD from BD sourcesjstebbins2011-04-221-14/+9
| | | | | | | | | | | | | | TrueHD and DTS-HD now show up in the audio list along side their AC-3 and DTS counterparts. Note that currently the DTS-HD decoder we are using (ffmpeg) discards the HD portion of the stream and onle decodes the DTS core portion. So there is no advantage yet to using the DTS-HD stream. In the future I would like to add DTS-HD passthru support and hopefully ffmpeg will improve their DTS-HD decoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3950 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Eliminate incompatible pointer type warnings for sws_scalejstebbins2011-04-081-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3910 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change internal audio representation rangejstebbins2011-04-081-29/+23
| | | | | | | | | | | ...from float [-32768...32767] to float [-1.0...1.0] Using the range [-1.0..1.0] requires fewer translations of the range for our various encoders and decoders. This also gets rid of a hacky translation from float to int to float in decavcodec audio decoding. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3908 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add parameter parsing and b-frame support to ffmpeg mpeg-4 encoderjstebbins2011-03-111-2/+1
| | | | | | | | | | | | | The cli will now accept ':' separated parameters using the '-x' option for ffmpeg mpeg-4. The linux gui has an entry box on the advanced tab to add options. The option keys and values are the same as what the ffmpeg command line allows. Calculation of DTS timestamps was added to encavcodec.c in order to allow out of order b-frames. The algorithm is similar to what x264 uses. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3839 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix crash with bd lpcm audio decodingjstebbins2011-02-251-1/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3807 b64f7644-9d1e-0410-96f1-a4d463321fa5
* plug some memory leaks.jstebbins2011-02-121-1/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3797 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix sync issue introduced in 3786jstebbins2011-02-111-0/+5
| | | | | | | Thanks to mac_man_ad for pointing this out and providing a sample. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3791 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve timestamp handling in decavcodecjstebbins2011-02-081-53/+44
| | | | | | | | | | | | Use new ffmpeg facility for passing timestamps through from AVPackets to AVFrames during parsing and decoding. Also fix a bug in handling of the timestamp of the first audio frame. We were putting the timestamp of the second frame on the first and shifting all audio by one frame time. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3786 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix ffmpeg multiple audio decode issuejstebbins2011-01-171-36/+226
| | | | | | | | we can now have one ffmpeg audio input track fan out to multiple output tracks. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3753 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a problem with the first timestamp returned from av_parser_parse2jstebbins2010-11-141-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3677 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg from r25374 to r25689jstebbins2010-11-101-1/+1
| | | | | | | brings back LATM support git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3669 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix windows crash and probably other random nastiness.jstebbins2010-11-061-2/+2
| | | | | | | | | | Initializing extradata_size to non-zero makes ffmpeg think it needs to parse extradata. But in the non-broken-by-microsoft case we leave extradata as uninitialized junk. So ffmpeg parses uninitialized data and sometimes marches off into the weeds. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3651 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix framerate detection again (really, i mean it this time)jstebbins2010-11-051-10/+6
| | | | | | | | | | | integer overflow was causing our sanity checks of ffmpegs frame rate to fail. We would then fall back to using less accurate values. Also removes the completely incorrect adjustment that I made based on ticks_per_frame. That is only useful in a different code path. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3650 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix framerate detection of ffmpeg sourcesjstebbins2010-11-031-0/+4
| | | | | | | found another spot where ticks_per_frame was not being accounted for. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3643 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a segfault and a deadlock if reader exits befor first buffer sentjstebbins2010-10-291-1/+4
| | | | | | | | This can happen if enough of the source is good that it scans but the beginning has an error that causes reader to exit. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3628 b64f7644-9d1e-0410-96f1-a4d463321fa5
* ffmpeg video decoder enhancementsjstebbins2010-10-231-2/+105
| | | | | | | | | Add film/video cadence logging. Set buffer flags indicating field order, progressive, and repeats. Fix frame duration calculation when ffmpeg ticks_per_frame > 1 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3609 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg from 25082 to 25374jstebbins2010-10-121-3/+2
| | | | | | | fixes h264 decoding issue git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3599 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add ac3 encodingjstebbins2010-10-041-13/+38
| | | | | | | Uses ffmpeg's ac3 encoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3570 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a crash when a TS has no aspect ratio set in the video streamjstebbins2010-09-141-3/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3529 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add Bluray supportjstebbins2010-09-081-2/+18
| | | | | | | | | | | | | | | | | | Unencrypted BD directory trees only. Doesn't support iso images. Also, no PGS subtitle support yet. Chapters and angles are supported. Adds a new contrib libbluray. Adds new option to hb_scan() for duration of short titles to filter. This applies to BD and DVD multi-title scans only. Does not apply to any single title scans. Fixes memory leak during scan. hb_buffer_close() was not freeing all buffers in a chain of buffers passed to it. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3510 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Support for reading VOB subtitle tracks from file inputs initital ↵dynaflash2010-05-201-9/+29
| | | | | | | | | | | | | | implementation. - Patch by davidfstr, Nice Work! - Adds support for reading VOB subtitle tracks from file inputs. Tested with: - MKV VOB -> MKV VOB passthru. - MKV VOB -> MKV VOB burned in. VOB subtitle palette moved from per-title to per-track. Discussion leading up to commit can be referenced here: http://forum.handbrake.fr/viewtopic.php?f=4&t=16267 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3308 b64f7644-9d1e-0410-96f1-a4d463321fa5
* allow mono mixdown with lame encoderjstebbins2010-05-131-4/+0
| | | | | | | | | | enable mono mode in lame encoder when mixdown is mono. use lame_encode_buffer_float instead of lame_encode_buffer_interleave. this eliminates the clipping issue in lame without reducing the level of the input. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3294 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg to rev 22950jstebbins2010-04-251-2/+8
| | | | | | | | | offset ffmpeg seeks by value of initial timestamp since it can be non-zero catch pix fmt that is unsupported by swscale, log it, skip the track use new ffmpeg avg_frame_rate for more accurate framerate estimate git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3267 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix qdm2 audio decodingjstebbins2010-04-251-1/+10
| | | | | | | | | | | | it seems ffmpeg wants to be passed the same buffer repeatedly while decoding this audio type. we were exiting if ffmpeg said it consumed 0 bytes. Now we continue to feed the same buffer when this happens. I added a loop limit to protect against an hypothetical ffmpeg bug that would never consume anything. I wonder if any other codecs behave this way *scratches head in bewilderment* git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3264 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix decoding of qtrle codec and possibly othersjstebbins2010-04-241-0/+10
| | | | | | | | | | we rely on ffmpeg calling context->get_buffer, which we override to point to our get_frame_buf(), to stuff our pts values into frames it is decoding. but some decoders call context->reget_buffer instead. So I added an override for this callback as well. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3262 b64f7644-9d1e-0410-96f1-a4d463321fa5