Small tweaks to get libav working as well as ffmpeg, for old debian versions. Some other tweaks too
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5098 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
484e8bbfc2
commit
f449b0eb88
6 changed files with 108 additions and 64 deletions
|
@ -33,21 +33,21 @@ ANDROID_ZIPALIGN=$ANDROIDROOT/build-tools/$ANDROIDBUILDTOOLS/zipalign #relative
|
|||
|
||||
THREADS="-j 4"
|
||||
|
||||
#windows is always cross compiled, so we don't have issues with non-native avplug
|
||||
#windows is always cross compiled, so we don't have issues with non-native ffmpeg
|
||||
PLUGINS_LINUXx86="ode qi ezhud xmpp irc"
|
||||
PLUGINS_LINUXx64="ode qi ezhud xmpp irc"
|
||||
PLUGINS_LINUXx32="qi ezhud xmpp irc"
|
||||
PLUGINS_LINUXarmhf="qi ezhud xmpp irc"
|
||||
if [ "$(uname -m)" != "x86_64" ]; then
|
||||
PLUGINS_LINUXx86="avplug ode qi ezhud xmpp irc"
|
||||
PLUGINS_LINUXx86="ffmpeg ode qi ezhud xmpp irc"
|
||||
fi
|
||||
if [ "$(uname -m)" == "x86_64" ]; then
|
||||
PLUGINS_LINUX64="avplug ode qi ezhud xmpp irc"
|
||||
PLUGINS_LINUX64="ffmpeg ode qi ezhud xmpp irc"
|
||||
fi
|
||||
#windows doesn't cross compile, so no system dependancy issues
|
||||
#skip some dependancies if we're running on cygwin, ode is buggy.
|
||||
if [ "$(uname -s)" == "Linux" ]; then
|
||||
PLUGINS_WINDOWS="avplug ode qi ezhud xmpp irc"
|
||||
PLUGINS_WINDOWS="ffmpeg ode qi ezhud xmpp irc"
|
||||
else
|
||||
PLUGINS_WINDOWS="qi ezhud xmpp irc"
|
||||
fi
|
||||
|
@ -234,7 +234,7 @@ if [ "$BUILD_LINUXx86" == "y" ]; then
|
|||
#for building linux targets
|
||||
debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev libvorbis-dev || otherpackages gcc || exit
|
||||
jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit
|
||||
if [[ "$PLUGINS_LINUXx86" =~ "avplug" ]]; then
|
||||
if [[ "$PLUGINS_LINUXx86" =~ "ffmpeg" ]]; then
|
||||
debianpackages libswscale-dev libavcodec-dev || otherpackages || exit
|
||||
fi
|
||||
fi
|
||||
|
@ -242,7 +242,7 @@ if [ "$BUILD_LINUXx64" == "y" ]; then
|
|||
#for building linux targets
|
||||
debianpackages gcc-multilib g++-multilib mesa-common-dev libasound2-dev || otherpackages gcc || exit
|
||||
jessiepackages libgnutls28-dev || debianpackages libgnutls28-dev || otherpackages gcc || exit
|
||||
if [[ "$PLUGINS_LINUXx64" =~ "avplug" ]]; then
|
||||
if [[ "$PLUGINS_LINUXx64" =~ "ffmpeg" ]]; then
|
||||
debianpackages libswscale-dev libavcodec-dev || otherpackages || exit
|
||||
fi
|
||||
fi
|
||||
|
@ -396,9 +396,9 @@ if [ $UID -ne 0 ] && [ $REBUILD_TOOLCHAINS == "y" ]; then
|
|||
fi
|
||||
if [ "$BUILD_WINDOWS" == "y" ]; then
|
||||
echo "Obtaining ffmpeg library (win32)..."
|
||||
make FTE_TARGET=win32 plugins-rel NATIVE_PLUGINS=avplug 2>&1 >>/dev/null
|
||||
make FTE_TARGET=win32 plugins-rel NATIVE_PLUGINS=ffmpeg 2>&1 >>/dev/null
|
||||
echo "Obtaining ffmpeg library (win64)..."
|
||||
make FTE_TARGET=win64 plugins-rel NATIVE_PLUGINS=avplug 2>&1 >>/dev/null
|
||||
make FTE_TARGET=win64 plugins-rel NATIVE_PLUGINS=ffmpeg 2>&1 >>/dev/null
|
||||
fi
|
||||
cd ~
|
||||
fi
|
||||
|
|
|
@ -19,6 +19,16 @@ SVNREVISION:=-DSVNREVISION=$(shell test -d $(BASE_DIR)/../.svn && svnversion $(B
|
|||
|
||||
WHOAMI:=$(shell whoami)
|
||||
|
||||
|
||||
#update these to download+build a different version. this assumes that the url+subdirs etc contain a consistant version everywhere.
|
||||
JPEGVER=9b
|
||||
ZLIBVER=1.2.11
|
||||
PNGVER=1.6.29
|
||||
OGGVER=1.3.2
|
||||
VORBISVER=1.3.5
|
||||
SDLVER=2.0.5
|
||||
SCINTILLAVER=373
|
||||
|
||||
#only limited forms of cross-making is supported
|
||||
#only the following 3 are supported
|
||||
#linux->win32 (FTE_TARGET=win32) RPM Package: "mingw32-gcc", DEB Package: "mingw32"
|
||||
|
@ -926,8 +936,8 @@ ifeq (win_SDL,$(findstring win,$(FTE_TARGET))$(findstring _SDL,$(FTE_TARGET)))
|
|||
EXEPOSTFIX=.exe
|
||||
|
||||
CC_MACHINE:=$(shell $(CC) -dumpmachine)
|
||||
ARCH_PREDEP=$(BASE_DIR)/libs/SDL2-2.0.1/$(CC_MACHINE)/bin/sdl2-config
|
||||
SDLCONFIG=$(ARCH_PREDEP) --prefix=$(BASE_DIR)/libs/SDL2-2.0.1/$(CC_MACHINE)
|
||||
ARCH_PREDEP=$(BASE_DIR)/libs/SDL2-$(SDLVER)/$(CC_MACHINE)/bin/sdl2-config
|
||||
SDLCONFIG=$(ARCH_PREDEP) --prefix=$(BASE_DIR)/libs/SDL2-$(SDLVER)/$(CC_MACHINE)
|
||||
ARCH_CFLAGS=`$(SDLCONFIG) --cflags`
|
||||
|
||||
#the defaults for sdl come first
|
||||
|
@ -1727,7 +1737,6 @@ qccgui-dbg:
|
|||
|
||||
#scintilla is messy as fuck when building statically. but at least we can strip out the lexers we don't use this way.
|
||||
#note that this is only used in the 'qccgui-scintilla' target.
|
||||
SCINTILLAVER=366
|
||||
SCINTILLA_FILES= AutoComplete.o CallTip.o CaseConvert.o CaseFolder.o CellBuffer.o CharacterCategory.o CharacterSet.o CharClassify.o ContractionState.o Decoration.o Document.o EditModel.o Editor.o EditView.o KeyMap.o Indicator.o LineMarker.o MarginView.o PerLine.o PlatWin.o PositionCache.o PropSetSimple.o RESearch.o RunStyles.o Selection.o Style.o UniConversion.o ViewStyle.o XPM.o ScintillaWin.o HanjaDic.o ScintillaBase.o Accessor.o Catalogue.o ExternalLexer.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o LexCPP.o
|
||||
SCINTILLA_ROOT=$(BASE_DIR)/scintilla$(SCINTILLAVER)/scintilla
|
||||
SCINTILLA_DIRS=$(SCINTILLA_ROOT)/lexers:$(SCINTILLA_ROOT)/lexlib:$(SCINTILLA_ROOT)/src:$(SCINTILLA_ROOT)/win32
|
||||
|
@ -1814,7 +1823,7 @@ clean:
|
|||
|
||||
distclean: clean
|
||||
-rm -f droid/ftekeystore
|
||||
-rm -f -r libs/SDL2-2.0.1
|
||||
-rm -f -r libs/SDL2-$(SDLVER)
|
||||
|
||||
|
||||
#################################################
|
||||
|
@ -1991,12 +2000,6 @@ $(BASE_DIR)/libs/SDL2-2.0.1/x86_64-w64-mingw32/bin/sdl2-config: $(BASE_DIR)/libs
|
|||
|
||||
|
||||
|
||||
#update these to download+build a different version. this assumes that the url+subdirs etc contain a consistant version everywhere.
|
||||
JPEGVER=9a
|
||||
ZLIBVER=1.2.11
|
||||
PNGVER=1.6.14
|
||||
OGGVER=1.3.2
|
||||
VORBISVER=1.3.4
|
||||
#makes sure the configure scripts get the right idea.
|
||||
AR?=$(ARCH)-ar
|
||||
|
||||
|
|
|
@ -623,8 +623,8 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server,
|
|||
// long _true = true;
|
||||
|
||||
/* Need to enable anonymous KX specifically. */
|
||||
const int kx_prio[] = {GNUTLS_KX_ANON_DH, 0};
|
||||
const int cert_type_priority[3] = {GNUTLS_CRT_X509, 0};
|
||||
// const int kx_prio[] = {GNUTLS_KX_ANON_DH, 0};
|
||||
// const int cert_type_priority[3] = {GNUTLS_CRT_X509, 0};
|
||||
|
||||
if (!source)
|
||||
return NULL;
|
||||
|
@ -680,7 +680,7 @@ vfsfile_t *FS_OpenSSL(const char *hostname, vfsfile_t *source, qboolean server,
|
|||
newf->funcs.WriteBytes = SSL_Write;
|
||||
newf->funcs.Seek = SSL_Seek;
|
||||
newf->funcs.Tell = SSL_Tell;
|
||||
newf->funcs.seekingisabadplan = SS_UNSEEKABLE;
|
||||
newf->funcs.seekstyle = SS_UNSEEKABLE;
|
||||
|
||||
Q_strncpyz(newf->certname, hostname, sizeof(newf->certname));
|
||||
|
||||
|
|
|
@ -129,14 +129,24 @@ AV_PRE32=$(AV_VER)-win32-dev/
|
|||
AV_W64=$(AV_VER)-win64-dev$(AV_ARCHIVEEXT)
|
||||
AV_URL64=http://ffmpeg.zeranoe.com/builds/win64/dev/$(AV_W64)
|
||||
AV_PRE64=$(AV_VER)-win64-dev/
|
||||
AV_BASE=$(OUT_DIR)/../fte_libav_$(AV_VER)/
|
||||
ifeq ($(findstring win,$(FTE_TARGET)),win)
|
||||
AV_BASE=$(OUT_DIR)/../fte_libav_$(AV_VER)/
|
||||
endif
|
||||
|
||||
ifneq ($(AV_BASE),)
|
||||
AV_DEP=$(AV_BASE)libavformat/avformat.h
|
||||
AV_CFLAGS=-I$(AV_BASE)
|
||||
AV_LDFLAGS=-L$(AV_BASE)lib$(BITS) -lavcodec -lavformat -lavutil -lswscale
|
||||
else
|
||||
AV_LDFLAGS=-lavcodec -lavformat -lavutil -lswscale
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(FTE_TARGET),win32)
|
||||
#NATIVE_PLUGINS+=avplug
|
||||
#NATIVE_PLUGINS+=ffmpeg
|
||||
endif
|
||||
ifeq ($(FTE_TARGET),win64)
|
||||
#NATIVE_PLUGINS+=avplug
|
||||
#NATIVE_PLUGINS+=ffmpeg
|
||||
endif
|
||||
|
||||
$(AV_BASE)libavformat/avformat.h:
|
||||
|
@ -153,13 +163,15 @@ $(AV_BASE)libavformat/avformat.h:
|
|||
rm $(AV_BASE)$(AV_W64)
|
||||
distclean:
|
||||
rm $(AV_BASE)libavformat/avformat.h
|
||||
$(OUT_DIR)/fteplug_ffmpeg$(PLUG_NATIVE_EXT): $(AV_BASE)libavformat/avformat.h
|
||||
$(OUT_DIR)/fteplug_ffmpeg$(PLUG_NATIVE_EXT): $(AV_DEP)
|
||||
|
||||
AVPLUG_OBJS= avplug/avaudio.c avplug/avencode.c avplug/avdecode.c plugin.c qvm_api.c
|
||||
$(OUT_DIR)/fteplug_ffmpeg$(PLUG_NATIVE_EXT): avplug/avencode.c avplug/avdecode.c avplug/avaudio.c plugin.c qvm_api.c
|
||||
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -s -o $@ -shared $(PLUG_CFLAGS) -L$(AV_BASE)lib$(BITS) -I$(AV_BASE) $^ $(PLUG_DEFFILE) $(PLUG_LDFLAGS) -lavcodec -lavformat -lavutil -lswscale
|
||||
$(CC) $(BASE_CFLAGS) $(CFLAGS) -DFTEPLUGIN -s -o $@ -shared $(PLUG_CFLAGS) $(AV_CFLAGS) $(AVPLUG_OBJS) $(PLUG_DEFFILE) $(PLUG_LDFLAGS) $(AV_LDFLAGS)
|
||||
|
||||
#small script for ode
|
||||
#FIXME: ode fails to compile under cygwin
|
||||
#FIXME: race condition if you try compiling debug+release at the same time, as this makefile is invoked twice by the engine's one
|
||||
ODE_ARCH=$(FTE_TARGET)
|
||||
ifeq ($(ODE_ARCH),)
|
||||
ODE_ARCH=unknown
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include "libswscale/swscale.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
#define TARGET_FFMPEG (LIBAVFORMAT_VERSION_MICRO >= 100)
|
||||
|
||||
//between av 52.31 and 54.35, lots of constants etc got renamed to gain an extra AV_ prefix.
|
||||
/*
|
||||
#define AV_PIX_FMT_BGRA PIX_FMT_BGRA
|
||||
|
@ -27,7 +29,7 @@
|
|||
BUILTIN(void, S_RawAudio, (int sourceid, void *data, int speed, int samples, int channels, int width, float volume));
|
||||
#undef ARGNAMES
|
||||
|
||||
/*should probably try threading this*/
|
||||
/*should probably try threading this, though I suppose it should be the engine doing that.*/
|
||||
/*timing is based upon the start time. this means overflow issues with rtsp etc*/
|
||||
|
||||
struct decctx
|
||||
|
@ -57,8 +59,8 @@ struct decctx
|
|||
static qboolean AVDec_SetSize (void *vctx, int width, int height)
|
||||
{
|
||||
struct decctx *ctx = (struct decctx*)vctx;
|
||||
uint8_t *rgb_data[1];
|
||||
int rgb_linesize[1];
|
||||
uint8_t *rgb_data[4]; //av_image_alloc requires at least 4 entries for certain pix formats (libav (but not ffmpeg) zero-fills, so this is important).
|
||||
int rgb_linesize[4];
|
||||
|
||||
//colourspace conversions will be fastest if we
|
||||
// if (width > ctx->pCodecCtx->width)
|
||||
|
@ -150,7 +152,7 @@ static void *AVDec_Create(const char *medianame)
|
|||
AVCodec *pCodec;
|
||||
qboolean useioctx = false;
|
||||
|
||||
/*only respond to av: media prefixes*/
|
||||
/*always respond to av: media prefixes*/
|
||||
if (!strncmp(medianame, "av:", 3))
|
||||
{
|
||||
medianame = medianame + 3;
|
||||
|
@ -161,8 +163,10 @@ static void *AVDec_Create(const char *medianame)
|
|||
medianame = medianame + 4;
|
||||
//let avformat do its own avio context stuff
|
||||
}
|
||||
else
|
||||
else if (strchr(medianame, ':')) //block other types of url.
|
||||
return NULL;
|
||||
else //if (!strcasecmp(extension, ".roq") || !strcasecmp(extension, ".roq"))
|
||||
return NULL; //roq+cin should be played back via the engine instead.
|
||||
|
||||
ctx = malloc(sizeof(*ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
|
@ -195,20 +199,20 @@ small how-to note for if I ever try to add support for voice-and-video rtp decod
|
|||
this stuff is presumably needed to handle ICE+stun+ports etc.
|
||||
I prolly need to hack around with adding rtcp too. :s
|
||||
|
||||
rtsp: Add support for depacketizing RTP data via custom IO
|
||||
|
||||
To use this, set sdpflags=custom_io to the sdp demuxer. During
|
||||
the avformat_open_input call, the SDP is read from the AVFormatContext
|
||||
AVIOContext (ctx->pb) - after the avformat_open_input call,
|
||||
during the av_read_frame() calls, the same ctx->pb is used for reading
|
||||
packets (and sending back RTCP RR packets).
|
||||
|
||||
Normally, one would use this with a read-only AVIOContext for the
|
||||
SDP during the avformat_open_input call, then close that one and
|
||||
replace it with a read-write one for the packets after the
|
||||
avformat_open_input call has returned.
|
||||
|
||||
This allows using the RTP depacketizers as "pure" demuxers, without
|
||||
rtsp: Add support for depacketizing RTP data via custom IO
|
||||
|
||||
To use this, set sdpflags=custom_io to the sdp demuxer. During
|
||||
the avformat_open_input call, the SDP is read from the AVFormatContext
|
||||
AVIOContext (ctx->pb) - after the avformat_open_input call,
|
||||
during the av_read_frame() calls, the same ctx->pb is used for reading
|
||||
packets (and sending back RTCP RR packets).
|
||||
|
||||
Normally, one would use this with a read-only AVIOContext for the
|
||||
SDP during the avformat_open_input call, then close that one and
|
||||
replace it with a read-write one for the packets after the
|
||||
avformat_open_input call has returned.
|
||||
|
||||
This allows using the RTP depacketizers as "pure" demuxers, without
|
||||
having them tied to the libavformat network IO.
|
||||
*/
|
||||
|
||||
|
@ -316,7 +320,17 @@ static qboolean VARGS AVDec_DisplayFrame(void *vctx, qboolean nosound, qboolean
|
|||
|
||||
repainted = true;
|
||||
}
|
||||
#if TARGET_FFMPEG
|
||||
ctx->lasttime = av_frame_get_best_effort_timestamp(ctx->pVFrame);
|
||||
#else
|
||||
if(frameFinished)
|
||||
{
|
||||
if (ctx->pVFrame->pkt_pts != AV_NOPTS_VALUE)
|
||||
ctx->lasttime = ctx->pVFrame->pkt_pts;
|
||||
else
|
||||
ctx->lasttime = ctx->pVFrame->pkt_dts;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if(packet.stream_index==ctx->audioStream && !nosound)
|
||||
{
|
||||
|
|
|
@ -7,9 +7,15 @@
|
|||
#include "libswscale/swscale.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/opt.h"
|
||||
//#include <libavutil/channel_layout.h>
|
||||
#include "libavutil/channel_layout.h"
|
||||
|
||||
#define TARGET_FFMPEG (LIBAVFORMAT_VERSION_MICRO >= 100)
|
||||
|
||||
#if TARGET_FFMPEG
|
||||
#define ENCODERNAME "ffmpeg"
|
||||
#else
|
||||
#define ENCODERNAME "libav"
|
||||
#endif
|
||||
|
||||
#define HAVE_DECOUPLED_API (LIBAVCODEC_VERSION_MAJOR>57 || (LIBAVCODEC_VERSION_MAJOR==57&&LIBAVCODEC_VERSION_MINOR>=36))
|
||||
|
||||
|
@ -50,6 +56,15 @@ struct encctx
|
|||
#define VARIABLE_AUDIO_FRAME_MIN_SIZE 512 //audio frames smaller than a certain size are just wasteful
|
||||
#define VARIABLE_AUDIO_FRAME_MAX_SIZE 1024
|
||||
|
||||
#if !TARGET_FFMPEG
|
||||
#define av_make_error_string qav_make_error_string
|
||||
static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum)
|
||||
{
|
||||
av_strerror(errnum, errbuf, errbuf_size);
|
||||
return errbuf;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void AVEnc_End (void *ctx);
|
||||
|
||||
static AVFrame *alloc_frame(enum AVPixelFormat pix_fmt, int width, int height)
|
||||
|
@ -61,14 +76,22 @@ static AVFrame *alloc_frame(enum AVPixelFormat pix_fmt, int width, int height)
|
|||
picture = av_frame_alloc();
|
||||
if(!picture)
|
||||
return NULL;
|
||||
#if TARGET_FFMPEG
|
||||
size = av_image_get_buffer_size(pix_fmt, width, height, 1);
|
||||
#else
|
||||
size = avpicture_get_size(pix_fmt, width, height);
|
||||
#endif
|
||||
picture_buf = (uint8_t*)(av_malloc(size));
|
||||
if (!picture_buf)
|
||||
{
|
||||
av_free(picture);
|
||||
return NULL;
|
||||
}
|
||||
#if TARGET_FFMPEG
|
||||
av_image_fill_arrays(picture->data, picture->linesize, picture_buf, pix_fmt, width, height, 1/*fixme: align*/);
|
||||
#else
|
||||
avpicture_fill((AVPicture*)picture, picture_buf, pix_fmt, width, height);
|
||||
#endif
|
||||
picture->width = width;
|
||||
picture->height = height;
|
||||
return picture;
|
||||
|
@ -174,8 +197,8 @@ static void AVEnc_DoEncode(AVFormatContext *fc, AVStream *stream, AVFrame *frame
|
|||
static void AVEnc_Video (void *vctx, int frameno, void *data, int bytestride, int width, int height, enum uploadfmt qpfmt)
|
||||
{
|
||||
struct encctx *ctx = vctx;
|
||||
const uint8_t *srcslices[2];
|
||||
int srcstride[2];
|
||||
const uint8_t *srcslices[4];
|
||||
int srcstride[4];
|
||||
int avpfmt;
|
||||
|
||||
if (!ctx->video_st)
|
||||
|
@ -185,8 +208,10 @@ static void AVEnc_Video (void *vctx, int frameno, void *data, int bytestride, in
|
|||
{
|
||||
case TF_BGRA32: avpfmt = AV_PIX_FMT_BGRA; break;
|
||||
case TF_RGBA32: avpfmt = AV_PIX_FMT_RGBA; break;
|
||||
#if TARGET_FFMPEG
|
||||
case TF_BGRX32: avpfmt = AV_PIX_FMT_BGR0; break;
|
||||
case TF_RGBX32: avpfmt = AV_PIX_FMT_RGB0; break;
|
||||
#endif
|
||||
case TF_BGR24: avpfmt = AV_PIX_FMT_BGR24; break;
|
||||
case TF_RGB24: avpfmt = AV_PIX_FMT_RGB24; break;
|
||||
default:
|
||||
|
@ -198,7 +223,12 @@ static void AVEnc_Video (void *vctx, int frameno, void *data, int bytestride, in
|
|||
srcstride[0] = bytestride;
|
||||
srcslices[1] = NULL;
|
||||
srcstride[1] = 0;
|
||||
srcslices[2] = NULL; //libav's version probably needs this excess
|
||||
srcstride[2] = 0;
|
||||
srcslices[3] = NULL;
|
||||
srcstride[3] = 0;
|
||||
|
||||
//fixme: it would be nice to avoid copies here if possible...
|
||||
//convert RGB to whatever the codec needs (ie: yuv...).
|
||||
//also rescales, but only if the user resizes the video while recording. which is a stupid thing to do.
|
||||
ctx->scale_ctx = sws_getCachedContext(ctx->scale_ctx, width, height, avpfmt, ctx->picture->width, ctx->picture->height, ctx->video_st->codec->pix_fmt, SWS_POINT, 0, 0, 0);
|
||||
|
@ -262,22 +292,6 @@ static AVStream *add_audio_stream(struct encctx *ctx, AVCodec *codec, int sample
|
|||
c->time_base.den = samplerate;
|
||||
c->sample_rate = samplerate;
|
||||
c->channels = channels;
|
||||
#if 0
|
||||
switch(channels)
|
||||
{
|
||||
case 1:
|
||||
c->channel_layout = AV_CH_LAYOUT_MONO;
|
||||
break;
|
||||
case 2:
|
||||
c->channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
c->channel_layout = av_get_default_channel_layout(c->channels);
|
||||
#endif
|
||||
|
||||
c->channel_layout = av_get_default_channel_layout(c->channels);
|
||||
c->sample_fmt = codec->sample_fmts[0];
|
||||
|
||||
|
@ -657,6 +671,7 @@ static void AVEnc_End (void *vctx)
|
|||
#endif
|
||||
|
||||
close_video(ctx);
|
||||
close_audio(ctx);
|
||||
|
||||
//don't write trailers if this is an error case and we never even wrote the headers.
|
||||
if (ctx->doneheaders)
|
||||
|
|
Loading…
Reference in a new issue