summaryrefslogtreecommitdiffstats
path: root/libhb/decmpeg2.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve mpeg PS supportjstebbins2011-09-141-6/+15
| | | | | | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix a crash that can happen due to corrupt mpeg2 datajstebbins2011-04-271-0/+9
| | | | | | | | | The mpe2dec can return nonsense values for width and height that make sws_getContext fail. So check the context return value and just drop the buffer if it fails. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3963 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Eliminate incompatible pointer type warnings for sws_scalejstebbins2011-04-081-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3910 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix source dimensions problem with some mpeg2 streamsjstebbins2011-03-131-6/+6
| | | | | | | | | Was using the incorrect field for actual "display" dimensions of video. The field I was using is most often used for pan and scan which crops a 16:9 image to fit a 4:3 display. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3847 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix PAR and height of mpeg-2 1080 content.jstebbins2011-03-111-58/+46
| | | | | | | | | | mpeg-2 dimensions must be multiples of 16, so the actual coded height is 1088. But there are fields in the sequence header that define the "display" height and width. We were ignoring these which lead to slightly incorrect height and PAR. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3838 b64f7644-9d1e-0410-96f1-a4d463321fa5
* plug some memory leaks.jstebbins2011-02-121-1/+1
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3797 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix double free in handling of last CC messagejstebbins2011-01-131-4/+13
| | | | | | | | | the code dealing with cc messages stores the last message in 2 places. sometimes it would free both and sometimes it would send one down the pipeline and free the other. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3743 b64f7644-9d1e-0410-96f1-a4d463321fa5
* bump ffmpeg from 25082 to 25374jstebbins2010-10-121-3/+2
| | | | | | | fixes h264 decoding issue git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3599 b64f7644-9d1e-0410-96f1-a4d463321fa5
* fix some mingw warnings and a mingw build issuejstebbins2010-04-101-1/+1
| | | | | | | mingw gcc-4.5 has linker issues against shared libstdc++ git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3217 b64f7644-9d1e-0410-96f1-a4d463321fa5
* handle YUV422P video in the mpeg2 decoderjstebbins2010-04-021-10/+31
| | | | | | | | if the image format is 422, convert it to 420 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3187 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Add support for ATSC (North American Digital TV) closed captions.van2009-07-131-184/+297
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2688 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - cleanup gcc format warnings showing up on linux 64-bitkonablend2009-06-251-2/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2619 b64f7644-9d1e-0410-96f1-a4d463321fa5
* softsubs: allow 1 source to many output subs by duplicating thejstebbins2009-06-031-11/+22
| | | | | | | 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
* Remove some noise from the log: Only announce chapters when we're reading, ↵van2009-05-161-3/+7
| | | | | | not while we're getting previews and get rid of a spurious chapter annoucement in sync (video decoders announce chapters since that's where they first get put in the output data stream). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2421 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Combine multiple CC lines into one, trimming whitespace, and adding proper ↵eddyg2009-05-071-1/+12
| | | | | | language code based on first audio track language. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2402 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Change CC608 decoder to be its own threadeddyg2009-05-071-55/+25
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2396 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
* Soft Subs Part 2: Auto-detect CC during scan, add CC to subtitle list in ↵eddyg2009-05-041-2/+237
| | | | | | 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
* Another minor step on the way back to Solaris compiles - not linking as yet.eddyg2009-03-201-2/+2
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2265 b64f7644-9d1e-0410-96f1-a4d463321fa5
* With live preview decmpeg2 can be running more than once simultaneously, so ↵jbrjake2009-02-051-25/+25
| | | | | | the crude cadence tracking (Film->Video messages) needs to go in the hb_libmpeg2 struct...where I should have put it in the first place. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2118 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Consolidate all the ffmpeg-related includes into libhb/hbffmpeg.h then ↵van2008-12-131-3/+1
| | | | | | prototype hb_avcodec_{init,open,close} so that we don't get gcc warnings from a dozen modules. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2025 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Correct chroma size for raw video frames - width & height need to be rounded ↵van2008-11-081-1/+1
| | | | | | up if they're odd before dividing by 2. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1905 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix for mpeg content that changes size in the middle of a decode (such as ↵van2008-10-301-17/+66
| | | | | | | | | Doctor Who season 1 disc 2 title 4). Problem reported in http://forum.handbrake.fr/viewtopic.php?f=4&t=4306 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1880 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix a couple problem exposed through some valgrind testing. use of freedjstebbins2008-09-151-0/+2
| | | | | | | memory in detelecine and use of uninitialized memory in decmpeg2 git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1700 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - change aspect from a scaled int to a double so we can handle the widervan2008-08-081-6/+3
| | | | | | | | | | | | | | | | | | | 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
* - add pixel_aspect_ratio reporting to the mpeg decodervan2008-06-041-31/+10
| | | | | | | | - try lots harder to extract a useful video frame rate from libavcodec (successful for more files but still get junk from wmv's). - save all video parameters while we're getting previews then use the set we've seen most frequently as the parameters of the title. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1490 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't crash in decmpeg2Info if we failed to get a preview due to not finding ↵van2008-06-031-1/+1
| | | | | | a sequence header. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1488 b64f7644-9d1e-0410-96f1-a4d463321fa5
* - support blu-ray, avchd & dvb x264van2008-05-311-22/+43
| | | | | | | - 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
* Print a log line for the first chapter.van2008-04-151-0/+8
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1421 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
* Fix the automatic subtitle scan that I broke with r1412.van2008-04-141-1/+3
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1413 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fixes for different number of frames between pass 1 & 2, missing frames at ↵van2008-04-131-6/+17
| | | | | | | | | | | | 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
* Minor chapter cleanups.van2008-04-041-25/+35
| | | | | | | | | | - put chapter number in buf rather than a 'new chapter' flag. - use that chapter number to index chapter text in muxers so a dropped chapter doesn't make all subsequent chapter labeling wrong. - get rid of most of the chapter logging & just output one line giving the chapter text, number, frame & time. - fix a bug in sync that could cause chapter marks to be lost. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1377 b64f7644-9d1e-0410-96f1-a4d463321fa5
* scan and pcm audio fixes.van2008-04-021-20/+13
| | | | | | | | | | | | | | - 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
* Don't crash while scanning when we can't get previews for some title.van2008-02-291-0/+7
| | | | | | | | | - if we get no previews for some title, ignore the title - use the most common aspect ratio found from our 10 previews rather than just the aspect of preview 2 (otherwise we'll crash in hb_fix_aspect if we don't get preview 2). - check parameters in hb_fix_aspect so we don't divide by zero. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1322 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Formatting: Remove a lot of trailing whitespace.saintdev2008-02-211-19/+19
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1307 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Refer to transitions in the presence-or-lack-thereof of progressive flags on ↵jbrjake2008-02-121-2/+2
| | | | | | MPEG-2 frames as Film->Video or vice versa instead of Progressive->Interlaced. Slightly more accurate, and will make future comb detection of previews less confusing. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1256 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Don't drop subtitles when crossing PTS discontinuities by using buffer ↵eddyg2007-10-081-0/+2
| | | | | | sequence numbers to determine where in the stream the buffer came from. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1011 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Die, non-standard printf logging, die!jbrjake2007-08-291-4/+4
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@895 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Doubles the number of frames checked for cadence changes, streamlines their ↵jbrjake2007-08-241-10/+10
| | | | | | storage with a for loop, gets rid of inaccurate "Interlaced->Progressive" messages during scanning, and, during encoding, displays those messages with time stamps in seconds instead of using the PTS units. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@862 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Prevents a bus error at scan time with DVDs that have a weird cell ↵jbrjake2007-08-171-10/+13
| | | | | | structure. Much gratitude to dynaflash, as without his patient assistance tele-debugging this, I would have been forced to buy a copy of Young Guns. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@828 b64f7644-9d1e-0410-96f1-a4d463321fa5
* "Same as source" changes. Old behavior: mark all NTSC content as 23.976. New ↵jbrjake2007-08-131-8/+116
| | | | | | | | | behavior: mark all NTSC content as 29.97, only use 23.976 when scanning shows a title reporting itself as mostly progressive. Also threw in a bunch of commented out logging messages for diagnostic usage. And notification during encodes when progressive flags go on or off (only works in jam builds until the contrib binary packs get rebuilt). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@799 b64f7644-9d1e-0410-96f1-a4d463321fa5
* This huge patch from huevos_rancheros ports a number of video filters from ↵jbrjake2007-07-271-0/+3
| | | | | | | | | | mencoder to HandBrake: yadif+mcdeint, hqdn3d, pp7, and pullup+softskip+harddup. What this means is that HB now has stateless inverse telecine, temporal denoising, and motion-adaptive deinterlacing! HandBrake is growing up =) Thank you, huevos_rancheros! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@749 b64f7644-9d1e-0410-96f1-a4d463321fa5
* This patch from eddyg should help alleviate HandBrake's audio drop issues. ↵jbrjake2007-07-251-0/+4
| | | | | | It also adds a number of beautiful comments to sync.c that really help clarify the code. Thanks, eddy! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@738 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Implement transport and program stream support. With these changes it's now ↵awk2007-07-041-1/+25
| | | | | | possible to open a .ts or .mpg files and transcode to standard Handbrake Output files. This fixes Ticket #21. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@648 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Fix Previous Bad commit for Cyanders Chapter Markersdynaflash2007-04-251-0/+33
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@548 b64f7644-9d1e-0410-96f1-a4d463321fa5
* Merge the 5.1 branch into the trunk.prigaux2007-03-061-0/+253
| | | | 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-253/+0
| | | | git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@285 b64f7644-9d1e-0410-96f1-a4d463321fa5