⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encode.cpp

📁 1、简介 此代码是IS0 13818-5 MPEG2系统层协议分析代码
💻 CPP
字号:
/* Copyright (C) 1995, Tektronix Inc. All Rights Reserved. * *   Usage Restrictions * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes only. * *   Disclaimer of Warranty * * These software programs are available to the user without any license * fee or royalty on an "as is" basis.  Tektronix Inc. disclaims any and * all warranties, whether express, implied, or statuary, including any * implied warranties or merchantability or of fitness for a particular * purpose.  In no event shall the copyright-holder be liable for any  * incidental, punitive, or consequential damages of any kind whatsoever * arising from the use of these programs. * * This disclaimer of warranty extends to the user of these programs and * user's customers, employees, agents, transferees, successors, and * assigns. * * The Tektronix Inc. does not represent or warrant that the programs * furnished hereunder are free of infringement of any third-party * patents.*//* A sample encoder *//*   The following application builds a transport stream with two programs   where each program has two elementary streams. The command syntax   is   encode file_name <textflag>   where file_name is the output file name.  If textflag is present   the stream will be output as ascii '0's and '1's.  Otherwise it   will output as "real bits"*/#include "stdafx.h"#include "Events.H"#include "Directory.H"#include "Encoder.H"#include "OPortToFile.H"#include "PESProducer.H"#include "TSProducer.H"extern "C"{void exit (int);}/*main (int argc, char* argv[]){  if ((argc != 2) && (argc != 3))    {      printf("syntax is encode <t> <text_flag>\n");      exit(0);    }  // create EventManager  EventManager* manager = new EventManager();  // create a Encoder  Encoder* encoder = new Encoder(manager);    // create a Directory and Programs  Directory* dir = new Directory();  Program* p1 = new Program(7);  EStream* s1 = new EStream(MPEG2VIDEO, UNASSIGNED, 4000);  p1->add_estream(s1);  EStream* s2 = new EStream(MPEG2AUDIO, UNASSIGNED, 512);    p1->add_estream(s2);  p1->set_pcr_estream(s2);  p1->activate();  Program* p2 = new Program(8);  EStream* s3 = new EStream(MPEG2VIDEO, UNASSIGNED, 6000);    p2->add_estream(s3);  EStream* s4 = new EStream(MPEG2AUDIO, UNASSIGNED, 384);    p2->add_estream(s4);  p2->set_pcr_estream(s4);  p2->activate();  dir->add_program(p1);  dir->add_program(p2);  // set bitrate and install directory (must be done in this order  encoder->set_bitrate(18500);  encoder->install_dir(dir);  // build oport and connect encoder  OPortToFile* oport = new OPortToFile(argv[1], (argc == 3));  encoder->connect(oport);    // get TS and PES elements from encoder and configure  TS* ts1 = encoder->get_ts(s1->pid);  PES* pes1 = encoder->get_pes(s1->pid);  PES* pes2 = encoder->get_pes(s2->pid);  TS* ts2 = encoder->get_ts(s2->pid);  PES* pes3 = encoder->get_pes(s3->pid);  PES* pes4 = encoder->get_pes(s4->pid);    ts1->config_basic('0', 'A', 'L', '0', 7, 'P');  ts1->config_adaptation('D', 'R', 'H', NULL, NULL, 12, 24, 17, 16);    pes1->config_basic(int(id_video_stream_0 + 1),		     214, '0', 'H', '0', 'C', '0',		     NULL, NULL, NULL, 0, NULL, NULL, 24);  pes2->config_basic(int(id_audio_stream_0 + 1),		     101, '0', 'L', '0', 'C', '0',		     NULL, NULL, NULL, 0, NULL, NULL, 16);  ts2->config_basic('0', 'A', 'L', '0', 7, 'P');  ts2->config_adaptation('D', 'R', 'H', NULL, NULL, 18, 10, 19, 5);    pes3->config_basic(int(id_video_stream_0 + 2),		     231, '0', 'H', '0', 'C', '0',		     NULL, NULL, NULL, 0, NULL, NULL, 8);  pes4->config_basic(int(id_audio_stream_0 + 2),		     231, '0', 'H', '0', 'C', '0',		     NULL, NULL, NULL, NULL, NULL, NULL, 11);  pes1->file_name = "streama";  pes2->file_name = "streamb";  pes3->file_name = "streamc";  pes4->file_name = "streamd";        // send some packets  int i;  encoder->send_packet(0);   encoder->send_packet(p1->pid);   encoder->send_packet(p2->pid);  for (i = 0; i < 1000; i++)    {      encoder->send_scheduled_packet();    }  printf("\ndone\n");  delete oport;}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -