📄 nulloutput.c
字号:
/*Copyright (C) 2006 Adam CharrettThis program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USAnulloutput.cNULL Delivery Method handler, doesn't write any output, to anywhere, period.*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdint.h>#include "plugin.h"#include "ts.h"#include "deliverymethod.h"/******************************************************************************** Prototypes ********************************************************************************/bool NullOutputCanHandle(char *mrl);DeliveryMethodInstance_t *NullOutputCreate(char *arg);void NullOutputSendPacket(DeliveryMethodInstance_t *this, TSPacket_t *packet);void NullOutputSendBlock(DeliveryMethodInstance_t *this, void *block, unsigned long blockLen);void NullOutputDestroy(DeliveryMethodInstance_t *this);/******************************************************************************** Global variables ********************************************************************************//** Constants for the start of the MRL **/#define PREFIX_LEN (sizeof(NullPrefix) - 1)const char NullPrefix[] = "null://";/** Plugin Interface **/DeliveryMethodHandler_t NullOutputHandler = { NullOutputCanHandle, NullOutputCreate};/******************************************************************************** Plugin Setup ********************************************************************************/PLUGIN_FEATURES( PLUGIN_FEATURE_DELIVERYMETHOD(NullOutputHandler));PLUGIN_INTERFACE_F( PLUGIN_FOR_ALL, "NullOutput", "0.1", "Null Delivery method, all packets are dropped.", "charrea6@users.sourceforge.net");/******************************************************************************** Delivery Method Functions ********************************************************************************/bool NullOutputCanHandle(char *mrl){ return (strncmp(NullPrefix, mrl, PREFIX_LEN) == 0);}DeliveryMethodInstance_t *NullOutputCreate(char *arg){ DeliveryMethodInstance_t *instance = calloc(1, sizeof(DeliveryMethodInstance_t)); if (instance) { instance->SendPacket = NullOutputSendPacket; instance->SendBlock = NullOutputSendBlock; instance->DestroyInstance = NullOutputDestroy; } return instance;}void NullOutputSendPacket(DeliveryMethodInstance_t *this, TSPacket_t *packet){ /* Does nothing with the packet */ return;}void NullOutputSendBlock(DeliveryMethodInstance_t *this, void *block, unsigned long blockLen){ /* Does nothing with the packet */ return;}void NullOutputDestroy(DeliveryMethodInstance_t *this){ free(this);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -