dataout: added segment implementation layer [1/2]

PD#SWPL-137949

Problem:
request for data output only

Solution:
optimized for segment layer
implemented output segment layer

Verify:
PB

Change-Id: Ia4c6a2ec451736e523c0ff5fc94226e95d7a9b7a
Signed-off-by: Zhiqiang Han <zhiqiang.han@amlogic.com>
diff --git a/src/dvr_segment.c b/src/dvr_segment.c
index 7c39a64..db512b7 100644
--- a/src/dvr_segment.c
+++ b/src/dvr_segment.c
@@ -87,18 +87,17 @@
 
   DIR *dir; // pointer to directory
   struct dirent *entry; // pointer to file entry
-  char *ext; // pointer to file extension
-  char *loc_dname;
-  int loc_dname_len;
-  char *loc_fname;
-  int loc_fname_len;
-  char *path;
-  int path_size;
+  char *loc_dname = NULL;
+  int loc_dname_len = 0;
+  char *loc_fname = NULL;
+  int loc_fname_len = 0;
+  char *path = NULL;
+  int path_size = 0;
 
   /*get the dirname and filename*/
   loc_fname = strrchr(location, '/');// fine last slash
-  loc_fname_len = strlen(loc_fname);
   if (loc_fname) {// skip the slash
+    loc_fname_len = strlen(loc_fname);
     loc_fname += 1;
     loc_fname_len -= 1;
   }