summaryrefslogtreecommitdiffstats
path: root/libhb/reader.c
Commit message (Collapse)AuthorAgeFilesLines
* handle TS streams that have no PCRs betterjstebbins2011-09-261-11/+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
* Improve mpeg PS supportjstebbins2011-09-141-13/+2
| | | | | | | | | | | | | | | | | | | | | | 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: fix or simplify several hacks involved with Libav supportjstebbins2011-07-271-62/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add support for TrueHD and DTS-HD from BD sourcesjstebbins2011-04-221-17/+13
| | | | | | | | | | | | | | 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
* Fix a deadlock that can happen with p-to-p encodingjstebbins2011-04-101-1/+15
| | | | | | | | | | | | | | | | | | With p-to-p, the audio sync thread waits for the video sync thread to reach the designated start point. There is a possibility that the video decoder will drop so many frames that the audio sync fifo fills before any frames reach the video sync thread. When this happens, drop some audio to unplug the pipeline. Also, to make this less likely to happen, start sending data to the video decoder 2 seconds before the actual desired start point. This will allow the decoder to find an initial i-frame before the audio stalls since the audio sync thread drops any audio that is before the designated start point. A side effect of this is our start time now more accurate since the decoder is only dropping frames before the start point instead of after. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3917 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix garbled previews from BD h.264 sourcesjstebbins2011-04-021-1/+2
| | | | | | | | | | | 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
* plug some memory leaks.jstebbins2011-02-121-0/+5
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3797 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix sync of ssa subtitles when using point-to-point encodingjstebbins2010-11-221-27/+10
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3685 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add Bluray supportjstebbins2010-09-081-53/+107
| | | | | | | | | | | | | | | | | | 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
* fix problem with spurious timestamp changejstebbins2010-06-201-4/+7
| | | | | | | | | | | some rearrangement of code that was previously done to reader caused scr_offset to be subtracted from renderOffset twice whenever a new scr_offset was calculated. this could cause subsequent timestamp calculations to be way off and in at least one known case lead to a crash due to consuming too much memory in hb_buffer_t's git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3399 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a problem with point-to-point hanging when searching for start pointjstebbins2010-05-261-39/+42
| | | | | | | | | | in reader, the timestamps were not being correctly adjusted for scr offset before comparing to start time. This could cause an early start in reader. Then in sync, syncAudioWork stalled until the correct start of video was found, causing the audio fifo to fill and stall the whole pipeline. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3329 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add point-to-point encodingjstebbins2009-12-231-10/+111
| | | | | | | | | | | | | | allows frame and pts based start points. end points were already previously supported. New job variables pts_to_start and frame_to_start specify the start point. There can be a period during the encode where it has to search for the start point. During this period, libhb sets a new state HB_STATE_SEARCHING and sets progress and eta till start point found. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3039 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix potential runaway buffer usagejstebbins2009-12-151-1/+8
| | | | | | | | | | pthread_cond_timedwait can wake early. under certain system load conditions, this happens often. I was going ahead and adding buffers whenever it woke, regardless of whether the condition had actually been met. so the fifo depth would increase until memory ran out. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3030 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix detection of forced subtitles during foreign audio searchjstebbins2009-12-071-1/+1
| | | | | | | | | | reader drops all buffers till it finds video or audio. but since video and audio fifos are null when indepth_scan is set, we never see video or audio. Solution is to not drop buffers in indepth scan mode git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3011 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Reduce the amount of buffering used and eliminate hb_snooze in the encoding ↵jstebbins2009-12-051-21/+16
| | | | | | | | | | | | | | | | | | | | | | pipeline For HD sources on an 8 core system with hyperthreading, we were using 1.5GB of ram. Add to that the 600MB x264 uses for rc-lookahead, pushes it north of 2GB. To reduce our memory usage, the fifo depths have been reduced are are no longer a multiple of cpu count. Use of hb_snooze has been eliminated in the encoding pipeline so that performance doesn't fall as a result of the reduced fifo depths. In sync, each audio and video were given separate threads so that each can wait on it's respective input fifo without blocking the others. In muxcommon, each stream being muxed was given a separate thread so that each can wait on it's respective fifo. This allows the removal of hb_snooze in the sync and muxer work loops. In both sync and muxer, there is common data that is shared by all threads, so special init routines allocate this shared data and initialize the threads. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3007 b64f7644-9d1e-0410-96f1-a4d463321fa5
* batch file scanning and scan canceljstebbins2009-11-251-5/+13
| | | | | | | | | | When a directory is specified as the source, first we attempt to open as a dvd, then if that fails, we attempt to open each file in the directory as a stream source. Since opening a large directory of files can take a really long time, you can also now cancel a scan. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2980 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a couple transport stream issuesjstebbins2009-10-231-1/+4
| | | | | | | | | | | | | | | when the first packet seen is audio, the stream timing for the audio must be initialized a little different then when it follows video add a more thorough check for duplicate packets. a ts stream that is the result of splicing multiple clips together can have duplicate continuity count values. usually this means that a duplicate packet exists and the duplicate is dropped. but in the case of spliced clips, the packet should not be dropped. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2895 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix bug that was causing one sec. of audio to be dropped on many ffmpeg ↵van2009-09-211-6/+11
| | | | | | files. Problem is that audio & video can be interleaved in any order but we drop everything up to the first video frame. Since ffmpeg returns a second of audio per read on an audio stream, if audio started before video we lose the first second of it. Changed to allow either audio or video to signal start 'reader'. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2831 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - cleanup gcc format warnings showing up on linux 64-bitkonablend2009-06-251-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2619 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix forced foreign language scan issuesjstebbins2009-06-131-1/+3
| | | | | | | | | | | | | | | - subtitles were not being added to list of subs to scan because the wrong config was being checked for the forced flag. needed to use job->select_subtitle_config instead of subtitle->config - scr code in reader was preventing the majority of subtitle packets from reaching decvobsub. made decvobsub more robust by adding ability to re-sync in the event of lost packets. made scr recovery initialize itself even in the event that it sees audio or subtitles before seeing video. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2526 b64f7644-9d1e-0410-96f1-a4d463321fa5
* softsubs: allow 1 source to many output subs by duplicating thejstebbins2009-06-031-6/+11
| | | | | | | subtitle buffer where necessary git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2475 b64f7644-9d1e-0410-96f1-a4d463321fa5
* softsubtitles:jstebbins2009-06-021-1/+1
| | | | | | | | | | | | | | | | | | - when doing an indepth scan, do not scan CC tracks - separate subtitle configureation attributes into separate hb_subtitle_config_t. Add an instance of this to hb_job_t for setting the attributes of the subtitle found through an indepth scan - Add a default_track flag to hb_subtitle_config_t that tells the muxer that the track should be flaged as the default. muxmkv uses this. - When an indepth scan is complete, check to see if the autoselected subtitle matchces (by id) one of the manually selected subtitles. If a match is found, the autoselected subtitle with all the attributes the user assigned to it replaces the manually selected subtitle. - LinGui: Add "Default" column to subtitle tab. This is a radio that lets the user choose which subtitle should be displayed by default. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2468 b64f7644-9d1e-0410-96f1-a4d463321fa5
* mkv soft subtitle supportjstebbins2009-05-191-1/+1
| | | | | | | | | | | | | - new libmkv 0.6.4 with subtitle track support - muxmkv supports vobsub and closed caption subtitles - added subtitle format, source, and dest initialization to dvdnav - moved subtitle_force flag into hb_subtitle_t struct as it needs to be settable per subtitle - gtk ui added subtitle tab which allows selection of multiple subtitles - reorgainize subtitle sync code to prevent dropping of subtitles when multiple subtitles are enabled git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2428 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Removed double EOF for CC's (one from dvd and one from cc), fixed compiler ↵eddyg2009-05-061-1/+1
| | | | | | warnings for CC. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2394 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Push an EOF onto the subtitle fifos from the reader for DVD VOBSUBs and also ↵eddyg2009-05-061-0/+7
| | | | | | from cc608 for closed captions git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2388 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Stage 1 Soft Subtitle Support - Allow multiple subtitle tracks to be ↵eddyg2009-05-041-26/+13
| | | | | | selected, and mark them for Render or Pass Through. No functional difference from the UIs, however in theory they could render multiple tracks - would be a dogs breakfast on screen though, and is untested. Have tested all normal operations from the UIs, including scanning. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2373 b64f7644-9d1e-0410-96f1-a4d463321fa5
* dvdnav: improve title scanningjstebbins2009-05-011-1/+1
| | | | | | | | | | | - looks for ptt with longest pgc sequence instead of just picking first ptt solves many 'short title' problems - constructs chapters from the pg's within the pgc's instead of using ptt's solve the problem of ptt's that point to an intro pgc instead of to the actual chapter position in the title. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2361 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add libdvdnav supportjstebbins2009-04-271-0/+4
| | | | | | | | | | | emulates the vm of a dvd player in order to navigate the disc more reliably it is optional and disabled by default CLI option '--dvdnav' enables. GUI's have a new option in preferences. When dvdnav is enabled, you can also select angles (cli '--angle') git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2355 b64f7644-9d1e-0410-96f1-a4d463321fa5
* This patch adds mingw32 cross-compilation support to HandBrake trunk tokonablend2009-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | produce native win32 binaries. The main benefits are the binary does not have any Cygwin runtime requirements and various host platforms can be leveraged to build HandBrake. Cross-compilation toolchains are complex to setup and recommended for experts only; but once setup it can build at speeds similar to native builds, on Darwin or Linux. BUILD INSTRUCTIONS: Add mingw32 toolchain to beginning of your path and take the toolchain prefix from gcc (eg: i386-mingw32-gcc) and pass to configure: ./configure --cross=i386-ming32 PRODUCTS: - hb.lib (static library) - HandBrakeCLI.exe DOWNLOADS: Contrib downloads need to be seeded with: - pthreads-w32-2-8-0-release.tar.gz (new) - xvidcore-20090311.tar.gz SUMMARY: Specifically, all GUI trees are not impacted. configure - added --cross=PREFIX - reworked search for gcc and cross-compile related tools to use prefix contrib/ - sub-patches added as needed for mingw contrib/xvidcore/ - bumped from 1.1.3 -> 1.2.1+ (daily 20090311) - reconstituted P01-cygwin.patch - created new P00-darwin.patch needed for macho64 asm flag on x86_64 arch libhb/ - uint -> uint32_t - remaining changes guarded by mingw32 macro. test/ - modified to support pthread-compatibility library attach/detach. - all changes guarded by mingw32 macro. BRANCHES: source: https://hbfork.googlecode.com/svn/branches/mingw@28 target: svn://svn.handbrake.fr/HandBrake/trunk@2325 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2326 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't resync based on subtitles since their average duration is meaningless.van2009-01-151-12/+43
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2087 b64f7644-9d1e-0410-96f1-a4d463321fa5
* More code to deal with the flakey streams from NZ TV. They like to change ↵van2008-12-051-1/+0
| | | | | | the PCR without sending a new PCR and we get big timestamp changes but no new reference clock. So now we look at the PTS and if its change is outside a tolerance window we use the new PTS as a PCR & declare a clock discontinuity. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2008 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add metadata support to libhb, add importing of MP4 metadata, add export of ↵eddyg2008-12-021-2/+24
| | | | | | MP4 metadata, add importing of MP4 chapters, add seek to chapter for input files, add new libmp4v2, remove old MP4 chapter muxing - now in libmp4v2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1987 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds two new parameters to hb_scan, to control the number of preview frames ↵jbrjake2008-11-301-2/+5
| | | | | | | | generated during scan, and whether or not they're written to disk for later display. This will break any interfaces that use hb_scan until the new params are specified...sorry. Also adds a new job->seek_points setting (set this to the same as the number of previews) to be used with job->start_at_preview when doing live preview encodes, so the seek function has a frame of reference. Wires up the CLI with a --previews option (long option only) to control the new scan parameters, and defaults the CLI to not writing previews to disk. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1970 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - add John A. Stebbins' changes to handle TrueHD and DTS-HD multiplexed ↵van2008-11-251-8/+1
| | | | | | | | | | streams. - give transport streams their own demuxer rather than constructing fake PS packets to use the DVD demuxer. - start re-doing the transport stream code so it does fewer memory to memory copies. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1953 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb support for live previewjstebbins2008-11-111-24/+45
| | | | | | | | set job->start_at_preview to the preview frame you want to start at set job->pts_to_stop to the number of 90khz ticks duration git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1915 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Try to drive the stream timing off the audio stream(s) since audio has a pts ↵van2008-10-051-4/+24
| | | | | | on every frame while video typically has one on <10% of the frames. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1813 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Only do 'lost PCR' checks (r1712) when we're dealing with something that ↵van2008-10-031-0/+5
| | | | | | | | | could be an over-the-air transport stream. We can't lose the clock of a program stream and shouldn't have losses on an m2ts stream. - Widen the DTS-to-PCR acceptance window from +-5sec to +-5min since there's nothing in the standard that bounds the offset between a DTS and its clock reference. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1802 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Another bug fix in the per-stream timing code: If the clock reference ↵van2008-09-161-7/+29
| | | | | | changes on the first buffer of a stream we haven't seen before we don't have the history we need to compute a clock offset & need to wait for a stream we've been tracking. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1704 b64f7644-9d1e-0410-96f1-a4d463321fa5
* The difference of two timestamps referenced to different clocks is a random ↵van2008-09-151-5/+7
| | | | | | number & not useful input to the average frame size computation. This major brain-o would occasionally cause huge average frame times which, when later used to compute the SCR correction, would result in large gaps in the audio and/or video streams. Fixed by always computing the average frame size from the scr-corrected timestamps. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1698 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Various fixes for ffmpeg input files (mp4, avi, mkv, etc.):van2008-09-111-14/+15
| | | | | | | | | | - always use source time stamps (HB vfr mpeg4 files now handled correctly) - handle Microsoft's braindead "VFW packed b-frames" - compute average video frame rate from total duration & number of frames (ignore ffmpeg's frame rate which is closer to a max f.r. for vfr video). - workaround an ffmpeg audio decode abort when it used SSE instructions on unaligned buffers. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1687 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix subtitle indepth scan abort & hang.van2008-08-191-1/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1645 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - in encx264, if an video frame is larger than init_delay split it into ↵van2008-07-261-3/+11
| | | | | | | | | | | | pieces so we don't get jerky output caused by out-of-order frames. - add an explicit EOF for all streams, not just video. - don't generate extra audio silence at the end of an encode (don't need it with explicit eof). - get rid of 80ms initial delay in AAC encode & flush final four frames buffered in encoder. - put mp4 'chap' atom on first track (usually video) rather than first audio track since we can now do video without audio (atom just needs to go on an enabled media track & video is always enabled). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1581 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Get rid of excessive video & audio drops on some content by implementing the ↵van2008-07-161-30/+114
| | | | | | | | | last 20% of the MPEG Standard Target Decoder timing model (per-stream timing state). Should fix the problem reported in http://forum.handbrake.fr/viewtopic.php?f=12&t=6601&sid=81048cf54c40b6cdb945236afb4f99da&p=37563#p37563 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1570 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - fix an error in the SCR calculation that would cause an extra frame to be ↵van2008-06-301-1/+16
| | | | | | | | | | dropped at an SCR discontinuity. - fix a rounding error in the encx264 init_delay computation that would underestimate the delay for progressive content and cause spurious "init_delay too small" messages. - clean up the sync.c "video time didn't advance" logic and try to make the error mgs more useful for debugging frame duration problems. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1543 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - support blu-ray, avchd & dvb x264van2008-05-311-30/+36
| | | | | | | - support video files handled by ffmpeg (avi, mkv, mp4, etc.) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1480 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Move clock recovery code from reader to demuxmpeg so it sees all frames & ↵van2008-04-151-52/+9
| | | | | | not just the ones we happen to be encoding. This change gives a more accurate clock and allows us to once again ignore audio during pass 1 of a 2 pass encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1420 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Saearch & Replace domain names to move from .m0k.org to handbrake.fr. Only ↵jbrjake2008-04-151-1/+1
| | | | | | covers trunk files, libhb, and test. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1418 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fixes for different number of frames between pass 1 & 2, missing frames at ↵van2008-04-131-0/+3
| | | | | | | | | | | | end, and an deadlock with pcm audio. - since the SCR clock recovery is done in reader.c we can't currently skip audio frames during pass 1 or we miss clock changes signaled by those frames & end up dropping more video frames in pass 1 than pass 2. - since many modules buffer frames we can't tell if we're done just by looking for empty fifos. Send an empty buffer to mark end-of-stream all the way along the processing pipeline & use it to flush internally buffered data. - in a processing pipeline you're done when the end of the pipe says your done. add a thread status variable so we can tell when individual threads are finished then make do_job wait until the encoder thread is done so that we're sure all the frames have been processed and sent to the muxer. - since the muxer alternates between reading video & audio packets we have to have enough buffer in the audio pipeline to handle a video-frame's worth of audio packets (33ms). Since pcm packets are <1ms we need >60 slots in the audio fifos or we'll deadlock. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1412 b64f7644-9d1e-0410-96f1-a4d463321fa5
* New internal audio handling.saintdev2008-04-011-1/+1
| | | | | | | | Each audio track contains it's own settings for codec, bitrate, samplerate, etc. This allows for very complex combinations of audio tracks if desired. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1365 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix two of my stupid bugs that prevented using the queue with transport streams:van2008-03-201-2/+2
| | | | | | | | - keep a cache of the pid/substream id mappings from each scan rather than assuming an encode will immediately follow a scan (there will be lots of scans followed by lots of encodes when the queue is used). - rewrite a few things to get rid of static variables. hb_ts_stream_decode is called by both scan & reader and they're in different threads. All the working storage & state has to either be in the stream struct or on the stack so it's private to the calling thread or it gets corrupted when doing a scan in the middle of an encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1351 b64f7644-9d1e-0410-96f1-a4d463321fa5