Changeset 40364 for titan/libeplayer3/playback/playback.c
- Timestamp:
- 04/24/17 23:40:31 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/libeplayer3/playback/playback.c
r40322 r40364 264 264 { 265 265 set_pause_timeout(1); 266 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 267 271 context->output->Command(context, OUTPUT_PAUSE, NULL); 268 272 … … 297 301 set_pause_timeout(0); 298 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) 299 307 context->output->Command(context, OUTPUT_CONTINUE, NULL); 300 308 … … 388 396 return ret; 389 397 } 398 399 //obi 400 static 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 431 static 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 480 static 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) 390 516 391 517 static int32_t PlaybackSeek(Context_t *context, int64_t *pos, uint8_t absolute) … … 685 811 break; 686 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) 687 830 case PLAYBACK_GET_FRAME_COUNT: 688 831 {
Note: See TracChangeset
for help on using the changeset viewer.