From patchwork Tue Jun 18 14:19:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guy Martin X-Patchwork-Id: 2742751 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 B8CCB9F472 for ; Tue, 18 Jun 2013 14:21:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B83B20171 for ; Tue, 18 Jun 2013 14:21:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D2BCD20153 for ; Tue, 18 Jun 2013 14:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932943Ab3FROVV (ORCPT ); Tue, 18 Jun 2013 10:21:21 -0400 Received: from venus.vo.lu ([80.90.45.96]:57452 "EHLO venus.vo.lu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932868Ab3FROUh (ORCPT ); Tue, 18 Jun 2013 10:20:37 -0400 Received: from ibiza.bxl.tuxicoman.be (vodsl-9486.vo.lu [85.93.204.14]) by venus.vo.lu with SMTP (version=TLS\Tls cipher=Aes128 bits=128); Tue, 18 Jun 2013 16:20:11 +0200 Received: from [2001:7e8:2221:300:230:5ff:fec0:2d3b] (helo=devbox) by ibiza.bxl.tuxicoman.be with smtp (Exim 4.80.1) (envelope-from ) id 1Uowll-0006xN-8i for linux-media@vger.kernel.org; Tue, 18 Jun 2013 16:20:26 +0200 Received: by devbox (sSMTP sendmail emulation); Tue, 18 Jun 2013 16:19:12 +0200 From: Guy Martin To: linux-media@vger.kernel.org Subject: [PATCH 2/6] libdvbv5: Add parsing of POLARIZATION Date: Tue, 18 Jun 2013 16:19:05 +0200 Message-Id: <9815a1c1f366563e7c20e19bea0703e0afb2ef51.1371561676.git.gmsoft@tuxicoman.be> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 This patch add parsing support for the POLARIZATION parameter for the DVBv5 file format. Signed-off-by: Guy Martin Acked-by: André Roth --- lib/include/dvb-file.h | 1 - lib/libdvbv5/dvb-file.c | 65 ++++++++++++++++++++++--------------------------- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/lib/include/dvb-file.h b/lib/include/dvb-file.h index ea76080..e38fe85 100644 --- a/lib/include/dvb-file.h +++ b/lib/include/dvb-file.h @@ -35,7 +35,6 @@ struct dvb_entry { char *location; -// enum dvbsat_polarization pol; int sat_number; unsigned freq_bpf; unsigned diseqc_wait; diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c index aa42a37..02b28e7 100644 --- a/lib/libdvbv5/dvb-file.c +++ b/lib/libdvbv5/dvb-file.c @@ -357,6 +357,29 @@ error: return -1; } +static int store_entry_prop(struct dvb_entry *entry, + uint32_t cmd, uint32_t value) +{ + int i; + + for (i = 0; i < entry->n_props; i++) { + if (cmd == entry->props[i].cmd) + break; + } + if (i == entry->n_props) { + if (i == DTV_MAX_COMMAND) { + fprintf(stderr, "Can't add property %s\n", + dvb_v5_name[cmd]); + return -1; + } + entry->n_props++; + entry->props[i].cmd = cmd; + } + + entry->props[i].u.data = value; + + return 0; +} #define CHANNEL "CHANNEL" @@ -428,16 +451,15 @@ static int fill_entry(struct dvb_entry *entry, char *key, char *value) is_video = 1; else if (!strcasecmp(key, "AUDIO_PID")) is_audio = 1; - /*else if (!strcasecmp(key, "POLARIZATION")) { - entry->service_id = atol(value); - for (j = 0; ARRAY_SIZE(pol_name); j++) - if (!strcasecmp(value, pol_name[j])) + else if (!strcasecmp(key, "POLARIZATION")) { + for (j = 0; ARRAY_SIZE(dvb_sat_pol_name); j++) + if (!strcasecmp(value, dvb_sat_pol_name[j])) break; - if (j == ARRAY_SIZE(pol_name)) + if (j == ARRAY_SIZE(dvb_sat_pol_name)) return -2; - entry->pol = j; + store_entry_prop(entry, DTV_POLARIZATION, j); return 0; - }*/ else if (!strncasecmp(key,"PID_", 4)){ + } else if (!strncasecmp(key,"PID_", 4)){ type = strtol(&key[4], NULL, 16); if (!type) return 0; @@ -647,11 +669,6 @@ int write_dvb_file(const char *fname, struct dvb_file *dvb_file) fprintf(fp, "\n"); } - /*if (entry->pol != POLARIZATION_OFF) {*/ - /*fprintf(fp, "\tPOLARIZATION = %s\n",*/ - /*pol_name[entry->pol]);*/ - /*}*/ - if (entry->sat_number >= 0) { fprintf(fp, "\tSAT_NUMBER = %d\n", entry->sat_number); @@ -751,29 +768,6 @@ char *dvb_vchannel(struct dvb_v5_descriptors *dvb_desc, return buf; } -static int store_entry_prop(struct dvb_entry *entry, - uint32_t cmd, uint32_t value) -{ - int i; - - for (i = 0; i < entry->n_props; i++) { - if (cmd == entry->props[i].cmd) - break; - } - if (i == entry->n_props) { - if (i == DTV_MAX_COMMAND) { - fprintf(stderr, "Can't add property %s\n", - dvb_v5_name[cmd]); - return -1; - } - entry->n_props++; - } - - entry->props[i].u.data = value; - - return 0; -} - static void handle_std_specific_parms(struct dvb_entry *entry, struct dvb_v5_descriptors *dvb_desc) { @@ -812,7 +806,6 @@ static void handle_std_specific_parms(struct dvb_entry *entry, nit_table->frequency[0]); store_entry_prop(entry, DTV_MODULATION, nit_table->modulation); - /*entry->pol = nit_table->pol;*/ store_entry_prop(entry, DTV_POLARIZATION, nit_table->pol); store_entry_prop(entry, DTV_DELIVERY_SYSTEM,