X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=webmdec.h;h=7dcb170caf3c0f1d394bb5e24764e619deb5edc6;hb=ff42e04f9cb60e63ca3fe12ac497f27c68555e1f;hp=fa5a52eaf10930fa3c19b39d667a95714ff64f50;hpb=c2ca97caafc89e52f0083326753ed461abc7bd62;p=libvpx diff --git a/webmdec.h b/webmdec.h index fa5a52eaf..7dcb170ca 100644 --- a/webmdec.h +++ b/webmdec.h @@ -16,29 +16,50 @@ extern "C" { #endif -struct nestegg; -struct nestegg_packet; struct VpxInputContext; struct WebmInputContext { - uint32_t chunk; - uint32_t chunks; - uint32_t video_track; - struct nestegg *nestegg_ctx; - struct nestegg_packet *pkt; + void *reader; + void *segment; + uint8_t *buffer; + const void *cluster; + const void *block_entry; + const void *block; + int block_frame_index; + int video_track_index; + uint64_t timestamp_ns; + int is_key_frame; + int reached_eos; }; +// Checks if the input is a WebM file. If so, initializes WebMInputContext so +// that webm_read_frame can be called to retrieve a video frame. +// Returns 1 on success and 0 on failure or input is not WebM file. +// TODO(vigneshv): Refactor this function into two smaller functions specific +// to their task. int file_is_webm(struct WebmInputContext *webm_ctx, struct VpxInputContext *vpx_ctx); -int webm_read_frame(struct WebmInputContext *webm_ctx, - uint8_t **buffer, - size_t *bytes_in_buffer, +// Reads a WebM Video Frame. Memory for the buffer is created, owned and managed +// by this function. For the first call, |buffer| should be NULL and +// |*buffer_size| should be 0. Once all the frames are read and used, +// webm_free() should be called, otherwise there will be a leak. +// Parameters: +// webm_ctx - WebmInputContext object +// buffer - pointer where the frame data will be filled. +// buffer_size - pointer to buffer size. +// Return values: +// 0 - Success +// 1 - End of Stream +// -1 - Error +int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer, size_t *buffer_size); +// Guesses the frame rate of the input file based on the container timestamps. int webm_guess_framerate(struct WebmInputContext *webm_ctx, struct VpxInputContext *vpx_ctx); +// Resets the WebMInputContext. void webm_free(struct WebmInputContext *webm_ctx); #ifdef __cplusplus