Skip to content

Instantly share code, notes, and snippets.

View leonelhs's full-sized avatar

Leonel Hernandez leonelhs

  • Particular
  • Guadalajara Mexico
View GitHub Profile
@leonelhs
leonelhs / simplest_player.c
Created January 26, 2022 16:56 — forked from mashingan/simplest_player.c
Simplest example of creating player using FFMpeg and SDL2. Currently with choppy audio playing.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <windows.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
//#include <libavutil/frame.h>
#include <SDL2/SDL.h>
@leonelhs
leonelhs / FFMpeg_player.cpp
Created January 27, 2022 20:21 — forked from CaptainJH/FFMpeg_player.cpp
a basic FFmpeg player based on SFML
//
// a basic FFMpeg video player
// FFMpeg 2.2.2
// SFML 2.1
// XCode 5.1.1
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
// a) As Mac OS X does not have byteswap.h
// needed this for a c util I had used over the years on linux.
// did not find a solution to stopgap via macports, sadly, but this did the trick
#if HAVE_BYTESWAP_H
#include <byteswap.h>
#else
#define bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
@leonelhs
leonelhs / Widget_QGraphicsView.py
Last active February 16, 2023 07:02
Pyside6 implementation for rezize event on QGraphicsView
#####################################################################
#
# Forked from :
# https://rk.edu.pl/en/qgraphicsview-and-qgraphicsscene/
# https://github.com/yjg30737/pyqt-single-image-graphics-view
#
######################################################################
import sys
@leonelhs
leonelhs / connect2graphs.py
Created April 8, 2023 19:12
Connect two QGraphicsItem by drawing line between them (using mouse)
########################################
#
# source from:
# https://stackoverflow.com/questions/65831884/how-to-connect-two-qgraphicsitem-by-drawing-line-between-them-using-mouse
#
#
########################################
import sys
from PySide6.QtCore import QRectF, Qt, QPointF, QLineF
from PySide6.QtGui import QPen, QColor, QBrush, QTransform
@leonelhs
leonelhs / canvas.py
Last active October 13, 2025 17:19
to draws rectangle and displaying meanwile mouse is draging to final position
########################################
#
# source from:
# https://stackoverflow.com/questions/63568214/qpainter-delete-previously-drawn-shapes
#
#
########################################
import sys
from PySide6.QtCore import Qt, QRect
@leonelhs
leonelhs / rgb2hex.py
Created June 24, 2023 17:29
converts rgb integers to hex
def rgb2hex(rgb):
return '#%02X%02X%02X' % rgb
print(rgb2hex((20, 110, 56)))