diff --git a/ffmpeg/ffmpeg.c b/ffmpeg/ffmpeg.c index 110e938..2e5db34 100644 --- a/ffmpeg/ffmpeg.c +++ b/ffmpeg/ffmpeg.c @@ -257,30 +257,11 @@ obtain_next_frame(AVFormatContext *fmt_ctx, AVCodecContext *dec_ctx, int stream_ return err; } -int64_t find_duration(AVFormatContext *fmt_ctx) { - AVPacket pkt = create_packet(); - int err = 0; - int64_t duration = 0; - while (err >= 0) { - err = av_read_frame(fmt_ctx, &pkt); - if (pkt.pts != AV_NOPTS_VALUE) { - AVRational time_base = fmt_ctx->streams[pkt.stream_index]->time_base; - duration = FFMAX(duration, pkt.pts * 1000000000 * time_base.num / time_base.den); - } - av_packet_unref(&pkt); - } - if (err == AVERROR_EOF) { - return duration; - } - return err; -} - ThumbContext *create_thumb_context(AVStream *stream, AVFrame *frame) { ThumbContext *thumb_ctx = av_mallocz(sizeof *thumb_ctx); if (!thumb_ctx) { return thumb_ctx; } -// thumb_ctx->n = 0; thumb_ctx->desc = av_pix_fmt_desc_get(frame->format); int nb_frames = 100; if (stream->disposition & AV_DISPOSITION_ATTACHED_PIC) { diff --git a/ffmpeg/ffmpeg.go b/ffmpeg/ffmpeg.go index caf5b92..168e73e 100644 --- a/ffmpeg/ffmpeg.go +++ b/ffmpeg/ffmpeg.go @@ -6,7 +6,6 @@ package ffmpeg // #include "ffmpeg.h" import "C" import ( - "context" "github.com/cshum/imagor/vips/pointer" "io" "math" @@ -35,7 +34,6 @@ type Metadata struct { } type AVContext struct { - context context.Context opaque unsafe.Pointer reader io.Reader seeker io.Seeker diff --git a/ffmpeg/ffmpeg.h b/ffmpeg/ffmpeg.h index c056244..180fbd5 100644 --- a/ffmpeg/ffmpeg.h +++ b/ffmpeg/ffmpeg.h @@ -52,8 +52,6 @@ AVPacket create_packet(); int obtain_next_frame(AVFormatContext *fmt_ctx, AVCodecContext *dec_ctx, int stream_index, AVPacket *pkt, AVFrame **frame); -int64_t find_duration(AVFormatContext *fmt_ctx); - ThumbContext *create_thumb_context(AVStream *stream, AVFrame *frame); void free_thumb_context(ThumbContext *thumb_ctx);