mirror of https://github.com/sipwise/jitsi.git
cusax-fix
parent
c8638d40b0
commit
ee9edb3641
@ -1,137 +1,140 @@
|
||||
1. lame-3.98.4
|
||||
|
||||
./configure --disable-shared --enable-static --enable-nasm \
|
||||
--disable-analyzer-hooks --disable-decoder \
|
||||
--disable-frontend --with-pic
|
||||
|
||||
FFmpeg looks for lame.h as lame/lame.h but the uninstalled lame-3.98.4 does not
|
||||
have the lame directory so go into lame-3.98.4/include and "ln -s . lame".
|
||||
|
||||
MS Windows notes
|
||||
- before make, open Makefile, libmp3lame/Makefile and libmp3lame/i386/Makefile
|
||||
and replace "NASM = C:\Program Files\nasm\nasm" by "NASM = nasm" (be sure nasm is in your PATH anyway);
|
||||
- For Windows x64, add --build=x86_64-w64-mingw32 to the configure line.
|
||||
|
||||
2. x264-snapshot-20101103-2245
|
||||
|
||||
- Windows
|
||||
|
||||
Download yasm for Windows (32-bit or 64-bit) at http://www.tortall.net/projects/yasm/wiki/Download
|
||||
and copy it to C:\MinGW\bin (or in a directory registered in the PATH environment variable).
|
||||
|
||||
./configure --disable-pthread
|
||||
make
|
||||
|
||||
- FreeBSD
|
||||
|
||||
Apply x264_bsd.diff patch first and compile:
|
||||
patch -p1 < /path/to/x264_bsd.diff
|
||||
./configure --enable-pic
|
||||
gmake
|
||||
|
||||
- Linux, Mac OS X
|
||||
|
||||
./configure --enable-pic
|
||||
make
|
||||
|
||||
3. ffmpeg-r25669
|
||||
|
||||
First patch ffmpeg with ffmpeg-25669.diff
|
||||
patch -p0 < ffmpeg-25669.diff
|
||||
|
||||
- Windows
|
||||
|
||||
32-bit:
|
||||
./configure \
|
||||
--target-os=mingw32 \
|
||||
--enable-memalign-hack \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffplay --disable-ffmpeg \
|
||||
--disable-pthreads --enable-w32threads
|
||||
|
||||
64-bit:
|
||||
|
||||
Then run:
|
||||
./configure \
|
||||
--arch=amd64 --target-os=mingw32 \
|
||||
--enable-memalign-hack \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--disable-dxva2 \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffplay --disable-ffmpeg \
|
||||
--disable-pthreads --enable-w32threads \
|
||||
--enable-cross-compile
|
||||
|
||||
mingw32-make
|
||||
Note: mingw64-make failed to work (segmentation fault) that's why we fallback to mingw32-make.
|
||||
|
||||
- Linux, FreeBSD
|
||||
|
||||
Note: remove --enable-pic for x86 architecture.
|
||||
|
||||
./configure \
|
||||
--enable-pic \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-decoder=mjpeg --enable-muxer=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffprobe --disable-ffplay --disable-ffmpeg \
|
||||
--enable-pthreads
|
||||
|
||||
- Mac OS X
|
||||
|
||||
Note: removed from configure script the option to add -mdynamic-no-pic unless you compile
|
||||
for i386 architecture (intel 32-bit). For i386, remove "--enable-pic" from the following
|
||||
command.
|
||||
|
||||
./configure \
|
||||
--enable-pic \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-fPIC -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-fPIC -I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffprobe --disable-ffplay --disable-ffmpeg \
|
||||
--enable-pthreads
|
||||
|
||||
4. libffmpeg
|
||||
|
||||
Open Makefile, uncomment the section for your OS and comment out the others.
|
||||
Be careful to correctly set FFMPEG_HOME, JAVA_HOME, MP3LAME_HOME and X264_HOME variables.
|
||||
|
||||
Then run:
|
||||
make (gmake on FreeBSD)
|
||||
|
||||
1. lame
|
||||
|
||||
./configure \
|
||||
--disable-shared --enable-static \
|
||||
--enable-nasm \
|
||||
--disable-analyzer-hooks --disable-decoder --disable-frontend \
|
||||
--with-pic
|
||||
|
||||
FFmpeg looks for lame.h as lame/lame.h but the uninstalled lame-3.98.4 does not
|
||||
have the lame directory so go into lame-3.98.4/include and "ln -s . lame" on
|
||||
Linux and Mac OS X or "mklink /d lame ." on Windows.
|
||||
|
||||
MS Windows notes:
|
||||
- As an alternative to configure and a subsequent make, just use:
|
||||
make -f Makefile.unix HAVE_NASM=YES NOUNIXCMD=NO UNAME=MSDOS
|
||||
- Before make, open Makefile, libmp3lame/Makefile and
|
||||
libmp3lame/i386/Makefile and make sure that the path to nasm.exe is
|
||||
correct (e.g. have NASM=nasm and nasm.exe on the PATH);
|
||||
- For Windows x64, add --build=x86_64-w64-mingw32 to the configure line.
|
||||
|
||||
2. x264
|
||||
|
||||
- Windows
|
||||
|
||||
Download yasm for Windows (32-bit or 64-bit) at
|
||||
http://www.tortall.net/projects/yasm/wiki/Download and copy it to a directory on
|
||||
the PATH.
|
||||
|
||||
./configure --disable-pthread
|
||||
make
|
||||
|
||||
- FreeBSD
|
||||
|
||||
patch -p1 < x264-01-freebsd.patch
|
||||
./configure --enable-pic
|
||||
gmake
|
||||
|
||||
- Linux, Mac OS X
|
||||
|
||||
./configure --enable-pic
|
||||
make
|
||||
|
||||
3. ffmpeg
|
||||
|
||||
patch -p0 < ffmpeg-01-libavcodec_libx264.c-zero_latency.patch
|
||||
|
||||
- Windows
|
||||
|
||||
32-bit:
|
||||
./configure \
|
||||
--target-os=mingw32 \
|
||||
--enable-memalign-hack \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-debug \
|
||||
--disable-everything --disable-network \
|
||||
--disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--enable-decoder=h263 --enable-encoder=h263p --enable-parser=h263 \
|
||||
--enable-libx264 --enable-gpl \
|
||||
--enable-decoder=h264 --enable-encoder=libx264 --enable-parser=h264 \
|
||||
--enable-filter=buffer --enable-filter=hflip --enable-filter=scale --enable-filter=nullsink \
|
||||
--extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" \
|
||||
--disable-pthreads --enable-w32threads
|
||||
|
||||
64-bit:
|
||||
|
||||
Then run:
|
||||
./configure \
|
||||
--arch=amd64 --target-os=mingw32 \
|
||||
--enable-memalign-hack \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--disable-dxva2 \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffplay --disable-ffmpeg \
|
||||
--disable-pthreads --enable-w32threads \
|
||||
--enable-cross-compile
|
||||
|
||||
mingw32-make
|
||||
Note: mingw64-make failed to work (segmentation fault) that's why we fallback to
|
||||
mingw32-make.
|
||||
|
||||
- Linux, FreeBSD
|
||||
|
||||
Note: remove --enable-pic for x86 architecture.
|
||||
|
||||
./configure \
|
||||
--enable-pic \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-decoder=mjpeg --enable-muxer=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffprobe --disable-ffplay --disable-ffmpeg \
|
||||
--enable-pthreads
|
||||
|
||||
- Mac OS X
|
||||
|
||||
Note: removed from configure script the option to add -mdynamic-no-pic unless
|
||||
you compile for the i386 architecture (Intel 32-bit). For i386, remove
|
||||
"--enable-pic" from the following command.
|
||||
|
||||
./configure \
|
||||
--enable-pic \
|
||||
--enable-static --disable-shared --shlibdir=. \
|
||||
--disable-encoders --disable-decoders --disable-muxers --disable-demuxers \
|
||||
--disable-parsers --disable-bsfs --disable-protocols --disable-devices \
|
||||
--disable-network \
|
||||
--enable-libx264 --enable-gpl --enable-parser=h264 --enable-encoder=libx264 \
|
||||
--enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 \
|
||||
--enable-parser=h263 --enable-encoder=h263p \
|
||||
--enable-decoder=h263 --enable-muxer=h263 --enable-demuxer=h263 \
|
||||
--enable-libmp3lame --enable-encoder=libmp3lame \
|
||||
--extra-ldflags="-fPIC -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME" --extra-cflags="-fPIC -I$MP3LAME_HOME/include -I$X264_HOME" \
|
||||
--disable-debug \
|
||||
--disable-ffserver --disable-ffprobe --disable-ffplay --disable-ffmpeg \
|
||||
--enable-pthreads
|
||||
|
||||
4. libffmpeg
|
||||
|
||||
Define the environment variable JAVA_HOME so that the JNI headers can be found.
|
||||
Change the current directory to src\native and run "ant ffmpeg" passing it
|
||||
values for the ffmpeg, lame and x264 properties which specify the paths to the
|
||||
homes of the development trees of the respective libraries.
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
Index: libavcodec/libx264.c
|
||||
===================================================================
|
||||
--- libavcodec/libx264.c (révision 25669)
|
||||
+++ libavcodec/libx264.c (copie de travail)
|
||||
@@ -303,6 +303,13 @@
|
||||
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
|
||||
x4->params.b_repeat_headers = 0;
|
||||
|
||||
+ /* zero latency */
|
||||
+ x4->params.rc.i_lookahead = 0;
|
||||
+ x4->params.i_sync_lookahead = 0;
|
||||
+ x4->params.i_bframe = 0;
|
||||
+ x4->params.b_sliced_threads = 1;
|
||||
+ x4->params.b_vfr_input = 0;
|
||||
+
|
||||
x4->enc = x264_encoder_open(&x4->params);
|
||||
if (!x4->enc)
|
||||
return -1;
|
||||
@ -1,36 +0,0 @@
|
||||
Index: libavcodec/libx264.c
|
||||
===================================================================
|
||||
--- libavcodec/libx264.c (révision 25669)
|
||||
+++ libavcodec/libx264.c (copie de travail)
|
||||
@@ -163,7 +163,7 @@
|
||||
x4->params.p_log_private = avctx;
|
||||
|
||||
x4->params.i_keyint_max = avctx->gop_size;
|
||||
- x4->params.b_intra_refresh = avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
|
||||
+ x4->params.b_intra_refresh = 1; //avctx->flags2 & CODEC_FLAG2_INTRA_REFRESH;
|
||||
x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
|
||||
x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
|
||||
x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;
|
||||
@@ -193,7 +193,7 @@
|
||||
x4->params.i_bframe_pyramid = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
|
||||
avctx->has_b_frames = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!avctx->max_b_frames;
|
||||
|
||||
- x4->params.i_keyint_min = avctx->keyint_min;
|
||||
+ x4->params.i_keyint_min = 0; //avctx->keyint_min;
|
||||
if (x4->params.i_keyint_min > x4->params.i_keyint_max)
|
||||
x4->params.i_keyint_min = x4->params.i_keyint_max;
|
||||
|
||||
@@ -303,6 +303,13 @@
|
||||
if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
|
||||
x4->params.b_repeat_headers = 0;
|
||||
|
||||
+ /* zero latency */
|
||||
+ x4->params.rc.i_lookahead = 0;
|
||||
+ x4->params.i_sync_lookahead = 0;
|
||||
+ x4->params.i_bframe = 0;
|
||||
+ x4->params.b_sliced_threads = 1;
|
||||
+ x4->params.b_vfr_input = 0;
|
||||
+
|
||||
x4->enc = x264_encoder_open(&x4->params);
|
||||
if (!x4->enc)
|
||||
return -1;
|
||||
@ -1,212 +0,0 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Various utilities for command line tools
|
||||
* Copyright (c) 2000-2003 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/* Include only the enabled headers since some compilers (namely, Sun
|
||||
Studio) will not omit unused inline functions and create undefined
|
||||
references to libraries that are not being built. */
|
||||
|
||||
#include "libavcodec/opt.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavfilter/graphparser.h"
|
||||
#include "libavfilter/vsrc_buffer.h"
|
||||
#include "libswscale/swscale.h"
|
||||
|
||||
#include "ffmpeg_utils.h"
|
||||
|
||||
static int ffsink_init(AVFilterContext *ctx, const char *args, void *opaque)
|
||||
{
|
||||
FFSinkContext *priv = ctx->priv;
|
||||
|
||||
if (!opaque)
|
||||
return AVERROR(EINVAL);
|
||||
*priv = *(FFSinkContext *)opaque;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void null_end_frame(AVFilterLink *inlink) { }
|
||||
|
||||
static int ffsink_query_formats(AVFilterContext *ctx)
|
||||
{
|
||||
FFSinkContext *priv = ctx->priv;
|
||||
enum PixelFormat pix_fmts[] = { priv->pix_fmt, PIX_FMT_NONE };
|
||||
|
||||
avfilter_set_common_formats(ctx, avfilter_make_format_list(pix_fmts));
|
||||
return 0;
|
||||
}
|
||||
|
||||
AVFilter ffsink = {
|
||||
.name = "ffsink",
|
||||
.priv_size = sizeof(FFSinkContext),
|
||||
.init = ffsink_init,
|
||||
|
||||
.query_formats = ffsink_query_formats,
|
||||
|
||||
.inputs = (AVFilterPad[]) {{ .name = "default",
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.end_frame = null_end_frame,
|
||||
.min_perms = AV_PERM_READ, },
|
||||
{ .name = NULL }},
|
||||
.outputs = (AVFilterPad[]) {{ .name = NULL }},
|
||||
};
|
||||
|
||||
int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
|
||||
struct AVFilterBufferRef **picref_ptr, AVRational *tb)
|
||||
{
|
||||
int ret;
|
||||
AVFilterBufferRef *picref;
|
||||
|
||||
if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if (!(picref = ctx->inputs[0]->cur_buf))
|
||||
{
|
||||
return AVERROR(ENOENT);
|
||||
}
|
||||
|
||||
*picref_ptr = picref;
|
||||
ctx->inputs[0]->cur_buf = NULL;
|
||||
*tb = ctx->inputs[0]->time_base;
|
||||
|
||||
memcpy(frame->data, picref->data, sizeof(frame->data));
|
||||
memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize));
|
||||
frame->interlaced_frame = picref->video->interlaced;
|
||||
frame->top_field_first = picref->video->top_field_first;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int configure_filters(AVInputStream *ist, int pix_fmt, int w, int h,
|
||||
AVFilterGraph *graph, const char* vfilters)
|
||||
{
|
||||
AVFilterContext *last_filter;
|
||||
/** filter graph containing all filters including input & output */
|
||||
//AVCodecContext *codec = ost->st->codec;
|
||||
//AVCodecContext *icodec = ist->st->codec;
|
||||
FFSinkContext ffsink_ctx = { .pix_fmt = pix_fmt };
|
||||
char args[255];
|
||||
int ret;
|
||||
int width = w;
|
||||
int height = h;
|
||||
|
||||
//graph = av_mallocz(sizeof(AVFilterGraph));
|
||||
|
||||
if ((ret = avfilter_open(&ist->input_video_filter, avfilter_get_by_name("buffer"), "src")) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if ((ret = avfilter_open(&ist->output_video_filter, &ffsink, "out")) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
snprintf(args, 255, "%d:%d:%d:%d:%d", width,
|
||||
height, pix_fmt, 1, AV_TIME_BASE);
|
||||
|
||||
if ((ret = avfilter_init_filter(ist->input_video_filter, args, NULL)) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
if ((ret = avfilter_init_filter(ist->output_video_filter, NULL, &ffsink_ctx)) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* add input and output filters to the overall graph */
|
||||
avfilter_graph_add_filter(graph, ist->input_video_filter);
|
||||
avfilter_graph_add_filter(graph, ist->output_video_filter);
|
||||
|
||||
last_filter = ist->input_video_filter;
|
||||
|
||||
/*
|
||||
if (codec->width != icodec->width || codec->height != icodec->height) {
|
||||
AVFilterContext *filter;
|
||||
snprintf(args, 255, "%d:%d:flags=0x%X",
|
||||
codec->width,
|
||||
codec->height,
|
||||
(int)av_get_int(sws_opts, "sws_flags", NULL));
|
||||
if ((ret = avfilter_open(&filter, avfilter_get_by_name("scale"), NULL)) < 0)
|
||||
return ret;
|
||||
if ((ret = avfilter_init_filter(filter, args, NULL)) < 0)
|
||||
return ret;
|
||||
if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
|
||||
return ret;
|
||||
last_filter = filter;
|
||||
avfilter_graph_add_filter(graph, last_filter);
|
||||
}
|
||||
*/
|
||||
//snprintf(args, sizeof(args), "flags=0x%X", (int)av_get_int(sws_opts, "sws_flags", NULL));
|
||||
snprintf(args, sizeof(args), "flags=0x%X", SWS_BICUBIC);
|
||||
graph->scale_sws_opts = av_strdup(args);
|
||||
|
||||
|
||||
if (vfilters) {
|
||||
AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
|
||||
AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
|
||||
|
||||
outputs->name = av_strdup("in");
|
||||
outputs->filter = last_filter;
|
||||
outputs->pad_idx = 0;
|
||||
outputs->next = NULL;
|
||||
|
||||
inputs->name = av_strdup("out");
|
||||
inputs->filter = ist->output_video_filter;
|
||||
inputs->pad_idx = 0;
|
||||
inputs->next = NULL;
|
||||
|
||||
if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
//av_freep(&vfilters);
|
||||
} else {
|
||||
if ((ret = avfilter_link(last_filter, 0, ist->output_video_filter, 0)) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if ((ret = avfilter_graph_config(graph, NULL)) < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
/*
|
||||
codec->width = ist->output_video_filter->inputs[0]->w;
|
||||
codec->height = ist->output_video_filter->inputs[0]->h;
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
|
||||
*
|
||||
* Distributable under LGPL license.
|
||||
* See terms of license at gnu.org.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Various utilities for command line tools
|
||||
* copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef FFMPEG_CMDUTILS_H
|
||||
#define FFMPEG_CMDUTILS_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavfilter/avfiltergraph.h"
|
||||
|
||||
typedef struct {
|
||||
enum PixelFormat pix_fmt;
|
||||
} FFSinkContext;
|
||||
|
||||
extern AVFilter ffsink;
|
||||
|
||||
struct AVInputStream;
|
||||
|
||||
typedef struct AVOutputStream {
|
||||
int file_index; /* file index */
|
||||
int index; /* stream index in the output file */
|
||||
int source_index; /* AVInputStream index */
|
||||
AVStream *st; /* stream in the output file */
|
||||
int encoding_needed; /* true if encoding needed for this stream */
|
||||
int frame_number;
|
||||
/* input pts and corresponding output pts
|
||||
for A/V sync */
|
||||
//double sync_ipts; /* dts from the AVPacket of the demuxer in second units */
|
||||
struct AVInputStream *sync_ist; /* input stream to sync against */
|
||||
int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number
|
||||
AVBitStreamFilterContext *bitstream_filters;
|
||||
/* video only */
|
||||
int video_resample;
|
||||
AVFrame pict_tmp; /* temporary image for resampling */
|
||||
// struct SwsContext *img_resample_ctx; /* for image resampling */
|
||||
// int resample_height;
|
||||
// int resample_width;
|
||||
// int resample_pix_fmt;
|
||||
|
||||
/* full frame size of first frame */
|
||||
int original_height;
|
||||
int original_width;
|
||||
|
||||
/* forced key frames */
|
||||
int64_t *forced_kf_pts;
|
||||
int forced_kf_count;
|
||||
int forced_kf_index;
|
||||
} AVOutputStream;
|
||||
|
||||
typedef struct AVInputStream {
|
||||
int file_index;
|
||||
int index;
|
||||
AVStream *st;
|
||||
int discard; /* true if stream data should be discarded */
|
||||
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
|
||||
int64_t sample_index; /* current sample */
|
||||
|
||||
int64_t start; /* time when read started */
|
||||
int64_t next_pts; /* synthetic pts for cases where pkt.pts
|
||||
is not defined */
|
||||
int64_t pts; /* current pts */
|
||||
//PtsCorrectionContext pts_ctx;
|
||||
int is_start; /* is 1 at the start and after a discontinuity */
|
||||
int showed_multi_packet_warning;
|
||||
int is_past_recording_time;
|
||||
|
||||
AVFilterContext *output_video_filter;
|
||||
AVFilterContext *input_video_filter;
|
||||
AVFrame *filter_frame;
|
||||
int has_filter_frame;
|
||||
AVFilterBufferRef *picref;
|
||||
} AVInputStream;
|
||||
|
||||
/**
|
||||
* Extract a frame from sink.
|
||||
*
|
||||
* @return a negative error in case of failure, 1 if one frame has
|
||||
* been extracted successfully.
|
||||
*/
|
||||
int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,
|
||||
AVFilterBufferRef **picref, AVRational *pts_tb);
|
||||
|
||||
int configure_filters(AVInputStream *ist, int pix_fmt, int width, int height,
|
||||
AVFilterGraph *graph, const char* vfilters);
|
||||
|
||||
#endif /* FFMPEG_CMDUTILS_H */
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue