• seanew
    了解作者
  • Objective-C
    开发工具
  • 17KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 51
    下载次数
  • 2008-09-18 07:39
    上传日期
解析DVB的工具,输入为DVB的信号流(TS),可以解析,也可以转换PES
dvb_ts.rar
  • www.pudn.com.txt
    218B
  • ts.c
    87.9KB
内容介绍
/***************************************************************************** * ts.c: MPEG-II TS Muxer ***************************************************************************** * Copyright (C) 2001-2005 the VideoLAN team * $Id: ts.c 16955 2006-10-05 16:35:01Z sam $ * * Authors: Laurent Aimar <fenrir@via.ecp.fr> * Eric Petit <titer@videolan.org> * Jean-Paul Saman <jpsaman #_at_# m2x.nl> * Wallace Wadge <wwadge #_at_# gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of 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 of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ #include <stdlib.h> #include <vlc/vlc.h> #include <vlc/input.h> #include <vlc/sout.h> #include "iso_lang.h" #include "bits.h" #include "pes.h" #include "csa.h" #ifdef HAVE_DVBPSI_DR_H # include <dvbpsi/dvbpsi.h> # include <dvbpsi/demux.h> # include <dvbpsi/descriptor.h> # include <dvbpsi/pat.h> # include <dvbpsi/pmt.h> # include <dvbpsi/sdt.h> # include <dvbpsi/dr.h> # include <dvbpsi/psi.h> #else # include "dvbpsi.h" # include "demux.h" # include "descriptor.h" # include "tables/pat.h" # include "tables/pmt.h" # include "tables/sdt.h" # include "descriptors/dr.h" # include "psi.h" #endif /* * TODO: * - check PCR frequency requirement * - check PAT/PMT " " * - check PCR/PCR "soft" * - check if "registration" descriptor : "AC-3" should be a program * descriptor or an es one. (xine want an es one) * * - remove creation of PAT/PMT without dvbpsi * - ? * FIXME: * - subtitle support is far from perfect. I expect some subtitles drop * if they arrive a bit late * (We cannot rely on the fact that the fifo should be full) */ /***************************************************************************** * Module descriptor *****************************************************************************/ static int Open ( vlc_object_t * ); static void Close ( vlc_object_t * ); #define VPID_TEXT N_("Video PID") #define VPID_LONGTEXT N_("Assign a fixed PID to the video stream. The PCR " \ "PID will automatically be the video.") #define APID_TEXT N_("Audio PID") #define APID_LONGTEXT N_("Assign a fixed PID to the audio stream.") #define SPUPID_TEXT N_("SPU PID") #define SPUPID_LONGTEXT N_("Assign a fixed PID to the SPU.") #define PMTPID_TEXT N_("PMT PID") #define PMTPID_LONGTEXT N_("Assign a fixed PID to the PMT") #define TSID_TEXT N_("TS ID") #define TSID_LONGTEXT N_("Assign a fixed Transport Stream ID.") #define NETID_TEXT N_("NET ID") #define NETID_LONGTEXT N_("Assign a fixed Network ID (for SDT table)") #define PMTPROG_TEXT N_("PMT Program numbers") #define PMTPROG_LONGTEXT N_("Assign a program number to each PMT. This " \ "requires \"Set PID to ID of ES\" to be enabled." ) #define MUXPMT_TEXT N_("Mux PMT (requires --sout-ts-es-id-pid)") #define MUXPMT_LONGTEXT N_("Define the pids to add to each pmt. This " \ "requires \"Set PID to ID of ES\" to be enabled." ) #define SDTDESC_TEXT N_("SDT Descriptors (requires --sout-ts-es-id-pid)") #define SDTDESC_LONGTEXT N_("Defines the descriptors of each SDT. This" \ "requires \"Set PID to ID of ES\" to be enabled." ) #define PID_TEXT N_("Set PID to ID of ES") #define PID_LONGTEXT N_("Sets PID to the ID if the incoming ES. This is for " \ "use with --ts-es-id-pid, and allows to have the same PIDs in the input " \ "and output streams.") #define ALIGNMENT_TEXT N_("Data alignment") #define ALIGNMENT_LONGTEXT N_("Enforces alignment of all access units on " \ "PES boundaries. Disabling this might save some bandwidth but introduce incompatibilities.") #define SHAPING_TEXT N_("Shaping delay (ms)") #define SHAPING_LONGTEXT N_("Cut the " \ "stream in slices of the given duration, and ensure a constant bitrate " \ "between the two boundaries. This avoids having huge bitrate peaks, " \ "especially for reference frames." ) #define KEYF_TEXT N_("Use keyframes") #define KEYF_LONGTEXT N_("If enabled, and shaping is specified, " \ "the TS muxer will place the boundaries at the end of I pictures. In " \ "that case, the shaping duration given by the user is a worse case " \ "used when no reference frame is available. This enhances the efficiency " \ "of the shaping algorithm, since I frames are usually the biggest " \ "frames in the stream.") #define PCR_TEXT N_("PCR delay (ms)") #define PCR_LONGTEXT N_("Set at which interval " \ "PCRs (Program Clock Reference) will be sent (in milliseconds). " \ "This value should be below 100ms. (default is 70ms).") #define BMIN_TEXT N_( "Minimum B (deprecated)") #define BMIN_LONGTEXT N_( "This setting is deprecated and not used anymore" ) #define BMAX_TEXT N_( "Maximum B (deprecated)") #define BMAX_LONGTEXT N_( "This setting is deprecated and not used anymore") #define DTS_TEXT N_("DTS delay (ms)") #define DTS_LONGTEXT N_("Delay the DTS (decoding time " \ "stamps) and PTS (presentation timestamps) of the data in the " \ "stream, compared to the PCRs. This allows for some buffering inside " \ "the client decoder.") #define ACRYPT_TEXT N_("Crypt audio") #define ACRYPT_LONGTEXT N_("Crypt audio using CSA") #define VCRYPT_TEXT N_("Crypt video") #define VCRYPT_LONGTEXT N_("Crypt video using CSA") #define CK_TEXT N_("CSA Key") #define CK_LONGTEXT N_("CSA encryption key. This must be a " \ "16 char string (8 hexadecimal bytes).") #define CPKT_TEXT N_("Packet size in bytes to encrypt") /// \bug [String] Extra space #define CPKT_LONGTEXT N_("Size of the TS packet to encrypt. " \ "The encryption routines subtract the TS-header from the value before " \ "encrypting. " ) #define SOUT_CFG_PREFIX "sout-ts-" #ifdef HAVE_BSEARCH # define MAX_PMT 64 /* Maximum number of programs. FIXME: I just chose an arbitary number. Where is the maximum in the spec? */ #else # define MAX_PMT 1 #endif #define MAX_PMT_PID 64 /* Maximum pids in each pmt. FIXME: I just chose an arbitary number. Where is the maximum in the spec? */ vlc_module_begin(); set_description( _("TS muxer (libdvbpsi)") ); set_shortname( "MPEG-TS"); set_category( CAT_SOUT ); set_subcategory( SUBCAT_SOUT_MUX ); set_capability( "sout mux", 120 ); add_shortcut( "ts" ); add_integer( SOUT_CFG_PREFIX "pid-video", 0, NULL,VPID_TEXT, VPID_LONGTEXT, VLC_TRUE ); add_integer( SOUT_CFG_PREFIX "pid-audio", 0, NULL, APID_TEXT, APID_LONGTEXT, VLC_TRUE ); add_integer( SOUT_CFG_PREFIX "pid-spu", 0, NULL, SPUPID_TEXT, SPUPID_LONGTEXT, VLC_TRUE ); add_integer( SOUT_CFG_PREFIX "pid-pmt", 0, NULL, PMTPID_TEXT, PMTPID_LONGTEXT, VLC_TRUE ); add_integer( SOUT_CFG_PREFIX "tsid", 0, NULL, TSID_TEXT, TSID_LONGTEXT, VLC_TRUE ); #ifdef HAVE_DVBPSI_SDT add_integer( SOUT_CFG_PREFIX "netid", 0, NULL, NETID_TEXT, NETID_LONGTEXT, VLC_TRUE ); #endif add_string( SOUT_CFG_PREFIX "program-pmt", NULL, NULL, PMTPROG_TEXT, PMTPROG_LONGTEXT, VLC_TRUE ); add_bool( SO
评论
    相关推荐