Skip to content

Instantly share code, notes, and snippets.

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);
@Maniulo
Maniulo / playback.cpp
Created November 9, 2013 06:31
SDL audio callback
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;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Image
{
public int[,] pixels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
struct Pixel
{
public int r;
@Maniulo
Maniulo / spriteGlitch.shader
Created April 10, 2016 18:26 — forked from KeyMaster-/spriteGlitch.shader
A glitch effect shader for Sprites in Unity3D
//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
@Maniulo
Maniulo / SpriteCombiner.cs
Created August 22, 2018 09:08 — forked from bcatcho/SpriteCombiner.cs
Combine Unity3d Sprites
// 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;