summaryrefslogtreecommitdiffstats
path: root/libhb/muxcommon.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove legacy % to RF mapping.jstebbins2011-03-211-1/+1
| | | | | | | | | | Although the % option has been gone for a while in the cli and gui's, there were some mappings happening in libhb and for preset imports. This removes the last vestages of % quality mapping. Thanks to Rodeo for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3857 b64f7644-9d1e-0410-96f1-a4d463321fa5
* clean up crufty legacy codejstebbins2010-10-231-8/+0
| | | | | | | remove unused code relating to avi, ogm, psp, ipod, and forcing h264 levels git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3622 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix another hang in the muxer.jstebbins2010-10-031-1/+2
| | | | | | | | If all streams are at EOF, then we must continue processing the track queues till they are all empty. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3564 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a rare hang in the muxer.jstebbins2010-09-131-1/+7
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3525 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix muxing problem with certain sources/settingsjstebbins2010-08-311-14/+15
| | | | | | | | | | | | | The fifo depth limit that was put in place to prevent out of memory conditions was too aggressive. It caused buffers to be flushed to the output too early with cercain settings. This change monitors memory usage (i.e. buffer sizes) rather than just fifo depth in order to decide when to flush buffers to prevent out of memory conditions. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3506 b64f7644-9d1e-0410-96f1-a4d463321fa5
* guard against excessive memory consumption in the muxer betterjstebbins2010-06-201-0/+22
| | | | | | | | | if there is a persistant skew in timestamps from 2 streams, the fifo depth could still continue to grow. Added extra check for fullness of fifo. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3400 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix fps logging when there is no audio track.jstebbins2010-04-221-6/+13
| | | | | | | | | | where there's no audio, the muxer closes earlier than when there is audio due to reference counting. upon close, the muxer sets the muxing state which overwrites the current state that includes the avg fps. so log the avg fps before closing mux. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3251 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix silence insertion problem in audio sync and pipeline stall problemjstebbins2010-04-031-2/+5
| | | | | | | | | | | | | | | | | | | | the current audio buffer was being dropped when silence was inserted, causing the time to fall even further behind and provoke more silence insertion in some cases. with pont-to-point, it is possible for one stream to complete before the other(s). when the work_loop exits for that stream, the fifo is no longer serviced and may fill. This can back up and cause a stall in reader causing the streams that are not yet complete to stall. The Solution is to continue servicing the fifo after work for a stream is complete. This was complicated by the fact that the video sync work object was being used as the indicator that all work was finished. When it exited everything was told to stop. So now, the muxer work object (last in the chain) is the indicator when work is done. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3197 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix sporadic incorrect bitrate calculation of muxed tracksjstebbins2010-03-271-1/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3173 b64f7644-9d1e-0410-96f1-a4d463321fa5
* reduce mux interleave threshold more to prevent out of memory situationsjstebbins2010-03-191-1/+1
| | | | | | | | | | when skewed timestamps or premature end of a stream is encountered, the muxer buffers streams in an attempt to interleave stream timestamps. this threshold tells it when to give up. The previous value still allowed out of memory conditions with windows 2GB per application limit. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3169 b64f7644-9d1e-0410-96f1-a4d463321fa5
* put a limit on how many buffers the muxer will cache when it isjstebbins2010-02-091-4/+11
| | | | | | | | | | | having trouble interleaving timestamps This prevents some out of memory crashes. In particular, it fixes a crashed caused by a source in which the audio stream ends substantially before the video stream ends. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3106 b64f7644-9d1e-0410-96f1-a4d463321fa5
* use DTS generated by x264 when computing duration and offset in muxmp4jstebbins2010-02-061-1/+0
| | | | | | | | also fix an issue where ffmpeg generated negative PTS for initial frames of video. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3097 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Only display mux stats oncejstebbins2009-12-101-42/+42
| | | | | | | | Close prints mux stats and gets called for each stream. So only print the stats when the last stream is closed. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3023 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix buffer leak during indepth scan jstebbins2009-12-081-0/+6
| | | | | | | and fix a couple potential leaks if the timing is just right in work loops git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3016 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Reduce the amount of buffering used and eliminate hb_snooze in the encoding ↵jstebbins2009-12-051-163/+257
| | | | | | | | | | | | | | | | | | | | | | 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
* - cleanup gcc format warnings showing up on linux 64-bitkonablend2009-06-251-3/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2619 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Format cleanup.konablend2009-06-251-2/+1
| | | | | | | | | | - fixed ports.c to use a more portable method of getting integral pthread_t representation; resolves mingw crash. - added GCC attribute to generate compiler warnings for invalid usage of hb_log, hb_deep_log and hb_errror; see new macro HB_WPRINTF(s,v) in common.h. - fixed various invalid usage of above functions on osx i386/x86_64, and mingw. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2618 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
* Another subtitle muxing fix: Don't check the rdy bit before calling ↵van2009-05-111-18/+14
| | | | | | OutputTrackChunk so subtitles get output as early as possible based on their start time rather than just before their stop time. (rdy is still checked for non-subtitle tracks since their rdy bit is in the allRdy mask that's tested in the outer loop.) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2410 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix another subtitle interleaving botch - for mkv's we want the subtitle in ↵van2009-05-091-8/+8
| | | | | | the cluster where it starts, not the cluster where it ends. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2409 b64f7644-9d1e-0410-96f1-a4d463321fa5
* subtitle muxing: jstebbins2009-05-061-0/+8
| | | | | | | | | | initialize mux_data for passthru subtitles in muxmp4 and muxmkv add non-continuous tracks for passthru subtitles in muxcommon log closed caption data that gets to the muxer git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2393 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix several boneheaded mistakes in fifo ready logic.van2009-05-061-13/+16
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2391 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix mkv muxing. eddyg forgot to add a break in a switch he modified.jstebbins2009-05-041-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2378 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Soft Subs Part 2: Auto-detect CC during scan, add CC to subtitle list in ↵eddyg2009-05-041-20/+32
| | | | | | title, if selected then CC's are extracted, MP4 Muxer will dump the subs to the log at the end of encoding. TODO: Translate PTS for buf->start to HB format, add MP4 subtitle track and subs during muxing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2375 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Get rid of deadlock that would halt processing some mkv files.van2009-04-211-90/+224
| | | | | | | | - Interleave media streams to reduce player buffer requirements and initial latency. - Add support for intermittent media streams like subtitles or closed captions (we don't have any of these yet but may one day). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2348 b64f7644-9d1e-0410-96f1-a4d463321fa5
* After discussion with eddyg, extending verbose logging level 2 from just ↵jbrjake2008-10-091-4/+4
| | | | | | memory-related logging to general-purpose housekeeping--stuff that isn't necessary when scrolling through activity logs users submit with bug reports and support queries. This includes things like thread start/exit messages and preview frames. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1820 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - in encx264, if an video frame is larger than init_delay split it into ↵van2008-07-261-51/+53
| | | | | | | | | | | | 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
* Fix mkv A/V sync problem created by R1542.van2008-07-081-2/+14
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1559 b64f7644-9d1e-0410-96f1-a4d463321fa5
* If we always require a buffer to be available on every fifo we'll eventually ↵van2008-06-301-3/+5
| | | | | | deadlock since video and audio run at different rates. Instead take the earliest available buffer (so we don't starve any of the fifos) but don't lock up if fifos are occasionally empty. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1542 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
* New internal audio handling.saintdev2008-04-011-3/+3
| | | | | | | | 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
* Add Subtitle scanning for forced subtitles and normal subtitles from the CLIeddyg2007-08-211-4/+4
| | | | | | | and the MacOS GUI. See the new subtitle language options in the GUI. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@844 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Matroska muxer!saintdev2007-07-141-0/+2
| | | | | | | | | | -Chapters don't work in VLC. I'll need to update the library to work-around this. Most other players should pick them up, however. -PAR, check. -x264 b-frames, check. -Multi-track audio, check. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@680 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Reverts an hb_snooze call's length from 200 to 50, like titer intended it. ↵jbrjake2007-03-181-1/+1
| | | | | | Should be slightly faster (maybe 1 fps), hopefully might fix some other random problems. It's located in the part of muxcommon.c that waits til the audio and video buffers are full before muxing packets. If the buffers aren't full, it snoozes. So I think it gets run 1 or more times for every frame. The snooze value got altered back in revision 98. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@437 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge the 5.1 branch into the trunk.prigaux2007-03-061-0/+227
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@422 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge the 0.8.0_mpeg4ip branch into the trunkprigaux2007-02-111-227/+0
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@285 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Revert changes to threading sleep intervals. johnallen2007-01-091-7/+2
| | | | | | | Some users have issues with this. It is less risky to not include this for release 0.7.2 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@100 b64f7644-9d1e-0410-96f1-a4d463321fa5
* added worker thread sleep throttling.johnallen2007-01-081-3/+11
| | | | | | | | | | each of the work object threads now self adjust their sleep interval based on the "fullness" of their fifo. 80% is the choose threshold. Work objects with a fifo fullness of greater than 80% increase their sleep interval. This allows other work object with less than 80% fullness more CPU usage. Also adjusted thread_func, reader, and muxer sleep intervals to more reasonable values. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@98 b64f7644-9d1e-0410-96f1-a4d463321fa5
* added HB_STATE_MUXING to hb_state_s and corresponding structure.johnallen2007-01-071-0/+7
| | | | | | | | | | this state indicates the transition from the end of HB_STATE_WORKING to the beginning of HB_STATE_WORKDONE. This state can take as long a 10 minutes on a long conversion. The associated working structure contains a progress float. Once we determine how to get a proper progress from the call to av_write_trailer in libavformat, we can update this progress. HB, IHB, and HBTest are now using using HB_STATE_MUXING to provided feedback to the user. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@96 b64f7644-9d1e-0410-96f1-a4d463321fa5
* RapidSVN commited changes to files I did not want commited. This commit ↵johnallen2007-01-061-6/+0
| | | | | | revert those files back to rev 92. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@94 b64f7644-9d1e-0410-96f1-a4d463321fa5
* added Doxyfile, config file for doxygenjohnallen2007-01-061-0/+6
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@93 b64f7644-9d1e-0410-96f1-a4d463321fa5
* HandBrake 0.7.1a1rhester2006-09-301-0/+1
| | | | | | | | | | | | | | | | Made H.264 baseline levels more generic Added iPod 640x480 support to libhb, HBTest and MacOS X GUI Added proper iPod 640x480 muxing Modified rate control for more accurate ending video bitrates Updated ffmpeg and x264 base sources to more current levels Removed inlined ff_get_fourcc (now in ffmpeg) Updated patches for xvidcore, libdvdread, x264, and ffmpeg Relocated contrib files to local web server and updated version files to new site Renamed contrib files and patches to consistent naming standard Updated contrib Jamfile to support new patches and naming standard git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@70 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge from avformat branchtiter2006-04-171-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@60 b64f7644-9d1e-0410-96f1-a4d463321fa5
* HandBrake 0.7.0handbrake2006-01-141-0/+215
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@16 b64f7644-9d1e-0410-96f1-a4d463321fa5