From patchwork Thu Sep 18 18:11:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 4933131 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9559BBEEA5 for ; Thu, 18 Sep 2014 18:12:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F0342017D for ; Thu, 18 Sep 2014 18:12:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC506200D9 for ; Thu, 18 Sep 2014 18:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932273AbaIRSML (ORCPT ); Thu, 18 Sep 2014 14:12:11 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:45040 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932117AbaIRSMK (ORCPT ); Thu, 18 Sep 2014 14:12:10 -0400 Received: by mail-wi0-f172.google.com with SMTP id hi2so730366wib.17 for ; Thu, 18 Sep 2014 11:12:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=CosjegUV6AGNUnHsnv9QfE23sX/w7yq/2sz7k/0cvk4=; b=KL+6Vxry90ZSYcu2MvkHHEMJm4BJc69I/B3AoTwVxwga40IHJvVpJQcb6St6Bqo233 cMF8F4GWkw3YADWYigvaJ8c5un7wCKBrvZmZnSkjHPbuxAFtSXGxa70fMcfwoANMy2r1 Jnu+xIf+fSXZWZB0bpal/Hs96lni0mpllcSYF4ZIJlFgvl9YdeSSEtNOjVw9s0wibIUy uTHDmtx4jO8fb+MQIhCDPkKa2xFIUsJuYcKD0i6OuB/19C27xYdsvZYKLK3kArsdoVjh GN39H/6xhmBTWCYCKYypRy2gfMTnoEnmBCbXq5UNnu48pMblLvnmBpU+o22HiU005gkN 2YHw== X-Received: by 10.180.9.144 with SMTP id z16mr49240766wia.26.1411063928608; Thu, 18 Sep 2014 11:12:08 -0700 (PDT) Received: from neutrino.exnihilo (162-27.194-178.cust.bluewin.ch. [178.194.27.162]) by mx.google.com with ESMTPSA id i5sm26936286wjz.0.2014.09.18.11.12.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Sep 2014 11:12:07 -0700 (PDT) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH v2] libdvbv5: MPEG TS parser documentation Date: Thu, 18 Sep 2014 20:11:56 +0200 Message-Id: <1411063916-4762-1-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: André Roth --- doxygen_libdvbv5.cfg | 1 + lib/include/libdvbv5/mpeg_ts.h | 96 ++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 94 insertions(+), 3 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/doxygen_libdvbv5.cfg b/doxygen_libdvbv5.cfg index f1f9ab4..bbdaf9a 100644 --- a/doxygen_libdvbv5.cfg +++ b/doxygen_libdvbv5.cfg @@ -765,6 +765,7 @@ INPUT = $(SRCDIR)/doc/libdvbv5-index.doc \ $(SRCDIR)/lib/include/libdvbv5/vct.h \ $(SRCDIR)/lib/include/libdvbv5/crc32.h \ $(SRCDIR)/lib/include/libdvbv5/mpeg_es.h \ + $(SRCDIR)/lib/include/libdvbv5/mpeg_ts.h \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses diff --git a/lib/include/libdvbv5/mpeg_ts.h b/lib/include/libdvbv5/mpeg_ts.h index 3eab029..2662543 100644 --- a/lib/include/libdvbv5/mpeg_ts.h +++ b/lib/include/libdvbv5/mpeg_ts.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 - Andre Roth + * Copyright (c) 2013-2014 - Andre Roth * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -21,12 +21,52 @@ #ifndef _MPEG_TS_H #define _MPEG_TS_H +/** + * @file mpeg_ts.h + * @ingroup dvb_table + * @brief Provides the table parser for the MPEG-PES Elementary Stream + * @copyright GNU General Public License version 2 (GPLv2) + * @author Andre Roth + * + * @par Relevant specs + * The table described herein is defined in ISO 13818-1 + * + * @see + * http://en.wikipedia.org/wiki/MPEG_transport_stream + * + * @par Bug Report + * Please submit bug reports and patches to linux-media@vger.kernel.org + */ #include #include /* ssize_t */ +/** + * @def DVB_MPEG_TS + * @brief MPEG Transport Stream magic + * @ingroup dvb_table + * @def DVB_MPEG_TS_PACKET_SIZE + * @brief Size of an MPEG packet + * @ingroup dvb_table + */ #define DVB_MPEG_TS 0x47 #define DVB_MPEG_TS_PACKET_SIZE 188 +/** + * @struct dvb_mpeg_ts_adaption + * @brief MPEG TS header adaption field + * + * @param type DVB_MPEG_ES_SEQ_START + * @param length 1 bit Adaptation Field Length + * @param discontinued 1 bit Discontinuity indicator + * @param random_access 1 bit Random Access indicator + * @param priority 1 bit Elementary stream priority indicator + * @param PCR 1 bit PCR flag + * @param OPCR 1 bit OPCR flag + * @param splicing_point 1 bit Splicing point flag + * @param private_data 1 bit Transport private data flag + * @param extension 1 bit Adaptation field extension flag + * @param data Pointer to data + */ struct dvb_mpeg_ts_adaption { uint8_t length; struct { @@ -42,8 +82,23 @@ struct dvb_mpeg_ts_adaption { uint8_t data[]; } __attribute__((packed)); +/** + * @structdvb_mpeg_ts + * @brief MPEG TS header + * + * @param sync_byte DVB_MPEG_TS + * @param tei 1 bit Transport Error Indicator + * @param payload_start 1 bit Payload Unit Start Indicator + * @param priority 1 bit Transport Priority + * @param pid 13 bits Packet Identifier + * @param scrambling 2 bits Scrambling control + * @param adaptation_field 1 bit Adaptation field exist + * @param payload 1 bit Contains payload + * @param continuity_counter 4 bits Continuity counter + * @param adaption Pointer to optional adaption fiels (struct dvb_mpeg_ts_adaption) + */ struct dvb_mpeg_ts { - uint8_t sync_byte; // DVB_MPEG_TS + uint8_t sync_byte; union { uint16_t bitfield; struct { @@ -68,8 +123,43 @@ struct dvb_v5_fe_parms; extern "C" { #endif -ssize_t dvb_mpeg_ts_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, uint8_t *table, ssize_t *table_length); +/** + * @brief Initialize a struct dvb_mpeg_ts from buffer + * + * @param parms struct dvb_v5_fe_parms for log functions + * @param buf Buffer + * @param buflen Length of buffer + * @param table Pointer to allocated struct dvb_mpeg_ts + * @param table_length Pointer to size_t where length will be written to + * + * @return Length of data in table + * + * This function copies the length of struct dvb_mpeg_ts + * to table and fixes endianness. table has to be allocated + * with malloc. + */ +ssize_t dvb_mpeg_ts_init (struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize_t buflen, + uint8_t *table, ssize_t *table_length); + +/** + * @brief Deallocate memory associated with a struct dvb_mpeg_ts + * @ingroup file + * + * @param ts struct dvb_mpeg_ts to be deallocated + * + * This function assumes frees dynamically allocated memory by the + * dvb_mpeg_ts_init function. + */ void dvb_mpeg_ts_free(struct dvb_mpeg_ts *ts); + +/** + * @brief Print details of struct dvb_mpeg_ts + * + * @param parms struct dvb_v5_fe_parms for log functions + * @param seq_start Pointer to struct dvb_mpeg_ts to print + * + * This function prints the fields of struct dvb_mpeg_ts + */ void dvb_mpeg_ts_print(struct dvb_v5_fe_parms *parms, struct dvb_mpeg_ts *ts); #ifdef __cplusplus