}
}
+void BC_WindowBase::xft_draw_string(XftColor *xft_color, XftFont *xft_font,
+ int x, int y, const FcChar32 *fc, int len, BC_Pixmap *pixmap)
+{
+ Pixmap draw_pixmap = 0;
+ XftDraw *xft_draw = (XftDraw *)
+ (pixmap ? pixmap->opaque_xft_draw : this->pixmap->opaque_xft_draw);
+ int src_x = x, src_y = y, src_w = 0, src_h = 0;
+ XGCValues values;
+ XGetGCValues(top_level->display, top_level->gc, GCFunction, &values);
+ if( values.function != GXcopy ) {
+ XSetFunction(top_level->display, top_level->gc, GXcopy);
+ XGlyphInfo info;
+ XftTextExtents32(top_level->display, xft_font, fc, len, &info);
+ src_w = info.width; src_h = info.height;
+ draw_pixmap = XCreatePixmap(top_level->display, top_level->win,
+ src_w, src_h, top_level->default_depth);
+ int color = get_color(); set_color(0);
+ XFillRectangle(top_level->display, draw_pixmap, top_level->gc, 0, 0, src_w, src_h);
+ set_color(color);
+ xft_draw = XftDrawCreate(top_level->display, draw_pixmap,
+ top_level->vis, top_level->cmap);
+ src_x = info.x; src_y = info.y;
+ }
+ XftDrawString32(xft_draw, xft_color, xft_font, src_x, src_y, fc, len);
+ if( values.function != GXcopy ) {
+ XSetFunction(top_level->display, top_level->gc, values.function);
+ Pixmap xpixmap = pixmap ? pixmap->opaque_pixmap : this->pixmap->opaque_pixmap;
+ XCopyArea(top_level->display, draw_pixmap, xpixmap,
+ top_level->gc, 0, 0, src_w, src_h, x, y);
+ XFreePixmap(top_level->display, draw_pixmap);
+ XftDrawDestroy(xft_draw);
+ }
+}
+
void BC_WindowBase::draw_wtext(int x, int y,
const wchar_t *text, int length, BC_Pixmap *pixmap, int *charpos)
{
if(nextfont != curfont)
{
l = up - ubp;
- XftDrawString32((XftDraw*)(pixmap ? pixmap->opaque_xft_draw : this->pixmap->opaque_xft_draw),
- &xft_color,
- curfont,
- x,
- y,
- (const FcChar32*)ubp,
- l);
+ xft_draw_string(&xft_color, curfont, x, y,
+ (const FcChar32*)ubp, l, pixmap);
if(charpos)
cp = &charpos[ubp - text + 1];
if(up > ubp)
{
- XftDrawString32((XftDraw*)(pixmap ? pixmap->opaque_xft_draw : this->pixmap->opaque_xft_draw),
- &xft_color,
- curfont,
- x,
- y,
- (const FcChar32*)ubp,
- up - ubp);
+ xft_draw_string(&xft_color, curfont, x, y,
+ (const FcChar32*)ubp, up - ubp, pixmap);
if(charpos)
wcharpos(ubp, curfont, up - ubp, &charpos[ubp - text + 1]);
}
if( dump ) zmsgs(" 0x%x bytes elementary data\n", raw_size-raw_offset);
// if( pid == 0x1100 ) zmsgs("get_payload 1 0x%x\n", audio_pid);
if( pid == audio_pid && (do_audio || read_all) ) {
- if( do_audio ) got_audio = pid;
+ if( do_audio ) got_audio = audio_pid;
if( dump ) {
zmsgs(" offset=0x%jx 0x%x bytes AC3 pid=0x%x\n",
absolute_position(), raw_size-raw_offset, pid);
get_transport_payload(1, 0);
}
else if( pid == video_pid && (do_video || read_all) ) {
- if( do_video ) got_video = pid;
+ if( do_video ) got_video = video_pid;
get_transport_payload(0, 1);
}
else {
void zdemuxer_t::
set_audio_pts(uint64_t pts, const double denom)
{
- if( pts ) {
+ if( pts && pes_audio_time < 0 ) {
pes_audio_pid = custom_id;
pes_audio_time = pts / denom;
//zmsgs("pid 0x%03x, pts %f @0x%jx\n",pes_audio_pid, pes_audio_time,
void zdemuxer_t::
set_video_pts(uint64_t pts, const double denom)
{
- if( pts ) {
+ if( pts && pes_video_time < 0 ) {
pes_video_pid = custom_id;
pes_video_time = pts / denom;
//zmsgs("pid 0x%03x, pts %f @0x%jx\n",pes_video_pid, pes_video_time,
/* In a transport stream the audio or video is determined by the PID. */
/* In other streams the data type is determined by stream ID. */
if( demuxer->got_audio >= 0 || is_transport_stream() || is_audio_stream() ) {
- int audio_pid = demuxer->got_audio;
+ int audio_pid = is_transport_stream() ? demuxer->custom_id : demuxer->got_audio;
atrack_t *atrk = 0;
for( idx=0; idx < total_atracks; ++idx ) {
if( atrack[idx]->pid == audio_pid ) { /* Update an audio track */
}
}
if( demuxer->got_video >= 0 || is_transport_stream() || is_video_stream() ) {
- int video_pid = demuxer->got_video;
+ int video_pid = is_transport_stream() ? demuxer->custom_id : demuxer->got_video;
vtrack_t *vtrk = 0;
for( idx=0; idx < total_vtracks; ++idx ) {
if( vtrack[idx]->pid == video_pid ) { /* Update a video track */