From f5af9ef219005bea3790a6bf74d007a39895cbb9 Mon Sep 17 00:00:00 2001 From: Andrey Shelest Date: Mon, 16 Jun 2014 17:52:15 +0300 Subject: [PATCH] Updated to version 0.9 from tizendev Change-Id: Ib2ba6b71f64b1fc956a82f68ba60e89a289038f6 --- configure.ac | 18 +++--- packaging/libmm-transcode.spec | 16 ++--- transcode/Makefile.am | 1 + transcode/include/mm_transcode.h | 2 +- transcode/include/mm_transcode_internal.h | 29 ++++----- transcode/mm_transcode_codec.c | 4 +- transcode/mm_transcode_pipeline.c | 12 ++-- transcode/mm_transcode_seek.c | 104 ++++++++++++------------------ 8 files changed, 81 insertions(+), 105 deletions(-) diff --git a/configure.ac b/configure.ac index 6e38449..b4f2d85 100755 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([libmm-transcode],[0.1]) +AC_INIT([libmm-transcode],[0.9]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) @@ -52,23 +52,23 @@ PKG_CHECK_MODULES(GLIB, glib-2.0) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) -PKG_CHECK_MODULES(GST, gstreamer-0.10 >= 0.10) +PKG_CHECK_MODULES(GST, gstreamer-1.0 >= 1.2.0) AC_SUBST(GST_CFLAGS) AC_SUBST(GST_LIBS) -PKG_CHECK_MODULES(GST_PLUGIN_BASE, gstreamer-plugins-base-0.10 >= 0.10) +PKG_CHECK_MODULES(GST_PLUGIN_BASE, gstreamer-plugins-base-1.0 >= 1.2.0) AC_SUBST(GST_PLUGIN_BASE_CFLAGS) AC_SUBST(GST_PLUGIN_BASE_LIBS) -PKG_CHECK_MODULES(GST_INTERFACE, gstreamer-interfaces-0.10 >= 0.10) -AC_SUBST(GST_INTERFACE_CFLAGS) -AC_SUBST(GST_LIBS) - -PKG_CHECK_MODULES(GSTAPP, gstreamer-app-0.10 >= 0.10) +PKG_CHECK_MODULES(GSTAPP, gstreamer-app-1.0 >= 1.2.0) AC_SUBST(GSTAPP_CFLAGS) AC_SUBST(GSTAPP_LIBS) -PKG_CHECK_MODULES(GSTPBUTILS, gstreamer-pbutils-0.10 >= 0.10) +PKG_CHECK_MODULES(GST_VIDEO, gstreamer-video-1.0 >= 1.2.0) +AC_SUBST(GST_VIDEO_CFLAGS) +AC_SUBST(GST_VIDEO_LIBS) + +PKG_CHECK_MODULES(GSTPBUTILS, gstreamer-pbutils-1.0 >= 1.2.0) AC_SUBST(GSTPBUTILS_CFLAGS) AC_SUBST(GSTPBUTILS_LIBS) diff --git a/packaging/libmm-transcode.spec b/packaging/libmm-transcode.spec index 88d47c1..a3103fe 100644 --- a/packaging/libmm-transcode.spec +++ b/packaging/libmm-transcode.spec @@ -1,7 +1,7 @@ Name: libmm-transcode Summary: Multimedia Framework Video Transcode Library -Version: 0.8 -Release: 2 +Version: 0.9 +Release: 1 Group: System/Libraries License: Apache-2.0 Source0: %{name}-%{version}.tar.gz @@ -11,11 +11,11 @@ BuildRequires: pkgconfig(mm-log) BuildRequires: pkgconfig(mm-ta) BuildRequires: pkgconfig(mm-fileinfo) BuildRequires: pkgconfig(glib-2.0) -BuildRequires: pkgconfig(gstreamer-0.10) -BuildRequires: pkgconfig(gstreamer-app-0.10) -BuildRequires: pkgconfig(gstreamer-interfaces-0.10) -BuildRequires: pkgconfig(gstreamer-plugins-base-0.10) -BuildRequires: pkgconfig(gstreamer-pbutils-0.10) +BuildRequires: pkgconfig(gstreamer-1.0) +BuildRequires: pkgconfig(gstreamer-app-1.0) +BuildRequires: pkgconfig(gstreamer-video-1.0) +BuildRequires: pkgconfig(gstreamer-plugins-base-1.0) +BuildRequires: pkgconfig(gstreamer-pbutils-1.0) BuildRequires: pkgconfig(gmodule-2.0) %description @@ -31,7 +31,7 @@ Multimedia Framework Video Transcode Library (DEV). %package tool Summary: Multimedia Framework Video Transcode Utility Package -Group: TO_BE/FILLED_IN +Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description tool diff --git a/transcode/Makefile.am b/transcode/Makefile.am index 4a85b44..7af85cb 100755 --- a/transcode/Makefile.am +++ b/transcode/Makefile.am @@ -29,6 +29,7 @@ libmm_transcode_la_LIBADD = $(MMCOMMON_LIBS) \ $(GLIB_LIBS) \ $(GST_LIBS) \ $(GSTAPP_LIBS) \ + $(GST_VIDEO_LIBS) \ $(GST_PLUGIN_BASE_LIBS) \ $(GST_INTERFACE_LIBS) \ $(GSTPBUTILS_LIBS) \ diff --git a/transcode/include/mm_transcode.h b/transcode/include/mm_transcode.h index 04bfa5c..09e51ca 100644 --- a/transcode/include/mm_transcode.h +++ b/transcode/include/mm_transcode.h @@ -101,7 +101,7 @@ mm_transcode_create(MMHandleType* MMHandle); * @param MMHandle [in] MMHandleType * @param in_Filename [in] Input Video File pointer * @param containerformat [in] Container format (3GP/MP4) - * @param videoencoder [in] Videoencoder (ffenc_h263p/ffenc_mpeg4/savsenc_mp4/savsenc_h264) + * @param videoencoder [in] Videoencoder (avenc_h263p/avenc_mpeg4/savsenc_mp4/savsenc_h264) * @param audioencoder [in] Audioencoder (amr/aac) * @return This function returns transcode processor result value diff --git a/transcode/include/mm_transcode_internal.h b/transcode/include/mm_transcode_internal.h index 2ebfb78..61cc6e7 100644 --- a/transcode/include/mm_transcode_internal.h +++ b/transcode/include/mm_transcode_internal.h @@ -41,16 +41,15 @@ extern "C" { #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include #include -#include -#include +#include #include #include #include @@ -68,14 +67,14 @@ extern "C" { #define AMRENC "amrnbenc" #define ARS "auto-audio-resample" #define ASF "asfdemux" -#define FFENCMPEG4 "ffenc_mpeg4" -#define FFENCH263 "ffenc_h263p" +#define AVENCMPEG4 "avenc_mpeg4" +#define AVENCH263 "avenc_h263p" #define MUX "mux-name" -#define MUXAAC "ffmux_adts" -#define MUX3GP "ffmux_3gp" +#define MUXAAC "avmux_adts" +#define MUX3GP "avmux_3gp" #define MUXGPP "gppmux" -#define MUXMP4 "ffmux_mp4" -#define AACENC "ffenc_aac" +#define MUXMP4 "avmux_mp4" +#define AACENC "avenc_aac" #define PROFILE "profile" #define VENC "venc-name" #define MIN_DURATION 1000 @@ -170,7 +169,7 @@ typedef struct _handle_property_s gulong audio_cb_probe_id; guint progrss_event_id; const gchar *mime; - guint32 fourcc; + gchar format[sizeof(GST_VIDEO_FORMATS_ALL)]; gint in_width; gint in_height; gint width; @@ -235,10 +234,10 @@ typedef struct _handle_s handle_property_s *property; } handle_s; -gboolean _mm_cb_audio_output_stream_probe(GstPad *pad, GstBuffer *buffer, gpointer user_data); +GstPadProbeReturn _mm_cb_audio_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data); GstAutoplugSelectResult _mm_cb_decode_bin_autoplug_select(GstElement * element, GstPad * pad, GstCaps * caps, GstElementFactory * factory, handle_s *handle); -void _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, gboolean last, handle_s *handle); -gboolean _mm_cb_video_output_stream_probe(GstPad *pad, GstBuffer *buffer, gpointer user_data); +void _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, handle_s *handle); +GstPadProbeReturn _mm_cb_video_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data); gboolean _mm_cb_print_position(handle_s *handle); gboolean _mm_cb_transcode_bus(GstBus * bus, GstMessage * message, gpointer userdata); const gchar* _mm_check_media_type(GstCaps *caps); diff --git a/transcode/mm_transcode_codec.c b/transcode/mm_transcode_codec.c index 89f43f4..796849a 100755 --- a/transcode/mm_transcode_codec.c +++ b/transcode/mm_transcode_codec.c @@ -75,11 +75,11 @@ _mm_encodebin_set_venc_aenc(handle_s *handle) switch(handle->property->videoencoder) { case MM_VIDEOENCODER_MPEG4 : - strncpy(handle->property->venc, FFENCMPEG4, ENC_BUFFER_SIZE-1); + strncpy(handle->property->venc, AVENCMPEG4, ENC_BUFFER_SIZE-1); debug_log("[FFMPEG] %s", handle->property->venc); break; case MM_VIDEOENCODER_H263 : - strncpy(handle->property->venc, FFENCH263, ENC_BUFFER_SIZE-1); + strncpy(handle->property->venc, AVENCH263, ENC_BUFFER_SIZE-1); debug_log("[FFMPEG] %s", handle->property->venc); break; case MM_VIDEOENCODER_NO_USE : diff --git a/transcode/mm_transcode_pipeline.c b/transcode/mm_transcode_pipeline.c index 4d7bc25..70b2919 100755 --- a/transcode/mm_transcode_pipeline.c +++ b/transcode/mm_transcode_pipeline.c @@ -369,7 +369,7 @@ _mm_decode_audio_output_link(handle_s *handle) handle->decoder_audp->sinkdecaudiopad = gst_element_get_static_pad (handle->decoder_audp->decaudiobin, "decbin_audiosink"); /* get sink audiopad of decodebin */ handle->decoder_audp->srcdecaudiopad = gst_element_get_static_pad (handle->decoder_audp->decaudiobin, "decbin_audiosrc"); /* get src audiopad of decodebin */ - handle->property->audio_cb_probe_id = gst_pad_add_buffer_probe (handle->decoder_audp->sinkdecaudiopad, G_CALLBACK (_mm_cb_audio_output_stream_probe), handle); + handle->property->audio_cb_probe_id = gst_pad_add_probe (handle->decoder_audp->sinkdecaudiopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_audio_output_stream_probe, handle, g_free); debug_log("audio_cb_probe_id: %d", handle->property->audio_cb_probe_id); /* must use sinkpad (sinkpad => srcpad) for normal resized video buffer*/ } @@ -474,7 +474,7 @@ _mm_decode_video_output_link(handle_s *handle) handle->decoder_vidp->sinkdecvideopad = gst_element_get_static_pad(handle->decoder_vidp->decvideobin,"decbin_videosink"); handle->decoder_vidp->srcdecvideopad = gst_element_get_static_pad(handle->decoder_vidp->decvideobin,"decbin_videosrc"); - handle->property->video_cb_probe_id = gst_pad_add_buffer_probe (handle->decoder_vidp->sinkdecvideopad, G_CALLBACK (_mm_cb_video_output_stream_probe), handle); + handle->property->video_cb_probe_id = gst_pad_add_probe (handle->decoder_vidp->sinkdecvideopad, GST_PAD_PROBE_TYPE_BUFFER, _mm_cb_video_output_stream_probe, handle, g_free); debug_log("video_cb_probe_sink_id: %d", handle->property->video_cb_probe_id); /* must use sinkpad (sinkpad => srcpad) */ gst_bin_add(GST_BIN(handle->pipeline), handle->decoder_vidp->decvideobin); @@ -487,14 +487,14 @@ _mm_decodebin_pipeline_create(handle_s *handle) { int ret = MM_ERROR_NONE; - handle->decodebin = gst_element_factory_make ("decodebin2", "decoder"); /* autoplug-select is not worked when decodebin */ + handle->decodebin = gst_element_factory_make ("decodebin", "decoder"); /* autoplug-select is not worked when decodebin */ if (!handle->decodebin) { debug_error("decbin element could not be created. Exiting"); return MM_ERROR_TRANSCODE_INTERNAL; } - g_signal_connect (handle->decodebin, "new-decoded-pad",G_CALLBACK(_mm_cb_decoder_newpad_encoder), handle); + g_signal_connect (handle->decodebin, "pad-added",G_CALLBACK(_mm_cb_decoder_newpad_encoder), handle); g_signal_connect (handle->decodebin, "autoplug-select", G_CALLBACK(_mm_cb_decode_bin_autoplug_select), handle); return ret; @@ -980,8 +980,8 @@ _mm_transcode_preset_capsfilter(handle_s *handle, unsigned int resolution_width, if (handle->decoder_vidp->vidflt) { debug_log("[Resolution] Output Width: [%d], Output Height: [%d]", resolution_width, resolution_height); - g_object_set (G_OBJECT (handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('I', '4', '2', '0'), + g_object_set (G_OBJECT (handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple("video/x-raw", + "format", G_TYPE_STRING, "I420", "width", G_TYPE_INT, resolution_width, "height", G_TYPE_INT, resolution_height, NULL), NULL); diff --git a/transcode/mm_transcode_seek.c b/transcode/mm_transcode_seek.c index 83516c9..8b4610a 100755 --- a/transcode/mm_transcode_seek.c +++ b/transcode/mm_transcode_seek.c @@ -31,34 +31,34 @@ static int _mm_transcode_play (handle_s *handle); static int _mm_transcode_seek (handle_s *handle); static gpointer _mm_transcode_thread_repeate(gpointer data); -gboolean -_mm_cb_audio_output_stream_probe(GstPad *pad, GstBuffer *buffer, gpointer user_data) +GstPadProbeReturn +_mm_cb_audio_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { handle_s *handle = (handle_s*) user_data; if (!handle) { debug_error("[ERROR] - handle"); - return MM_ERROR_INVALID_ARGUMENT; + return GST_PAD_PROBE_REMOVE; } if (!handle->property) { debug_error("[ERROR] - handle property"); - return MM_ERROR_TRANSCODE_INTERNAL; + return GST_PAD_PROBE_REMOVE; } gint64 start_pos_ts = handle->param->start_pos * G_GINT64_CONSTANT(1000000); - if(GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) { + if(GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) { if(0 == handle->property->AUDFLAG++) { - _mm_transcode_audio_capsfilter(gst_buffer_get_caps (buffer), handle); /* Need to audio caps converting when amrnbenc*/ /* Not drop buffer with 'return FALSE'*/ + _mm_transcode_audio_capsfilter(gst_pad_query_caps (pad, NULL), handle); /* Need to audio caps converting when amrnbenc*/ /* Not drop buffer with 'return FALSE'*/ if(handle->param->seeking) { debug_log("[AUDIO BUFFER TIMESTAMP] ([%"GST_TIME_FORMAT"])", GST_TIME_ARGS(start_pos_ts)); - GST_BUFFER_TIMESTAMP (buffer) = start_pos_ts; + GST_BUFFER_TIMESTAMP (GST_PAD_PROBE_INFO_BUFFER(info)) = start_pos_ts; } } } - return TRUE; + return GST_PAD_PROBE_OK; } GstAutoplugSelectResult @@ -105,7 +105,7 @@ _mm_cb_decode_bin_autoplug_select(GstElement * element, GstPad * pad, GstCaps * } void -_mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, gboolean last, handle_s *handle) +_mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, handle_s *handle) { if (!handle) { debug_error("[ERROR] - handle"); @@ -133,7 +133,7 @@ _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, gboolean last, } debug_log("[============ new-decoded-pad ============]"); - handle->property->caps = gst_pad_get_caps (pad); + handle->property->caps = gst_pad_query_caps (pad, NULL); const gchar *mime = _mm_check_media_type(handle->property->caps); if(!mime) { @@ -172,35 +172,6 @@ _mm_cb_decoder_newpad_encoder(GstElement *decodebin, GstPad *pad, gboolean last, } else { debug_log("gst structure error"); } - - if(last) { - if(0 == handle->property->seek_idx) { - if(handle->property->linked_vidoutbin == TRUE) { - if(handle->property->videoencoder != MM_VIDEOENCODER_NO_USE) { - if(handle->param->seeking) { - _mm_transcode_add_sink(handle, handle->decoder_vidp->decsinkvideoqueue); - } - if(gst_pad_link(handle->decoder_vidp->srcdecvideopad, handle->encodebin->encvideopad) != GST_PAD_LINK_OK) { - debug_error("Error [srcdecvideopad - encvideopad]"); - } else { - debug_log("Success [srcdecvideopad - encvideopad]"); - } - } - } - if(handle->property->linked_audoutbin == TRUE) { - if(handle->property->audioencoder != MM_AUDIOENCODER_NO_USE) { - if(handle->param->seeking) { - _mm_transcode_add_sink(handle, handle->decoder_audp->decsinkaudioqueue); - } - if(gst_pad_link(handle->decoder_audp->srcdecaudiopad, handle->encodebin->encaudiopad) != GST_PAD_LINK_OK) { - debug_error("Error [srcdecaudiopad - encaudiopad]"); - } else { - debug_log("Success [srcdecaudiopad - encaudiopad]"); - } - } - } - } - } } gboolean @@ -220,7 +191,7 @@ _mm_cb_print_position(handle_s *handle) } if(!handle->property->repeat_thread_exit) { /* To avoid gst_element_query_position bs */ - if (gst_element_query_position (handle->pipeline, &fmt, &pos)) { + if (gst_element_query_position (handle->pipeline, fmt, &pos)) { unsigned long current_pos =(unsigned long)(GST_TIME_AS_MSECONDS(pos)); if(handle->param->seeking == FALSE) { handle->property->current_pos = current_pos; @@ -256,34 +227,34 @@ _mm_cb_print_position(handle_s *handle) return TRUE; } -gboolean -_mm_cb_video_output_stream_probe(GstPad *pad, GstBuffer *buffer, gpointer user_data) +GstPadProbeReturn +_mm_cb_video_output_stream_probe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) { handle_s *handle = (handle_s*) user_data; if (!handle) { debug_error("[ERROR] - handle"); - return FALSE; + return GST_PAD_PROBE_REMOVE; } if (!handle->property) { debug_error("[ERROR] - handle property"); - return FALSE; + return GST_PAD_PROBE_REMOVE; } gint64 start_pos_ts = handle->param->start_pos * G_GINT64_CONSTANT(1000000); - if(GST_BUFFER_TIMESTAMP_IS_VALID (buffer)) { + if(GST_BUFFER_TIMESTAMP_IS_VALID (GST_PAD_PROBE_INFO_BUFFER(info))) { if(0 == handle->property->VIDFLAG++) { - _mm_transcode_video_capsfilter(gst_buffer_get_caps (buffer), handle); /* Not drop buffer with 'return FALSE'*/ + _mm_transcode_video_capsfilter(gst_pad_query_caps (pad, NULL), handle); /* Not drop buffer with 'return FALSE'*/ if(handle->param->seeking) { debug_log("[VIDEO BUFFER TIMESTAMP] ([%"GST_TIME_FORMAT"])", GST_TIME_ARGS(start_pos_ts)); - GST_BUFFER_TIMESTAMP (buffer) = start_pos_ts; + GST_BUFFER_TIMESTAMP (GST_PAD_PROBE_INFO_BUFFER(info)) = start_pos_ts; } } } - return TRUE; + return GST_PAD_PROBE_OK; } gboolean @@ -385,7 +356,7 @@ _mm_cb_transcode_bus(GstBus * bus, GstMessage * message, gpointer userdata) break; } - if(gst_element_query_duration (handle->pipeline, &fmt, &total_length) && handle->property->total_length == 0) { + if(gst_element_query_duration (handle->pipeline, fmt, &total_length) && handle->property->total_length == 0) { debug_log("[GST_MESSAGE_ASYNC_DONE] Total Duration: %" GST_TIME_FORMAT " ", GST_TIME_ARGS (total_length)); handle->property->total_length = (unsigned long)(GST_TIME_AS_MSECONDS(total_length)); } @@ -506,11 +477,11 @@ _mm_transcode_audio_capsfilter(GstCaps *caps, handle_s *handle) } if(!strcmp(handle->property->aenc, AMRENC)) { - caps = gst_caps_new_simple("audio/x-raw-int", + caps = gst_caps_new_simple("audio/x-raw", "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); } else if(!strcmp(handle->property->aenc, AACENC)) { - caps = gst_caps_new_simple("audio/x-raw-int", + caps = gst_caps_new_simple("audio/x-raw", "width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, "rate", G_TYPE_INT, 44100, @@ -624,7 +595,6 @@ _mm_transcode_exec(handle_s *handle, handle_param_s *param) } else { g_object_set (G_OBJECT (handle->filesink), "location", handle->param->outputfile, NULL); debug_log("[%s] set filesink location", handle->param->outputfile); - g_object_set (G_OBJECT (handle->filesink), "preroll-queue-len", 2, NULL); /* Ready Transcode */ if(strlen(handle->param->outputfile) !=0) { @@ -818,7 +788,7 @@ _mm_transcode_video_capsfilter_call(handle_s *handle) debug_log("Input Width: [%d] Input Hieght: [%d] Output Width: [%d], Output Height: [%d]", handle->property->in_width, handle->property->in_height, handle->param->resolution_width, handle->param->resolution_height); g_object_set (G_OBJECT (handle->decoder_vidp->vidflt), "caps", gst_caps_new_simple(handle->property->mime, - "format", GST_TYPE_FOURCC, handle->property->fourcc, + "format", G_TYPE_STRING, handle->property->format, "width", G_TYPE_INT, handle->param->resolution_width, "height", G_TYPE_INT, handle->param->resolution_height, "framerate", GST_TYPE_FRACTION, handle->property->fps_n, handle->property->fps_d, @@ -851,17 +821,23 @@ _mm_transcode_video_capsfilter_set_parameter(GstCaps *caps, handle_s *handle) handle->property->mime = _mm_check_media_type(caps); debug_log("mime: %s", handle->property->mime); - gst_structure_get_fourcc (_str, "format", &handle->property->fourcc); - if (GST_MAKE_FOURCC ('I', '4', '2', '0') == handle->property->fourcc) { - debug_log("GST_MAKE_FOURCC ('I', '4', '2', '0')"); - } else if(GST_MAKE_FOURCC ('R', 'G', 'B',' ') == handle->property->fourcc) { - debug_log("GST_MAKE_FOURCC ('R', 'G', 'B', ' ')"); - } else if(GST_MAKE_FOURCC ('S', 'N', '1', '2') == handle->property->fourcc) { - debug_log("GST_MAKE_FOURCC ('S', 'N', '1', '2')"); - } else if(GST_MAKE_FOURCC ('S', 'T', '1', '2') == handle->property->fourcc) { - debug_log("GST_MAKE_FOURCC ('S', 'T', '1', '2')"); - } else if(GST_MAKE_FOURCC ('N', 'V', '1', '2') == handle->property->fourcc) { - debug_log("GST_MAKE_FOURCC ('N', 'V', '1', '2')"); + const gchar* format = gst_structure_get_string(_str, "format"); + strncpy(handle->property->format, format, sizeof(handle->property->format)); + switch (gst_video_format_from_string(handle->property->format)) { + case GST_VIDEO_FORMAT_I420: + case GST_VIDEO_FORMAT_RGB: + case GST_VIDEO_FORMAT_NV12: + debug_log("format: %s", handle->property->format); + break; + + case GST_VIDEO_FORMAT_UNKNOWN: + if (strcmp(handle->property->format, "SN12") == 0 || strcmp(handle->property->format, "ST12") == 0) { + debug_log("format: %s", handle->property->format); + } + break; + + default: + break; } if(!gst_structure_get_int(_str, "width", &handle->property->in_width) || !gst_structure_get_int(_str, "height", &handle->property->in_height)) { -- 2.7.4