aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/saa7164/saa7164-api.c23
-rw-r--r--drivers/media/video/saa7164/saa7164-reg.h1
-rw-r--r--drivers/media/video/saa7164/saa7164-types.h12
3 files changed, 35 insertions, 1 deletions
diff --git a/drivers/media/video/saa7164/saa7164-api.c b/drivers/media/video/saa7164/saa7164-api.c
index 5e05723fe44f..5dcdf7bb12cd 100644
--- a/drivers/media/video/saa7164/saa7164-api.c
+++ b/drivers/media/video/saa7164/saa7164-api.c
@@ -24,6 +24,25 @@
24 24
25#include "saa7164.h" 25#include "saa7164.h"
26 26
27int saa7164_api_set_gop_size(struct saa7164_port *port)
28{
29 struct saa7164_dev *dev = port->dev;
30 tmComResEncVideoGopStructure_t gs;
31 int ret;
32
33 dprintk(DBGLVL_ENC, "%s()\n", __func__);
34
35 gs.ucRefFrameDist = SAA7164_ENCODER_DEFAULT_GOP_DIST;
36 gs.ucGOPSize = SAA7164_ENCODER_DEFAULT_GOP_SIZE;
37 ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR,
38 EU_VIDEO_GOP_STRUCTURE_CONTROL,
39 sizeof(gs), &gs);
40 if (ret != SAA_OK)
41 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
42
43 return ret;
44}
45
27int saa7164_api_set_encoder(struct saa7164_port *port) 46int saa7164_api_set_encoder(struct saa7164_port *port)
28{ 47{
29 struct saa7164_dev *dev = port->dev; 48 struct saa7164_dev *dev = port->dev;
@@ -31,7 +50,8 @@ int saa7164_api_set_encoder(struct saa7164_port *port)
31 tmComResEncAudioBitRate_t ab; 50 tmComResEncAudioBitRate_t ab;
32 int ret; 51 int ret;
33 52
34 dprintk(DBGLVL_ENC, "%s() unitid=0x%x\n", __func__, port->hwcfg.sourceid); 53 dprintk(DBGLVL_ENC, "%s() unitid=0x%x\n", __func__,
54 port->hwcfg.sourceid);
35 55
36 ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR, 56 ret = saa7164_cmd_send(port->dev, port->hwcfg.sourceid, SET_CUR,
37 EU_PROFILE_CONTROL, sizeof(u8), &port->encoder_profile); 57 EU_PROFILE_CONTROL, sizeof(u8), &port->encoder_profile);
@@ -57,6 +77,7 @@ int saa7164_api_set_encoder(struct saa7164_port *port)
57 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret); 77 printk(KERN_ERR "%s() error, ret = 0x%x\n", __func__, ret);
58 78
59 saa7164_api_set_aspect_ratio(port); 79 saa7164_api_set_aspect_ratio(port);
80 saa7164_api_set_gop_size(port);
60 81
61 return ret; 82 return ret;
62} 83}
diff --git a/drivers/media/video/saa7164/saa7164-reg.h b/drivers/media/video/saa7164/saa7164-reg.h
index a4ad55907b91..ad60534463e9 100644
--- a/drivers/media/video/saa7164/saa7164-reg.h
+++ b/drivers/media/video/saa7164/saa7164-reg.h
@@ -205,6 +205,7 @@
205#define EU_PROFILE_CONTROL 0x00 205#define EU_PROFILE_CONTROL 0x00
206#define EU_VIDEO_FORMAT_CONTROL 0x01 206#define EU_VIDEO_FORMAT_CONTROL 0x01
207#define EU_VIDEO_BIT_RATE_CONTROL 0x02 207#define EU_VIDEO_BIT_RATE_CONTROL 0x02
208#define EU_VIDEO_GOP_STRUCTURE_CONTROL 0x04
208#define EU_VIDEO_INPUT_ASPECT_CONTROL 0x0A 209#define EU_VIDEO_INPUT_ASPECT_CONTROL 0x0A
209#define EU_AUDIO_FORMAT_CONTROL 0x0C 210#define EU_AUDIO_FORMAT_CONTROL 0x0C
210#define EU_AUDIO_BIT_RATE_CONTROL 0x0D 211#define EU_AUDIO_BIT_RATE_CONTROL 0x0D
diff --git a/drivers/media/video/saa7164/saa7164-types.h b/drivers/media/video/saa7164/saa7164-types.h
index 5340404059b3..7c2788d9a647 100644
--- a/drivers/media/video/saa7164/saa7164-types.h
+++ b/drivers/media/video/saa7164/saa7164-types.h
@@ -325,6 +325,18 @@ typedef struct
325 u8 height; 325 u8 height;
326} __attribute__((packed)) tmComResEncVideoInputAspectRatio_t; 326} __attribute__((packed)) tmComResEncVideoInputAspectRatio_t;
327 327
328/* Video Encoder GOP IBP message */
329/* 1. IPPPPPPPPPPPPPP */
330/* 2. IBPBPBPBPBPBPBP */
331/* 3. IBBPBBPBBPBBP */
332#define SAA7164_ENCODER_DEFAULT_GOP_DIST ( 1)
333#define SAA7164_ENCODER_DEFAULT_GOP_SIZE (15)
334typedef struct
335{
336 u8 ucGOPSize; /* GOP Size 12, 15 */
337 u8 ucRefFrameDist; /* Reference Frame Distance */
338} __attribute__((packed)) tmComResEncVideoGopStructure_t;
339
328/* Encoder processor definition */ 340/* Encoder processor definition */
329typedef struct 341typedef struct
330{ 342{