summaryrefslogtreecommitdiffstats
path: root/libhb/decvobsub.c
diff options
context:
space:
mode:
authordynaflash <[email protected]>2010-05-20 15:28:27 +0000
committerdynaflash <[email protected]>2010-05-20 15:28:27 +0000
commit5c0877e87e58f15cf5fe86c43afaad0778a8817d (patch)
tree6100ce310d0bedebcc3c1bf50883ab2365f846e0 /libhb/decvobsub.c
parentf6b620012c27bc2858ea0ad198bd3edf34965ca3 (diff)
Support for reading VOB subtitle tracks from file inputs initital 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
Diffstat (limited to 'libhb/decvobsub.c')
-rw-r--r--libhb/decvobsub.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/libhb/decvobsub.c b/libhb/decvobsub.c
index e180b232f..3b5177ca3 100644
--- a/libhb/decvobsub.c
+++ b/libhb/decvobsub.c
@@ -4,6 +4,26 @@
Homepage: <http://handbrake.fr/>.
It may be used under the terms of the GNU General Public License. */
+/*
+ * Decoder for DVD bitmap subtitles, also known as "VOB subtitles" within the HandBrake source code.
+ *
+ * Input format of the subtitle packets is described here:
+ * http://sam.zoy.org/writings/dvd/subtitles/
+ *
+ * An auxiliary input is the color palette lookup table, in 'subtitle->palette'.
+ * The demuxer implementation must fill out this table appropriately.
+ * - In the case of a true DVD input, the palette is read from the IFO file.
+ * - In the case of an MKV file input, the palette is read from the codec private data of the subtitle track.
+ *
+ * Output format of this decoder is PICTURESUB, which is:
+ * struct PictureSubPacket {
+ * uint8_t lum[pixelCount];
+ * uint8_t alpha[pixelCount];
+ * uint8_t chromaU[pixelCount];
+ * uint8_t chromaV[pixelCount];
+ * }
+ */
+
#include "hb.h"
struct hb_work_private_s
@@ -42,6 +62,21 @@ int decsubInit( hb_work_object_t * w, hb_job_t * job )
pv->job = job;
pv->pts = -1;
+
+ // Warn if the input color palette is empty
+ int paletteEmpty = 1;
+ int i;
+ for (i=0; i<16; i++)
+ {
+ if (w->subtitle->palette[i])
+ {
+ paletteEmpty = 0;
+ break;
+ }
+ }
+ if (paletteEmpty) {
+ hb_log( "decvobsub: input color palette is empty; not demuxed properly?" );
+ }
return 0;
}
@@ -262,7 +297,7 @@ static void ParseControls( hb_work_object_t * w )
* work, but I get the right colours by doing
* no conversion.
*/
- uint32_t color = title->palette[colors[j]];
+ uint32_t color = w->subtitle->palette[colors[j]];
uint8_t Cr, Cb, y;
y = (color>>16) & 0xff;
Cr = (color>>8) & 0xff;