gstreamer_core/tsrc/examples/wav_record/src/wav_record.c
changeset 31 aec498aab1d3
parent 27 d43ce56a1534
equal deleted inserted replaced
27:d43ce56a1534 31:aec498aab1d3
    27 }
    27 }
    28 
    28 
    29 GstElement *pipeline, *source, *wavenc,*sink;
    29 GstElement *pipeline, *source, *wavenc,*sink;
    30 GstBus *bus;
    30 GstBus *bus;
    31 GMainLoop *loop;
    31 GMainLoop *loop;
    32 
    32 gint error;
    33 static gboolean
    33 static gboolean
    34 bus_call (GstBus     *bus,
    34 bus_call (GstBus     *bus,
    35           GstMessage *msg,
    35           GstMessage *msg,
    36           gpointer    data)
    36           gpointer    data)
    37 {
    37 {
    39     case GST_MESSAGE_EOS:
    39     case GST_MESSAGE_EOS:
    40         gst_element_set_state (pipeline, GST_STATE_NULL);
    40         gst_element_set_state (pipeline, GST_STATE_NULL);
    41         g_main_loop_quit(loop);
    41         g_main_loop_quit(loop);
    42         gst_object_unref (GST_OBJECT (pipeline));
    42         gst_object_unref (GST_OBJECT (pipeline));
    43         //std_log(LOG_FILENAME_LINE, "Test Successful");
    43         //std_log(LOG_FILENAME_LINE, "Test Successful");
    44         create_xml(0); 
    44         create_xml(error); 
    45       break;
    45       break;
    46     case GST_MESSAGE_ERROR: {
    46     case GST_MESSAGE_ERROR: {
    47       gchar *debug;
    47       gchar *debug;
    48       GError *err;
    48       GError *err;
    49       gst_message_parse_error (msg, &err, &debug);
    49       gst_message_parse_error (msg, &err, &debug);
    50       g_free (debug);
    50       g_free (debug);
    51       g_print ("Error: %s\n", err->message);
    51       g_print ("Error: %s\n", err->message);
       
    52       error = err->code;
    52       g_error_free (err);
    53       g_error_free (err);
    53       //std_log(LOG_FILENAME_LINE, "Test Failed");
    54       //std_log(LOG_FILENAME_LINE, "Test Failed");
    54       create_xml(1); 
    55 
    55       break;
    56       break;
    56     }
    57     }
    57     default:
    58     default:
    58       break;
    59       break;
    59   }
    60   }
    77     int sampling_rate = 8000;
    78     int sampling_rate = 8000;
    78     int chans = 1; 
    79     int chans = 1; 
    79     int width = 16;
    80     int width = 16;
    80     guint record_duration = 10000;
    81     guint record_duration = 10000;
    81     
    82     
       
    83     error = 0;
    82     if (argc > 1) {
    84     if (argc > 1) {
    83     record_duration = (guint) atoi( argv[1] ) * 1000;
    85     record_duration = (guint) atoi( argv[1] ) * 1000;
    84     }
    86     }
    85 
    87 
    86     if (argc > 2) {
    88     if (argc > 2) {