media: dvb: dvb-core: Add video indexing support for MPQ usecase
MPQ uses dvb/demux and dvb/video for broadcast feature. Video indexing (or framing) is required for PVR use case or when the video decoder does not handle framing. Linux dvb-core was extended to support video indexing. New features: - Support passing video indexing parameters as part of PES filter parameters. - Support storing video indexing parameters per TS feed. Change-Id: I33289743cb93e8bc46ba8d6da88805326c89c523 Signed-off-by: Liron Kuch <lkuch@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
This commit is contained in:
@@ -136,6 +136,8 @@ struct dmx_ts_feed {
|
|||||||
struct timespec timeout);
|
struct timespec timeout);
|
||||||
int (*start_filtering) (struct dmx_ts_feed* feed);
|
int (*start_filtering) (struct dmx_ts_feed* feed);
|
||||||
int (*stop_filtering) (struct dmx_ts_feed* feed);
|
int (*stop_filtering) (struct dmx_ts_feed* feed);
|
||||||
|
int (*set_indexing_params) (struct dmx_ts_feed *feed,
|
||||||
|
struct dmx_indexing_video_params *params);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
@@ -1185,6 +1185,24 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Support indexing for video PES */
|
||||||
|
if ((para->pes_type == DMX_PES_VIDEO0) ||
|
||||||
|
(para->pes_type == DMX_PES_VIDEO1) ||
|
||||||
|
(para->pes_type == DMX_PES_VIDEO2) ||
|
||||||
|
(para->pes_type == DMX_PES_VIDEO3)) {
|
||||||
|
|
||||||
|
if (tsfeed->set_indexing_params) {
|
||||||
|
ret = tsfeed->set_indexing_params(tsfeed,
|
||||||
|
¶->video_params);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
|
dmxdev->demux->release_ts_feed(dmxdev->demux,
|
||||||
|
tsfeed);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = tsfeed->start_filtering(tsfeed);
|
ret = tsfeed->start_filtering(tsfeed);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed);
|
dmxdev->demux->release_ts_feed(dmxdev->demux, tsfeed);
|
||||||
@@ -1463,6 +1481,23 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
|
|||||||
if (params->pes_type > DMX_PES_OTHER || params->pes_type < 0)
|
if (params->pes_type > DMX_PES_OTHER || params->pes_type < 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (params->flags & DMX_ENABLE_INDEXING) {
|
||||||
|
if (!(dmxdev->capabilities & DMXDEV_CAP_INDEXING))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* can do indexing only on video PES */
|
||||||
|
if ((params->pes_type != DMX_PES_VIDEO0) &&
|
||||||
|
(params->pes_type != DMX_PES_VIDEO1) &&
|
||||||
|
(params->pes_type != DMX_PES_VIDEO2) &&
|
||||||
|
(params->pes_type != DMX_PES_VIDEO3))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
/* can do indexing only when recording */
|
||||||
|
if ((params->output != DMX_OUT_TS_TAP) &&
|
||||||
|
(params->output != DMX_OUT_TSDEMUX_TAP))
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
dmxdevfilter->type = DMXDEV_TYPE_PES;
|
dmxdevfilter->type = DMXDEV_TYPE_PES;
|
||||||
memcpy(&dmxdevfilter->params, params,
|
memcpy(&dmxdevfilter->params, params,
|
||||||
sizeof(struct dmx_pes_filter_params));
|
sizeof(struct dmx_pes_filter_params));
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ struct dmxdev {
|
|||||||
#define DMXDEV_CAP_DUPLEX 0x1
|
#define DMXDEV_CAP_DUPLEX 0x1
|
||||||
#define DMXDEV_CAP_PULL_MODE 0x2
|
#define DMXDEV_CAP_PULL_MODE 0x2
|
||||||
#define DMXDEV_CAP_PCR_EXTRACTION 0x4
|
#define DMXDEV_CAP_PCR_EXTRACTION 0x4
|
||||||
|
#define DMXDEV_CAP_INDEXING 0x8
|
||||||
|
|
||||||
enum dmx_playback_mode_t playback_mode;
|
enum dmx_playback_mode_t playback_mode;
|
||||||
dmx_source_t source;
|
dmx_source_t source;
|
||||||
|
|||||||
@@ -1027,6 +1027,18 @@ static int dmx_ts_feed_stop_filtering(struct dmx_ts_feed *ts_feed)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int dmx_ts_set_indexing_params(
|
||||||
|
struct dmx_ts_feed *ts_feed,
|
||||||
|
struct dmx_indexing_video_params *params)
|
||||||
|
{
|
||||||
|
struct dvb_demux_feed *feed = (struct dvb_demux_feed *)ts_feed;
|
||||||
|
|
||||||
|
memcpy(&feed->indexing_params, params,
|
||||||
|
sizeof(struct dmx_indexing_video_params));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
|
static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
|
||||||
struct dmx_ts_feed **ts_feed,
|
struct dmx_ts_feed **ts_feed,
|
||||||
dmx_ts_cb callback)
|
dmx_ts_cb callback)
|
||||||
@@ -1048,6 +1060,8 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
|
|||||||
feed->pid = 0xffff;
|
feed->pid = 0xffff;
|
||||||
feed->peslen = 0xfffa;
|
feed->peslen = 0xfffa;
|
||||||
feed->buffer = NULL;
|
feed->buffer = NULL;
|
||||||
|
memset(&feed->indexing_params, 0,
|
||||||
|
sizeof(struct dmx_indexing_video_params));
|
||||||
|
|
||||||
/* default behaviour - pass first PES data even if it is
|
/* default behaviour - pass first PES data even if it is
|
||||||
* partial PES data from previous PES that we didn't receive its header.
|
* partial PES data from previous PES that we didn't receive its header.
|
||||||
@@ -1063,6 +1077,7 @@ static int dvbdmx_allocate_ts_feed(struct dmx_demux *dmx,
|
|||||||
(*ts_feed)->start_filtering = dmx_ts_feed_start_filtering;
|
(*ts_feed)->start_filtering = dmx_ts_feed_start_filtering;
|
||||||
(*ts_feed)->stop_filtering = dmx_ts_feed_stop_filtering;
|
(*ts_feed)->stop_filtering = dmx_ts_feed_stop_filtering;
|
||||||
(*ts_feed)->set = dmx_ts_feed_set;
|
(*ts_feed)->set = dmx_ts_feed_set;
|
||||||
|
(*ts_feed)->set_indexing_params = dmx_ts_set_indexing_params;
|
||||||
|
|
||||||
if (!(feed->filter = dvb_dmx_filter_alloc(demux))) {
|
if (!(feed->filter = dvb_dmx_filter_alloc(demux))) {
|
||||||
feed->state = DMX_STATE_FREE;
|
feed->state = DMX_STATE_FREE;
|
||||||
|
|||||||
@@ -95,10 +95,12 @@ struct dvb_demux_feed {
|
|||||||
int cc;
|
int cc;
|
||||||
int pusi_seen; /* prevents feeding of garbage from previous section */
|
int pusi_seen; /* prevents feeding of garbage from previous section */
|
||||||
|
|
||||||
u16 peslen;
|
u32 peslen;
|
||||||
|
|
||||||
struct list_head list_head;
|
struct list_head list_head;
|
||||||
unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */
|
unsigned int index; /* a unique index for each feed (can be used as hardware pid filter index) */
|
||||||
|
|
||||||
|
struct dmx_indexing_video_params indexing_params;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dvb_demux {
|
struct dvb_demux {
|
||||||
|
|||||||
@@ -99,16 +99,40 @@ typedef struct dmx_filter
|
|||||||
} dmx_filter_t;
|
} dmx_filter_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Filter flags */
|
||||||
|
#define DMX_CHECK_CRC 0x01
|
||||||
|
#define DMX_ONESHOT 0x02
|
||||||
|
#define DMX_IMMEDIATE_START 0x04
|
||||||
|
#define DMX_ENABLE_INDEXING 0x08
|
||||||
|
#define DMX_KERNEL_CLIENT 0x8000
|
||||||
|
|
||||||
struct dmx_sct_filter_params
|
struct dmx_sct_filter_params
|
||||||
{
|
{
|
||||||
__u16 pid;
|
__u16 pid;
|
||||||
dmx_filter_t filter;
|
dmx_filter_t filter;
|
||||||
__u32 timeout;
|
__u32 timeout;
|
||||||
__u32 flags;
|
__u32 flags;
|
||||||
#define DMX_CHECK_CRC 1
|
};
|
||||||
#define DMX_ONESHOT 2
|
|
||||||
#define DMX_IMMEDIATE_START 4
|
|
||||||
#define DMX_KERNEL_CLIENT 0x8000
|
/* Indexing: supported video standards */
|
||||||
|
enum dmx_indexing_video_standard {
|
||||||
|
DMX_INDEXING_MPEG2,
|
||||||
|
DMX_INDEXING_H264,
|
||||||
|
DMX_INDEXING_VC1
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Indexing: Supported video profiles */
|
||||||
|
enum dmx_indexing_video_profile {
|
||||||
|
DMX_INDEXING_MPEG2_ANY,
|
||||||
|
DMX_INDEXING_H264_ANY,
|
||||||
|
DMX_INDEXING_VC1_ANY
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Indexing: video configuration parameters */
|
||||||
|
struct dmx_indexing_video_params {
|
||||||
|
enum dmx_indexing_video_standard standard;
|
||||||
|
enum dmx_indexing_video_profile profile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -119,6 +143,8 @@ struct dmx_pes_filter_params
|
|||||||
dmx_output_t output;
|
dmx_output_t output;
|
||||||
dmx_pes_type_t pes_type;
|
dmx_pes_type_t pes_type;
|
||||||
__u32 flags;
|
__u32 flags;
|
||||||
|
|
||||||
|
struct dmx_indexing_video_params video_params;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dmx_buffer_status {
|
struct dmx_buffer_status {
|
||||||
|
|||||||
Reference in New Issue
Block a user