summaryrefslogtreecommitdiff
authorKe Gong <ke.gong@amlogic.com>2017-06-09 06:21:16 (GMT)
committer Ke Gong <ke.gong@amlogic.com>2017-06-09 06:21:16 (GMT)
commit17e543666fadf3322f38437a317615c531ea70d1 (patch)
tree894b1e8a006a5c9ecb95138c97f096a2af7d3b65
parentd5cac95e32d8e61793daab8e8da5a6f4204907a9 (diff)
downloadlibzvbi-17e543666fadf3322f38437a317615c531ea70d1.zip
libzvbi-17e543666fadf3322f38437a317615c531ea70d1.tar.gz
libzvbi-17e543666fadf3322f38437a317615c531ea70d1.tar.bz2
PD#144711: xds: add rating info event
Squashed commit of the following: commit a6781ee3d4c776430a05be9c982c67d3a082f861 Merge: 23a525a e24d50f Author: Pengfei Liu <pengfei.liu@amlogic.com> Date: Fri May 26 14:00:37 2017 +0800 PD#144711: xds: add rating info struct commit 23a525a854b4119af95c417b90b8e83194b3861e Author: Pengfei Liu <pengfei.liu@amlogic.com> Date: Thu May 25 14:55:06 2017 +0800 PD#144711: xds: add rating info event Change-Id: Iae1fc76c9be1f23fd001a6085ff9a11f09cff16e
Diffstat
-rwxr-xr-xntsc_decode/am_vbi.c26
-rwxr-xr-xsrc/caption.c28
-rwxr-xr-x[-rw-r--r--]src/event.h23
-rwxr-xr-x[-rw-r--r--]src/libzvbi.h19
-rwxr-xr-x[-rw-r--r--]src/vbi.c2
5 files changed, 55 insertions, 43 deletions
diff --git a/ntsc_decode/am_vbi.c b/ntsc_decode/am_vbi.c
index 85d82fb..3bb8411 100755
--- a/ntsc_decode/am_vbi.c
+++ b/ntsc_decode/am_vbi.c
@@ -205,7 +205,7 @@ static void vbi_xds_handler (vbi_event * ev, void * user_data)
* For details STFW for "v-chip"
* If unknown rating_auth == VBI_RATING_NONE
*/
- if(!(prog_info->rating_auth == VBI_RATING_AUTH_NONE))
+ if(!(prog_info->rating.auth == VBI_RATING_AUTH_NONE))
{
xds_program = VBI_XDS_PROGRAM_RATING;
AM_DEBUG("xds*********VBI_XDS_PROGRAM_RATING \n");
@@ -244,30 +244,30 @@ static void vbi_xds_handler (vbi_event * ev, void * user_data)
}
- if(prog_info->rating_auth != VBI_RATING_AUTH_NONE)
+ if(prog_info->rating.auth != VBI_RATING_AUTH_NONE)
{
- AM_DEBUG("xds**********prog_info->rating_auth = %d\n",prog_info->rating_auth );
+ AM_DEBUG("xds**********prog_info->rating_auth = %d\n",prog_info->rating.auth );
- if(prog_info->rating_auth == VBI_RATING_AUTH_MPAA)
+ if(prog_info->rating.auth == VBI_RATING_AUTH_MPAA)
AM_DEBUG("xds**********result*******************VBI_RATING_AUTH_MPAA\n");
- if(prog_info->rating_auth == VBI_RATING_AUTH_TV_US)
+ if(prog_info->rating.auth == VBI_RATING_AUTH_TV_US)
AM_DEBUG("xds**********result*******************VBI_RATING_AUTH_TV_US\n");
- if(prog_info->rating_auth == VBI_RATING_AUTH_TV_CA_EN)
+ if(prog_info->rating.auth == VBI_RATING_AUTH_TV_CA_EN)
AM_DEBUG("xds**********result*******************VBI_RATING_AUTH_TV_CA_EN\n");
- if(prog_info->rating_auth == VBI_RATING_AUTH_TV_CA_FR)
+ if(prog_info->rating.auth == VBI_RATING_AUTH_TV_CA_FR)
AM_DEBUG("xds**********result*******************VBI_RATING_AUTH_TV_CA_FR\n");
- if(prog_info->rating_auth == VBI_RATING_AUTH_NONE)
+ if(prog_info->rating.auth == VBI_RATING_AUTH_NONE)
AM_DEBUG("result*******************VBI_RATING_AUTH_NONE\n");
- if (prog_info->rating_dlsv == VBI_RATING_D)
+ if (prog_info->rating.dlsv == VBI_RATING_D)
AM_DEBUG("xds**********result*******************VBI_RATING_D\n");
- if (prog_info->rating_dlsv == VBI_RATING_L)
+ if (prog_info->rating.dlsv == VBI_RATING_L)
AM_DEBUG("xds**********result*******************VBI_RATING_L\n");
- if (prog_info->rating_dlsv == VBI_RATING_S)
+ if (prog_info->rating.dlsv == VBI_RATING_S)
AM_DEBUG("xds**********result*******************VBI_RATING_S\n");
- if (prog_info->rating_dlsv == VBI_RATING_V)
+ if (prog_info->rating.dlsv == VBI_RATING_V)
AM_DEBUG("xds**********result*******************VBI_RATING_V\n");
- AM_DEBUG("xds**********result*******************prog_info->rating_id = %d\n",prog_info->rating_id );
+ AM_DEBUG("xds**********result*******************prog_info->rating_id = %d\n",prog_info->rating.id );
}
diff --git a/src/caption.c b/src/caption.c
index d6de9b6..125223f 100755
--- a/src/caption.c
+++ b/src/caption.c
@@ -169,7 +169,7 @@ xds_decoder(vbi_decoder *vbi, int _class, int type,
switch (_class) {
case XDS_CURRENT: /* 0 */
case XDS_FUTURE: /* 1 */
- if (!(vbi->event_mask & (VBI_EVENT_ASPECT | VBI_EVENT_PROG_INFO))){
+ if (!(vbi->event_mask & (VBI_EVENT_ASPECT | VBI_EVENT_PROG_INFO | VBI_EVENT_RATING))){
XDS_SEP_DEBUG("vbi->event_mask & VBI_EVENT_ASPECT | VBI_EVENT_PROG_INFO");
return;
}
@@ -309,7 +309,7 @@ xds_decoder(vbi_decoder *vbi, int _class, int type,
if ((buffer[0] & 0x08) == 0) {
if (r == 0) return;
auth = VBI_RATING_AUTH_MPAA;
- pi->rating_dlsv = dlsv = 0;
+ pi->rating.dlsv = dlsv = 0;
} else if ((buffer[0] & 0x10) == 0) {
auth = VBI_RATING_AUTH_TV_US;
r = g;
@@ -321,20 +321,22 @@ xds_decoder(vbi_decoder *vbi, int _class, int type,
if ((r = g) > 5) return;
auth = VBI_RATING_AUTH_TV_CA_FR;
}
- pi->rating_dlsv = dlsv = 0;
+ pi->rating.dlsv = dlsv = 0;
} else
return;
- if ((neq = (pi->rating_auth != auth
- || pi->rating_id != r
- || pi->rating_dlsv != dlsv))) {
- pi->rating_auth = auth;
- pi->rating_id = r;
- pi->rating_dlsv = dlsv;
- }
- e.type = VBI_EVENT_PROG_INFO;
- e.ev.prog_info = pi;
- caption_send_event(vbi, &e);
+ if ((neq = (pi->rating.auth != auth
+ || pi->rating.id != r
+ || pi->rating.dlsv != dlsv))) {
+ pi->rating.auth = auth;
+ pi->rating.id = r;
+ pi->rating.dlsv = dlsv;
+ }
+ if (vbi->event_mask & VBI_EVENT_RATING){
+ e.type = VBI_EVENT_RATING;
+ e.ev.prog_info = pi;
+ caption_send_event(vbi, &e);
+ }
break;
}
diff --git a/src/event.h b/src/event.h
index 1977cef..1ba71ee 100644..100755
--- a/src/event.h
+++ b/src/event.h
@@ -417,7 +417,16 @@ typedef enum {
*/
VBI_AUDIO_MODE_UNKNOWN
} vbi_audio_mode;
-
+typedef struct vbi_rating{
+ /*
+ * For details STFW for "v-chip"
+ * If unknown rating_auth == VBI_RATING_NONE
+ */
+ vbi_rating_auth auth;
+ int id;
+ /* Only valid when auth == VBI_RATING_TV_US */
+ int dlsv;
+}vbi_rating;
/**
* @ingroup Event
*
@@ -473,16 +482,7 @@ typedef struct vbi_program_info {
int type_id[33];
/* 05 Program rating */
-
- /*
- * For details STFW for "v-chip"
- * If unknown rating_auth == VBI_RATING_NONE
- */
- vbi_rating_auth rating_auth;
- int rating_id;
-
- /* Only valid when auth == VBI_RATING_TV_US */
- int rating_dlsv;
+ vbi_rating rating;
/* 06 Program Audio Services */
@@ -655,6 +655,7 @@ extern void vbi_reset_prog_info(vbi_program_info *pi);
* @since 0.2.20
*/
#define VBI_EVENT_NETWORK_ID 0x0100
+#define VBI_EVENT_RATING 0x0200
/** @} */
/**
diff --git a/src/libzvbi.h b/src/libzvbi.h
index d6b5dbf..2e251bf 100644..100755
--- a/src/libzvbi.h
+++ b/src/libzvbi.h
@@ -385,6 +385,18 @@ typedef enum {
VBI_AUDIO_MODE_UNKNOWN
} vbi_audio_mode;
+typedef struct vbi_rating{
+ /*
+ * For details STFW for "v-chip"
+ * If unknown rating_auth == VBI_RATING_NONE
+ */
+ vbi_rating_auth auth;
+ int id;
+ /* Only valid when auth == VBI_RATING_TV_US */
+ int dlsv;
+}vbi_rating;
+
+
typedef struct vbi_program_info {
/*
* Refers to the current or next program.
@@ -440,11 +452,7 @@ typedef struct vbi_program_info {
* For details STFW for "v-chip"
* If unknown rating_auth == VBI_RATING_NONE
*/
- vbi_rating_auth rating_auth;
- int rating_id;
-
- /* Only valid when auth == VBI_RATING_TV_US */
- int rating_dlsv;
+ vbi_rating rating;
/* 06 Program Audio Services */
@@ -509,6 +517,7 @@ extern void vbi_reset_prog_info(vbi_program_info *pi);
#define VBI_EVENT_ASPECT 0x0040
#define VBI_EVENT_PROG_INFO 0x0080
#define VBI_EVENT_NETWORK_ID 0x0100
+#define VBI_EVENT_RATING 0x0200
diff --git a/src/vbi.c b/src/vbi.c
index 687a02f..92cb363 100644..100755
--- a/src/vbi.c
+++ b/src/vbi.c
@@ -795,7 +795,7 @@ vbi_reset_prog_info(vbi_program_info *pi)
/* PT */
pi->type_classf = VBI_PROG_CLASSF_NONE;
/* PR */
- pi->rating_auth = VBI_RATING_AUTH_NONE;
+ pi->rating.auth = VBI_RATING_AUTH_NONE;
/* PAS */
pi->audio[0].mode = VBI_AUDIO_MODE_UNKNOWN;
pi->audio[0].language = NULL;