diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-03-19 15:40:34 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-03-20 14:18:11 +0100 |
commit | 041d84f7586a0907ed85166755b5bde7fe2d67cf (patch) | |
tree | e0320812ff6a08eccfbba3605f5b1b73ff57faa4 | |
parent | 1f19cb0952b0144ec73b0ee12d0762f6bc73ee21 (diff) | |
download | gst-plugins-fsl-vpu-041d84f7586a0907ed85166755b5bde7fe2d67cf.tar.gz gst-plugins-fsl-vpu-041d84f7586a0907ed85166755b5bde7fe2d67cf.tar.xz |
remove unused crap
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/mfw_gst_utils.h | 433 | ||||
-rwxr-xr-x | src/mfw_gst_vpu_decoder.c | 20 | ||||
-rw-r--r-- | src/mfw_gst_vpu_encoder.c | 127 |
3 files changed, 71 insertions, 509 deletions
diff --git a/include/mfw_gst_utils.h b/include/mfw_gst_utils.h index 734557a..a270a93 100644 --- a/include/mfw_gst_utils.h +++ b/include/mfw_gst_utils.h @@ -47,433 +47,6 @@ #define __MFW_GST_UTILS_H__ /*============================================================================= - MACROS -=============================================================================*/ - -#define _STR(s) #s -#define STR(s) _STR(s) - -/* ANSI color print */ -#define COLOR_RED 31 -#define COLOR_GREEN 32 -#define COLOR_YELLOW 33 -#define COLOR_BLUE 34 -#define COLOR_PURPLE 35 -#define COLOR_CYAN 36 - -#define COLORFUL_STR(color, format, ...)\ - "\33[1;" STR(color) "m" format "\33[0m", __VA_ARGS__ - -#define YELLOW_STR(format,...) COLORFUL_STR(COLOR_YELLOW,format, __VA_ARGS__) -#define RED_STR(format,...) COLORFUL_STR(COLOR_RED,format, __VA_ARGS__) -#define GREEN_STR(format,...) COLORFUL_STR(COLOR_GREEN,format, __VA_ARGS__) -#define BLUE_STR(format,...) COLORFUL_STR(COLOR_BLUE,format,__VA_ARGS__) -#define PURPLE_STR(format,...) COLORFUL_STR(COLOR_PURPLE,format,__VA_ARGS__) -#define CYAN_STR(format,...) COLORFUL_STR(COLOR_CYAN,format,__VA_ARGS__) - - -/* version info print */ -#define PRINT_CORE_VERSION(ver)\ - do{\ - g_print(YELLOW_STR("%s.\n",(ver)));\ - }while(0) - -#define PRINT_PLUGIN_VERSION(ver)\ - do {\ - g_print(GREEN_STR("%s %s build on %s %s.\n", #ver,(ver),__DATE__,__TIME__));\ - }while(0) - -#define FLAG_SET_BIT(flag, bit)\ - do {\ - (flag) |= (bit);\ - }while(0) - -#define FLAG_CLEAR_BIT(flag, bit)\ - do {\ - (flag) &= (~(bit));\ - }while(0) - -#define FLAG_TEST_BIT(flag, bit)\ - ((flag) & (bit)) - - -/* common resolution limitation by platform */ -#if defined (_MX51) -// 1080p -#define MAX_RESOLUTION_WIDTH 1920 -#define MAX_RESOLUTION_HEIGHT 1080 -#define MIN_RESOLUTION_WIDTH 64 -#define MIN_RESOLUTION_HEIGHT 64 - -#elif defined(_MX37) -// SVGA -#define MAX_RESOLUTION_WIDTH 800 -#define MAX_RESOLUTION_HEIGHT 600 -#define MIN_RESOLUTION_WIDTH 64 -#define MIN_RESOLUTION_HEIGHT 64 - -#elif defined(_MX31)|| defined(_MX35) -// D1 -#define MAX_RESOLUTION_WIDTH 720 -#define MAX_RESOLUTION_HEIGHT 576 -#define MIN_RESOLUTION_WIDTH 64 -#define MIN_RESOLUTION_HEIGHT 64 - -#else -#define MAX_RESOLUTION_WIDTH 720 -#define MAX_RESOLUTION_HEIGHT 576 -#define MIN_RESOLUTION_WIDTH 64 -#define MIN_RESOLUTION_HEIGHT 64 -#endif - - -/*============================================================================= - DIRECT RENDER RELATED MACROS -=============================================================================*/ - -#if (DIRECT_RENDER_VERSION==2) -/*Direct render v2, support get/release decoder interface only*/ - -#ifndef BM_FLOW -#define BM_FLOW(...) -#endif - -#ifndef BM_TRACE_BUFFER -#define BM_TRACE_BUFFER(...) -#endif - -typedef enum { - BMDIRECT = 0, - BMINDIRECT = 1 -}BMMode; - -#define BMFLAG (GST_BUFFER_FLAG_LAST>>1) - -static BMMode bm_mode = BMDIRECT; -static GSList * bm_list = NULL; -static gint bm_buf_num = 0; - -#define BM_CLEAN_LIST do{\ - while(bm_list){\ - if (GST_BUFFER_FLAG_IS_SET(bm_list->data, BMFLAG))\ - gst_buffer_unref(bm_list->data);\ - gst_buffer_unref(bm_list->data);\ - (bm_list) = g_slist_remove((bm_list), (bm_list)->data);\ - };\ - }while(0) - -#define BM_INIT(rmdmode, decbufnum, rendbufnum) do{\ - BM_FLOW("BM_INIT\n", 0);\ - bm_buf_num = decbufnum;\ - BM_CLEAN_LIST;\ - }while(0) - -#define BM_GET_BUFFER(tgtpad, size, pdata) do{\ - GstBuffer * buffer;\ - GstFlowReturn result;\ - GstCaps *src_caps = NULL;\ - src_caps = GST_PAD_CAPS((tgtpad));\ - result = gst_pad_alloc_buffer_and_set_caps((tgtpad), 0,(size), src_caps,&buffer);\ - if (result==GST_FLOW_OK){\ - GST_BUFFER_FLAG_SET(buffer, BMFLAG);\ - (pdata) = GST_BUFFER_DATA(buffer);\ - gst_buffer_ref(buffer);\ - bm_list=g_slist_append(bm_list, buffer);\ - BM_FLOW("BM_GET_BUFFERv2 %p:d%p\n", buffer, pdata);\ - BM_TRACE_BUFFER("codec request %p:d%p\n", buffer, pdata);\ - break;\ - }\ - if (result!=GST_FLOW_OK){\ - (pdata)=NULL;\ - g_print("BM_GET_BUFFERv2 no buffer, %d in codec\n", g_slist_length(bm_list));\ - }\ - }while(0) - -#define BM_QUERY_HWADDR(pdata, hwbuffer) do{\ - GSList * tmp = (bm_list);\ - GstBuffer * buffer;\ - while(tmp){\ - buffer = (GstBuffer *)(tmp->data);\ - if (GST_BUFFER_DATA(buffer)==(pdata)){\ - (hwbuffer) = GST_BUFFER_OFFSET(buffer);\ - BM_FLOW("BM_HWTRANSITION v%p=h%p\n", buffer, (hwbuffer));\ - break;\ - }\ - tmp = tmp->next;\ - }\ - if (tmp==NULL)\ - g_print("BM_HWTRANSITION illegal %p!\n", pdata);\ - }while (0) - -#define BM_RELEASE_BUFFER(pdata) do{\ - GSList * tmp = (bm_list);\ - GstBuffer * buffer;\ - while(tmp){\ - buffer = (GstBuffer *)(tmp->data);\ - if (GST_BUFFER_DATA(buffer)==(pdata)){\ - BM_FLOW("BM_RELEASE_BUFFERv2 %p:d%p\n", buffer, pdata);\ - if (GST_BUFFER_FLAG_IS_SET(buffer, BMFLAG)){\ - GST_BUFFER_FLAG_UNSET(buffer, BMFLAG);\ - }else{\ - (bm_list) = g_slist_remove((bm_list), buffer);\ - BM_TRACE_BUFFER("codec release %p:d%p\n", buffer, pdata);\ - }\ - gst_buffer_unref(buffer);\ - break;\ - }\ - tmp = tmp->next;\ - }\ - if (tmp==NULL)\ - g_print("BM_RELEASE_BUFFERv2 illegal %p!\n", pdata);\ - }while (0) - -#define BM_REJECT_BUFFER(pdata) do{\ - GSList * tmp = (bm_list);\ - GstBuffer * buffer;\ - g_print("BM_REJECT_BUFFER shuold not here %p!\n", pdata);\ - while(tmp){\ - buffer = (GstBuffer *)(tmp->data);\ - if (GST_BUFFER_DATA(buffer)==(pdata)){\ - BM_FLOW("BM_REJECT_BUFFERv2 %p:d%p\n", buffer, pdata);\ - if (GST_BUFFER_FLAG_IS_SET(buffer, BMFLAG)){\ - GST_BUFFER_FLAG_UNSET(buffer, BMFLAG);\ - }else{\ - (bm_list) = g_slist_remove((bm_list), buffer);\ - BM_TRACE_BUFFER("codec release %p:d%p\n", buffer, pdata);\ - }\ - gst_buffer_unref(buffer);\ - break;\ - }\ - tmp = tmp->next;\ - }\ - if (tmp==NULL)\ - g_print("BM_RELEASE_BUFFERv2 illegal %p!\n", pdata);\ - }while (0) - -#define BM_RENDER_BUFFER(pdata, tgtpad, status, timestamp, duration) do{\ - GSList * tmp = (bm_list);\ - GstBuffer * buffer;\ - while(tmp){\ - buffer = (GstBuffer *)(tmp->data);\ - if (GST_BUFFER_DATA(buffer)==(pdata)){\ - BM_FLOW("BM_RENDER_BUFFERv2 %p:d%p\n", buffer, pdata);\ - BM_FLOW("Render timestamp %lld\n",(timestamp)/1000000);\ - if (GST_BUFFER_FLAG_IS_SET(buffer, BMFLAG)){\ - GST_BUFFER_FLAG_UNSET(buffer, BMFLAG);\ - }else{\ - (bm_list) = g_slist_remove((bm_list), buffer);\ - BM_TRACE_BUFFER("codec release %p:d%p\n", buffer, pdata);\ - }\ - GST_BUFFER_TIMESTAMP(buffer) = (timestamp);\ - GST_BUFFER_DURATION(buffer) = (duration);\ - status = gst_pad_push((tgtpad), buffer);\ - break;\ - }\ - tmp = tmp->next;\ - }\ - if (tmp==NULL)\ - g_print("BM_RENDER_BUFFERv2 illegal %p!\n", pdata);\ - }while (0) - -#define BM_GET_MODE bm_mode -#define BM_GET_BUFFERNUM bm_buf_num - -#endif//(DIRECT_RENDER_VERSION==2) - - -/*============================================================================= - FRAME DROPING RELATED MACROS/FUNCTIONS -=============================================================================*/ - -#ifdef FRAMEDROPING_ENALBED - -#define OVERHEAD_TIME 50 -#define GST_BUFFER_FLAG_IS_SYNC (GST_BUFFER_FLAG_LAST<<2) -#define KEY_FRAME_SHIFT 3 -#define KEY_FRAME_ARRAY (1<<KEY_FRAME_SHIFT) -#define KEY_FRAME_MASK (KEY_FRAME_ARRAY-1) - -struct sfd_frames_info { - int total_frames; - int dropped_frames; - int dropped_iframes; - int is_dropped_iframes; - int estimate_decoding_time; - int decoded_time; - int curr_nonekey_frames, total_key_frames; - int key_frames_interval[8]; - struct timeval tv_start, tv_stop; -}; - -#define INIT_SFD_INFO(x) \ -do { \ - gint i; \ - (x)->total_frames = 0; \ - (x)->dropped_frames = 0; \ - (x)->dropped_iframes = 0; \ - (x)->is_dropped_iframes = 0; \ - (x)->estimate_decoding_time = 0; \ - (x)->decoded_time = 0; \ - (x)->curr_nonekey_frames = 0; \ - (x)->total_key_frames = 0; \ - for(i=0;i<KEY_FRAME_ARRAY;i++) { \ - (x)->key_frames_interval[i]=0; \ - } \ -} while(0); - -#define CALC_SFD_DECODED_TIME(x) \ -do { \ - int decoded_time; \ - int decoded_frames = (x)->total_frames-(x)->dropped_frames; \ - decoded_time = ((x)->tv_stop.tv_sec - (x)->tv_start.tv_sec) * 1000000 \ - + (x)->tv_stop.tv_usec - (x)->tv_start.tv_usec; \ - (x)->decoded_time += decoded_time; \ - if (decoded_frames == 0) { \ - (x)->estimate_decoding_time = decoded_time; \ - } else { \ - if ( decoded_time > (x)->estimate_decoding_time) \ - (x)->estimate_decoding_time = (x)->decoded_time / decoded_frames ; \ - } \ - GST_DEBUG("SFD info:\ntotal frames : %d,\tdropped frames : %d.\n", \ - (x)->total_frames,(x)->dropped_frames); \ - GST_DEBUG("Decoded time: %d,\tAverage decoding time : %d.\n", \ - decoded_time, (x)->estimate_decoding_time); \ -}while(0); - -#define GST_ADD_SFD_FIELD(caps) \ -do { \ - GValue sfd_value = { G_TYPE_INT, 1}; \ - GstStructure *s,*structure; \ - structure = gst_caps_get_structure((caps),0); \ - s = gst_structure_copy(structure); \ - gst_structure_set_value(s,"sfd",&sfd_value); \ - gst_caps_remove_structure((caps), 0); \ - gst_caps_append_structure((caps), s); \ -}while(0); - -#define MIN_DELAY_TIME 2000000 -#define MAX_DELAY_TIME 3000000 - -#define GST_QOS_EVENT_HANDLE(pSfd_info,diff,framerate) do { \ - if ((pSfd_info)->is_dropped_iframes == 0) { \ - int key_frames_interval,next_key_frame_time; \ - int micro_diff = (diff)/1000; \ - gint i; \ - if (micro_diff>MAX_DELAY_TIME) { \ - (pSfd_info)->is_dropped_iframes =1; \ - GST_ERROR ("The time of decoding is far away the system," \ - "so should drop some frames\n"); \ - break; \ - } \ - if((pSfd_info)->total_key_frames >= KEY_FRAME_ARRAY) { \ - for(i=0;i<KEY_FRAME_ARRAY;i++) { \ - key_frames_interval += (pSfd_info)->key_frames_interval[i]; \ - } \ - key_frames_interval >>= KEY_FRAME_SHIFT; \ - next_key_frame_time = (1000000 / (framerate)) * \ - (key_frames_interval - (pSfd_info)->curr_nonekey_frames); \ - } \ - else \ - next_key_frame_time = 0; \ - if ( (micro_diff > MIN_DELAY_TIME) && \ - (next_key_frame_time) && (next_key_frame_time < micro_diff) ) { \ - (pSfd_info)->is_dropped_iframes =1; \ - GST_ERROR ("The time of decoding is after the system," \ - "so should drop some frames\n"); \ - GST_ERROR ("key frame interval: %d," \ - "estimate next I frames: %d.\n",key_frames_interval, \ - key_frames_interval-(pSfd_info)->curr_nonekey_frames); \ - GST_ERROR ("diff time: %d, to next I frame time: %d\n", \ - (micro_diff),next_key_frame_time); \ - } \ - } \ -} while(0); -#define GET_TIME(x) do { \ - gettimeofday((x), 0); \ -} while(0); - -/*============================================================================= -FUNCTION: Strategy_FD - -DESCRIPTION: Strategy of Frame dropping in. - -ARGUMENTS PASSED: None. - - -RETURN VALUE: GstFlowReturn - GST_FLOW_ERROR: The GST buffer should be dropped. - GST_FLOW_OK: original case. - -PRE-CONDITIONS: None - -POST-CONDITIONS: None - -IMPORTANT NOTES: None -=============================================================================*/ -static GstFlowReturn Strategy_FD(int is_keyframes, - struct sfd_frames_info * psfd_info - ) -{ - psfd_info->total_frames++; - psfd_info->curr_nonekey_frames++; - - if (is_keyframes) { - (psfd_info)->is_dropped_iframes = 0; - (psfd_info)->key_frames_interval[(psfd_info)->total_key_frames&(KEY_FRAME_MASK)] - = (psfd_info)->curr_nonekey_frames; - (psfd_info)->total_key_frames++; - (psfd_info)->curr_nonekey_frames = 0; - } - if ((psfd_info)->is_dropped_iframes) - { - if (!(is_keyframes)) { - (psfd_info)->dropped_frames++; - GST_WARNING("SFD info:\ntotal frames : %d,\tdropped frames : %d.\n", - (psfd_info)->total_frames,(psfd_info)->dropped_frames); - return GST_FLOW_ERROR; - } - } - return GST_FLOW_OK; -} - -#endif - - -/*============================================================================= - DEMO PROTECTION RELATED MACROS -=============================================================================*/ - -/* The following is for DEMO protection */ -#define DEMO_STR "DEMO" - -#define INIT_DEMO_MODE(strVer,demomode) \ -do { \ - if (strstr((strVer), DEMO_STR)>0) \ - (demomode) = 1; \ - else \ - (demomode) = 0; \ -}while(0); - -#define DEMO_LIVE_TIME 120 - -#define DEMO_LIVE_CHECK(demomode,timestamp,srcpad) \ -do { \ - if ( \ - ( (demomode) == 1 ) && \ - ( ((timestamp) / GST_SECOND ) > DEMO_LIVE_TIME) \ - ) \ - { \ - GstEvent *event; \ - GST_WARNING("This is a demo version, \ - and the time exceed 2 minutes. \ - Sending EOS event.\n"); \ - event = gst_event_new_eos(); \ - gst_pad_push_event ((srcpad), event); \ - (demomode) = 2; \ - } \ -}while(0); - -/*============================================================================= STRUCTURES AND OTHER TYPEDEFS =============================================================================*/ @@ -489,9 +62,9 @@ typedef enum { STD_VC = -1, STD_MPEG4 = 0, STD_H263, - STD_AVC + STD_AVC, + STD_MJPG, } CodStd; -#endif//__MFW_GST_UTILS_H__ - +#endif//__MFW_GST_UTILS_H__ diff --git a/src/mfw_gst_vpu_decoder.c b/src/mfw_gst_vpu_decoder.c index 6571bfb..e97fef6 100755 --- a/src/mfw_gst_vpu_decoder.c +++ b/src/mfw_gst_vpu_decoder.c @@ -44,22 +44,22 @@ #define MFW_GST_VPUDEC_VIDEO_CAPS \ "video/mpeg, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int) [16," STR(MAX_HEIGHT)"], " \ + "width = (int) [16, 1920], " \ + "height = (int) [16, 1080], " \ "mpegversion = (int) 4; " \ \ "video/x-divx, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int) [16, " STR(MAX_HEIGHT)"], " \ + "width = (int) [16, 1920], " \ + "height = (int) [16, 1080], " \ "divxversion = (int) [4, 5]; " \ \ "video/x-h263, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int)[16, " STR(MAX_HEIGHT)"]; " \ - \ + "width = (int) [16, 1920], " \ + "height = (int) [16, 1080], " \ + \ "video/x-h264, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int)[16, " STR(MAX_HEIGHT)"]" + "width = (int) [16, 1920], " \ + "height = (int)[16, 1080]" #define DEFAULT_DBK_OFFSET_VALUE 5 @@ -732,8 +732,6 @@ mfw_gst_vpudec_change_state(GstElement * element, GstStateChange transition) return GST_STATE_CHANGE_FAILURE; } -#define MFW_GST_VPU_DECODER_PLUGIN VERSION - PRINT_PLUGIN_VERSION(MFW_GST_VPU_DECODER_PLUGIN); break; case GST_STATE_CHANGE_READY_TO_PAUSED: vpu_dec->init = FALSE; diff --git a/src/mfw_gst_vpu_encoder.c b/src/mfw_gst_vpu_encoder.c index 0b1bcdc..3b4028d 100644 --- a/src/mfw_gst_vpu_encoder.c +++ b/src/mfw_gst_vpu_encoder.c @@ -90,39 +90,25 @@ typedef struct _GstVPU_Enc char *device; }GstVPU_Enc; -/*maximum limit of the output buffer */ -#define BUFF_FILL_SIZE (200 * 1024) - -/* Maximum width and height - D1*/ -#define MAX_WIDTH 4096 -#define MAX_HEIGHT 4096 - /* Default frame rate */ #define DEFAULT_FRAME_RATE 30 -/* The processor clock is 333 MHz for MX27 -to be chnaged for other platforms */ - #define MFW_GST_VPUENC_VIDEO_CAPS \ "video/mpeg, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int) [16," STR(MAX_HEIGHT)"]; " \ + "width = (int) [16, 1280], " \ + "height = (int) [16, 720]; " \ \ "video/x-h263, " \ - "width = (int) [16, " STR(MAX_WIDTH)"], " \ - "height = (int)[16, " STR(MAX_HEIGHT)"]; " \ + "width = (int) [16, 1280], " \ + "height = (int) [16, 720]; " \ \ "video/x-h264, " \ - "width = (int) [16," STR(MAX_WIDTH)"], " \ - "height = (int)[16," STR(MAX_HEIGHT)"] " \ + "width = (int) [16, 1280], " \ + "height = (int) [16, 720]; " \ \ "image/jpeg, " \ - "width = (int) [16, " STR(MAX_WIDTH) "], " \ - "height = (int)[16, " STR(MAX_HEIGHT) "] " - -/* Chroma Subsampling ratio - assuming 4:2:0. */ -/* Not providing ability to set this on the command line because I'm not sure if VPU supports 4:2:2 - r58604 */ -#define CHROMA_SAMPLING_MULTIPLE 1.5 + "width = (int) [16, 1280], " \ + "height = (int) [16, 720]; " /* get the element details */ static GstElementDetails mfw_gst_vpuenc_details = @@ -144,9 +130,9 @@ GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_ALWAYS, GST_STATIC_CAPS("video/x-raw-yuv, " "format = (fourcc) {I420}, " - "width = (int) [ 16, " STR(MAX_WIDTH)"], " - "height = (int) [ 16, " STR(MAX_HEIGHT)"], " - "framerate = (fraction) [ 0/1, 60/1 ]") + "width = (int) [16, 1280], " + "height = (int) [16, 720], " + "framerate = (fraction) [0/1, 60/1]") ); #define GST_CAT_DEFAULT mfw_gst_vpuenc_debug @@ -157,7 +143,7 @@ static void mfw_gst_vpuenc_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GST_DEBUG("mfw_gst_vpuenc_set_property"); -printf("%s\n", __func__); + GstVPU_Enc *vpu_enc = MFW_GST_VPU_ENC(object); switch (prop_id) { case MFW_GST_VPU_PROF_ENABLE: @@ -202,7 +188,6 @@ printf("%s\n", __func__); static void mfw_gst_vpuenc_get_property(GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { -printf("%s\n", __func__); GST_DEBUG("mfw_gst_vpuenc_get_property"); GstVPU_Enc *vpu_enc = MFW_GST_VPU_ENC(object); switch (prop_id) { @@ -235,7 +220,6 @@ printf("%s\n", __func__); break; } return; - } static struct v4l2_requestbuffers reqs = { @@ -304,12 +288,22 @@ static int mfw_gst_vpuenc_init_encoder(GstPad *pad, enum v4l2_memory memory) } } - if (vpu_enc->codec == STD_MPEG4) + switch (vpu_enc->codec) { + case STD_MPEG4: mime = "video/mpeg"; - else if (vpu_enc->codec == STD_AVC) + break; + case STD_AVC: mime = "video/x-h264"; - else if (vpu_enc->codec == STD_H263) + break; + case STD_H263: mime = "video/x-h263"; + break; + case STD_MJPG: + mime = "image/jpeg"; + break; + default: + return GST_FLOW_ERROR; + } caps = gst_caps_new_simple(mime, "mpegversion", G_TYPE_INT, 4, @@ -337,7 +331,7 @@ static GstFlowReturn mfw_gst_vpuenc_chain(GstPad * pad, GstBuffer * buffer) struct pollfd pollfd; unsigned long type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - GST_DEBUG("mfw_gst_vpuenc_chain"); + GST_DEBUG(__func__); vpu_enc = MFW_GST_VPU_ENC(GST_PAD_PARENT(pad)); @@ -375,7 +369,7 @@ static GstFlowReturn mfw_gst_vpuenc_chain(GstPad * pad, GstBuffer * buffer) /* copy the input Frame into the allocated buffer */ memcpy(vpu_enc->buf_data[i], GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer)); gst_buffer_unref(buffer); - }else { + } else { vpu_enc->buf_v4l2[i].m.userptr = (long int)GST_BUFFER_DATA (buffer); vpu_enc->buf_v4l2[i].length = GST_BUFFER_SIZE (buffer); } @@ -442,12 +436,10 @@ static GstFlowReturn mfw_gst_vpuenc_chain(GstPad * pad, GstBuffer * buffer) retval = gst_pad_push(vpu_enc->srcpad, outbuffer); if (retval != GST_FLOW_OK) { - GST_ERROR("Error in Pushing the Output ont to " - "the Source Pad,error is %d \n", + GST_ERROR("Pushing Output onto the source pad failed with %d \n", retval); } -//done: return retval; } @@ -457,13 +449,12 @@ static GstStateChangeReturn mfw_gst_vpuenc_change_state GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS; GstVPU_Enc *vpu_enc = NULL; vpu_enc = MFW_GST_VPU_ENC(element); -// gint vpu_ret = 0; CodStd mode; switch (transition) { case GST_STATE_CHANGE_NULL_TO_READY: GST_DEBUG("VPU State: Null to Ready"); - vpu_enc->vpu_fd = open(vpu_enc->device, O_RDWR); // | O_NONBLOCK); + vpu_enc->vpu_fd = open(vpu_enc->device, O_RDWR); if (vpu_enc->vpu_fd < 0) { GST_ERROR("opening %s failed", vpu_enc->device); return GST_STATE_CHANGE_FAILURE; @@ -480,17 +471,18 @@ static GstStateChangeReturn mfw_gst_vpuenc_change_state vpu_enc->init = FALSE; vpu_enc->wait = FALSE; -// vpu_enc->encOP->bitRate = vpu_enc->bitrate; -// vpu_enc->encOP->gopSize = vpu_enc->gopsize; -// vpu_enc->encOP->slicemode.sliceMode = 1; /* 1 slice per picture */ -// vpu_enc->encOP->slicemode.sliceSize = 4000; /* not used if sliceMode is 0 */ vpu_enc->numframebufs = 0; - if (mode == STD_MPEG4) { - } else if (mode == STD_H263) { -// vpu_enc->encOP->frameRateInfo = 0x3E87530; - } else if (mode == STD_AVC) { - } else { + switch (mode) { + case STD_MPEG4: + break; + case STD_H263: + break; + case STD_AVC: + break; + case STD_MJPG: + break; + default: GST_ERROR("Encoder: Invalid codec standard mode"); return GST_STATE_CHANGE_FAILURE; } @@ -511,7 +503,7 @@ static GstStateChangeReturn mfw_gst_vpuenc_change_state GST_DEBUG("VPU State: Playing to Paused"); break; case GST_STATE_CHANGE_PAUSED_TO_READY: - vpu_enc->encoded_frames=0; + vpu_enc->encoded_frames = 0; GST_DEBUG("VPU State: Paused to Ready"); break; case GST_STATE_CHANGE_READY_TO_NULL: @@ -629,38 +621,37 @@ mfw_gst_vpuenc_class_init(GstVPU_EncClass * klass) mfw_gst_vpu_class_init_common(gobject_class); g_object_class_install_property(gobject_class, MFW_GST_VPU_PROF_ENABLE, - g_param_spec_boolean("profile", - "Profile", - "enable time profile of the vpu encoder plug-in", - FALSE, - G_PARAM_READWRITE)); + g_param_spec_boolean("profile", + "Profile", + "enable time profile of the vpu encoder plug-in", + FALSE, + G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, - MFW_GST_VPUENC_FRAME_RATE, - g_param_spec_float("framerate", - "FrameRate", - "gets the framerate at which the input stream is to be encoded", - 0, 60.0, 30.0, - G_PARAM_READWRITE)); + MFW_GST_VPUENC_FRAME_RATE, + g_param_spec_float("framerate", + "FrameRate", + "gets the framerate at which the input stream is to be encoded", + 0, 60.0, 30.0, + G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, MFW_GST_VPUENC_BITRATE, - g_param_spec_int("bitrate", "Bitrate", - "gets the bitrate (in kbps) at which stream is to be encoded", - 0, 32767, 0, - G_PARAM_READWRITE)); + g_param_spec_int("bitrate", "Bitrate", + "gets the bitrate (in kbps) at which stream is to be encoded", + 0, 32767, 0, + G_PARAM_READWRITE)); g_object_class_install_property(gobject_class, MFW_GST_VPUENC_GOP, - g_param_spec_int("gopsize", "Gopsize", - "gets the GOP size at which stream is to be encoded", - 0, 60, 0, - G_PARAM_READWRITE)); + g_param_spec_int("gopsize", "Gopsize", + "gets the GOP size at which stream is to be encoded", + 0, 60, 0, + G_PARAM_READWRITE)); } static void mfw_gst_vpuenc_init(GstVPU_Enc * vpu_enc, GstVPU_EncClass * gclass) { - GST_DEBUG("mfw_gst_vpuenc_init"); GstElementClass *klass = GST_ELEMENT_GET_CLASS(vpu_enc); |