Skip to content

Commit

Permalink
Install the OSD theme, and fix it to resize properly.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.mythtv.org/svn/trunk@166 7dbf422c-18fa-0310-86e9-fd20926502f2
  • Loading branch information
Isaac Richards committed Aug 16, 2002
1 parent 77db6b9 commit 90d9abf
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 22 deletions.
5 changes: 5 additions & 0 deletions mythtv/libs/libNuppelVideo/libNuppelVideo.pro
Expand Up @@ -8,6 +8,11 @@ CONFIG += thread staticlib

include ( ../settings.pro )

themes.path = /usr/local/share/mythtv/themes/
themes.files = defaultosd

INSTALLS += themes

# Input
HEADERS += effects.h \
format.h \
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
Expand Up @@ -58,6 +58,7 @@ NuppelVideoPlayer::NuppelVideoPlayer(void)
avcodec_register_all();

mpa_codec = 0;
osdtheme = "none";
}

NuppelVideoPlayer::~NuppelVideoPlayer(void)
Expand Down Expand Up @@ -1001,7 +1002,7 @@ void NuppelVideoPlayer::StartPlaying(void)
if (fileheader.audioblocks != 0)
InitSound();

osd = new OSD(video_width, video_height, osdfilename, osdprefix);
osd = new OSD(video_width, video_height, osdfilename, osdprefix, osdtheme);

playing = true;
killplayer = false;
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/NuppelVideoPlayer.h
Expand Up @@ -78,7 +78,8 @@ class NuppelVideoPlayer

void SetOSDFontName(QString filename, char *prefix)
{ osdfilename = filename; osdprefix = prefix; }

void SetOSDThemeName(QString themename) { osdtheme = themename; }

// don't use this on something you're playing
char *GetScreenGrab(int secondsin, int &buflen, int &vw, int &vh);

Expand Down Expand Up @@ -223,6 +224,7 @@ class NuppelVideoPlayer

QString osdfilename;
QString osdprefix;
QString osdtheme;
OSD *osd;

bool InitAVCodec(int codectype);
Expand Down
29 changes: 13 additions & 16 deletions mythtv/libs/libmythtv/osd.cpp
Expand Up @@ -84,7 +84,8 @@ OSDImage::~OSDImage()
delete [] alpha;
}

OSD::OSD(int width, int height, const QString &filename, const QString &prefix)
OSD::OSD(int width, int height, const QString &filename, const QString &prefix,
const QString &osdtheme)
{
vid_width = width;
vid_height = height;
Expand All @@ -111,7 +112,7 @@ OSD::OSD(int width, int height, const QString &filename, const QString &prefix)

SetNoThemeDefaults();

themepath = FindTheme("defaultosd");
themepath = FindTheme(osdtheme);

if (themepath == "")
{
Expand Down Expand Up @@ -273,15 +274,14 @@ bool OSD::LoadTheme(void)
x += (int)(vid_width * 0.045);
if (y == -1)
y = (int)(vid_height * 0.95 - infobackground->height);
y = (int)(y * hmult);


infobackground->position.setX(x);
infobackground->position.setY(y);

coords = settings->GetSetting("InfoTextBox");
infoRect = parseRect(coords);
normalizeRect(&infoRect);
infoRect.moveBy(x, y);
normalizeRect(&infoRect);

int fontsize = settings->GetNumSetting("InfoTextFontSize");
if (fontsize > 0)
Expand All @@ -292,8 +292,8 @@ bool OSD::LoadTheme(void)
if (coords.length() > 1)
{
infoiconpos = parsePoint(coords);
infoiconpos.setX((x + infoiconpos.x()) * wmult);
infoiconpos.setY((y + infoiconpos.y()) * hmult);
infoiconpos.setX(x + infoiconpos.x() * wmult);
infoiconpos.setY(y + infoiconpos.y() * hmult);
useinfoicon = true;
}

Expand All @@ -302,8 +302,8 @@ bool OSD::LoadTheme(void)
if (coords.length() > 1)
{
callsignRect = parseRect(coords);
callsignRect.moveBy(x, y);
normalizeRect(&callsignRect);
callsignRect.moveBy(x, y);
}
}

Expand All @@ -324,7 +324,6 @@ bool OSD::LoadTheme(void)
x += (int)(vid_width * 0.045);
if (y == -1)
y = (int)(vid_height * 0.95 - pausebackground->height);
y = (int)(y * hmult);

pausebackground->position.setX(x);
pausebackground->position.setY(y);
Expand All @@ -334,8 +333,8 @@ bool OSD::LoadTheme(void)
if (coords.length() > 1)
{
pausestatusRect = parseRect(coords);
pausestatusRect.moveBy(x, y);
normalizeRect(&pausestatusRect);
pausestatusRect.moveBy(x, y);
}

bgname = settings->GetSetting("SeekSliderNormal");
Expand All @@ -345,8 +344,8 @@ bool OSD::LoadTheme(void)
pausesliderfill = new OSDImage(bgname, hmult, wmult, true);

pausesliderRect = parseRect(settings->GetSetting("SeekSliderRect"));
pausesliderRect.moveBy(x, y);
normalizeRect(&pausesliderRect);
pausesliderRect.moveBy(x, y);
}
}

