diff --git a/libavformat/isom.h b/libavformat/isom.h
index 8f92cae..9a2847d 100644
|
a
|
b
|
typedef struct MOVStreamContext {
|
| 130 | 130 | } MOVStreamContext; |
| 131 | 131 | |
| 132 | 132 | typedef struct MOVContext { |
| | 133 | AVClass *avclass; |
| 133 | 134 | AVFormatContext *fc; |
| 134 | 135 | int time_scale; |
| 135 | 136 | int64_t duration; ///< duration of the longest track |
| … |
… |
typedef struct MOVContext {
|
| 143 | 144 | unsigned trex_count; |
| 144 | 145 | int itunes_metadata; ///< metadata are itunes style |
| 145 | 146 | int chapter_track; |
| | 147 | int use_absolute_path; |
| 146 | 148 | } MOVContext; |
| 147 | 149 | |
| 148 | 150 | int ff_mp4_read_descr_len(AVIOContext *pb); |
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3bb42fe..788cea0 100644
|
a
|
b
|
|
| 30 | 30 | #include "libavutil/mathematics.h" |
| 31 | 31 | #include "libavutil/avstring.h" |
| 32 | 32 | #include "libavutil/dict.h" |
| | 33 | #include "libavutil/opt.h" |
| 33 | 34 | #include "avformat.h" |
| 34 | 35 | #include "internal.h" |
| 35 | 36 | #include "avio_internal.h" |
| … |
… |
static void mov_build_index(MOVContext *mov, AVStream *st)
|
| 1931 | 1932 | } |
| 1932 | 1933 | |
| 1933 | 1934 | static int mov_open_dref(AVIOContext **pb, const char *src, MOVDref *ref, |
| 1934 | | AVIOInterruptCB *int_cb) |
| | 1935 | AVIOInterruptCB *int_cb, int use_absolute_path) |
| 1935 | 1936 | { |
| 1936 | 1937 | /* try relative path, we do not try the absolute because it can leak information about our |
| 1937 | 1938 | system to an attacker */ |
| … |
… |
static int mov_open_dref(AVIOContext **pb, const char *src, MOVDref *ref,
|
| 1969 | 1970 | if (!avio_open2(pb, filename, AVIO_FLAG_READ, int_cb, NULL)) |
| 1970 | 1971 | return 0; |
| 1971 | 1972 | } |
| | 1973 | } else if (use_absolute_path) { |
| | 1974 | if (!avio_open2(pb, ref->path, AVIO_FLAG_READ, int_cb, NULL)) |
| | 1975 | return 0; |
| 1972 | 1976 | } |
| 1973 | 1977 | |
| 1974 | 1978 | return AVERROR(ENOENT); |
| … |
… |
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
| 2021 | 2025 | |
| 2022 | 2026 | if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) { |
| 2023 | 2027 | MOVDref *dref = &sc->drefs[sc->dref_id - 1]; |
| 2024 | | if (mov_open_dref(&sc->pb, c->fc->filename, dref, &c->fc->interrupt_callback) < 0) |
| | 2028 | if (mov_open_dref(&sc->pb, c->fc->filename, dref, &c->fc->interrupt_callback, |
| | 2029 | c->use_absolute_path) < 0) |
| 2025 | 2030 | av_log(c->fc, AV_LOG_ERROR, |
| 2026 | 2031 | "stream %d, error opening alias: path='%s', dir='%s', " |
| 2027 | 2032 | "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n", |
| … |
… |
static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
|
| 2740 | 2745 | AVIndexEntry *sample; |
| 2741 | 2746 | AVStream *st = NULL; |
| 2742 | 2747 | int ret; |
| | 2748 | mov->fc = s; |
| 2743 | 2749 | retry: |
| 2744 | 2750 | sample = mov_find_next_sample(s, &st); |
| 2745 | 2751 | if (!sample) { |
| … |
… |
static int mov_read_close(AVFormatContext *s)
|
| 2909 | 2915 | return 0; |
| 2910 | 2916 | } |
| 2911 | 2917 | |
| | 2918 | static const AVOption options[]={ |
| | 2919 | {"use_absolute_path", "allow using absolute path when opening alias", offsetof(MOVContext, use_absolute_path), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_DECODING_PARAM}, |
| | 2920 | {NULL} |
| | 2921 | }; |
| | 2922 | static const AVClass class = { "mov,mp4,m4a,3gp,3g2,mj2", av_default_item_name, options, LIBAVUTIL_VERSION_INT }; |
| | 2923 | |
| 2912 | 2924 | AVInputFormat ff_mov_demuxer = { |
| 2913 | 2925 | .name = "mov,mp4,m4a,3gp,3g2,mj2", |
| 2914 | 2926 | .long_name = NULL_IF_CONFIG_SMALL("QuickTime/MPEG-4/Motion JPEG 2000 format"), |
| … |
… |
AVInputFormat ff_mov_demuxer = {
|
| 2918 | 2930 | .read_packet = mov_read_packet, |
| 2919 | 2931 | .read_close = mov_read_close, |
| 2920 | 2932 | .read_seek = mov_read_seek, |
| | 2933 | .priv_class = &class, |
| 2921 | 2934 | }; |