text:
*****************
GENIE Data Set
*****************

About the AACR Project Genomics Evidence Neoplasia Information Exchange
------------------------------------------------------------------------

The `AACR Project Genomics Evidence Neoplasia Information Exchange <https://gdc.cancer.gov/about-gdc/contributed-genomic-data-cancer-research/genie>`_ contains data generated from an international pan-cancer registry to serve as an evidence base for the entire cancer community. Genomic and baseline clinical data from more than 40,000 tumors has been made available in the GDC, following the efforts of AACR's strategic and technical partners, Sage Bionetworks and Memorial Sloan Kettering Cancer Center.

About the AACR Project Genomics Evidence Neoplasia Information Exchange Data
---------------------------------------------------------------------------------

The GENIE data set includes masked annotations, somatic mutations, gene level copy number scores, and transcript fusion analysis. The program analyzed more than 44,000 cases. The Genomic Data Commons (GDC) currently has MAF, TXT, and TSV controlled data available.

For more information on GENIE data, please refer to the site below:

- `GDC Data Portal <https://portal.gdc.cancer.gov/projects?filters=%7B%22op%22%3A%22and%22%2C%22content%22%3A%5B%7B%22op%22%3A%22in%22%2C%22content%22%3A%7B%22field%22%3A%22projects.program.name%22%2C%22value%22%3A%5B%22GENIE%22%5D%7D%7D%5D%7D>`_

Accessing the AACR Project Genomics Evidence Neoplasia Information Exchange Data on the Cloud
-------------------------------------------------------------------------------------------

Besides accessing the files on the GDC Data Portal, you can also access them from the GDC Google Cloud Storage Bucket, which means that you don't need to download them to perform analysis. ISB-CGC stores the cloud file locations in tables in the ``isb-cgc-bq.GDC_case_file_metadata`` data set in BigQuery.

- To access these metadata files, go to the Google BigQuery console.
- Perform SQL queries to find the GENIE files. Here is an example:

.. code-block:: sql

  SELECT active.*, file_gdc_url
  FROM `isb-cgc-bq.GDC_case_file_metadata.fileData_active_current` as active, `isb-cgc-bq.GDC_case_file_metadata.GDCfileID_to_GCSurl_current` as GCSurl
  WHERE program_name = 'GENIE'
  AND active.file_gdc_id = GCSurl.file_gdc_id

Accessing the GENIE Data in Google BigQuery
------------------------------------------------

ISB-CGC has GENIE data, such as clinical, stored in Google BigQuery tables. Information about these tables can be found using the `ISB-CGC BigQuery Table Search <https://isb-cgc.appspot.com/bq_meta_search/>`_ with GENIE selected for filter PROGRAM. To learn more about this tool, see the `ISB-CGC BigQuery Table Search documentation <../BigQueryTableSearchUI.html>`_.

The GENIE tables are in project isb-cgc-bq. To learn more about how to view and query tables in the Google BigQuery console, see the `ISB-CGC BigQuery Tables documentation <../BigQuery.html>`_.

- Data set ``isb-cgc-bq.GENIE`` contains the latest tables for each data type.
- Data set ``isb-cgc-bq.GENIE_versioned`` contains previously released tables, as well as the most current table.


text:
package com.dpoli.store.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

import com.google.gson.Gson;
import com.thoughtworks.xstream.XStream;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ShoppingCart implements Serializable {

	// @XmlRootElement - Maps the class to an XML element.
	// @XmlAccessorType(XmlAccessType.FIELD) - Sets all fields as serialized by default.
	// JAXB requires a default constructor (with no arguments).

	private static final long serialVersionUID = 1L;

	private long id;
	private String address;
	private String city;
	private List<Product> products = new ArrayList<>();

	public ShoppingCart() {
	}

	public ShoppingCart add(Product product) {
		products.add(product);
		return this;
	}

	public ShoppingCart setData(String address, String city) {
		this.address = address;
		this.city = city;
		return this;
	}

	public long getId() {
		return id;
	}

	public ShoppingCart setId(long id) {
		this.id = id;
		return this;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public List<Product> getProducts() {
		return products;
	}

	public void delete(long id) {
		for (Iterator<Product> iterator = products.iterator(); iterator.hasNext();) {
			Product produto = (Product) iterator.next();
			if (produto.getId() == id) {
				iterator.remove();
			}
		}
	}

	public void replace(Product product) {
		delete(product.getId());
		add(product);
	}

	public void updateQuantity(Product product) {
		for (Iterator<Product> iterator = products.iterator(); iterator.hasNext();) {
			Product p = (Product) iterator.next();
			if (p.getId() == product.getId()) {
				p.setQuantity(product.getQuantity());
				return;
			}
		}
	}

	public String toXML() {
		return new XStream().toXML(this);
	}

	public String toJson() {
		return new Gson().toJson(this);
	}
}

redpajama_set_name: RedPajamaGithub


text:
- remove pathwatcher - using atom

## 0.15.0
- removed project, need to rewrite it
- fixed input text

## 0.8.0
- new project will create an alloy project
- use cli to create controller and widget

## 0.6.0
- move to package menu

## 0.5.0
- last versions code got missing
- ESC and widget are back again
- Alloy folder check

## 0.4.0
- ESC key to cancel textfield
- don't use empty field when pressing ENTER
- create widgets

## 0.3.0
- changelog
- added controller arguments preset


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>net.ljcomputing.people.service Class Hierarchy (LJ Computing - Contacts 1.0.0-SNAPSHOT API)</title>
<meta name="date" content="2015-09-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Copyright 2014-2015, James G. Willmore, LJ Computing

Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package net.ljcomputing.people.service

Package Hierarchies:

All Packages

Interface Hierarchy

net.ljcomputing.core.service.EntityService<T,S,R>

net.ljcomputing.people.service.EmailAddressService

net.ljcomputing.people.service.PersonService

net.ljcomputing.people.service.PhoneNumberService

net.ljcomputing.people.service.PostalAddressService

net.ljcomputing.people.service.PersonalContactsService

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2015 LJ Computing. All rights reserved.


text:
<?php

describe(\Dxw\TwoFa\Tokens::class, function () {
    beforeEach(function () {
        \WP_Mock::setUp();

        $this->tokens = new \Dxw\TwoFa\Tokens();
        $this->namespace = 'tricorder';
        $this->token = '123123';
        $this->wrongToken = '999999';
        $this->now = 1476969672;
        $this->expiry = 2*60;
        $this->userId = 3;

        \phpmock\mockery\PHPMockery::mock('\\Dxw\\TwoFa', 'time')->andReturn($this->now);

        \WP_Mock::wpFunction('get_user_meta', [
            'args' => [$this->userId, '2fa_'.$this->namespace.'_temporary_token', true],
            'return' => $this->token,
        ]);
    });

    afterEach(function () {
        \WP_Mock::tearDown();
    });

    describe('->tokenIsValid()', function () {
        context('when token is expired', function () {
            beforeEach(function () {
                \WP_Mock::wpFunction('get_user_meta', [
                    'args' => [$this->userId, '2fa_'.$this->namespace.'_temporary_token_time', true],
                    'return' => $this->now - ($this->expiry + 1),
                ]);
            });

            it('returns false', function () {
                $result = $this->tokens->isValid($this->namespace, $this->userId, $this->token);
                expect($result)->to->equal(false);
            });
        });

        context('when token is current', function () {
            beforeEach(function () {
                \WP_Mock::wpFunction('get_user_meta', [
                    'args' => [$this->userId, '2fa_'.$this->namespace.'_temporary_token_time', true],
                    'return' => $this->now - $this->expiry,
                ]);
            });

            context('and invalid', function () {
                it('returns false', function () {
                    $result = $this->tokens->isValid($this->namespace, $this->userId, $this->wrongToken);
                    expect($result)->to->equal(false);
                });
            });

            context('and valid', function () {
                it('returns true', function () {
                    $result = $this->tokens->isValid($this->namespace, $this->userId, $this->token);
                    expect($result)->to->equal(true);
                });
            });
        });

        context('when token is not an int', function () {
            beforeEach(function () {
                \WP_Mock::wpFunction('get_user_meta', [
                    'args' => [$this->userId, '2fa_'.$this->namespace.'_temporary_token_time', true],
                    'return' => 'hello',
                ]);
            });

            it('does something', function () {
                $result = $this->tokens->isValid($this->namespace, $this->userId, $this->token);
                expect($result)->to->equal(false);
            });
        });
    });
});


text:
namespace chrono {
namespace opengl {

/// @addtogroup opengl_module
/// @{

/// Renders a wireframe view for triangles.
class CH_OPENGL_API ChOpenGLWires : public ChOpenGLObject {
  public:
    ChOpenGLWires();
    bool Initialize(const std::vector<glm::vec3>& data, ChOpenGLMaterial mat, ChOpenGLShader* shader);

    virtual void Draw(const glm::mat4& projection, const glm::mat4& view) override;
    virtual void TakeDown() override;

    void Update(const std::vector<glm::vec3>& data);
    void SetPointSize(const float& pointsize);

  private:
    typedef ChOpenGLObject super;

    std::vector<glm::vec3> vertices;
    glm::vec4 color;
    float point_size;
    GLuint color_handle;
    GLuint point_size_handle;
};

/// @} opengl_module

}
}

#endif


text:
<?php

namespace Opulence\Views\Compilers\Fortune\Lexers;

use Opulence\Views\Compilers\Fortune\Lexers\Tokens\Token;
use Opulence\Views\IView;

/**
 * Defines the interface for view lexers to implement
 */
interface ILexer
{
    /**
     * Lexes input text and returns a list of tokens
     *
     * @param IView $view The view to lex
     * @return Token[] The list of tokens
     */
    public function lex(IView $view) : array;
}


text:
package org.buffer.android.buffertextinputlayout;

public interface TextInputListener {
    void onTextChanged(String text);
}


text:
package org.apache.webapp.admin.valve;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.MessageResources;

import javax.management.MBeanServer;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.JMException;

import org.apache.webapp.admin.ApplicationServlet;
import org.apache.webapp.admin.LabelValueBean;
import org.apache.webapp.admin.Lists;
import org.apache.webapp.admin.TomcatTreeBuilder;

/**
 * A generic Action that sets up Edit
 * Valve  transactions, based on the type of Valve.
 *
 * @author Manveen Kaur
 * @version $Revision: 1.3 $ $Date: 2003/05/13 08:33:14 $
 */

public class EditValveAction extends Action {

    /**
     * The MBeanServer we will be interacting with.
     */
    private MBeanServer mBServer = null;

    /**
     * The MessageResources we will be retrieving messages from.
     */
    private MessageResources resources = null;

    private HttpSession session = null;
    private Locale locale = null;
    private String parent = null;

    // --------------------------------------------------------- Public Methods

    /**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an ActionForward instance describing where and how
     * control should be forwarded, or null if the response has
     * already been completed.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param actionForm The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     *
     * @exception IOException if an input/output error occurs
     * @exception ServletException if a servlet exception occurs
     */
    public ActionForward perform(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws IOException, ServletException {

        // Acquire the resources that we need
        session = request.getSession();
        locale = (Locale) session.getAttribute(Action.LOCALE_KEY);
        if (resources == null) {
            resources = getServlet().getResources();
        }

        // Acquire a reference to the MBeanServer containing our MBeans
        try {
            mBServer = ((ApplicationServlet) getServlet()).getServer();
        } catch (Throwable t) {
            throw new ServletException
            ("Cannot acquire MBeanServer reference", t);
        }

        // Set up the object names of the MBeans we are manipulating
        ObjectName vname = null;
        StringBuffer sb = null;
        try {
            vname = new ObjectName(request.getParameter("select"));
        } catch (Exception e) {
            String message =
                resources.getMessage("error.valveName.bad",
                                     request.getParameter("select"));
            getServlet().log(message);
            response.sendError(HttpServletResponse.SC_BAD_REQUEST, message);
            return (null);
        }

       parent = request.getParameter("parent");
       String valveType = null;
       String attribute = null;

       // Find what type of Valve this is
       try {
            attribute = "className";
            String className = (String)
                mBServer.getAttribute(vname, attribute);
            int period = className.lastIndexOf(".");
            if (period >= 0)
                valveType = className.substring(period + 1);
        } catch (Throwable t) {
          getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
            return (null);
        }

        // Forward to the appropriate valve display page
        if ("AccessLogValve".equalsIgnoreCase(valveType)) {
               setUpAccessLogValve(vname, response);
        } else if ("RemoteAddrValve".equalsIgnoreCase(valveType)) {
               setUpRemoteAddrValve(vname, response);
        } else if ("RemoteHostValve".equalsIgnoreCase(valveType)) {
                setUpRemoteHostValve(vname, response);
        } else if ("RequestDumperValve".equalsIgnoreCase(valveType)) {
               setUpRequestDumperValve(vname, response);
        } else if ("SingleSignOn".equalsIgnoreCase(valveType)) {
               setUpSingleSignOnValve(vname, response);
        }

        return (mapping.findForward(valveType));

    }

    private void setUpAccessLogValve(ObjectName vname,
                                        HttpServletResponse response)
    throws IOException {
        // Fill in the form values for display and editing
        AccessLogValveForm valveFm = new AccessLogValveForm();
        session.setAttribute("accessLogValveForm", valveFm);
        valveFm.setAdminAction("Edit");
        valveFm.setObjectName(vname.toString());
        valveFm.setParentObjectName(parent);
        String valveType = "AccessLogValve";
        StringBuffer sb = new StringBuffer("");
        String host = vname.getKeyProperty("host");
        String context = vname.getKeyProperty("path");
        if (host!=null) {
            sb.append("Host (" + host + ") > ");
        }
        if (context!=null) {
            sb.append("Context (" + context + ") > ");
        }
        sb.append("Valve");
        valveFm.setNodeLabel(sb.toString());
        valveFm.setValveType(valveType);
        valveFm.setDebugLvlVals(Lists.getDebugLevels());
        valveFm.setBooleanVals(Lists.getBooleanValues());
        String attribute = null;
        try {

            // Copy scalar properties
            attribute = "debug";
            valveFm.setDebugLvl
                (((Integer) mBServer.getAttribute(vname, attribute)).toString());
            attribute = "directory";
            valveFm.setDirectory
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "pattern";
            valveFm.setPattern
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "prefix";
            valveFm.setPrefix
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "suffix";
            valveFm.setSuffix
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "resolveHosts";
            valveFm.setResolveHosts
                (((Boolean) mBServer.getAttribute(vname, attribute)).toString());
            attribute = "rotatable";
            valveFm.setRotatable
                (((Boolean) mBServer.getAttribute(vname, attribute)).toString());

        } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
        }
    }

    private void setUpRequestDumperValve(ObjectName vname,
                                        HttpServletResponse response)
    throws IOException {
        // Fill in the form values for display and editing
        RequestDumperValveForm valveFm = new RequestDumperValveForm();
        session.setAttribute("requestDumperValveForm", valveFm);
        valveFm.setAdminAction("Edit");
        valveFm.setObjectName(vname.toString());
        valveFm.setParentObjectName(parent);
        String valveType = "RequestDumperValve";
        StringBuffer sb = new StringBuffer("Valve (");
        sb.append(valveType);
        sb.append(")");
        valveFm.setNodeLabel(sb.toString());
        valveFm.setValveType(valveType);
        valveFm.setDebugLvlVals(Lists.getDebugLevels());
        String attribute = null;
        try {

            // Copy scalar properties
            attribute = "debug";
            valveFm.setDebugLvl
                (((Integer) mBServer.getAttribute(vname, attribute)).toString());
        } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
        }
    }

    private void setUpSingleSignOnValve(ObjectName vname,
                                        HttpServletResponse response)
    throws IOException {
        // Fill in the form values for display and editing
        SingleSignOnValveForm valveFm = new SingleSignOnValveForm();
        session.setAttribute("singleSignOnValveForm", valveFm);
        valveFm.setAdminAction("Edit");
        valveFm.setObjectName(vname.toString());
        valveFm.setParentObjectName(parent);
        String valveType = "SingleSignOn";
        StringBuffer sb = new StringBuffer("Valve (");
        sb.append(valveType);
        sb.append(")");
        valveFm.setNodeLabel(sb.toString());
        valveFm.setValveType(valveType);
        valveFm.setDebugLvlVals(Lists.getDebugLevels());
        String attribute = null;
        try {

            // Copy scalar properties
            attribute = "debug";
            valveFm.setDebugLvl
                (((Integer) mBServer.getAttribute(vname, attribute)).toString());
        } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
        }
    }

    private void setUpRemoteAddrValve(ObjectName vname,
                                        HttpServletResponse response)
    throws IOException {
        // Fill in the form values for display and editing
        RemoteAddrValveForm valveFm = new RemoteAddrValveForm();
        session.setAttribute("remoteAddrValveForm", valveFm);
        valveFm.setAdminAction("Edit");
        valveFm.setObjectName(vname.toString());
        valveFm.setParentObjectName(parent);
        String valveType = "RemoteAddrValve";
        StringBuffer sb = new StringBuffer("Valve (");
        sb.append(valveType);
        sb.append(")");
        valveFm.setNodeLabel(sb.toString());
        valveFm.setValveType(valveType);
        String attribute = null;
        try {

            // Copy scalar properties
            attribute = "allow";
            valveFm.setAllow
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "deny";
            valveFm.setDeny
                ((String) mBServer.getAttribute(vname, attribute));

        } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
        }
    }

    private void setUpRemoteHostValve(ObjectName vname,
                                        HttpServletResponse response)
    throws IOException {
        // Fill in the form values for display and editing
        RemoteHostValveForm valveFm = new RemoteHostValveForm();
        session.setAttribute("remoteHostValveForm", valveFm);
        valveFm.setAdminAction("Edit");
        valveFm.setObjectName(vname.toString());
        valveFm.setParentObjectName(parent);
        String valveType = "RemoteHostValve";
        StringBuffer sb = new StringBuffer("Valve (");
        sb.append(valveType);
        sb.append(")");
        valveFm.setNodeLabel(sb.toString());
        valveFm.setValveType(valveType);
        String attribute = null;
        try {

            // Copy scalar properties
            attribute = "allow";
            valveFm.setAllow
                ((String) mBServer.getAttribute(vname, attribute));
            attribute = "deny";
            valveFm.setDeny
                ((String) mBServer.getAttribute(vname, attribute));

        } catch (Throwable t) {
            getServlet().log
                (resources.getMessage(locale, "users.error.attribute.get",
                                      attribute), t);
            response.sendError
                (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                 resources.getMessage(locale, "users.error.attribute.get",
                                      attribute));
        }
    }

}


text:
static const CGFloat BUTTON_WIDTH   = 48.0f;
static const CGFloat BUTTON_HEIGHT  = 30.0;
static const CGFloat ICON_WIDTH     = 18.0f;
static const CGFloat FONT_SIZE      = 17.0f;

#define BOLD_FONT   [UIFont fontWithName:@"AvenirNextCondensed-DemiBold" size:FONT_SIZE]
#define NORMAL_FONT [UIFont fontWithName:@"AvenirNextCondensed-Medium" size:FONT_SIZE]

#define LEFT_SHRINK     CGRectMake(ICON_WIDTH, self.midY, 0.f, BUTTON_HEIGHT)
#define RIGHT_SHRINK    CGRectMake(ICON_WIDTH + BUTTON_WIDTH, 0, 0.f, BUTTON_HEIGHT)
#define MIDDLE_EXPANDED CGRectMake(ICON_WIDTH, self.midY, BUTTON_WIDTH, BUTTON_HEIGHT)

@interface THFlashControl ()

@property (nonatomic) BOOL expanded;
@property (nonatomic) CGFloat defaultWidth;
@property (nonatomic) CGFloat expandedWidth;
@property (nonatomic) NSUInteger selectedIndex;
@property (nonatomic) CGFloat midY;

@property (strong, nonatomic) NSArray *labels;

@end

@implementation THFlashControl

- (id)initWithFrame:(CGRect)frame {
	self = [super initWithFrame:CGRectMake(0.0f, 0.0f, ICON_WIDTH + BUTTON_WIDTH, BUTTON_HEIGHT)];
	if (self) {
        [self setupView];
	}
	return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupView];
}

- (void)setupView {
    self.backgroundColor = [UIColor clearColor];
    UIImage *iconImage = [UIImage imageNamed:@"flash_icon"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:iconImage];
    imageView.frameY = (self.frameHeight - imageView.frameHeight) / 2;
    [self addSubview:imageView];
    _midY = floorf(self.frameWidth - BUTTON_HEIGHT) / 2.0f;
    _labels = [self buildLabels:@[@"Auto", @"On", @"Off"]];

    _defaultWidth = self.frameWidth;
    _expandedWidth = ICON_WIDTH + (BUTTON_WIDTH * self.labels.count);
    self.clipsToBounds = YES;

    [self addTarget:self action:@selector(selectMode:forEvent:) forControlEvents:UIControlEventTouchUpInside];
}

- (NSArray *)buildLabels:(NSArray *)labelStrings {
	CGFloat x = ICON_WIDTH;
    BOOL first = YES;
	NSMutableArray *labels = [NSMutableArray array];
	for (NSString *string in labelStrings) {
		CGRect frame = CGRectMake(x, self.midY, BUTTON_WIDTH, BUTTON_HEIGHT);
		UILabel *label = [[UILabel alloc] initWithFrame:frame];
		label.text = string;
		label.font = NORMAL_FONT;
		label.textColor = [UIColor whiteColor];
		label.backgroundColor = [UIColor clearColor];
        label.textAlignment = first ? NSTextAlignmentLeft : NSTextAlignmentCenter;
        first = NO;
		[self addSubview:label];
		[labels addObject:label];
		x += BUTTON_WIDTH;
	}
    return labels;
}

- (void)selectMode:(id)sender forEvent:(UIEvent *)event {

	if (!self.expanded) {
		[self performDelegateSelectorIfSupported:@selector(flashControlWillExpand)];
		[UIView animateWithDuration:0.3 animations:^{
            self.frameWidth = self.expandedWidth;
            for (NSUInteger i = 0; i < self.labels.count; i++) {
                UILabel *label = self.labels[i];
                label.font = (i == self.selectedIndex) ? BOLD_FONT : NORMAL_FONT;
                label.frame = CGRectMake(ICON_WIDTH + (i * BUTTON_WIDTH), self.midY, BUTTON_WIDTH, BUTTON_HEIGHT);
                if (i > 0) {
                    label.textAlignment = NSTextAlignmentCenter;
                }
            }
        } completion:^(BOOL finished) {
			[self performDelegateSelectorIfSupported:@selector(flashControlDidExpand)];
		}];
	} else {

		[self performDelegateSelectorIfSupported:@selector(flashControlWillCollapse)];

		UITouch *touch = [[event allTouches] anyObject];
        for (NSUInteger i = 0; i < self.labels.count; i++) {

            UILabel *label = self.labels[i];
			CGPoint touchPoint = [touch locationInView:label];

            if ([label pointInside:touchPoint withEvent:event]) {

                self.selectedIndex = i;
                label.textAlignment = NSTextAlignmentLeft;

                [UIView animateWithDuration:0.2 animations:^{
                    for (NSUInteger i = 0; i < self.labels.count; i++) {
                        UILabel *label = self.labels[i];
                        if (i < self.selectedIndex) {
                            label.frame = LEFT_SHRINK;
                        } else if (i > self.selectedIndex) {
                            label.frame = RIGHT_SHRINK;
                        } else if (i == self.selectedIndex) {
                            label.frame = MIDDLE_EXPANDED;
                        }
                    }
                    self.frameWidth = self.defaultWidth;
                } completion:^(BOOL finished) {
					[self performDelegateSelectorIfSupported:@selector(flashControlDidCollapse)];
				}];
                break;
            }
        }
	}
    self.expanded = !self.expanded;
}

- (void)performDelegateSelectorIfSupported:(SEL)sel {
	if ([self.delegate respondsToSelector:sel]) {
		[self.delegate performSelector:sel withObject:nil];
	}
}

- (void)setSelectedIndex:(NSUInteger)selectedIndex {
    _selectedIndex = selectedIndex;

    // Remap to fit enum values
    NSInteger mode = selectedIndex;
    if (selectedIndex == 0) {
        mode = 2;
    } else if (selectedIndex == 2) {
        mode = 0;
    }
    self.selectedMode = mode;
}

- (void)setSelectedMode:(NSInteger)selectedMode {
	if (_selectedMode != selectedMode) {
		_selectedMode = selectedMode;
		[self sendActionsForControlEvents:UIControlEventValueChanged];
	}
}

@end


text:
<?php

class DatabaseSeeder extends Seeder {

	/**
	 * Run the database seeds.
	 *
	 * @return void
	 */
	public function run()
	{
		Eloquent::unguard();

		$this->call('UsersTableSeeder');
		$this->call('ItemsTableSeeder');
		$this->call('ListsTableSeeder');
		$this->call('SubItemsTableSeeder');
		$this->call('UserListsTableSeeder');
	}

}


text:
/**
 * Created by cwasser on 13.04.16.
 */
    'use strict';
window.jQuery = require('jquery');
window.$ = window.jQuery;
require('../../../../node_modules/jquery.spa/src/jquery.spa.js');

$(function(){
    'use strict';
    // ------------ VARIABLES ----------------------------
    var rootCallback,

        booksRoute = '/books', rootRoute = '/',

        BooksView = require('./components/booksView'),
        CartView = require('./components/cartView');

    // ------------ CONFIGURATION ------------------------
    $.spa.configModule({
        historyConfig : {
            useHistoryApi : true
        },
        dataConfig : {
            serverUrl : 'http://localhost:8000/app_dev.php/api/v1'
        },
        routerConfig : {}
    });

    rootCallback = function(){
        $.spa.navigate(booksRoute);
    };

    $.spa.addRoute(
        rootRoute,
        rootCallback,
        {
            isResource : false,
            httpMethod : 'GET'
        }
    );

    BooksView.init();
    CartView.init();
    $.spa.getResource(booksRoute);

    // ------------ FUNCTIONS ----------------------------

});


text:
namespace Google.Cloud.Dialogflow.V2.Snippets
{
    // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async_flattened_resourceNames]
    using Google.Cloud.Dialogflow.V2;
    using Google.LongRunning;
    using Google.Protobuf.WellKnownTypes;
    using System.Collections.Generic;
    using System.Threading.Tasks;

    public sealed partial class GeneratedEntityTypesClientSnippets
    {
        /// <summary>Snippet for BatchDeleteEntityTypesAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task BatchDeleteEntityTypesResourceNamesAsync()
        {
            // Create client
            EntityTypesClient entityTypesClient = await EntityTypesClient.CreateAsync();
            // Initialize request argument(s)
            AgentName parent = AgentName.FromProject("[PROJECT]");
            IEnumerable<string> entityTypeNames = new string[] { "", };
            // Make the request
            Operation<Empty, Struct> response = await entityTypesClient.BatchDeleteEntityTypesAsync(parent, entityTypeNames);

            // Poll until the returned long-running operation is complete
            Operation<Empty, Struct> completedResponse = await response.PollUntilCompletedAsync();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation<Empty, Struct> retrievedResponse = await entityTypesClient.PollOnceBatchDeleteEntityTypesAsync(operationName);
            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
    }
    // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async_flattened_resourceNames]
}


text:
package yamlexporter

import (
	"bufio"
	"io/ioutil"
	"os"
	"path/filepath"

	"github.com/ghodss/yaml"
	"github.com/pkg/errors"
	"github.com/pravega/zookeeper-operator/api/v1beta1"
)

// YAMLOutputDir where the zookeeper YAML resources will get generated
var YAMLOutputDir string

// CreateOutputSubDir creates a subdirectories where we want create the YAML file
func CreateOutputSubDir(clusterName string, compName string) (string, error) {
	fpath := filepath.Join(clusterName, compName)
	return fpath, createDirIfNotExist(fpath)
}

// GenerateOutputYAMLFile writes YAML output for a resource
func GenerateOutputYAMLFile(subdir string, depType string, data interface{}) error {
	filename := filepath.Join(subdir, depType+"."+"yaml")
	fileFd, err := os.Create(filename)
	if err != nil {
		return err
	}
	defer func() {
		_ = fileFd.Close()
	}()
	yamlWriter := bufio.NewWriter(fileFd)
	defer yamlWriter.Flush()
	yamlData, err := yaml.Marshal(data)
	if err != nil {
		return err
	}
	n, err := yamlWriter.Write(yamlData)
	if err != nil {
		return errors.Wrapf(err, "write failed total bytes written:%d", n)
	}
	return nil
}

func createDirIfNotExist(dir string) error {
	if _, err := os.Stat(dir); os.IsNotExist(err) {
		err = os.MkdirAll(dir, 0755)
		if err != nil {
			return err
		}
	}
	return nil
}

// CreateYAMLOutputDir create output directory for YAML output
func CreateYAMLOutputDir(maindir string) error {
	err := createDirIfNotExist(maindir)
	if err != nil {
		return err
	}
	return nil
}

// ReadInputClusterYAMLFile will read input YAML file and returns Go struct for ZookeeperCluster
func ReadInputClusterYAMLFile(inyamlfile string) (*v1beta1.ZookeeperCluster, error) {
	if _, err := os.Stat(inyamlfile); os.IsNotExist(err) {
		return nil, err
	}
	var z v1beta1.ZookeeperCluster
	source, err := ioutil.ReadFile(inyamlfile)
	if err != nil {
		return nil, err
	}
	err = yaml.Unmarshal(source, &z)
	if err != nil {
		return nil, err
	}
	return &z, err
}


text:
layout: post
title:  Oracle Learn-02-MetaData 元数据管理
date:  2018-04-22 19:00:57 +0800
categories: [SQL]
tags: [sql, oracle, learn]
published: true
---

# oracle 的元数据

有时候我们希望获取对应表的数据表结构信息。

整理 sql 如下:

```sql
select cols.table_name 表名, cols.column_name 列名, cols.data_type 字段类型, cols.data_length 长度, cols.nullable 是否为空, cols.data_default 默认值, comm.comments 备注 from user_tab_cols cols
left join user_col_comments comm on cols.table_name = comm.table_name and cols.column_name = comm.column_name
where cols.table_name in (select distinct table_name from user_tab_cols)  and  cols.column_id is not null order by cols.table_name, segment_column_id;
```

* any list
{:toc}


text:
/*
 * KeyMappings.cpp
 *
 *  Created on: Oct 9, 2014
 *      Author: Dean.Sands
 */

#include "KeyMappings.h"

namespace enDJIN {

KeyMappings::KeyMappings() {
	actionEffectMap=new std::unordered_map<std::string,TCallBack>();

}

KeyMappings::~KeyMappings() {
	keyActionMap.clear();
	keyEffectMap.clear();
}

bool KeyMappings::map_key(sf::Keyboard::Key keyPressed, std::string newEventName){
	keyActionMap[(unsigned int)keyPressed]=newEventName;
	try{
		TCallBack thisFunction=(*actionEffectMap)[newEventName];
		keyEffectMap[(unsigned int)keyPressed]=thisFunction;
	}catch(std::exception &e){

		return false;
	}
	return true;
}
TCallBack KeyMappings::callbackFromKey(unsigned int key){
	std::string eventName=keyActionMap[key];
	TCallBack thisFunction=(*actionEffectMap)[eventName];
	return thisFunction;
}

} /* namespace enDJIN */


text:
#include <stdarg.h>

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/user.h>
#include <linux/delay.h>
#include <linux/reboot.h>
#include <linux/interrupt.h>
#include <linux/kallsyms.h>
#include <linux/init.h>
#include <linux/cpu.h>
#include <linux/elfcore.h>
#include <linux/pm.h>
#include <linux/tick.h>
#include <linux/utsname.h>
#include <linux/uaccess.h>
#include <linux/random.h>
#include <linux/hw_breakpoint.h>
#include <linux/console.h>
#include <linux/cpuidle.h>

#include <asm/cacheflush.h>
#include <asm/processor.h>
#include <asm/system.h>
#include <asm/thread_notify.h>
#include <asm/stacktrace.h>
#include <asm/mach/time.h>

#ifdef CONFIG_CC_STACKPROTECTOR
#include <linux/stackprotector.h>
unsigned long __stack_chk_guard __read_mostly;
EXPORT_SYMBOL(__stack_chk_guard);
#endif

static const char *processor_modes[] = {
  "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" ,
  "UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26",
  "USER_32", "FIQ_32" , "IRQ_32" , "SVC_32" , "UK4_32" , "UK5_32" , "UK6_32" , "ABT_32" ,
  "UK8_32" , "UK9_32" , "UK10_32", "UND_32" , "UK12_32", "UK13_32", "UK14_32", "SYS_32"
};

static const char *isa_modes[] = {
  "ARM" , "Thumb" , "Jazelle", "ThumbEE"
};

extern void setup_mm_for_reboot(char mode);

static volatile int hlt_counter;

#include <mach/system.h>

#ifdef CONFIG_SMP
void arch_trigger_all_cpu_backtrace(void)
{
	smp_send_all_cpu_backtrace();
}
#else
void arch_trigger_all_cpu_backtrace(void)
{
	dump_stack();
}
#endif

void disable_hlt(void)
{
	hlt_counter++;
}

EXPORT_SYMBOL(disable_hlt);

void enable_hlt(void)
{
	hlt_counter--;
}

EXPORT_SYMBOL(enable_hlt);

static int __init nohlt_setup(char *__unused)
{
	hlt_counter = 1;
	return 1;
}

static int __init hlt_setup(char *__unused)
{
	hlt_counter = 0;
	return 1;
}

__setup("nohlt", nohlt_setup);
__setup("hlt", hlt_setup);

#ifdef CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART
void arm_machine_flush_console(void)
{
	printk("\n");
	pr_emerg("Restarting %s\n", linux_banner);
	if (console_trylock()) {
		console_unlock();
		return;
	}

	mdelay(50);

	local_irq_disable();
	if (!console_trylock())
		pr_emerg("arm_restart: Console was locked! Busting\n");
	else
		pr_emerg("arm_restart: Console was locked!\n");
	console_unlock();
}
#else
void arm_machine_flush_console(void)
{
}
#endif

void arm_machine_restart(char mode, const char *cmd)
{
	/* Flush the console to make sure all the relevant messages make it
	 * out to the console drivers */
	arm_machine_flush_console();

	/* Disable interrupts first */
	local_irq_disable();
	local_fiq_disable();

	/*
	 * Tell the mm system that we are going to reboot -
	 * we may need it to insert some 1:1 mappings so that
	 * soft boot works.
	 */
	setup_mm_for_reboot(mode);

	/* Clean and invalidate caches */
	flush_cache_all();

	/* Turn off caching */
	cpu_proc_fin();

	/* Push out any further dirty data, and ensure cache is empty */
	flush_cache_all();

	/*
	 * Now call the architecture specific reboot code.
	 */
	arch_reset(mode, cmd);

	/*
	 * Whoops - the architecture was unable to reboot.
	 * Tell the user!
	 */
	mdelay(1000);
	printk("Reboot failed -- System halted\n");
	while (1);
}

/*
 * Function pointers to optional machine specific functions
 */
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);

void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);

static void do_nothing(void *unused)
{
}

/*
 * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
 * pm_idle and update to new pm_idle value. Required while changing pm_idle
 * handler on SMP systems.
 *
 * Caller must have changed pm_idle to the new value before the call. Old
 * pm_idle value will not be used by any CPU after the return of this function.
 */
void cpu_idle_wait(void)
{
	smp_mb();
	/* kick all the CPUs so that they exit out of pm_idle */
	smp_call_function(do_nothing, NULL, 1);
}
EXPORT_SYMBOL_GPL(cpu_idle_wait);

/*
 * This is our default idle handler.  We need to disable
 * interrupts here to ensure we don't miss a wakeup call.
 */
static void default_idle(void)
{
	if (!need_resched())
		arch_idle();
	local_irq_enable();
}

void (*pm_idle)(void) = default_idle;
EXPORT_SYMBOL(pm_idle);

/*
 * The idle thread, has rather strange semantics for calling pm_idle,
 * but this is what x86 does and we need to do the same, so that
 * things like cpuidle get called in the same way.  The only difference
 * is that we always respect 'hlt_counter' to prevent low power idle.
 */
void cpu_idle(void)
{
	local_fiq_enable();

	/* endless idle loop with no priority at all */
	while (1) {
		idle_notifier_call_chain(IDLE_START);
		tick_nohz_stop_sched_tick(1);
		while (!need_resched()) {
#ifdef CONFIG_HOTPLUG_CPU
			if (cpu_is_offline(smp_processor_id()))
				cpu_die();
#endif

			local_irq_disable();
#ifdef CONFIG_PL310_ERRATA_769419
			wmb();
#endif
			if (hlt_counter) {
				local_irq_enable();
				cpu_relax();
			} else {
				stop_critical_timings();
				if (cpuidle_idle_call())
					pm_idle();
				start_critical_timings();
				/*
				 * This will eventually be removed - pm_idle
				 * functions should always return with IRQs
				 * enabled.
				 */
				WARN_ON(irqs_disabled());
				local_irq_enable();
			}
		}
		tick_nohz_restart_sched_tick();
		idle_notifier_call_chain(IDLE_END);
		preempt_enable_no_resched();
		schedule();
		preempt_disable();
	}
}

static char reboot_mode = 'h';

int __init reboot_setup(char *str)
{
	reboot_mode = str[0];
	return 1;
}

__setup("reboot=", reboot_setup);

void machine_shutdown(void)
{
#ifdef CONFIG_SMP
	smp_send_stop();
#endif
}

void machine_halt(void)
{
	machine_shutdown();
	while (1);
}

void machine_power_off(void)
{
	machine_shutdown();
	if (pm_power_off)
		pm_power_off();
}

void machine_restart(char *cmd)
{
	machine_shutdown();
	arm_pm_restart(reboot_mode, cmd);
}

/*
 * dump a block of kernel memory from around the given address
 */
static void show_data(unsigned long addr, int nbytes, const char *name)
{
	int	i, j;
	int	nlines;
	u32	*p;

	/*
	 * don't attempt to dump non-kernel addresses or
	 * values that are probably just small negative numbers
	 */
	if (addr < PAGE_OFFSET || addr > -256UL)
		return;

	printk("\n%s: %#lx:\n", name, addr);

	/*
	 * round address down to a 32 bit boundary
	 * and always dump a multiple of 32 bytes
	 */
	p = (u32 *)(addr & ~(sizeof(u32) - 1));
	nbytes += (addr & (sizeof(u32) - 1));
	nlines = (nbytes + 31) / 32;

	for (i = 0; i < nlines; i++) {
		/*
		 * just display low 16 bits of address to keep
		 * each line of the dump < 80 characters
		 */
		printk("%04lx ", (unsigned long)p & 0xffff);
		for (j = 0; j < 8; j++) {
			u32	data;
			if (probe_kernel_address(p, data)) {
				printk(" ********");
			} else {
				printk(" %08x", data);
			}
			++p;
		}
		printk("\n");
	}
}

static void show_extra_register_data(struct pt_regs *regs, int nbytes)
{
	mm_segment_t fs;

	fs = get_fs();
	set_fs(KERNEL_DS);
	show_data(regs->ARM_pc - nbytes, nbytes * 2, "PC");
	show_data(regs->ARM_lr - nbytes, nbytes * 2, "LR");
	show_data(regs->ARM_sp - nbytes, nbytes * 2, "SP");
	show_data(regs->ARM_ip - nbytes, nbytes * 2, "IP");
	show_data(regs->ARM_fp - nbytes, nbytes * 2, "FP");
	show_data(regs->ARM_r0 - nbytes, nbytes * 2, "R0");
	show_data(regs->ARM_r1 - nbytes, nbytes * 2, "R1");
	show_data(regs->ARM_r2 - nbytes, nbytes * 2, "R2");
	show_data(regs->ARM_r3 - nbytes, nbytes * 2, "R3");
	show_data(regs->ARM_r4 - nbytes, nbytes * 2, "R4");
	show_data(regs->ARM_r5 - nbytes, nbytes * 2, "R5");
	show_data(regs->ARM_r6 - nbytes, nbytes * 2, "R6");
	show_data(regs->ARM_r7 - nbytes, nbytes * 2, "R7");
	show_data(regs->ARM_r8 - nbytes, nbytes * 2, "R8");
	show_data(regs->ARM_r9 - nbytes, nbytes * 2, "R9");
	show_data(regs->ARM_r10 - nbytes, nbytes * 2, "R10");
	set_fs(fs);
}

void __show_regs(struct pt_regs *regs)
{
	unsigned long flags;
	char buf[64];

	printk("CPU: %d    %s  (%s %.*s)\n",
		raw_smp_processor_id(), print_tainted(),
		init_utsname()->release,
		(int)strcspn(init_utsname()->version, " "),
		init_utsname()->version);
	print_symbol("PC is at %s\n", instruction_pointer(regs));
	print_symbol("LR is at %s\n", regs->ARM_lr);
	printk("pc : [<%08lx>]    lr : [<%08lx>]    psr: %08lx\n"
	       "sp : %08lx  ip : %08lx  fp : %08lx\n",
		regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr,
		regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
	printk("r10: %08lx  r9 : %08lx  r8 : %08lx\n",
		regs->ARM_r10, regs->ARM_r9,
		regs->ARM_r8);
	printk("r7 : %08lx  r6 : %08lx  r5 : %08lx  r4 : %08lx\n",
		regs->ARM_r7, regs->ARM_r6,
		regs->ARM_r5, regs->ARM_r4);
	printk("r3 : %08lx  r2 : %08lx  r1 : %08lx  r0 : %08lx\n",
		regs->ARM_r3, regs->ARM_r2,
		regs->ARM_r1, regs->ARM_r0);

	flags = regs->ARM_cpsr;
	buf[0] = flags & PSR_N_BIT ? 'N' : 'n';
	buf[1] = flags & PSR_Z_BIT ? 'Z' : 'z';
	buf[2] = flags & PSR_C_BIT ? 'C' : 'c';
	buf[3] = flags & PSR_V_BIT ? 'V' : 'v';
	buf[4] = '\0';

	printk("Flags: %s  IRQs o%s  FIQs o%s  Mode %s  ISA %s  Segment %s\n",
		buf, interrupts_enabled(regs) ? "n" : "ff",
		fast_interrupts_enabled(regs) ? "n" : "ff",
		processor_modes[processor_mode(regs)],
		isa_modes[isa_mode(regs)],
		get_fs() == get_ds() ? "kernel" : "user");
#ifdef CONFIG_CPU_CP15
	{
		unsigned int ctrl;

		buf[0] = '\0';
#ifdef CONFIG_CPU_CP15_MMU
		{
			unsigned int transbase, dac;
			asm("mrc p15, 0, %0, c2, c0\n\t"
			    "mrc p15, 0, %1, c3, c0\n"
			    : "=r" (transbase), "=r" (dac));
			snprintf(buf, sizeof(buf), "  Table: %08x  DAC: %08x",
			  	transbase, dac);
		}
#endif
		asm("mrc p15, 0, %0, c1, c0\n" : "=r" (ctrl));

		printk("Control: %08x%s\n", ctrl, buf);
	}
#endif

	show_extra_register_data(regs, 128);
}

void show_regs(struct pt_regs * regs)
{
	printk("\n");
	printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
	__show_regs(regs);
	__backtrace();
}

ATOMIC_NOTIFIER_HEAD(thread_notify_head);

EXPORT_SYMBOL_GPL(thread_notify_head);

/*
 * Free current thread data structures etc..
 */
void exit_thread(void)
{
	thread_notify(THREAD_NOTIFY_EXIT, current_thread_info());
}

void flush_thread(void)
{
	struct thread_info *thread = current_thread_info();
	struct task_struct *tsk = current;

	flush_ptrace_hw_breakpoint(tsk);

	memset(thread->used_cp, 0, sizeof(thread->used_cp));
	memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
	memset(&thread->fpstate, 0, sizeof(union fp_state));

	thread_notify(THREAD_NOTIFY_FLUSH, thread);
}

void release_thread(struct task_struct *dead_task)
{
}

asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");

int
copy_thread(unsigned long clone_flags, unsigned long stack_start,
	    unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs)
{
	struct thread_info *thread = task_thread_info(p);
	struct pt_regs *childregs = task_pt_regs(p);

	*childregs = *regs;
	childregs->ARM_r0 = 0;
	childregs->ARM_sp = stack_start;

	memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
	thread->cpu_context.sp = (unsigned long)childregs;
	thread->cpu_context.pc = (unsigned long)ret_from_fork;

	clear_ptrace_hw_breakpoint(p);

	if (clone_flags & CLONE_SETTLS)
		thread->tp_value = regs->ARM_r3;

	thread_notify(THREAD_NOTIFY_COPY, thread);

	return 0;
}

/*
 * Fill in the task's elfregs structure for a core dump.
 */
int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)
{
	elf_core_copy_regs(elfregs, task_pt_regs(t));
	return 1;
}

/*
 * fill in the fpe structure for a core dump...
 */
int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
{
	struct thread_info *thread = current_thread_info();
	int used_math = thread->used_cp[1] | thread->used_cp[2];

	if (used_math)
		memcpy(fp, &thread->fpstate.soft, sizeof (*fp));

	return used_math != 0;
}
EXPORT_SYMBOL(dump_fpu);

/*
 * Shuffle the argument into the correct register before calling the
 * thread function.  r4 is the thread argument, r5 is the pointer to
 * the thread function, and r6 points to the exit function.
 */
extern void kernel_thread_helper(void);
asm(	".pushsection .text\n"
"	.align\n"
"	.type	kernel_thread_helper, #function\n"
"kernel_thread_helper:\n"
#ifdef CONFIG_TRACE_IRQFLAGS
"	bl	trace_hardirqs_on\n"
#endif
"	msr	cpsr_c, r7\n"
"	mov	r0, r4\n"
"	mov	lr, r6\n"
"	mov	pc, r5\n"
"	.size	kernel_thread_helper, . - kernel_thread_helper\n"
"	.popsection");

#ifdef CONFIG_ARM_UNWIND
extern void kernel_thread_exit(long code);
asm(	".pushsection .text\n"
"	.align\n"
"	.type	kernel_thread_exit, #function\n"
"kernel_thread_exit:\n"
"	.fnstart\n"
"	.cantunwind\n"
"	bl	do_exit\n"
"	nop\n"
"	.fnend\n"
"	.size	kernel_thread_exit, . - kernel_thread_exit\n"
"	.popsection");
#else
#define kernel_thread_exit	do_exit
#endif

/*
 * Create a kernel thread.
 */
pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
{
	struct pt_regs regs;

	memset(&regs, 0, sizeof(regs));

	regs.ARM_r4 = (unsigned long)arg;
	regs.ARM_r5 = (unsigned long)fn;
	regs.ARM_r6 = (unsigned long)kernel_thread_exit;
	regs.ARM_r7 = SVC_MODE | PSR_ENDSTATE | PSR_ISETSTATE;
	regs.ARM_pc = (unsigned long)kernel_thread_helper;
	regs.ARM_cpsr = regs.ARM_r7 | PSR_I_BIT;

	return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
}
EXPORT_SYMBOL(kernel_thread);

unsigned long get_wchan(struct task_struct *p)
{
	struct stackframe frame;
	int count = 0;
	if (!p || p == current || p->state == TASK_RUNNING)
		return 0;

	frame.fp = thread_saved_fp(p);
	frame.sp = thread_saved_sp(p);
	frame.lr = 0;			/* recovered from the stack */
	frame.pc = thread_saved_pc(p);
	do {
		int ret = unwind_frame(&frame);
		if (ret < 0)
			return 0;
		if (!in_sched_functions(frame.pc))
			return frame.pc;
	} while (count ++ < 16);
	return 0;
}

unsigned long arch_randomize_brk(struct mm_struct *mm)
{
	unsigned long range_end = mm->brk + 0x02000000;
	return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
}

#ifdef CONFIG_MMU
/*
 * The vectors page is always readable from user space for the
 * atomic helpers and the signal restart code.  Let's declare a mapping
 * for it so it is visible through ptrace and /proc/<pid>/mem.
 */

int vectors_user_mapping(void)
{
	struct mm_struct *mm = current->mm;
	return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
				       VM_READ | VM_EXEC |
				       VM_MAYREAD | VM_MAYEXEC |
				       VM_ALWAYSDUMP | VM_RESERVED,
				       NULL);
}

const char *arch_vma_name(struct vm_area_struct *vma)
{
	return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL;
}
#endif


text:
/*
 * MP2TS.cpp
 *
 *  Created on: Jul 12, 2015
 *      Author: lmartel
 */

#include <string>
#include <vector>

#include "MP2TS.hpp"

// CRC32 lookup table for polynomial 0x04c11db7
/// ---------------------------------------------------------------------------------------
static uint32_t crc_table[256] = {
    0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
    0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
    0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
    0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
    0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
    0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
    0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
    0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
    0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
    0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
    0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
    0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
    0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4,
    0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
    0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
    0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
    0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
    0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
    0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
    0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
    0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
    0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
    0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
    0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
    0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
    0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff,
    0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
    0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
    0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
    0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
    0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
    0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
    0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
    0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
    0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
    0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec,
    0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
    0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
    0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
    0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
    0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
    0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
    0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4};

uint32_t crc32(char *data, int len) {
  int i;
  uint32_t crc = 0xffffffff;

  for (i = 0; i < len; i++)
    crc = (crc << 8) ^ crc_table[((crc >> 24) ^ *data++) & 0xff];

  return crc;
}
/// ---------------------------------------------------------------------------------------