Expand All @@ -355,11 +354,9 @@ bool OSD::LoadTheme(void)

void OSD::normalizeRect(QRect *rect)
{
rect->setWidth(rect->width() * 0.91);
rect->setLeft(rect->left() * wmult);
rect->setRight(rect->right() * wmult);
rect->setTop(rect->top() * hmult);
rect->setBottom(rect->bottom() * hmult);
rect->setWidth(rect->width() * 0.91 * wmult);
rect->setHeight(rect->height() * hmult);
rect->moveTopLeft(QPoint(rect->left() * wmult, rect->top() * hmult));
}

QPoint OSD::parsePoint(QString text)
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/osd.h
Expand Up @@ -13,7 +13,8 @@ class OSDImage;
class OSD
{
public:
OSD(int width, int height, const QString &filename, const QString &prefix);
OSD(int width, int height, const QString &filename, const QString &prefix,
const QString &osdtheme);
~OSD(void);

void Display(unsigned char *yuvptr);
Expand Down
5 changes: 4 additions & 1 deletion mythtv/libs/libmythtv/settings.txt
Expand Up @@ -65,7 +65,10 @@ int MP3Quality=7
int Deinterlace=1
# How long should the OSD stay up for in seconds?
int OSDDisplayTime=3
# Path to the TTF
# Theme to use for the OSD, if 'none' or otherwise doesn't exist, the normal
# ugly OSD will be used instead.
str OSDTheme=defaultosd
# Path to the TTF used in the OSD.
str OSDFont=helr.ttf
#str OSDFont=/usr/share/fonts/truetype/Arial.ttf

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/tv.cpp
Expand Up @@ -632,6 +632,7 @@ void TV::SetupPlayer(void)
nvp->SetRecorder(nvr);
nvp->SetDeinterlace((bool)settings->GetNumSetting("Deinterlace"));
nvp->SetOSDFontName(settings->GetSetting("OSDFont"), theprefix);
nvp->SetOSDThemeName(settings->GetSetting("OSDTheme"));
nvp->SetAudioSampleRate(settings->GetNumSetting("AudioSampleRate"));
nvp->SetAudioDevice(settings->GetSetting("AudioDevice"));
nvp->SetLength(playbackLen);
Expand Down
3 changes: 3 additions & 0 deletions mythtv/libs/libmythtv/videoout_xv.cpp
Expand Up @@ -11,6 +11,9 @@
#include <sys/shm.h>
#include <math.h>

#include <iostream>
using namespace std;

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
Expand Down
23 changes: 21 additions & 2 deletions mythtv/themes/oldosd/osd.txt
@@ -1,14 +1,33 @@
# Background image for the box that shows up on channel change, should be
# sized to fit 640x480
str InfoBackground=channelinfo.png
# Position, if the y coord is 0, it'll be on the bottom of the screen
str InfoPosition=0,-1
str InfoTextBox=10,60,630,135
# optional
# Where the information text can be drawn inside.
str InfoTextBox=10,60,630,155
# The font size of the text, if this isn't here, the default is 16.
int InfoTextFontSize=18

# optional settings
# Position (relative to the info box upper left) where the channel icon is
# displayed
str InfoIconPosition=15,15
# Position (relative to the info box upper left) where the 5 letter call sign
# is displayed
str InfoCallSignRect=55,20,95,45


# If this next setting exists, display a dialog when the video is paused.
# This pixmap should also be sized to fit a 640x480 screen.
str SeekBackground=pause.png
# Positioning of the dialog, the -1 in the y means put it on the bottom of
# the screen
str SeekPosition=0,-1
# Location of a place to put a short status message, such as 'Paused'
# optional
str SeekStatusRect=10,20,100,45
# Location of the slider bar to draw. If this exists, the next setting must
# also
str SeekSliderRect=152,13,470,45
# Image to use for the fill slider bar. Only the first column is used.
str SeekSliderNormal=slider-normal.png

0 comments on commit 90d9abf

Please sign in to comment.