Revision 87335b80 src/libsharedvideo/shared-video-writer.cpp
| b/src/libsharedvideo/shared-video-writer.cpp | ||
|---|---|---|
| 7 | 7 |
|
| 8 | 8 |
Writer::Writer (GstElement *pipeline,GstElement *videoElement,const std::string socketPath) : timereset_ (FALSE), timeshift_ (0) |
| 9 | 9 |
{
|
| 10 |
|
|
| 11 | 10 |
qserial_ = gst_element_factory_make ("queue", NULL);
|
| 12 | 11 |
serializer_ = gst_element_factory_make ("gdppay", NULL);
|
| 13 | 12 |
shmsink_ = gst_element_factory_make ("shmsink", NULL);
|
| ... | ... | |
| 44 | 43 |
gst_element_set_state (serializer_, current); |
| 45 | 44 |
gst_element_set_state (shmsink_, current); |
| 46 | 45 |
} |
| 47 |
|
|
| 48 |
|
|
| 49 | 46 |
} |
| 50 | 47 |
|
| 51 |
|
|
| 52 | 48 |
Writer::~Writer (){
|
| 53 | 49 |
} |
| 54 | 50 |
|
| ... | ... | |
| 71 | 67 |
} |
| 72 | 68 |
|
| 73 | 69 |
return TRUE; |
| 74 |
|
|
| 75 | 70 |
} |
| 76 | 71 |
|
| 77 | 72 |
void |
| ... | ... | |
| 82 | 77 |
if(blocked) |
| 83 | 78 |
g_printerr ("Error: pad not unblocked\n");
|
| 84 | 79 |
else |
| 85 |
{
|
|
| 86 | 80 |
context->timereset_=TRUE; |
| 87 |
} |
|
| 88 | 81 |
} |
| 89 | 82 |
|
| 90 | 83 |
void |
| ... | ... | |
| 107 | 100 |
gst_object_unref (sinkPad); |
| 108 | 101 |
|
| 109 | 102 |
GstBin *bin=GST_BIN (GST_ELEMENT_PARENT(context->serializer_)); |
| 110 |
|
|
| 111 | 103 |
|
| 112 | 104 |
//supposed to be PLAYING, possible issue because of not taking care of pending state |
| 113 | 105 |
GstState current; |
| 114 | 106 |
gst_element_get_state (context->serializer_,¤t,NULL,GST_CLOCK_TIME_NONE); |
| 115 |
//g_print("serializer state: %d \n",current);
|
|
| 116 | 107 |
|
| 117 | 108 |
//get rid of the old serializer TODO ensure object has been cleaned up |
| 118 | 109 |
gst_element_set_state (context->serializer_,GST_STATE_NULL); |
| 119 |
|
|
| 120 | 110 |
//waiting for possible async state change |
| 121 | 111 |
gst_element_get_state (context->serializer_,NULL,NULL,GST_CLOCK_TIME_NONE); |
| 122 | 112 |
|
| ... | ... | |
| 125 | 115 |
if(gst_element_set_state (context->serializer_, current) != GST_STATE_CHANGE_SUCCESS) |
| 126 | 116 |
g_printerr ("Error: issue changing newSerializer state\n");
|
| 127 | 117 |
else{
|
| 128 |
//g_print ("changing serializer state\n");
|
|
| 129 | 118 |
gst_bin_add (bin,context->serializer_); |
| 130 | 119 |
GstPad *newSinkPad=gst_element_get_static_pad (context->serializer_,"sink"); |
| 131 | 120 |
GstPad *newSrcPad=gst_element_get_static_pad (context->serializer_,"src"); |
| ... | ... | |
| 138 | 127 |
gst_object_unref (sinkPadPeer); |
| 139 | 128 |
|
| 140 | 129 |
//unblocking data stream |
| 141 |
//g_print ("setting pad to unblocked\n");
|
|
| 142 | 130 |
gst_pad_set_blocked_async (pad, |
| 143 | 131 |
FALSE, |
| 144 | 132 |
(GstPadBlockCallback) (Writer::pad_unblocked), |
| ... | ... | |
| 149 | 137 |
Writer::on_client_connected (GstElement * shmsink, gint num, gpointer user_data) |
| 150 | 138 |
{
|
| 151 | 139 |
Writer *context = static_cast<Writer*>(user_data); |
| 152 |
|
|
| 153 |
//g_print ("on client connected %d\n",num);
|
|
| 154 | 140 |
GstPad *serializerSinkPad=gst_element_get_static_pad(context->serializer_,"sink"); |
| 155 | 141 |
GstPad *padToBlock = gst_pad_get_peer(serializerSinkPad); |
| 156 | 142 |
|
Also available in: Unified diff