Avalpa Community

The place where we can talk freely about Avalpa product and services
It is currently Thu May 26, 2022 3:41 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: BAT
PostPosted: Fri May 08, 2015 3:00 pm 
Offline

Joined: Thu Feb 13, 2014 12:48 pm
Posts: 5
Could you please give an example of BAT table generation?


Top
 Profile  
 
 Post subject: Re: BAT
PostPosted: Wed May 13, 2015 7:55 am 
Offline

Joined: Thu Feb 13, 2014 12:48 pm
Posts: 5
I made some progress, here is an example:

PSI/BAT.py

Code:
#! /usr/bin/env python


import string
from dvbobjects.MPEG.Section import Section
from dvbobjects.utils import *
from dvbobjects.DVB.Descriptors import *

######################################################################
class bouquet_association_section(Section):

    table_id = 0x4A
   
    section_max_size = 1024

    def pack_section_body(self):
   
        # pack bouquet_descriptor_loop
        ndl_bytes = string.join(
            map(lambda x: x.pack(),
                self.bouquet_descriptor_loop),
            "")

        # pack transport_stream_loop
        tsl_bytes = string.join(
            map(lambda x: x.pack(),
                self.transport_stream_loop),
            "")

        self.table_id_extension = self.bouquet_id
        self.private_indicator = 1

        fmt = "!H%dsH%ds" % (len(ndl_bytes), len(tsl_bytes))
        return pack(fmt,
            0xF000 | (len(ndl_bytes) & 0x0FFF),
            ndl_bytes,
            0xF000 | (len(tsl_bytes) & 0x0FFF),
            tsl_bytes,
            )

######################################################################
class transport_stream_loop_item(DVBobject):

    def pack(self):
   
        # pack transport_descriptor_loop
        tdl_bytes = string.join(
            map(lambda x: x.pack(),
                self.transport_descriptor_loop),
            "")

        fmt = "!HHH%ds" % len(tdl_bytes)
        return pack(fmt,
                    self.transport_stream_id,
                    self.original_network_id,
                    0xF000 | (len(tdl_bytes) & 0x0FFF),
                    tdl_bytes,
                    )

                   


basically its the same as NIT.py


Descriptors.py:
Code:
######################################################################
class bouquet_name_descriptor(Descriptor):

    descriptor_tag = 0x47

    def bytes(self):
        fmt = "!%ds" % len(self.bouquet_name)
        return pack(fmt,
          self.bouquet_name)


######################################################################
class user_defined_descriptor(Descriptor):

    descriptor_tag = 0x91

    def bytes(self):
        fmt = "!%ds" % len(self.descriptor_data)
        return pack(fmt,
          self.descriptor_data)


######################################################################


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group