Files
videostreamer/videostreamer.h
Will Storey 734ccb6d6b Support input with non-monotonic dts
This fixes issue #1.

It appears there are inputs where the dts fluctuates. This is apparently
inputs that are not well formed. However, I discovered that ffmpeg
itself allows for this. If it detects this happening, it updates the
pts/dts of the packet. To do this, it tracks the last output dts. This
ensures the output dts is monotonic even if the input is not.

I use essentially the same approach as in ffmpeg.
2017-03-14 12:00:07 -07:00

51 lines
1019 B
C

#ifndef _VIDEOSTREAMER_H
#define _VIDEOSTREAMER_H
#include <libavformat/avformat.h>
#include <stdbool.h>
#include <stdint.h>
struct VSInput {
AVFormatContext * format_ctx;
int video_stream_index;
};
struct VSOutput {
AVFormatContext * format_ctx;
// Track the last dts we output. We use it to double check that dts is
// monotonic.
//
// I am not sure if it is available anywhere already. I tried
// AVStream->info->last_dts and that is apparently not set.
int64_t last_dts;
};
void
vs_setup(void);
struct VSInput *
vs_open_input(const char * const,
const char * const, const bool);
void
vs_destroy_input(struct VSInput * const);
struct VSOutput *
vs_open_output(const char * const,
const char * const, const struct VSInput * const,
const bool);
void
vs_destroy_output(struct VSOutput * const);
int
vs_read_packet(const struct VSInput *, AVPacket * const,
const bool);
int
vs_write_packet(const struct VSInput * const,
struct VSOutput * const, AVPacket * const, const bool);
#endif