Skip to content

Commit

Permalink
Compile vbitext using C++.
Browse files Browse the repository at this point in the history
The files vbilut.cpp and recorders/vbitext/hamm.c were almost
identical.  Move two functions from hamm.c to other files, and then
delete hamm.c.  Otherwise these changes were mostly removing "extern
C" declarations, a couple of changes from "0/NULL" to "nullptr", and a
couple of additional casts.  Also added a typedef for a callback
pointer.
  • Loading branch information
linuxdude42 committed Jan 23, 2020
1 parent 39ad873 commit afe8de9
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 332 deletions.
6 changes: 2 additions & 4 deletions mythtv/libs/libmythtv/libmythtv.pro
Expand Up @@ -89,14 +89,12 @@ using_valgrind:DEFINES += USING_VALGRIND
!mingw:!win32-msvc* {
HEADERS += recorders/vbitext/cc.h
HEADERS += recorders/vbitext/dllist.h
HEADERS += recorders/vbitext/hamm.h
HEADERS += recorders/vbitext/lang.h
HEADERS += recorders/vbitext/vbi.h
HEADERS += recorders/vbitext/vt.h
SOURCES += recorders/vbitext/cc.cpp
SOURCES += recorders/vbitext/vbi.c
SOURCES += recorders/vbitext/hamm.c
SOURCES += recorders/vbitext/lang.c
SOURCES += recorders/vbitext/vbi.cpp
SOURCES += recorders/vbitext/lang.cpp
}
#}

Expand Down
7 changes: 4 additions & 3 deletions mythtv/libs/libmythtv/recorders/v4lrecorder.cpp
Expand Up @@ -68,8 +68,9 @@ void V4LRecorder::SetOption(const QString &name, const QString &value)
DTVRecorder::SetOption(name, value);
}

static void vbi_event(struct VBIData *data, struct vt_event *ev)
static void vbi_event(void *data_in, struct vt_event *ev)
{
struct VBIData *data = static_cast<struct VBIData *>(data_in);
switch (ev->type)
{
case EV_PAGE:
Expand Down Expand Up @@ -115,7 +116,7 @@ int V4LRecorder::OpenVBIDevice(void)
vbi_cb = new VBIData;
memset(vbi_cb, 0, sizeof(VBIData));
vbi_cb->nvr = this;
vbi_add_handler(pal_tt, (void*) vbi_event, vbi_cb);
vbi_add_handler(pal_tt, vbi_event, vbi_cb);
}
}
else if (VBIMode::NTSC_CC == m_vbiMode)
Expand Down Expand Up @@ -230,7 +231,7 @@ void V4LRecorder::CloseVBIDevice(void)

if (m_palVbiTt)
{
vbi_del_handler(m_palVbiTt, (void*) vbi_event, m_palVbiCb);
vbi_del_handler(m_palVbiTt, vbi_event, m_palVbiCb);
vbi_close(m_palVbiTt);
delete m_palVbiCb;
m_palVbiCb = nullptr;
Expand Down
8 changes: 0 additions & 8 deletions mythtv/libs/libmythtv/recorders/vbitext/cc.h
@@ -1,10 +1,6 @@
#ifndef CC_H
#define CC_H

#ifdef __cplusplus
extern "C" {
#endif

#define CC_VBIBUFSIZE (65536*2)

//cc is 32 columns per row, this allows for extra characters
Expand All @@ -29,8 +25,4 @@ struct cc *cc_open(const char *vbi_name);
void cc_close(struct cc *cc);
void cc_handler(struct cc *cc);

#ifdef __cplusplus
}
#endif

#endif
6 changes: 1 addition & 5 deletions mythtv/libs/libmythtv/recorders/vbitext/dllist.h
Expand Up @@ -22,11 +22,7 @@ static inline struct dl_head *
dl_init(struct dl_head *h)
{
h->first = (struct dl_node *)&h->null;
#ifdef __cplusplus
h->null = nullptr;
#else
h->null = NULL;
#endif
h->last = (struct dl_node *)&h->first;
return h;
}
Expand All @@ -49,7 +45,7 @@ dl_insert_after(struct dl_node *p, struct dl_node *n)
return n;
}

#define dl_empty(h) ((h)->first->next == 0)
#define dl_empty(h) ((h)->first->next == nullptr)
#define dl_insert_before(p, n) dl_insert_after((p)->prev, (n))
#define dl_insert_first(h, n) ({ struct dl_node *_n = (n); \
dl_insert_before((h)->first, _n); })
Expand Down
240 changes: 0 additions & 240 deletions mythtv/libs/libmythtv/recorders/vbitext/hamm.c

This file was deleted.

18 changes: 0 additions & 18 deletions mythtv/libs/libmythtv/recorders/vbitext/hamm.h

This file was deleted.

@@ -1,4 +1,4 @@
#include <string.h>
#include <cstring>
#include "vt.h"
#include "lang.h"

Expand Down Expand Up @@ -174,9 +174,8 @@ do_enhancements(struct enhance *eh, struct vt_page *vtp)
if (adr < VT_WIDTH && row < VT_HEIGHT)
{
struct mark *mark = marks + (mode - 16);
char *x = NULL;

if ((x = strchr(mark->m_g0, data)))
const char *x = std::strchr(mark->m_g0, data);
if (x != nullptr)
{
if (latin1)
data = mark->m_latin1[x - mark->m_g0];
Expand Down
10 changes: 1 addition & 9 deletions mythtv/libs/libmythtv/recorders/vbitext/lang.h
@@ -1,14 +1,10 @@
#ifndef LANG_H
#define LANG_H

#ifdef __cplusplus
extern "C" {
#endif

#include "vt.h"
#include "vbilut.h"

extern int latin1;
extern const unsigned char lang_chars[][16]; /* from vbilut.cpp */

struct enhance
{
Expand All @@ -23,9 +19,5 @@ void init_enhance(struct enhance *eh);
void add_enhance(struct enhance *eh, int dcode, unsigned int *data);
void do_enhancements(struct enhance *eh, struct vt_page *vtp);

#ifdef __cplusplus
}
#endif

#endif // LANG_H

0 comments on commit afe8de9

Please sign in to comment.