source: titan/libeplayer3/playback/playback.c @ 40364

Last change on this file since 40364 was 40364, checked in by obi, 7 years ago

add slowmotion fastforward/fastbackward

File size: 24.6 KB
Line 
1/*
2 * GPL
3 * duckbox 2010
4 */
5
6/* ***************************** */
7/* Includes                      */
8/* ***************************** */
9
10#include <stdlib.h>
11#include <string.h>
12#include <unistd.h>
13#include <sys/stat.h>
14#include <fcntl.h>
15#include <sys/socket.h>
16#include <netdb.h>
17#include <sys/types.h>
18#include <dirent.h>
19#include <errno.h>
20#include <poll.h>
21#include <stdint.h>
22
23#include "playback.h"
24#include "common.h"
25#include "misc.h"
26
27/* ***************************** */
28/* Makros/Constants              */
29/* ***************************** */
30// SULGE DEBUG
31//#define SAM_WITH_DEBUG
32
33#ifdef SAM_WITH_DEBUG
34#define PLAYBACK_DEBUG
35#else
36#define PLAYBACK_SILENT
37#endif
38
39static short debug_level = 20;
40
41#ifdef PLAYBACK_DEBUG
42#define playback_printf(level, fmt, x...) do { \
43if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
44#else
45#define playback_printf(level, fmt, x...)
46#endif
47
48#ifndef PLAYBACK_SILENT
49#define playback_err(fmt, x...) do { printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0)
50#else
51#define playback_err(fmt, x...)
52#endif
53
54#define cERR_PLAYBACK_NO_ERROR      0
55#define cERR_PLAYBACK_ERROR        -1
56
57#define cMaxSpeed_ff   128 /* fixme: revise */
58#define cMaxSpeed_fr   -320 /* fixme: revise */
59
60/* ***************************** */
61/* Varaibles                     */
62/* ***************************** */
63
64/* ***************************** */
65/* Prototypes                    */
66/* ***************************** */
67extern void set_pause_timeout(uint8_t pause);
68static int32_t PlaybackTerminate(Context_t  *context);
69
70/* ***************************** */
71/* MISC Functions                */
72/* ***************************** */
73int8_t PlaybackDieNow(int8_t val)
74{
75    static int8_t dieNow = 0;
76    if(val)
77    {
78        dieNow = 1;
79    }
80    return dieNow;
81}
82
83/* ***************************** */
84/* Functions                     */
85/* ***************************** */
86
87static int PlaybackStop(Context_t  *context);
88
89static int PlaybackOpen(Context_t  *context, PlayFiles_t *pFiles)
90{
91    if (context->playback->isPlaying)
92    {
93        PlaybackStop(context);
94    }
95   
96    char *uri = pFiles->szFirstFile;
97   
98    playback_printf(10, "URI=%s\n", uri);
99
100    if (context->playback->isPlaying)
101    { // shouldn't happen
102        playback_err("playback already running\n");
103        return cERR_PLAYBACK_ERROR;
104    }
105
106    char * extension = NULL;
107
108    context->playback->uri = strdup(uri);
109
110    context->playback->isFile = 0;
111    context->playback->isHttp = 0;
112
113    if (!strncmp("file://", uri, 7) || !strncmp("myts://", uri, 7))
114    {
115        context->playback->isFile = 1;
116        if (!strncmp("myts://", uri, 7))
117        {
118            memcpy(context->playback->uri, "file", 4);
119            context->playback->noprobe = 1;
120        }
121        else
122        {
123            context->playback->noprobe = 0;
124        }
125
126        extension = getExtension(context->playback->uri+7);
127        if(!extension)
128        {
129            playback_err("Wrong extension (%s)\n", context->playback->uri+7);
130            return cERR_PLAYBACK_ERROR;
131        }
132    }
133    else if (strstr(uri, "://"))
134    {
135        context->playback->isHttp = 1;
136        extension = "mp3";
137        if (!strncmp("mms://", uri, 6))
138        {
139            // mms is in reality called rtsp, and ffmpeg expects this
140            char * tUri = (char*)malloc(strlen(uri) + 2);
141            strncpy(tUri+1, uri, strlen(uri)+1);
142            strncpy(tUri, "rtsp", 4);
143            free(context->playback->uri);
144            context->playback->uri = tUri;
145        }
146    }
147    else
148    {
149        playback_err("Unknown stream (%s)\n", uri);
150        return cERR_PLAYBACK_ERROR;
151    }
152
153    pFiles->szFirstFile = context->playback->uri;
154    if ((context->container->Command(context, CONTAINER_ADD, extension) < 0)
155        ||  (!context->container->selectedContainer)
156        ||  (context->container->selectedContainer->Command(context, CONTAINER_INIT, pFiles) < 0))
157    {
158        playback_err("CONTAINER_ADD failed\n");
159        return cERR_PLAYBACK_ERROR;
160    }
161
162    playback_printf(10, "exiting with value 0\n");
163
164    return cERR_PLAYBACK_NO_ERROR;
165}
166
167static int PlaybackClose(Context_t  *context)
168{
169    int ret = cERR_PLAYBACK_NO_ERROR;
170
171    playback_printf(10, "\n");
172
173    if (context->container->Command(context, CONTAINER_DEL, NULL) < 0)
174    {
175        playback_err("container delete failed\n");
176    }
177
178    context->manager->audio->Command(context, MANAGER_DEL, NULL);
179    context->manager->video->Command(context, MANAGER_DEL, NULL);
180
181    context->playback->isPaused     = 0;
182    context->playback->isPlaying    = 0;
183    context->playback->isForwarding = 0;
184    context->playback->BackWard     = 0;
185    context->playback->SlowMotion   = 0;
186    context->playback->Speed        = 0;
187    if(context->playback->uri)
188    {
189        free(context->playback->uri);
190        context->playback->uri = NULL;
191    }
192
193    playback_printf(10, "exiting with value %d\n", ret);
194
195    return ret;
196}
197
198static int PlaybackPlay(Context_t  *context)
199{
200    pthread_attr_t attr;
201    int ret = cERR_PLAYBACK_NO_ERROR;
202
203    playback_printf(10, "\n");
204
205    if (!context->playback->isPlaying)
206    {
207        context->playback->AVSync = 1;
208        context->output->Command(context, OUTPUT_AVSYNC, NULL);
209
210        context->playback->isCreationPhase = 1; // allows the created thread to go into wait mode
211        ret = context->output->Command(context, OUTPUT_PLAY, NULL);
212
213        if (ret != 0)
214        {
215            playback_err("OUTPUT_PLAY failed!\n");
216            playback_err("clearing isCreationPhase!\n");
217            context->playback->isCreationPhase = 0;     // allow thread to go into next state
218            context->playback->isPlaying       = 0;
219            context->playback->isPaused        = 0;
220            context->playback->isForwarding    = 0;
221            context->playback->BackWard        = 0;
222            context->playback->SlowMotion      = 0;
223            context->playback->Speed           = 0;
224            context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
225        }
226        else
227        {
228            context->playback->isPlaying    = 1;
229            context->playback->isPaused     = 0;
230            context->playback->isForwarding = 0;
231            context->playback->BackWard     = 0;
232            context->playback->SlowMotion   = 0;
233            context->playback->Speed        = 1;
234
235            playback_printf(10, "clearing isCreationPhase!\n");
236
237            context->playback->isCreationPhase = 0;     // allow thread to go into next state
238
239            ret = context->container->selectedContainer->Command(context, CONTAINER_PLAY, NULL);
240            if (ret != 0) {
241                playback_err("CONTAINER_PLAY failed!\n");
242            }
243
244        }
245    }
246    else
247    {
248        playback_err("playback already running\n");
249        ret = cERR_PLAYBACK_ERROR;
250    }
251
252    playback_printf(10, "exiting with value %d\n", ret);
253
254    return ret;
255}
256
257static int PlaybackPause(Context_t  *context)
258{
259    int ret = cERR_PLAYBACK_NO_ERROR;
260
261    playback_printf(10, "\n");
262
263    if (context->playback->isPlaying && !context->playback->isPaused)
264    {
265        set_pause_timeout(1);
266//obi     
267        if(context->playback->SlowMotion)
268             context->output->Command(context, OUTPUT_CLEAR, NULL);        context->output->Command(context, OUTPUT_PAUSE, NULL);
269//obi (end)
270
271        context->output->Command(context, OUTPUT_PAUSE, NULL);
272
273        context->playback->isPaused     = 1;
274        //context->playback->isPlaying  = 1;
275        context->playback->isForwarding = 0;
276        context->playback->BackWard     = 0;
277        context->playback->SlowMotion   = 0;
278        context->playback->Speed        = 1;
279    }
280    else
281    {
282        playback_err("playback not playing or already in pause mode\n");
283        ret = cERR_PLAYBACK_ERROR;
284    }
285
286    playback_printf(10, "exiting with value %d\n", ret);
287    return ret;
288}
289
290static int32_t PlaybackContinue(Context_t  *context)
291{
292    int32_t ret = cERR_PLAYBACK_NO_ERROR;
293
294    playback_printf(10, "\n");
295
296    if (context->playback->isPlaying &&
297       (context->playback->isPaused || context->playback->isForwarding ||
298        context->playback->BackWard || context->playback->SlowMotion))
299    {
300
301        set_pause_timeout(0);
302
303//obi     
304        if(context->playback->SlowMotion)
305             context->output->Command(context, OUTPUT_CLEAR, NULL);        context->output->Command(context, OUTPUT_PAUSE, NULL);
306//obi (end)
307        context->output->Command(context, OUTPUT_CONTINUE, NULL);
308
309        context->playback->isPaused     = 0;
310        //context->playback->isPlaying  = 1;
311        context->playback->isForwarding = 0;
312        context->playback->BackWard     = 0;
313        context->playback->SlowMotion   = 0;
314        context->playback->Speed        = 1;
315    }
316    else
317    {
318        playback_err("continue not possible\n");
319        ret = cERR_PLAYBACK_ERROR;
320    }
321
322    playback_printf(10, "exiting with value %d\n", ret);
323    return ret;
324}
325
326static int32_t PlaybackStop(Context_t  *context)
327{
328    int32_t ret = cERR_PLAYBACK_NO_ERROR;
329
330    playback_printf(10, "\n");
331   
332    PlaybackDieNow(1);
333
334    if (context && context->playback && context->playback->isPlaying)
335    {
336
337        context->playback->isPaused     = 0;
338        context->playback->isPlaying    = 0;
339        context->playback->isForwarding = 0;
340        context->playback->BackWard     = 0;
341        context->playback->SlowMotion   = 0;
342        context->playback->Speed        = 0;
343
344        context->output->Command(context, OUTPUT_STOP, NULL);
345        context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
346
347    }
348    else
349    {
350        playback_err("stop not possible\n");
351        ret = cERR_PLAYBACK_ERROR;
352    }
353
354    playback_printf(10, "exiting with value %d\n", ret);
355    return ret;
356}
357
358static int32_t PlaybackTerminate(Context_t  *context)
359{
360    int32_t ret = cERR_PLAYBACK_NO_ERROR;
361
362    playback_printf(20, "\n");
363   
364    PlaybackDieNow(1);
365
366    if ( context && context->playback && context->playback->isPlaying )
367    {
368        //First Flush and than delete container, else e2 cant read length of file anymore
369
370        if (context->output->Command(context, OUTPUT_FLUSH, NULL) < 0)
371        {
372            playback_err("failed to flush output.\n");
373        }
374
375        ret = context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
376
377        context->playback->isPaused     = 0;
378        context->playback->isPlaying    = 0;
379        context->playback->isForwarding = 0;
380        context->playback->BackWard     = 0;
381        context->playback->SlowMotion   = 0;
382        context->playback->Speed        = 0;
383
384    }
385    else
386    {
387        playback_err("%p %p %d\n", context, context->playback, context->playback->isPlaying);
388
389        /* fixme: konfetti: we should return an error here but this seems to be a condition which
390         * can happen and is not a real error, which leads to a dead neutrino. should investigate
391         * here later.
392         */
393    }
394
395    playback_printf(20, "exiting with value %d\n", ret);
396    return ret;
397}
398
399//obi
400static int PlaybackFastForward(Context_t  *context, int* speed) {
401    int32_t ret = cERR_PLAYBACK_NO_ERROR;
402
403    playback_printf(10, "speed %d\n", *speed);
404
405    /* Audio only forwarding not supported */
406    if (context->playback->isVideo && !context->playback->isHttp && !context->playback->BackWard && (!context->playback->isPaused || context->playback->isPlaying)) {
407
408        if ((*speed <= 0) || (*speed > cMaxSpeed_ff))
409        {
410            playback_err("speed %d out of range (1 - %d) \n", *speed, cMaxSpeed_ff);
411            return cERR_PLAYBACK_ERROR;
412        }
413
414        context->playback->isForwarding = 1;
415        context->playback->Speed = *speed;
416
417        playback_printf(20, "Speed: %d x {%d}\n", *speed, context->playback->Speed);
418
419        context->output->Command(context, OUTPUT_FASTFORWARD, NULL);
420    } else
421    {
422        playback_err("fast forward not possible\n");
423        ret = cERR_PLAYBACK_ERROR;
424    }
425
426    playback_printf(10, "exiting with value %d\n", ret);
427
428    return ret;
429}
430
431static int PlaybackFastBackward(Context_t  *context,int* speed) {
432    int32_t ret = cERR_PLAYBACK_NO_ERROR;
433
434    playback_printf(10, "speed = %d\n", *speed);
435
436    /* Audio only reverse play not supported */
437    if (context->playback->isVideo && !context->playback->isForwarding && (!context->playback->isPaused || context->playback->isPlaying)) {
438
439        if ((*speed > 0) || (*speed < cMaxSpeed_fr))
440        {
441            playback_err("speed %d out of range (0 - %d) \n", *speed, cMaxSpeed_fr);
442            return cERR_PLAYBACK_ERROR;
443        }
444
445        if (*speed == 0)
446        {
447            context->playback->BackWard = 0;
448            context->playback->Speed = 0;    /* reverse end */
449        } else
450        {
451            context->playback->isSeeking = 1;
452            context->playback->Speed = *speed;
453            context->playback->BackWard = 2^(*speed);
454         
455            playback_printf(1, "S %d B %f\n", context->playback->Speed, context->playback->BackWard);
456        }
457
458        context->output->Command(context, OUTPUT_AUDIOMUTE, "1");
459        context->output->Command(context, OUTPUT_CLEAR, NULL);
460        if (context->output->Command(context, OUTPUT_REVERSE, NULL) < 0)
461        {
462            playback_err("OUTPUT_REVERSE failed\n");
463            context->playback->BackWard = 0;
464            context->playback->Speed = 1;
465            context->playback->isSeeking = 0;
466            ret = cERR_PLAYBACK_ERROR;
467        }
468    } else
469    {
470        playback_err("fast backward not possible\n");
471        ret = cERR_PLAYBACK_ERROR;
472    }
473
474    context->playback->isSeeking = 0;
475    playback_printf(10, "exiting with value %d\n", ret);
476
477    return ret;
478}
479
480static int32_t PlaybackSlowMotion(Context_t  *context,int* speed) {
481    int32_t ret = cERR_PLAYBACK_NO_ERROR;
482
483    playback_printf(10, "\n");
484
485    //Audio only forwarding not supported
486    if (context->playback->isVideo && !context->playback->isHttp && context->playback->isPlaying) {
487        if(context->playback->isPaused)
488            PlaybackContinue(context);
489
490        switch(*speed) {
491        case 2:
492            context->playback->SlowMotion = 2;
493            break;
494        case 4:
495            context->playback->SlowMotion = 4;
496            break;
497        case 8:
498            context->playback->SlowMotion = 8;
499            break;
500        }
501
502        playback_printf(20, "SlowMotion: %d x {%d}\n", *speed, context->playback->SlowMotion);
503
504        context->output->Command(context, OUTPUT_SLOWMOTION, NULL);
505    } else
506    {
507        playback_err("slowmotion not possible\n");
508        ret = cERR_PLAYBACK_ERROR;
509    }
510
511    playback_printf(10, "exiting with value %d\n", ret);
512
513    return ret;
514}
515//obi (end)
516
517static int32_t PlaybackSeek(Context_t  *context, int64_t *pos, uint8_t absolute)
518{
519    int32_t ret = cERR_PLAYBACK_NO_ERROR;
520
521    playback_printf(10, "pos: %lldd\n", *pos);
522
523    if (context->playback->isPlaying && !context->playback->isForwarding && !context->playback->BackWard && !context->playback->SlowMotion && !context->playback->isPaused)
524    {
525        context->playback->isSeeking = 1;
526        context->output->Command(context, OUTPUT_CLEAR, NULL);
527        if (absolute)
528        {
529            context->container->selectedContainer->Command(context, CONTAINER_SEEK_ABS, pos);
530        }
531        else
532        {
533            context->container->selectedContainer->Command(context, CONTAINER_SEEK, pos);
534        }
535        context->playback->isSeeking = 0;
536    }
537    else
538    {
539        playback_err("not possible\n");
540        ret = cERR_PLAYBACK_ERROR;
541    }
542
543    playback_printf(10, "exiting with value %d\n", ret);
544
545    return ret;
546}
547
548static int32_t PlaybackPts(Context_t  *context, int64_t *pts)
549{
550    int32_t ret = cERR_PLAYBACK_NO_ERROR;
551
552    playback_printf(20, "\n");
553
554    *pts = 0;
555
556    if (context->playback->isPlaying)
557    {
558        ret = context->output->Command(context, OUTPUT_PTS, pts);
559    }
560    else
561    {
562        playback_err("not possible\n");
563        ret = cERR_PLAYBACK_ERROR;
564    }
565
566    playback_printf(20, "exiting with value %d\n", ret);
567
568    return ret;
569}
570
571static int32_t PlaybackGetFrameCount(Context_t  *context, int64_t *frameCount)
572{
573    int ret = cERR_PLAYBACK_NO_ERROR;
574
575    playback_printf(20, "\n");
576
577    *frameCount = 0;
578
579    if (context->playback->isPlaying)
580    {
581        ret = context->output->Command(context, OUTPUT_GET_FRAME_COUNT, frameCount);
582    } else
583    {
584        playback_err("not possible\n");
585        ret = cERR_PLAYBACK_ERROR;
586    }
587
588    playback_printf(20, "exiting with value %d\n", ret);
589
590    return ret;
591}
592
593static int32_t PlaybackLength(Context_t  *context, int64_t *length)
594{
595    int32_t ret = cERR_PLAYBACK_NO_ERROR;
596
597    playback_printf(20, "\n");
598
599    *length = -1;
600
601    if (context->playback->isPlaying)
602    {
603        if (context->container && context->container->selectedContainer)
604        {
605            context->container->selectedContainer->Command(context, CONTAINER_LENGTH, length);
606        }
607    }
608    else
609    {
610        playback_err("not possible\n");
611        ret = cERR_PLAYBACK_ERROR;
612    }
613
614    playback_printf(20, "exiting with value %d\n", ret);
615    return ret;
616}
617
618static int32_t PlaybackSwitchAudio(Context_t  *context, int32_t *track)
619{
620    int32_t ret = cERR_PLAYBACK_NO_ERROR;
621    int32_t curtrackid = 0;
622    int32_t nextrackid = 0;
623
624    playback_printf(10, "\n");
625
626    if (context && context->playback && context->playback->isPlaying)
627    {
628        if (context->manager && context->manager->audio)
629        {
630            context->manager->audio->Command(context, MANAGER_GET, &curtrackid);
631            context->manager->audio->Command(context, MANAGER_SET, track);
632            context->manager->audio->Command(context, MANAGER_GET, &nextrackid);
633        }
634        else
635        {
636            playback_err("switch audio not possible\n");
637            ret = cERR_PLAYBACK_ERROR;
638        }
639
640        if(nextrackid != curtrackid)
641        {
642
643            //PlaybackPause(context);
644            if (context->output && context->output->audio)
645            {
646                context->output->audio->Command(context, OUTPUT_SWITCH, (void*)"audio");
647            }
648
649            if (context->container && context->container->selectedContainer)
650            {
651                context->container->selectedContainer->Command(context, CONTAINER_SWITCH_AUDIO, &nextrackid);
652            }
653            //PlaybackContinue(context);
654        }
655    }
656    else
657    {
658        playback_err("switch audio not possible\n");
659        ret = cERR_PLAYBACK_ERROR;
660    }
661
662    playback_printf(10, "exiting with value %d\n", ret);
663    return ret;
664}
665
666static int32_t PlaybackSwitchSubtitle(Context_t  *context, int32_t *track)
667{
668    int32_t ret = cERR_PLAYBACK_NO_ERROR;
669    int32_t curtrackid = -1;
670    int32_t nextrackid = -1;
671
672    playback_printf(10, "Track: %d\n", *track);
673
674    if (context && context->playback && context->playback->isPlaying )
675    {
676        if (context->manager && context->manager->subtitle)
677        {
678            context->manager->subtitle->Command(context, MANAGER_GET, &curtrackid);
679            context->manager->subtitle->Command(context, MANAGER_SET, track);
680            context->manager->subtitle->Command(context, MANAGER_GET, &nextrackid);
681         
682            if (curtrackid != nextrackid && nextrackid > -1)
683            {
684                if (context->output && context->output->subtitle)
685                {
686                    context->output->subtitle->Command(context, OUTPUT_SWITCH, (void*)"subtitle");
687                }
688
689                if (context->container && context->container->selectedContainer)
690                {
691                    context->container->selectedContainer->Command(context, CONTAINER_SWITCH_SUBTITLE, &nextrackid);
692                }
693            }
694        }
695        else
696        {
697            ret = cERR_PLAYBACK_ERROR;
698            playback_err("no subtitle\n");
699        }
700    }
701    else
702    {
703        playback_err("not possible\n");
704        ret = cERR_PLAYBACK_ERROR;
705    }
706
707    playback_printf(10, "exiting with value %d\n", ret);
708
709    return ret;
710}
711
712static int32_t PlaybackInfo(Context_t  *context, char **infoString)
713{
714    int32_t ret = cERR_PLAYBACK_NO_ERROR;
715
716    playback_printf(10, "\n");
717
718    /* konfetti comment:
719     * removed if clause here (playback running) because its
720     * not necessary for all container. e.g. in case of ffmpeg
721     * container playback must not play to get the info.
722     */
723    if (context->container && context->container->selectedContainer)
724    {
725        context->container->selectedContainer->Command(context, CONTAINER_INFO, infoString);
726    }
727
728    playback_printf(10, "exiting with value %d\n", ret);
729
730    return ret;
731}
732
733static int32_t Command(void* _context, PlaybackCmd_t command, void *argument)
734{
735    Context_t* context = (Context_t*) _context; /* to satisfy compiler */
736    int32_t ret = cERR_PLAYBACK_NO_ERROR;
737
738    playback_printf(20, "Command %d\n", command);
739
740
741    switch(command)
742    {
743        case PLAYBACK_OPEN:
744        {
745            ret = PlaybackOpen(context, (PlayFiles_t*)argument);
746            break;
747        }
748        case PLAYBACK_CLOSE:
749        {
750            ret = PlaybackClose(context);
751            break;
752        }
753        case PLAYBACK_PLAY:
754        {
755            ret = PlaybackPlay(context);
756            break;
757        }
758        case PLAYBACK_STOP:
759        {
760            ret = PlaybackStop(context);
761            break;
762        }
763        case PLAYBACK_PAUSE:
764        {
765            ret = PlaybackPause(context);
766            break;
767        }
768        case PLAYBACK_CONTINUE:
769        {
770            ret = PlaybackContinue(context);
771            break;
772        }
773        case PLAYBACK_TERM:
774        {
775            ret = PlaybackTerminate(context);
776            break;
777        }
778        case PLAYBACK_SEEK:
779        {
780            ret = PlaybackSeek(context, (int64_t*)argument, 0);
781            break;
782        }
783        case PLAYBACK_SEEK_ABS:
784        {
785            ret = PlaybackSeek(context, (int64_t*)argument, -1);
786            break;
787        }
788        case PLAYBACK_PTS:
789        {
790            ret = PlaybackPts(context, (int64_t*)argument);
791            break;
792        }
793        case PLAYBACK_LENGTH:
794        {
795            ret = PlaybackLength(context, (int64_t*)argument);
796            break;
797        }
798        case PLAYBACK_SWITCH_AUDIO:
799        {
800            ret = PlaybackSwitchAudio(context, (int*)argument);
801            break;
802        }
803        case PLAYBACK_SWITCH_SUBTITLE:
804        {
805            ret = PlaybackSwitchSubtitle(context, (int*)argument);
806            break;
807        }
808        case PLAYBACK_INFO:
809        {
810            ret = PlaybackInfo(context, (char**)argument);
811            break;
812        }
813//obi
814        case PLAYBACK_SLOWMOTION:
815        {
816            ret = PlaybackSlowMotion(context,(int*)argument);
817            break;
818        }
819        case PLAYBACK_FASTBACKWARD:
820        {
821            ret = PlaybackFastBackward(context,(int*)argument);
822            break;
823        }
824        case PLAYBACK_FASTFORWARD:
825        {
826            ret = PlaybackFastForward(context,(int*)argument);
827            break;
828        }
829//obi (end)
830        case PLAYBACK_GET_FRAME_COUNT:
831        {
832            ret = PlaybackGetFrameCount(context, (uint64_t*)argument);
833            break;
834        }
835        default:
836            playback_err("PlaybackCmd %d not supported!\n", command);
837            ret = cERR_PLAYBACK_ERROR;
838            break;
839    }
840
841    playback_printf(20, "exiting with value %d\n", ret);
842
843    return ret;
844}
845
846/*
847 * This is very unreadable and must be changed
848 */
849PlaybackHandler_t PlaybackHandler = {
850    "Playback", //name
851    -1,         //fd
852    0,          //isFile
853    0,          //isHttp
854    0,          //isPlaying
855    0,          //isPaused
856    0,          //isForwarding
857    0,          //isSeeking
858    0,          //isCreationPhase
859    0,          //BackWard
860    0,          //SlowMotion
861    0,          //Speed
862    0,          //AVSync
863    0,          //isVideo
864    0,          //isAudio
865    0,          //isSubtitle
866    0,          //abortRequested
867    &Command,   //Command
868    "",         //uri
869    0,          //size
870    0,          //noprobe
871    0,          //isLoopMode
872    0,          //isTSLiveMode
873};
Note: See TracBrowser for help on using the repository browser.