namespace MP2TS {

// MPEG-2 TS Multiplexer
// -----------------------------------------------------------------------------------------
Mux::Mux(std::string filename) : BinaryOutFile(filename) {}

bool Mux::Put(PES_Packet *packet) {
  bool rval = true;

  // Build a series of TS packets
  uint32_t bytes_left = packet->mSize;
  uint32_t pid = packet->mPID;
  do {
  } while (bytes_left);

  return rval;
}

bool Mux::BuildPMT(PES_Packet *packet) {
  bool rval = true;

  return rval;
}

bool Mux::BuildPAT(PES_Packet *packet) {
  bool rval = true;

  return rval;
}

bool Mux::AddChannel(uint32_t channel_number, uint32_t pmt_pid) {
  bool rval = true;

  // Add the channel to the data structures
  mPMTPIDtoChannelNumber[pmt_pid] = channel_number;
  mChannelMap[channel_number] = Channel(pmt_pid);

  return rval;
}

bool Mux::AddStreamToChannel(uint32_t channel_number, uint32_t pid,
                             uint32_t stream_type) {
  bool rval = true;

  if (IsAChannel(channel_number)) {
    mChannelMap[channel_number].mStreams.push_back(Stream(stream_type, pid));
  } else {
    rval = false;
  }

  return rval;
}

bool Mux::IsAChannel(uint32_t channel_number) {
  return !(mChannelMap.find(channel_number) == mChannelMap.end());
}

// MPEG-2 TS Demultiplexer Main Class
// -----------------------------------------------------------------------------------------

Demux::Demux(std::string filename)
    : BinaryInFile(filename),
      mVerbose(true),
      mOutputPacket(false),
      mOutputTSPacket(false),
      mCurrentPointer(0),
      mError(ErrorCode::NONE),
      mEOF(false),
      mNumberOfTSPackets(0),
      mIsPATParsed(false) {}

Demux::Demux(std::vector<uint8_t> &data)
    : BinaryInFile(data),
      mVerbose(true),
      mOutputPacket(false),
      mOutputTSPacket(false),
      mCurrentPointer(0),
      mError(ErrorCode::NONE),
      mEOF(false),
      mNumberOfTSPackets(0),
      mIsPATParsed(false) {}

Demux::~Demux() {
  // Cleaning unused or unreturned packets
  for (auto packet : mPESPacketsMap) {
    delete packet.second;
  }
}

bool Demux::Get(PES_Packet *&returned_packet) {
  bool rval = true;

  // PES Write Pointer
  uint32_t temp;
  returned_packet = (PES_Packet *)0;

  // TODO :: This doesn't work at all. Actually, it's a bug
  //         Need to implement a proper sychronization method
  // -------------------------------------------------------------------------
  // Find first TS packet with Start Indicator = 1
  // while ((mData[0] == 0x47) && !(mData[1] & 0x40)) {
  //   // Skip to next packet
  //   mData += TS_PACKET_LENGTH;
  // }
  // -------------------------------------------------------------------------

  // Keep track of the number of TS packets per PES packet
  mNumberOfTSPacketsPerPESPacket = 0;

  bool packet_complete = false;
  mAdaptationFieldWasPresent = false;
  do {
    // Advance to the first sync byte 0x47
    uint32_t bytes_skipped = 0;
    while (((mSize - mCurrentPointer) > 0) &&
           (mData[mCurrentPointer] != 0x47)) {
      mCurrentPointer++;
      bytes_skipped++;
    }
    if (mVerbose) {
      if (bytes_skipped > 0) {
        std::cout << "Skipped " << bytes_skipped << " bytes. " << std::endl;
      }
    }

    uint32_t start_pointer = mCurrentPointer;
    // If there is enough room fo ran extra TS packet
    // PS packet size = 188 bytes
    if ((mSize - mCurrentPointer) >= TS_PACKET_LENGTH) {
      if (mData[mCurrentPointer++] == 0x47) {
        // Output the content of the entire TS packet
        if (mOutputTSPacket) {
          std::cout << "TS packet #" << mNumberOfTSPackets << std::endl;
          outputHex(&(mData[mCurrentPointer - 1]), 188);
        }
        // Parsing The Tansport Stream Header (First 32 bits)
        // -----------------------------------------------------------------
        // Read PID
        temp = ((mData[mCurrentPointer]) << 8) | mData[mCurrentPointer + 1];
        mPID = temp & 0x1fff;
        mTEI = temp & 0x8000;
        mPayloadUnitStartIndicator = temp & 0x4000;
        mTransportPriority = temp & 0x2000;
        mCurrentPointer += 2;

        // Next 8 bits
        temp = mData[mCurrentPointer++];
        mScramblingControl = (temp & 0xC0) >> 6;
        mAdaptationFieldExist =
            (temp & 0x20) >> 5;                 // Adaptation field control msb
        mContainsPayload = (temp & 0x10) >> 4;  // Adaptation field control lsb
        mContinuityCounter = (temp & 0x0f);

        // For debugging only
        // if ((mNumberOfTSPackets == 113)) {
        //  std::cout << "Found the broken packet" << std::endl;
        // }
        if (mVerbose) {
          std::cout << mPID << " @  TS Packet " << mNumberOfTSPackets
                    << std::endl;
        }
        // If Present - Parse the Adaptation Field
        // ----------------------------------------------------------------
        if (mAdaptationFieldExist) {
          mAdaptationFieldWasPresent = true;

          // In a TS packet the adaptation field may or may not be present.
          // When it is present, the first byte is the length of the
          // adaptation field in bytes following the length. Well, encoders
          // use adaptation field length = 0, to insert 1 single byte of
          // stuffing. It's a thing
          // You have to guard against that
          // So the size will always be checked against within
          // ParseAdaptationField()
          mAdaptationFieldLength = mData[mCurrentPointer++];

          if (mAdaptationFieldLength > TS_PACKET_LENGTH - (4 + 1)) {
            if (mVerbose) {
              std::cout << "Found adaptation field of illegal length"
                        << std::endl;
              std::cout << "Reducing the length to 0 to prevent any issues"
                        << std::endl;
            }
            mAdaptationFieldLength = 0;
          }

          if (mVerbose) {
            std::cout << "Found adaptation field of length "
                      << mAdaptationFieldLength << " bytes" << std::endl;
          }

          // Parse the adaptation field
          ParseAdaptationField(&(mData[mCurrentPointer]),
                               mAdaptationFieldLength);

          // Skip it
          mCurrentPointer += mAdaptationFieldLength;
        }

        // Find a PES Packet to write the data into
        // --------------------------------------------------------------------
        PES_Packet *current_packet = (PES_Packet *)0;

        // If it is the start of a new payload
        if (mPayloadUnitStartIndicator) {
          // std::cout << "Creating a PES_Packet for PID : " << mPID
          //          << std::endl;
          current_packet = new PES_Packet;
          current_packet->mPID = mPID;
          current_packet->mContinuityCounter = mContinuityCounter;
          // If we already have a PES_Packet with the same PID
          if (AsAPIDPacket(mPID)) {
            packet_complete = true;
            returned_packet = mPESPacketsMap[mPID];
          }
          mPESPacketsMap[mPID] = current_packet;
        } else {
          if (AsAPIDPacket(mPID)) {
            current_packet = mPESPacketsMap[mPID];
          }
        }
        // --------------------------------------------------------------------

        uint32_t bytes_left =
            TS_PACKET_LENGTH - (mCurrentPointer - start_pointer);
        // If we have a current packet
        if ((current_packet) && (mContainsPayload)) {
          // Check continuity counter
          if (mContinuityCounter != current_packet->mContinuityCounter) {
            current_packet->mState |= MP2TS::PESPacketState::CONTINUITY_ERROR;
            if (mVerbose) {
              std::cout << "Error: Invalid continuity counter" << std::endl;
              std::cout << "  Expected : "
                        << (int)current_packet->mContinuityCounter
                        << " but found : " << mContinuityCounter << std::endl;
            }
          }
          // Update the continuity counter to the expected value for the next
          // TS packet
          current_packet->mContinuityCounter =
              (current_packet->mContinuityCounter + 1) & 0xf;

          // Go to the end of the current_packet data
          uint8_t *write_pointer =
              (current_packet->mData) + (current_packet->mSize);
          // Copy Payload into the write buffer
          // std::cout << "Bytes left : " << bytes_left << " written." <<
          // std::endl;  std::cout << "In a packet of size : " <<
          // current_packet->mSize << std::endl;
          std::memcpy(write_pointer, &(mData[mCurrentPointer]), bytes_left);
          current_packet->mSize += bytes_left;

          // Output the content of the TS payload
          if (mOutputTSPacket) {
            std::cout << "TS packet #" << mNumberOfTSPackets << " payload"
                      << std::endl;
            outputHex(&(mData[mCurrentPointer]), bytes_left);
          }
        }
        mCurrentPointer += bytes_left;

        mNumberOfTSPacketsPerPESPacket++;
        mNumberOfTSPackets++;
      } else {
        mError = ErrorCode::INVALID_START_CODE;
        break;
      }
    } else {
      mEOF = true;
    }

    // Early exit for debugging only
    // --------------------------------------------------------------------------
    // if (mNumberOfTSPackets == 1) {
    //   mEOF = true;
    // }

    // Loop until either we reach the end of file or if we find a packet
  } while ((!mEOF) && (!packet_complete));

  rval = packet_complete;
  return rval;
}

bool Demux::GetDangling(PES_Packet *&returned_packet) {
  bool rval = true;
  if (mPESPacketsMap.size()) {
    returned_packet = mPESPacketsMap.begin()->second;
    mPESPacketsMap.erase(mPESPacketsMap.begin());
  } else {
    rval = false;
  }
  return rval;
}

uint32_t Demux::NumberOfTSPackets() { return mNumberOfTSPacketsPerPESPacket; }

uint32_t Demux::GetPID() { return mPID; }

bool Demux::IsEOF() { return mEOF; }

ErrorCode Demux::Error() { return mError; }

std::map<uint32_t, Channel> &Demux::GetChannelMap() { return mChannelMap; }

void Demux::SetVerbosity(bool x) { mVerbose = x; }

void Demux::SetOutputPacket(bool x) { mOutputPacket = x; }

void Demux::SetOutputTSPacket(bool x) { mOutputTSPacket = x; }

bool Demux::IsAPMTPID(uint32_t pid) {
  bool rval = false;
  for (auto channel : mChannelMap) {
    if (channel.second.mPMTPID == pid) {
      rval = true;
      break;
    }
  }
  return rval;
}

bool Demux::AsAPIDPacket(uint32_t pid) {
  return !(mPESPacketsMap.find(pid) == mPESPacketsMap.end());
}

bool Demux::Parse(PES_Packet *packet, bool outputPESPacketStart) {
  bool rval = true;

  // Decode Program Association Table
  if (packet->mPID == PAT_PID) {
    ParsePAT(packet);
  }
  // TODO: Conditional Access Table
  else if (packet->mPID == CAT_PID) {
  }
  // TODO: Transport Stream Description Table
  else if (packet->mPID == TSDT_PID) {
  }
  // TODO: IPMP Control Information Table
  else if (packet->mPID == IPMP_PID) {
  }
  // Reserved - this should not happen
  else if ((packet->mPID >= 0x4) && (mPID <= 0xf)) {
  }
  // DVB Metadata
  else if ((packet->mPID >= 0x10) && (mPID <= 0x1f)) {
  }
  // Assigned by PMT
  else if (((packet->mPID >= 0x20) && (mPID <= 0x1ffa))) {
    if (mVerbose) {
      std::cout << "Parsing Assigned PID *********************************** 0x"
                << std::hex << std::setfill('0') << std::setw(6) << mPID
                << std::dec << std::endl;
    }
    ParseAssigned(packet, outputPESPacketStart);
  }
  // TODO: Used by DigiCypher 2/ATSC MGT Metadata
  else if (packet->mPID == 0x1ffb) {
  }
  // Assigned by PMT
  else if (((packet->mPID >= 0x1ffc) && (mPID <= 0x1ffe))) {
    if (mVerbose) {
      std::cout << "Parsing Assigned PID *********************************** 0x"
                << std::hex << std::setfill('0') << std::setw(6) << mPID
                << std::dec << std::endl;
    }
    ParseAssigned(packet, outputPESPacketStart);
  }
  // TODO: Null Packet
  else if (packet->mPID == 0x1fff) {
  }
  return rval;
}

bool Demux::ParsePAT(PES_Packet *packet) {
  bool rval = true;

  if (mVerbose) {
    std::cout << "Parsing PAT" << std::endl;
    outputHex(packet->mData, 184);
  }

  // Parser the PSI Header
  uint32_t bytes_read = ParsePSIHeader(packet);

  if (bytes_read) {
    // Check CRC
    uint32_t crc_calc = crc32((char *)mCRCPointer, mCRCLength);
    uint32_t crc_infile = 0;
    crc_infile |= (*(mCRCPointer + mCRCLength + 3) & 0xFF);
    crc_infile |= (*(mCRCPointer + mCRCLength + 2) & 0xFF) << 8;
    crc_infile |= (*(mCRCPointer + mCRCLength + 1) & 0xFF) << 16;
    crc_infile |= (*(mCRCPointer + mCRCLength + 0) & 0xFF) << 24;

    // std::cout << "PAT CRC32 Calculated = " << std::hex << crc_calc <<
    // std::endl; std::cout << "PAT CRC32 In File    = " << std::hex <<
    // crc_infile
    //           << std::endl
    //           << std::dec;

    if (crc_infile == crc_calc) {
      // After the PSI Header the pointer needs to advance by
      // mFillerLength + 8
      uint8_t *data = packet->mData + mFillerLength + 8;

      // Start decoding PAT
      // bytes left excluding the CRC is
      // Section Length - (5) Syntax - (4) CRC
      // Section Length = CRC Length + 1
      // Bytes Left = CRC Length - 8
      uint32_t bytes_left = mCRCLength - 8;

      // Number of PAT Specific Data is bytes_left / 4
      uint32_t PAT_entries = bytes_left >> 2;

      //
      if (mVerbose == true) {
        std::cout << " " << PAT_entries << " PAT entries" << std::endl;
      }
      for (uint32_t i = 0; i < PAT_entries; i++) {
        unsigned int program_number = 0;
        program_number |= *data << 8;
        data++;
        program_number |= *data;
        data++;
        if (mVerbose == true) {
          std::cout << "   Program Number = " << program_number << std::endl;
        }
        unsigned int pmt_pid = 0;
        pmt_pid |= *data << 8;
        data++;
        pmt_pid |= *data;
        data++;
        if (mVerbose == true) {
          std::cout << "   PMT_PID= " << (pmt_pid & 0x1fff) << std::endl;
        }
        mPMTPIDtoChannelNumber[pmt_pid & 0x1fff] = program_number;
        mChannelMap.insert(std::map<uint32_t, Channel>::value_type(
            program_number, Channel(pmt_pid & 0x1fff)));
        // mChannelMap[program_number] = Channel(pmt_pid);
      }
      mIsPATParsed = true;
      rval = true;
    } else {
      rval = false;
    }
  }
  return rval;
}

bool Demux::ParsePMT(PES_Packet *packet) {
  bool rval = false;

  if (mVerbose) {
    std::cout << "Parsing PMT" << std::endl;
  }

  // Parser the PSI Header
  uint32_t bytes_read = ParsePSIHeader(packet);

  if (bytes_read) {
    // Check CRC
    uint32_t crc_calc = crc32((char *)mCRCPointer, mCRCLength);
    uint32_t crc_infile = 0;
    crc_infile |= (*(mCRCPointer + mCRCLength + 3) & 0xFF);
    crc_infile |= (*(mCRCPointer + mCRCLength + 2) & 0xFF) << 8;
    crc_infile |= (*(mCRCPointer + mCRCLength + 1) & 0xFF) << 16;
    crc_infile |= (*(mCRCPointer + mCRCLength + 0) & 0xFF) << 24;

    // std::cout << "PMT CRC32 Calculated = " << std::hex << crc_calc <<
    // std::endl; std::cout << "PMT CRC32 In File    = " << std::hex <<
    // crc_infile
    //           << std::endl
    //           << std::dec;

    if (crc_infile == crc_calc) {
      // After the PSI Header the pointer needs to advance by
      // mFillerLength + 8
      uint8_t *data = packet->mData + mFillerLength + 8;

      // Start decoding PMT

      uint32_t pcr_pid = 0;
      pcr_pid |= *data << 8;
      data++;
      pcr_pid |= *data;
      data++;
      // std::cout << "PRC PID = " << (pcr_pid & 0x1fff) << std::endl;

      uint32_t program_info_length = 0;
      program_info_length |= *data << 8;
      data++;
      program_info_length |= *data;
      data++;
      program_info_length &= 0x03ff;

      // Skip program descriptor bytes
      data += program_info_length;

      // For all stream
      // TODO :: This toooo simple - right now only expecting 1 video and 1
      // audio ES

      // Bytes left excluding the CRC is
      // Section Length - (5) Syntax PIS Header - (4) CRC - (4) Syntax PMT -
      // program_info_length Section Length = CRC Length + 1 Bytes Left = CRC
      // Length + 1 - 5 - 4 - 4 - program_info_length Bytes Left = CRC Length -
      // 12
      // - program_info_length
      uint32_t bytes_left = mCRCLength - 12 - program_info_length;

      // std::cout << "Bytes left in PMT ------------------------------ " <<
      // bytes_left << std::endl;

      Channel channel;
      channel.mPMTPID = packet->mPID;

      while (bytes_left > 0) {
        unsigned int stream_type = 0;
        stream_type = *data;
        data++;

        if (mVerbose) {
          std::cout << "Stream Type : = " << stream_type << std::endl;
        }

        unsigned int pid = 0;
        pid |= *data << 8;
        data++;
        pid |= *data;
        data++;
        pid &= 0x1fff;

        if (mVerbose) {
          std::cout << "PID = " << pid << std::endl;
        }

        channel.mStreams.push_back(std::move(Stream(stream_type, pid)));

        // Skip to next
        unsigned int elementary_stream_descriptor_length = 0;
        elementary_stream_descriptor_length |= *data << 8;
        data++;
        elementary_stream_descriptor_length |= *data;
        data++;

        elementary_stream_descriptor_length &= 0x3ff;
        data += elementary_stream_descriptor_length;

        bytes_left -= (5 + elementary_stream_descriptor_length);
      }
      mChannelMap[mPMTPIDtoChannelNumber[channel.mPMTPID]] = std::move(channel);

      rval = true;
    } else {
      rval = false;
    }
  }

  return rval;
}

// Returns the number of bytes parsed
uint32_t Demux::ParsePSIHeader(PES_Packet *packet) {
  uint32_t rval = 0;

  uint8_t *data = packet->mData;

  // Skip filler
  unsigned int pointer_field = *data++;
  data += pointer_field;
  mFillerLength = 1 + pointer_field;

  // Set the start of the payload to include in the CRC calculation
  mCRCPointer = data;

  // Parse Header
  // Table ID
  mTableId = *data++;
  // std::cout << "Table ID = " << table_id << std::endl;

  // Section Length
  unsigned int section_length = 0;
  section_length |= *data << 8;
  data++;
  section_length |= *data;
  data++;
  section_length &= 0x3FF;  // 10-bits

  if ((section_length > 1021) || (section_length < 5)) {
    rval = 0;
  } else {
    // std::cout << "Section length = " << section_length << std::endl;

    // Calculate the CRC Length
    // Section Length is the number of syntaxt bytes including the CRC
    // (3) Table Header Length
    // (section_length) = Syntax Length including CRC
    // (4) CRC Length
    // crc_length = 3 + section_length - 4;
    mCRCLength = section_length - 1;

    // Calculate current CRC
    // crc = calculate_crc32(crc_payload, crc_length, 0xffffffff);
    // std::cout << "PAT CRC = " << std::hex << std::setfill('0') <<
    // std::setw(8) << crc << std::endl;  std::cout << std::dec;

    // Table ID Extension
    mTableIdExtenxion = 0;
    mTableIdExtenxion |= *data << 8;
    data++;
    mTableIdExtenxion |= *data;
    data++;
    // std::cout << "Table ID Extension = " << table_id_extension <<
    // std::endl;

    // Skip (Reserved bits (0b11), Version Number, Current/Next indicator)
    data++;

    mSectionNumber = *data++;
    // std::cout << "Section Number = " << section_number << std::endl;

    mLastSectionNumber = *data++;
    // std::cout << "Last Section Number = " << last_section_number <<
    // std::endl;
    rval = (data - packet->mData);
  }

  return rval;
}

bool Demux::ParseAdaptationField(uint8_t *data, uint32_t size) {
  if (size >= 1) {
    uint8_t temp = *data++;
    --size;
    mDiscontinuityIndicator = (temp & 0x80) >> 7;
    mRandomAccessIndicator = (temp & 0x40) >> 6;
    mElementaryStreamPriorityIndicator = (temp & 0x20) >> 5;
    mPCRFlag = (temp & 0x10) >> 4;
    mOPCRFlag = (temp & 0x08) >> 3;
    mSplicingPointFlag = (temp & 0x04) >> 2;
    mTransportPrivateDataFlag = (temp & 0x02) >> 1;
    mAdaptationFieldExtensionFlag = (temp & 0x01);
  }

  if (size >= 6) {
    if (mPCRFlag) {
      mPCR = *data++;                //
      mPCR = (mPCR << 8) | *data++;  //
      mPCR = (mPCR << 8) | *data++;  //
      mPCR = (mPCR << 8) | *data++;  //
      mPCR = (mPCR << 8) | *data++;  //
      mPCR = (mPCR << 8) | *data++;  //
      size -= 6;
    }
  }

  if (size >= 6) {
    if (mOPCRFlag) {
      mOPCR = *data++;                 //
      mOPCR = (mOPCR << 8) | *data++;  //
      mOPCR = (mOPCR << 8) | *data++;  //
      mOPCR = (mOPCR << 8) | *data++;  //
      mOPCR = (mOPCR << 8) | *data++;  //
      mOPCR = (mOPCR << 8) | *data++;  //
      size -= 6;
    }
  }

  if (size >= 1) {
    if (mSplicingPointFlag) {
      mSpliceCountDown = *data++;
      --size;
    }
  }

  // If adaptation field private data is present
  if (size >= 1) {
    if (mTransportPrivateDataFlag) {
      unsigned int transportPrivateDataLength = *data++;
      --size;

      if (transportPrivateDataLength > size) {
        if (mVerbose) {
          std::cout << "Found adaptation field private data of illegal length"
                    << std::endl;
          std::cout << "Reducing the length to 0 to prevent any issues"
                    << std::endl;
        }
        transportPrivateDataLength = 0;
      }

      for (int i = 0; i < transportPrivateDataLength; i++) {
        mAdaptationFieldPrivateData[i] = *data++;
        --size;
      }
      if (mVerbose) {
        std::cout << "Found Adaptation Field Private Data" << std::endl;
        for (int i = 0; i < transportPrivateDataLength; i++) {
          std::cout << std::hex << std::setw(2) << std::setfill('0')
                    << (unsigned int)mAdaptationFieldPrivateData[i] << " ";
          std::cout << std::dec;
        }
        std::cout << std::endl;
      }
    }
  }
}

bool Demux::ParseAssigned(PES_Packet *packet, bool outputPESPacketStart) {
  bool rval = true;

  // If PAT is not yet parsed, look into the packet map if there is a
  // packet with PID=0
  if (!mIsPATParsed) {
    // Do we have a PAT?
    if (AsAPIDPacket(0)) {
      // Parse PAT
      ParsePAT(mPESPacketsMap[0]);
    }
    // Do we have any PMT? If yes, parse them.
    for (auto channel : mChannelMap) {
      if (AsAPIDPacket(channel.second.mPMTPID)) {
        ParsePMT(mPESPacketsMap[channel.second.mPMTPID]);
      }
    }
  }

  if (IsAPMTPID(packet->mPID)) {
    ParsePMT(packet);
  } else {
    // Is there a PES start code?
    uint8_t *data = packet->mData;

    uint32_t start_code = 0;
    start_code = *data;
    start_code = (start_code << 8) | *(data + 1);
    start_code = (start_code << 8) | *(data + 2);
    data += 3;
    if (mVerbose) {
      std::cout << "  Start Code : 0x" << std::hex << std::setfill('0')
                << std::setw(6) << start_code << std::dec << std::endl;
    }
    // Found a stream
    if (start_code == 0x000001) {
      packet->mStreamId = *data;
      data++;

      if (mVerbose) {
        std::cout << "  Stream ID : 0x" << std::hex << std::setfill('0')
                  << std::setw(2) << (int)packet->mStreamId << std::dec
                  << std::endl;
      }

      uint16_t pes_packet_length = *data << 8;
      data++;
      pes_packet_length |= *data;
      data++;

      if (mVerbose) {
        std::cout << "  PES Packet length : " << pes_packet_length << std::endl;
      }

      uint8_t temp = *data;
      data++;

      if (mVerbose) {
        std::cout << "  Marker bits (must be 0x2 or 0b11) : "
                  << ((temp & 0xc0) >> 6) << std::endl;
        std::cout << "  Scrmbling control (0 if not scrambled): "
                  << ((temp & 0x30) >> 4) << std::endl;
        std::cout << "  Priority: " << ((temp & 0x08) >> 3) << std::endl;
        std::cout << "  Data alignement indicator : " << ((temp & 0x04) >> 2)
                  << std::endl;
        std::cout << "  Copyright: " << ((temp & 0x02) >> 1) << std::endl;
        std::cout << "  Original or copy (1 implies copy) : " << (temp & 0x01)
                  << std::endl;
      }

      temp = *data;
      data++;

      packet->mPTSDTSIndicator = (temp & 0xc0) >> 6;
      uint8_t escr_flag = (temp & 0x20) >> 5;
      uint8_t es_flag = (temp & 0x10) >> 4;
      uint8_t dms_trick_mode_flag = (temp & 0x08) >> 3;
      uint8_t additional_copy_info_flag = (temp & 0x04) >> 2;
      uint8_t crc_flag = (temp & 0x02) >> 1;
      uint8_t extension_flag = (temp & 0x01);

      if (mVerbose) {
        std::cout << "  PTS present : "
                  << ((packet->mPTSDTSIndicator & 0x2) ? "YES" : "NO")
                  << std::endl;
        std::cout << "  DTS present : "
                  << ((packet->mPTSDTSIndicator & 0x1) ? "YES" : "NO")
                  << std::endl;
      }

      uint8_t pes_header_raimaining_bytes = *data;
      data++;

      // Store the current data pointer
      uint8_t *tempData = data;

      // Skip over the remaining of the PES header, will use tempData to
      // finish parsing
      data += pes_header_raimaining_bytes;
      // Set the start of the PES packet payload
      packet->mDataPESPayload = data;

      if (mVerbose) {
        std::cout << "   Remaining bytes = " << (int)pes_header_raimaining_bytes
                  << std::endl;
      }

      // If PTS present
      if (packet->mPTSDTSIndicator & 0x2) {
        uint8_t high = *tempData;
        tempData++;
        uint16_t mid = (*tempData << 8) + (*(tempData + 1));
        tempData += 2;
        uint16_t low = (*tempData << 8) + (*(tempData + 1));
        tempData += 2;

        // std::cout << "    -> HIGH : " << std::hex << (int)high <<
        // std::endl;  std::cout << "    -> MID : " << std::hex << (int)mid <<
        // std::endl;  std::cout << "    -> LOW : " << std::hex << (int)low <<
        // std::endl;  std::cout << std::dec << std::endl;

        packet->mPTS = ((uint64_t(high) & 0x0e) >> 1) << 30;
        packet->mPTS |= ((uint64_t(mid) & 0xfffe) >> 1) << 15;
        packet->mPTS |= ((uint64_t(low) & 0xfffe) >> 1);
      }
      // If DTS present
      if (packet->mPTSDTSIndicator & 0x1) {
        uint8_t high = *tempData;
        tempData++;
        uint16_t mid = (*tempData << 8) + (*(tempData + 1));
        tempData += 2;
        uint16_t low = (*tempData << 8) + (*(tempData + 1));
        tempData += 2;

        packet->mDTS = ((uint64_t(high) & 0x0e) >> 1) << 30;
        packet->mDTS |= ((uint64_t(mid) & 0xfffe) >> 1) << 15;
        packet->mDTS |= ((uint64_t(low) & 0xfffe) >> 1);
      }

      if (mVerbose) {
        if (packet->mPTSDTSIndicator & 0x2) {
          std::cout << "   PTS : " << packet->mPTS << std::endl;
        }
        if (packet->mPTSDTSIndicator & 0x1) {
          std::cout << "   DTS : " << packet->mDTS << std::endl;
        }
      }

      if (outputPESPacketStart) {
        std::cout << "Size of packet payload : "
                  << (unsigned int)packet->mSize - (data - packet->mData)
                  << std::endl;
        if (mVerbose) {
          outputHex(data, (packet->mSize - (data - packet->mData)) > 128
                              ? 128
                              : (packet->mSize - (data - packet->mData)));
        }
      }
    }
  }

  return rval;
}

std::vector<std::string> gStreamTypeName{
    /* 0x00 */ "Reserved",
    /* 0x01 */ "ISO/IEC 11172-2 (MPEG-1 Video)",
    /* 0x02 */ "ITU-T Rec. H.262 and ISO/IEC 13818-2",
    /* 0x03 */ "ISO/IEC 11172-3 (MPEG-1 audio)",
    /* 0x04 */ "ISO/IEC 13818-3 (MPEG-2 halved sample rate audio)",
    /* 0x05 */ "ITU-T Rec. H.222 and ISO/IEC 13818-1 (MPEG-2 tabled data)",
    /* 0x06 */ "ITU-T Rec. H.222 and ISO/IEC 13818-1 (MPEG-2 packetized data)",
    /* 0x07 */ "ISO/IEC 13522 (MHEG)",
    /* 0x08 */ "ITU-T Rec. H.222 and ISO/IEC 13818-1 ",
    /* 0x09 */ "ITU-T Rec. H.222 and ISO/IEC 13818-1/11172-1 auxiliary data",
    /* 0x0a */ "ISO/IEC 13818-6 DSM CC multiprotocol encapsulation",
    /* 0x0b */ "ISO/IEC 13818-6 DSM CC U-N messages",
    /* 0x0c */ "ISO/IEC 13818-6 DSM CC stream descriptors",
    /* 0x0d */ "ISO/IEC 13818-6 DSM CC tabled data",
    /* 0x0e */ "ISO/IEC 13818-1 auxiliary data",
    /* 0x0f */ "ISO/IEC 13818-7 ADTS AAC (MPEG-2 lower bit-rate audio)",
    /* 0x10 */ "ISO/IEC 14496-2 (MPEG-4 H.263 based video)",
    /* 0x11 */ "ISO/IEC 14496-3 (MPEG-4 LOAS multi-format framed audio)",
    /* 0x12 */ "ISO/IEC 14496-1 (MPEG-4 FlexMux) in packetized stream",
    /* 0x13 */ "ISO/IEC 14496-1 (MPEG-4 FlexMux) in ISO/IEC 14496 tables",
    /* 0x14 */ "ISO/IEC 13818-6 DSM CC synchronized download protocol",
    /* 0x15 */ "Packetized metadata",
    /* 0x16 */ "Sectioned metadata",
    /* 0x17 */ "ISO/IEC 13818-6 DSM CC Data Carousel metadata",
    /* 0x18 */ "ISO/IEC 13818-6 DSM CC Object Carousel metadata",
    /* 0x19 */ "ISO/IEC 13818-6 Synchronized Download Protocol metadata",
    /* 0x1a */ "ISO/IEC 13818-11 IPMP",
    /* 0x1b */ "ITU-T Rec. H.264 and ISO/IEC 14496-10 (lower bit-rate video)",
    /* 0x1c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x1d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x1e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x1f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x20 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x21 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x22 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x23 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x24 */ "ITU-T Rec. H.265 and ISO/IEC 23008-2 (Ultra HD video)",
    /* 0x25 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x26 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x27 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x28 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x29 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x2f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x30 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x31 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x32 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x33 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x34 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x35 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x36 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x37 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x38 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x39 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x3f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x40 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x41 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x42 */ "Chinese Video Standard",
    /* 0x43 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x44 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x45 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x46 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x47 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x48 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x49 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x4f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x50 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x51 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x52 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x53 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x54 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x55 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x56 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x57 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x58 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x59 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x5f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x60 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x61 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x62 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x63 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x64 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x65 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x66 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x67 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x68 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x69 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x6f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x70 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x71 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x72 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x73 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x74 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x75 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x76 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x77 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x78 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x79 */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7a */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7b */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7c */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7d */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7e */ "Warning: Unknown or Reserved Stream Type",
    /* 0x7f */ "Warning: Unknown or Reserved Stream Type",
    /* 0x80 */
    "ITU-T Rec. H.262 and ISO/IEC 13818-2 for DigiCipher II or PCM audio for "
    "Blu-ray",
    /* 0x81 */ "Dolby Digital up to six channel audio for ATSC and Blu-ray",
    /* 0x82 */ "SCTE subtitle or DTS 6 channel audio for Blu-ray",
    /* 0x83 */ "Dolby TrueHD lossless audio for Blu-ray",
    /* 0x84 */ "Dolby Digital Plus up to 16 channel audio for Blu-ray",
    /* 0x85 */ "DTS 8 channel audio for Blu-ray",
    /* 0x86 */ "DTS 8 channel lossless audio for Blu-ray",
    /* 0x87 */ "Dolby Digital Plus up to 16 channel audio for ATSC",
    /* 0x88 */ "Warning: Privately defined Stream Id",
    /* 0x89 */ "Warning: Privately defined Stream Id",
    /* 0x8a */ "Warning: Privately defined Stream Id",
    /* 0x8b */ "Warning: Privately defined Stream Id",
    /* 0x8c */ "Warning: Privately defined Stream Id",
    /* 0x8d */ "Warning: Privately defined Stream Id",
    /* 0x8e */ "Warning: Privately defined Stream Id",
    /* 0x8f */ "Warning: Privately defined Stream Id",
    /* 0x90 */ "Blu-ray Presentation Graphic Stream (subtitling)",
    /* 0x91 */ "Warning: Privately defined Stream Id",
    /* 0x92 */ "Warning: Privately defined Stream Id",
    /* 0x93 */ "Warning: Privately defined Stream Id",
    /* 0x94 */ "Warning: Privately defined Stream Id",
    /* 0x95 */ "ATSC DSM CC Network Resources table",
    /* 0x96 */ "Warning: Privately defined Stream Id",
    /* 0x97 */ "Warning: Privately defined Stream Id",
    /* 0x98 */ "Warning: Privately defined Stream Id",
    /* 0x99 */ "Warning: Privately defined Stream Id",
    /* 0x9a */ "Warning: Privately defined Stream Id",
    /* 0x9b */ "Warning: Privately defined Stream Id",
    /* 0x9c */ "Warning: Privately defined Stream Id",
    /* 0x9d */ "Warning: Privately defined Stream Id",
    /* 0x9e */ "Warning: Privately defined Stream Id",
    /* 0x9f */ "Warning: Privately defined Stream Id",
    /* 0xa0 */ "Warning: Privately defined Stream Id",
    /* 0xa1 */ "Warning: Privately defined Stream Id",
    /* 0xa2 */ "Warning: Privately defined Stream Id",
    /* 0xa3 */ "Warning: Privately defined Stream Id",
    /* 0xa4 */ "Warning: Privately defined Stream Id",
    /* 0xa5 */ "Warning: Privately defined Stream Id",
    /* 0xa6 */ "Warning: Privately defined Stream Id",
    /* 0xa7 */ "Warning: Privately defined Stream Id",
    /* 0xa8 */ "Warning: Privately defined Stream Id",
    /* 0xa9 */ "Warning: Privately defined Stream Id",
    /* 0xaa */ "Warning: Privately defined Stream Id",
    /* 0xab */ "Warning: Privately defined Stream Id",
    /* 0xac */ "Warning: Privately defined Stream Id",
    /* 0xad */ "Warning: Privately defined Stream Id",
    /* 0xae */ "Warning: Privately defined Stream Id",
    /* 0xaf */ "Warning: Privately defined Stream Id",
    /* 0xb0 */ "Warning: Privately defined Stream Id",
    /* 0xb1 */ "Warning: Privately defined Stream Id",
    /* 0xb2 */ "Warning: Privately defined Stream Id",
    /* 0xb3 */ "Warning: Privately defined Stream Id",
    /* 0xb4 */ "Warning: Privately defined Stream Id",
    /* 0xb5 */ "Warning: Privately defined Stream Id",
    /* 0xb6 */ "Warning: Privately defined Stream Id",
    /* 0xb7 */ "Warning: Privately defined Stream Id",
    /* 0xb8 */ "Warning: Privately defined Stream Id",
    /* 0xb9 */ "Warning: Privately defined Stream Id",
    /* 0xba */ "Warning: Privately defined Stream Id",
    /* 0xbb */ "Warning: Privately defined Stream Id",
    /* 0xbc */ "Warning: Privately defined Stream Id",
    /* 0xbd */ "Warning: Privately defined Stream Id",
    /* 0xbe */ "Warning: Privately defined Stream Id",
    /* 0xbf */ "Warning: Privately defined Stream Id",
    /* 0xc0 */ "DigiCipher II text",
    /* 0xc1 */ "Warning: Privately defined Stream Id",
    /* 0xc2 */ "ATSC DSM CC synchronous data",
    /* 0xc3 */ "Warning: Privately defined Stream Id",
    /* 0xc4 */ "Warning: Privately defined Stream Id",
    /* 0xc5 */ "Warning: Privately defined Stream Id",
    /* 0xc6 */ "Warning: Privately defined Stream Id",
    /* 0xc7 */ "Warning: Privately defined Stream Id",
    /* 0xc8 */ "Warning: Privately defined Stream Id",
    /* 0xc9 */ "Warning: Privately defined Stream Id",
    /* 0xca */ "Warning: Privately defined Stream Id",
    /* 0xcb */ "Warning: Privately defined Stream Id",
    /* 0xcc */ "Warning: Privately defined Stream Id",
    /* 0xcd */ "Warning: Privately defined Stream Id",
    /* 0xce */ "Warning: Privately defined Stream Id",
    /* 0xcf */ "Warning: Privately defined Stream Id",
    /* 0xd0 */ "Warning: Privately defined Stream Id",
    /* 0xd1 */ "BBC Dirac (Ultra HD video)",
    /* 0xd2 */ "Warning: Privately defined Stream Id",
    /* 0xd3 */ "Warning: Privately defined Stream Id",
    /* 0xd4 */ "Warning: Privately defined Stream Id",
    /* 0xd5 */ "Warning: Privately defined Stream Id",
    /* 0xd6 */ "Warning: Privately defined Stream Id",
    /* 0xd7 */ "Warning: Privately defined Stream Id",
    /* 0xd8 */ "Warning: Privately defined Stream Id",
    /* 0xd9 */ "Warning: Privately defined Stream Id",
    /* 0xda */ "Warning: Privately defined Stream Id",
    /* 0xdb */ "Warning: Privately defined Stream Id",
    /* 0xdc */ "Warning: Privately defined Stream Id",
    /* 0xdd */ "Warning: Privately defined Stream Id",
    /* 0xde */ "Warning: Privately defined Stream Id",
    /* 0xdf */ "Warning: Privately defined Stream Id",
    /* 0xe0 */ "Warning: Privately defined Stream Id",
    /* 0xe1 */ "Warning: Privately defined Stream Id",
    /* 0xe2 */ "Warning: Privately defined Stream Id",
    /* 0xe3 */ "Warning: Privately defined Stream Id",
    /* 0xe4 */ "Warning: Privately defined Stream Id",
    /* 0xe5 */ "Warning: Privately defined Stream Id",
    /* 0xe6 */ "Warning: Privately defined Stream Id",
    /* 0xe7 */ "Warning: Privately defined Stream Id",
    /* 0xe8 */ "Warning: Privately defined Stream Id",
    /* 0xe9 */ "Warning: Privately defined Stream Id",
    /* 0xea */ "Microsoft Windows Media Video 9 (lower bit-rate video)",
    /* 0xeb */ "Warning: Privately defined Stream Id",
    /* 0xec */ "Warning: Privately defined Stream Id",
    /* 0xed */ "Warning: Privately defined Stream Id",
    /* 0xee */ "Warning: Privately defined Stream Id",
    /* 0xef */ "Warning: Privately defined Stream Id",
    /* 0xf0 */ "Warning: Privately defined Stream Id",
    /* 0xf1 */ "Warning: Privately defined Stream Id",
    /* 0xf2 */ "Warning: Privately defined Stream Id",
    /* 0xf3 */ "Warning: Privately defined Stream Id",
    /* 0xf4 */ "Warning: Privately defined Stream Id",
    /* 0xf5 */ "Warning: Privately defined Stream Id",
    /* 0xf6 */ "Warning: Privately defined Stream Id",
    /* 0xf7 */ "Warning: Privately defined Stream Id",
    /* 0xf8 */ "Warning: Privately defined Stream Id",
    /* 0xf9 */ "Warning: Privately defined Stream Id",
    /* 0xfa */ "Warning: Privately defined Stream Id",
    /* 0xfb */ "Warning: Privately defined Stream Id",
    /* 0xfc */ "Warning: Privately defined Stream Id",
    /* 0xfd */ "Warning: Privately defined Stream Id",
    /* 0xfe */ "Warning: Privately defined Stream Id",
    /* 0xff */ "Warning: Privately defined Stream Id"

};
}  // namespace MP2TS