mpeg_pes.h
Go to the documentation of this file.
/*
* Copyright (c) 2013-2014 - Andre Roth <neolynx@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation version 2.1 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*/
#ifndef _MPEG_PES_H
#define _MPEG_PES_H
#include <stdint.h>
#include <unistd.h> /* ssize_t */
#define DVB_MPEG_PES 0x00001
#define DVB_MPEG_PES_AUDIO 0xc0 ... 0xcf
#define DVB_MPEG_PES_VIDEO 0xe0 ... 0xef
#define DVB_MPEG_STREAM_MAP 0xBC
#define DVB_MPEG_STREAM_PADDING 0xBE
#define DVB_MPEG_STREAM_PRIVATE_2 0x5F
#define DVB_MPEG_STREAM_ECM 0x70
#define DVB_MPEG_STREAM_EMM 0x71
#define DVB_MPEG_STREAM_DIRECTORY 0xFF
#define DVB_MPEG_STREAM_DSMCC 0x7A
#define DVB_MPEG_STREAM_H222E 0xF8
struct ts_t {
uint8_t one:1;
uint8_t bits30:3;
uint8_t tag:4;
union {
uint16_t bitfield;
struct {
uint16_t one1:1;
uint16_t bits15:15;
} __attribute__((packed));
} __attribute__((packed));
union {
uint16_t bitfield2;
struct {
uint16_t one2:1;
uint16_t bits00:15;
} __attribute__((packed));
} __attribute__((packed));
} __attribute__((packed));
struct dvb_mpeg_pes_optional {
union {
uint16_t bitfield;
struct {
uint16_t PES_extension:1;
uint16_t PES_CRC:1;
uint16_t additional_copy_info:1;
uint16_t DSM_trick_mode:1;
uint16_t ES_rate:1;
uint16_t ESCR:1;
uint16_t PTS_DTS:2;
uint16_t original_or_copy:1;
uint16_t copyright:1;
uint16_t data_alignment_indicator:1;
uint16_t PES_priority:1;
uint16_t PES_scrambling_control:2;
uint16_t two:2;
} __attribute__((packed));
} __attribute__((packed));
uint8_t length;
uint64_t pts;
uint64_t dts;
} __attribute__((packed));
struct dvb_mpeg_pes {
union {
uint32_t bitfield;
struct {
uint32_t stream_id:8;
uint32_t sync:24;
} __attribute__((packed));
} __attribute__((packed));
uint16_t length;
struct dvb_mpeg_pes_optional optional[];
} __attribute__((packed));
struct dvb_v5_fe_parms;
#ifdef __cplusplus
extern "C" {
#endif
ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen,
uint8_t *table);
void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes);
void dvb_mpeg_pes_print (struct dvb_v5_fe_parms *parms, struct dvb_mpeg_pes *pes);
#ifdef __cplusplus
}
#endif
#endif
dvb_mpeg_pes_init
ssize_t dvb_mpeg_pes_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, uint8_t *table)
Initialize a struct dvb_mpeg_pes from buffer.
dvb_mpeg_pes_free
void dvb_mpeg_pes_free(struct dvb_mpeg_pes *pes)
Deallocate memory associated with a struct dvb_mpeg_pes.
dvb_mpeg_pes_print
void dvb_mpeg_pes_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_pes *pes)
Print details of struct dvb_mpeg_pes.
dvb_mpeg_pes_optional
MPEG PES optional header.
Definition mpeg_pes.h:152
dvb_mpeg_pes_optional::PTS_DTS
uint16_t PTS_DTS
Definition mpeg_pes.h:162
dvb_mpeg_pes_optional::PES_priority
uint16_t PES_priority
Definition mpeg_pes.h:166
dvb_mpeg_pes_optional::length
uint8_t length
Definition mpeg_pes.h:171
dvb_mpeg_pes_optional::original_or_copy
uint16_t original_or_copy
Definition mpeg_pes.h:163
dvb_mpeg_pes_optional::pts
uint64_t pts
Definition mpeg_pes.h:172
dvb_mpeg_pes_optional::copyright
uint16_t copyright
Definition mpeg_pes.h:164
dvb_mpeg_pes_optional::dts
uint64_t dts
Definition mpeg_pes.h:173
dvb_mpeg_pes_optional::bitfield
uint16_t bitfield
Definition mpeg_pes.h:154
dvb_mpeg_pes_optional::two
uint16_t two
Definition mpeg_pes.h:168
dvb_mpeg_pes_optional::PES_CRC
uint16_t PES_CRC
Definition mpeg_pes.h:157
dvb_mpeg_pes_optional::ES_rate
uint16_t ES_rate
Definition mpeg_pes.h:160
dvb_mpeg_pes_optional::PES_extension
uint16_t PES_extension
Definition mpeg_pes.h:156
dvb_mpeg_pes_optional::data_alignment_indicator
uint16_t data_alignment_indicator
Definition mpeg_pes.h:165
dvb_mpeg_pes_optional::PES_scrambling_control
uint16_t PES_scrambling_control
Definition mpeg_pes.h:167
dvb_mpeg_pes_optional::additional_copy_info
uint16_t additional_copy_info
Definition mpeg_pes.h:158
dvb_mpeg_pes_optional::DSM_trick_mode
uint16_t DSM_trick_mode
Definition mpeg_pes.h:159
dvb_mpeg_pes_optional::ESCR
uint16_t ESCR
Definition mpeg_pes.h:161
dvb_mpeg_pes
MPEG PES data structure.
Definition mpeg_pes.h:186
dvb_mpeg_pes::stream_id
uint32_t stream_id
Definition mpeg_pes.h:190
dvb_mpeg_pes::length
uint16_t length
Definition mpeg_pes.h:194
dvb_mpeg_pes::sync
uint32_t sync
Definition mpeg_pes.h:191
dvb_mpeg_pes::optional
struct dvb_mpeg_pes_optional optional[]
Definition mpeg_pes.h:195
dvb_mpeg_pes::bitfield
uint32_t bitfield
Definition mpeg_pes.h:188
dvb_v5_fe_parms
Keeps data needed to handle the DVB frontend.
Definition dvb-fe.h:117
ts_t
MPEG PES timestamp structure, used for dts and pts.
Definition mpeg_pes.h:108
ts_t::one
uint8_t one
Definition mpeg_pes.h:109
ts_t::bits15
uint16_t bits15
Definition mpeg_pes.h:117
ts_t::one1
uint16_t one1
Definition mpeg_pes.h:116
ts_t::bits30
uint8_t bits30
Definition mpeg_pes.h:110
ts_t::tag
uint8_t tag
Definition mpeg_pes.h:111
ts_t::bitfield2
uint16_t bitfield2
Definition mpeg_pes.h:122
ts_t::bitfield
uint16_t bitfield
Definition mpeg_pes.h:114
ts_t::bits00
uint16_t bits00
Definition mpeg_pes.h:125
ts_t::one2
uint16_t one2
Definition mpeg_pes.h:124