Commit 0602ad23 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Remove trailing whitespace and updated comments.

parent b14bc0fe
......@@ -21,7 +21,6 @@
*
*****************************************************************************/
#include "config.h"
#include <stdio.h>
......@@ -40,18 +39,17 @@
#include "dr_56.h"
/*****************************************************************************
* dvbpsi_DecodeTeletextDr
*****************************************************************************/
dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
dvbpsi_descriptor_t * p_descriptor)
{
int i_pages_number, i;
int i_pages_number, i;
dvbpsi_teletext_dr_t * p_decoded;
/* Check the tag */
if(p_descriptor->i_tag != 0x56 && p_descriptor->i_tag != 0x46)
if( (p_descriptor->i_tag != 0x56) && (p_descriptor->i_tag != 0x46) )
{
DVBPSI_ERROR_ARG("dr_46/56 decoder", "bad tag (0x%x)", p_descriptor->i_tag);
return NULL;
......@@ -64,45 +62,45 @@ dvbpsi_teletext_dr_t * dvbpsi_DecodeTeletextDr(
/* Decode data and check the length */
if(p_descriptor->i_length < 3)
{
DVBPSI_ERROR_ARG("dr_56 decoder", "bad length (%d)",
DVBPSI_ERROR_ARG("dr_46/dr_56 decoder", "bad length (%d)",
p_descriptor->i_length);
return NULL;
}
if(p_descriptor->i_length % 5)
{
DVBPSI_ERROR_ARG("dr_56 decoder", "length not multiple of 5(%d)",
DVBPSI_ERROR_ARG("dr_46/dr_56 decoder", "length not multiple of 5(%d)",
p_descriptor->i_length);
return NULL;
}
i_pages_number = p_descriptor->i_length / 5;
/* Allocate memory */
p_decoded =
(dvbpsi_teletext_dr_t*)malloc(sizeof(dvbpsi_teletext_dr_t));
if(!p_decoded)
{
DVBPSI_ERROR("dr_56 decoder", "out of memory");
DVBPSI_ERROR("dr_46/dr_56 decoder", "out of memory");
return NULL;
}
p_decoded->i_pages_number = i_pages_number;
for(i=0; i < i_pages_number; i++)
{
memcpy(p_decoded->p_pages[i].i_iso6392_language_code,
p_descriptor->p_data + 5 * i, 3);
p_decoded->p_pages[i].i_teletext_type =
p_decoded->p_pages[i].i_teletext_type =
((uint8_t)(p_descriptor->p_data[5 * i + 3]) >> 3);
p_decoded->p_pages[i].i_teletext_magazine_number =
p_decoded->p_pages[i].i_teletext_magazine_number =
((uint16_t)(p_descriptor->p_data[5 * i + 3]) & 0x07);
p_decoded->p_pages[i].i_teletext_page_number = p_descriptor->p_data[5 * i + 4];
}
p_descriptor->p_decoded = (void*)p_decoded;
return p_decoded;
......@@ -117,28 +115,28 @@ dvbpsi_descriptor_t * dvbpsi_GenTeletextDr(
int b_duplicate)
{
int i;
/* Create the descriptor */
dvbpsi_descriptor_t * p_descriptor =
dvbpsi_NewDescriptor(0x56, p_decoded->i_pages_number * 8 , NULL);
if(p_descriptor)
{
/* Encode data */
for (i=0; i < p_decoded->i_pages_number; i++ )
{
{
memcpy( p_descriptor->p_data + 8 * i,
p_decoded->p_pages[i].i_iso6392_language_code,
3);
p_descriptor->p_data[8 * i + 3] =
(uint8_t) ( ( (uint8_t) p_decoded->p_pages[i].i_teletext_type << 3 ) |
(uint8_t) ( ( (uint8_t) p_decoded->p_pages[i].i_teletext_type << 3 ) |
( (uint8_t) p_decoded->p_pages[i].i_teletext_magazine_number & 0x07 ) );
p_descriptor->p_data[8 * i + 4] =
p_descriptor->p_data[8 * i + 4] =
p_decoded->p_pages[i].i_teletext_page_number;
}
if(b_duplicate)
{
/* Duplicate decoded data */
......@@ -146,11 +144,10 @@ dvbpsi_descriptor_t * dvbpsi_GenTeletextDr(
(dvbpsi_teletext_dr_t*)malloc(sizeof(dvbpsi_teletext_dr_t));
if(p_dup_decoded)
memcpy(p_dup_decoded, p_decoded, sizeof(dvbpsi_teletext_dr_t));
p_descriptor->p_decoded = (void*)p_dup_decoded;
}
}
return p_descriptor;
}
......@@ -26,9 +26,9 @@
* \author Derk-Jan Hartman <hartman at videolan dot org>
* \brief EBU Teletext descriptor parsing.
*
* DVB EBU Teletext descriptor parsing, according to ETSI EN 300 468
* section 6.2.41.
*
* DVB EBU Teletext descriptor parsing, according to ETSI EN 300 468
* version 1.7.1 section 6.2.42 and 6.2.47.
*
* NOTE: this descriptor is known by tag value 0x56 AND 0x46
*/
......@@ -71,7 +71,7 @@ typedef struct dvbpsi_teletextpage_s
* \brief "teletext" descriptor structure.
*
* This structure is used to store a decoded "teletext"
* descriptor. (ETSI EN 300 468 section 6.2.41).
* descriptor. (ETSI EN 300 468 version 1.7.1 section 6.2.42 and 6.2.47).
*/
/*!
* \typedef struct dvbpsi_teletext_dr_s dvbpsi_teletext_dr_t
......@@ -125,4 +125,3 @@ dvbpsi_descriptor_t * dvbpsi_GenTeletextDr(
#else
#error "Multiple inclusions of dr_56.h"
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment