Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
  • abdsaber000/vlc
  • falbrechtskirchinger/vlc
  • b.sullender/vlc
  • hulxv/vlc
  • zyad-ayad/vlc
408 results
Show changes
Commits on Source (4)
......@@ -214,7 +214,7 @@ codecprobingend:
static void BuildPATCallback( void *p_opaque, block_t *p_block )
{
ts_pid_t *pat_pid = (ts_pid_t *) p_opaque;
dvbpsi_packet_push( pat_pid->u.p_pat->handle, p_block->p_buffer );
ts_psi_Packet_Push( pat_pid, p_block->p_buffer );
block_Release( p_block );
}
......@@ -224,8 +224,7 @@ static void BuildPMTCallback( void *p_opaque, block_t *p_block )
assert(program_pid->type == TYPE_PMT);
while( p_block )
{
dvbpsi_packet_push( program_pid->u.p_pmt->handle,
p_block->p_buffer );
ts_psi_Packet_Push( program_pid, p_block->p_buffer );
block_t *p_next = p_block->p_next;
block_Release( p_block );
p_block = p_next;
......@@ -304,7 +303,11 @@ void MissingPATPMTFixup( demux_t *p_demux )
.b_discontinuity = false
};
BuildPAT( GetPID(p_sys, 0)->u.p_pat->handle,
dvbpsi_t *handle = dvbpsi_new( NULL, DVBPSI_MSG_DEBUG );
if( !handle )
return;
BuildPAT( handle,
&p_sys->pids.pat, BuildPATCallback,
0, 1,
&patstream,
......@@ -313,6 +316,7 @@ void MissingPATPMTFixup( demux_t *p_demux )
/* PAT callback should have been triggered */
if( p_program_pid->type != TYPE_PMT )
{
dvbpsi_delete( handle );
msg_Err( p_demux, "PAT creation failed" );
return;
}
......@@ -359,7 +363,7 @@ void MissingPATPMTFixup( demux_t *p_demux )
j++;
}
BuildPMT( GetPID(p_sys, 0)->u.p_pat->handle, VLC_OBJECT(p_demux),
BuildPMT( handle, VLC_OBJECT(p_demux),
mux_standard,
p_program_pid, BuildPMTCallback,
0, 1,
......@@ -374,4 +378,6 @@ void MissingPATPMTFixup( demux_t *p_demux )
}
free(esstreams);
free(mapped);
dvbpsi_delete( handle );
}
......@@ -31,6 +31,7 @@
#include <dvbpsi/pat.h>
#include <dvbpsi/pmt.h>
#include <dvbpsi/dr.h>
#include "../../mux/mpeg/dvbpsi_compat.h" /* dvbpsi_messages */
#include <vlc_demux.h>
#include <vlc_bits.h>
......@@ -62,6 +63,12 @@
#include <assert.h>
struct ts_psi_context_t
{
dvbpsi_t *p_handle;
void (*pf_detach)(dvbpsi_t *);
};
static void PIDFillFormat( demux_t *, ts_stream_t *p_pes, int i_stream_type, ts_transport_type_t * );
static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt );
static ts_standards_e ProbePMTStandard( const dvbpsi_pmt_t *p_dvbpsipmt );
......@@ -178,11 +185,12 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
if( !b_existing || pmtpid->u.p_pmt->i_number != p_program->i_number )
{
if( b_existing && pmtpid->u.p_pmt->i_number != p_program->i_number )
dvbpsi_pmt_detach(pmtpid->u.p_pmt->handle);
dvbpsi_pmt_detach(pmtpid->u.p_pmt->p_ctx->p_handle);
if( !dvbpsi_pmt_attach( pmtpid->u.p_pmt->handle, p_program->i_number, PMTCallBack, p_demux ) )
if( !dvbpsi_pmt_attach( pmtpid->u.p_pmt->p_ctx->p_handle, p_program->i_number, PMTCallBack, p_demux ) )
msg_Err( p_demux, "PATCallback failed attaching PMTCallback to program %d",
p_program->i_number );
pmtpid->u.p_pmt->p_ctx->pf_detach = dvbpsi_pmt_detach;
}
pmtpid->u.p_pmt->i_number = p_program->i_number;
......@@ -2124,7 +2132,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
if ( PIDSetup( p_demux, TYPE_PSIP, atsc_base_pid, pmtpid ) )
{
ts_psip_t *p_psip = atsc_base_pid->u.p_psip;
if( !ATSC_Attach_Dvbpsi_Base_Decoders( p_psip->handle, atsc_base_pid ) )
if( !ATSC_Attach_Dvbpsi_Base_Decoders( p_psip->p_ctx, atsc_base_pid ) )
{
msg_Err( p_demux, "dvbpsi_atsc_AttachMGT/STT failed for program %d",
p_pmt->i_number );
......@@ -2249,7 +2257,7 @@ int UserPmt( demux_t *p_demux, const char *psz_fmt )
/* Dummy PMT */
ts_pmt_t *p_pmt = pmtpid->u.p_pmt;
p_pmt->i_number = i_number != 0 ? i_number : TS_USER_PMT_NUMBER;
if( !dvbpsi_pmt_attach( p_pmt->handle,
if( !dvbpsi_pmt_attach( p_pmt->p_ctx->p_handle,
((i_number != TS_USER_PMT_NUMBER ? i_number : 1)),
PMTCallBack, p_demux ) )
{
......@@ -2350,13 +2358,42 @@ bool ts_psi_PAT_Attach( ts_pid_t *patpid, void *cbdata )
{
if( unlikely(patpid->type != TYPE_PAT || patpid->i_pid != TS_PSI_PAT_PID) )
return false;
return dvbpsi_pat_attach( patpid->u.p_pat->handle, PATCallBack, cbdata );
patpid->u.p_pat->p_ctx->pf_detach = dvbpsi_pat_detach;
return dvbpsi_pat_attach( patpid->u.p_pat->p_ctx->p_handle, PATCallBack, cbdata );
}
void ts_psi_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
{
if( p_pid->type == TYPE_PAT )
dvbpsi_packet_push( p_pid->u.p_pat->handle, (uint8_t *) p_pktbuffer );
dvbpsi_packet_push( p_pid->u.p_pat->p_ctx->p_handle, (uint8_t *) p_pktbuffer );
else if( p_pid->type == TYPE_PMT )
dvbpsi_packet_push( p_pid->u.p_pmt->handle, (uint8_t *) p_pktbuffer );
dvbpsi_packet_push( p_pid->u.p_pmt->p_ctx->p_handle, (uint8_t *) p_pktbuffer );
}
void ts_psi_context_Delete( ts_psi_context_t *p_ctx )
{
if( dvbpsi_decoder_present( p_ctx->p_handle ) )
{
assert( p_ctx->pf_detach );
p_ctx->pf_detach( p_ctx->p_handle );
}
dvbpsi_delete( p_ctx->p_handle );
free( p_ctx );
}
ts_psi_context_t * ts_psi_context_New( demux_t *p_demux )
{
ts_psi_context_t *p_ctx = malloc(sizeof(*p_ctx));
if(likely(p_ctx))
{
p_ctx->p_handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_ctx->p_handle )
{
free( p_ctx );
return NULL;
}
p_ctx->p_handle->p_sys = (void *) p_demux;
p_ctx->pf_detach = NULL;
}
return p_ctx;
}
......@@ -29,6 +29,11 @@ typedef enum
TS_PMT_REGISTRATION_ARIB,
} ts_pmt_registration_type_t;
typedef struct ts_psi_context_t ts_psi_context_t;
ts_psi_context_t * ts_psi_context_New( demux_t * );
void ts_psi_context_Delete( ts_psi_context_t * );
bool ts_psi_PAT_Attach( ts_pid_t *, void * );
void ts_psi_Packet_Push( ts_pid_t *, const uint8_t * );
......
......@@ -38,6 +38,7 @@
#include <dvbpsi/atsc_ett.h>
#include <dvbpsi/atsc_stt.h>
#include <dvbpsi/dr_a0.h>
#include "../../mux/mpeg/dvbpsi_compat.h" /* dvbpsi_messages */
/* Custom decoders */
#include <dvbpsi/psi.h>
#include "ts_decoders.h"
......@@ -76,6 +77,8 @@ static inline char *grab_notempty( char **ppsz )
struct ts_psip_context_t
{
dvbpsi_t *p_handle;
int i_version;
dvbpsi_atsc_mgt_t *p_mgt; /* Used to match (EITx,ETTx)<->PIDn */
dvbpsi_atsc_stt_t *p_stt; /* Time reference for EIT/EAS */
dvbpsi_atsc_vct_t *p_vct; /* Required for EIT vchannel -> program remapping */
......@@ -85,17 +88,28 @@ struct ts_psip_context_t
DECL_ARRAY(dvbpsi_atsc_eit_t *) eits; /* For EIT pid, used on new ETT update */
};
static void ATSC_Detach_Dvbpsi_Decoders( dvbpsi_t *p_handle );
void ts_psip_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
{
if( p_pid->u.p_psip->handle->p_decoder && likely(p_pid->type == TYPE_PSIP) )
dvbpsi_packet_push( p_pid->u.p_psip->handle, (uint8_t *) p_pktbuffer );
ts_psip_context_t *p_ctx = p_pid->u.p_psip->p_ctx;
if( p_ctx->p_handle->p_decoder && likely(p_pid->type == TYPE_PSIP) )
dvbpsi_packet_push( p_ctx->p_handle, (uint8_t *) p_pktbuffer );
}
ts_psip_context_t * ts_psip_context_New( void )
ts_psip_context_t * ts_psip_context_New( demux_t *p_demux )
{
ts_psip_context_t *p_ctx = malloc(sizeof(*p_ctx));
if(likely(p_ctx))
{
p_ctx->p_handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_ctx->p_handle )
{
free( p_ctx );
return NULL;
}
p_ctx->p_handle->p_sys = (void *) p_demux;
p_ctx->i_version = -1;
p_ctx->p_mgt = NULL;
p_ctx->p_stt = NULL;
p_ctx->p_vct = NULL;
......@@ -112,6 +126,9 @@ void ts_psip_context_Delete( ts_psip_context_t *p_ctx )
assert( !p_ctx->p_mgt || !p_ctx->etts.i_size );
assert( !p_ctx->p_vct || !p_ctx->eits.i_size );
ATSC_Detach_Dvbpsi_Decoders( p_ctx->p_handle );
dvbpsi_delete( p_ctx->p_handle );
if( p_ctx->p_mgt )
dvbpsi_atsc_DeleteMGT( p_ctx->p_mgt );
if( p_ctx->p_stt )
......@@ -269,7 +286,7 @@ static bool ATSC_Ready_SubDecoders( dvbpsi_t *p_handle, void *p_cb_pid )
return true;
}
void ATSC_Detach_Dvbpsi_Decoders( dvbpsi_t *p_handle )
static void ATSC_Detach_Dvbpsi_Decoders( dvbpsi_t *p_handle )
{
if( dvbpsi_decoder_present( p_handle ) )
dvbpsi_DetachDemux( p_handle );
......@@ -422,7 +439,7 @@ static void ATSC_EIT_Callback( void *p_pid, dvbpsi_atsc_eit_t* p_eit )
return;
}
demux_t *p_demux = (demux_t *) p_eit_pid->u.p_psip->handle->p_sys;
demux_t *p_demux = (demux_t *) p_eit_pid->u.p_psip->p_ctx->p_handle->p_sys;
demux_sys_t *p_sys = p_demux->p_sys;
ts_pid_t *p_base_pid = GetPID(p_sys, ATSC_BASE_PID);
ts_psip_t *p_basepsip = p_base_pid->u.p_psip;
......@@ -521,7 +538,7 @@ static void ATSC_ETT_Callback( void *p_pid, dvbpsi_atsc_ett_t *p_ett )
return;
}
demux_t *p_demux = (demux_t *) p_ett_pid->u.p_psip->handle->p_sys;
demux_t *p_demux = (demux_t *) p_ett_pid->u.p_psip->p_ctx->p_handle->p_sys;
demux_sys_t *p_sys = p_demux->p_sys;
ts_pid_t *p_base_pid = GetPID(p_sys, ATSC_BASE_PID);
ts_psip_t *p_basepsip = p_base_pid->u.p_psip;
......@@ -598,7 +615,7 @@ static void ATSC_VCT_Callback( void *p_cb_basepid, dvbpsi_atsc_vct_t* p_vct )
dvbpsi_atsc_DeleteVCT( p_vct );
return;
}
demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->handle->p_sys;
demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->p_ctx->p_handle->p_sys;
ts_psip_context_t *p_ctx = p_base_pid->u.p_psip->p_ctx;
if( !p_ctx->p_a65 && !(p_ctx->p_a65 = atsc_a65_handle_New( NULL )) )
......@@ -674,10 +691,10 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
return;
}
ts_psip_t *p_mgtpsip = p_base_pid->u.p_psip;
demux_t *p_demux = (demux_t *) p_mgtpsip->handle->p_sys;
demux_t *p_demux = (demux_t *) p_mgtpsip->p_ctx->p_handle->p_sys;
demux_sys_t *p_sys = p_demux->p_sys;
if( ( p_mgtpsip->i_version != -1 && p_mgtpsip->i_version == p_mgt->i_version ) ||
if( ( p_mgtpsip->p_ctx->i_version != -1 && p_mgtpsip->p_ctx->i_version == p_mgt->i_version ) ||
p_mgt->b_current_next == 0 )
{
dvbpsi_atsc_DeleteMGT( p_mgt );
......@@ -686,7 +703,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
/* Easy way, delete and recreate every child if any new version comes
* (We don't need to keep PID active as with video/PMT update) */
if( p_mgtpsip->i_version != -1 )
if( p_mgtpsip->p_ctx->i_version != -1 )
{
if( p_mgtpsip->p_ctx->p_vct )
{
......@@ -703,7 +720,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
ARRAY_RESET(p_mgtpsip->eit);
/* Remove EAS */
dvbpsi_demux_t *p_dvbpsi_demux = (dvbpsi_demux_t *) p_mgtpsip->handle->p_decoder;
dvbpsi_demux_t *p_dvbpsi_demux = (dvbpsi_demux_t *) p_mgtpsip->p_ctx->p_handle->p_decoder;
dvbpsi_demux_subdec_t *p_subdec = dvbpsi_demuxGetSubDec( p_dvbpsi_demux, SCTE18_TABLE_ID, 0x00 );
if( p_subdec )
{
......@@ -715,7 +732,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
if( p_mgtpsip->p_ctx->p_mgt )
dvbpsi_atsc_DeleteMGT( p_mgtpsip->p_ctx->p_mgt );
p_mgtpsip->p_ctx->p_mgt = p_mgt;
p_mgtpsip->i_version = p_mgt->i_version;
p_mgtpsip->p_ctx->i_version = p_mgt->i_version;
for( const dvbpsi_atsc_mgt_table_t *p_tab = p_mgt->p_first_table;
p_tab; p_tab = p_tab->p_next )
......@@ -726,7 +743,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
const uint8_t i_table_id = (p_tab->i_table_type == ATSC_TABLE_TYPE_CVCT)
? ATSC_CVCT_TABLE_ID
: ATSC_TVCT_TABLE_ID;
if( !ATSC_ATTACH( p_mgtpsip->handle, VCT, i_table_id,
if( !ATSC_ATTACH( p_mgtpsip->p_ctx->p_handle, VCT, i_table_id,
GetPID(p_sys, 0)->u.p_pat->i_ts_id, p_base_pid ) )
msg_Dbg( p_demux, " * pid=%d listening for ATSC VCT", p_base_pid->i_pid );
}
......@@ -740,7 +757,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
{
SetPIDFilter( p_demux->p_sys, pid, true );
pid->u.p_psip->p_ctx->i_tabletype = p_tab->i_table_type;
ATSC_Ready_SubDecoders( pid->u.p_psip->handle, pid );
ATSC_Ready_SubDecoders( pid->u.p_psip->p_ctx->p_handle, pid );
msg_Dbg( p_demux, " * pid=%d reserved for ATSC EIT", pid->i_pid );
ARRAY_APPEND( p_mgtpsip->eit, pid );
}
......@@ -755,7 +772,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
{
SetPIDFilter( p_sys, pid, true );
pid->u.p_psip->p_ctx->i_tabletype = p_tab->i_table_type;
ATSC_Ready_SubDecoders( pid->u.p_psip->handle, pid );
ATSC_Ready_SubDecoders( pid->u.p_psip->p_ctx->p_handle, pid );
msg_Dbg( p_demux, " * pid=%d reserved for ATSC ETT", pid->i_pid );
ARRAY_APPEND( p_mgtpsip->eit, pid );
}
......@@ -765,7 +782,7 @@ static void ATSC_MGT_Callback( void *p_cb_basepid, dvbpsi_atsc_mgt_t* p_mgt )
}
if( SCTE18_SI_BASE_PID == ATSC_BASE_PID &&
ts_dvbpsi_AttachRawSubDecoder( p_mgtpsip->handle, SCTE18_TABLE_ID, 0x00,
ts_dvbpsi_AttachRawSubDecoder( p_mgtpsip->p_ctx->p_handle, SCTE18_TABLE_ID, 0x00,
SCTE18_Section_Callback, p_base_pid ) )
{
msg_Dbg( p_demux, " * pid=%d listening for EAS", p_base_pid->i_pid );
......@@ -782,10 +799,10 @@ static void ATSC_STT_Callback( void *p_cb_basepid, dvbpsi_atsc_stt_t* p_stt )
dvbpsi_atsc_DeleteSTT( p_stt );
return;
}
demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->handle->p_sys;
demux_t *p_demux = (demux_t *) p_base_pid->u.p_psip->p_ctx->p_handle->p_sys;
demux_sys_t *p_sys = p_demux->p_sys;
ts_psip_context_t *p_ctx = p_base_pid->u.p_psip->p_ctx;
dvbpsi_t *p_handle = p_base_pid->u.p_psip->handle;
dvbpsi_t *p_handle = p_base_pid->u.p_psip->p_ctx->p_handle;
if( !p_ctx->p_stt ) /* First call */
{
......@@ -828,11 +845,11 @@ static void ATSC_STT_RawCallback( dvbpsi_t *p_handle, const dvbpsi_psi_section_t
}
}
bool ATSC_Attach_Dvbpsi_Base_Decoders( dvbpsi_t *p_handle, void *p_base_pid )
bool ATSC_Attach_Dvbpsi_Base_Decoders( ts_psip_context_t *p_ctx, void *p_base_pid )
{
if( !ATSC_ATTACH_WITH_FIXED_DECODER( p_handle, STT, ATSC_STT_TABLE_ID, 0x00, p_base_pid ) )
if( !ATSC_ATTACH_WITH_FIXED_DECODER( p_ctx->p_handle, STT, ATSC_STT_TABLE_ID, 0x00, p_base_pid ) )
{
ATSC_Detach_Dvbpsi_Decoders( p_handle ); /* shouldn't be any, except demux */
ATSC_Detach_Dvbpsi_Decoders( p_ctx->p_handle ); /* shouldn't be any, except demux */
return false;
}
return true;
......
......@@ -60,10 +60,9 @@ typedef struct ts_psip_context_t ts_psip_context_t;
void ts_psip_Packet_Push( ts_pid_t *, const uint8_t * );
ts_psip_context_t * ts_psip_context_New( void );
ts_psip_context_t * ts_psip_context_New( demux_t * );
void ts_psip_context_Delete( ts_psip_context_t * );
bool ATSC_Attach_Dvbpsi_Base_Decoders( dvbpsi_t *p_handle, void *p_cb_data );
void ATSC_Detach_Dvbpsi_Decoders( dvbpsi_t *p_handle );
bool ATSC_Attach_Dvbpsi_Base_Decoders( ts_psip_context_t *, void *p_cb_data );
#endif
......@@ -37,6 +37,7 @@
#include <dvbpsi/tot.h> /* TDT support */
#include <dvbpsi/dr.h>
#include <dvbpsi/psi.h>
#include "../../mux/mpeg/dvbpsi_compat.h" /* dvbpsi_messages */
#include "ts_si.h"
#include "ts_arib.h"
......@@ -55,6 +56,12 @@
#include <assert.h>
#include <limits.h>
struct ts_si_context_t
{
dvbpsi_t *p_handle;
int i_version;
};
#ifndef SI_DEBUG_EIT
#define SI_DEBUG_TIMESHIFT(t)
#else
......@@ -74,8 +81,8 @@ static void SINewTableCallBack( dvbpsi_t *h, uint8_t i_table_id,
void ts_si_Packet_Push( ts_pid_t *p_pid, const uint8_t *p_pktbuffer )
{
if( likely(p_pid->type == TYPE_SI) &&
dvbpsi_decoder_present( p_pid->u.p_si->handle ) )
dvbpsi_packet_push( p_pid->u.p_si->handle, (uint8_t *) p_pktbuffer );
dvbpsi_decoder_present( p_pid->u.p_si->p_ctx->p_handle ) )
dvbpsi_packet_push( p_pid->u.p_si->p_ctx->p_handle, (uint8_t *) p_pktbuffer );
}
static char *EITConvertToUTF8( demux_t *p_demux,
......@@ -154,14 +161,14 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
if( p_sys->es_creation != CREATE_ES ||
!p_sdt->b_current_next ||
p_sdt->i_version == sdt->u.p_si->i_version )
p_sdt->i_version == sdt->u.p_si->p_ctx->i_version )
{
dvbpsi_sdt_delete( p_sdt );
return;
}
/* First callback */
if( sdt->u.p_si->i_version == -1 )
if( sdt->u.p_si->p_ctx->i_version == -1 )
{
attach_SI_decoders( TS_SI_EIT_PID, "EIT", eitpid );
attach_SI_decoders( TS_SI_TDT_PID, "TDT", tdtpid );
......@@ -333,7 +340,7 @@ static void SDTCallBack( demux_t *p_demux, dvbpsi_sdt_t *p_sdt )
vlc_meta_Delete( p_meta );
}
sdt->u.p_si->i_version = p_sdt->i_version;
sdt->u.p_si->p_ctx->i_version = p_sdt->i_version;
dvbpsi_sdt_delete( p_sdt );
}
......@@ -396,7 +403,7 @@ static void TDTCallBack( demux_t *p_demux, dvbpsi_tot_t *p_tdt )
/* Because libdvbpsi is broken and deduplicating timestamp tables,
* we need to reset it to get next timestamp callback */
ts_pid_t *pid = ts_pid_Get( &p_sys->pids, TS_SI_TDT_PID );
dvbpsi_decoder_reset( pid->u.p_si->handle->p_decoder, true );
dvbpsi_decoder_reset( pid->u.p_si->p_ctx->p_handle->p_decoder, true );
dvbpsi_tot_delete(p_tdt);
es_out_Control( p_demux->out, ES_OUT_SET_EPG_TIME, (int64_t) p_sys->i_network_time );
......@@ -806,8 +813,33 @@ bool ts_attach_SI_Tables_Decoders( ts_pid_t *p_pid )
if( p_pid->type != TYPE_SI )
return false;
if( dvbpsi_decoder_present( p_pid->u.p_si->handle ) )
if( dvbpsi_decoder_present( p_pid->u.p_si->p_ctx->p_handle ) )
return true;
return dvbpsi_AttachDemux( p_pid->u.p_si->handle, SINewTableCallBack, p_pid );
return dvbpsi_AttachDemux( p_pid->u.p_si->p_ctx->p_handle, SINewTableCallBack, p_pid );
}
void ts_si_context_Delete( ts_si_context_t *p_ctx )
{
if( dvbpsi_decoder_present( p_ctx->p_handle ) )
dvbpsi_DetachDemux( p_ctx->p_handle );
dvbpsi_delete( p_ctx->p_handle );
free( p_ctx );
}
ts_si_context_t * ts_si_context_New( demux_t *p_demux )
{
ts_si_context_t *p_ctx = malloc(sizeof(*p_ctx));
if(likely(p_ctx))
{
p_ctx->p_handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !p_ctx->p_handle )
{
free( p_ctx );
return NULL;
}
p_ctx->p_handle->p_sys = (void *) p_demux;
p_ctx->i_version = -1;
}
return p_ctx;
}
......@@ -37,8 +37,13 @@
#define TS_SI_RUNSTATUS_RUNNING 0x04
#define TS_SI_RUNSTATUS_OFF_AIR 0x05
typedef struct ts_si_context_t ts_si_context_t;
void ts_si_Packet_Push( ts_pid_t *, const uint8_t * );
ts_si_context_t * ts_si_context_New( demux_t * );
void ts_si_context_Delete( ts_si_context_t * );
bool ts_attach_SI_Tables_Decoders( ts_pid_t * );
#endif
......@@ -26,17 +26,6 @@
#include "ts_streams.h"
#include "ts_streams_private.h"
#ifndef _DVBPSI_DVBPSI_H_
#include <dvbpsi/dvbpsi.h>
#endif
#ifndef _DVBPSI_DEMUX_H_
#include <dvbpsi/demux.h>
#endif
#include <dvbpsi/descriptor.h>
#include <dvbpsi/pat.h>
#include <dvbpsi/pmt.h>
#include "../../mux/mpeg/dvbpsi_compat.h" /* dvbpsi_messages */
#include <vlc_demux.h>
#include <vlc_es.h>
#include <vlc_es_out.h>
......@@ -45,24 +34,18 @@
#include "ts_pid.h"
#include "ts.h"
#include "ts_psi.h"
#include "ts_si.h"
#include "ts_psip.h"
static inline bool handle_Init( demux_t *p_demux, dvbpsi_t **handle )
{
*handle = dvbpsi_new( &dvbpsi_messages, DVBPSI_MSG_DEBUG );
if( !*handle )
return false;
(*handle)->p_sys = (void *) p_demux;
return true;
}
ts_pat_t *ts_pat_New( demux_t *p_demux )
{
ts_pat_t *pat = malloc( sizeof( ts_pat_t ) );
if( !pat )
return NULL;
if( !handle_Init( p_demux, &pat->handle ) )
pat->p_ctx = ts_psi_context_New( p_demux );
if( !pat->p_ctx )
{
free( pat );
return NULL;
......@@ -78,9 +61,7 @@ ts_pat_t *ts_pat_New( demux_t *p_demux )
void ts_pat_Del( demux_t *p_demux, ts_pat_t *pat )
{
if( dvbpsi_decoder_present( pat->handle ) )
dvbpsi_pat_detach( pat->handle );
dvbpsi_delete( pat->handle );
ts_psi_context_Delete( pat->p_ctx );
for( int i=0; i<pat->programs.i_size; i++ )
PIDRelease( p_demux, pat->programs.p_elems[i] );
ARRAY_RESET( pat->programs );
......@@ -105,7 +86,8 @@ ts_pmt_t *ts_pmt_New( demux_t *p_demux )
if( !pmt )
return NULL;
if( !handle_Init( p_demux, &pmt->handle ) )
pmt->p_ctx = ts_psi_context_New( p_demux );
if( !pmt->p_ctx )
{
free( pmt );
return NULL;
......@@ -146,9 +128,7 @@ ts_pmt_t *ts_pmt_New( demux_t *p_demux )
void ts_pmt_Del( demux_t *p_demux, ts_pmt_t *pmt )
{
if( dvbpsi_decoder_present( pmt->handle ) )
dvbpsi_pmt_detach( pmt->handle );
dvbpsi_delete( pmt->handle );
ts_psi_context_Delete( pmt->p_ctx );
for( int i=0; i<pmt->e_streams.i_size; i++ )
PIDRelease( p_demux, pmt->e_streams.p_elems[i] );
ARRAY_RESET( pmt->e_streams );
......@@ -326,13 +306,13 @@ ts_si_t *ts_si_New( demux_t *p_demux )
if( !si )
return NULL;
if( !handle_Init( p_demux, &si->handle ) )
si->p_ctx = ts_si_context_New( p_demux );
if( !si->p_ctx )
{
free( si );
return NULL;
}
si->i_version = -1;
si->eitpid = NULL;
si->tdtpid = NULL;
si->cdtpid = NULL;
......@@ -342,9 +322,7 @@ ts_si_t *ts_si_New( demux_t *p_demux )
void ts_si_Del( demux_t *p_demux, ts_si_t *si )
{
if( dvbpsi_decoder_present( si->handle ) )
dvbpsi_DetachDemux( si->handle );
dvbpsi_delete( si->handle );
ts_si_context_Delete( si->p_ctx );
if( si->eitpid )
PIDRelease( p_demux, si->eitpid );
if( si->tdtpid )
......@@ -356,17 +334,10 @@ void ts_si_Del( demux_t *p_demux, ts_si_t *si )
void ts_psip_Del( demux_t *p_demux, ts_psip_t *psip )
{
if( psip->p_ctx )
ts_psip_context_Delete( psip->p_ctx );
ts_psip_context_Delete( psip->p_ctx );
ts_pes_ChainDelete_es( p_demux, psip->p_eas_es );
if( psip->handle )
{
ATSC_Detach_Dvbpsi_Decoders( psip->handle );
dvbpsi_delete( psip->handle );
}
for( int i=0; i<psip->eit.i_size; i++ )
PIDRelease( p_demux, psip->eit.p_elems[i] );
ARRAY_RESET( psip->eit );
......@@ -380,21 +351,15 @@ ts_psip_t *ts_psip_New( demux_t *p_demux )
if( !psip )
return NULL;
if( !handle_Init( p_demux, &psip->handle ) )
psip->p_ctx = ts_psip_context_New( p_demux );
if( !psip->p_ctx )
{
free( psip );
return NULL;
}
ARRAY_INIT( psip->eit );
psip->i_version = -1;
psip->p_eas_es = NULL;
psip->p_ctx = ts_psip_context_New();
if( !psip->p_ctx )
{
ts_psip_Del( p_demux, psip );
psip = NULL;
}
return psip;
}
......@@ -19,7 +19,7 @@
#ifndef VLC_TS_STREAMS_PRIVATE_H
#define VLC_TS_STREAMS_PRIVATE_H
typedef struct dvbpsi_s dvbpsi_t;
typedef struct ts_psi_context_t ts_psi_context_t;
typedef struct ts_sections_processor_t ts_sections_processor_t;
#include "mpeg4_iod.h"
......@@ -31,17 +31,17 @@ typedef struct ts_sections_processor_t ts_sections_processor_t;
struct ts_pat_t
{
ts_psi_context_t *p_ctx;
int i_version;
int i_ts_id;
bool b_generated;
dvbpsi_t *handle;
DECL_ARRAY(ts_pid_t *) programs;
};
struct ts_pmt_t
{
dvbpsi_t *handle;
ts_psi_context_t *p_ctx;
int i_version;
int i_number;
int i_pid_pcr;
......@@ -150,8 +150,7 @@ typedef struct ts_si_context_t ts_si_context_t;
struct ts_si_t
{
dvbpsi_t *handle;
int i_version;
ts_si_context_t *p_ctx;
/* Track successfully set pid */
ts_pid_t *eitpid;
ts_pid_t *tdtpid;
......@@ -162,10 +161,8 @@ typedef struct ts_psip_context_t ts_psip_context_t;
struct ts_psip_t
{
dvbpsi_t *handle;
int i_version;
ts_es_t *p_eas_es;
ts_psip_context_t *p_ctx;
ts_es_t *p_eas_es;
/* Used to track list of active pid for eit/ett, to call PIDRelease on them.
VCT table could have been used, but PIDSetup can fail, and we can't alter
the VCT table accordingly without going ahead of more troubles */
......