This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MIT License (MIT) - https://gist.github.com/bcatcho/1926794b7fd6491159e7 | |
// Copyright (c) 2015 Brandon Catcho | |
using UnityEngine; | |
using System.Collections.Generic; | |
using System.Linq; | |
#if UNITY_EDITOR | |
using System; | |
using UnityEditor; | |
using UnityEditor.Sprites; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_) | |
//Permission is hereby granted, free of charge, to any person obtaining a copy | |
//of this software and associated documentation files (the "Software"), to deal | |
//in the Software without restriction, including without limitation the rights | |
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
//copies of the Software, and to permit persons to whom the Software is | |
//furnished to do so, subject to the following conditions: | |
//The above copyright notice and this permission notice shall be included in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
struct Pixel | |
{ | |
public int r; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
{ | |
class Image | |
{ | |
public int[,] pixels; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Playback(Uint8 *stream, int streamSize) | |
{ | |
int dataSizeToCopy; | |
while (streamSize > 0) | |
{ | |
// Decide how much data the playback stream can hold | |
dataSizeToCopy = dataLeftInBuffer(); | |
if (dataSizeToCopy > streamSize) | |
dataSizeToCopy = streamSize; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void PreparePicture(AVFrame *frame, AVCodecContext *codecContext) | |
{ | |
SDL_LockMutex(PictureMutex); | |
while (PictureReady) | |
SDL_CondWait(PictureReadyCond, PictureMutex); | |
SDL_UnlockMutex(PictureMutex); | |
int pitch = codecContext->width * SDL_BYTESPERPIXEL(SDL_PIXELFORMAT_IYUV); | |
uint8_t * buffer = ToYUV420(frame, codecContext); | |
SDL_UpdateTexture(texture, NULL, buffer, pitch); |