From: Zhao Zhili <quinkblack@foxmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] Revert "avformat/file: seek back to initial position for fd protocol"
Date: Mon, 27 May 2024 23:54:48 +0800
Message-ID: <tencent_E0CD944FDAD51B2750B8E7964E4D0F204F07@qq.com> (raw)
In-Reply-To: <20240527152213.259504-1-remi@remlab.net>
> On May 27, 2024, at 23:22, Rémi Denis-Courmont <remi@remlab.net> wrote:
>
> The generally expected behaviour is for software to append from the
> current position, not to keep resetting. See also how shell works:
> # (foo && bar) > file
> ...would normally concatenate the output of both commands to file.
>
> If foo seeks like lavf, bar would instead overwrite the output of
> foo (possibly not completely).
Fine. I overlooked this use case.
>
> This reverts commit 5c3d2177e7be7dde69a83b1b394f57976c164c84.
> ---
> libavformat/file.c | 14 +-------------
> 1 file changed, 1 insertion(+), 13 deletions(-)
>
> diff --git a/libavformat/file.c b/libavformat/file.c
> index 0ed4cff266..3fc1e741f2 100644
> --- a/libavformat/file.c
> +++ b/libavformat/file.c
> @@ -99,7 +99,6 @@ typedef struct FileContext {
> #if HAVE_DIRENT_H
> DIR *dir;
> #endif
> - int64_t initial_pos;
> } FileContext;
>
> static const AVOption file_options[] = {
> @@ -220,12 +219,7 @@ static int fd_dup(URLContext *h, int oldfd)
> static int file_close(URLContext *h)
> {
> FileContext *c = h->priv_data;
> - int ret;
> -
> - if (c->initial_pos >= 0 && !h->is_streamed)
> - lseek(c->fd, c->initial_pos, SEEK_SET);
> -
> - ret = close(c->fd);
> + int ret = close(c->fd);
> return (ret == -1) ? AVERROR(errno) : 0;
> }
>
> @@ -293,7 +287,6 @@ static int file_open(URLContext *h, const char *filename, int flags)
>
> av_strstart(filename, "file:", &filename);
>
> - c->initial_pos = -1;
> if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) {
> access = O_CREAT | O_RDWR;
> if (c->trunc)
> @@ -505,11 +498,6 @@ static int fd_open(URLContext *h, const char *filename, int flags)
> if (c->fd == -1)
> return AVERROR(errno);
>
> - if (h->is_streamed)
> - c->initial_pos = -1;
> - else
> - c->initial_pos = lseek(c->fd, 0, SEEK_CUR);
> -
> return 0;
> }
>
> --
> 2.45.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2024-05-27 15:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 15:22 Rémi Denis-Courmont
2024-05-27 15:54 ` Zhao Zhili [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_E0CD944FDAD51B2750B8E7964E4D0F204F07@qq.com \
--to=quinkblack@foxmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git