Skip to content

Commit

Permalink
remove libmythtv/recorders/vbitext
Browse files Browse the repository at this point in the history
NuppelVideoRecorder::FormatTT() was the only user of VBIData::teletextpage, so
vbi_event() now has no effects.  Since no data is ever extracted, the calls to
vbi_add_handler() and thus vbi_open() are now pointless and can be removed.

V4LRecorder::m_palVbiCb and m_palVbiTt will then always be nullptr, so they can
be removed.

After copying the value of the VT_WIDTH constant to its use in cc608reader.cpp,
the vbitext directory is now unused and can be removed.
  • Loading branch information
ulmus-scott committed Nov 9, 2024
1 parent e3558df commit 4a1fcf9
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 1,219 deletions.
9 changes: 0 additions & 9 deletions mythtv/libs/libmythtv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,6 @@ if(WIN32)
if(HAVE_DXVA2)
target_compile_definitions(mythtv PRIVATE USING_DXVA2)
endif()
else(WIN32)
target_sources(
mythtv
PRIVATE recorders/vbitext/dllist.h
recorders/vbitext/lang.h
recorders/vbitext/vbi.h
recorders/vbitext/vt.h
recorders/vbitext/vbi.cpp
recorders/vbitext/lang.cpp)
endif(WIN32)

target_compile_definitions(mythtv PRIVATE MTV_API)
Expand Down
3 changes: 1 addition & 2 deletions mythtv/libs/libmythtv/captions/cc608reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

#include "captions/cc608reader.h"
#include "mythplayer.h"
#include "recorders/vbitext/vbi.h"

CC608Reader::CC608Reader(MythPlayer *parent)
: m_parent(parent),
m_maxTextSize(8 * (sizeof(teletextsubtitle) + VT_WIDTH))
m_maxTextSize(8 * (sizeof(teletextsubtitle) + 40))
{
for (int i = 0; i < MAXTBUFFER; i++)
m_inputBuffers[i].buffer = new unsigned char[m_maxTextSize + 1];
Expand Down
1 change: 0 additions & 1 deletion mythtv/libs/libmythtv/captions/teletextdecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

extern "C" {
#include <cinttypes>
#include "recorders/vbitext/vt.h"
}

#include "libmythbase/mythlogging.h"
Expand Down
13 changes: 0 additions & 13 deletions mythtv/libs/libmythtv/libmythtv.pro
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,6 @@ cygwin:DEFINES += _WIN32
# Enable Valgrind, i.e. disable some timeouts
using_valgrind:DEFINES += USING_VALGRIND

# old libvbitext (Caption decoder)
#using_v4l2 {

!mingw:!win32-msvc* {
HEADERS += recorders/vbitext/dllist.h
HEADERS += recorders/vbitext/lang.h
HEADERS += recorders/vbitext/vbi.h
HEADERS += recorders/vbitext/vt.h
SOURCES += recorders/vbitext/vbi.cpp
SOURCES += recorders/vbitext/lang.cpp
}
#}

QMAKE_CLEAN += $(TARGET) $(TARGETA) $(TARGETD) $(TARGET0) $(TARGET1) $(TARGET2)

##########################################################################
Expand Down
70 changes: 3 additions & 67 deletions mythtv/libs/libmythtv/recorders/v4lrecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include "captions/vbi608extractor.h"
#include "v4lrecorder.h"
#include "vbitext/vbi.h"
#include "tv_rec.h"

#define TVREC_CARDNUM \
Expand Down Expand Up @@ -65,58 +64,18 @@ void V4LRecorder::SetOption(const QString &name, const QString &value)
DTVRecorder::SetOption(name, value);
}

static void vbi_event(void *data_in, struct vt_event *ev)
{
auto *data = static_cast<struct VBIData *>(data_in);
switch (ev->type)
{
case EV_PAGE:
{
auto *vtp = (struct vt_page *) ev->p1;
if (vtp->flags & PG_SUBTITLE)
{
#if 0
LOG(VB_GENERAL, LOG_DEBUG, QString("subtitle page %1.%2")
.arg(vtp->pgno, 0, 16) .arg(vtp->subno, 0, 16));
#endif
data->foundteletextpage = true;
memcpy(&(data->teletextpage), vtp, sizeof(vt_page));
}
}
break;

case EV_HEADER:
case EV_XPACKET:
break;
}
}

int V4LRecorder::OpenVBIDevice(void)
{
int fd = -1;
if (m_vbiFd >= 0)
return m_vbiFd;

struct VBIData *vbi_cb = nullptr;
struct vbi *pal_tt = nullptr;
uint width = 0;
uint start_line = 0;
uint line_count = 0;

QByteArray vbidev = m_vbiDeviceName.toLatin1();
if (VBIMode::PAL_TT == m_vbiMode)
{
pal_tt = vbi_open(vbidev.constData(), nullptr, 99, -1);
if (pal_tt)
{
fd = pal_tt->fd;
vbi_cb = new VBIData;
memset(vbi_cb, 0, sizeof(VBIData));
vbi_cb->nvr = this;
vbi_add_handler(pal_tt, vbi_event, vbi_cb);
}
}
else if (VBIMode::NTSC_CC == m_vbiMode)
if (VBIMode::NTSC_CC == m_vbiMode)
{
fd = open(vbidev.constData(), O_RDONLY/*|O_NONBLOCK*/);
}
Expand Down Expand Up @@ -181,12 +140,7 @@ int V4LRecorder::OpenVBIDevice(void)
#endif // USING_V4L2
}

if (VBIMode::PAL_TT == m_vbiMode)
{
m_palVbiCb = vbi_cb;
m_palVbiTt = pal_tt;
}
else if (VBIMode::NTSC_CC == m_vbiMode)
if (VBIMode::NTSC_CC == m_vbiMode)
{
m_ntscVbiWidth = width;
m_ntscVbiStartLine = start_line;
Expand All @@ -204,14 +158,6 @@ void V4LRecorder::CloseVBIDevice(void)
if (m_vbiFd < 0)
return;

if (m_palVbiTt)
{
vbi_del_handler(m_palVbiTt, vbi_event, m_palVbiCb);
vbi_close(m_palVbiTt);
delete m_palVbiCb;
m_palVbiCb = nullptr;
}
else
{
delete m_vbi608; m_vbi608 = nullptr;
close(m_vbiFd);
Expand Down Expand Up @@ -259,17 +205,7 @@ void V4LRecorder::RunVBIDevice(void)
LOG(VB_GENERAL, LOG_DEBUG, LOC + "vbi select timed out");
continue; // either failed or timed out..
}
if (VBIMode::PAL_TT == m_vbiMode)
{
m_palVbiCb->foundteletextpage = false;
vbi_handler(m_palVbiTt, m_palVbiTt->fd);
if (m_palVbiCb->foundteletextpage)
{
// decode VBI as teletext subtitles
FormatTT(m_palVbiCb);
}
}
else if (VBIMode::NTSC_CC == m_vbiMode)
if (VBIMode::NTSC_CC == m_vbiMode)
{
int ret = read(m_vbiFd, ptr, ptr_end - ptr);
ptr = (ret > 0) ? ptr + ret : ptr;
Expand Down
12 changes: 0 additions & 12 deletions mythtv/libs/libmythtv/recorders/v4lrecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,12 @@

#include "libmythtv/captions/cc608decoder.h"
#include "libmythtv/recorders/dtvrecorder.h"
#include "libmythtv/recorders/vbitext/vt.h"
#include "libmythtv/tv.h" // for VBIMode

class VBI608Extractor;
class VBIThread;
class TVRec;

struct vbi;
struct VBIData
{
RecorderBase *nvr;
vt_page teletextpage;
bool foundteletextpage;
};

/// Abstract base class for Video4Linux based recorders.
class MTV_PUBLIC V4LRecorder : public DTVRecorder
{
Expand All @@ -40,15 +31,12 @@ class MTV_PUBLIC V4LRecorder : public DTVRecorder
void RunVBIDevice(void);

virtual bool IsHelperRequested(void) const;
virtual void FormatTT(struct VBIData */*vbidata*/) {}
virtual void FormatCC(uint /*code1*/, uint /*code2*/) {}

protected:
QString m_audioDeviceName;
QString m_vbiDeviceName;
int m_vbiMode {VBIMode::None};
struct VBIData *m_palVbiCb {nullptr};
struct vbi *m_palVbiTt {nullptr};
uint m_ntscVbiWidth {0};
uint m_ntscVbiStartLine {0};
uint m_ntscVbiLineCount {0};
Expand Down
62 changes: 0 additions & 62 deletions mythtv/libs/libmythtv/recorders/vbitext/dllist.h

This file was deleted.

Loading

0 comments on commit 4a1fcf9

Please sign in to comment.