summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2009-09-11 21:00:57 +0200
committerChristian Gmeiner <christian.gmeiner@gmail.com>2009-09-11 21:00:57 +0200
commit414e76fd94edf6861977dc8a84d888d7236da732 (patch)
tree8299837e7a5fe4700b01c74a2ffdd3a9ac047be3
parent6787dbc234dcf23a20eabf53ff4990e4e2abc523 (diff)
downloadvdr-plugin-dxr3-414e76fd94edf6861977dc8a84d888d7236da732.tar.gz
vdr-plugin-dxr3-414e76fd94edf6861977dc8a84d888d7236da732.tar.bz2
also write color informations - we have a working < 5 bpp spu encoder now
-rw-r--r--spuencoder.c19
-rw-r--r--spuencoder.h1
2 files changed, 19 insertions, 1 deletions
diff --git a/spuencoder.c b/spuencoder.c
index 13b4832..80ecc57 100644
--- a/spuencoder.c
+++ b/spuencoder.c
@@ -142,6 +142,21 @@ void cSpuEncoder::writeNibble(uint8_t val)
}
}
+void cSpuEncoder::writeColorAndAlpha(sSection &sec, bool withCMD)
+{
+ if (withCMD) {
+ spu[written++] = CMD_SET_COLOR;
+ }
+ spu[written++] = (sec.colIndex[0] << 4) | (sec.colIndex[1] & 0x0f);
+ spu[written++] = (sec.colIndex[2] << 4) | (sec.colIndex[3] & 0x0f);
+
+ if (withCMD) {
+ spu[written++] = CMD_SET_ALPHA;
+ }
+ spu[written++] = (opacity[sec.colIndex[3]] << 4) | (opacity[sec.colIndex[2]] & 0x0f);
+ spu[written++] = (opacity[sec.colIndex[1]] << 4) | (opacity[sec.colIndex[0]] & 0x0f);
+}
+
void cSpuEncoder::generateColorPalette()
{
// we need to convert the color we get from
@@ -228,7 +243,8 @@ void cSpuEncoder::generateSpuData(bool topAndBottom) throw (char const* )
spu[written++] = bottomStart >> 8;
spu[written++] = bottomStart & 0xff;
- // TODO write color-> palette index and alpha data
+ // write color-> palette index and alpha data for the first region
+ writeColorAndAlpha(regions.front()->sections[0], true);
// 0xff: end sequence
spu[written++] = 0xff;
@@ -317,3 +333,4 @@ void cSpuEncoder::rle4colors()
}
}
}
+
diff --git a/spuencoder.h b/spuencoder.h
index dbeb833..7ef0b10 100644
--- a/spuencoder.h
+++ b/spuencoder.h
@@ -66,6 +66,7 @@ private:
tColor palcolors[16];
void writeNibble(uint8_t val);
+ void writeColorAndAlpha(sSection &sec, bool withCMD);
void generateColorPalette();
void generateSpuData(bool topAndBottom) throw (char const* );