Partial rewrite: Go like func naming; Objs

This commit is contained in:
H.G. Giorgis
2015-09-03 15:22:50 -04:00
parent 0e97991e3f
commit f8e07f7a7b
20 changed files with 1680 additions and 1786 deletions
+15 -15
View File
@@ -3,7 +3,7 @@
// Tested on Gentoo, CVS version 5/01/07 compiled with GCC 4.1.1
// With updates from https://github.com/chelyaev/ffmpeg-tutorial
// Updates tested on:
// LAVC 54.59.100, LAVF 54.29.104, LSWS 2.1.101
// LAvC 54.59.100, LAvF 54.29.104, LSWS 2.1.101
// on GCC 4.7.2 in Debian February 2015
// A small sample program that shows how to use libavformat and libavcodec to
@@ -30,12 +30,12 @@
#include <stdio.h>
// compatibility with newer API
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#if LIBAvCODEC_VERSION_INT < Av_VERSION_INT(55,28,1)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame
#endif
void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
void SaveFrame(AvFrame *pFrame, int width, int height, int iFrame) {
FILE *pFile;
char szFilename[32];
int y;
@@ -59,14 +59,14 @@ void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
int main(int argc, char *argv[]) {
// Initalizing these to NULL prevents segfaults!
AVFormatContext *pFormatCtx = NULL;
AvFormatContext *pFormatCtx = NULL;
int i, videoStream;
AVCodecContext *pCodecCtxOrig = NULL;
AVCodecContext *pCodecCtx = NULL;
AVCodec *pCodec = NULL;
AVFrame *pFrame = NULL;
AVFrame *pFrameRGB = NULL;
AVPacket packet;
AvCodecContext *pCodecCtxOrig = NULL;
AvCodecContext *pCodecCtx = NULL;
AvCodec *pCodec = NULL;
AvFrame *pFrame = NULL;
AvFrame *pFrameRGB = NULL;
AvPacket packet;
int frameFinished;
int numBytes;
uint8_t *buffer = NULL;
@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) {
// Find the first video stream
videoStream=-1;
for(i=0; i<pFormatCtx->nb_streams; i++)
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) {
if(pFormatCtx->streams[i]->codec->codec_type==AvMEDIA_TYPE_VIDEO) {
videoStream=i;
break;
}
@@ -122,7 +122,7 @@ int main(int argc, char *argv[]) {
// Allocate video frame
pFrame=av_frame_alloc();
// Allocate an AVFrame structure
// Allocate an AvFrame structure
pFrameRGB=av_frame_alloc();
if(pFrameRGB==NULL)
return -1;
@@ -133,9 +133,9 @@ int main(int argc, char *argv[]) {
buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
// Assign appropriate parts of buffer to image planes in pFrameRGB
// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
// of AVPicture
avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
// Note that pFrameRGB is an AvFrame, but AvFrame is a superset
// of AvPicture
avpicture_fill((AvPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
pCodecCtx->width, pCodecCtx->height);
// initialize SWS context for software scaling