summaryrefslogtreecommitdiffstats
path: root/libhb/common.c
Commit message (Collapse)AuthorAgeFilesLines
* Blu-ray: display playlist number in log, CLI scan output, and title drop-down.Rodeo2011-08-161-0/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4182 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix or simplify several hacks involved with Libav supportjstebbins2011-07-271-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+5
| | | | | | | Noticed when debugging a memory corruption issue with valgrind git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4122 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix some warnings in the clijstebbins2011-07-011-1/+1
| | | | | | | and add printf attribute to hb_strdup_printf git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4081 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: fix a warning in decssasub.c by adding new hb_valog functionjstebbins2011-06-151-32/+38
| | | | | | | | And consolidate logging code in hb_valog. hb_log and hb_deep_log call hb_valog. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4060 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add DTS-HD passthru \o/jstebbins2011-06-141-1/+1
| | | | 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: add support for libav aac encoder (libhb only)jstebbins2011-06-071-0/+16
| | | | | | | | | This generalizes the ac3 encoder to make it easy to add support for any audio encoder that libav supports. Since ffaac is not quite ready, the cli and gui does not expose ffaac yet. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4029 b64f7644-9d1e-0410-96f1-a4d463321fa5
* LinGui: Add support for naming audio tracks.jstebbins2011-06-031-0/+4
| | | | | | | | Also fix hb_audio_add. It was not copying the audio name. And fix audio track name parsing in the CLI. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4020 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Remove the depreciated hb_calc_bitrate methodsr552011-05-211-115/+0
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3987 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix some problems with rgb2yuv and yuv2rgbjstebbins2011-05-171-8/+8
| | | | | | | | | | yuv2rgb converted incorrectly. Cb and Cr were swapped in 2 of the 3 conversion expressions. rgb2yuv was setting the color channels in the incorrect order in the output. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3981 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Make order of audio tracks found in PS streams more predictablejstebbins2011-04-251-0/+34
| | | | | | | | | 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
* HE-AAC support for the OSX port. Thanks go to amarcus, ritsuka and rodeo.sr552011-04-181-18/+47
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3937 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix int overflow that can happen when computing PARjstebbins2011-04-161-0/+56
| | | | | | | | | | If the source has large non-reduced PAR values, our computed value was overflowing an int. Compute it in an int64_t then reduce it. Also, keep num and den below 65535. Larger values just aren't really significant and will cause more overflow issues. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3931 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add audio gain adjustment to libhb and CLIjstebbins2011-04-051-0/+1
| | | | | | | | New CLI option is --gain <float>. Value is measured in dB. Negative values are quieter, positive values are louder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3902 b64f7644-9d1e-0410-96f1-a4d463321fa5
* make keyint match between 1st and 2nd passes of vfr and pfr encodes.jstebbins2011-03-081-2/+1
| | | | | | | | | | | | make keyint and fps settings consistent across video encoders. make interjob->vrate changes for pfr mode like we do for vfr since pfr is the same as vfr except when it hits it's peak. in mkv, set track default duration to actual measured vrate on 2 pass encodes. thanks to Rodeo for the corrections in encx264 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3831 b64f7644-9d1e-0410-96f1-a4d463321fa5
* initialize title->angle_count to 1jstebbins2011-03-011-0/+1
| | | | | | | sources that don't support multiple angles should default to 1 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3821 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix ffmpeg multiple audio decode issuejstebbins2011-01-171-0/+4
| | | | | | | | 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
* tweak audio bitrate limitsjstebbins2010-11-111-3/+13
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3672 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix hb_get_best_mixdown to allow downmixing 7.1 to 5.1jstebbins2010-11-051-1/+3
| | | | | | | | Use hb_get_best_mixdown in places in the LinGui that were duplicating code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3648 b64f7644-9d1e-0410-96f1-a4d463321fa5
* clean up crufty legacy codejstebbins2010-10-231-10/+2
| | | | | | | 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
* Use libhb functions for mixdown and bitrate defaults in the clijstebbins2010-10-231-53/+40
| | | | | | | sanitize mixdown and audio bitrates in work.c git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3620 b64f7644-9d1e-0410-96f1-a4d463321fa5
* tweak ca_aac bitrate limits some morejstebbins2010-10-091-2/+44
| | | | | | | add comment table of bitrate limits found through empirical testing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3594 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add more audio bitrate limitsjstebbins2010-10-091-10/+47
| | | | | | | Thanks to Rodeo for doing some testing and providing numbers. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3592 b64f7644-9d1e-0410-96f1-a4d463321fa5
* allow ca_aac lower limit of 192kbps for 6chjstebbins2010-10-081-0/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3584 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a bug in bitrate selection. forgot to change a '++' to '--'jstebbins2010-10-081-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3583 b64f7644-9d1e-0410-96f1-a4d463321fa5
* future proof faac bitrate limits jstebbins2010-10-081-5/+2
| | | | | | | by making the high thresh dependent on # channels git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3582 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix some audio bitrate limits issues with ca aacjstebbins2010-10-081-6/+6
| | | | | | | | and choose the next lower bitrate rather than next higher when between 2 valid rates. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3581 b64f7644-9d1e-0410-96f1-a4d463321fa5
* cli: make smarter mixdown decision when doing ac3 encode fallbackjstebbins2010-10-081-0/+102
| | | | | | | | | | | | | also, clean up the mixdown sanitizing logic in work.c added new functions hb_get_default_mix(codec, layout) hb_get_best_mix(codec, layout) These take the output codec and the input layout as parameters. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3580 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add audio defaults and limits calculation to libhbjstebbins2010-10-081-0/+124
| | | | | | | | | | | | | | | hb_get_audio_bitrate_limits() Get the bitrate limits for a (codec,samplerate,mixdown) triplet hb_get_best_audio_bitrate() Given an input bitrate, sanitize it. Check low and high limits and make sure it is in the set of allowed bitrates. hb_get_default_audio_bitrate() Get the default bitrate for a given (codec,samplerate,mixdown) triplet git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3578 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add ac3 encodingjstebbins2010-10-041-4/+8
| | | | | | | Uses ffmpeg's ac3 encoder. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3570 b64f7644-9d1e-0410-96f1-a4d463321fa5
* SSA subtitle burn injstebbins2010-09-281-0/+78
| | | | | | | | | | Anime fans rejoice! This patch adds SSA subtitle burn-in support with libass. Therefore SSA subtitles should now be rendered in full quality, with the appropriate embedded fonts and positioning information. Thanks to davidfstr git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3557 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Support for reading VOB subtitle tracks from file inputs initital ↵dynaflash2010-05-201-0/+68
| | | | | | | | | | | | | | 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
* Adjustable picture modulus: Base patch by BradleyS, Thanks BradleyS!dynaflash2010-02-111-20/+26
| | | | | | | - Enables setting modulus for all anamorphic modes (including non-anamorphic) except strict. The job variable "anamorphic.modulus" is repurposed for this and is renamed to simply "modulus" - Other changes: Increases minimum output dimensions to 32x32 pixels in libhb (prevents possible crashes, notably in macgui). Better crop value and maximum crop value calculations to prevent crashes. Some code optimization / refactoring. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3113 b64f7644-9d1e-0410-96f1-a4d463321fa5
* batch file scanning and scan canceljstebbins2009-11-251-2/+44
| | | | | | | | | | 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
* Rate limit hb_error() messages to at most 1 message per second of the same ↵eddyg2009-11-241-1/+74
| | | | | | | | | | | | message. Repeats will be counted and presented as a count when 1 second has elapsed since the first error of a sequence, or an error message with a different string. Also modified dvdnav to use hb_error() to take advantage of the limiting. This works around a real bug from dvdnav where the Mac GUI becomes unresponsive during the output of large numbers of errors. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2971 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix lockup in reader when importing srt'sjstebbins2009-11-131-0/+1
| | | | | | | | | | | | The subitle id for srt's was not being set. This caused the reader to mistakenly select the subtitle's fifo when processing audio data and stuff audio into it, filling it very rapidly. Sync would not remove items from the subtitle fifo because the corresponding video timestamp hadn't arrived yet. And since reader was waiting on a full subtitle fifo, no more video would ever arive at sync. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2926 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Format cleanup.konablend2009-06-251-2/+2
| | | | | | | | | | - 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
* CLI: SubRip Subtitle importeddyg2009-06-231-1/+31
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2602 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds an interjob structure to preserve some encode data across jobs within ↵jbrjake2009-06-041-0/+14
| | | | | | an instance of libhb. This allows correcting the estimated bitrate/filesize of 2-pass encodes of variable framerate content, as the actual frame count is known after the first pass. Thanks for putting the idea into code, Shaya. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2482 b64f7644-9d1e-0410-96f1-a4d463321fa5
* softsubs:jstebbins2009-06-031-0/+39
| | | | | | | | | | | | | | - add ability to have 1 source subtitle feed many output subtitles use hb_subtitle_add() to add output tracks. example use case: you want forced subtitles from a source track on one output track and the entire subtitle stream from the same source track on a second output track - LinGui: make subtitle tab resemble functionality of the audio tab any track can be added multiple times with different settings. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2476 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Forgot a comma in common.c .ritsuka2009-05-231-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2442 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Add CoreAudio AAC as one of the encoder on Mac OS X.ritsuka2009-05-231-1/+3
| | | | | | | - Remove hb_init() and hb_init_express() macro. Rename hb_init_real() to hb_init() - Add two more bitrate combination for audio codecs in common.h git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2441 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Enable DTS passthru for matroska containerjstebbins2009-04-181-0/+1
| | | | | | | | since we have no way to create silent dts frames for insertion to maintain sync, frames from other streams may be dropped when there is a sync problem on the DTS stream git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2339 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add metadata support to libhb, add importing of MP4 metadata, add export of ↵eddyg2008-12-021-0/+9
| | | | | | 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
* ETSI TS 102 366 V1.2.1 compliant AC3 in MP4, replaces older hacked version ↵eddyg2008-10-291-0/+2
| | | | | | that was hardcoding the AC3 stream information in the dac3 atom based on the AppleTV startup movie stream. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1879 b64f7644-9d1e-0410-96f1-a4d463321fa5
* CLI: Add support for naming audio tracks to the HandBrakeCLI, thanks to ↵eddyg2008-10-101-0/+1
| | | | | | LePetomane for the patch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1825 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Adds an hb_deep_log() function for multiple levels of debugging verbosity. ↵jbrjake2008-10-091-0/+38
| | | | | | Level 1 displays when hb_log does (job->verbose == 1) and is now meant for logging that helps in tech support. Level 2 adds memory-related logging like freed buffers, and level 3 is for granular stuff that displays once per sample, frame, packet, etc. The debug level continues to be set when hb_init() is called. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1819 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't crash when the user specifies audio tracks that don't exist from the ↵eddyg2008-08-181-2/+7
| | | | | | HandBrakeCLI git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1640 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - change aspect from a scaled int to a double so we can handle the widervan2008-08-081-21/+25
| | | | | | | | | | | | | | | | | | | range of aspect ratios we get from ffmpeg files. - add container_aspect to title struct (always zero except for DVDs when it's the aspect from the VTSI). To handle broken French DVDs, make HB complain & use the container aspect if it's different from the aspect computed from the video PAR. - fix ScanFunc's job template init so that it doesn't think the only legal aspect ratios are 16:9 & 4:3. - hb_reduce wouldn't reduce any fraction where both terms were equal and prime (e.g., 2/2, 3/3, 5/5, etc. would not become 1/1). Recoded it using Euclid's Algorithm so it always works and is faster. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1616 b64f7644-9d1e-0410-96f1-a4d463321fa5