summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--tv_callback.h24
-rw-r--r--tv_input.cpp762
-rw-r--r--tvapi/android/include/ITv.h2
-rw-r--r--tvapi/android/include/Tv.h79
-rw-r--r--tvapi/android/include/TvClient.h75
-rw-r--r--tvapi/android/jni/com_droidlogic_app_tv_TvControlManager.cpp30
-rw-r--r--tvapi/android/libtvbinder/Android.mk2
-rw-r--r--tvapi/android/libtvbinder/Tv.cpp189
-rw-r--r--tvapi/android/libtvbinder/TvClient.cpp168
-rw-r--r--tvapi/android/tv/Android.mk2
-rw-r--r--tvapi/android/tv/CTv.cpp104
-rw-r--r--tvapi/android/tv/CTv.h54
-rw-r--r--tvapi/android/tv/TvPlay.cpp85
-rw-r--r--tvapi/android/tv/TvPlay.h62
-rw-r--r--tvapi/android/tvserver/TvService.cpp11
-rw-r--r--tvapi/android/tvserver/TvService.h2
-rw-r--r--tvapi/libtv/tv/CAv.cpp2
-rw-r--r--tvapi/libtv/tv/CFbcCommunication.cpp2
-rw-r--r--tvapi/libtv/tv/CTv.cpp12798
-rw-r--r--tvapi/libtv/tv/CTv.h4
-rw-r--r--tvapi/libtv/tvconfig/tvconfig.h8
-rw-r--r--tvapi/libtv/tvdb/CTvDatabase.cpp4
-rw-r--r--tvapi/libtv/tvin/CHDMIRxCEC.cpp2
-rw-r--r--tvapi/libtv/tvin/CTvin.cpp115
-rw-r--r--tvapi/libtv/tvsetting/CBlobDeviceFile.cpp4
-rw-r--r--tvapi/libtv/tvsetting/CTvSetting.cpp104
-rw-r--r--tvapi/libtv/tvsetting/CTvSettingDeviceFactory.cpp6
-rw-r--r--tvapi/libtv/tvsetting/TvKeyData.cpp54
-rw-r--r--tvapi/libtv/tvsetting/audio_cfg.cpp122
-rw-r--r--tvapi/libtv/tvutils/tvutils.cpp126
-rw-r--r--tvapi/libtv/tvutils/tvutils.h2
-rw-r--r--tvapi/libtv/vpp/CVpp.cpp34
-rw-r--r--tvapi/tvtests/android_tvtest.cpp33
33 files changed, 7184 insertions, 7887 deletions
diff --git a/tv_input.cpp b/tv_input.cpp
index 9eb4781..277349b 100644
--- a/tv_input.cpp
+++ b/tv_input.cpp
@@ -22,7 +22,7 @@
#include <cutils/native_handle.h>
#include <hardware/tv_input.h>
-#include "tvapi/android/tv/CTv.h"
+#include "tvapi/android/tv/TvPlay.h"
#include "tv_callback.h"
#include "tvapi/android/include/tvcmd.h"
#include <ui/GraphicBufferMapper.h>
@@ -35,190 +35,181 @@ __android_log_print(ANDROID_LOG_DEBUG, "tv_input", __VA_ARGS__); }
#ifndef container_of
#define container_of(ptr, type, member) ({ \
- const typeof(((type *) 0)->member) *__mptr = (ptr); \
- (type *) ((char *) __mptr - (char *)(&((type *)0)->member)); })
+ const typeof(((type *) 0)->member) *__mptr = (ptr); \
+ (type *) ((char *) __mptr - (char *)(&((type *)0)->member)); })
#endif
struct sideband_handle_t {
- native_handle_t nativeHandle;
- int identflag;
- int usage;
+ native_handle_t nativeHandle;
+ int identflag;
+ int usage;
};
typedef struct tv_input_private {
- tv_input_device_t device;
- const tv_input_callback_ops_t *callback;
- void *callback_data;
- CTv *mpTv;
- TvCallback *tvcallback;
+ tv_input_device_t device;
+ const tv_input_callback_ops_t *callback;
+ void *callback_data;
+ TvPlay *mpTv;
+ TvCallback *tvcallback;
} tv_input_private_t;
static int notify_ATV_device_available(tv_input_private_t *priv)
{
- tv_input_event_t event;
- event.device_info.device_id = SOURCE_TV;
- event.device_info.type = TV_INPUT_TYPE_TUNER;
- event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = SOURCE_TV;
+ event.device_info.type = TV_INPUT_TYPE_TUNER;
+ event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_ATV_stream_configurations_change(tv_input_private_t *priv)
{
- tv_input_event_t event;
- event.device_info.device_id = SOURCE_TV;
- event.device_info.type = TV_INPUT_TYPE_TUNER;
- event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = SOURCE_TV;
+ event.device_info.type = TV_INPUT_TYPE_TUNER;
+ event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_DTV_device_available(tv_input_private_t *priv)
{
- tv_input_event_t event;
- event.device_info.device_id = SOURCE_DTV;
- event.device_info.type = TV_INPUT_TYPE_TUNER;
- event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = SOURCE_DTV;
+ event.device_info.type = TV_INPUT_TYPE_TUNER;
+ event.type = TV_INPUT_EVENT_DEVICE_AVAILABLE;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_DTV_stream_configurations_change(tv_input_private_t *priv)
{
- tv_input_event_t event;
- event.device_info.device_id = SOURCE_DTV;
- event.device_info.type = TV_INPUT_TYPE_TUNER;
- event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = SOURCE_DTV;
+ event.device_info.type = TV_INPUT_TYPE_TUNER;
+ event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
void TvIputHal_ChannelConl(tv_input_private_t *priv, int ops_type, int device_id)
{
- if (priv->mpTv) {
- if (ops_type) {
- LOGD ( "%s\, OpenSourceSwitchInput id = %d\n", __FUNCTION__, device_id );
- priv->mpTv->StartTv();
- priv->mpTv->SwitchSourceInput((tv_source_input_t) device_id);
- } else {
- if (priv->mpTv->GetCurrentSourceInput() == device_id) {
- LOGD ( "%s\, StopSourceSwitchInput id = %d\n", __FUNCTION__, device_id );
- priv->mpTv->StopTv();
- }
- }
- }
+ if (priv->mpTv) {
+ if (ops_type) {
+ LOGD ( "%s\, OpenSourceSwitchInput id = %d\n", __FUNCTION__, device_id );
+ priv->mpTv->StartTv();
+ priv->mpTv->SwitchSourceInput((tv_source_input_t) device_id);
+ } else if (priv->mpTv->GetCurrentSourceInput() == device_id) {
+ LOGD ( "%s\, StopSourceSwitchInput id = %d\n", __FUNCTION__, device_id );
+ priv->mpTv->StopTv();
+ }
+ }
}
static int notify_AV_device_available(tv_input_private_t *priv, tv_source_input_t source_input, int type)
{
- tv_input_event_t event;
- event.device_info.device_id = source_input;
- event.device_info.type = TV_INPUT_TYPE_COMPONENT;
- event.type = type;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = source_input;
+ event.device_info.type = TV_INPUT_TYPE_COMPONENT;
+ event.type = type;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_AV_stream_configurations_change(tv_input_private_t *priv, tv_source_input_t source_input)
{
- tv_input_event_t event;
- event.device_info.device_id = source_input;
- event.device_info.type = TV_INPUT_TYPE_COMPONENT;
- event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = source_input;
+ event.device_info.type = TV_INPUT_TYPE_COMPONENT;
+ event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_HDMI_device_available(tv_input_private_t *priv, tv_source_input_t source_input, uint32_t port_id, int type)
{
- tv_input_event_t event;
- event.device_info.device_id = source_input;
- event.device_info.type = TV_INPUT_TYPE_HDMI;
- event.type = type;
- event.device_info.hdmi.port_id = port_id;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = source_input;
+ event.device_info.type = TV_INPUT_TYPE_HDMI;
+ event.type = type;
+ event.device_info.hdmi.port_id = port_id;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
static int notify_HDMI_stream_configurations_change(tv_input_private_t *priv, tv_source_input_t source_input, uint32_t port_id)
{
- tv_input_event_t event;
- event.device_info.device_id = source_input;
- event.device_info.type = TV_INPUT_TYPE_HDMI;
- event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
- event.device_info.hdmi.port_id = port_id;
- event.device_info.audio_type = AUDIO_DEVICE_NONE;
- event.device_info.audio_address = NULL;
- priv->callback->notify(&priv->device, &event, priv->callback_data);
- return 0;
+ tv_input_event_t event;
+ event.device_info.device_id = source_input;
+ event.device_info.type = TV_INPUT_TYPE_HDMI;
+ event.type = TV_INPUT_EVENT_STREAM_CONFIGURATIONS_CHANGED;
+ event.device_info.hdmi.port_id = port_id;
+ event.device_info.audio_type = AUDIO_DEVICE_NONE;
+ event.device_info.audio_address = NULL;
+ priv->callback->notify(&priv->device, &event, priv->callback_data);
+ return 0;
}
-
void TvCallback::onTvEvent (int32_t msgType, const Parcel &p)
{
- tv_input_private_t *priv = (tv_input_private_t *)(mPri);
- switch (msgType) {
- case SOURCE_CONNECT_CALLBACK: {
- int source = p.readInt32();
- int connectState = p.readInt32();
- LOGD("TvCallback::onTvEvent source = %d, status = %d", source, connectState)
- if ( connectState == 1) {
- switch (source) {
- case SOURCE_HDMI1:
- case SOURCE_HDMI2:
- case SOURCE_HDMI3: {
- notify_HDMI_device_available(priv, (tv_source_input_t)source, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, (tv_source_input_t)source, 1);
- break;
- }
- case SOURCE_AV1:
- case SOURCE_AV2: {
- notify_AV_device_available(priv, (tv_source_input_t)source, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_AV_stream_configurations_change(priv, (tv_source_input_t)source);
- break;
- }
- default:
- break;
- }
- } else {//out
- switch (source) {
- case SOURCE_HDMI1:
- case SOURCE_HDMI2:
- case SOURCE_HDMI3: {
- notify_HDMI_device_available(priv, (tv_source_input_t)source, 1, TV_INPUT_EVENT_DEVICE_UNAVAILABLE);
- break;
- }
- case SOURCE_AV1:
- case SOURCE_AV2: {
- notify_AV_device_available(priv, (tv_source_input_t)source, TV_INPUT_EVENT_DEVICE_UNAVAILABLE);
- break;
- }
- default:
- break;
- }
- }
- //tv_input_event_t event;
-
- break;
- }
- default:
- break;
- }
+ tv_input_private_t *priv = (tv_input_private_t *)(mPri);
+ switch (msgType) {
+ case SOURCE_CONNECT_CALLBACK: {
+ int source = p.readInt32();
+ int connectState = p.readInt32();
+ LOGD("TvCallback::onTvEvent source = %d, status = %d", source, connectState)
+
+ switch (source) {
+ case SOURCE_HDMI1:
+ case SOURCE_HDMI2:
+ case SOURCE_HDMI3: {
+ if (connectState == 1) {
+ notify_HDMI_device_available(priv, (tv_source_input_t)source, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, (tv_source_input_t)source, 1);
+ }
+ else {
+ notify_HDMI_device_available(priv, (tv_source_input_t)source, 1, TV_INPUT_EVENT_DEVICE_UNAVAILABLE);
+ }
+ }
+ break;
+
+ case SOURCE_AV1:
+ case SOURCE_AV2: {
+ if (connectState == 1) {
+ notify_AV_device_available(priv, (tv_source_input_t)source, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_AV_stream_configurations_change(priv, (tv_source_input_t)source);
+ }
+ else {
+ notify_AV_device_available(priv, (tv_source_input_t)source, TV_INPUT_EVENT_DEVICE_UNAVAILABLE);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
}
#define NORMAL_STREAM_ID 1
@@ -226,305 +217,298 @@ void TvCallback::onTvEvent (int32_t msgType, const Parcel &p)
static tv_stream_config_t mconfig[2];
static int get_stream_configs(int dev_id, int *num_configurations, const tv_stream_config_t **configs)
{
- switch (dev_id) {
- case SOURCE_TV:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- case SOURCE_DTV:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- case SOURCE_AV1:
- case SOURCE_AV2:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- case SOURCE_HDMI1:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- case SOURCE_HDMI2:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- case SOURCE_HDMI3:
- mconfig[0].stream_id = NORMAL_STREAM_ID;
- mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
- mconfig[0].max_video_width = 1920;
- mconfig[0].max_video_height = 1080;
- mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
- mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
- mconfig[1].max_video_width = 1920;
- mconfig[1].max_video_height = 1080;
- *num_configurations = 2;
- *configs = mconfig;
- break;
- default:
- break;
- }
- return 0;
+ switch (dev_id) {
+ case SOURCE_TV:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ case SOURCE_DTV:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ case SOURCE_AV1:
+ case SOURCE_AV2:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ case SOURCE_HDMI1:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ case SOURCE_HDMI2:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ case SOURCE_HDMI3:
+ mconfig[0].stream_id = NORMAL_STREAM_ID;
+ mconfig[0].type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE ;
+ mconfig[0].max_video_width = 1920;
+ mconfig[0].max_video_height = 1080;
+ mconfig[1].stream_id = FRAME_CAPTURE_STREAM_ID;
+ mconfig[1].type = TV_STREAM_TYPE_BUFFER_PRODUCER ;
+ mconfig[1].max_video_width = 1920;
+ mconfig[1].max_video_height = 1080;
+ *num_configurations = 2;
+ *configs = mconfig;
+ break;
+ default:
+ break;
+ }
+ return 0;
}
static int get_tv_stream(tv_stream_t *stream)
{
- static struct sideband_handle_t *tvstream = NULL;
- if (stream->stream_id == NORMAL_STREAM_ID) {
- if ( !tvstream ) {
- tvstream = (struct sideband_handle_t *)native_handle_create(0, 2);
- if ( !tvstream ) {
- return -EINVAL;
- }
- }
- tvstream->identflag = 0xabcdcdef; //magic word
- tvstream->usage = GRALLOC_USAGE_AML_VIDEO_OVERLAY;
- stream->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE;
- stream->sideband_stream_source_handle = (native_handle_t *)tvstream;
- } else if (stream->stream_id == NORMAL_STREAM_ID) {
- stream->type = TV_STREAM_TYPE_BUFFER_PRODUCER;
- }
- return 0;
+ static struct sideband_handle_t *tvstream = NULL;
+ if (stream->stream_id == NORMAL_STREAM_ID) {
+ if ( !tvstream ) {
+ tvstream = (struct sideband_handle_t *)native_handle_create(0, 2);
+ if ( !tvstream ) {
+ return -EINVAL;
+ }
+ }
+ tvstream->identflag = 0xabcdcdef; //magic word
+ tvstream->usage = GRALLOC_USAGE_AML_VIDEO_OVERLAY;
+ stream->type = TV_STREAM_TYPE_INDEPENDENT_VIDEO_SOURCE;
+ stream->sideband_stream_source_handle = (native_handle_t *)tvstream;
+ } else if (stream->stream_id == NORMAL_STREAM_ID) {
+ stream->type = TV_STREAM_TYPE_BUFFER_PRODUCER;
+ }
+ return 0;
}
static int tv_input_device_open(const struct hw_module_t *module,
- const char *name, struct hw_device_t **device);
+ const char *name, struct hw_device_t **device);
static struct hw_module_methods_t tv_input_module_methods = {
open:
- tv_input_device_open
+ tv_input_device_open
};
tv_input_module_t HAL_MODULE_INFO_SYM = {
-common:
- {
-tag:
- HARDWARE_MODULE_TAG,
- version_major: 0,
- version_minor: 1,
-id:
- TV_INPUT_HARDWARE_MODULE_ID,
-name: "TVInput module"
- ,
-author: "Amlogic"
- ,
-methods:
- &tv_input_module_methods,
- }
+ common: {
+ tag: HARDWARE_MODULE_TAG,
+ version_major: 0,
+ version_minor: 1,
+ id: TV_INPUT_HARDWARE_MODULE_ID,
+ name: "TVInput module",
+ author: "Amlogic",
+ methods: &tv_input_module_methods,
+ }
};
/*****************************************************************************/
-
static int tv_input_initialize(struct tv_input_device *dev,
- const tv_input_callback_ops_t *callback, void *data)
+ const tv_input_callback_ops_t *callback, void *data)
{
- if (dev == NULL || callback == NULL) {
- return -EINVAL;
- }
- tv_input_private_t *priv = (tv_input_private_t *)dev;
- if (priv->callback != NULL) {
- return -EEXIST;
- }
- priv->callback = callback;
- priv->callback_data = data;
- /* ATV_DEVICE_AVAILABLE */
- notify_ATV_device_available(priv);
- notify_ATV_stream_configurations_change(priv);
- /* DTV_DEVICE_AVAILABLE */
- notify_DTV_device_available(priv);
- notify_DTV_stream_configurations_change(priv);
-
- if (priv->mpTv->GetHdmiAvHotplugDetectOnoff()) {
- /* AV1_DEVICE_AVAILABLE */
- int status = priv->mpTv->GetSourceConnectStatus(SOURCE_AV1);
- if (status == 1) { //IN
- notify_AV_device_available(priv, SOURCE_AV1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_AV_stream_configurations_change(priv, SOURCE_AV1);
- }
-
- /* AV2_DEVICE_AVAILABLE */
- status = priv->mpTv->GetSourceConnectStatus(SOURCE_AV2);
- if (status == 1) { //IN
- notify_AV_device_available(priv, SOURCE_AV2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_AV_stream_configurations_change(priv, SOURCE_AV2);
- }
-
- /* HDMI1_DEVICE_AVAILABLE */
- status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI1);
- if (status == 1) { //IN
- notify_HDMI_device_available(priv, SOURCE_HDMI1, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI1, 0);
- }
-
- /* HDMI2_DEVICE_AVAILABLE */
- status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI2);
- if (status == 1) { //IN
- notify_HDMI_device_available(priv, SOURCE_HDMI2, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI2, 1);
- }
-
- /* HDMI3_DEVICE_AVAILABLE */
- status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI3);
- if (status == 1) { //IN
- notify_HDMI_device_available(priv, SOURCE_HDMI3, 2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI3, 2);
- }
-
- priv->mpTv->setTvObserver(priv->tvcallback);
- } else {
- /* AV1_DEVICE_AVAILABLE */
- notify_AV_device_available(priv, SOURCE_AV1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_AV_stream_configurations_change(priv, SOURCE_AV1);
- /* AV2_DEVICE_AVAILABLE */
- notify_AV_device_available(priv, SOURCE_AV2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_AV_stream_configurations_change(priv, SOURCE_AV2);
- /* HDMI1_DEVICE_AVAILABLE */
- notify_HDMI_device_available(priv, SOURCE_HDMI1, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI1, 0);
- /* HDMI2_DEVICE_AVAILABLE */
- notify_HDMI_device_available(priv, SOURCE_HDMI2, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI2, 1);
- /* HDMI3_DEVICE_AVAILABLE */
- notify_HDMI_device_available(priv, SOURCE_HDMI3, 2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
- notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI3, 2);
- }
- return 0;
+ if (dev == NULL || callback == NULL) {
+ return -EINVAL;
+ }
+ tv_input_private_t *priv = (tv_input_private_t *)dev;
+ if (priv->callback != NULL) {
+ return -EEXIST;
+ }
+ priv->callback = callback;
+ priv->callback_data = data;
+ /* ATV_DEVICE_AVAILABLE */
+ notify_ATV_device_available(priv);
+ notify_ATV_stream_configurations_change(priv);
+ /* DTV_DEVICE_AVAILABLE */
+ notify_DTV_device_available(priv);
+ notify_DTV_stream_configurations_change(priv);
+
+ if (priv->mpTv->GetHdmiAvHotplugDetectOnoff()) {
+ /* AV1_DEVICE_AVAILABLE */
+ int status = priv->mpTv->GetSourceConnectStatus(SOURCE_AV1);
+ if (status == 1) { //IN
+ notify_AV_device_available(priv, SOURCE_AV1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_AV_stream_configurations_change(priv, SOURCE_AV1);
+ }
+
+ /* AV2_DEVICE_AVAILABLE */
+ status = priv->mpTv->GetSourceConnectStatus(SOURCE_AV2);
+ if (status == 1) { //IN
+ notify_AV_device_available(priv, SOURCE_AV2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_AV_stream_configurations_change(priv, SOURCE_AV2);
+ }
+
+ /* HDMI1_DEVICE_AVAILABLE */
+ status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI1);
+ if (status == 1) { //IN
+ notify_HDMI_device_available(priv, SOURCE_HDMI1, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI1, 0);
+ }
+
+ /* HDMI2_DEVICE_AVAILABLE */
+ status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI2);
+ if (status == 1) { //IN
+ notify_HDMI_device_available(priv, SOURCE_HDMI2, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI2, 1);
+ }
+
+ /* HDMI3_DEVICE_AVAILABLE */
+ status = priv->mpTv->GetSourceConnectStatus(SOURCE_HDMI3);
+ if (status == 1) { //IN
+ notify_HDMI_device_available(priv, SOURCE_HDMI3, 2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI3, 2);
+ }
+
+ priv->mpTv->setTvObserver(priv->tvcallback);
+ } else {
+ /* AV1_DEVICE_AVAILABLE */
+ notify_AV_device_available(priv, SOURCE_AV1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_AV_stream_configurations_change(priv, SOURCE_AV1);
+ /* AV2_DEVICE_AVAILABLE */
+ notify_AV_device_available(priv, SOURCE_AV2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_AV_stream_configurations_change(priv, SOURCE_AV2);
+ /* HDMI1_DEVICE_AVAILABLE */
+ notify_HDMI_device_available(priv, SOURCE_HDMI1, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI1, 0);
+ /* HDMI2_DEVICE_AVAILABLE */
+ notify_HDMI_device_available(priv, SOURCE_HDMI2, 1, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI2, 1);
+ /* HDMI3_DEVICE_AVAILABLE */
+ notify_HDMI_device_available(priv, SOURCE_HDMI3, 2, TV_INPUT_EVENT_DEVICE_AVAILABLE);
+ notify_HDMI_stream_configurations_change(priv, SOURCE_HDMI3, 2);
+ }
+ return 0;
}
static int tv_input_get_stream_configurations(const struct tv_input_device *dev,
- int device_id, int *num_configurations,
- const tv_stream_config_t **configs)
+ int device_id, int *num_configurations,
+ const tv_stream_config_t **configs)
{
- if (get_stream_configs(device_id, num_configurations, configs) == 0) {
- return 0;
- }
- return -EINVAL;
+ if (get_stream_configs(device_id, num_configurations, configs) == 0) {
+ return 0;
+ }
+ return -EINVAL;
}
static int tv_input_open_stream(struct tv_input_device *dev, int device_id,
- tv_stream_t *stream)
+ tv_stream_t *stream)
{
- tv_input_private_t *priv = (tv_input_private_t *)dev;
- if (priv) {
- if (get_tv_stream(stream) != 0) {
- return -EINVAL;
- }
- if (stream->stream_id == NORMAL_STREAM_ID) {
- TvIputHal_ChannelConl(priv, 1, device_id);
- return 0;
- } else if (stream->stream_id == FRAME_CAPTURE_STREAM_ID) {
- return 0;
- }
- }
- return -EINVAL;
+ tv_input_private_t *priv = (tv_input_private_t *)dev;
+ if (priv) {
+ if (get_tv_stream(stream) != 0) {
+ return -EINVAL;
+ }
+ if (stream->stream_id == NORMAL_STREAM_ID) {
+ TvIputHal_ChannelConl(priv, 1, device_id);
+ return 0;
+ } else if (stream->stream_id == FRAME_CAPTURE_STREAM_ID) {
+ return 0;
+ }
+ }
+ return -EINVAL;
}
static int tv_input_close_stream(struct tv_input_device *dev, int device_id,
- int stream_id)
+ int stream_id)
{
- tv_input_private_t *priv = (tv_input_private_t *)dev;
- if (stream_id == NORMAL_STREAM_ID) {
- TvIputHal_ChannelConl(priv, 0, device_id);
- return 0;
- } else if (stream_id == FRAME_CAPTURE_STREAM_ID) {
- return 0;
- }
- return -EINVAL;
+ tv_input_private_t *priv = (tv_input_private_t *)dev;
+ if (stream_id == NORMAL_STREAM_ID) {
+ TvIputHal_ChannelConl(priv, 0, device_id);
+ return 0;
+ } else if (stream_id == FRAME_CAPTURE_STREAM_ID) {
+ return 0;
+ }
+ return -EINVAL;
}
static int tv_input_request_capture(
- struct tv_input_device *dev, int device_id, int stream_id, buffer_handle_t buffer, uint32_t seq)
+ struct tv_input_device *dev, int device_id, int stream_id, buffer_handle_t buffer, uint32_t seq)
{
- return -EINVAL;
+ return -EINVAL;
}
static int tv_input_cancel_capture(struct tv_input_device *, int, int, uint32_t)
{
- return -EINVAL;
+ return -EINVAL;
}
/*****************************************************************************/
static int tv_input_device_close(struct hw_device_t *dev)
{
- tv_input_private_t *priv = (tv_input_private_t *)dev;
- if (priv) {
- if (priv->mpTv) {
- delete priv->mpTv;
- }
- free(priv);
- }
- return 0;
+ tv_input_private_t *priv = (tv_input_private_t *)dev;
+ if (priv) {
+ if (priv->mpTv) {
+ delete priv->mpTv;
+ }
+ free(priv);
+ }
+ return 0;
}
/*****************************************************************************/
static int tv_input_device_open(const struct hw_module_t *module,
- const char *name, struct hw_device_t **device)
+ const char *name, struct hw_device_t **device)
{
- int status = -EINVAL;
- if (!strcmp(name, TV_INPUT_DEFAULT_DEVICE)) {
- tv_input_private_t *dev = (tv_input_private_t *)malloc(sizeof(*dev));
-
- /* initialize our state here */
- memset(dev, 0, sizeof(*dev));
- dev->mpTv = new CTv();
- dev->tvcallback = new TvCallback(dev);
- /* initialize the procs */
- dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = TV_INPUT_DEVICE_API_VERSION_0_1;
- dev->device.common.module = const_cast<hw_module_t *>(module);
- dev->device.common.close = tv_input_device_close;
-
- dev->device.initialize = tv_input_initialize;
- dev->device.get_stream_configurations =
- tv_input_get_stream_configurations;
- dev->device.open_stream = tv_input_open_stream;
- dev->device.close_stream = tv_input_close_stream;
- dev->device.request_capture = tv_input_request_capture;
- dev->device.cancel_capture = tv_input_cancel_capture;
-
- *device = &dev->device.common;
- status = 0;
- }
- return status;
+ int status = -EINVAL;
+ if (!strcmp(name, TV_INPUT_DEFAULT_DEVICE)) {
+ tv_input_private_t *dev = (tv_input_private_t *)malloc(sizeof(*dev));
+
+ /* initialize our state here */
+ memset(dev, 0, sizeof(*dev));
+ dev->mpTv = new TvPlay();
+ dev->tvcallback = new TvCallback(dev);
+ /* initialize the procs */
+ dev->device.common.tag = HARDWARE_DEVICE_TAG;
+ dev->device.common.version = TV_INPUT_DEVICE_API_VERSION_0_1;
+ dev->device.common.module = const_cast<hw_module_t *>(module);
+ dev->device.common.close = tv_input_device_close;
+
+ dev->device.initialize = tv_input_initialize;
+ dev->device.get_stream_configurations =
+ tv_input_get_stream_configurations;
+ dev->device.open_stream = tv_input_open_stream;
+ dev->device.close_stream = tv_input_close_stream;
+ dev->device.request_capture = tv_input_request_capture;
+ dev->device.cancel_capture = tv_input_cancel_capture;
+
+ *device = &dev->device.common;
+ status = 0;
+ }
+ return status;
}