<commit_before>/*
 *			GPAC - Multimedia Framework C SDK
 *
 *			Copyright (c) <NAME> 2000-2005
 *					All rights reserved
 *
 *  This file is part of GPAC / Dummy input module
 *
 *  GPAC 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, or (at your option)
 *  any later version.
 *   
 *  GPAC 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; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *
 */


#include <gpac/modules/service.h>
/*for GF_STREAM_PRIVATE_SCENE definition*/
#include <gpac/constants.h>
#include <gpac/download.h>
#include <gpac/xml.h>

typedef struct
{
	u32 ESID;
	LPNETCHANNEL ch;
	u32 start, end;
} DummyChannel;

typedef struct
{
	/*the service we're responsible for*/
	GF_ClientService *service;
	char *url;
	u32 oti;
	GF_List *channels;

	/*file downloader*/
	GF_DownloadSession * dnload;
	Bool is_service_connected;
} DCReader;

DummyChannel *DC_GetChannel(DCReader *read, LPNETCHANNEL ch)
{
	DummyChannel *dc;
	u32 i=0;
	while ((dc = (DummyChannel *)gf_list_enum(read->channels, &i))) {
		if (dc->ch && dc->ch==ch) return dc;
	}
	return NULL;
}

Bool DC_RemoveChannel(DCReader *read, LPNETCHANNEL ch)
{
	DummyChannel *dc;
	u32 i=0;
	while ((dc = (DummyChannel *)gf_list_enum(read->channels, &i))) {
		if (dc->ch && dc->ch==ch) {
			gf_list_rem(read->channels, i-1);
			gf_free(dc);
			return 1;
		}
	}
	return 0;
}

static const char * DC_MIME_TYPES[] = {
/*  "application/x-xmta", "xmta xmta.gz xmtaz", "MPEG-4 Text (XMT)" */
    "application/x-bt", "bt bt.gz btz", "MPEG-4 Text (BT)",
    "application/x-xmt", "xmt xmt.gz xmtz", "MPEG-4 Text (XMT)",
    "model/vrml", "wrl wrl.gz", "VRML World",
    "x-model/x-vrml", "wrl wrl.gz", "VRML World",
    "model/x3d+vrml", "x3dv x3dv.gz x3dvz", "X3D/VRML World",
    "model/x3d+xml", "x3d x3d.gz x3dz", "X3D/XML World",
    "application/x-shockwave-flash", "swf", "Macromedia Flash Movie",
    "image/svg+xml", "svg svg.gz svgz", "SVG Document",
    "image/x-svgm", "svgm", "SVGM Document",
    "application/x-LASeR+xml", "xsr", "LASeR Document",
    "application/widget", "wgt", "W3C Widget Package",
    "application/x-mpegu-widget", "mgt", "MPEG-U Widget Package",
    NULL
};


static u32 DC_RegisterMimeTypes(GF_InputService *plug){
    u32 i;
    if (!plug)
      return 0;
    for (i = 0 ; DC_MIME_TYPES[i] ; i+=3)
      gf_term_register_mime_type(plug, DC_MIME_TYPES[i], DC_MIME_TYPES[i+1], DC_MIME_TYPES[i+2]);
    return i / 3;
}

Bool DC_CanHandleURL(GF_InputService *plug, const char *url)
{
	char *sExt = strrchr(url, '.');
	if (sExt) {
		Bool ok;
		char *cgi_par;
		if (!strnicmp(sExt, ".gz", 3)) sExt = strrchr(sExt, '.');
		if (!strnicmp(url, "rtsp://", 7)) return 0;

		cgi_par = strchr(sExt, '?'); 
		if (cgi_par) cgi_par[0] = 0;<commit_msg>fixed compilation warning about uninitialized value<commit_after>/*
 *			GPAC - Multimedia Framework C SDK
 *
 *			Copyright (c) <NAME> 2000-2005
 *					All rights reserved
 *
 *  This file is part of GPAC / Dummy input module
 *
 *  GPAC 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, or (at your option)
 *  any later version.
 *   
 *  GPAC 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; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
 *
 */


#include <gpac/modules/service.h>
/*for GF_STREAM_PRIVATE_SCENE definition*/
#include <gpac/constants.h>
#include <gpac/download.h>
#include <gpac/xml.h>

typedef struct
{
	u32 ESID;
	LPNETCHANNEL ch;
	u32 start, end;
} DummyChannel;

typedef struct
{
	/*the service we're responsible for*/
	GF_ClientService *service;
	char *url;
	u32 oti;
	GF_List *channels;

	/*file downloader*/
	GF_DownloadSession * dnload;
	Bool is_service_connected;
} DCReader;

DummyChannel *DC_GetChannel(DCReader *read, LPNETCHANNEL ch)
{
	DummyChannel *dc;
	u32 i=0;
	while ((dc = (DummyChannel *)gf_list_enum(read->channels, &i))) {
		if (dc->ch && dc->ch==ch) return dc;
	}
	return NULL;
}

Bool DC_RemoveChannel(DCReader *read, LPNETCHANNEL ch)
{
	DummyChannel *dc;
	u32 i=0;
	while ((dc = (DummyChannel *)gf_list_enum(read->channels, &i))) {
		if (dc->ch && dc->ch==ch) {
			gf_list_rem(read->channels, i-1);
			gf_free(dc);
			return 1;
		}
	}
	return 0;
}

static const char * DC_MIME_TYPES[] = {
/*  "application/x-xmta", "xmta xmta.gz xmtaz", "MPEG-4 Text (XMT)" */
    "application/x-bt", "bt bt.gz btz", "MPEG-4 Text (BT)",
    "application/x-xmt", "xmt xmt.gz xmtz", "MPEG-4 Text (XMT)",
    "model/vrml", "wrl wrl.gz", "VRML World",
    "x-model/x-vrml", "wrl wrl.gz", "VRML World",
    "model/x3d+vrml", "x3dv x3dv.gz x3dvz", "X3D/VRML World",
    "model/x3d+xml", "x3d x3d.gz x3dz", "X3D/XML World",
    "application/x-shockwave-flash", "swf", "Macromedia Flash Movie",
    "image/svg+xml", "svg svg.gz svgz", "SVG Document",
    "image/x-svgm", "svgm", "SVGM Document",
    "application/x-LASeR+xml", "xsr", "LASeR Document",
    "application/widget", "wgt", "W3C Widget Package",
    "application/x-mpegu-widget", "mgt", "MPEG-U Widget Package",
    NULL
};


static u32 DC_RegisterMimeTypes(GF_InputService *plug){
    u32 i;
    if (!plug)
      return 0;
    for (i = 0 ; DC_MIME_TYPES[i] ; i+=3)
      gf_term_register_mime_type(plug, DC_MIME_TYPES[i], DC_MIME_TYPES[i+1], DC_MIME_TYPES[i+2]);
    return i / 3;
}

Bool DC_CanHandleURL(GF_InputService *plug, const char *url)
{
	char *sExt = strrchr(url, '.');
	if (sExt) {
		Bool ok = 0;
		char *cgi_par;
		if (!strnicmp(sExt, ".gz", 3)) sExt = strrchr(sExt, '.');
		if (!strnicmp(url, "rtsp://", 7)) return 0;

		cgi_par = strchr(sExt, '?'); 
		if (cgi_par) cgi_par[0] = 0;
{'fraction_non_alphanumeric': 0.14506740196078433, 'fraction_numerical': 0.01884191176470588, 'mean_word_length': 3.6971223021582733, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3191799', 'n_tokens_mistral': 2640, 'n_tokens_neox': 2530, 'n_words': 713}