summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
Commit message (Collapse)AuthorAgeFilesLines
* libhb: Fix detection of streams in tivo capturesjstebbins2012-03-181-1/+4
| | | | | | | | | Tivo creates an initial program stream map that is incomplete, missing the video stream definition. So don't quit scanning for new streams after seeing the first program stream map. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4513 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Use libdca to decode DTS-ES audio. While the Libav DTS decoder gives us an ↵Rodeo2012-02-011-11/+7
| | | | | | extra channel, we can't do anything with it for the time being. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4430 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Update hb_ff_dts_request_5point1 to work with DTS-ES 6.0 Distcrete sources ↵Rodeo2012-01-311-3/+3
| | | | | | | | | | | | | | | | | | | | | (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
* Fix crash in add_ffmpeg_attachment: the value for "filename" metadata may be ↵Rodeo2012-01-241-1/+1
| | | | | | | | | | NULL, so we can't call strlen without checking. Should fix https://forum.handbrake.fr/viewtopic.php?f=11&t=23018 and https://forum.handbrake.fr/viewtopic.php?f=12&t=23101 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4420 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve mpeg-ps detectionjstebbins2012-01-141-0/+20
| | | | | | | | Make mis-detects less likely by checking all the marker bits in the pack header. This makes it much less likely that we will be spoofed by data that looks like a pack header. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4406 b64f7644-9d1e-0410-96f1-a4d463321fa5
* revert an ffmpeg reader changejstebbins2011-11-091-31/+23
| | | | | | | I did this a while back to improve seek performance for some samples that are demuxed by ffmpeg. But it causes crashes with some file types. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4343 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix probing mpeg video in program streamsjstebbins2011-11-061-2/+37
| | | | | | | | | | | | | | | | | ... and probably some other formats as well. Libav's probe routine doesn't necessarily return names that match the codec names that can be looked up by avcodec_find_decoder_by_name(). So we have to manually map the names if the lookup fails. Lookup for mpeg video started failing with the last Libav bump because they removed an obsolete "mpegvideo" decoder that we were matching on. The correct decoder is "mpeg2video", but probe doesn't return that string. Also fix our implementation of the ff_lockmgr callback. Current git Libav fails if we don't fix it. So might as well fix it now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4341 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Disable DTS-HD LBR secondary audio tracksjstebbins2011-11-021-2/+7
| | | | | | | | | DTS-HD LBR used in HD-DVD and bluray for secondary audio streams. Libav can not decode yet. Having it in the audio list causes long delays during scan while we try to get stream parameters. So skip this audio type for now. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4336 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Find font attachments by file name extensionjstebbins2011-10-251-1/+17
| | | | | | | Some font attachments don't have the correct mime type. So check the file name extension as well when looking for fonts. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4316 b64f7644-9d1e-0410-96f1-a4d463321fa5
* better detection of Libav audio bitratejstebbins2011-10-181-1/+7
| | | | | | | | For some codecs, Libav does not set the codec context bitrate. They expect you to compute it from bits per sample, sample rate, and channels. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4298 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump Libav from v0.7.1 to v0.7-1241-g5f3fb59jstebbins2011-10-151-1/+1
| | | | | | | | | | | | 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 crash during 2 pass encoding TS or PS sourcejstebbins2011-10-151-208/+160
| | | | | | | | | | | | | | | | | | | stream.c cached information that it probed during the first time it opened any source. Then later it would re-use that cached data. I was prematurely deleting the cached data during 2 pass encodes. The problem is that there is no way to know when the cached data is no longer needed. You could have a thousand items in the queue all using the same source, or you could have only 1. So you either have to (a) keep the cached data indefinitely, or (b) you have to be able to handle the case where scanned cached data is flushed before you start an encode. (a) is poor design. And if you choose (b) you might as well eliminate the cache all together. It doesn't really save any time and only complicates the code. In summary, the cache is gone. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4286 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add flac + quality + compression level supportjstebbins2011-10-121-2/+4
| | | | | | | | | Adds flac audio to cli, lingui, and macgui Adds quality and compression level options to cli Adds quality option to lingui Quality option works for vorbis and lame git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4281 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix log spam during batch scan of TS filesjstebbins2011-10-111-0/+6
| | | | | | | | IDRs detected before generating previews were not being remembered. So we started decoding on non-IDR boundaries which generates a lot of decoder log spam. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4279 b64f7644-9d1e-0410-96f1-a4d463321fa5
* handle PCR discontinuities betterjstebbins2011-09-301-39/+33
| | | | | | | | | | The PCR comparison we were doing could cause us to drop all the timestamps for an audio stream when the audio packets are very widely spaced. Now, it detects PCR changes explicitely and only drops the timestamps if a discontinuity PCR prior to the packets current PCR has already been sent to the reader. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4263 b64f7644-9d1e-0410-96f1-a4d463321fa5
* handle TS streams that have no PCRs betterjstebbins2011-09-261-4/+29
| | | | | | | | | | | | | | | | For TS streams that don't have PCRs, we substitute the DTS timestamp from the video track (or PTS if we don't see DTS). But these can bounce around or be wider spaced in the stream that PCRs are meant to be. So I have added a test to see if the timestamp looks like a discontinuity. Then I only pass the timestamp as a PCR if there appears to be a discontinuity. This prevents a lot of scr_offset thrashing. I have also fixed an error in our scr_offset processing. It is rarely triggered and it's effects are so minor with well behaved streams that it would be completely unnoticed. But with the test stream I was using, it caused a factor of 10 times more "audio went backwards" errors. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4254 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix corrupt first frame in BD point-to-pointjstebbins2011-09-191-81/+47
| | | | | | | | | | | 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
* don't pass unhandled TS/PS stream types to demuxjstebbins2011-09-161-0/+3
| | | | | | | | I ran across a stream that has bad timestamps in the Teletext track which causes the demux to think there are discontinuities and drop packets. makes a real mess of things. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4224 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix silly error in scanning BDjstebbins2011-09-151-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4223 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve mpeg PS supportjstebbins2011-09-141-1085/+2664
| | | | | | | | | | | | | | | | | | | | | | 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/+6
| | | | | | | | | | | | 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
* libhb: Use h.264 recovery points as key frames when decodingjstebbins2011-08-161-27/+160
| | | | | | | | | | | Many transport streams have few or zero IDR frames. So scanning them takes a long time, generates a lot of log spam, and results in poor preview quality. Often there will be several identical preview frames because it will find the same IDR for several of the previews. Using recovery points helps all these problems. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4180 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: tighten up dvd program stream detectionjstebbins2011-08-041-2/+4
| | | | | | | so that we don't misdetect mpeg1 program streams as dvd program streams git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4155 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix mis-detection of mov files as mpeg PSjstebbins2011-08-011-8/+10
| | | | | | | | | Tightens the mpeg PS detection further to prevent mis-detection of mov files as mpeg PS. Hopefully doesn't cause faulures to detect real mpeg PS files. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4150 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add more audio passthru optionsjstebbins2011-08-011-3/+15
| | | | | | | | | | | | | | | | | 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
* bump Libav from git-v0.7b2-406-g7b20d35 to release 0.7.1jstebbins2011-08-011-11/+11
| | | | | | | | | | | | | It includes the following fixes: - MKV seek issue: http://git.libav.org/?p=libav.git;a=commit;h=c29c609 - crash when decoding corrupt MPEG-2 streams: http://git.libav.org/?p=libav.git;a=commit;h=20153fb - other misc. fixes: http://git.libav.org/?p=libav.git;a=shortlog;h=refs/heads/release/0.7 It includes the following new feature: - support for DTS in MP4 and MOV files: http://git.libav.org/?p=libav.git;a=commit;h=26f4875 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4148 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix some log spam when scanning h.264 BDsjstebbins2011-08-011-4/+2
| | | | | | | | Some residual data from the previous preview was being sent to the decoder after a seek causing the decoder to complain. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4147 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix or simplify several hacks involved with Libav supportjstebbins2011-07-271-243/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: fix access outside allocated memory regionjstebbins2011-07-191-19/+25
| | | | | | | | | In some cases we could access memory outside the memory buffer we allocate for TS packets. This didn't cause any known crashes, but it could possibly lead to a crash. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4123 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix incorrect error message when adding substreams to ts listjstebbins2011-06-211-8/+8
| | | | | | | | | | The error message was meant to catch the case were a source has more than 2 substreams in a stream. But due to incorrect order of conditionals, it triggered when both substreams have been seen and we try to add one of them again (which is allowed and should do nothing). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4071 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add DTS-HD passthru \o/jstebbins2011-06-141-25/+39
| | | | 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-0/+1
| | | | | | | | 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: disable threaded ffmpeg decoding for scanjstebbins2011-06-101-1/+0
| | | | | | | | 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-1/+1
| | | | | | | | 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
* libhb: don't use deprecated elements of the FFmpeg/Libav APIjstebbins2011-04-281-20/+14
| | | | | | | | | | | | | 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
* Make order of audio tracks found in PS streams more predictablejstebbins2011-04-251-1/+10
| | | | | | | | | Since PS streams don't have a directory of streams, we find them by scanning the PES headers for stream types. We were adding them in the order found which is pretty random. This sorts audios by substream id. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3958 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix a problem when encoding the same source audio track twice from BD sourcesjstebbins2011-04-251-5/+23
| | | | | | | | | The pid and substream were being added to the TS stream list twice which caused 2 copies of each packet to be returned to reader. This caused sync to drop every second packet with "time went backwards" log message. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3957 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add support for TrueHD and DTS-HD from BD sourcesjstebbins2011-04-221-483/+761
| | | | | | | | | | | | | | 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
* Change internal audio representation rangejstebbins2011-04-081-0/+1
| | | | | | | | | | | ...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
* Flush ffmpeg codec buffers after every seek.jstebbins2011-04-021-1/+21
| | | | | | | | | | According to several e-mails I've read on ffmpeg-devel, avcodec_flush_buffers should be called after any seek. It appears this is even more critical to do when using frame based multi-threading. I don't see any immediate difference in functionality by adding this, but it may prevent surprises in the future. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3896 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix garbled previews from BD h.264 sourcesjstebbins2011-04-021-1/+4
| | | | | | | | | | | Forome reason, frames that are tagged as recovery points in many BD h.264 streams do not result in complete frames when decoded. Pushing 2 extra frames through the decoder seems to always fix this. This patch extends something I was already doing when generating previews from a BD structure. This just applies the same logic to ffmpeg streams that have h.264 video. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3895 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix chapter passthru problems with some files.jstebbins2011-03-291-0/+1
| | | | | | | | | | | | If the video stream is not the first track in the file, chapters were lost. During scan, we identify which track is video and stash this in title. While reading, when a chapter is found we want to tag the next video buffer. But the video track id stored in the title was not being applied when opening the file for reading, so the chapter mark always went on track id 0. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3889 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add support for DTS-HD High Resolution Audio for BD streamsjstebbins2011-03-191-5/+29
| | | | | | | Thanks to Rodeo for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3851 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Use ffmpeg's lock manager for locking needed by ffmpegjstebbins2011-03-101-1/+1
| | | | | | | | This lets ffmpeg tell us when it needs a lock instead of us trying to guess which functions we need to wrap in a mutex. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3834 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Remove a workaround for an ffmpeg bug that has been fixed.jstebbins2011-03-081-11/+0
| | | | | | | | | Removal of the workaround also removes the need for a patch that fails to apply cleanly to latest ffmpeg git. So remove the patch as well. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3833 b64f7644-9d1e-0410-96f1-a4d463321fa5
* silence compiler warning about const char *jstebbins2011-03-011-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3822 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg from git-185a155 to git-0b32da9jstebbins2011-02-271-1/+1
| | | | | | | fixes win64 crash git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3818 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Remove unnecessary translation of string "LIBFAAD" to "AAC".jstebbins2011-02-111-4/+0
| | | | | | | | ffmpeg will never give us this name anymore since it no longer wraps faad. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3795 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix issue with decoding DTS-HD streamsjstebbins2011-02-081-17/+17
| | | | | | | | We now inspect the new profile member of AVCodecContext to determine if the stream is DTS or DTS-HD and send it to the appropriate decoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3785 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix ffmpeg multiple audio decode issuejstebbins2011-01-171-1/+1
| | | | | | | | 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