Youtube DS - Play Youtube videos on your DS!

Hey guys, lately I've been working on playing Youtube videos on a DS. As you can see in the video below, I got it working. I think I'll try to improve it some more if I have some time and add a gui to make it actually possible to search for videos.



You can download a preview here, if you want to try it out: https://github.com/Gericom/YoutubeDS/raw/master/YoutubeDS.nds
It might take a few tries, because the video info parser does not work very good yet.

Source: https://github.com/Gericom/YoutubeDS
 

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
dtcm / itcm can cause section conflicts if you for example call some function located in itcm, then you use a literal pool located in the same place. Compiler warns about this if you try to explicitely try to do it through the preprocessor. If you skip that by using some tricks, you will get that behaviour

so the best results ive got so far is to use all not executable, but read / writeable code in dtcm, and just functions in itcm, and trying to not to use the itcm for anything but functions

also have you tried drain buffer operation prior DMA copy? NDS's CP15 opcode is:

Code:
asm("mcr p15,0,r12,C7,C10,4");

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0198e/I1014942.html

this allows the ARM9 to sync the memory across master/slaves in AHB (like DMA controller)
I don't think I have any problems with ITCM/DTCM other than that
Code:
.section .dtcm
does not work correctly in .s files. In cpp files with DTCM_DATA it works correctly (hence the dtcm_tables.cpp file).

What's the advantage of using that buffer drain? Faster DMA?
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
well ARM9 is a "master" that is connected to the matrix I told you about earlier, DMA is master, same as EWRAM, since DMA is external circuitry, ARM9 needs to acknowledge when memory has changed, so that opcode allows to "sync memory" all over the matrix, and when DMA has finished copies, ARM9 acknowledges the current memory state. (prefetch buffer in ARM9 for example can make the CPU crash if data in memory was previosuly changed through external controller so it would fetch outdated opcodes)
 

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
well ARM9 is a "master" that is connected to the matrix I told you about earlier, DMA is master, same as EWRAM, since DMA is external circuitry, ARM9 needs to acknowledge when memory has changed, so that opcode allows to "sync memory" all over the matrix, and when DMA has finished copies, ARM9 acknowledges the current memory state. (prefetch buffer in ARM9 for example can make the CPU crash if data in memory was previosuly changed through external controller so it would fetch outdated opcodes)
Well, opcodes never change in my code, since I do not use self-modifying code and I am flushing the data cache by using DC_FlushRange after yuv to rgb conversion, so that should be enough I think.
 

DanTheManMS

aka Ricochet Otter
Member
Joined
Jun 2, 2007
Messages
4,453
Trophies
1
Age
34
Location
Georgia
XP
751
Country
United States
... holy ****

I am absolutely amazed that you managed to get this working, using the DS's 2D hardware in pure assembly for performance. Even at 144p this is much more than I thought the DS was capable of. I have videos on my microSD card of course, but those were pre-converted into a Moonshell-friendly format. For a DS-wifi homebrew library that didn't progress beyond roughly 5 KB/s outside of DSLinux, this Youtube client is a technological marvel.

EDIT: Some videos tend to crash my DS Phat and power it off directly. This happens when I try to search for the top result for "OK Go"
 
Last edited by DanTheManMS,

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
... holy ****

I am absolutely amazed that you managed to get this working, using the DS's 2D hardware in pure assembly for performance. Even at 144p this is much more than I thought the DS was capable of. I have videos on my microSD card of course, but those were pre-converted into a Moonshell-friendly format. For a DS-wifi homebrew library that didn't progress beyond roughly 5 KB/s outside of DSLinux, this Youtube client is a technological marvel.

EDIT: Some videos tend to crash my DS Phat and power it off directly. This happens when I try to search for the top result for "OK Go"
This is probably going to be one of my favorite project for a long time to come. Keep up the great work, OP.
Thanks both!

Yes, some videos crash for some reason. I don't know why, but since it shuts down, I guess it's something memory related (maybe because it fully loads the video header in memory?). I am not sure though.
 
  • Like
Reactions: I pwned U!

Clector

Well-Known Member
Member
Joined
Mar 15, 2016
Messages
1,078
Trophies
0
Location
Not here
XP
459
Country
Bangladesh
The majority of videos worked, but I noticed something the videos since 19th April of 2016 that I tried started but part of the video was showed in green, and after a little that videos being in an infinite loop of some second and you get a guru meditation error; well I tought this is related to that YouTube aparently changed something in their videos format since that date and to note the 3DS app is also having issues with videos from that date, so maybe that change is also related here; I tried older videos of 2015 and two from 30 minutes one after the other and worked prefectly, great work!
Also sometimes I wrote a little extendend word using in some part "-" returns me to my Flashcart menu curiosly.
 

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
The majority of videos worked, but I noticed something the videos since 19th April of 2016 that I tried started but part of the video was showed in green, and after a little that videos being in an infinite loop of some second and you get a guru meditation error; well I tought this is related to that YouTube aparently changed something in their videos format since that date and to note the 3DS app is also having issues with videos from that date, so maybe that change is also related here; I tried older videos of 2015 and two from 30 minutes one after the other and worked prefectly, great work!
Also sometimes I wrote a little extendend word using in some part "-" returns me to my Flashcart menu curiosly.
Youtube started to use slices it seems. I partly implemented support (I tried adding complete support, but that didn't work well yet), by stopping when a slice boundary appears (hence the green part of the video). I wasn't aware that there were more problems, like infinite loops though.
That dash may be something related to url escaping or something like that.
 
  • Like
Reactions: I pwned U!

habababa

Well-Known Member
Newcomer
Joined
Nov 24, 2010
Messages
63
Trophies
0
XP
270
Country
I don't think I have any problems with ITCM/DTCM other than that
Code:
.section .dtcm
does not work correctly in .s files. In cpp files with DTCM_DATA it works correctly (hence the dtcm_tables.cpp file).

What's the advantage of using that buffer drain? Faster DMA?

afair, you use the .section directive only once.
so if you're doing this -
Code:
.section .itcm
...
.section .dtcm
the 2nd .section is ignored?

while this should work
Code:
.section .itcm
...
.pushsection .dtcm
@ dtcm code here
.popsection
 

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
afair, you use the .section directive only once.
so if you're doing this -
Code:
.section .itcm
...
.section .dtcm
the 2nd .section is ignored?

while this should work
Code:
.section .itcm
...
.pushsection .dtcm
@ dtcm code here
.popsection
Oh? Really? I didn't know that. I might try that later, but it works in a cpp file just fine aswell.
Oh, and the dtcm can not contain code by the way. Data only.
 
K

KingpinSlim

Guest
I am usually fairly cynical when it comes to posting on gbatemp, but i have to say that this is really impressive and i acknowledge that it propably required a lot of work and effort.

People limited to the use of a DS as their primary device for media consumption will surely appreciate this.
 

DanTheManMS

aka Ricochet Otter
Member
Joined
Jun 2, 2007
Messages
4,453
Trophies
1
Age
34
Location
Georgia
XP
751
Country
United States
I normally dislike bumping threads, but I gotta ask, are there any plans for further development of this project? I haven't been this enthusiastic about a DS homebrew project since the SNEmulDS days, and it's a shame to see it fall by the wayside. I mean it's a great proof of concept and all, but I can't seem to get through any full video without it skipping or looping or crashing. Please don't view this as a complaint! I'm still amazed it's even possible in the first place.
 

Gericom

Well-Known Member
OP
Member
Joined
Jun 30, 2011
Messages
1,382
Trophies
2
Age
25
XP
4,690
Country
Netherlands
I normally dislike bumping threads, but I gotta ask, are there any plans for further development of this project? I haven't been this enthusiastic about a DS homebrew project since the SNEmulDS days, and it's a shame to see it fall by the wayside. I mean it's a great proof of concept and all, but I can't seem to get through any full video without it skipping or looping or crashing. Please don't view this as a complaint! I'm still amazed it's even possible in the first place.
Thanks! I think I will be trying to improve this project soon. The video's that played for me played fine though, so it could be your router/modem/internet aswell.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: I'm back