Move lib files
This commit is contained in:
1 parent
9e9302f8cd
commit
702fa77675
6 files changed
+41
-25
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ SET( PROJECT_NAME playuver )
|
||||
# Project directories
|
||||
SET( SRC_DIR source )
|
||||
SET( INC_DIR source )
|
||||
SET( LIB_DIR lib )
|
||||
SET( LIB_DIR ${SRC_DIR}/lib )
|
||||
SET( RSC_DIR resources )
|
||||
SET( UI_DIR ui )
|
||||
SET( EXTERNAL_SRC external_lib )
|
||||
|
||||
@@ -136,7 +136,7 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
|
||||
m_iPixelFormat = input_format;
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
avStatus = m_cLibAvContext.initAvFormat( filename, m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
||||
avStatus = m_cLibAvContext.initAvFormat( filename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
||||
#endif
|
||||
|
||||
if( m_uiWidth <= 0 || m_uiHeight <= 0 )
|
||||
|
||||
@@ -36,8 +36,12 @@
|
||||
#include <opencv2/opencv.hpp>
|
||||
#endif
|
||||
|
||||
#include "TypeDef.h"
|
||||
#ifdef USE_FFMPEG
|
||||
#include "LibAvContextHandle.h"
|
||||
#endif
|
||||
|
||||
#include "TypeDef.h"
|
||||
|
||||
#include "PlaYUVerFrame.h"
|
||||
|
||||
namespace plaYUVer
|
||||
|
||||
@@ -23,12 +23,7 @@
|
||||
|
||||
#include "LibAvContextHandle.h"
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "LibMemAlloc.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
|
||||
@@ -87,7 +82,7 @@ namespace plaYUVer
|
||||
m_bHasStream = false;
|
||||
}
|
||||
|
||||
Bool LibAvContextHandle::initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate )
|
||||
Bool LibAvContextHandle::initAvFormat( char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate )
|
||||
{
|
||||
Bool bRet = true;
|
||||
int ret = 0;
|
||||
@@ -103,7 +98,7 @@ namespace plaYUVer
|
||||
frame = NULL;
|
||||
m_bHasStream = false;
|
||||
|
||||
char *src_filename = filename.toLocal8Bit().data();
|
||||
char *src_filename = filename;
|
||||
AVDictionary *format_opts = NULL;
|
||||
|
||||
/* register all formats and codecs */
|
||||
@@ -130,14 +125,14 @@ namespace plaYUVer
|
||||
/* open input file, and allocate format context */
|
||||
if( avformat_open_input( &fmt_ctx, src_filename, NULL, &format_opts ) < 0 )
|
||||
{
|
||||
qDebug( ) << " Could not open source file %s !!!" << filename << endl;
|
||||
//qDebug( ) << " Could not open source file %s !!!" << filename << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* retrieve stream information */
|
||||
if( avformat_find_stream_info( fmt_ctx, NULL ) < 0 )
|
||||
{
|
||||
qDebug( ) << " Could not find stream information !!!" << endl;
|
||||
//qDebug( ) << " Could not find stream information !!!" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -150,7 +145,7 @@ namespace plaYUVer
|
||||
ret = av_image_alloc( video_dst_data, video_dst_linesize, video_dec_ctx->width, video_dec_ctx->height, video_dec_ctx->pix_fmt, 1 );
|
||||
if( ret < 0 )
|
||||
{
|
||||
qDebug( ) << " Could not allocate raw video buffer !!!" << endl;
|
||||
//qDebug( ) << " Could not allocate raw video buffer !!!" << endl;
|
||||
closeAvFormat();
|
||||
return false;
|
||||
}
|
||||
@@ -187,7 +182,7 @@ namespace plaYUVer
|
||||
av_dump_format( fmt_ctx, 0, src_filename, 0 );
|
||||
if( !video_stream )
|
||||
{
|
||||
qDebug( ) << " Could not find audio or video stream in the input, aborting !!!" << endl;
|
||||
//qDebug( ) << " Could not find audio or video stream in the input, aborting !!!" << endl;
|
||||
bRet = false;
|
||||
closeAvFormat();
|
||||
return false;
|
||||
@@ -196,7 +191,7 @@ namespace plaYUVer
|
||||
frame = avcodec_alloc_frame();
|
||||
if( !frame )
|
||||
{
|
||||
qDebug( ) << " Could not allocate frame !!!" << endl;
|
||||
//qDebug( ) << " Could not allocate frame !!!" << endl;
|
||||
ret = AVERROR( ENOMEM );
|
||||
closeAvFormat();
|
||||
return false;
|
||||
@@ -262,5 +257,3 @@ namespace plaYUVer
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif
|
||||
@@ -24,11 +24,7 @@
|
||||
#ifndef __LIBAVCONTEXTHANDLE_H__
|
||||
#define __LIBAVCONTEXTHANDLE_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_FFMPEG
|
||||
|
||||
#include <QtCore>
|
||||
//#include "config.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -46,7 +42,7 @@ namespace plaYUVer
|
||||
class LibAvContextHandle
|
||||
{
|
||||
public:
|
||||
Bool initAvFormat( QString filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate );
|
||||
Bool initAvFormat( char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate );
|
||||
Void closeAvFormat();
|
||||
Bool decodeAvFormat();
|
||||
|
||||
@@ -74,6 +70,4 @@ namespace plaYUVer
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __LIBAVCONTEXTHANDLE_H__
|
||||
@@ -0,0 +1,25 @@
|
||||
# Makefile template for shared library
|
||||
|
||||
CC = gcc # C compiler
|
||||
CFLAGS = -fPIC -Wall -Wextra -O2 -g -I../.. # C flags
|
||||
LDFLAGS = -shared # linking flags
|
||||
RM = rm -f # rm command
|
||||
TARGET_LIB = LibAvContextHandle.so # target lib
|
||||
|
||||
SRCS = LibAvContextHandle.cpp # source files
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
||||
.PHONY: all
|
||||
all: ${TARGET_LIB}
|
||||
|
||||
$(TARGET_LIB): $(OBJS)
|
||||
$(CC) ${LDFLAGS} -o $@ $^
|
||||
|
||||
$(SRCS:.c=.d):%.d:%.cpp
|
||||
$(CC) $(CFLAGS) -MM $< >$@
|
||||
|
||||
include $(SRCS:.c=.d)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
|
||||
Reference in new issue
Block a user