09.02.2013 Views

Sviluppo di una piattaforma per lo streaming multimediale - MobiLab ...

Sviluppo di una piattaforma per lo streaming multimediale - MobiLab ...

Sviluppo di una piattaforma per lo streaming multimediale - MobiLab ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

<strong>Sviluppo</strong> <strong>di</strong> <strong>una</strong> <strong>piattaforma</strong> <strong>per</strong> <strong>lo</strong> <strong>streaming</strong> multime<strong>di</strong>ale in ambiente Android<br />

// For H.263, we only support some specific sizes.<br />

if (size.width < 128) {<br />

width = 128;<br />

height = 96;<br />

} else if (size.width < 176) {<br />

width = 176;<br />

height = 144;<br />

} else {<br />

width = 352;<br />

height = 288;<br />

}<br />

} else {<br />

// Formato sconosciuto<br />

return supported;<br />

}<br />

return (new VideoFormat(null, new Dimension(width, height),<br />

Format.NOT_SPECIFIED, null, Format.NOT_SPECIFIED))<br />

.intersects(supported);<br />

/**<br />

* Setting the enco<strong>di</strong>ng quality to the specified value on the JPEG<br />

* 0.5 is a good default.<br />

*/<br />

}<br />

void setJPEGQuality(Player p, f<strong>lo</strong>at val) {<br />

Control cs[] = p.getControls();<br />

QualityControl qc = null;<br />

VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);<br />

for (int i = 0; i < cs.length; i++) {<br />

if (cs[i] instanceof QualityControl && cs[i] instanceof Owned) {<br />

Object owner = ((Owned) cs[i]).getOwner();<br />

if (owner instanceof Codec) {<br />

Format fmts[] = ((Codec) owner)<br />

.getSupportedOutputFormats(null);<br />

for (int j = 0; j < fmts.length; j++) {<br />

if (fmts[j].matches(jpegFmt)) {<br />

qc = (QualityControl) cs[i];<br />

qc.setQuality(val);<br />

System.err.println("-Setta Qualità a "+val+" su " + qc);<br />

break;<br />

}<br />

}<br />

}<br />

if (qc != null) break;<br />

}<br />

}<br />

private Integer stateLock = new Integer(0);<br />

private boolean failed = false;<br />

89

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!