summaryrefslogtreecommitdiffstats
path: root/libhb/stream.c
Commit message (Collapse)AuthorAgeFilesLines
* downmix support for ffmpeg audio sourcesjstebbins2010-04-021-13/+14
| | | | | | | | now we can eat our own dogfood. i.e. aac 6ch discrete input now works, along with any other multi-channel audio ffmpeg can toss at us. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3182 b64f7644-9d1e-0410-96f1-a4d463321fa5
* handle bluray LPCM streamsjstebbins2010-03-271-20/+63
| | | | | | | | | | | | | | | bluray lpcm uses an stype that is normally used for digicipher. so we use the registration descriptor == HDMV in the PMT to recognize bluray streams. also, ffmpeg doesn't provide a parser for this audio type because none is needed. so when the parser is NULL, pass our buffer data directly to the decoder. Since ffmpeg is doing the decoding, we will still suffer from the same problem with multi-channel ffmpeg streams. So this currenlty only works properly with stereo. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3175 b64f7644-9d1e-0410-96f1-a4d463321fa5
* extend search range for TS re-syncjstebbins2010-03-131-14/+24
| | | | | | | | we were only checking approx the next 16K bytes when sync was lost in a transport stream. now we will continues searching to the end of the file. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3165 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix incorrect comment in PS detection functionjstebbins2010-02-121-3/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3119 b64f7644-9d1e-0410-96f1-a4d463321fa5
* try harder to identify program streams that do not begin with a pack headerjstebbins2010-02-121-8/+22
| | | | | | | | search deeper into the file for a pack header followed by another start code prefix. Fixes problem with file cut by StreamClip on non-pack header boundary git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3118 b64f7644-9d1e-0410-96f1-a4d463321fa5
* use DTS generated by x264 when computing duration and offset in muxmp4jstebbins2010-02-061-0/+11
| | | | | | | | 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
* osx doesn't have fread_unlockedjstebbins2010-01-311-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3090 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix problem with reading program streamsjstebbins2010-01-311-1/+33
| | | | | | | | audio PES packets can have sequences that look like start codes in the data so parse PES enough to get the length and skip the data. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3089 b64f7644-9d1e-0410-96f1-a4d463321fa5
* add point-to-point encodingjstebbins2009-12-231-0/+23
| | | | | | | | | | | | | | 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
* bump ffmpeg to svn 20817jstebbins2009-12-141-0/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3028 b64f7644-9d1e-0410-96f1-a4d463321fa5
* batch file scanning and scan canceljstebbins2009-11-251-0/+2
| | | | | | | | | | 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
* don't read the entire file looking for audio in transport streamsjstebbins2009-11-251-1/+1
| | | | | | | | if the PMT indicates there is no audio we do not need to continue searching. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2972 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix an off-by-one error in assignment of audio stream registration descriptorjstebbins2009-11-091-26/+28
| | | | | | | | | | | | | | format. This sometimes caused the misdetection of TrueHD audio since it would be tagged as the format of the stream following it in the PMT. Also fix a problem in PMT parsing that I stumbled upon while investigating the above problem. If a PMT has a PID listed more than once for some reason, we would add that PID multiple times to our stream list. And if it happened to be a video PID that is duplicated, the duplications would be interpreted as audio PIDs. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2920 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix a couple transport stream issuesjstebbins2009-10-231-9/+46
| | | | | | | | | | | | | | | 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 VC1 I-frame detection in ffmpeg_is_keyframejstebbins2009-10-061-1/+1
| | | | | | | | | The pattern was incorrect, so we were pretty much always starting on a non-I-frame when creating previews from VC1 ffmpeg sources. This fixes the grey preview complaints several users have had. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2870 b64f7644-9d1e-0410-96f1-a4d463321fa5
* libhb: don't truncate last chapter of a streamjstebbins2009-08-091-1/+2
| | | | | | | | | | | | | When an ffmpeg stream doesn't have chapters, we insert a dummy chapter into our chapter list that has the same duration as the title. But the title duration is only a guess. Later, when the chapter end time is reached, we increment the chapter number. In the reader, we exit if the current chapter number is greater than the last chapter. This patch only increments the chapter number in stream if there is actually another chapter. This way reader will continue till the file is exhausted git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2757 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - Some DVB programs have a lot of streams (20 for BBC HD) so up max from 16 ↵van2009-07-131-1/+5
| | | | | | | | | to 32 - If we find a DVB AC-3 stream descriptor mark the associated stream as AC-3 so we don't mistakenly type it as MPEG-2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2687 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - cleanup gcc format warnings showing up on linux 64-bitkonablend2009-06-251-9/+12
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2619 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - fixed gcc warnings for various unused vars, implicit function decls, ↵konablend2009-06-241-1/+1
| | | | | | signedness. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2612 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - mingw fixes to use fopen() with 'b' flag.konablend2009-06-061-1/+1
| | | | | | | - include pthread.h for pthread_win32 attach/detach decls. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2495 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix for New Zealand TV not following the mpeg2 standardvan2009-06-021-1/+7
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2466 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Get rid of silence inserted at the beginning of mp4/mov/mkv files. GENPTS ↵van2009-05-171-3/+0
| | | | | | seems to do the wrong thing on files with real time stamps & inserts a delay equal to the audio/video interleave offset. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2424 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Make chapters in mp4 & mkv ffmpeg input files work again (not sure when they ↵van2009-05-111-80/+38
| | | | | | | | | got broken). Correct timestamp type (it's signed, not unsigned) and do some code cleanup. Fixes problem reported in http://forum.handbrake.fr/viewtopic.php?f=12&t=10701&sid=4c007d887bf65f3e397203fc2bba1d12 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2411 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Enable chapter boundary check for ffmpeg input even when chapters marker are ↵ritsuka2009-05-091-1/+0
| | | | | | disabled, fixes an issue where the encoding process wouldn't stop at the right time. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2408 b64f7644-9d1e-0410-96f1-a4d463321fa5
* BuildSystem: conversion from jam-based to make-based system.konablend2009-03-011-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | KNOWN ISSUES: 1. OSX + Xcode builds do not support parallel builds; attempting to use them may cause unbounded number of jobs. However, disabling via configure --disable-xcode avoids the issue. 2. OSX ppc binary produces binary which has audio-scan problems. 3. OSX ppc64 binary has not been runtime tested. ADDED: 00-BuildUserGuide.txt contrib/*/module.* doc/ make/ libhb/module.* test/module.* macos/module.* gtk/module.* DROPPED: BUILD BuildContribDarwin.sh DownloadMacOsXContribBinaries.sh Jamfile Jamrules MacOsXContribBinariesVersion.txt Makefile Makefile.config jam libhb/Jamefile libhb/Makefile test/BUILDSHARED test/Makefile contrib/Jamfile contrib/Makefile contrib/patch-ffmpeg.patch contrib/patch-x264-idr.patch contrib/patch-x264-linux.patch RENAMED: contrib/*.patch -> contrib/MODULE/[AP]??-*.patch macosx/HandBrake.plist -> macosx/Info.plist MODIFIED: libhb/decavcodec.c Patched to use cleaner include "libavcodec/audioconvert". Second part to support this cleanup is ffmpeg A02-audioconvert.patch . MODIFIED: libhb/hb.c MODIFIED: libhb/hb.h MODIFIED: libhb/muxmkv.c MODIFIED: libhb/muxmp4.c MODIFIED: libhb/update.c Patched to use "project.h" for project metadata. Renamed HB_BUILD -> HB_PROJECT_BUILD. Renamed HB_VERSION -> HB_PROJECT_VERSION. MODIFIED: test/test.c: Patched HandBrakeCLI to support I/O on Mac OS X ZFS filesystems. Reference r1803 as similar patch for HandBrake.app . Unpatched behavior is crash/buserror when using ZFS. MODIFIED: macosx/Growl.framework/ Upgraded 0.7.6 (i386,ppc) -> 1.1.2 (i386,x86_64,ppc,ppc64). New architectures facilitate x86_64 and ppc64 builds. MODIFIED: macosx/HandBrake.xcodeproj/ Bumped compatibilty mode from 2.4 -> 3.1 . Dumped old configurations Deployment, Developer. Added configurations standard, sebug as replacements. Added standard.i386, standard.x86_64, standard.ppc, standard.ppc64 . for explicit architecture build. All configurations settings cleaned up and normalized. Build output directories adjusted to support new build system. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2180 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't let an invalid PES header length (from a corrupted packet) cause us to ↵van2009-01-281-8/+9
| | | | | | crash in memcpy. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2103 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add importing of ffmpeg input chapters.ritsuka2009-01-141-7/+32
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2082 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Get previews from H.264 content even if it's missing IDR frames (e.g., NZ TV ↵van2009-01-101-147/+136
| | | | | | | | | | | | & some blu-rays): - Grab stream characteristics (IDRs or not, PCRs or not, RAPs or not) while we're reading to compute the duration rather than trying to guess with no information later. - Only wait for an IDR after a seek if we know the stream has IDRs. Even then, wait for at most 255 frames. - If the stream doesn't have IDRs tell scan (via a new flag in the title struct) so that it can read but discard a second's worth of frames to get the decoder in sync withe stream. - While we're trying to sync the decoder, ffmpeg will spit out dozens of useless error messages so suppress them. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2071 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - 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