From patchwork Wed Jan 8 11:23:26 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: 3453481 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 446249F374 for ; Wed, 8 Jan 2014 11:23:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12E0F20149 for ; Wed, 8 Jan 2014 11:23:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 099E220144 for ; Wed, 8 Jan 2014 11:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755099AbaAHLXy (ORCPT ); Wed, 8 Jan 2014 06:23:54 -0500 Received: from mail-ea0-f177.google.com ([209.85.215.177]:51543 "EHLO mail-ea0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754867AbaAHLXy (ORCPT ); Wed, 8 Jan 2014 06:23:54 -0500 Received: by mail-ea0-f177.google.com with SMTP id n15so753076ead.8 for ; Wed, 08 Jan 2014 03:23:52 -0800 (PST) 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=vJB7IZBvYCOLcPOUwLgNykZnZfeiojWBXXa/JNlnO2c=; b=Ozv2vxeEByB9gdTbIuw0YTngEbQSUE+nryKsGnxv6Id/x5YxiDNjkt6RmD0q5rTFKX 11krlgRx847PfZbybaLOPpSMbh8CnQCQ222cDVCGVJhGt5xDlBYcCgOjc6gGqB84W3qP Phi13Sl0CFIX8xWte64Gx7xV8P+3mPqHfdL5bmaQ7xW/+pkikvT2x1fAzXexV75UiicB bAieV8m4um7YJe8wOUkG6d1H2lQVaas1X4GDSKye0VEXAdreNQxfkX1Kqfb3YwVPRz66 kaZW07yvVIj1nrpWaCFqcrJ3/JnuFyrLI9m9SzNrKKEmiaDcnK7fMxWgwbXN4HSk7PqF dkgQ== X-Received: by 10.14.88.5 with SMTP id z5mr12650333eee.101.1389180232712; Wed, 08 Jan 2014 03:23:52 -0800 (PST) Received: from neutrino.exnihilo (140-227.61-188.cust.bluewin.ch. [188.61.227.140]) by mx.google.com with ESMTPSA id l4sm188551890een.13.2014.01.08.03.23.51 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 03:23:52 -0800 (PST) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 1/3] libdvbv5: implement ATSC standard header Date: Wed, 8 Jan 2014 12:23:26 +0100 Message-Id: <1389180208-3458-1-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.8.3.2 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=-6.9 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 The ATSC standard header is slightly different from the one used in DVB. This implements the parser for it, and will be used by the VCT table for example. Signed-off-by: André Roth --- lib/include/descriptors/atsc_header.h | 63 ++++++++++++++++++++++++++++++++++ lib/libdvbv5/descriptors/atsc_header.c | 47 +++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 lib/include/descriptors/atsc_header.h create mode 100644 lib/libdvbv5/descriptors/atsc_header.c diff --git a/lib/include/descriptors/atsc_header.h b/lib/include/descriptors/atsc_header.h new file mode 100644 index 0000000..1e7148e --- /dev/null +++ b/lib/include/descriptors/atsc_header.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2013 - Andre Roth + * + * 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 version 2 + * of the License. + * + * 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 02110-1301 USA + * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * + */ + +#ifndef _ATSC_HEADER_H +#define _ATSC_HEADER_H + +#include +#include /* ssize_t */ + +#define ATSC_BASE_PID 0x1FFB + +struct atsc_table_header { + uint8_t table_id; + union { + uint16_t bitfield; + struct { + uint16_t section_length:12; + uint16_t one:2; + uint16_t priv:1; + uint16_t syntax:1; + } __attribute__((packed)); + }; + uint16_t id; + uint8_t current_next:1; + uint8_t version:5; + uint8_t one2:2; + + uint8_t section_id; + uint8_t last_section; + uint8_t protocol_version; +} __attribute__((packed)); + +struct dvb_v5_fe_parms; + +#ifdef __cplusplus +extern "C" { +#endif + +int atsc_table_header_init (struct atsc_table_header *t); +void atsc_table_header_print(struct dvb_v5_fe_parms *parms, const struct atsc_table_header *t); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/lib/libdvbv5/descriptors/atsc_header.c b/lib/libdvbv5/descriptors/atsc_header.c new file mode 100644 index 0000000..ed152ce --- /dev/null +++ b/lib/libdvbv5/descriptors/atsc_header.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 - Andre Roth + * + * 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 version 2 + * of the License. + * + * 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 02110-1301 USA + * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * + */ + +#include "descriptors/atsc_header.h" +#include "descriptors.h" +#include "dvb-fe.h" + +int atsc_table_header_init(struct atsc_table_header *t) +{ + bswap16(t->bitfield); + bswap16(t->id); + return 0; +} + +void atsc_table_header_print(struct dvb_v5_fe_parms *parms, const struct atsc_table_header *t) +{ + dvb_log("| table_id %02x", t->table_id); + dvb_log("| section_length %d", t->section_length); + dvb_log("| syntax %d", t->syntax); + dvb_log("| priv %d", t->priv); + dvb_log("| one %d", t->one); + dvb_log("| id %d", t->id); + dvb_log("| one2 %d", t->one2); + dvb_log("| version %d", t->version); + dvb_log("| current_next %d", t->current_next); + dvb_log("| section_id %d", t->section_id); + dvb_log("| last_section %d", t->last_section); + dvb_log("| protocol_version %d", t->protocol_version); +} +