2
* libzvbi - VTX export function
4
* Copyright (C) 2001, 2002, 2003, 2004 Michael H. Schimek
6
* Based on code from AleVT 1.5.1
7
* Copyright (C) 1998, 1999 Edgar Toernig <froese@gmx.de>
8
* Copyright (C) 1999 Paul Ortyl <ortylp@from.pl>
10
* Based on code from VideoteXt 0.6
11
* Copyright (C) 1995, 1996, 1997 Martin Buck
12
* <martin-2.buck@student.uni-ulm.de>
14
* This program is free software; you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation; either version 2 of the License, or
17
* (at your option) any later version.
19
* This program is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
24
* You should have received a copy of the GNU General Public License
25
* along with this program; if not, write to the Free Software
26
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
/* $Id: exp-vtx.c,v 1.12 2005/01/19 04:17:54 mschimek Exp $ */
31
/* VTX is the file format used by the VideoteXt application. It stores
32
Teletext pages in raw level 1.0 format. Level 1.5 additional characters
33
(e.g. accents), the FLOF and TOP navigation bars and the level 2.5
36
Since restoring the raw page from a fmt_page is complicated we violate
37
encapsulation by fetching a raw copy from the cache. :-( */
46
#include "hamm.h" /* vbi3_rev8() */
47
#include "cache-priv.h" /* cache_page */
48
#include "page-priv.h" /* vbi3_page_priv */
49
#include "common/intl-priv.h"
50
#include "export-priv.h"
64
* VTX - VideoteXt File (VTXV4)
68
export (vbi3_export * e,
71
const vbi3_page_priv *pgp;
75
if (pg->pgno < 0x100 || pg->pgno > 0x8FF) {
76
_vbi3_export_error_printf
77
(e, _("Can only export Teletext pages."));
81
pgp = CONST_PARENT (pg, vbi3_page_priv, pg);
83
if (pg->priv != pgp || !pgp->cp) {
84
_vbi3_export_error_printf (e, _("Page is not cached."));
90
if (cp->function != PAGE_FUNCTION_UNKNOWN
91
&& cp->function != PAGE_FUNCTION_LOP) {
92
_vbi3_export_error_printf
93
(e, _("Cannot export this page, is not displayable."));
97
memcpy (h.signature, "VTXV4", 5);
99
h.pagenum_l = cp->pgno & 0xFF;
100
h.pagenum_h = (cp->pgno >> 8) & 15;
105
h.charset = cp->national & 7;
107
h.wst_flags = cp->flags & C4_ERASE_PAGE;
108
h.wst_flags |= vbi3_rev8 (cp->flags >> 12);
109
h.vtx_flags = (0 << 7) | (0 << 6) | (0 << 5) | (0 << 4) | (0 << 3);
110
/* notfound, pblf (?), hamming error, virtual, seven bits */
112
if (fwrite (&h, sizeof (h), 1, e->fp) != 1)
115
if (fwrite (cp->data.lop.raw, 40 * 24, 1, e->fp) != 1)
121
_vbi3_export_write_error (e);
127
static const vbi3_export_info
131
.tooltip = N_("Export this page as VTX file, the "
132
"format used by VideoteXt and vbidecode"),
134
/* From VideoteXt examples/mime.types */
135
.mime_type = "application/videotext",
139
const _vbi3_export_module
140
_vbi3_export_module_vtx = {
141
.export_info = &export_info,
143
/* no private data, no options */