kopia lustrzana https://github.com/kierank/libmpegts
Fix CRLF
rodzic
4a0d349eda
commit
c5d276966f
28
README
28
README
|
@ -1,14 +1,14 @@
|
|||
libmpegts README
|
||||
|
||||
Single Program Transport stream muxer
|
||||
|
||||
Things which work:
|
||||
|
||||
CBR and VBR TS muxing of AVC, AC-3, MP2 and AAC/HE-AAC.
|
||||
DVB AU_Information
|
||||
(Very likely MPEG-2 as well but not tested)
|
||||
|
||||
Things which don't work:
|
||||
|
||||
Blu-Ray and associated formats
|
||||
DTS
|
||||
libmpegts README
|
||||
|
||||
Single Program Transport stream muxer
|
||||
|
||||
Things which work:
|
||||
|
||||
CBR and VBR TS muxing of AVC, AC-3, MP2 and AAC/HE-AAC.
|
||||
DVB AU_Information
|
||||
(Very likely MPEG-2 as well but not tested)
|
||||
|
||||
Things which don't work:
|
||||
|
||||
Blu-Ray and associated formats
|
||||
DTS
|
||||
|
|
24
TODO
24
TODO
|
@ -1,12 +1,12 @@
|
|||
libmpegts TODO list
|
||||
|
||||
Most important TODO is to get streams verified with a good analyzer
|
||||
Is there a need to implement full T-STD modelling or use the simpler version currently implemented?
|
||||
Do we need to control EB buffer fullness more?
|
||||
Find out why some streams where muxrate is larger than TB leak rate fail to mux.
|
||||
A true VBR mode? How to implement? Within Spec?
|
||||
Write ATSC PSIP
|
||||
Write DVB Tables (SIT, NIT, EIT) etc
|
||||
Sort out T-STD on Data streams
|
||||
Add more formats
|
||||
Add Blu-ray formats - dealing with vbr audio?
|
||||
libmpegts TODO list
|
||||
|
||||
Most important TODO is to get streams verified with a good analyzer
|
||||
Is there a need to implement full T-STD modelling or use the simpler version currently implemented?
|
||||
Do we need to control EB buffer fullness more?
|
||||
Find out why some streams where muxrate is larger than TB leak rate fail to mux.
|
||||
A true VBR mode? How to implement? Within Spec?
|
||||
Write ATSC PSIP
|
||||
Write DVB Tables (SIT, NIT, EIT) etc
|
||||
Sort out T-STD on Data streams
|
||||
Add more formats
|
||||
Add Blu-ray formats - dealing with vbr audio?
|
||||
|
|
150
atsc/atsc.c
150
atsc/atsc.c
|
@ -1,75 +1,75 @@
|
|||
/*****************************************************************************
|
||||
* atsc.c : ATSC specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "atsc.h"
|
||||
|
||||
/* Second Loop of PMT */
|
||||
void parse_ac3_frame( ts_atsc_ac3_info *atsc_ac3_ctx, uint8_t *frame )
|
||||
{
|
||||
atsc_ac3_ctx->sample_rate_code = frame[4] >> 6;
|
||||
atsc_ac3_ctx->bsid = frame[5] >> 3;
|
||||
atsc_ac3_ctx->bit_rate_code = (frame[4] & 0x3f) >> 1;
|
||||
atsc_ac3_ctx->surround_mode = (frame[6] & 1) << 1 | (frame[7] >> 7);
|
||||
atsc_ac3_ctx->bsmod = frame[5] & 0x7;
|
||||
atsc_ac3_ctx->num_channels = frame[6] >> 5;
|
||||
}
|
||||
|
||||
void write_atsc_ac3_descriptor( bs_t *s, ts_atsc_ac3_info *atsc_ac3_ctx )
|
||||
{
|
||||
bs_write( s, 8, ATSC_AC3_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 3 ); // descriptor_length
|
||||
bs_write( s, 3, atsc_ac3_ctx->sample_rate_code ); // sample_rate_code
|
||||
bs_write( s, 5, atsc_ac3_ctx->bsid ); // bsid
|
||||
bs_write( s, 6, atsc_ac3_ctx->bit_rate_code ); // bit_rate_code
|
||||
bs_write( s, 2, atsc_ac3_ctx->surround_mode ); // surround_mode
|
||||
bs_write( s, 3, atsc_ac3_ctx->bsmod ); // bsmod
|
||||
bs_write( s, 4, atsc_ac3_ctx->num_channels ); // num_channels
|
||||
bs_write1( s, 1 ); // full_svc
|
||||
}
|
||||
|
||||
/* Also in EIT */
|
||||
// FIXME fill in the blanks
|
||||
void write_caption_service_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, ATSC_CAPTION_SERVICE_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
bs_write( s, 3, 0x7 ); // reserved
|
||||
|
||||
bs_write( s, 5, 0 ); // number_of_services
|
||||
|
||||
for( int i = 0; i < 0; i++ )
|
||||
{
|
||||
bs_write( s, 8, 0 ); // language[0]
|
||||
bs_write( s, 8, 0 ); // language[1]
|
||||
bs_write( s, 8, 0 ); // language[2]
|
||||
bs_write1( s, 0 ); // digital_cc
|
||||
bs_write1( s, 1 ); // reserved
|
||||
|
||||
if( 0 )
|
||||
bs_write( s, 6, 0x3f ); // reserved
|
||||
else
|
||||
bs_write( s, 6, 0 ); // caption_service_number
|
||||
|
||||
bs_write1( s, 0 ); // easy_reader
|
||||
bs_write1( s, 0 ); // wide_aspect_ratio
|
||||
bs_write( s, 13, 0x3fff ); // reserved
|
||||
}
|
||||
}
|
||||
/*****************************************************************************
|
||||
* atsc.c : ATSC specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "atsc.h"
|
||||
|
||||
/* Second Loop of PMT */
|
||||
void parse_ac3_frame( ts_atsc_ac3_info *atsc_ac3_ctx, uint8_t *frame )
|
||||
{
|
||||
atsc_ac3_ctx->sample_rate_code = frame[4] >> 6;
|
||||
atsc_ac3_ctx->bsid = frame[5] >> 3;
|
||||
atsc_ac3_ctx->bit_rate_code = (frame[4] & 0x3f) >> 1;
|
||||
atsc_ac3_ctx->surround_mode = (frame[6] & 1) << 1 | (frame[7] >> 7);
|
||||
atsc_ac3_ctx->bsmod = frame[5] & 0x7;
|
||||
atsc_ac3_ctx->num_channels = frame[6] >> 5;
|
||||
}
|
||||
|
||||
void write_atsc_ac3_descriptor( bs_t *s, ts_atsc_ac3_info *atsc_ac3_ctx )
|
||||
{
|
||||
bs_write( s, 8, ATSC_AC3_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 3 ); // descriptor_length
|
||||
bs_write( s, 3, atsc_ac3_ctx->sample_rate_code ); // sample_rate_code
|
||||
bs_write( s, 5, atsc_ac3_ctx->bsid ); // bsid
|
||||
bs_write( s, 6, atsc_ac3_ctx->bit_rate_code ); // bit_rate_code
|
||||
bs_write( s, 2, atsc_ac3_ctx->surround_mode ); // surround_mode
|
||||
bs_write( s, 3, atsc_ac3_ctx->bsmod ); // bsmod
|
||||
bs_write( s, 4, atsc_ac3_ctx->num_channels ); // num_channels
|
||||
bs_write1( s, 1 ); // full_svc
|
||||
}
|
||||
|
||||
/* Also in EIT */
|
||||
// FIXME fill in the blanks
|
||||
void write_caption_service_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, ATSC_CAPTION_SERVICE_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
bs_write( s, 3, 0x7 ); // reserved
|
||||
|
||||
bs_write( s, 5, 0 ); // number_of_services
|
||||
|
||||
for( int i = 0; i < 0; i++ )
|
||||
{
|
||||
bs_write( s, 8, 0 ); // language[0]
|
||||
bs_write( s, 8, 0 ); // language[1]
|
||||
bs_write( s, 8, 0 ); // language[2]
|
||||
bs_write1( s, 0 ); // digital_cc
|
||||
bs_write1( s, 1 ); // reserved
|
||||
|
||||
if( 0 )
|
||||
bs_write( s, 6, 0x3f ); // reserved
|
||||
else
|
||||
bs_write( s, 6, 0 ); // caption_service_number
|
||||
|
||||
bs_write1( s, 0 ); // easy_reader
|
||||
bs_write1( s, 0 ); // wide_aspect_ratio
|
||||
bs_write( s, 13, 0x3fff ); // reserved
|
||||
}
|
||||
}
|
||||
|
|
74
atsc/atsc.h
74
atsc/atsc.h
|
@ -1,37 +1,37 @@
|
|||
/*****************************************************************************
|
||||
* atsc.h : ATSC specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_ATSC_H
|
||||
#define LIBMPEGTS_ATSC_H
|
||||
|
||||
/* ATSC stream_types */
|
||||
#define AUDIO_AC3 0x81
|
||||
#define AUDIO_EAC3 0x84
|
||||
|
||||
/* Descriptors */
|
||||
#define ATSC_AC3_DESCRIPTOR_TAG 0x81
|
||||
#define ATSC_CAPTION_SERVICE_DESCRIPTOR_TAG 0x86
|
||||
#define ATSC_EXTENDED_CHANNEL_NAME_DESCRIPTOR_TAG 0xa0
|
||||
|
||||
void parse_ac3_frame( ts_atsc_ac3_info *atsc_ac3_ctx, uint8_t *frame );
|
||||
void write_atsc_ac3_descriptor( bs_t *s, ts_atsc_ac3_info *atsc_ac3_ctx );
|
||||
void write_caption_service_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* atsc.h : ATSC specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_ATSC_H
|
||||
#define LIBMPEGTS_ATSC_H
|
||||
|
||||
/* ATSC stream_types */
|
||||
#define AUDIO_AC3 0x81
|
||||
#define AUDIO_EAC3 0x84
|
||||
|
||||
/* Descriptors */
|
||||
#define ATSC_AC3_DESCRIPTOR_TAG 0x81
|
||||
#define ATSC_CAPTION_SERVICE_DESCRIPTOR_TAG 0x86
|
||||
#define ATSC_EXTENDED_CHANNEL_NAME_DESCRIPTOR_TAG 0xa0
|
||||
|
||||
void parse_ac3_frame( ts_atsc_ac3_info *atsc_ac3_ctx, uint8_t *frame );
|
||||
void write_atsc_ac3_descriptor( bs_t *s, ts_atsc_ac3_info *atsc_ac3_ctx );
|
||||
void write_caption_service_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
/*****************************************************************************
|
||||
* cablelabs.c : CableLabs (includes SCTE) specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "cablelabs.h"
|
||||
|
||||
/**** First Loop of PMT Descriptors ****/
|
||||
/* 3D descriptor */
|
||||
void write_cablelabs_3d_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, CABLELABS_3D_MPEG2_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write1( s, 1 ); // 3d_frame_packing_data_present
|
||||
bs_write( s, 7, 0 ); // reserved
|
||||
}
|
||||
|
||||
/**** Second Loop of PMT Descriptors ****/
|
||||
/* Adaptation Descriptor */
|
||||
void write_scte_adaptation_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, SCTE_ADAPTATION_FIELD_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
}
|
||||
/*****************************************************************************
|
||||
* cablelabs.c : CableLabs (includes SCTE) specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "cablelabs.h"
|
||||
|
||||
/**** First Loop of PMT Descriptors ****/
|
||||
/* 3D descriptor */
|
||||
void write_cablelabs_3d_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, CABLELABS_3D_MPEG2_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write1( s, 1 ); // 3d_frame_packing_data_present
|
||||
bs_write( s, 7, 0 ); // reserved
|
||||
}
|
||||
|
||||
/**** Second Loop of PMT Descriptors ****/
|
||||
/* Adaptation Descriptor */
|
||||
void write_scte_adaptation_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, SCTE_ADAPTATION_FIELD_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/*****************************************************************************
|
||||
* cablelabs.h : CableLabs (includes SCTE) specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_CABLELABS_H
|
||||
#define LIBMPEGTS_CABLELABS_H
|
||||
|
||||
/* Descriptors */
|
||||
#define SCTE_ADAPTATION_FIELD_DESCRIPTOR_TAG 0x97
|
||||
#define CABLELABS_3D_MPEG2_DESCRIPTOR_TAG 0xe8
|
||||
|
||||
void write_cablelabs_3d_descriptor( bs_t *s );
|
||||
void write_scte_adaptation_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* cablelabs.h : CableLabs (includes SCTE) specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_CABLELABS_H
|
||||
#define LIBMPEGTS_CABLELABS_H
|
||||
|
||||
/* Descriptors */
|
||||
#define SCTE_ADAPTATION_FIELD_DESCRIPTOR_TAG 0x97
|
||||
#define CABLELABS_3D_MPEG2_DESCRIPTOR_TAG 0xe8
|
||||
|
||||
void write_cablelabs_3d_descriptor( bs_t *s );
|
||||
void write_scte_adaptation_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
|
|
716
common.h
716
common.h
|
@ -1,358 +1,358 @@
|
|||
/*****************************************************************************
|
||||
* common.h : common data
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_COMMON_H
|
||||
#define LIBMPEGTS_COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include "bitstream.h"
|
||||
#include "libmpegts.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Standardised Audio/Video stream_types */
|
||||
#define VIDEO_MPEG2 0x02
|
||||
#define VIDEO_AVC 0x1b
|
||||
|
||||
#define AUDIO_MPEG1 0x03
|
||||
#define AUDIO_MPEG2 0x04
|
||||
#define AUDIO_ADTS 0x0f
|
||||
#define AUDIO_LATM 0x11
|
||||
|
||||
#define PRIVATE_SECTION 0x05
|
||||
#define PRIVATE_DATA 0x06
|
||||
|
||||
#define TS_HEADER_SIZE 4
|
||||
#define TS_PACKET_SIZE 188
|
||||
#define TS_CLOCK 27000000LL
|
||||
#define TS_START 10
|
||||
|
||||
// arbitrary
|
||||
#define MAX_PROGRAMS 100
|
||||
#define MAX_STREAMS 100
|
||||
|
||||
/* DVB 40ms recommendation */
|
||||
#define PCR_MAX_RETRANS_TIME 40
|
||||
#define PAT_MAX_RETRANS_TIME 100
|
||||
|
||||
/* PIDs */
|
||||
#define PAT_PID 0x0000
|
||||
#define NIT_PID 0x0010
|
||||
#define SIT_PID 0x001f
|
||||
#define NULL_PID 0xffff
|
||||
|
||||
/* TIDs */
|
||||
#define PAT_TID 0x00
|
||||
#define PMT_TID 0x02
|
||||
#define NIT_TID 0x40
|
||||
#define SIT_TID 0x7f
|
||||
|
||||
/* NIT */
|
||||
/* ETSI TS 101 162 - Temporary Private Use
|
||||
* Used for both "Original Network ID" and "Network ID" */
|
||||
#define DEFAULT_NID 0xff01
|
||||
|
||||
/* Program and Program Element Descriptor Tags */
|
||||
#define VIDEO_STREAM_DESCRIPTOR_TAG 0x2
|
||||
#define AUDIO_STREAM_DESCRIPTOR_TAG 0x3
|
||||
#define REGISTRATION_DESCRIPTOR_TAG 0x5
|
||||
#define DATA_STREAM_ALIGNMENT_DESCRIPTOR_TAG 0x6
|
||||
#define ISO_693_LANGUAGE_DESCRIPTOR_TAG 0xa
|
||||
#define PRIVATE_DATA_DESCRIPTOR_TAG 0xe
|
||||
#define SMOOTHING_BUFFER_DESCRIPTOR_TAG 0x10
|
||||
#define AVC_DESCRIPTOR_TAG 0x28
|
||||
#define MPEG2_AAC_AUDIO_DESCRIPTOR 0x2b
|
||||
#define SVC_EXTENSION_DESCRIPTOR_TAG 0x30
|
||||
#define MVC_EXTENSION_DESCRIPTOR_TAG 0x31
|
||||
#define USER_DEFINED_DESCRIPTOR_TAG 0xc4
|
||||
|
||||
#define TB_SIZE 4096
|
||||
#define RX_SYS 1000000
|
||||
#define R_SYS_DEFAULT 80000
|
||||
|
||||
/* Macros */
|
||||
#define BOOLIFY(x) x = !!x
|
||||
#define MIN(a,b) ( (a)<(b) ? (a) : (b) )
|
||||
#define MAX(a,b) ( (a)>(b) ? (a) : (b) )
|
||||
|
||||
#define IS_VIDEO(x) ( x->stream_format == LIBMPEGTS_VIDEO_MPEG2 || x->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
|
||||
/* Internal Program & Stream Structures */
|
||||
typedef struct
|
||||
{
|
||||
int level;
|
||||
int profile;
|
||||
int frame_rate;
|
||||
} mpegvideo_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int num_channels;
|
||||
int sample_rate;
|
||||
int bits_per_sample;
|
||||
} lpcm_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int frame_rate;
|
||||
int aspect_ratio;
|
||||
} hdmv_video_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sample_rate_code;
|
||||
int bsid;
|
||||
int bit_rate_code;
|
||||
int surround_mode;
|
||||
int bsmod;
|
||||
int num_channels;
|
||||
} ts_atsc_ac3_info;
|
||||
|
||||
/* Blu-Ray DTCP */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t byte_1;
|
||||
uint8_t byte_2;
|
||||
} ts_dtcp_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* in bytes */
|
||||
int adapt_field_size;
|
||||
int pes_header_size;
|
||||
int cur_pos;
|
||||
} buffer_queue_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int buf_size; /* size of buffer */
|
||||
int cur_buf; /* current buffer fill */
|
||||
|
||||
double last_byte_removal_time;
|
||||
|
||||
buffer_queue_t queued_packets[10];
|
||||
} buffer_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int pid;
|
||||
int cc;
|
||||
int stream_format; /* internal stream format type */
|
||||
int stream_type; /* stream_type syntax element */
|
||||
int stream_id;
|
||||
|
||||
int version_number;
|
||||
|
||||
int64_t last_pkt_pcr;
|
||||
|
||||
/* Stream contexts */
|
||||
mpegvideo_stream_ctx_t *mpegvideo_ctx;
|
||||
lpcm_stream_ctx_t *lpcm_ctx;
|
||||
ts_atsc_ac3_info *atsc_ac3_ctx;
|
||||
|
||||
int num_dvb_sub;
|
||||
ts_dvb_sub_t *dvb_sub_ctx;
|
||||
|
||||
int num_dvb_ttx;
|
||||
ts_dvb_ttx_t *dvb_ttx_ctx;
|
||||
|
||||
int num_dvb_vbi;
|
||||
ts_dvb_vbi_t *dvb_vbi_ctx;
|
||||
|
||||
int num_channels;
|
||||
int max_frame_size;
|
||||
|
||||
/* T_STD */
|
||||
buffer_t tb; /* transport buffer */
|
||||
int rx; /* flow from transport to multiplex buffer (video) or main buffer (audio) */
|
||||
buffer_t mb; /* multiplex buffer (video) or main buffer (audio) */
|
||||
buffer_t eb; /* elementary buffer */
|
||||
int rbx; /* flow from multiplex to elementary buffer (video) */
|
||||
|
||||
/* Language Codes */
|
||||
int write_lang_code;
|
||||
char lang_code[4];
|
||||
int audio_type;
|
||||
|
||||
/* AAC */
|
||||
int aac_is_mpeg4;
|
||||
int aac_profile;
|
||||
int aac_channel_map;
|
||||
|
||||
/* ATSC */
|
||||
|
||||
/* DVB */
|
||||
/* Stream Identifier */
|
||||
int has_stream_identifier;
|
||||
int stream_identifier;
|
||||
|
||||
/* DVB AU_Information */
|
||||
int dvb_au;
|
||||
int dvb_au_frame_rate;
|
||||
|
||||
/* ISDB */
|
||||
|
||||
/* CableLabs */
|
||||
|
||||
/* Blu-Ray */
|
||||
int hdmv_video_format;
|
||||
int hdmv_frame_rate;
|
||||
int hdmv_aspect_ratio;
|
||||
} ts_int_stream_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *data;
|
||||
int size;
|
||||
uint8_t *cur_pos;
|
||||
int bytes_left;
|
||||
|
||||
/* stream context associated with pes */
|
||||
ts_int_stream_t *stream;
|
||||
|
||||
int header_size;
|
||||
int random_access;
|
||||
int priority;
|
||||
|
||||
int64_t cpb_initial_arrival_time;
|
||||
int64_t cpb_final_arrival_time;
|
||||
int64_t dts;
|
||||
int64_t pts;
|
||||
|
||||
/* DVB AU_Information specific fields */
|
||||
uint8_t frame_type;
|
||||
int ref_pic_idc;
|
||||
int write_pulldown_info;
|
||||
int pic_struct;
|
||||
} ts_int_pes_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ts_int_stream_t pmt;
|
||||
int program_num;
|
||||
|
||||
int num_queued_pmt;
|
||||
uint8_t **pmt_packets;
|
||||
|
||||
int num_streams;
|
||||
ts_int_stream_t *streams[MAX_STREAMS];
|
||||
ts_int_stream_t *pcr_stream;
|
||||
|
||||
int pmt_version;
|
||||
|
||||
uint64_t last_pcr;
|
||||
|
||||
int64_t video_dts;
|
||||
|
||||
//sdt_program_ctx_t *sdt_ctx;
|
||||
int is_3dtv;
|
||||
|
||||
int sb_leak_rate;
|
||||
int sb_size;
|
||||
} ts_int_program_t;
|
||||
|
||||
struct ts_writer_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
int i_bitstream;
|
||||
uint8_t *p_bitstream;
|
||||
bs_t bs;
|
||||
} out;
|
||||
|
||||
uint64_t bytes_written;
|
||||
uint64_t packets_written;
|
||||
|
||||
int ts_type;
|
||||
int ts_id;
|
||||
|
||||
int cbr;
|
||||
int ts_muxrate;
|
||||
|
||||
int pat_cc;
|
||||
|
||||
int num_programs;
|
||||
ts_int_program_t *programs[MAX_PROGRAMS];
|
||||
|
||||
int pat_period;
|
||||
int pcr_period;
|
||||
int first_input;
|
||||
|
||||
int pat_version;
|
||||
|
||||
int network_pid;
|
||||
int network_id;
|
||||
|
||||
int num_buffered_frames;
|
||||
ts_int_pes_t **buffered_frames;
|
||||
|
||||
int num_pcrs;
|
||||
int pcr_list_alloced;
|
||||
int64_t *pcr_list;
|
||||
|
||||
/* system control */
|
||||
buffer_t tb; /* transport buffer */
|
||||
buffer_t main_b; /* main buffer */
|
||||
|
||||
int rx_sys; /* flow from transport to main buffer */
|
||||
int r_sys; /* flow from main buffer to system decoder */
|
||||
|
||||
/* CableLabs */
|
||||
int legacy_constraints;
|
||||
|
||||
/* DVB-specific */
|
||||
ts_int_stream_t *nit;
|
||||
ts_int_stream_t *sdt;
|
||||
ts_int_stream_t *eit;
|
||||
ts_int_stream_t *tdt;
|
||||
ts_int_stream_t *sit;
|
||||
|
||||
uint64_t last_pat;
|
||||
uint64_t last_pmt;
|
||||
uint64_t last_nit;
|
||||
uint64_t last_sdt;
|
||||
uint64_t last_eit;
|
||||
uint64_t last_tdt;
|
||||
uint64_t last_sit;
|
||||
|
||||
ts_dtcp_t *dtcp_ctx;
|
||||
};
|
||||
|
||||
enum adaptation_field_control_e
|
||||
{
|
||||
PAYLOAD_ONLY = 1,
|
||||
ADAPT_FIELD_ONLY = 2,
|
||||
ADAPT_FIELD_AND_PAYLOAD = 3,
|
||||
};
|
||||
|
||||
void write_bytes( bs_t *s, uint8_t *bytes, int length );
|
||||
void write_packet_header( ts_writer_t *w, bs_t *s, int start, int pid, int adapt_field, int *cc );
|
||||
void write_registration_descriptor( bs_t *s, int descriptor_tag, int descriptor_length, char *format_id );
|
||||
void write_crc( bs_t *s, int start );
|
||||
int write_padding( bs_t *s, int start );
|
||||
int increase_pcr( ts_writer_t *w, int num_packets, int imaginary );
|
||||
ts_int_stream_t *find_stream( ts_writer_t *w, int pid );
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* common.h : common data
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_COMMON_H
|
||||
#define LIBMPEGTS_COMMON_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#include "bitstream.h"
|
||||
#include "libmpegts.h"
|
||||
#include <string.h>
|
||||
|
||||
/* Standardised Audio/Video stream_types */
|
||||
#define VIDEO_MPEG2 0x02
|
||||
#define VIDEO_AVC 0x1b
|
||||
|
||||
#define AUDIO_MPEG1 0x03
|
||||
#define AUDIO_MPEG2 0x04
|
||||
#define AUDIO_ADTS 0x0f
|
||||
#define AUDIO_LATM 0x11
|
||||
|
||||
#define PRIVATE_SECTION 0x05
|
||||
#define PRIVATE_DATA 0x06
|
||||
|
||||
#define TS_HEADER_SIZE 4
|
||||
#define TS_PACKET_SIZE 188
|
||||
#define TS_CLOCK 27000000LL
|
||||
#define TS_START 10
|
||||
|
||||
// arbitrary
|
||||
#define MAX_PROGRAMS 100
|
||||
#define MAX_STREAMS 100
|
||||
|
||||
/* DVB 40ms recommendation */
|
||||
#define PCR_MAX_RETRANS_TIME 40
|
||||
#define PAT_MAX_RETRANS_TIME 100
|
||||
|
||||
/* PIDs */
|
||||
#define PAT_PID 0x0000
|
||||
#define NIT_PID 0x0010
|
||||
#define SIT_PID 0x001f
|
||||
#define NULL_PID 0xffff
|
||||
|
||||
/* TIDs */
|
||||
#define PAT_TID 0x00
|
||||
#define PMT_TID 0x02
|
||||
#define NIT_TID 0x40
|
||||
#define SIT_TID 0x7f
|
||||
|
||||
/* NIT */
|
||||
/* ETSI TS 101 162 - Temporary Private Use
|
||||
* Used for both "Original Network ID" and "Network ID" */
|
||||
#define DEFAULT_NID 0xff01
|
||||
|
||||
/* Program and Program Element Descriptor Tags */
|
||||
#define VIDEO_STREAM_DESCRIPTOR_TAG 0x2
|
||||
#define AUDIO_STREAM_DESCRIPTOR_TAG 0x3
|
||||
#define REGISTRATION_DESCRIPTOR_TAG 0x5
|
||||
#define DATA_STREAM_ALIGNMENT_DESCRIPTOR_TAG 0x6
|
||||
#define ISO_693_LANGUAGE_DESCRIPTOR_TAG 0xa
|
||||
#define PRIVATE_DATA_DESCRIPTOR_TAG 0xe
|
||||
#define SMOOTHING_BUFFER_DESCRIPTOR_TAG 0x10
|
||||
#define AVC_DESCRIPTOR_TAG 0x28
|
||||
#define MPEG2_AAC_AUDIO_DESCRIPTOR 0x2b
|
||||
#define SVC_EXTENSION_DESCRIPTOR_TAG 0x30
|
||||
#define MVC_EXTENSION_DESCRIPTOR_TAG 0x31
|
||||
#define USER_DEFINED_DESCRIPTOR_TAG 0xc4
|
||||
|
||||
#define TB_SIZE 4096
|
||||
#define RX_SYS 1000000
|
||||
#define R_SYS_DEFAULT 80000
|
||||
|
||||
/* Macros */
|
||||
#define BOOLIFY(x) x = !!x
|
||||
#define MIN(a,b) ( (a)<(b) ? (a) : (b) )
|
||||
#define MAX(a,b) ( (a)>(b) ? (a) : (b) )
|
||||
|
||||
#define IS_VIDEO(x) ( x->stream_format == LIBMPEGTS_VIDEO_MPEG2 || x->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
|
||||
/* Internal Program & Stream Structures */
|
||||
typedef struct
|
||||
{
|
||||
int level;
|
||||
int profile;
|
||||
int frame_rate;
|
||||
} mpegvideo_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int num_channels;
|
||||
int sample_rate;
|
||||
int bits_per_sample;
|
||||
} lpcm_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int frame_rate;
|
||||
int aspect_ratio;
|
||||
} hdmv_video_stream_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sample_rate_code;
|
||||
int bsid;
|
||||
int bit_rate_code;
|
||||
int surround_mode;
|
||||
int bsmod;
|
||||
int num_channels;
|
||||
} ts_atsc_ac3_info;
|
||||
|
||||
/* Blu-Ray DTCP */
|
||||
typedef struct
|
||||
{
|
||||
uint8_t byte_1;
|
||||
uint8_t byte_2;
|
||||
} ts_dtcp_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* in bytes */
|
||||
int adapt_field_size;
|
||||
int pes_header_size;
|
||||
int cur_pos;
|
||||
} buffer_queue_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int buf_size; /* size of buffer */
|
||||
int cur_buf; /* current buffer fill */
|
||||
|
||||
double last_byte_removal_time;
|
||||
|
||||
buffer_queue_t queued_packets[10];
|
||||
} buffer_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int pid;
|
||||
int cc;
|
||||
int stream_format; /* internal stream format type */
|
||||
int stream_type; /* stream_type syntax element */
|
||||
int stream_id;
|
||||
|
||||
int version_number;
|
||||
|
||||
int64_t last_pkt_pcr;
|
||||
|
||||
/* Stream contexts */
|
||||
mpegvideo_stream_ctx_t *mpegvideo_ctx;
|
||||
lpcm_stream_ctx_t *lpcm_ctx;
|
||||
ts_atsc_ac3_info *atsc_ac3_ctx;
|
||||
|
||||
int num_dvb_sub;
|
||||
ts_dvb_sub_t *dvb_sub_ctx;
|
||||
|
||||
int num_dvb_ttx;
|
||||
ts_dvb_ttx_t *dvb_ttx_ctx;
|
||||
|
||||
int num_dvb_vbi;
|
||||
ts_dvb_vbi_t *dvb_vbi_ctx;
|
||||
|
||||
int num_channels;
|
||||
int max_frame_size;
|
||||
|
||||
/* T_STD */
|
||||
buffer_t tb; /* transport buffer */
|
||||
int rx; /* flow from transport to multiplex buffer (video) or main buffer (audio) */
|
||||
buffer_t mb; /* multiplex buffer (video) or main buffer (audio) */
|
||||
buffer_t eb; /* elementary buffer */
|
||||
int rbx; /* flow from multiplex to elementary buffer (video) */
|
||||
|
||||
/* Language Codes */
|
||||
int write_lang_code;
|
||||
char lang_code[4];
|
||||
int audio_type;
|
||||
|
||||
/* AAC */
|
||||
int aac_is_mpeg4;
|
||||
int aac_profile;
|
||||
int aac_channel_map;
|
||||
|
||||
/* ATSC */
|
||||
|
||||
/* DVB */
|
||||
/* Stream Identifier */
|
||||
int has_stream_identifier;
|
||||
int stream_identifier;
|
||||
|
||||
/* DVB AU_Information */
|
||||
int dvb_au;
|
||||
int dvb_au_frame_rate;
|
||||
|
||||
/* ISDB */
|
||||
|
||||
/* CableLabs */
|
||||
|
||||
/* Blu-Ray */
|
||||
int hdmv_video_format;
|
||||
int hdmv_frame_rate;
|
||||
int hdmv_aspect_ratio;
|
||||
} ts_int_stream_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t *data;
|
||||
int size;
|
||||
uint8_t *cur_pos;
|
||||
int bytes_left;
|
||||
|
||||
/* stream context associated with pes */
|
||||
ts_int_stream_t *stream;
|
||||
|
||||
int header_size;
|
||||
int random_access;
|
||||
int priority;
|
||||
|
||||
int64_t cpb_initial_arrival_time;
|
||||
int64_t cpb_final_arrival_time;
|
||||
int64_t dts;
|
||||
int64_t pts;
|
||||
|
||||
/* DVB AU_Information specific fields */
|
||||
uint8_t frame_type;
|
||||
int ref_pic_idc;
|
||||
int write_pulldown_info;
|
||||
int pic_struct;
|
||||
} ts_int_pes_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ts_int_stream_t pmt;
|
||||
int program_num;
|
||||
|
||||
int num_queued_pmt;
|
||||
uint8_t **pmt_packets;
|
||||
|
||||
int num_streams;
|
||||
ts_int_stream_t *streams[MAX_STREAMS];
|
||||
ts_int_stream_t *pcr_stream;
|
||||
|
||||
int pmt_version;
|
||||
|
||||
uint64_t last_pcr;
|
||||
|
||||
int64_t video_dts;
|
||||
|
||||
//sdt_program_ctx_t *sdt_ctx;
|
||||
int is_3dtv;
|
||||
|
||||
int sb_leak_rate;
|
||||
int sb_size;
|
||||
} ts_int_program_t;
|
||||
|
||||
struct ts_writer_t
|
||||
{
|
||||
struct
|
||||
{
|
||||
int i_bitstream;
|
||||
uint8_t *p_bitstream;
|
||||
bs_t bs;
|
||||
} out;
|
||||
|
||||
uint64_t bytes_written;
|
||||
uint64_t packets_written;
|
||||
|
||||
int ts_type;
|
||||
int ts_id;
|
||||
|
||||
int cbr;
|
||||
int ts_muxrate;
|
||||
|
||||
int pat_cc;
|
||||
|
||||
int num_programs;
|
||||
ts_int_program_t *programs[MAX_PROGRAMS];
|
||||
|
||||
int pat_period;
|
||||
int pcr_period;
|
||||
int first_input;
|
||||
|
||||
int pat_version;
|
||||
|
||||
int network_pid;
|
||||
int network_id;
|
||||
|
||||
int num_buffered_frames;
|
||||
ts_int_pes_t **buffered_frames;
|
||||
|
||||
int num_pcrs;
|
||||
int pcr_list_alloced;
|
||||
int64_t *pcr_list;
|
||||
|
||||
/* system control */
|
||||
buffer_t tb; /* transport buffer */
|
||||
buffer_t main_b; /* main buffer */
|
||||
|
||||
int rx_sys; /* flow from transport to main buffer */
|
||||
int r_sys; /* flow from main buffer to system decoder */
|
||||
|
||||
/* CableLabs */
|
||||
int legacy_constraints;
|
||||
|
||||
/* DVB-specific */
|
||||
ts_int_stream_t *nit;
|
||||
ts_int_stream_t *sdt;
|
||||
ts_int_stream_t *eit;
|
||||
ts_int_stream_t *tdt;
|
||||
ts_int_stream_t *sit;
|
||||
|
||||
uint64_t last_pat;
|
||||
uint64_t last_pmt;
|
||||
uint64_t last_nit;
|
||||
uint64_t last_sdt;
|
||||
uint64_t last_eit;
|
||||
uint64_t last_tdt;
|
||||
uint64_t last_sit;
|
||||
|
||||
ts_dtcp_t *dtcp_ctx;
|
||||
};
|
||||
|
||||
enum adaptation_field_control_e
|
||||
{
|
||||
PAYLOAD_ONLY = 1,
|
||||
ADAPT_FIELD_ONLY = 2,
|
||||
ADAPT_FIELD_AND_PAYLOAD = 3,
|
||||
};
|
||||
|
||||
void write_bytes( bs_t *s, uint8_t *bytes, int length );
|
||||
void write_packet_header( ts_writer_t *w, bs_t *s, int start, int pid, int adapt_field, int *cc );
|
||||
void write_registration_descriptor( bs_t *s, int descriptor_tag, int descriptor_length, char *format_id );
|
||||
void write_crc( bs_t *s, int start );
|
||||
int write_padding( bs_t *s, int start );
|
||||
int increase_pcr( ts_writer_t *w, int num_packets, int imaginary );
|
||||
ts_int_stream_t *find_stream( ts_writer_t *w, int pid );
|
||||
|
||||
#endif
|
||||
|
|
780
dvb/dvb.c
780
dvb/dvb.c
|
@ -1,390 +1,390 @@
|
|||
/*****************************************************************************
|
||||
* dvb.c : DVB functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "dvb.h"
|
||||
|
||||
/**** PMT Second Loop Descriptors ****/
|
||||
void write_aac_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
bs_write( s, 8, DVB_AAC_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, stream->aac_profile ); // profile_and_level
|
||||
}
|
||||
|
||||
void write_adaptation_field_data_descriptor( bs_t *s, uint8_t identifier )
|
||||
{
|
||||
bs_write( s, 8, DVB_ADAPTATION_FIELD_DATA_DESCRIPTOR ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, identifier ); // adaptation_field_data_identifier
|
||||
}
|
||||
|
||||
void write_dvb_subtitling_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
ts_dvb_sub_t *subtitle;
|
||||
|
||||
bs_write( s, 8, DVB_SUBTITLING_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, stream->num_dvb_sub * 8 ); // descriptor_length
|
||||
for( int i = 0; i < stream->num_dvb_sub; i++ )
|
||||
{
|
||||
subtitle = &stream->dvb_sub_ctx[i];
|
||||
for( int j = 0; j < 3; j++ )
|
||||
bs_write( s, 8, subtitle->lang_code[j] ); // ISO_639_language_code
|
||||
bs_write( s, 8, subtitle->subtitling_type ); // subtitling_type
|
||||
bs_write( s, 16, subtitle->composition_page_id ); // composition_page_id
|
||||
bs_write( s, 16, subtitle->ancillary_page_id ); // ancillary_page_id
|
||||
}
|
||||
}
|
||||
|
||||
void write_stream_identifier_descriptor( bs_t *s, uint8_t stream_identifier )
|
||||
{
|
||||
bs_write( s, 8, DVB_STREAM_IDENTIFIER_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, stream_identifier ); // component_tag
|
||||
}
|
||||
|
||||
void write_teletext_descriptor( bs_t *s, ts_int_stream_t *stream, int vbi )
|
||||
{
|
||||
ts_dvb_ttx_t *teletext;
|
||||
|
||||
if( vbi )
|
||||
bs_write( s, 8, DVB_VBI_TELETEXT_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
else
|
||||
bs_write( s, 8, DVB_TELETEXT_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
|
||||
bs_write( s, 8, stream->num_dvb_ttx * 5 ); // descriptor_length
|
||||
for( int i = 0; i < stream->num_dvb_ttx; i++ )
|
||||
{
|
||||
teletext = &stream->dvb_ttx_ctx[i];
|
||||
for( int j = 0; j < 3; j++ )
|
||||
bs_write( s, 8, teletext->lang_code[j] ); // ISO_639_language_code
|
||||
bs_write( s, 5, teletext->teletext_type ); // teletext_type
|
||||
bs_write( s, 3, teletext->teletext_magazine_number ); // teletext_magazine_number
|
||||
bs_write( s, 8, teletext->teletext_page_number ); // teletext_page_number
|
||||
}
|
||||
}
|
||||
|
||||
void write_vbi_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
bs_t q;
|
||||
uint8_t temp[1024];
|
||||
ts_dvb_vbi_t *vbi;
|
||||
|
||||
bs_init( &q, temp, 1024 );
|
||||
|
||||
bs_write( s, 8, DVB_VBI_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
|
||||
for( int i = 0; i < stream->num_dvb_vbi; i++ )
|
||||
{
|
||||
vbi = &stream->dvb_vbi_ctx[i];
|
||||
|
||||
bs_write( &q, 8, vbi->data_service_id ); // data_service_id
|
||||
bs_write( &q, 8, vbi->num_lines ); // data_service_descriptor_length
|
||||
|
||||
for( int j = 0; j < vbi->num_lines; j++ )
|
||||
{
|
||||
bs_write( &q, 2, 0x3 ); // reserved
|
||||
bs_write( &q, 1, vbi->lines[j].field_parity ); // field_parity
|
||||
bs_write( &q, 5, vbi->lines[j].line_offset ); // line_offset
|
||||
}
|
||||
}
|
||||
|
||||
bs_flush( &q );
|
||||
bs_write( s, 8, bs_pos( &q ) >> 3 ); // descriptor_length
|
||||
write_bytes( s, temp, bs_pos( &q ) >> 3 );
|
||||
}
|
||||
|
||||
/*
|
||||
static void write_service_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, DVB_SERVICE_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
bs_write( s, 8, 0 ); // service_type
|
||||
bs_write( s, 8, 0 ); // service_provider_name_length
|
||||
|
||||
// TODO support more character codes
|
||||
while( *provider_name != '\0' )
|
||||
bs_write( s, 8, *provider_name++ );
|
||||
|
||||
bs_write( s, 8, name_len ); // service_name_length
|
||||
|
||||
while( *name != '\0' )
|
||||
bs_write( s, 8, *name++ );
|
||||
}
|
||||
*/
|
||||
|
||||
/* DVB Service Information */
|
||||
int write_nit( ts_writer_t *w )
|
||||
{
|
||||
int start;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, w->network_pid, PAYLOAD_ONLY, &w->nit->cc );
|
||||
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, NIT_TID ); // table_id = network_information_section
|
||||
bs_write1( s, 1 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 12, 0x13 ); // section_length
|
||||
bs_write( s, 16, w->network_id ); // network_id
|
||||
bs_write( s, 2, 0x02 ); // reserved
|
||||
bs_write( s, 5, 0 ); // version_number
|
||||
bs_write1( s, 1 ); // current_next_indicator
|
||||
bs_write(s, 8, 0 ); // section_number
|
||||
bs_write(s, 8, 0 ); // last_section_number
|
||||
bs_write(s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // network_descriptors_length
|
||||
|
||||
// network descriptor(s) here
|
||||
|
||||
bs_write(s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // transport_stream_loop_length
|
||||
|
||||
bs_write( s, 16, w->ts_id ); // transport_stream_id
|
||||
bs_write( s, 16, w->network_id ); // original_network_id
|
||||
bs_write( s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // transport_descriptors_length
|
||||
|
||||
// transport descriptor(s) here
|
||||
|
||||
bs_flush( s );
|
||||
write_crc( s, start );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
if( increase_pcr( w, 1, 0 ) < 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
/* "The SDT contains data describing the services in the system e.g. names of services, the service provider, etc" */
|
||||
void write_sdt( ts_writer_t *w )
|
||||
{
|
||||
uint64_t start;
|
||||
int i;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, SDT_PID, PAYLOAD_ONLY, &w->sdt->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, SDT_TID ); // table_id
|
||||
bs_write1( s, 1 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write1( s, 1 ); // reserved
|
||||
|
||||
// TODO temp
|
||||
|
||||
bs_write( s, 12, len ); // section_length
|
||||
bs_write( s, 16, w->ts_id ); // transport_stream_id
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 5, 0 ); // version_number
|
||||
bs_write1( s, 1 ); // current_next_indicator
|
||||
bs_write( s, 8, 0 ); // section_number
|
||||
bs_write( s, 8, 0 ); // last_section_number
|
||||
bs_write( s, 8, w->nid ); // original_network_id
|
||||
bs_write( s, 8, 0xff ); // reserved_future_use
|
||||
|
||||
for( i = 0; i < w->num_programs; i++ )
|
||||
{
|
||||
bs_write( s, 16, w->programs[i]->program_num & 0xffff ); // service_id (equivalent to program_number)
|
||||
bs_write( s, 6, 0x7f ); // reserved_future_use
|
||||
bs_write1( s, 0 ); // EIT_schedule_flag
|
||||
bs_write1( s, 1 ); // EIT_present_following_flag
|
||||
bs_write( s, 3, 0 ); // running_status
|
||||
bs_write1( s, 1 ); // free_CA_mode
|
||||
|
||||
int provider_name_len = strlen( w->programs[i]->sdt_ctx->provider_name );
|
||||
int name_len = strlen( w->programs[i]->sdt_ctx->service_name );
|
||||
|
||||
char *provider_name = w->programs[i]->sdt_ctx->provider_name;
|
||||
char *name = w->programs[i]->sdt_ctx->service_name;
|
||||
|
||||
int descriptors_len = 5 + provider_name_len + name_len;
|
||||
bs_write( s, 12, descriptors_len ); // descriptors_loop_length
|
||||
|
||||
// service descriptor (mandatory for DVB)
|
||||
|
||||
|
||||
// other descriptor(s) here
|
||||
}
|
||||
|
||||
bs_flush( s );
|
||||
write_crc( s, start );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
increase_pcr( w, 1 );
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
// FIXME
|
||||
// "the EIT contains data concerning events or programmes such as event name, start time, duration, etc.; "
|
||||
void write_eit( ts_writer_t *w )
|
||||
{
|
||||
uint64_t start;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, EIT_PID, PAYLOAD_ONLY, &w->eit->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, EIT_TID ); // table_id
|
||||
bs_write1( s, 0 ); // section_syntax_indicator CHECKME
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03); // reserved
|
||||
|
||||
|
||||
bs_write( s, 12, len ); // section_length
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static void write_utc_time( bs_t *s )
|
||||
{
|
||||
int l, mjd;
|
||||
time_t cur_time;
|
||||
struct tm *now;
|
||||
|
||||
/* MJD conversions in Annex C of ETSI EN 300 468 */
|
||||
cur_time = time( NULL );
|
||||
now = gmtime( &cur_time );
|
||||
|
||||
l = ( ( now->tm_mon + 1 == 1 ) || ( now->tm_mon + 1 == 2 ) ) ? 1 : 0;
|
||||
mjd = 14956 + now->tm_mday + (int)((now->tm_year - l) * 365.25) + (int)((now->tm_mon + 1 + 1 + l * 12) * 30.6001);
|
||||
|
||||
bs_write( s, 8, mjd >> 8 );
|
||||
bs_write( s, 8, mjd & 0xff );
|
||||
bs_write( s, 8, (now->tm_hour / 10) << 4 | (now->tm_hour % 10) ); // hours
|
||||
bs_write( s, 8, (now->tm_min / 10) << 4 | (now->tm_min % 10) ); // minutes
|
||||
bs_write( s, 8, (now->tm_sec / 10) << 4 | (now->tm_sec % 10) ); // seconds
|
||||
}
|
||||
|
||||
int write_tdt( ts_writer_t *w )
|
||||
{
|
||||
int start;
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, TDT_PID, PAYLOAD_ONLY, &w->tdt->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, TDT_TID ); // table_id
|
||||
bs_write1( s, 0 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 12, 0x05 ); // section_length
|
||||
|
||||
write_utc_time( s );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
|
||||
if( increase_pcr( w, 1, 0 ) < 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO TOT
|
||||
|
||||
void write_dvb_au_information( bs_t *s, ts_int_pes_t *pes )
|
||||
{
|
||||
bs_t q;
|
||||
uint8_t temp[128];
|
||||
|
||||
ts_int_stream_t *stream = pes->stream;
|
||||
|
||||
bs_write( s, 8, AU_INFORMATION_DATA_FIELD ); // data_field_tag
|
||||
bs_init( &q, temp, 128 );
|
||||
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_MPEG2 )
|
||||
bs_write( &q, 4, 1 ); // AU_coding_format
|
||||
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
bs_write( &q, 4, 0x2 ); // AU_coding_format
|
||||
|
||||
bs_write( &q, 4, pes->frame_type ); // AU_coding_type_information
|
||||
bs_write( &q, 2, pes->ref_pic_idc ); // AU_ref_pic_idc
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_MPEG2 )
|
||||
bs_write( &q, 2, pes->pic_struct ); // AU_pic_struct
|
||||
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
bs_write( &q, 2, 0 ); // AU_coding_format
|
||||
|
||||
bs_write1( &q, 1 ); // AU_PTS_present_flag
|
||||
bs_write1( &q, 1 ); // AU_profile_info_present_flag
|
||||
bs_write1( &q, 1 ); // AU_stream_info_present_flag
|
||||
bs_write1( &q, 0 ); // AU_trick_mode_info_present_flag
|
||||
|
||||
bs_write32( &q, (pes->pts * 300) & 0xffffffff ); // AU_PTS_32
|
||||
|
||||
bs_write( &q, 4, 0 ); // reserved
|
||||
bs_write( &q, 4, stream->dvb_au_frame_rate ); // AU_frame_rate_code
|
||||
|
||||
bs_write( &q, 8, stream->mpegvideo_ctx->profile & 0xff ); // profile_idc
|
||||
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
{
|
||||
bs_write1( &q, stream->mpegvideo_ctx->profile == AVC_BASELINE ); // constraint_set0_flag
|
||||
bs_write1( &q, stream->mpegvideo_ctx->profile <= AVC_MAIN ); // constraint_set1_flag
|
||||
bs_write1( &q, 0 ); // constraint_set2_flag
|
||||
if( stream->mpegvideo_ctx->level == 9 && stream->mpegvideo_ctx->profile <= AVC_MAIN ) // level 1b
|
||||
bs_write1( &q, 1 ); // constraint_set3_flag
|
||||
else if( stream->mpegvideo_ctx->profile == AVC_HIGH_10_INTRA ||
|
||||
stream->mpegvideo_ctx->profile == AVC_CAVLC_444_INTRA ||
|
||||
stream->mpegvideo_ctx->profile == AVC_HIGH_444_INTRA )
|
||||
bs_write1( &q, 1 ); // constraint_set3_flag
|
||||
else
|
||||
bs_write1( &q, 0 ); // constraint_set3_flag
|
||||
bs_write1( &q, 0 ); // constraint_set4_flag
|
||||
bs_write1( &q, 0 ); // constraint_set5_flag
|
||||
}
|
||||
else
|
||||
bs_write( &q, 5, 0 );
|
||||
|
||||
bs_write( &q, 2, 0 ); // AU_AVC_compatible_flags
|
||||
bs_write( &q, 8, stream->mpegvideo_ctx->level & 0xff ); // level_idc
|
||||
|
||||
if( pes->write_pulldown_info )
|
||||
{
|
||||
bs_write1( &q, 1 ); // AU_Pulldown_info_present_flag
|
||||
bs_write( &q, 6, 0 ); // AU_reserved_zero
|
||||
bs_write1( &q, 0 ); // AU_flags_extension_1
|
||||
|
||||
bs_write( &q, 4, 0 ); // AU_reserved_zero
|
||||
bs_write( &q, 4, pes->pic_struct & 0xf ); // AU_Pulldown_info
|
||||
}
|
||||
|
||||
/* reserved bytes */
|
||||
|
||||
bs_flush( &q );
|
||||
bs_write( s, 8, bs_pos( &q ) >> 3 ); // data_field_length
|
||||
write_bytes( s, temp, bs_pos( &q ) >> 3 );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* dvb.c : DVB functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "../common.h"
|
||||
#include "dvb.h"
|
||||
|
||||
/**** PMT Second Loop Descriptors ****/
|
||||
void write_aac_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
bs_write( s, 8, DVB_AAC_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, stream->aac_profile ); // profile_and_level
|
||||
}
|
||||
|
||||
void write_adaptation_field_data_descriptor( bs_t *s, uint8_t identifier )
|
||||
{
|
||||
bs_write( s, 8, DVB_ADAPTATION_FIELD_DATA_DESCRIPTOR ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, identifier ); // adaptation_field_data_identifier
|
||||
}
|
||||
|
||||
void write_dvb_subtitling_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
ts_dvb_sub_t *subtitle;
|
||||
|
||||
bs_write( s, 8, DVB_SUBTITLING_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, stream->num_dvb_sub * 8 ); // descriptor_length
|
||||
for( int i = 0; i < stream->num_dvb_sub; i++ )
|
||||
{
|
||||
subtitle = &stream->dvb_sub_ctx[i];
|
||||
for( int j = 0; j < 3; j++ )
|
||||
bs_write( s, 8, subtitle->lang_code[j] ); // ISO_639_language_code
|
||||
bs_write( s, 8, subtitle->subtitling_type ); // subtitling_type
|
||||
bs_write( s, 16, subtitle->composition_page_id ); // composition_page_id
|
||||
bs_write( s, 16, subtitle->ancillary_page_id ); // ancillary_page_id
|
||||
}
|
||||
}
|
||||
|
||||
void write_stream_identifier_descriptor( bs_t *s, uint8_t stream_identifier )
|
||||
{
|
||||
bs_write( s, 8, DVB_STREAM_IDENTIFIER_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 1 ); // descriptor_length
|
||||
bs_write( s, 8, stream_identifier ); // component_tag
|
||||
}
|
||||
|
||||
void write_teletext_descriptor( bs_t *s, ts_int_stream_t *stream, int vbi )
|
||||
{
|
||||
ts_dvb_ttx_t *teletext;
|
||||
|
||||
if( vbi )
|
||||
bs_write( s, 8, DVB_VBI_TELETEXT_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
else
|
||||
bs_write( s, 8, DVB_TELETEXT_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
|
||||
bs_write( s, 8, stream->num_dvb_ttx * 5 ); // descriptor_length
|
||||
for( int i = 0; i < stream->num_dvb_ttx; i++ )
|
||||
{
|
||||
teletext = &stream->dvb_ttx_ctx[i];
|
||||
for( int j = 0; j < 3; j++ )
|
||||
bs_write( s, 8, teletext->lang_code[j] ); // ISO_639_language_code
|
||||
bs_write( s, 5, teletext->teletext_type ); // teletext_type
|
||||
bs_write( s, 3, teletext->teletext_magazine_number ); // teletext_magazine_number
|
||||
bs_write( s, 8, teletext->teletext_page_number ); // teletext_page_number
|
||||
}
|
||||
}
|
||||
|
||||
void write_vbi_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
bs_t q;
|
||||
uint8_t temp[1024];
|
||||
ts_dvb_vbi_t *vbi;
|
||||
|
||||
bs_init( &q, temp, 1024 );
|
||||
|
||||
bs_write( s, 8, DVB_VBI_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
|
||||
for( int i = 0; i < stream->num_dvb_vbi; i++ )
|
||||
{
|
||||
vbi = &stream->dvb_vbi_ctx[i];
|
||||
|
||||
bs_write( &q, 8, vbi->data_service_id ); // data_service_id
|
||||
bs_write( &q, 8, vbi->num_lines ); // data_service_descriptor_length
|
||||
|
||||
for( int j = 0; j < vbi->num_lines; j++ )
|
||||
{
|
||||
bs_write( &q, 2, 0x3 ); // reserved
|
||||
bs_write( &q, 1, vbi->lines[j].field_parity ); // field_parity
|
||||
bs_write( &q, 5, vbi->lines[j].line_offset ); // line_offset
|
||||
}
|
||||
}
|
||||
|
||||
bs_flush( &q );
|
||||
bs_write( s, 8, bs_pos( &q ) >> 3 ); // descriptor_length
|
||||
write_bytes( s, temp, bs_pos( &q ) >> 3 );
|
||||
}
|
||||
|
||||
/*
|
||||
static void write_service_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, DVB_SERVICE_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
bs_write( s, 8, 0 ); // service_type
|
||||
bs_write( s, 8, 0 ); // service_provider_name_length
|
||||
|
||||
// TODO support more character codes
|
||||
while( *provider_name != '\0' )
|
||||
bs_write( s, 8, *provider_name++ );
|
||||
|
||||
bs_write( s, 8, name_len ); // service_name_length
|
||||
|
||||
while( *name != '\0' )
|
||||
bs_write( s, 8, *name++ );
|
||||
}
|
||||
*/
|
||||
|
||||
/* DVB Service Information */
|
||||
int write_nit( ts_writer_t *w )
|
||||
{
|
||||
int start;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, w->network_pid, PAYLOAD_ONLY, &w->nit->cc );
|
||||
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, NIT_TID ); // table_id = network_information_section
|
||||
bs_write1( s, 1 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 12, 0x13 ); // section_length
|
||||
bs_write( s, 16, w->network_id ); // network_id
|
||||
bs_write( s, 2, 0x02 ); // reserved
|
||||
bs_write( s, 5, 0 ); // version_number
|
||||
bs_write1( s, 1 ); // current_next_indicator
|
||||
bs_write(s, 8, 0 ); // section_number
|
||||
bs_write(s, 8, 0 ); // last_section_number
|
||||
bs_write(s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // network_descriptors_length
|
||||
|
||||
// network descriptor(s) here
|
||||
|
||||
bs_write(s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // transport_stream_loop_length
|
||||
|
||||
bs_write( s, 16, w->ts_id ); // transport_stream_id
|
||||
bs_write( s, 16, w->network_id ); // original_network_id
|
||||
bs_write( s, 4, 0xf ); // reserved_future_use
|
||||
bs_write(s, 12, 0 ); // transport_descriptors_length
|
||||
|
||||
// transport descriptor(s) here
|
||||
|
||||
bs_flush( s );
|
||||
write_crc( s, start );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
if( increase_pcr( w, 1, 0 ) < 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#if 0
|
||||
/* "The SDT contains data describing the services in the system e.g. names of services, the service provider, etc" */
|
||||
void write_sdt( ts_writer_t *w )
|
||||
{
|
||||
uint64_t start;
|
||||
int i;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, SDT_PID, PAYLOAD_ONLY, &w->sdt->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, SDT_TID ); // table_id
|
||||
bs_write1( s, 1 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write1( s, 1 ); // reserved
|
||||
|
||||
// TODO temp
|
||||
|
||||
bs_write( s, 12, len ); // section_length
|
||||
bs_write( s, 16, w->ts_id ); // transport_stream_id
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 5, 0 ); // version_number
|
||||
bs_write1( s, 1 ); // current_next_indicator
|
||||
bs_write( s, 8, 0 ); // section_number
|
||||
bs_write( s, 8, 0 ); // last_section_number
|
||||
bs_write( s, 8, w->nid ); // original_network_id
|
||||
bs_write( s, 8, 0xff ); // reserved_future_use
|
||||
|
||||
for( i = 0; i < w->num_programs; i++ )
|
||||
{
|
||||
bs_write( s, 16, w->programs[i]->program_num & 0xffff ); // service_id (equivalent to program_number)
|
||||
bs_write( s, 6, 0x7f ); // reserved_future_use
|
||||
bs_write1( s, 0 ); // EIT_schedule_flag
|
||||
bs_write1( s, 1 ); // EIT_present_following_flag
|
||||
bs_write( s, 3, 0 ); // running_status
|
||||
bs_write1( s, 1 ); // free_CA_mode
|
||||
|
||||
int provider_name_len = strlen( w->programs[i]->sdt_ctx->provider_name );
|
||||
int name_len = strlen( w->programs[i]->sdt_ctx->service_name );
|
||||
|
||||
char *provider_name = w->programs[i]->sdt_ctx->provider_name;
|
||||
char *name = w->programs[i]->sdt_ctx->service_name;
|
||||
|
||||
int descriptors_len = 5 + provider_name_len + name_len;
|
||||
bs_write( s, 12, descriptors_len ); // descriptors_loop_length
|
||||
|
||||
// service descriptor (mandatory for DVB)
|
||||
|
||||
|
||||
// other descriptor(s) here
|
||||
}
|
||||
|
||||
bs_flush( s );
|
||||
write_crc( s, start );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
increase_pcr( w, 1 );
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
// FIXME
|
||||
// "the EIT contains data concerning events or programmes such as event name, start time, duration, etc.; "
|
||||
void write_eit( ts_writer_t *w )
|
||||
{
|
||||
uint64_t start;
|
||||
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, EIT_PID, PAYLOAD_ONLY, &w->eit->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, EIT_TID ); // table_id
|
||||
bs_write1( s, 0 ); // section_syntax_indicator CHECKME
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03); // reserved
|
||||
|
||||
|
||||
bs_write( s, 12, len ); // section_length
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static void write_utc_time( bs_t *s )
|
||||
{
|
||||
int l, mjd;
|
||||
time_t cur_time;
|
||||
struct tm *now;
|
||||
|
||||
/* MJD conversions in Annex C of ETSI EN 300 468 */
|
||||
cur_time = time( NULL );
|
||||
now = gmtime( &cur_time );
|
||||
|
||||
l = ( ( now->tm_mon + 1 == 1 ) || ( now->tm_mon + 1 == 2 ) ) ? 1 : 0;
|
||||
mjd = 14956 + now->tm_mday + (int)((now->tm_year - l) * 365.25) + (int)((now->tm_mon + 1 + 1 + l * 12) * 30.6001);
|
||||
|
||||
bs_write( s, 8, mjd >> 8 );
|
||||
bs_write( s, 8, mjd & 0xff );
|
||||
bs_write( s, 8, (now->tm_hour / 10) << 4 | (now->tm_hour % 10) ); // hours
|
||||
bs_write( s, 8, (now->tm_min / 10) << 4 | (now->tm_min % 10) ); // minutes
|
||||
bs_write( s, 8, (now->tm_sec / 10) << 4 | (now->tm_sec % 10) ); // seconds
|
||||
}
|
||||
|
||||
int write_tdt( ts_writer_t *w )
|
||||
{
|
||||
int start;
|
||||
bs_t *s = &w->out.bs;
|
||||
|
||||
write_packet_header( w, s, 1, TDT_PID, PAYLOAD_ONLY, &w->tdt->cc );
|
||||
bs_write( s, 8, 0 ); // pointer field
|
||||
|
||||
start = bs_pos( s );
|
||||
bs_write( s, 8, TDT_TID ); // table_id
|
||||
bs_write1( s, 0 ); // section_syntax_indicator
|
||||
bs_write1( s, 1 ); // reserved_future_use
|
||||
bs_write( s, 2, 0x03 ); // reserved
|
||||
bs_write( s, 12, 0x05 ); // section_length
|
||||
|
||||
write_utc_time( s );
|
||||
|
||||
// -40 to include header and pointer field
|
||||
write_padding( s, start - 40 );
|
||||
|
||||
if( increase_pcr( w, 1, 0 ) < 0 )
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO TOT
|
||||
|
||||
void write_dvb_au_information( bs_t *s, ts_int_pes_t *pes )
|
||||
{
|
||||
bs_t q;
|
||||
uint8_t temp[128];
|
||||
|
||||
ts_int_stream_t *stream = pes->stream;
|
||||
|
||||
bs_write( s, 8, AU_INFORMATION_DATA_FIELD ); // data_field_tag
|
||||
bs_init( &q, temp, 128 );
|
||||
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_MPEG2 )
|
||||
bs_write( &q, 4, 1 ); // AU_coding_format
|
||||
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
bs_write( &q, 4, 0x2 ); // AU_coding_format
|
||||
|
||||
bs_write( &q, 4, pes->frame_type ); // AU_coding_type_information
|
||||
bs_write( &q, 2, pes->ref_pic_idc ); // AU_ref_pic_idc
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_MPEG2 )
|
||||
bs_write( &q, 2, pes->pic_struct ); // AU_pic_struct
|
||||
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
bs_write( &q, 2, 0 ); // AU_coding_format
|
||||
|
||||
bs_write1( &q, 1 ); // AU_PTS_present_flag
|
||||
bs_write1( &q, 1 ); // AU_profile_info_present_flag
|
||||
bs_write1( &q, 1 ); // AU_stream_info_present_flag
|
||||
bs_write1( &q, 0 ); // AU_trick_mode_info_present_flag
|
||||
|
||||
bs_write32( &q, (pes->pts * 300) & 0xffffffff ); // AU_PTS_32
|
||||
|
||||
bs_write( &q, 4, 0 ); // reserved
|
||||
bs_write( &q, 4, stream->dvb_au_frame_rate ); // AU_frame_rate_code
|
||||
|
||||
bs_write( &q, 8, stream->mpegvideo_ctx->profile & 0xff ); // profile_idc
|
||||
|
||||
if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||
{
|
||||
bs_write1( &q, stream->mpegvideo_ctx->profile == AVC_BASELINE ); // constraint_set0_flag
|
||||
bs_write1( &q, stream->mpegvideo_ctx->profile <= AVC_MAIN ); // constraint_set1_flag
|
||||
bs_write1( &q, 0 ); // constraint_set2_flag
|
||||
if( stream->mpegvideo_ctx->level == 9 && stream->mpegvideo_ctx->profile <= AVC_MAIN ) // level 1b
|
||||
bs_write1( &q, 1 ); // constraint_set3_flag
|
||||
else if( stream->mpegvideo_ctx->profile == AVC_HIGH_10_INTRA ||
|
||||
stream->mpegvideo_ctx->profile == AVC_CAVLC_444_INTRA ||
|
||||
stream->mpegvideo_ctx->profile == AVC_HIGH_444_INTRA )
|
||||
bs_write1( &q, 1 ); // constraint_set3_flag
|
||||
else
|
||||
bs_write1( &q, 0 ); // constraint_set3_flag
|
||||
bs_write1( &q, 0 ); // constraint_set4_flag
|
||||
bs_write1( &q, 0 ); // constraint_set5_flag
|
||||
}
|
||||
else
|
||||
bs_write( &q, 5, 0 );
|
||||
|
||||
bs_write( &q, 2, 0 ); // AU_AVC_compatible_flags
|
||||
bs_write( &q, 8, stream->mpegvideo_ctx->level & 0xff ); // level_idc
|
||||
|
||||
if( pes->write_pulldown_info )
|
||||
{
|
||||
bs_write1( &q, 1 ); // AU_Pulldown_info_present_flag
|
||||
bs_write( &q, 6, 0 ); // AU_reserved_zero
|
||||
bs_write1( &q, 0 ); // AU_flags_extension_1
|
||||
|
||||
bs_write( &q, 4, 0 ); // AU_reserved_zero
|
||||
bs_write( &q, 4, pes->pic_struct & 0xf ); // AU_Pulldown_info
|
||||
}
|
||||
|
||||
/* reserved bytes */
|
||||
|
||||
bs_flush( &q );
|
||||
bs_write( s, 8, bs_pos( &q ) >> 3 ); // data_field_length
|
||||
write_bytes( s, temp, bs_pos( &q ) >> 3 );
|
||||
}
|
||||
|
||||
|
||||
|
|
140
dvb/dvb.h
140
dvb/dvb.h
|
@ -1,70 +1,70 @@
|
|||
/*****************************************************************************
|
||||
* dvb.h : DVB specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_DVB_H
|
||||
#define LIBMPEGTS_DVB_H
|
||||
|
||||
/* Descriptor Tags */
|
||||
#define DVB_VBI_DESCRIPTOR_TAG 0x45
|
||||
#define DVB_VBI_TELETEXT_DESCRIPTOR_TAG 0x46
|
||||
#define DVB_SERVICE_DESCRIPTOR_TAG 0x48
|
||||
#define DVB_STREAM_IDENTIFIER_DESCRIPTOR_TAG 0x52
|
||||
#define DVB_TELETEXT_DESCRIPTOR_TAG 0x56
|
||||
#define DVB_SUBTITLING_DESCRIPTOR_TAG 0x59
|
||||
#define DVB_AC3_DESCRIPTOR_TAG 0x6a
|
||||
#define DVB_ADAPTATION_FIELD_DATA_DESCRIPTOR 0x70
|
||||
#define DVB_EAC3_DESCRIPTOR_TAG 0x7a
|
||||
#define DVB_AAC_DESCRIPTOR_TAG 0x7c
|
||||
|
||||
/* PIDs */
|
||||
#define SDT_PID 0x0011
|
||||
#define EIT_PID 0x0012
|
||||
#define TDT_PID 0x0014
|
||||
|
||||
/* TIDs */
|
||||
#define SDT_TID 0x42
|
||||
#define EIT_TID 0x4e
|
||||
#define TDT_TID 0x70
|
||||
|
||||
/* Default Retransmit times (ms) */
|
||||
#define EIT_MAX_RETRANS_TIME 2000
|
||||
#define EIT_OTHER_TS_MAX_RETRANS_TIME 10000
|
||||
#define TDT_MAX_RETRANS_TIME 25000
|
||||
#define TOT_MAX_RETRANS_TIME 25000
|
||||
|
||||
/* Private Data Bytes data_field_tags */
|
||||
#define ANNOUNCEMENT_SWITCHING_DATA_FIELD 0x01
|
||||
#define AU_INFORMATION_DATA_FIELD 0x02
|
||||
#define PVR_ASSIST_INFORMATION_DATA_FIELD 0x03
|
||||
|
||||
void write_aac_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_adaptation_field_data_descriptor( bs_t *s, uint8_t identifier );
|
||||
void write_dvb_subtitling_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_stream_identifier_descriptor( bs_t *s, uint8_t stream_identifier );
|
||||
void write_teletext_descriptor( bs_t *s, ts_int_stream_t *stream, int vbi );
|
||||
void write_vbi_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
|
||||
int write_nit( ts_writer_t *w );
|
||||
//void write_sdt( ts_writer_t *w );
|
||||
//void write_eit( ts_writer_t *w );
|
||||
int write_tdt( ts_writer_t *w );
|
||||
|
||||
void write_dvb_au_information( bs_t *s, ts_int_pes_t *pes );
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* dvb.h : DVB specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_DVB_H
|
||||
#define LIBMPEGTS_DVB_H
|
||||
|
||||
/* Descriptor Tags */
|
||||
#define DVB_VBI_DESCRIPTOR_TAG 0x45
|
||||
#define DVB_VBI_TELETEXT_DESCRIPTOR_TAG 0x46
|
||||
#define DVB_SERVICE_DESCRIPTOR_TAG 0x48
|
||||
#define DVB_STREAM_IDENTIFIER_DESCRIPTOR_TAG 0x52
|
||||
#define DVB_TELETEXT_DESCRIPTOR_TAG 0x56
|
||||
#define DVB_SUBTITLING_DESCRIPTOR_TAG 0x59
|
||||
#define DVB_AC3_DESCRIPTOR_TAG 0x6a
|
||||
#define DVB_ADAPTATION_FIELD_DATA_DESCRIPTOR 0x70
|
||||
#define DVB_EAC3_DESCRIPTOR_TAG 0x7a
|
||||
#define DVB_AAC_DESCRIPTOR_TAG 0x7c
|
||||
|
||||
/* PIDs */
|
||||
#define SDT_PID 0x0011
|
||||
#define EIT_PID 0x0012
|
||||
#define TDT_PID 0x0014
|
||||
|
||||
/* TIDs */
|
||||
#define SDT_TID 0x42
|
||||
#define EIT_TID 0x4e
|
||||
#define TDT_TID 0x70
|
||||
|
||||
/* Default Retransmit times (ms) */
|
||||
#define EIT_MAX_RETRANS_TIME 2000
|
||||
#define EIT_OTHER_TS_MAX_RETRANS_TIME 10000
|
||||
#define TDT_MAX_RETRANS_TIME 25000
|
||||
#define TOT_MAX_RETRANS_TIME 25000
|
||||
|
||||
/* Private Data Bytes data_field_tags */
|
||||
#define ANNOUNCEMENT_SWITCHING_DATA_FIELD 0x01
|
||||
#define AU_INFORMATION_DATA_FIELD 0x02
|
||||
#define PVR_ASSIST_INFORMATION_DATA_FIELD 0x03
|
||||
|
||||
void write_aac_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_adaptation_field_data_descriptor( bs_t *s, uint8_t identifier );
|
||||
void write_dvb_subtitling_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_stream_identifier_descriptor( bs_t *s, uint8_t stream_identifier );
|
||||
void write_teletext_descriptor( bs_t *s, ts_int_stream_t *stream, int vbi );
|
||||
void write_vbi_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
|
||||
int write_nit( ts_writer_t *w );
|
||||
//void write_sdt( ts_writer_t *w );
|
||||
//void write_eit( ts_writer_t *w );
|
||||
int write_tdt( ts_writer_t *w );
|
||||
|
||||
void write_dvb_au_information( bs_t *s, ts_int_pes_t *pes );
|
||||
#endif
|
||||
|
|
254
hdmv/hdmv.c
254
hdmv/hdmv.c
|
@ -1,127 +1,127 @@
|
|||
/*****************************************************************************
|
||||
* hdmv.c : HDMV specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "hdmv.h"
|
||||
|
||||
int ts_setup_hdmv_lpcm_stream( ts_writer_t *w, int pid, int num_channels, int sample_rate, int bits_per_sample )
|
||||
{
|
||||
ts_int_stream_t *stream = find_stream( w, pid );
|
||||
|
||||
if( !stream )
|
||||
{
|
||||
fprintf( stderr, "Invalid PID\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
stream->lpcm_ctx = calloc( 1, sizeof(stream->lpcm_ctx) );
|
||||
if( !stream->lpcm_ctx )
|
||||
return -1;
|
||||
|
||||
stream->lpcm_ctx->num_channels = num_channels;
|
||||
stream->lpcm_ctx->sample_rate = sample_rate;
|
||||
stream->lpcm_ctx->bits_per_sample = bits_per_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ts_setup_dtcp( ts_writer_t *w, uint8_t byte_1, uint8_t byte_2 )
|
||||
{
|
||||
w->dtcp_ctx = calloc( 1, sizeof(w->dtcp_ctx) );
|
||||
if( !w->dtcp_ctx )
|
||||
return -1;
|
||||
|
||||
w->dtcp_ctx->byte_1 = byte_1;
|
||||
w->dtcp_ctx->byte_2 = byte_2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**** First Loop of PMT Descriptors ****/
|
||||
void write_hdmv_copy_control_descriptor( ts_writer_t *w, bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, HDMV_COPY_CTRL_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x04 ); // descriptor_length
|
||||
bs_write( s, 16, 0x0fff ); // CA_System_ID
|
||||
bs_write( s, 8, w->dtcp_ctx->byte_1 ); // private_data_byte
|
||||
bs_write( s, 8, w->dtcp_ctx->byte_2 ); // private_data_byte
|
||||
}
|
||||
|
||||
/**** Second Loop of PMT Descriptors ****/
|
||||
void write_hdmv_video_registration_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
char *format_id = "HDMV";
|
||||
|
||||
bs_write( s, 8, REGISTRATION_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x8 ); // descriptor_length
|
||||
while( *format_id != '\0' )
|
||||
bs_write( s, 8, *format_id++ ); // format_identifier
|
||||
|
||||
bs_write( s, 8, 0xff ); // stuffing_bits
|
||||
bs_write( s, 8, stream->stream_id ); // stream_coding_type
|
||||
bs_write( s, 4, stream->hdmv_video_format ); // video_format
|
||||
bs_write( s, 4, stream->hdmv_frame_rate ); // frame_rate
|
||||
bs_write( s, 4, stream->hdmv_aspect_ratio ); // aspect_ratio
|
||||
bs_write( s, 4, 0xf ); // stuffing_bits
|
||||
}
|
||||
|
||||
void write_hdmv_lpcm_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
write_registration_descriptor( s, REGISTRATION_DESCRIPTOR_TAG, 8, "HDMV" );
|
||||
bs_write( s, 8, 0xff ); // stuffing_bits
|
||||
bs_write( s, 8, stream->stream_type ); // stream_coding_type
|
||||
|
||||
if( stream->lpcm_ctx->num_channels == 1 )
|
||||
bs_write( s, 4, 1 ); // audio_presentation_type
|
||||
else if( stream->lpcm_ctx->num_channels == 2 )
|
||||
bs_write( s, 4, 0x03 ); // audio_presentation_type
|
||||
else
|
||||
bs_write( s, 4, 0x06 ); // audio_presentation_type
|
||||
|
||||
if( stream->lpcm_ctx->sample_rate == 48 )
|
||||
bs_write( s, 4, 1 ); // sampling_frequency
|
||||
else if( stream->lpcm_ctx->sample_rate == 96 )
|
||||
bs_write( s, 4, 0x04 ); // sampling_frequency
|
||||
else
|
||||
bs_write( s, 4, 0x05 ); // sampling_frequency
|
||||
|
||||
if( stream->lpcm_ctx->bits_per_sample == 16 )
|
||||
bs_write( s, 2, 1 ); // bits_per_sample
|
||||
else if( stream->lpcm_ctx->bits_per_sample == 20 )
|
||||
bs_write( s, 2, 0x02 ); // bits_per_sample
|
||||
else
|
||||
bs_write( s, 2, 0x03 ); // bits_per_sample
|
||||
|
||||
bs_write( s, 6, 0x3f ); // stuffing_bits
|
||||
|
||||
}
|
||||
|
||||
/**** In loop of SIT ****/
|
||||
void write_partial_ts_descriptor( ts_writer_t *w, bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, HDMV_PARTIAL_TS_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x08 ); // descriptor_length
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 22, w->ts_muxrate / 400 ); // peak_rate
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 22, 0x3fffff ); // minimum_overall_smoothing_rate
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 14, 0x3fff ); // maximum_overall_smoothing_buffer
|
||||
}
|
||||
/*****************************************************************************
|
||||
* hdmv.c : HDMV specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "hdmv.h"
|
||||
|
||||
int ts_setup_hdmv_lpcm_stream( ts_writer_t *w, int pid, int num_channels, int sample_rate, int bits_per_sample )
|
||||
{
|
||||
ts_int_stream_t *stream = find_stream( w, pid );
|
||||
|
||||
if( !stream )
|
||||
{
|
||||
fprintf( stderr, "Invalid PID\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
stream->lpcm_ctx = calloc( 1, sizeof(stream->lpcm_ctx) );
|
||||
if( !stream->lpcm_ctx )
|
||||
return -1;
|
||||
|
||||
stream->lpcm_ctx->num_channels = num_channels;
|
||||
stream->lpcm_ctx->sample_rate = sample_rate;
|
||||
stream->lpcm_ctx->bits_per_sample = bits_per_sample;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ts_setup_dtcp( ts_writer_t *w, uint8_t byte_1, uint8_t byte_2 )
|
||||
{
|
||||
w->dtcp_ctx = calloc( 1, sizeof(w->dtcp_ctx) );
|
||||
if( !w->dtcp_ctx )
|
||||
return -1;
|
||||
|
||||
w->dtcp_ctx->byte_1 = byte_1;
|
||||
w->dtcp_ctx->byte_2 = byte_2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**** First Loop of PMT Descriptors ****/
|
||||
void write_hdmv_copy_control_descriptor( ts_writer_t *w, bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, HDMV_COPY_CTRL_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x04 ); // descriptor_length
|
||||
bs_write( s, 16, 0x0fff ); // CA_System_ID
|
||||
bs_write( s, 8, w->dtcp_ctx->byte_1 ); // private_data_byte
|
||||
bs_write( s, 8, w->dtcp_ctx->byte_2 ); // private_data_byte
|
||||
}
|
||||
|
||||
/**** Second Loop of PMT Descriptors ****/
|
||||
void write_hdmv_video_registration_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
char *format_id = "HDMV";
|
||||
|
||||
bs_write( s, 8, REGISTRATION_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x8 ); // descriptor_length
|
||||
while( *format_id != '\0' )
|
||||
bs_write( s, 8, *format_id++ ); // format_identifier
|
||||
|
||||
bs_write( s, 8, 0xff ); // stuffing_bits
|
||||
bs_write( s, 8, stream->stream_id ); // stream_coding_type
|
||||
bs_write( s, 4, stream->hdmv_video_format ); // video_format
|
||||
bs_write( s, 4, stream->hdmv_frame_rate ); // frame_rate
|
||||
bs_write( s, 4, stream->hdmv_aspect_ratio ); // aspect_ratio
|
||||
bs_write( s, 4, 0xf ); // stuffing_bits
|
||||
}
|
||||
|
||||
void write_hdmv_lpcm_descriptor( bs_t *s, ts_int_stream_t *stream )
|
||||
{
|
||||
write_registration_descriptor( s, REGISTRATION_DESCRIPTOR_TAG, 8, "HDMV" );
|
||||
bs_write( s, 8, 0xff ); // stuffing_bits
|
||||
bs_write( s, 8, stream->stream_type ); // stream_coding_type
|
||||
|
||||
if( stream->lpcm_ctx->num_channels == 1 )
|
||||
bs_write( s, 4, 1 ); // audio_presentation_type
|
||||
else if( stream->lpcm_ctx->num_channels == 2 )
|
||||
bs_write( s, 4, 0x03 ); // audio_presentation_type
|
||||
else
|
||||
bs_write( s, 4, 0x06 ); // audio_presentation_type
|
||||
|
||||
if( stream->lpcm_ctx->sample_rate == 48 )
|
||||
bs_write( s, 4, 1 ); // sampling_frequency
|
||||
else if( stream->lpcm_ctx->sample_rate == 96 )
|
||||
bs_write( s, 4, 0x04 ); // sampling_frequency
|
||||
else
|
||||
bs_write( s, 4, 0x05 ); // sampling_frequency
|
||||
|
||||
if( stream->lpcm_ctx->bits_per_sample == 16 )
|
||||
bs_write( s, 2, 1 ); // bits_per_sample
|
||||
else if( stream->lpcm_ctx->bits_per_sample == 20 )
|
||||
bs_write( s, 2, 0x02 ); // bits_per_sample
|
||||
else
|
||||
bs_write( s, 2, 0x03 ); // bits_per_sample
|
||||
|
||||
bs_write( s, 6, 0x3f ); // stuffing_bits
|
||||
|
||||
}
|
||||
|
||||
/**** In loop of SIT ****/
|
||||
void write_partial_ts_descriptor( ts_writer_t *w, bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, HDMV_PARTIAL_TS_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0x08 ); // descriptor_length
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 22, w->ts_muxrate / 400 ); // peak_rate
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 22, 0x3fffff ); // minimum_overall_smoothing_rate
|
||||
bs_write( s, 2, 0x03 ); // DVB_reserved_future_use
|
||||
bs_write( s, 14, 0x3fff ); // maximum_overall_smoothing_buffer
|
||||
}
|
||||
|
|
94
hdmv/hdmv.h
94
hdmv/hdmv.h
|
@ -1,47 +1,47 @@
|
|||
/*****************************************************************************
|
||||
* hdmv.h : HDMV specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_HDMV_H
|
||||
#define LIBMPEGTS_HDMV_H
|
||||
|
||||
/* Blu-Ray specific stream types */
|
||||
#define AUDIO_LPCM 0x80
|
||||
#define AUDIO_DTS 0x82
|
||||
#define AUDIO_DOLBY_LOSSLESS 0x83
|
||||
#define AUDIO_DTS_HD 0x85
|
||||
#define AUDIO_DTS_HD_XLL 0x86
|
||||
#define AUDIO_EAC3_SECONDARY 0xa1
|
||||
#define AUDIO_DTS_HD_SECONDARY 0xa2
|
||||
#define SUB_PRESENTATION_GRAPHICS 0x90
|
||||
#define SUB_INTERACTIVE_GRAPHICS 0x91
|
||||
#define SUB_TEXT 0x92
|
||||
|
||||
/* Descriptor Tags */
|
||||
#define HDMV_PARTIAL_TS_DESCRIPTOR_TAG 0x63
|
||||
#define HDMV_AC3_DESCRIPTOR_TAG 0x81
|
||||
#define HDMV_CAPTION_DESCRIPTOR_TAG 0x86
|
||||
#define HDMV_COPY_CTRL_DESCRIPTOR_TAG 0x88
|
||||
|
||||
void write_hdmv_copy_control_descriptor( ts_writer_t *w, bs_t *s );
|
||||
void write_hdmv_video_registration_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_hdmv_lpcm_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_partial_ts_descriptor( ts_writer_t *w, bs_t *s );
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* hdmv.h : HDMV specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_HDMV_H
|
||||
#define LIBMPEGTS_HDMV_H
|
||||
|
||||
/* Blu-Ray specific stream types */
|
||||
#define AUDIO_LPCM 0x80
|
||||
#define AUDIO_DTS 0x82
|
||||
#define AUDIO_DOLBY_LOSSLESS 0x83
|
||||
#define AUDIO_DTS_HD 0x85
|
||||
#define AUDIO_DTS_HD_XLL 0x86
|
||||
#define AUDIO_EAC3_SECONDARY 0xa1
|
||||
#define AUDIO_DTS_HD_SECONDARY 0xa2
|
||||
#define SUB_PRESENTATION_GRAPHICS 0x90
|
||||
#define SUB_INTERACTIVE_GRAPHICS 0x91
|
||||
#define SUB_TEXT 0x92
|
||||
|
||||
/* Descriptor Tags */
|
||||
#define HDMV_PARTIAL_TS_DESCRIPTOR_TAG 0x63
|
||||
#define HDMV_AC3_DESCRIPTOR_TAG 0x81
|
||||
#define HDMV_CAPTION_DESCRIPTOR_TAG 0x86
|
||||
#define HDMV_COPY_CTRL_DESCRIPTOR_TAG 0x88
|
||||
|
||||
void write_hdmv_copy_control_descriptor( ts_writer_t *w, bs_t *s );
|
||||
void write_hdmv_video_registration_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_hdmv_lpcm_descriptor( bs_t *s, ts_int_stream_t *stream );
|
||||
void write_partial_ts_descriptor( ts_writer_t *w, bs_t *s );
|
||||
|
||||
#endif
|
||||
|
|
48
isdb/isdb.h
48
isdb/isdb.h
|
@ -1,24 +1,24 @@
|
|||
/*****************************************************************************
|
||||
* isdb.h : ISDB specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_ISDB_H
|
||||
#define LIBMPEGTS_ISDB_H
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* isdb.h : ISDB specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_ISDB_H
|
||||
#define LIBMPEGTS_ISDB_H
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*****************************************************************************
|
||||
* smpte.c : SMPTE specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "smpte.h"
|
||||
|
||||
void write_anc_data_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, USER_DEFINED_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
|
||||
/* Optional descriptors here */
|
||||
}
|
||||
/*****************************************************************************
|
||||
* smpte.c : SMPTE specific functions
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../common.h"
|
||||
#include "smpte.h"
|
||||
|
||||
void write_anc_data_descriptor( bs_t *s )
|
||||
{
|
||||
bs_write( s, 8, USER_DEFINED_DESCRIPTOR_TAG ); // descriptor_tag
|
||||
bs_write( s, 8, 0 ); // descriptor_length
|
||||
|
||||
/* Optional descriptors here */
|
||||
}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
/*****************************************************************************
|
||||
* smpte.h : SMPTE specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_SMPTE_H
|
||||
#define LIBMPEGTS_SMPTE_H
|
||||
|
||||
void write_anc_data_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* smpte.h : SMPTE specific headers
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2010 Kieran Kunhya
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef LIBMPEGTS_SMPTE_H
|
||||
#define LIBMPEGTS_SMPTE_H
|
||||
|
||||
void write_anc_data_descriptor( bs_t *s );
|
||||
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue