2.II SACIC - 2010 - Desenvolvimento de Aplicações para TVDigital com NCLUA
Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.
Transcript of Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.
![Page 1: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/1.jpg)
Caio NevesLeila Soriano
![Page 2: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/2.jpg)
Agenda
O que é Ginga?SBTVD NewsNCLAPI NCLuaExemplos
![Page 3: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/3.jpg)
O que é Ginga?
Middleware Aberto do Sistema Brasileiro de TV Digital (SBTVD)
Dois MódulosGinga-J (Java)Ginga-NCL (Lua - suporte)
Grande Inovação (Ponte Java-NCL NCL-Java)
![Page 4: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/4.jpg)
SBTVD News
Ginga-JPrimeiro draft final de setembroRoyalties freeImplementação aqui! (cesar)
Seminário de Televisão Digital: Modelo, Cenários, Linguagem
Ginga 1.0
![Page 5: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/5.jpg)
NCL - O que tocar?
![Page 6: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/6.jpg)
NCL – O que tocar?
Suporta todos os tipos definidos na norma.
A definição do que tocar define-se no body.
![Page 7: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/7.jpg)
NCL - Onde tocar?
![Page 8: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/8.jpg)
NCL – Onde tocar?
As dimensões podem ser definidas por unidades de pixel ou por porcentagem.
![Page 9: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/9.jpg)
NCL - Como tocar?
![Page 10: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/10.jpg)
NCL – Como tocar?
Definido no head.Parâmetros:
transparencyfreeze...
![Page 11: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/11.jpg)
NCL – Quando tocar?
![Page 12: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/12.jpg)
NCL – Quando tocar?
Descreve-se o comportamento do elo no head.
Pode-se ter ações compostas.
![Page 13: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/13.jpg)
NCL – Quando tocar?
Com o port pode-se tornar uma mídia auto initialize.
<port id="portVideo" component="video"/>
Definido no body.
![Page 14: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/14.jpg)
NCL – Quando tocar?
Conectar a mídia ao comportamento do elo.
![Page 15: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/15.jpg)
NCL - Estrutura
Todo documento NCL é escrito em XML
Cabeçalho do documento NCLUma seção de Cabeçalho do
programa (head)Corpo do programa (body)Pelo menos uma portaConclusão do documento
![Page 16: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/16.jpg)
NCL - Estrutura
![Page 17: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/17.jpg)
API – NCLua (Events)
event.register (f: function)
event.timer (time: number, f: function)
event.post (dst: string; evt: event)
event.uptime ()
event.post(evt)
![Page 18: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/18.jpg)
Classes de Eventos
Eventos Key:evt = { class='key', type: string, key: string}type pode ser 'press' ou 'release'.key é o valor da tecla em questão.evt = { class='key', type='press', key=’0’ }
Tipo ‘presentation’:evt = { class='ncl', type='presentation', area='?',
action='start'/'stop'/'abort'/'pause'/'resume' }
![Page 19: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/19.jpg)
Classes de Eventos
Tipo ‘selection’:evt = { class='ncl', type='selection',
area='?', transition='stops' }
Tipo ‘attribution’:evt = { class='ncl', type='attribution',
area='?', transition='stops' }
Classes TCP:evt = { class=’tcp’, from=’addr:port’,
value=string }
![Page 20: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/20.jpg)
Settings
Dados do próprio set-top-box
lang = settings.system.languageage = settings.user.agelocation = settings.user.location
![Page 21: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/21.jpg)
Persistent
Variáveis persistentes entre execuções
Divididas entre tres grupos:“service”“channel” “shared”
persistent.service.total = 10color = persistent.shared.color
![Page 22: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/22.jpg)
API – NCLua (Canvas)
canvas:new()Construtor vazio, imagem, (width, height)
canvas:attrSize()retorno x, y = canvas:attrSize()
canvas:attrColor()'white', 'aqua', 'lime', 'yellow', 'red',
'fuchsia', 'purple', 'maroon','blue', 'navy', 'teal', 'green', 'olive', 'silver', 'gray', 'black'
![Page 23: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/23.jpg)
API – NCLua (Canvas)
canvas:attrFont (face: string; size: number; style: string)
canvas:drawLine (x1, y1, x2, y2: number)
canvas:drawRect (mode: string; x, y, width, height: number)
canvas:drawPolygon (mode: string)canvas:drawPolygon('fill')(1,1)(10,1)(10,10)
(1,10)()
![Page 24: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/24.jpg)
API – NCLua (Canvas)
canvas:drawEllipse (mode: string; xc, yc, width, height, ang_start, ang_end: number)
canvas:drawText (text: string; x, y: number)
canvas:flush ()
![Page 25: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/25.jpg)
API – NCLua (Canvas)
canvas:measureText (x, y: number; text: string)
canvas:compose (x, y: number; src: canvas; [ src_x, src_y, src_width, src_height: number ])
![Page 26: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/26.jpg)
Exemplo 1
Aplicacao que conta o números de cliques e mostra na tela.
![Page 27: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/27.jpg)
Desafio
Faça o macaco comer a banana!Através de captura de eventos da
classe “key”Criação de canvas com imagensComposição de canvas
![Page 28: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/28.jpg)
Referências
http://www.abnt.org.br/imagens/Normalizacao_TV_Digital/ABNTNBR15606-5_2008Ed1.pdf
www.ncl.org.br/documentos/TutorialNCL3.0-2ed.pdf
![Page 29: Caio Neves Leila Soriano. Agenda O que é Ginga? SBTVD News NCL API NCLua Exemplos.](https://reader036.fdocument.pub/reader036/viewer/2022062418/552fc142497959413d8df5df/html5/thumbnails/29.jpg)
Dúvidas?
Obrigado pela atenção!