tags:

views:

17

answers:

0

static void deinterleave_pad_added_cb(GstElement * deinterleave, GstPad * pad, AudioDeintBin * dat) { _AxonDVR * dvr; gchar * name; GstElement * bin;

    g_return_if_fail(dat != NULL);

    dvr = dat->dvr;
    name = gst_pad_get_name(pad);

    DEBUG("Got '%s' pad", name);

    /* Left/Right Channels */
    if(g_ascii_strncasecmp(name, "src0", 4) == 0 ||
       g_ascii_strncasecmp(name, "src1", 4) == 0) {
            GstElement * parent = NULL;

            if((parent = gst_pad_get_parent_element(pad))) {
                    GstElement * pbin;
                    if((pbin = (GstElement*)gst_element_get_parent(parent))) {
                            AudioChannelVolume * vdat = NULL;

                            DEBUG("Linking '%s' pad", name);

                            bin = advr_create_audio_channel_vol_bin(dvr, &vdat);
                            gst_element_set_state(bin, GST_STATE_PLAYING);
                            gst_bin_add(GST_BIN(pbin), bin);
                            GST_LINK_PADS_OR_BREAK(dat->deinterleave, name, bin, "sink", err);
                            GST_LINK_REQ_SINK_OR_BREAK(bin, "src", dat->interleave, "sink%d", err);
                            g_object_set_data(G_OBJECT(pad), "audio-channel-vol-bin", bin);
                            g_object_set_data(G_OBJECT(dat->deinterleave), name, vdat);
                    }
            }
    }

}

for the Above code i write the test case

void test_1_deinterleave_pad_added_cb(void **state) { GstElement * deinterleave = g_new0(GstElement,1); GstPad * pad =g_new0(GstElement,1);

AudioDeintBin * dat = g_new0(AudioDeintBin,1);
GstElement * parent = NULL;
 gst_pad_get_parent_element(pad);
deinterleave_pad_added_cb(deinterleave,pad,dat);
g_free(deinterleave);
g_free(pad);
g_free(dat);

} Upto this line if((parent = gst_pad_get_parent_element(pad))) it works fine but when this line gets executed condition gets false and m dont know how to make this conditin true in the main code.... can u please help me????