summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
Commit message (Collapse)AuthorAgeFilesLines
* - have to account for a non-zero start time when we're seeking in ffmpeg files.van2008-12-131-13/+60
| | | | | | | | - try harder to get keyframes from ffmpeg files: if we've just done a seek, search the next 50 frames for a keyframe. - detect WMV3 keyframes since ffmpeg doesn't. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2027 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a threading issue with avcodec_open/closejstebbins2008-12-121-1/+1
| | | | | | | | these functions can not be called from 2 threads simultaneosly. made a wrapper function that holds a lock while making the call git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2023 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't reject MPEG PS files just because they're missing a SYS header (clips ↵van2008-12-111-7/+7
| | | | | | won't have one). The standard says we just need a PACK header followed by some other legal start code. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2018 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improve duration calculation for transport streams. Streams that havejstebbins2008-12-101-3/+5
| | | | | | | | | many discontinuities (like concatenated blu-ray m2ts files) are handled better. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2017 b64f7644-9d1e-0410-96f1-a4d463321fa5
* More code to deal with the flakey streams from NZ TV. They like to change ↵van2008-12-051-7/+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
* - Elementary streams that scan couldn't type as audio streams have to be ↵van2008-12-041-15/+56
| | | | | | | | | | completely ignored - some of these don't follow the normal PES packet encoding so feeding them downstream to the demuxer will cause strange timing and other problems. - make log message correctly reflect our uncertainty about audio stream type so people don't complain about missing AC-3 audio when it isn't really there. - add missing av_free_packet in VC-1 keyframe search. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2001 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Found the ffmpeg initialization problem with VC-1 video. jstebbins2008-12-031-8/+16
| | | | | | | So now we can use our own demuxer for streams with VC-1. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1995 b64f7644-9d1e-0410-96f1-a4d463321fa5
* I suspect that eddyg's r1987 didn't really want to totally break transport ↵van2008-12-021-0/+5
| | | | | | and program streams ... git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1992 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add metadata support to libhb, add importing of MP4 metadata, add export of ↵eddyg2008-12-021-10/+136
| | | | | | 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
* - add John A. Stebbins' changes to handle TrueHD and DTS-HD multiplexed ↵van2008-11-251-310/+290
| | | | | | | | | | 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
* - get rid of an unnecessary seek that was messing up either mkv or vc1 ↵van2008-11-191-2/+16
| | | | | | | | | | decoding. - switch av_seek_frame to zero back to time-based rather than byte-based since time-based screws up mkv & mp4 while time-based works for everything but vc1. - since ffmpeg doesn't correctly indicate key frames in vc1 look for them ourselves so that vc1 previews & cropping will work. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1927 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't abort when the ffmpeg vc1 decoder hands us a bogus packet sizevan2008-11-181-0/+7
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1925 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - search for IDR frames in blu-ray (m2ts) inputs so we get useful previewsvan2008-11-161-5/+35
| | | | | | | - don't require a key frame after we seeking to the beginning of the file (this was probably causing the leading PPS & SPS of some blu-ray h.264 content to get dropped which resulted in a few seconds of missing video). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1923 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix pmt processingjstebbins2008-11-111-14/+24
| | | | | | | | | | | | | | there were 2 problems 1. when the program list in the pat contains a network PID, the pmt parsing code doesn't properly skip this entry. this causes attempts to interpret a pat as a pmt since the pid entry in the table is left initialized to 0. 2. pmt parsing always waits till the start of the second pmt section before parsing the first. if for some reason there were only one pmt in the stream, it would never parse the pmt. I've changed it to parse the pmt as soon as all the necessary bytes are collected. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1916 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Hack to make VC1 work: If we get a ts or m2ts with VC1 video, don't say we ↵van2008-11-091-0/+16
| | | | | | have a valid stream. This will cause HB to try to open it with ffmpeg which often can read VC1 TS streams. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1908 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Always use HandBrake's DTS decoder rather than ffmpeg's even for inputs ↵van2008-11-081-0/+4
| | | | | | | | | | we read via ffmpeg so that we get the user-specified mixdown. Otherwise we eventually abort in the sample rate converter or audio encoder. - Teach HB's DTS coder to handle implicit timestamps so that it doesn't screw up on mkv's & some m2ts inputs. - mkv's produced from Bluray HD content seem to have large timestamp errors - filter them out in the decoder so that sync doesn't drop big chunks of our audio. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1904 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Make DTS and HDMV DTS audio work in Transport and m2ts streams.van2008-10-111-8/+14
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1827 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Only do 'lost PCR' checks (r1712) when we're dealing with something that ↵van2008-10-031-0/+7
| | | | | | | | | 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
* Update ffmpeg from version r14737 to r15462.eddyg2008-09-291-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1788 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Bug fix to r1691: had the offsets for PTS & DTS reversed so we were trying ↵van2008-09-161-7/+7
| | | | | | to grab a DTS when there wasn't one. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1705 b64f7644-9d1e-0410-96f1-a4d463321fa5
* HD Home Run seems to strip the PCR from some streams (which makes HB refuse ↵van2008-09-121-6/+29
| | | | | | to process them) so use the video stream DTS as a substitute until the first real PCR appears. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1691 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Various fixes for ffmpeg input files (mp4, avi, mkv, etc.):van2008-09-111-21/+65
| | | | | | | | | | - 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
* - To reliably find audio in 720p or 1080i TS streams we need to search ↵van2008-08-181-5/+18
| | | | | | | | | | through first 50MB of file looking for the stream rather than first 18MB. - When we're looking for a PES header for some PID, check both that the TS 'start' bit is set and that the first 3 data bytes are an MPEG start code (the start bit may get set by an error not caught by the CRC). - Print the substream id when we reject a PID as "not audio" so we'll be able to debug TS streams using non-standard PES encapsulations. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1642 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Splits the display of job settings off from the actual work of beginning of ↵jbrjake2008-08-011-0/+3
| | | | | | | | a job, and reorganizes/elaborates the display's layout. Adds new title variables to provide more description of sources: video_codec_name, video_bitrate (currently only used by DVD sources), and container_name and data_rate (currently only used by ffmpeg input sources). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1599 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added Paul Kendalls ffmpeg AAC-LATM codec. Allows HB to decode AAC-LATMeddyg2008-07-021-1/+1
| | | | | | | MPEG-TS DVB streams. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1550 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't crash during scan when source not recognized (bug found & fixed by ↵van2008-06-011-1/+4
| | | | | | John Stebbins) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1485 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - support blu-ray, avchd & dvb x264van2008-05-311-140/+581
| | | | | | | - 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
* Changes to support unstructured program streams (such as those produced by a ↵van2008-04-251-342/+463
| | | | | | Tivo) and the three other forms of transport streams (m2ts, dvb-s & digicipher). Start of the changes necessary to support other types of video besides mpeg2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1439 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Move clock recovery code from reader to demuxmpeg so it sees all frames & ↵van2008-04-151-2/+2
| | | | | | 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
* Provide more feedback as to the types of the streams in an MPEG Transport streameddyg2008-04-111-24/+101
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1402 b64f7644-9d1e-0410-96f1-a4d463321fa5
* scan and pcm audio fixes.van2008-04-021-116/+27
| | | | | | | | | | | | | | - lpcm audio fixed to handle 24 bit & interpret header correctly. - get aspect ratio from libmpeg2 rather than doing it ourselves. - announce when aspect ratio changes during preview scan. - if aspect ratio isn't either 4:3 or 16:9 complain & map to either 4:3 or 16:9 (whichever is closest). - start stream previews from file position 0 rather than 1/11 in case there's only on mpeg sequence header in the file. - don't give up on a file just because we can't get a preview due to a missing sequence header - only give up if we can't get any previews. - get audio bitstream characteristics during preview in a uniform way (we were treating PCM & MPEG audio specially which resulted in not getting their sample rate which caused a divide by zero in sync). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1370 b64f7644-9d1e-0410-96f1-a4d463321fa5
* New internal audio handling.saintdev2008-04-011-42/+42
| | | | | | | | 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-240/+322
| | | | | | | | - 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
* - Add mpeg2 "Standard Target Decoder" clock recovery to the low level mpeg ↵van2008-03-151-820/+507
| | | | | | | | | | stream reader so we don't have to guess about the clock in sync. - Since sync now has a fairly reliable clock, make it just trim excess audio or video and fill holes so that we maintain cross media sync. - Redo the TS-to-PS transmuxing code to work on smaller units so that we can reliably convert the TS clock (PCR) to a PS clock (SCR). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1341 b64f7644-9d1e-0410-96f1-a4d463321fa5
* DVB teletext streams and ATSC AC3 audio streams use the same code points. If ↵van2008-03-021-5/+22
| | | | | | | | | we misclassify teletext as audio we'll die early in the encode while trying to find an AC3 sync frame. So, if we don't find a sync frame after searching a megabyte of the stream decide it's not AC3, delete the audio entry & keep going. Problem & test case from ncbp http://forum.handbrake.fr/viewtopic.php?p=29137#p29137. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1325 b64f7644-9d1e-0410-96f1-a4d463321fa5
* It's a good idea to have a buffer for every pid you decide to decode.van2008-02-291-4/+2
| | | | | | | | Max buffers was 1/4 max streams. This makes it same as max streams. (Fixes crash reported by ncbp at http://forum.handbrake.fr/viewtopic.php?p=28899&sid=0c89bb9c9aed7eee51c294f25ac61e99#p28899) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1321 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Formatting: Remove a lot of trailing whitespace.saintdev2008-02-211-87/+87
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1307 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - More robust stream duration estimation: take 16 (position,pts) samples ↵van2008-02-091-28/+100
| | | | | | | | | then do a max likelihood estimate of the average rate based on the rate between all pairs of samples. - When we detect a sync error attempt to resync so that we can handle streams where a few bytes have been inserted or deleted. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1253 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Make MPEG audio (and other audio types besides AC3) work.van2008-01-221-103/+126
| | | | | | | | | - Since the stream is closed after the scan then reopened by reader, we have to preserve all the state we gathered during the scan (like audio id to TS PID bindings) across the close. For now do this by ignoring the close call & doing a close internally when a stream of a different name is opened. - Don't overfill ts_packetbuf and abort just because an audio stream was missing the AC3 sync pattern (MPEG & DTS streams don't even have an AC3 sync pattern). - Get rid of several unused variables so that this compiles with no warnings. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1231 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - figure out MPEG PS duration from stream rather than faking it.van2008-01-061-91/+136
| | | | | | | | | | - correct some audio substream id mistakes: substream 2 is for dvd subtitles (in a vob) not lpcm, substream 10 is lpcm, dts seems to be a variant of ac3 (8), not its own code. - incorporate suggestions from eddyg's code review. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1170 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Program Streams: Vans patch to set a fake duration for program streams.dynaflash2008-01-011-5/+5
| | | | | | Thanks Van! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1159 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Program Stream Enhancements - Van: Libhbdynaflash2007-12-311-224/+205
| | | | | | | | | | | - Thanks Van ! - Identifies program streams by type instead of file extension - Improves proper duration reporting of program streams - fixes audio reconvergence code in libhb/sync.c trying to free a null buffer causing a crash - Assorted other enhancements to encoding program streams. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1155 b64f7644-9d1e-0410-96f1-a4d463321fa5
* MPEG-2 stream reading fixes for missing audio, multiple audio tracks, ↵jbrjake2007-12-131-180/+277
| | | | | | language codes, reading streams larger than 2GB, and incorrect title numbers. This vastly expands HandBrake's TS/PS compatibility. Thanks, van! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1123 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Improved PMT and PAT algorithms to work with streams where the PAT contains ↵awk2007-09-211-227/+262
| | | | | | | | | | entries for PMT's not present in the stream. Improved the PMT algorithm to work with PMT's that span TS Packets (though this is not well tested due to a lack of such streams). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@976 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Added buffer management and changed fifo sizes. Changed job->subtitle_scan ↵eddyg2007-09-111-1/+1
| | | | | | to job->indepth_scan, and fixed memory init bug in denoise.c. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@945 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Allows stream.c to try to read .VOB, .TS, and .mpeg files in addition to ↵jbrjake2007-08-241-3/+6
| | | | | | | | .vob, .ts, .m2t, and .mpg files. These are just more hard-coded file type extensions. awk, if this is a Bad Idea for a reason I'm ignorant of, feel free to revert. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@861 b64f7644-9d1e-0410-96f1-a4d463321fa5
* This should finally fix the PS stream language without iterating through ↵saintdev2007-07-261-1/+1
| | | | | | every language to find we want the first. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@740 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Ok, this should fix compilation. Instead of using the 2-letter language code ↵jbrjake2007-07-251-1/+1
| | | | | | for "Unknown" (which is a blank string) I've set it to use the 3-letter code ("und" for undetermined). There could easily be a better way to do this. C strings are not my forte. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@732 b64f7644-9d1e-0410-96f1-a4d463321fa5
* We shouldn't assume that MPEG2-PS audio is English. Set it to 'Unknown' instead.saintdev2007-07-251-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@730 b64f7644-9d1e-0410-96f1-a4d463321fa5