<commit_before>/*****************************************************************************
 * Copyright (C) 2011-2014 <NAME>
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef __DECODE_H__
#define __DECODE_H__

#include <string>
#include <string.h>
#include <time.h>

#include "dvbpsi/dvbpsi.h"
#include "dvbpsi/pat.h"
#include "dvbpsi/descriptor.h"
#include "dvbpsi/pmt.h"
#include "dvbpsi/demux.h"
#include "dvbpsi/sdt.h"
#include "dvbpsi/eit.h"
#include "dvbpsi/nit.h"
#include "dvbpsi/tot.h"
#if !USING_DVBPSI_VERSION_0
#include "dvbpsi/atsc_eit.h"
#include "dvbpsi/atsc_ett.h"
#include "dvbpsi/atsc_stt.h"
#include "dvbpsi/atsc_vct.h"
#include "dvbpsi/atsc_mgt.h"
#ifdef RRT
#include "dvbpsi/atsc_rrt.h"
#endif
#endif

#include "desc.h"

#include <map>

#if (DVBPSI_VERSION_INT < ((1<<16)+(0<<8)+0))
#define USING_DVBPSI_VERSION_0 1
#else
#define USING_DVBPSI_VERSION_0 0
#endif

/* -- PAT -- */
typedef std::map<uint16_t, uint16_t> map_decoded_pat_programs; /* program number, pid */

typedef struct
{
	uint16_t			ts_id;
	uint8_t				version;
	map_decoded_pat_programs	programs;
} decoded_pat_t;

/* -- PMT -- */
typedef struct ts_elementary_stream_s
{
	uint8_t		type;
	uint16_t	pid;
	// FIXME: descriptors...
	// from ISO639 language descriptor 0A:
	unsigned char iso_639_code[4];

	ts_elementary_stream_s() { memset(iso_639_code, 0, sizeof(iso_639_code)); }
} ts_elementary_stream_t; // FIXME: rename this later

typedef std::map<uint16_t, ts_elementary_stream_t> map_ts_elementary_streams; /* arbitrary idx(pid), ts_elementary_stream_t */

typedef struct
{<commit_msg>decode: move up DVBPSI_VERSION_INT test<commit_after>/*****************************************************************************
 * Copyright (C) 2011-2014 <NAME>
 *
 * Author: <NAME> <<EMAIL>>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef __DECODE_H__
#define __DECODE_H__

#include <string>
#include <string.h>
#include <time.h>

#include "dvbpsi/dvbpsi.h"
#include "dvbpsi/pat.h"
#include "dvbpsi/descriptor.h"
#include "dvbpsi/pmt.h"
#include "dvbpsi/demux.h"
#include "dvbpsi/sdt.h"
#include "dvbpsi/eit.h"
#include "dvbpsi/nit.h"
#include "dvbpsi/tot.h"

#if (DVBPSI_VERSION_INT < ((1<<16)+(0<<8)+0))
#define USING_DVBPSI_VERSION_0 1
#else
#define USING_DVBPSI_VERSION_0 0
#endif

#if !USING_DVBPSI_VERSION_0
#include "dvbpsi/atsc_eit.h"
#include "dvbpsi/atsc_ett.h"
#include "dvbpsi/atsc_stt.h"
#include "dvbpsi/atsc_vct.h"
#include "dvbpsi/atsc_mgt.h"
#ifdef RRT
#include "dvbpsi/atsc_rrt.h"
#endif
#endif

#include "desc.h"

#include <map>

/* -- PAT -- */
typedef std::map<uint16_t, uint16_t> map_decoded_pat_programs; /* program number, pid */

typedef struct
{
	uint16_t			ts_id;
	uint8_t				version;
	map_decoded_pat_programs	programs;
} decoded_pat_t;

/* -- PMT -- */
typedef struct ts_elementary_stream_s
{
	uint8_t		type;
	uint16_t	pid;
	// FIXME: descriptors...
	// from ISO639 language descriptor 0A:
	unsigned char iso_639_code[4];

	ts_elementary_stream_s() { memset(iso_639_code, 0, sizeof(iso_639_code)); }
} ts_elementary_stream_t; // FIXME: rename this later

typedef std::map<uint16_t, ts_elementary_stream_t> map_ts_elementary_streams; /* arbitrary idx(pid), ts_elementary_stream_t */

typedef struct
{
{'fraction_non_alphanumeric': 0.1696076396097156, 'fraction_numerical': 0.02449657463151339, 'mean_word_length': 5.037593984962406, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1633082', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1673, 'n_words': 480}