Author Topic: TI-Nspire Video Player Help  (Read 5211 times)

0 Members and 1 Guest are viewing this topic.

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
TI-Nspire Video Player Help
« on: January 31, 2011, 04:30:16 pm »
I am in the process of coding a video player for the Nspire using almost the same method as described by thepenguin77 in his 84+ video player.  Unfortunately, I am having difficulty getting the .tns file to run.  I find that when I display one and only one frame of the video, everything works fine, but the instant I try to show more than one frame, whether it be 200 frames of 2 frames, the Nspire crashes.

For example, the code:

Code: [Select]
#include <os.h>

int main (void) {

char * buffer=malloc(SCREEN_BYTES_SIZE);
memcpy(buffer,0xFF,SCREEN_BYTES_SIZE);
char image1[SCREEN_BYTES_SIZE]={image data, too long to post here};
memcpy(buffer,image1,SCREEN_BYTES_SIZE);
memcpy(SCREEN_BASE_ADDRESS,buffer,SCREEN_BYTES_SIZE);
free(buffer);
return 0;

}

But, when I add a second image, like so:


Code: [Select]
#include <os.h>

int main (void) {

char * buffer=malloc(SCREEN_BYTES_SIZE);
memcpy(buffer,0xFF,SCREEN_BYTES_SIZE);
char image1[SCREEN_BYTES_SIZE]={image data, too long to post here};
memcpy(buffer,image1,SCREEN_BYTES_SIZE);
memcpy(SCREEN_BASE_ADDRESS,buffer,SCREEN_BYTES_SIZE);
char image2[SCREEN_BYTES_SIZE]={image data, too long to post here};
memcpy(buffer,image2,SCREEN_BYTES_SIZE);
memcpy(SCREEN_BASE_ADDRESS,buffer,SCREEN_BYTES_SIZE);
free(buffer);
return 0;

}

The Nspire crashes when I run the program.  Does anyone know what could be causing this?  Obviously, this program is still in very early stages, and the conversion process is difficult at this point, but, I can't make any more progress until I can at least see something play.  Is there something preventing me from calling memcpy( so many times?  The data files for each frame are HUGE, could having more than one be causing me to crash?   Any help would be much appreciated, I would love to finish this program, as I think it would add new dimensions to Nspire programming.

Also, for the curious, here is a screenshot of it successfully running one single frame:


(note, the dithering is done by my screenshot program, not the actual calculator)


Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: TI-Nspire Video Player Help
« Reply #1 on: January 31, 2011, 06:08:59 pm »
It could be because it's allocating these char buffers on the stack. Try making them global variables instead.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: TI-Nspire Video Player Help
« Reply #2 on: January 31, 2011, 06:24:56 pm »
YAY! :D

That works beautifully, calc84, thank you!  Now I can actually rickroll everyone in school tomorrow!!!! :)


Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: TI-Nspire Video Player Help
« Reply #3 on: January 31, 2011, 06:27:10 pm »
Oh, I was expecting critor. He usually does some of the interesting NSpire hacks.  It looks nice apcalc!

Offline critor

  • Editor
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2079
  • Rating: +439/-13
    • View Profile
    • TI-Planet
Re: TI-Nspire Video Player Help
« Reply #4 on: January 31, 2011, 06:40:46 pm »
Sorry, I was quite busy today.

I'm glad the problem is solved :)
TI-Planet co-admin.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: TI-Nspire Video Player Help
« Reply #5 on: February 01, 2011, 08:51:02 pm »
Nice, apcalc :D
And I see that it has already been put to rickroll use elsewhere... :P
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: TI-Nspire Video Player Help
« Reply #6 on: February 01, 2011, 09:50:33 pm »
wow so how does it convert the frames (like there are different video resolutions)
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)