summaryrefslogtreecommitdiff
path: root/src/media.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/media.c')
-rw-r--r--src/media.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/media.c b/src/media.c
index dcda0664..cd3dfb82 100644
--- a/src/media.c
+++ b/src/media.c
@@ -22,6 +22,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "media.h" 23#include "media.h"
24#include "gmdocument.h" 24#include "gmdocument.h"
25#include "gmrequest.h"
25#include "ui/window.h" 26#include "ui/window.h"
26#include "audio/player.h" 27#include "audio/player.h"
27#include "app.h" 28#include "app.h"
@@ -295,3 +296,36 @@ iPlayer *audioPlayer_Media(const iMedia *d, iMediaId audioId) {
295 } 296 }
296 return NULL; 297 return NULL;
297} 298}
299
300/*----------------------------------------------------------------------------------------------*/
301
302static void updated_MediaRequest_(iAnyObject *obj) {
303 iMediaRequest *d = obj;
304 postCommandf_App("media.updated link:%u request:%p", d->linkId, d);
305}
306
307static void finished_MediaRequest_(iAnyObject *obj) {
308 iMediaRequest *d = obj;
309 postCommandf_App("media.finished link:%u request:%p", d->linkId, d);
310}
311
312void init_MediaRequest(iMediaRequest *d, iDocumentWidget *doc, unsigned int linkId, const iString *url) {
313 d->doc = doc;
314 d->linkId = linkId;
315 d->req = new_GmRequest(certs_App());
316 setUrl_GmRequest(d->req, url);
317 iConnect(GmRequest, d->req, updated, d, updated_MediaRequest_);
318 iConnect(GmRequest, d->req, finished, d, finished_MediaRequest_);
319 submit_GmRequest(d->req);
320}
321
322void deinit_MediaRequest(iMediaRequest *d) {
323 iDisconnect(GmRequest, d->req, updated, d, updated_MediaRequest_);
324 iDisconnect(GmRequest, d->req, finished, d, finished_MediaRequest_);
325 iRelease(d->req);
326}
327
328iDefineObjectConstructionArgs(MediaRequest,
329 (iDocumentWidget *doc, unsigned int linkId, const iString *url),
330 doc, linkId, url)
331iDefineClass(MediaRequest)