summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-08-30 22:25:40 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-08-30 22:25:40 +0000
commit735e934c58ddd831c5e94feac52ba87e7541cfc8 (patch)
tree8edc075a99c39258a87573d7854760466f3fe1f0
parenteae1896f51ebd0617528e8d3fdd737e38298c777 (diff)
downloadmpv-735e934c58ddd831c5e94feac52ba87e7541cfc8.tar.bz2
mpv-735e934c58ddd831c5e94feac52ba87e7541cfc8.tar.xz
added lavfdopts to pass options to libavformat
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19604 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--cfg-common.h7
-rw-r--r--libmpdemux/demux_lavf.c19
2 files changed, 26 insertions, 0 deletions
diff --git a/cfg-common.h b/cfg-common.h
index ad69e5cb1d..bab29b4fda 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -239,6 +239,9 @@
#ifdef USE_LIBAVCODEC
{"lavdopts", lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
+#if defined(USE_LIBAVFORMAT) || defined(USE_LIBAVFORMAT_SO)
+ {"lavfdopts", lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+#endif
#if defined(HAVE_XVID3) || defined(HAVE_XVID4)
{"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
@@ -471,6 +474,10 @@ m_option_t pvropts_conf[]={
extern m_config_t dvbin_opts_conf[];
#endif
+#if defined(USE_LIBAVFORMAT) || defined(USE_LIBAVFORMAT_SO)
+extern m_option_t lavfdopts_conf[];
+#endif
+
#ifdef USE_FRIBIDI
extern char *fribidi_charset;
extern int flip_hebrew;
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 8740dba104..3ace94f665 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -27,17 +27,27 @@
#include "stream.h"
#include "demuxer.h"
#include "stheader.h"
+#include "m_option.h"
#ifdef USE_LIBAVFORMAT_SO
#include <ffmpeg/avformat.h>
+#include <ffmpeg/opt.h>
#else
#include "avformat.h"
#include "avi.h"
+#include "opt.h"
#endif
#define PROBE_BUF_SIZE 2048
extern char *audio_lang;
+static unsigned int opt_probesize = 0;
+
+m_option_t lavfdopts_conf[] = {
+ {"probesize", &(opt_probesize), CONF_TYPE_INT, CONF_RANGE, 32, INT_MAX, NULL},
+ {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
typedef struct lavf_priv_t{
AVInputFormat *avif;
@@ -136,6 +146,7 @@ static int lavf_check_file(demuxer_t *demuxer){
static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
AVFormatContext *avfc;
AVFormatParameters ap;
+ AVOption *opt;
lavf_priv_t *priv= demuxer->priv;
int i,g;
char mp_filename[256]="mp:";
@@ -146,6 +157,14 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
register_protocol(&mp_protocol);
+ avfc = av_alloc_format_context();
+ ap.prealloced_context = 1;
+ if(opt_probesize) {
+ double d = (double) opt_probesize;
+ opt = av_set_double(avfc, "probesize", opt_probesize);
+ if(!opt) mp_msg(MSGT_HEADER,MSGL_ERR, "demux_lavf, couldn't set option probesize to %.3f\r\n", d);
+ }
+
if(demuxer->stream->url)
strncpy(mp_filename + 3, demuxer->stream->url, sizeof(mp_filename)-3);
else