MPEG4
} codec_list_e;
+typedef enum {
+ DECODER,
+ ENCODER
+} codec_type_e;
+
struct _codec_list_t {
codec_list_e ename;
char cname[CODEC_INI_MAX_STRLEN];
char temp[CNAME_SIZE];
char cname[CNAME_SIZE];
const char *type[2];
- type[0] = ":hw_decoder";
- type[1] = ":hw_encoder";
+ type[DECODER] = ":hw_decoder";
+ type[ENCODER] = ":hw_encoder";
CODEC_INI_GET_STRING(dict, port_name, (char *)"port_in_use:media_codec_port", (char *)DEFAULT_PORT);
if (strstr(caps_str, "h264")) {
parse = gst_element_factory_make("h264parse", NULL);
- codec = gst_element_factory_make(codec_list[H264].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[H264].plugins[DECODER], NULL);
} else if (strstr(caps_str, "h263")) {
parse = gst_element_factory_make("h263parse", NULL);
- codec = gst_element_factory_make(codec_list[H263].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[H263].plugins[DECODER], NULL);
} else if (strstr(caps_str, "video/mpeg")) {
parse = gst_element_factory_make("mpeg4videoparse", NULL);
- codec = gst_element_factory_make(codec_list[MPEG4].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[MPEG4].plugins[DECODER], NULL);
} else {
GST_WARNING_OBJECT(pad, "non video pad");
g_free(caps_str);
{
}
+static gboolean __is_hw_codec_supported(codec_list_e codec, codec_type_e type)
+{
+ if (strlen(codec_list[codec].plugins[type]) == 0) {
+ std::cout << "NO HW CODEC SUPPORTED" << std::endl;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/*
* main class
*/
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(H263, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[H263].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[H263].plugins[DECODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(H264, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[H264].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[H264].plugins[DECODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(MPEG4, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[MPEG4].plugins[0], NULL);
+ codec = gst_element_factory_make(codec_list[MPEG4].plugins[DECODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(H263, ENCODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[H263].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[H263].plugins[ENCODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(H264, ENCODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[H264].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[H264].plugins[ENCODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstElement *sink, *src, *codec, *pipeline;
GstStateChangeReturn ret;
+ if (!__is_hw_codec_supported(MPEG4, ENCODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("fakesrc", NULL);
- codec = gst_element_factory_make(codec_list[MPEG4].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[MPEG4].plugins[ENCODER], NULL);
sink = gst_element_factory_make("fakesink", NULL);
gst_bin_add_many(GST_BIN(pipeline), src, codec, sink, NULL);
GstBus *bus;
gchar *path;
+ if (!__is_hw_codec_supported(H264, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("filesrc", NULL);
GstBus *bus;
gchar *path;
+ if (!__is_hw_codec_supported(H263, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("filesrc", NULL);
GstBus *bus;
gchar *path;
+ if (!__is_hw_codec_supported(MPEG4, DECODER))
+ return;
+
pipeline = gst_pipeline_new("pipeline");
src = gst_element_factory_make("filesrc", NULL);
src = gst_element_factory_make("appsrc", NULL);
- codec = gst_element_factory_make(codec_list[H264].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[H264].plugins[ENCODER], NULL);
bus = gst_element_get_bus(pipeline);
bus_watch_id = gst_bus_add_watch(bus, bus_callback, NULL);
src = gst_element_factory_make("appsrc", NULL);
- codec = gst_element_factory_make(codec_list[H263].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[H263].plugins[ENCODER], NULL);
bus = gst_element_get_bus(pipeline);
bus_watch_id = gst_bus_add_watch(bus, bus_callback, NULL);
src = gst_element_factory_make("appsrc", NULL);
- codec = gst_element_factory_make(codec_list[MPEG4].plugins[1], NULL);
+ codec = gst_element_factory_make(codec_list[MPEG4].plugins[ENCODER], NULL);
bus = gst_element_get_bus(pipeline);
bus_watch_id = gst_bus_add_watch(bus, bus_callback, NULL);