diff options
author | Jan Klemkow <j.klemkow@wemelug.de> | 2013-01-10 17:31:15 +0100 |
---|---|---|
committer | Jan Klemkow <j.klemkow@wemelug.de> | 2013-01-10 17:31:15 +0100 |
commit | 078e97c9bcf9480bbbc5f55edb909e01dad47190 (patch) | |
tree | 9d483bf4298c5ca8a7b2f5de34cadc21d1e965c2 /src | |
parent | 30f097e47c10a3acb56889ce0083c3cb68e6496e (diff) | |
download | advtime-078e97c9bcf9480bbbc5f55edb909e01dad47190.tar.gz advtime-078e97c9bcf9480bbbc5f55edb909e01dad47190.tar.bz2 advtime-078e97c9bcf9480bbbc5f55edb909e01dad47190.zip |
mv struct and wip state
Diffstat (limited to 'src')
-rw-r--r-- | src/advtime.c | 32 | ||||
-rw-r--r-- | src/video_decode.c | 8 | ||||
-rw-r--r-- | src/video_decode.h | 12 |
3 files changed, 40 insertions, 12 deletions
diff --git a/src/advtime.c b/src/advtime.c index 265d18c..4c329da 100644 --- a/src/advtime.c +++ b/src/advtime.c @@ -4,6 +4,8 @@ #include <stdint.h> #include <unistd.h> +#include <libavutil/rational.h> + #include "video_decode.h" #include "util.h" @@ -97,20 +99,42 @@ main(int argc, char **argv) if (ret < 0) return -ret; + printf("fps: %d\n", vd->fmt_ctx->fps_probe_size); + printf("streams: %d\n", vd->fmt_ctx->nb_streams); + printf("filename: %s\n", vd->fmt_ctx->filename); + printf("streams: %d\n", vd->fmt_ctx->streams[0]->duration); + printf("duration: %d\n", vd->fmt_ctx->streams[1]->duration); + printf("nb_frames: %d\n", vd->fmt_ctx->streams[0]->nb_frames); + printf("avg frame rate: %f\n", + av_q2d(vd->fmt_ctx->streams[0]->avg_frame_rate)); + printf("real frame rate: %f\n", + av_q2d(vd->fmt_ctx->streams[0]->r_frame_rate)); + printf("first: %ji\n", vd->fmt_ctx->streams[0]->first_dts); + printf("cur: %ji\n", vd->fmt_ctx->streams[0]->cur_dts); + printf("reference: %ji\n", vd->fmt_ctx->streams[0]->reference_dts); + for (int i = 0; video_decode_get_frame(vd, &frame_b) > 0; ++i) { - printf("%d\t", i); +// printf("first: %ji\t", vd->fmt_ctx->streams[0]->first_dts); +// printf("cur: %ji\t", vd->fmt_ctx->streams[0]->cur_dts); +// printf("reference: %ji\n", vd->fmt_ctx->streams[0]->reference_dts); + + +// printf("%d\t", i); if (average_flag == 1) printf("%f", frame_average(frame_a)); if (average_flag == 1 && diff_flag == 1) printf("\t"); - if (diff_flag == 1) - printf("%f", diff = frame_diff(frame_a, frame_b)); + if (diff_flag == 1) { + diff = frame_diff(frame_a, frame_b); +// printf("%f", diff); + } if (diff > 40.0) { + printf("cut: %d\n", i); snprintf(filename, BUFSIZ, "img/%04i.pgm", i); frame_mix(frame_a, frame_b); if (pgm_save(frame_a->data, frame_a->stride, @@ -119,7 +143,7 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } - printf("\n"); +// printf("\n"); video_decode_free_frame(&frame_a); frame_a = frame_b; } diff --git a/src/video_decode.c b/src/video_decode.c index b3c8e4d..993fd14 100644 --- a/src/video_decode.c +++ b/src/video_decode.c @@ -10,14 +10,6 @@ #include <libavcodec/avcodec.h> #include <libswscale/swscale.h> - -struct video_decode { - AVFormatContext *fmt_ctx; - AVCodecContext *codec_ctx; - AVCodec *codec; - int stream; -}; - struct video_frame_priv { struct video_frame base; AVFrame *frame; diff --git a/src/video_decode.h b/src/video_decode.h index 2505b8b..9da7f63 100644 --- a/src/video_decode.h +++ b/src/video_decode.h @@ -2,6 +2,11 @@ #define _VIDEO_DECODE_H_ #include <stdint.h> +#include <libavutil/avutil.h> +#include <libavutil/error.h> +#include <libavformat/avformat.h> +#include <libavcodec/avcodec.h> +#include <libswscale/swscale.h> struct video_decode; struct video_frame { @@ -9,6 +14,13 @@ struct video_frame { int width, height, stride; }; +struct video_decode { + AVFormatContext *fmt_ctx; + AVCodecContext *codec_ctx; + AVCodec *codec; + int stream; +}; + int video_decode_init(struct video_decode **vd, char *file, int64_t timestamp); |