27#include "config_components.h"
58#include <SDL_thread.h>
67#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
69#define EXTERNAL_CLOCK_MIN_FRAMES 2
70#define EXTERNAL_CLOCK_MAX_FRAMES 10
73#define SDL_AUDIO_MIN_BUFFER_SIZE 512
75#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC 30
78#define SDL_VOLUME_STEP (0.75)
81#define AV_SYNC_THRESHOLD_MIN 0.04
83#define AV_SYNC_THRESHOLD_MAX 0.1
85#define AV_SYNC_FRAMEDUP_THRESHOLD 0.1
87#define AV_NOSYNC_THRESHOLD 10.0
90#define SAMPLE_CORRECTION_PERCENT_MAX 10
93#define EXTERNAL_CLOCK_SPEED_MIN 0.900
94#define EXTERNAL_CLOCK_SPEED_MAX 1.010
95#define EXTERNAL_CLOCK_SPEED_STEP 0.001
98#define AUDIO_DIFF_AVG_NB 20
101#define REFRESH_RATE 0.01
105#define SAMPLE_ARRAY_SIZE (8 * 65536)
107#define CURSOR_HIDE_DELAY 1000000
109#define CHAPTER_LIST_FADE_TIME 250000
110#define CHAPTER_LIST_HOLD_TIME 500000
111#define CHAPTER_LIST_ROWS 7
149#define USE_ONEPASS_SUBTITLE_RENDER 1
167#define VIDEO_PICTURE_QUEUE_SIZE 3
168#define SUBPICTURE_QUEUE_SIZE 16
169#define SAMPLE_QUEUE_SIZE 9
170#define FRAME_QUEUE_SIZE FFMAX(SAMPLE_QUEUE_SIZE, FFMAX(VIDEO_PICTURE_QUEUE_SIZE, SUBPICTURE_QUEUE_SIZE))
448#define FF_QUIT_EVENT (SDL_USEREVENT + 2)
505 if (channel_count1 == 1 && channel_count2 == 1)
508 return channel_count1 != channel_count2 || fmt1 != fmt2;
530 SDL_CondSignal(q->
cond);
546 SDL_LockMutex(q->
mutex);
548 SDL_UnlockMutex(q->
mutex);
558 pkt->stream_index = stream_index;
569 q->
mutex = SDL_CreateMutex();
574 q->
cond = SDL_CreateCond();
587 SDL_LockMutex(q->
mutex);
594 SDL_UnlockMutex(q->
mutex);
601 SDL_DestroyMutex(q->
mutex);
602 SDL_DestroyCond(q->
cond);
607 SDL_LockMutex(q->
mutex);
611 SDL_CondSignal(q->
cond);
613 SDL_UnlockMutex(q->
mutex);
618 SDL_LockMutex(q->
mutex);
621 SDL_UnlockMutex(q->
mutex);
630 SDL_LockMutex(q->
mutex);
655 SDL_UnlockMutex(q->
mutex);
714 }
while (ret !=
AVERROR(EAGAIN));
744 if (got_frame && !d->
pkt->
data) {
762 av_log(d->
avctx,
AV_LOG_ERROR,
"Receive_frame and send_packet both returned EAGAIN, which is an API violation.\n");
786 if (!(
f->mutex = SDL_CreateMutex())) {
790 if (!(
f->cond = SDL_CreateCond())) {
796 f->keep_last = !!keep_last;
797 for (
i = 0;
i <
f->max_size;
i++)
806 for (
i = 0;
i <
f->max_size;
i++) {
811 SDL_DestroyMutex(
f->mutex);
812 SDL_DestroyCond(
f->cond);
817 SDL_LockMutex(
f->mutex);
818 SDL_CondSignal(
f->cond);
819 SDL_UnlockMutex(
f->mutex);
824 return &
f->queue[(
f->rindex +
f->rindex_shown) %
f->max_size];
829 return &
f->queue[(
f->rindex +
f->rindex_shown + 1) %
f->max_size];
834 return &
f->queue[
f->rindex];
840 SDL_LockMutex(
f->mutex);
841 while (
f->size >=
f->max_size &&
842 !
f->pktq->abort_request) {
843 SDL_CondWait(
f->cond,
f->mutex);
845 SDL_UnlockMutex(
f->mutex);
847 if (
f->pktq->abort_request)
850 return &
f->queue[
f->windex];
856 SDL_LockMutex(
f->mutex);
857 while (
f->size -
f->rindex_shown <= 0 &&
858 !
f->pktq->abort_request) {
859 SDL_CondWait(
f->cond,
f->mutex);
861 SDL_UnlockMutex(
f->mutex);
863 if (
f->pktq->abort_request)
866 return &
f->queue[(
f->rindex +
f->rindex_shown) %
f->max_size];
871 if (++
f->windex ==
f->max_size)
873 SDL_LockMutex(
f->mutex);
875 SDL_CondSignal(
f->cond);
876 SDL_UnlockMutex(
f->mutex);
881 if (
f->keep_last && !
f->rindex_shown) {
886 if (++
f->rindex ==
f->max_size)
888 SDL_LockMutex(
f->mutex);
890 SDL_CondSignal(
f->cond);
891 SDL_UnlockMutex(
f->mutex);
897 return f->size -
f->rindex_shown;
903 Frame *fp = &
f->queue[
f->rindex];
904 if (
f->rindex_shown && fp->
serial ==
f->pktq->serial)
930static int realloc_texture(SDL_Texture **texture, Uint32 new_format,
int new_width,
int new_height, SDL_BlendMode blendmode,
int init_texture)
934 if (!*texture || SDL_QueryTexture(*texture, &
format, &access, &
w, &
h) < 0 || new_width !=
w || new_height !=
h || new_format !=
format) {
938 SDL_DestroyTexture(*texture);
939 if (!(*texture = SDL_CreateTexture(
renderer, new_format, SDL_TEXTUREACCESS_STREAMING, new_width, new_height)))
941 if (SDL_SetTextureBlendMode(*texture, blendmode) < 0)
944 if (SDL_LockTexture(*texture,
NULL, &pixels, &pitch) < 0)
946 memset(pixels, 0, pitch * new_height);
947 SDL_UnlockTexture(*texture);
949 av_log(
NULL,
AV_LOG_VERBOSE,
"Created %dx%d texture with %s.\n", new_width, new_height, SDL_GetPixelFormatName(new_format));
955 int scr_xleft,
int scr_ytop,
int scr_width,
int scr_height,
956 int pic_width,
int pic_height,
AVRational pic_sar)
969 if (
width > scr_width) {
973 x = (scr_width -
width) / 2;
974 y = (scr_height -
height) / 2;
975 rect->
x = scr_xleft + x;
976 rect->
y = scr_ytop + y;
984 *sdl_blendmode = SDL_BLENDMODE_NONE;
985 *sdl_pix_fmt = SDL_PIXELFORMAT_UNKNOWN;
990 *sdl_blendmode = SDL_BLENDMODE_BLEND;
1003 SDL_BlendMode sdl_blendmode;
1005 if (
realloc_texture(tex, sdl_pix_fmt == SDL_PIXELFORMAT_UNKNOWN ? SDL_PIXELFORMAT_ARGB8888 : sdl_pix_fmt,
frame->width,
frame->height, sdl_blendmode, 0) < 0)
1007 switch (sdl_pix_fmt) {
1008 case SDL_PIXELFORMAT_IYUV:
1009 if (
frame->linesize[0] > 0 &&
frame->linesize[1] > 0 &&
frame->linesize[2] > 0) {
1010 ret = SDL_UpdateYUVTexture(*tex,
NULL,
frame->data[0],
frame->linesize[0],
1013 }
else if (
frame->linesize[0] < 0 &&
frame->linesize[1] < 0 &&
frame->linesize[2] < 0) {
1014 ret = SDL_UpdateYUVTexture(*tex,
NULL,
frame->data[0] +
frame->linesize[0] * (
frame->height - 1), -
frame->linesize[0],
1023 if (
frame->linesize[0] < 0) {
1024 ret = SDL_UpdateTexture(*tex,
NULL,
frame->data[0] +
frame->linesize[0] * (
frame->height - 1), -
frame->linesize[0]);
1026 ret = SDL_UpdateTexture(*tex,
NULL,
frame->data[0],
frame->linesize[0]);
1046#if SDL_VERSION_ATLEAST(2,0,8)
1047 SDL_YUV_CONVERSION_MODE
mode = SDL_YUV_CONVERSION_AUTOMATIC;
1050 mode = SDL_YUV_CONVERSION_JPEG;
1052 mode = SDL_YUV_CONVERSION_BT709;
1054 mode = SDL_YUV_CONVERSION_BT601;
1056 SDL_SetYUVConversionMode(
mode);
1063 SDL_Rect *
rect = &
is->render_params.target_rect;
1064 SDL_BlendMode blendMode;
1066 if (!SDL_GetTextureBlendMode(
is->vid_texture, &blendMode) && blendMode == SDL_BLENDMODE_BLEND) {
1067 switch (
is->render_params.video_background_type) {
1069 SDL_SetRenderDrawColor(
renderer, 237, 237, 237, 255);
1071 SDL_SetRenderDrawColor(
renderer, 222, 222, 222, 255);
1072 for (
int x = 0; x <
rect->
w; x += tile_size * 2)
1074 for (
int y = 0; y <
rect->
h; y += tile_size * 2)
1076 SDL_SetRenderDrawColor(
renderer, 237, 237, 237, 255);
1077 for (
int y = 0; y <
rect->
h; y += tile_size * 2) {
1079 for (
int x = 0; x <
rect->
w; x += tile_size * 2)
1084 const uint8_t *
c =
is->render_params.video_background_color;
1085 SDL_SetRenderDrawColor(
renderer,
c[0],
c[1],
c[2],
c[3]);
1090 SDL_SetTextureBlendMode(
is->vid_texture, SDL_BLENDMODE_NONE);
1103 if (!
is->chapter_bitmap)
1105 if (!
is->chapter_pinned)
1114 return tag ?
tag->value :
"";
1129 rank *= 0x2C1B3C6Du;
1130 return rank ^ rank >> 12;
1145 default:
cmp = ra->
index - rb->index;
break;
1174 int selected =
is->nb_chapter_rows ?
is->chapter_rows[
is->chapter_selected].index : 0;
1179 is->chapter_rows = rows;
1180 is->nb_chapter_rows = 0;
1181 for (
int i = 0;
i <
is->ic->nb_chapters;
i++) {
1186 (uint64_t)chapter->
end - chapter->
start <= INT64_MAX)
1189 is->chapter_rows[
is->nb_chapter_rows++] = row;
1192 is->chapter_selected = 0;
1193 for (
int row = 0; row <
is->nb_chapter_rows; row++)
1194 if (
is->chapter_rows[row].index == selected)
1195 is->chapter_selected = row;
1199static const struct {
1210#define CHAPTER_LIST_EVENT "Dialogue: 0:00:00.00,9999:00:00.00,"
1214 av_bprintf(script,
CHAPTER_LIST_EVENT "%s,{\\pos(%d,%d)\\p1}m 0 0 l %d 0 %d %d 0 %d{\\p0}\n", style, x, y,
w,
w,
h,
h);
1218static void bprint_chapter_cell(AVBPrint *script,
const char *style,
int x,
int y,
int right,
int bottom,
const char *text)
1220 av_bprintf(script,
CHAPTER_LIST_EVENT "%s,{\\pos(%d,%d)\\clip(0,0,%d,%d)}", style, x, y, right, bottom);
1221 for (; *text; text++)
1247 y += l.
font * 3 / 2;
1251 x +=
w + l.
font / 4;
1256 y += l.
font * 3 / 2;
1285 if (y >= l->
rows_y && line < l->nb_rows) {
1299 int k =
r * 552 / 1000;
1302 "b %d %d %d %d %d %d b %d %d 0 %d 0 %d{\\p0}\n",
1303 cx, cy,
r,
r - k,
r - k,
r,
r + k, 2 *
r,
r - k, 2 *
r,
r, 2 *
r,
r + k,
r + k, 2 *
r,
r, 2 *
r,
1304 r - k, 2 *
r,
r + k,
r);
1315 "[Script Info]\nScriptType: v4.00+\nPlayResX: %d\nPlayResY: %d\nWrapStyle: 2\nYCbCr Matrix: None\n\n"
1317 "Format: Name, Fontname, Fontsize, PrimaryColour, OutlineColour, Bold, Outline, Alignment\n"
1318 "Style: Button,Sans,%d,&H80FFFFFF,&H80FFFFFF,0,0,7\n"
1319 "Style: Row,Sans,%d,&H00FFFFFF,&H00000000,0,%d,7\n"
1320 "Style: Selected,Sans,%d,&H0080D0FF,&H00000000,-1,%d,7\n"
1321 "Style: Artist,Sans,%d,&H00C0C0C0,&H00000000,0,%d,7\n"
1322 "Style: ArtistSelected,Sans,%d,&H0080D0FF,&H00000000,-1,%d,7\n"
1323 "Style: Playing,Sans,%d,&H00FFFFFF,&H00FFFFFF,0,0,7\n"
1324 "Style: Hint,Sans,%d,&H00A0A0A0,&H00000000,0,%d,7\n"
1325 "Style: ButtonHover,Sans,%d,&H50FFFFFF,&H50FFFFFF,0,0,7\n"
1326 "Style: Ring,Sans,%d,&HFF000000,&H00A0A0A0,0,%d,7\n"
1327 "Style: Detail,Sans,%d,&H00FFFFFF,&H00000000,0,%d,7\n\n"
1328 "[Events]\nFormat: Start, End, Style, Text\n",
1336 if (
is->chapter_pinned)
1338 l->
search_y + l->
font * 3 / 2, *
is->chapter_search ?
is->chapter_search :
"type to search");
1344 x +
w / 2, y + l->
font * 5 / 8);
1356 const char *style =
r ==
is->chapter_selected ?
"Selected" :
"Row";
1359 if (row->
index ==
is->chapter_playing)
1371 if (seconds >= 3600)
1372 av_bprintf(script,
"%"PRId64
":%02d:%02d\n", seconds / 3600, (
int)(seconds / 60 % 60), (
int)(seconds % 60));
1374 av_bprintf(script,
"%d:%02d\n", (
int)(seconds / 60), (
int)(seconds % 60));
1383 if (!(*nb & (*nb - 1))) {
1391 if (!(*strips)[*nb].script)
1406 for (
int i = 0; ret >= 0 &&
i < l->
nb_rows + 2;
i++) {
1421 if (ret >= 0 &&
is->chapter_hover.detail) {
1431 for (
int top = 0; ret >= 0 && top <
height && (above ||
tag); top += l->
font) {
1437 for (
int i = 0;
i < 2;
i++) {
1456 for (
int i = 0;
i < *nb;
i++)
1467 if (
is->chapter_texture)
1468 SDL_DestroyTexture(
is->chapter_texture);
1469 is->chapter_texture =
NULL;
1477 char source_args[64];
1481 static int reported;
1488 is->chapter_rect = *canvas;
1497 snprintf(source_args,
sizeof(source_args),
"color=black@0:rate=1:size=%dx%d", l->
canvas_w, l->
strip_h);
1500 if (!ass || !
is->chapter_sink)
1520 uint32_t
scale[256] = { 1 << 16 };
1525 for (
int a = 1;
a < 256;
a++)
1526 scale[
a] = ((255 << 16) +
a - 1) /
a;
1531 for (
int y = 0; ret >= 0 && y < strip->
rect.h; y++) {
1532 const uint8_t *
src =
frame->data[0] + y *
frame->linesize[0] + strip->
rect.x * 4;
1533 uint8_t *
dst =
is->chapter_bitmap + ((strip->
rect.y + y) *
is->chapter_rect.w + strip->
rect.x) * 4;
1535 for (
int x = 0; x < strip->
rect.w * 4; x += 4)
1536 for (
int c = 0;
c < 4;
c++)
1545 SDL_UnionRect(&
is->chapter_dirty,
rect, &
is->chapter_dirty);
1546 is->force_refresh = 1;
1556 if (!
shift || kept <= 0 || is->nb_chapter_strips <= l->nb_rows || nb <= l->nb_rows)
1559 for (
int j = 0; j < l->
nb_rows; j++) {
1562 if (!SDL_RectEquals(&rows[j].
rect, &slot) || !SDL_RectEquals(&strips[j + 1].
rect, &slot))
1565 for (
int i = 0;
i <
is->nb_chapter_strips;
i++) {
1567 SDL_UnionRect(&popup, &
is->chapter_strips[
i].rect, &popup);
1568 is->chapter_strips[
i].background =
NULL;
1571 for (
int j = 0; j < l->
nb_rows; j++)
1572 if (SDL_HasIntersection(&rows[j].
rect, &popup))
1574 for (
int k = 0; k < kept * l->
line; k++) {
1577 memcpy(
is->chapter_bitmap + y *
is->chapter_rect.w * 4,
is->chapter_bitmap + (y -
shift * l->
line) *
is->chapter_rect.w * 4,
1585 for (
int j = 0; j < l->
nb_rows; j++)
1596 int nb = 0, ret = 0;
1598 is->chapter_render_pending = 0;
1600 if (!
is->chapter_graph || !SDL_RectEquals(&
is->chapter_rect, &canvas))
1608 for (
int i = 0; ret >= 0 &&
i <
is->nb_chapter_strips;
i++) {
1609 const SDL_Rect *old = &
is->chapter_strips[
i].rect;
1611 if (
i < nb && SDL_RectEquals(old, &strips[
i].
rect))
1613 for (
int y = 0; y < old->h; y++)
1614 memset(
is->chapter_bitmap + ((old->y + y) *
is->chapter_rect.w + old->x) * 4, 0, old->w * 4);
1615 SDL_UnionRect(&redrawn, old, &redrawn);
1618 for (
int i = 0; ret >= 0 &&
i < nb;
i++) {
1622 !strcmp(old->
script, strips[
i].
script) && !SDL_HasIntersection(&strips[
i].
rect, &redrawn))
1626 SDL_UnionRect(&redrawn, &strips[
i].
rect, &redrawn);
1634 is->chapter_pinned = 0;
1635 SDL_StopTextInput();
1638 is->chapter_strips = strips;
1639 is->nb_chapter_strips = nb;
1648 is->chapter_selected = row;
1650 is->chapter_last_input = now;
1651 is->chapter_render_pending = 1;
1661 for (
int row = 0; row <
is->nb_chapter_rows; row++)
1662 if (
is->chapter_rows[row].index == chapter)
1663 is->chapter_selected = row;
1670 if (
is->nb_chapter_rows)
1682 int len = strlen(
is->chapter_search);
1685 if (
len + strlen(typed) <
sizeof(
is->chapter_search))
1686 av_strlcat(
is->chapter_search, typed,
sizeof(
is->chapter_search));
1688 while (
len > 0 && (
is->chapter_search[--
len] & 0xC0) == 0x80)
1690 is->chapter_search[
len] = 0;
1693 is->chapter_render_pending = 1;
1700 is->chapter_pinned = pinned;
1703 if (
is->chapter_pinned)
1704 SDL_StartTextInput();
1706 SDL_StopTextInput();
1708 is->chapter_search[0] = 0;
1710 is->chapter_render_pending = 1;
1726 if (
is->nb_chapter_rows)
1739 is->chapter_mouse_x = x;
1740 is->chapter_mouse_y = y;
1745 if (hit.
row !=
is->chapter_hover.row || hit.
button !=
is->chapter_hover.button || hit.
detail !=
is->chapter_hover.detail)
1746 is->chapter_render_pending = 1;
1770 SDL_Rect *dirty = &
is->chapter_dirty;
1772 is->chapter_drawn_alpha =
alpha;
1775 if (dirty->w && !SDL_UpdateTexture(
is->chapter_texture, dirty,
1776 is->chapter_bitmap + (dirty->y *
is->chapter_rect.w + dirty->x) * 4,
is->chapter_rect.w * 4))
1777 *dirty = (SDL_Rect){ 0, 0, 0, 0 };
1778 SDL_SetTextureAlphaMod(
is->chapter_texture,
alpha * 255);
1786 SDL_Rect *
rect = &
is->render_params.target_rect;
1795 if (
is->subtitle_st) {
1823 if (!
is->sub_convert_ctx) {
1827 if (!SDL_LockTexture(
is->sub_texture, (SDL_Rect *)sub_rect, (
void **)pixels, pitch)) {
1829 0, sub_rect->
h, pixels, pitch);
1830 SDL_UnlockTexture(
is->sub_texture);
1855#if USE_ONEPASS_SUBTITLE_RENDER
1862 SDL_Rect *sub_rect = (SDL_Rect*)sp->
sub.
rects[
i];
1863 SDL_Rect target = {.x =
rect.
x + sub_rect->x * xratio,
1864 .y =
rect.
y + sub_rect->y * yratio,
1865 .w = sub_rect->w * xratio,
1866 .h = sub_rect->h * yratio};
1867 SDL_RenderCopy(
renderer,
is->sub_texture, sub_rect, &target);
1875 return a < 0 ?
a%
b +
b :
a%
b;
1880 int i, i_start, x, y1, y, ys, delay, n, nb_display_channels;
1883 int rdft_bits, nb_freq;
1885 for (rdft_bits = 1; (1 << rdft_bits) < 2 *
s->height; rdft_bits++)
1887 nb_freq = 1 << (rdft_bits - 1);
1890 channels =
s->audio_tgt.ch_layout.nb_channels;
1893 int data_used=
s->show_mode == SHOW_MODE_WAVES ?
s->width : (2*nb_freq);
1895 delay =
s->audio_write_buf_size;
1902 delay -= (time_diff *
s->audio_tgt.freq) / 1000000;
1905 delay += 2 * data_used;
1906 if (delay < data_used)
1910 if (
s->show_mode == SHOW_MODE_WAVES) {
1914 int a =
s->sample_array[idx];
1919 if (
h < score && (
b ^
c) < 0) {
1926 s->last_i_start = i_start;
1928 i_start =
s->last_i_start;
1931 if (
s->show_mode == SHOW_MODE_WAVES) {
1932 SDL_SetRenderDrawColor(
renderer, 255, 255, 255, 255);
1935 h =
s->height / nb_display_channels;
1938 for (ch = 0; ch < nb_display_channels; ch++) {
1940 y1 =
s->ytop + ch *
h + (
h / 2);
1941 for (x = 0; x <
s->width; x++) {
1942 y = (
s->sample_array[
i] * h2) >> 15;
1956 SDL_SetRenderDrawColor(
renderer, 0, 0, 255, 255);
1958 for (ch = 1; ch < nb_display_channels; ch++) {
1959 y =
s->ytop + ch *
h;
1964 if (
realloc_texture(&
s->vis_texture, SDL_PIXELFORMAT_ARGB8888,
s->width,
s->height, SDL_BLENDMODE_NONE, 1) < 0)
1967 if (
s->xpos >=
s->width)
1969 nb_display_channels=
FFMIN(nb_display_channels, 2);
1970 if (rdft_bits !=
s->rdft_bits) {
1971 const float rdft_scale = 1.0;
1975 s->rdft_bits = rdft_bits;
1979 0, 1 << rdft_bits, &rdft_scale, 0);
1981 if (err < 0 || !s->rdft_data) {
1983 s->show_mode = SHOW_MODE_WAVES;
1987 SDL_Rect
rect = {.x =
s->xpos, .y = 0, .w = 1, .h =
s->height};
1990 for (ch = 0; ch < nb_display_channels; ch++) {
1991 data_in[ch] =
s->real_data + 2 * nb_freq * ch;
1992 data[ch] =
s->rdft_data + nb_freq * ch;
1994 for (x = 0; x < 2 * nb_freq; x++) {
1995 double w = (x-nb_freq) * (1.0 / nb_freq);
1996 data_in[ch][x] =
s->sample_array[
i] * (1.0 -
w *
w);
2001 s->rdft_fn(
s->rdft,
data[ch], data_in[ch],
sizeof(
float));
2002 data[ch][0].im =
data[ch][nb_freq].re;
2003 data[ch][nb_freq].re = 0;
2007 if (!SDL_LockTexture(
s->vis_texture, &
rect, (
void **)&pixels, &pitch)) {
2009 pixels += pitch *
s->height;
2010 for (y = 0; y <
s->height; y++) {
2011 double w = 1 / sqrt(nb_freq);
2012 int a = sqrt(
w * sqrt(
data[0][y].re *
data[0][y].re +
data[0][y].im *
data[0][y].im));
2013 int b = (nb_display_channels == 2 ) ? sqrt(
w * hypot(
data[1][y].re,
data[1][y].im))
2018 *pixels = (
a << 16) + (
b << 8) + ((
a+
b) >> 1);
2020 SDL_UnlockTexture(
s->vis_texture);
2038 sti = ici->
streams[stream_index];
2060 if (stream_index < 0 || stream_index >= ic->
nb_streams)
2073 is->audio_buf1_size = 0;
2100 is->audio_stream = -1;
2104 is->video_stream = -1;
2108 is->subtitle_stream = -1;
2118 is->abort_request = 1;
2119 SDL_WaitThread(
is->read_tid,
NULL);
2122 if (
is->audio_stream >= 0)
2124 if (
is->video_stream >= 0)
2126 if (
is->subtitle_stream >= 0)
2150 SDL_DestroyCond(
is->continue_read_thread);
2153 if (
is->vis_texture)
2154 SDL_DestroyTexture(
is->vis_texture);
2155 if (
is->vid_texture)
2156 SDL_DestroyTexture(
is->vid_texture);
2157 if (
is->sub_texture)
2158 SDL_DestroyTexture(
is->sub_texture);
2174 SDL_DestroyWindow(
window);
2203 if (max_width == INT_MAX && max_height == INT_MAX)
2224 SDL_SetWindowFullscreen(
window, SDL_WINDOW_FULLSCREEN_DESKTOP);
2239 SDL_SetRenderDrawColor(
renderer, 0, 0, 0, 255);
2241 if (
is->audio_st &&
is->show_mode != SHOW_MODE_VIDEO)
2243 else if (
is->video_st)
2251 if (*
c->queue_serial !=
c->serial)
2257 return c->pts_drift + time - (time -
c->last_updated) * (1.0 -
c->speed);
2264 c->last_updated = time;
2265 c->pts_drift =
c->pts - time;
2285 c->queue_serial = queue_serial;
2340 double speed =
is->extclk.speed;
2349 if (!
is->seek_req) {
2356 SDL_CondSignal(
is->continue_read_thread);
2365 if (
is->read_pause_return !=
AVERROR(ENOSYS)) {
2366 is->vidclk.paused = 0;
2371 is->paused =
is->audclk.paused =
is->vidclk.paused =
is->extclk.paused = !
is->paused;
2382 is->muted = !
is->muted;
2387 double volume_level =
is->audio_volume ? (20 * log(
is->audio_volume / (
double)SDL_MIX_MAXVOLUME) / log(10)) : -1000.0;
2388 int new_volume =
lrint(SDL_MIX_MAXVOLUME * pow(10.0, (volume_level + sign * step) / 20.0));
2389 is->audio_volume =
av_clip(
is->audio_volume == new_volume ? (
is->audio_volume + sign) : new_volume, 0, SDL_MIX_MAXVOLUME);
2402 double sync_threshold,
diff = 0;
2415 if (
diff <= -sync_threshold)
2418 delay = delay +
diff;
2419 else if (
diff >= sync_threshold)
2462 if (
is->force_refresh ||
is->last_vis_time +
rdftspeed < time) {
2464 is->last_vis_time = time;
2466 *remaining_time =
FFMIN(*remaining_time,
is->last_vis_time +
rdftspeed - time);
2474 double last_duration,
duration, delay;
2481 if (vp->
serial !=
is->videoq.serial) {
2497 if (time < is->frame_timer + delay) {
2498 *remaining_time =
FFMIN(
is->frame_timer + delay - time, *remaining_time);
2502 is->frame_timer += delay;
2504 is->frame_timer = time;
2506 SDL_LockMutex(
is->pictq.mutex);
2507 if (!isnan(vp->
pts))
2509 SDL_UnlockMutex(
is->pictq.mutex);
2515 is->frame_drops_late++;
2521 if (
is->subtitle_st) {
2530 if (sp->
serial !=
is->subtitleq.serial
2541 if (!SDL_LockTexture(
is->sub_texture, (SDL_Rect *)sub_rect, (
void **)&pixels, &pitch)) {
2542 for (j = 0; j < sub_rect->
h; j++, pixels += pitch)
2543 memset(pixels, 0, sub_rect->
w << 2);
2544 SDL_UnlockTexture(
is->sub_texture);
2556 is->force_refresh = 1;
2558 if (
is->step && !
is->paused)
2563 if (!
display_disable &&
is->force_refresh &&
is->show_mode == SHOW_MODE_VIDEO &&
is->pictq.rindex_shown)
2566 is->force_refresh = 0;
2571 int aqsize, vqsize, sqsize;
2575 if (!last_time || (cur_time - last_time) >= 30000) {
2580 aqsize =
is->audioq.size;
2582 vqsize =
is->videoq.size;
2583 if (
is->subtitle_st)
2584 sqsize =
is->subtitleq.size;
2586 if (
is->audio_st &&
is->video_st)
2588 else if (
is->video_st)
2590 else if (
is->audio_st)
2595 "%7.2f %s:%7.3f fd=%4d aq=%5dKB vq=%5dKB sq=%5dB \r",
2597 (
is->audio_st &&
is->video_st) ?
"A-V" : (
is->video_st ?
"M-V" : (
is->audio_st ?
"M-A" :
" ")),
2599 is->frame_drops_early +
is->frame_drops_late,
2605 fprintf(stderr,
"%s", buf.str);
2612 last_time = cur_time;
2621#if defined(DEBUG_SYNC)
2622 printf(
"frame_type=%c pts=%0.3f\n",
2667 diff -
is->frame_last_filter_delay < 0 &&
2668 is->viddec.pkt_serial ==
is->vidclk.serial &&
2669 is->videoq.nb_packets) {
2670 is->frame_drops_early++;
2697 outputs->filter_ctx = source_ctx;
2702 inputs->filter_ctx = sink_ctx;
2727 char sws_flags_str[512] =
"";
2733 int nb_pix_fmts = 0;
2750 if (!strcmp(e->
key,
"sws_flags")) {
2751 av_strlcatf(sws_flags_str,
sizeof(sws_flags_str),
"%s=%s:",
"flags", e->
value);
2755 if (strlen(sws_flags_str))
2756 sws_flags_str[strlen(sws_flags_str)-1] =
'\0';
2787 "ffplay_buffersink");
2811 last_filter = filt_out;
2815#define INSERT_FILT(name, arg) do { \
2816 AVFilterContext *filt_ctx; \
2818 ret = avfilter_graph_create_filter(&filt_ctx, \
2819 avfilter_get_by_name(name), \
2820 "ffplay_" name, arg, NULL, graph); \
2824 ret = avfilter_link(filt_ctx, 0, last_filter, 0); \
2828 last_filter = filt_ctx; \
2837 if (!displaymatrix) {
2839 is->video_st->codecpar->nb_coded_side_data,
2846 if (
fabs(theta - 90) < 1.0) {
2847 INSERT_FILT(
"transpose", displaymatrix[3] > 0 ?
"cclock_flip" :
"clock");
2848 }
else if (
fabs(theta - 180) < 1.0) {
2849 if (displaymatrix[0] < 0)
2851 if (displaymatrix[4] < 0)
2853 }
else if (
fabs(theta - 270) < 1.0) {
2854 INSERT_FILT(
"transpose", displaymatrix[3] < 0 ?
"clock_flip" :
"cclock");
2855 }
else if (
fabs(theta) > 1.0) {
2856 char rotate_buf[64];
2857 snprintf(rotate_buf,
sizeof(rotate_buf),
"%f*PI/180", theta);
2860 if (displaymatrix && displaymatrix[4] < 0)
2868 is->in_video_filter = filt_src;
2869 is->out_video_filter = filt_out;
2879 char aresample_swr_opts[512] =
"";
2882 char asrc_args[256];
2894 if (strlen(aresample_swr_opts))
2895 aresample_swr_opts[strlen(aresample_swr_opts)-1] =
'\0';
2896 av_opt_set(
is->agraph,
"aresample_swr_opts", aresample_swr_opts, 0);
2900 ret = snprintf(asrc_args,
sizeof(asrc_args),
2901 "sample_rate=%d:sample_fmt=%s:time_base=%d/%d:channel_layout=%s",
2903 1,
is->audio_filter_src.freq, bp.str);
2907 asrc_args,
NULL,
is->agraph);
2912 "ffplay_abuffersink");
2921 if (force_output_format) {
2937 is->in_audio_filter = filt_asrc;
2938 is->out_audio_filter = filt_asink;
2953 int last_serial = -1;
2971 frame->format,
frame->ch_layout.nb_channels) ||
2973 is->audio_filter_src.freq !=
frame->sample_rate ||
2974 is->auddec.pkt_serial != last_serial;
2977 char buf1[1024], buf2[1024];
2981 "Audio frame changed from rate:%d ch:%d fmt:%s layout:%s serial:%d to rate:%d ch:%d fmt:%s layout:%s serial:%d\n",
2982 is->audio_filter_src.freq,
is->audio_filter_src.ch_layout.nb_channels,
av_get_sample_fmt_name(
is->audio_filter_src.fmt), buf1, last_serial,
2985 is->audio_filter_src.fmt =
frame->format;
2989 is->audio_filter_src.freq =
frame->sample_rate;
2990 last_serial =
is->auddec.pkt_serial;
3007 af->
serial =
is->auddec.pkt_serial;
3013 if (
is->audioq.serial !=
is->auddec.pkt_serial)
3017 is->auddec.finished =
is->auddec.pkt_serial;
3052 int last_serial = -1;
3053 int last_vfilter_idx = 0;
3065 if ( last_w !=
frame->width
3066 || last_h !=
frame->height
3067 || last_format !=
frame->format
3068 || last_serial !=
is->viddec.pkt_serial
3069 || last_vfilter_idx !=
is->vfilter_idx) {
3071 "Video frame changed from size:%dx%d format:%s serial:%d to size:%dx%d format:%s serial:%d\n",
3086 event.user.data1 =
is;
3087 SDL_PushEvent(&event);
3090 filt_in =
is->in_video_filter;
3091 filt_out =
is->out_video_filter;
3092 last_w =
frame->width;
3093 last_h =
frame->height;
3094 last_format =
frame->format;
3095 last_serial =
is->viddec.pkt_serial;
3096 last_vfilter_idx =
is->vfilter_idx;
3112 is->viddec.finished =
is->viddec.pkt_serial;
3121 is->frame_last_filter_delay = 0;
3127 if (
is->videoq.serial !=
is->viddec.pkt_serial)
3156 if (got_subtitle && sp->
sub.
format == 0) {
3160 sp->
serial =
is->subdec.pkt_serial;
3161 sp->
width =
is->subdec.avctx->width;
3162 sp->
height =
is->subdec.avctx->height;
3167 }
else if (got_subtitle) {
3179 size = samples_size /
sizeof(short);
3184 memcpy(
is->sample_array +
is->sample_array_index, samples,
len *
sizeof(
short));
3186 is->sample_array_index +=
len;
3188 is->sample_array_index = 0;
3197 int wanted_nb_samples = nb_samples;
3201 double diff, avg_diff;
3202 int min_nb_samples, max_nb_samples;
3207 is->audio_diff_cum =
diff +
is->audio_diff_avg_coef *
is->audio_diff_cum;
3210 is->audio_diff_avg_count++;
3213 avg_diff =
is->audio_diff_cum * (1.0 -
is->audio_diff_avg_coef);
3215 if (
fabs(avg_diff) >=
is->audio_diff_threshold) {
3216 wanted_nb_samples = nb_samples + (int)(
diff *
is->audio_src.freq);
3219 wanted_nb_samples =
av_clip(wanted_nb_samples, min_nb_samples, max_nb_samples);
3222 diff, avg_diff, wanted_nb_samples - nb_samples,
3223 is->audio_clock,
is->audio_diff_threshold);
3228 is->audio_diff_avg_count = 0;
3229 is->audio_diff_cum = 0;
3233 return wanted_nb_samples;
3245 int data_size, resampled_data_size;
3247 int wanted_nb_samples;
3264 }
while (af->
serial !=
is->audioq.serial);
3279 &
is->audio_tgt.ch_layout,
is->audio_tgt.fmt,
is->audio_tgt.freq,
3284 "Cannot create sample rate converter for conversion of %d Hz %s %d channels to %d Hz %s %d channels!\n",
3298 uint8_t **
out = &
is->audio_buf1;
3314 if (!
is->audio_buf1)
3321 if (len2 == out_count) {
3326 is->audio_buf =
is->audio_buf1;
3330 resampled_data_size = data_size;
3333 audio_clock0 =
is->audio_clock;
3335 if (!isnan(af->
pts))
3338 is->audio_clock =
NAN;
3339 is->audio_clock_serial = af->
serial;
3342 static double last_clock;
3343 printf(
"audio: delay=%0.3f clock=%0.3f clock0=%0.3f\n",
3344 is->audio_clock - last_clock,
3345 is->audio_clock, audio_clock0);
3346 last_clock =
is->audio_clock;
3349 return resampled_data_size;
3356 int audio_size, len1;
3361 if (
is->audio_buf_index >=
is->audio_buf_size) {
3363 if (audio_size < 0) {
3368 if (
is->show_mode != SHOW_MODE_VIDEO)
3370 is->audio_buf_size = audio_size;
3372 is->audio_buf_index = 0;
3374 len1 =
is->audio_buf_size -
is->audio_buf_index;
3377 if (!
is->muted &&
is->audio_buf &&
is->audio_volume == SDL_MIX_MAXVOLUME)
3378 memcpy(stream, (uint8_t *)
is->audio_buf +
is->audio_buf_index, len1);
3380 memset(stream, 0, len1);
3381 if (!
is->muted &&
is->audio_buf)
3382 SDL_MixAudioFormat(stream, (uint8_t *)
is->audio_buf +
is->audio_buf_index, AUDIO_S16SYS, len1,
is->audio_volume);
3386 is->audio_buf_index += len1;
3388 is->audio_write_buf_size =
is->audio_buf_size -
is->audio_buf_index;
3390 if (!isnan(
is->audio_clock)) {
3398 SDL_AudioSpec wanted_spec, spec;
3400 static const int next_nb_channels[] = {0, 0, 1, 6, 2, 6, 4, 6};
3401 static const int next_sample_rates[] = {0, 44100, 48000, 96000, 192000};
3402 int next_sample_rate_idx =
FF_ARRAY_ELEMS(next_sample_rates) - 1;
3403 int wanted_nb_channels = wanted_channel_layout->
nb_channels;
3405 env = SDL_getenv(
"SDL_AUDIO_CHANNELS");
3407 wanted_nb_channels = atoi(env);
3415 wanted_nb_channels = wanted_channel_layout->
nb_channels;
3416 wanted_spec.channels = wanted_nb_channels;
3417 wanted_spec.freq = wanted_sample_rate;
3418 if (wanted_spec.freq <= 0 || wanted_spec.channels <= 0) {
3422 while (next_sample_rate_idx && next_sample_rates[next_sample_rate_idx] >= wanted_spec.freq)
3423 next_sample_rate_idx--;
3424 wanted_spec.format = AUDIO_S16SYS;
3425 wanted_spec.silence = 0;
3428 wanted_spec.userdata = opaque;
3429 while (!(
audio_dev = SDL_OpenAudioDevice(
NULL, 0, &wanted_spec, &spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))) {
3431 wanted_spec.channels, wanted_spec.freq, SDL_GetError());
3432 wanted_spec.channels = next_nb_channels[
FFMIN(7, wanted_spec.channels)];
3433 if (!wanted_spec.channels) {
3434 wanted_spec.freq = next_sample_rates[next_sample_rate_idx--];
3435 wanted_spec.channels = wanted_nb_channels;
3436 if (!wanted_spec.freq) {
3438 "No more combinations to try, audio open failed\n");
3444 if (spec.format != AUDIO_S16SYS) {
3446 "SDL advised audio format %d is not supported!\n", spec.format);
3449 if (spec.channels != wanted_spec.channels) {
3454 "SDL advised channel count %d is not supported!\n", spec.channels);
3460 audio_hw_params->
freq = spec.freq;
3581 lcevc_sti->
group = stgi;
3593 const char *forced_codec_name =
NULL;
3598 int stream_lowres =
lowres;
3600 if (stream_index < 0 || stream_index >= ic->
nb_streams)
3619 if (forced_codec_name)
3623 "No codec could be found with name '%s'\n", forced_codec_name);
3636 avctx->
lowres = stream_lowres;
3680 sink =
is->out_audio_filter;
3688 if ((ret =
audio_open(
is, &ch_layout, sample_rate, &
is->audio_tgt)) < 0)
3690 is->audio_hw_buf_size = ret;
3691 is->audio_src =
is->audio_tgt;
3692 is->audio_buf_size = 0;
3693 is->audio_buf_index = 0;
3697 is->audio_diff_avg_count = 0;
3700 is->audio_diff_threshold = (
double)(
is->audio_hw_buf_size) /
is->audio_tgt.bytes_per_sec;
3702 is->audio_stream = stream_index;
3703 is->audio_st = ic->
streams[stream_index];
3705 if ((ret =
decoder_init(&
is->auddec, avctx, &
is->audioq,
is->continue_read_thread)) < 0)
3708 is->auddec.start_pts =
is->audio_st->start_time;
3709 is->auddec.start_pts_tb =
is->audio_st->time_base;
3716 is->video_stream = stream_index;
3717 is->video_st = ic->
streams[stream_index];
3723 if ((ret =
decoder_init(&
is->viddec, avctx, &
is->videoq,
is->continue_read_thread)) < 0)
3727 is->queue_attachments_req = 1;
3730 is->subtitle_stream = stream_index;
3731 is->subtitle_st = ic->
streams[stream_index];
3733 if ((ret =
decoder_init(&
is->subdec, avctx, &
is->subtitleq,
is->continue_read_thread)) < 0)
3755 return is->abort_request;
3759 return stream_id < 0 ||
3767 if( !strcmp(
s->iformat->name,
"rtp")
3768 || !strcmp(
s->iformat->name,
"rtsp")
3769 || !strcmp(
s->iformat->name,
"sdp")
3773 if(
s->pb && ( !strncmp(
s->url,
"rtp:", 4)
3774 || !strncmp(
s->url,
"udp:", 4)
3804 "Error applying bitstream filters to a packet: %s\n",
3824 if (!stgi || !stgi->
graph)
3849 char metadata_description[96];
3850 int pkt_in_play_range = 0;
3852 SDL_mutex *wait_mutex = SDL_CreateMutex();
3853 int scan_all_pmts_set = 0;
3862 memset(st_index, -1,
sizeof(st_index));
3887 scan_all_pmts_set = 1;
3895 if (scan_all_pmts_set)
3914 "Error setting up avformat_find_stream_info() options\n");
3921 for (
i = 0;
i < orig_nb_streams;
i++)
3927 "%s: could not find codec parameters\n",
is->filename);
3964 fprintf(stderr,
"\x1b[2K\r");
4033 st_index[
i] = INT_MAX;
4061 if (codecpar->
width)
4074 if (
is->show_mode == SHOW_MODE_NONE)
4075 is->show_mode = ret >= 0 ? SHOW_MODE_VIDEO : SHOW_MODE_RDFT;
4081 if (
is->video_stream < 0 &&
is->audio_stream < 0) {
4092 if (
is->abort_request)
4094 if (
is->paused !=
is->last_paused) {
4095 is->last_paused =
is->paused;
4101#if CONFIG_RTSP_DEMUXER || CONFIG_MMSH_PROTOCOL
4113 int64_t seek_min =
is->seek_rel > 0 ? seek_target -
is->seek_rel + 2: INT64_MIN;
4114 int64_t seek_max =
is->seek_rel < 0 ? seek_target -
is->seek_rel - 2: INT64_MAX;
4121 "%s: error while seeking\n",
is->ic->url);
4123 if (
is->audio_stream >= 0)
4125 if (
is->subtitle_stream >= 0)
4127 if (
is->video_stream >= 0) {
4142 is->queue_attachments_req = 1;
4147 if (
is->queue_attachments_req) {
4154 is->queue_attachments_req = 0;
4164 SDL_LockMutex(wait_mutex);
4165 SDL_CondWaitTimeout(
is->continue_read_thread, wait_mutex, 10);
4166 SDL_UnlockMutex(wait_mutex);
4182 if (
is->video_stream >= 0) {
4188 if (
is->audio_stream >= 0)
4190 if (
is->subtitle_stream >= 0)
4200 SDL_LockMutex(wait_mutex);
4201 SDL_CondWaitTimeout(
is->continue_read_thread, wait_mutex, 10);
4202 SDL_UnlockMutex(wait_mutex);
4210 fprintf(stderr,
"\x1b[2K\r");
4216 fprintf(stderr,
"\x1b[2K\r");
4217 snprintf(metadata_description,
4218 sizeof(metadata_description),
4219 "\r New metadata for stream %d",
4232 (pkt_ts - (stream_start_time !=
AV_NOPTS_VALUE ? stream_start_time : 0)) *
4236 if (
pkt->stream_index ==
is->audio_stream && pkt_in_play_range) {
4238 }
else if (
pkt->stream_index ==
is->video_stream && pkt_in_play_range
4242 if (stgi && stgi->
graph) {
4248 }
else if (
pkt->stream_index ==
is->subtitle_stream && pkt_in_play_range) {
4253 if (stgi && stgi->
graph) {
4264 if (ic && !
is->ic) {
4274 event.user.data1 =
is;
4275 SDL_PushEvent(&event);
4277 SDL_DestroyMutex(wait_mutex);
4289 is->last_video_stream =
is->video_stream = -1;
4290 is->last_audio_stream =
is->audio_stream = -1;
4291 is->last_subtitle_stream =
is->subtitle_stream = -1;
4312 if (!(
is->continue_read_thread = SDL_CreateCond())) {
4320 is->audio_clock_serial = -1;
4341 if (!
is->read_tid) {
4353 int start_index, stream_index;
4360 start_index =
is->last_video_stream;
4361 old_index =
is->video_stream;
4363 start_index =
is->last_audio_stream;
4364 old_index =
is->audio_stream;
4366 start_index =
is->last_subtitle_stream;
4367 old_index =
is->subtitle_stream;
4369 stream_index = start_index;
4375 for (start_index = 0; start_index <
nb_streams; start_index++)
4376 if (p->stream_index[start_index] == stream_index)
4380 stream_index = start_index;
4390 is->last_subtitle_stream = -1;
4393 if (start_index == -1)
4397 if (stream_index == start_index)
4399 st =
is->ic->streams[p ? p->stream_index[stream_index] : stream_index];
4417 if (p && stream_index != -1)
4418 stream_index = p->stream_index[stream_index];
4437 int next =
is->show_mode;
4439 next = (next + 1) % SHOW_MODE_NB;
4440 }
while (next !=
is->show_mode && (next == SHOW_MODE_VIDEO && !
is->video_st || next != SHOW_MODE_VIDEO && !
is->audio_st));
4441 if (
is->show_mode != next) {
4442 is->force_refresh = 1;
4443 is->show_mode = next;
4448 double remaining_time = 0.0;
4450 while (!SDL_PeepEvents(event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) {
4459 if (remaining_time > 0.0) {
4462 else if (SDL_WaitEventTimeout(
NULL,
ceil(remaining_time * 1000)))
4469 is->force_refresh = 1;
4470 if (
is->show_mode != SHOW_MODE_NONE && (!
is->paused ||
is->force_refresh))
4482 for (
i = 0;
i <
is->ic->nb_chapters;
i++) {
4494 if (
i >=
is->ic->nb_chapters)
4506 double incr,
pos, frac;
4511 switch (event.type) {
4514 (event.key.keysym.sym == SDLK_ESCAPE || event.key.keysym.sym == SDLK_q))) {
4519 if (!cur_stream->
width)
4525 switch (event.key.keysym.sym) {
4537 case SDLK_KP_MULTIPLY:
4541 case SDLK_KP_DIVIDE:
4643 case SDL_MOUSEWHEEL:
4647 case SDL_MOUSEBUTTONDOWN:
4655 if (event.button.button == SDL_BUTTON_LEFT) {
4656 static int64_t last_mouse_left_click = 0;
4660 last_mouse_left_click = 0;
4666 case SDL_MOUSEMOTION:
4672 if (event.type == SDL_MOUSEMOTION)
4674 if (event.type == SDL_MOUSEBUTTONDOWN) {
4675 if (event.button.button != SDL_BUTTON_RIGHT)
4679 if (!(event.motion.state & SDL_BUTTON_RMASK))
4689 int tns, thh, tmm, tss;
4692 tmm = (tns % 3600) / 60;
4694 frac = x / cur_stream->
width;
4697 mm = (ns % 3600) / 60;
4700 "Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d) \n", frac*100,
4701 hh, mm,
ss, thh, tmm, tss);
4708 case SDL_WINDOWEVENT:
4709 switch (event.window.event) {
4710 case SDL_WINDOWEVENT_LEAVE:
4713 case SDL_WINDOWEVENT_SIZE_CHANGED:
4725 case SDL_WINDOWEVENT_EXPOSED:
4773 if (!strcmp(
arg,
"audio"))
4775 else if (!strcmp(
arg,
"video"))
4777 else if (!strcmp(
arg,
"ext"))
4789 !strcmp(
arg,
"waves") ? SHOW_MODE_WAVES :
4790 !strcmp(
arg,
"rdft" ) ? SHOW_MODE_RDFT : SHOW_MODE_NONE;
4806 "Argument '%s' provided as input filename, but '%s' was already specified.\n",
4810 if (!strcmp(filename,
"-"))
4821 const char *spec = strchr(opt,
':');
4825 "No media specifier was specified in '%s' in option '%s'\n",
4837 "Invalid media specifier '%s' in option '%s'\n", spec, opt);
4894 "read and decode the streams to fill missing information with heuristics" },
4920 printf(
"\nWhile playing:\n"
4922 "f toggle full screen\n"
4925 "9, 0 decrease and increase volume respectively\n"
4926 "/, * decrease and increase volume respectively\n"
4927 "a cycle audio channel in the current program\n"
4928 "v cycle video channel\n"
4929 "t cycle subtitle channel in the current program\n"
4931 "w cycle video filters or show modes\n"
4932 "s activate frame-step mode\n"
4933 "left/right seek backward/forward by 10 seconds or a custom interval if -seek_interval is set\n"
4934 "down/up seek backward/forward 1 minute\n"
4935 "page down/page up seek to previous/next chapter or backward/forward 10 minutes if no chapters\n"
4936 "l keep the chapter list on screen; typing then filters it, down/up move its selection and escape closes it\n"
4937 "enter seek to the chapter selected in the chapter list while it is shown\n"
4938 "mouse wheel move the chapter list selection while it is shown\n"
4939 "left click seek to the clicked chapter list entry, or sort the list by the clicked column, again to flip it;\n"
4940 " the left half of the shuffle button lowers its seed, the right half raises it\n"
4941 "mouse over (i) show the metadata of that chapter list entry\n"
4942 "right mouse click seek to percentage in file corresponding to fraction of width\n"
4943 "left double-click toggle full screen\n"
4977 "Use -h to get full help or, even better, run 'man %s'\n",
program_name);
4984 flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER;
4986 flags &= ~SDL_INIT_AUDIO;
4988 flags &= ~SDL_INIT_VIDEO;
4989 if (SDL_Init (
flags)) {
4995 SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE);
4996 SDL_EventState(SDL_USEREVENT, SDL_IGNORE);
4999 int flags = SDL_WINDOW_HIDDEN;
5001#if SDL_VERSION_ATLEAST(2,0,5)
5002 flags |= SDL_WINDOW_ALWAYS_ON_TOP;
5004 av_log(
NULL,
AV_LOG_WARNING,
"Your SDL version doesn't support SDL_WINDOW_ALWAYS_ON_TOP. Feature will be inactive.\n");
5007 flags |= SDL_WINDOW_BORDERLESS;
5009 flags |= SDL_WINDOW_RESIZABLE;
5011#ifdef SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR
5012 SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR,
"0");
5021#if SDL_VERSION_ATLEAST(2, 0, 6)
5022 flags |= SDL_WINDOW_VULKAN;
5030 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,
"linear");
5057 renderer = SDL_CreateRenderer(
window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static const char *const format[]
static AVFormatContext * ctx
static AVDictionary * opts
Main libavdevice API header.
Main libavfilter public API header.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
char * av_asprintf(const char *fmt,...)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
void av_bprintf(AVBPrint *buf, const char *fmt,...)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
memory buffer sink API for audio and video
Memory buffer source API.
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define is(width, name, range_min, range_max, subs,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define ss(width, name, subs,...)
Public libavutil channel layout APIs header.
void show_help_children(const AVClass *class, int flags)
Show help for all options with given flags in class and all its children.
void init_dynload(void)
Initialize dynamic library loading.
int check_avoptions(AVDictionary *m)
void dump_dictionary(void *ctx, const AVDictionary *m, const char *name, const char *indent, int log_level)
This does the same as libavformat/dump.c corresponding function and should probably be kept in sync w...
void parse_loglevel(int argc, char **argv, const OptionDef *options)
Find the '-loglevel' option in the command line args and apply it.
void show_help_options(const OptionDef *options, const char *msg, int req_flags, int rej_flags)
Print help for all options matching specified flags.
void log_callback_help(void *ptr, int level, const char *fmt, va_list vl)
Trivial log callback.
AVDictionary * format_opts
int parse_options(void *optctx, int argc, char **argv, const OptionDef *options, int(*parse_arg_function)(void *, const char *))
Parse the command line arguments.
int filter_codec_opts(const AVDictionary *opts, enum AVCodecID codec_id, AVFormatContext *s, AVStream *st, const AVCodec *codec, AVDictionary **dst, AVDictionary **opts_used)
Filter out options for given codec.
void remove_avoptions(AVDictionary **a, AVDictionary *b)
AVDictionary * codec_opts
void uninit_opts(void)
Uninitialize the cmdutils option system, in particular free the *_opts contexts and their contents.
double get_rotation(const int32_t *displaymatrix)
int setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *local_codec_opts, AVDictionary ***dst)
Setup AVCodecContext options for avformat_find_stream_info().
int parse_number(const char *context, const char *numstr, enum OptionType type, double min, double max, double *dst)
Parse a string and return its corresponding value as a double.
const char program_name[]
program name, defined by the program for show_version().
static void print_error(const char *filename, int err)
Print an error message to stderr, indicating filename and a human readable description of the error c...
void show_banner(int argc, char **argv, const OptionDef *options)
Print the program banner to stderr.
#define GROW_ARRAY(array, nb_elems)
const int program_birth_year
program birth year, defined by the program for show_banner()
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
#define AV_CEIL_RSHIFT(a, b)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static __device__ float ceil(float a)
__device__ int printf(const char *,...)
static __device__ float fabs(float a)
static AVStream * video_stream
static AVStream * audio_stream
static volatile int received_sigterm
static int decode_interrupt_cb(void *ctx)
static volatile int received_nb_signals
static void sigterm_handler(int sig)
static void show_usage(void)
static char * vulkan_params
static VideoState * stream_open(const char *filename, const AVInputFormat *iformat)
static double compute_target_delay(double delay, VideoState *is)
#define SDL_AUDIO_MAX_CALLBACKS_PER_SEC
static int default_height
static char * video_background
static int is_realtime(AVFormatContext *s)
static void frame_queue_destroy(FrameQueue *f)
static const char chapter_panel_color[]
static int audio_open(void *opaque, AVChannelLayout *wanted_channel_layout, int wanted_sample_rate, struct AudioParams *audio_hw_params)
static int chapter_list_click(VideoState *is, int x, int y)
static int packet_queue_put_nullpacket(PacketQueue *q, AVPacket *pkt, int stream_index)
static int decoder_decode_frame(Decoder *d, AVFrame *frame, AVSubtitle *sub)
static void chapter_list_search(VideoState *is, const char *typed)
static int chapter_strip_add(ChapterStrip **strips, int *nb, SDL_Rect rect, const char *background, const AVBPrint *script)
static const char * hwaccel
#define CHAPTER_LIST_ROWS
static Frame * frame_queue_peek_writable(FrameQueue *f)
static int video_open(VideoState *is)
static int current_chapter(VideoState *is)
static int infinite_buffer
static void draw_video_background(VideoState *is)
static void do_exit(VideoState *is)
static int is_full_screen
static ChapterListHit chapter_list_hit(VideoState *is, const ChapterListLayout *l, int x, int y)
static int chapter_list_configure(VideoState *is, const ChapterListLayout *l, const SDL_Rect *canvas)
static int upload_texture(SDL_Texture **tex, AVFrame *frame)
static int chapter_strip_render(VideoState *is, const ChapterStrip *strip)
static void set_clock_at(Clock *c, double pts, int serial, double time)
static void stream_toggle_pause(VideoState *is)
static void chapter_list_hover(VideoState *is, int x, int y)
static SDL_AudioDeviceID audio_dev
static double get_master_clock(VideoState *is)
static void chapter_bitmap_touched(VideoState *is, const SDL_Rect *rect)
static double vp_duration(VideoState *is, Frame *vp, Frame *nextvp)
static int display_disable
static uint32_t shuffle_rank(int index)
static int compare_tags(const char *a, const char *b)
static void sdl_audio_callback(void *opaque, Uint8 *stream, int len)
#define EXTERNAL_CLOCK_MAX_FRAMES
static int audio_decode_frame(VideoState *is)
Decode one audio frame and return its uncompressed size.
static void event_loop(VideoState *cur_stream)
static int opt_format(void *optctx, const char *opt, const char *arg)
static double chapter_list_alpha(VideoState *is, int64_t now)
#define EXTERNAL_CLOCK_SPEED_STEP
static const AVInputFormat * file_iformat
#define AV_SYNC_THRESHOLD_MAX
static int find_stream_info
#define SAMPLE_QUEUE_SIZE
static Frame * frame_queue_peek(FrameQueue *f)
static const char * chapter_tag(const AVChapter *chapter, const char *key)
static const char chapter_hover_color[]
static int opt_codec(void *optctx, const char *opt, const char *arg)
static Frame * frame_queue_peek_next(FrameQueue *f)
static const char ** vfilters_list
static int get_master_sync_type(VideoState *is)
static void video_image_display(VideoState *is)
static int compare_chapter_rows(const void *a, const void *b)
static Frame * frame_queue_peek_readable(FrameQueue *f)
static int decoder_reorder_pts
static int subtitle_disable
static ChapterListLayout chapter_list_layout(VideoState *is)
static const struct @171016013232041267156014171031267212062350175105 sort_buttons[CHAPTER_SORT_NB]
static void packet_queue_destroy(PacketQueue *q)
static void set_clock(Clock *c, double pts, int serial)
static int init_lcevc_graph(AVFormatContext *ic, int stream_index)
static int startup_volume
static void toggle_mute(VideoState *is)
static void frame_queue_next(FrameQueue *f)
static int chapter_list_update_rows(VideoState *is)
static void fill_rectangle(int x, int y, int w, int h)
static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int by_bytes)
#define EXTERNAL_CLOCK_SPEED_MAX
static int opt_input_file(void *optctx, const char *filename)
static const char * video_codec_name
#define SAMPLE_ARRAY_SIZE
static const char * input_filename
static void video_display(VideoState *is)
static void packet_queue_abort(PacketQueue *q)
static void update_volume(VideoState *is, int sign, double step)
static void toggle_audio_display(VideoState *is)
static void refresh_loop_wait_event(VideoState *is, SDL_Event *event)
static enum AVColorSpace sdl_supported_color_spaces[]
static enum ShowMode show_mode
static void bprint_chapter_ring(AVBPrint *script, int cx, int cy, int r)
static int subtitle_thread(void *arg)
static int frame_queue_nb_remaining(FrameQueue *f)
static void chapter_list_scroll(VideoState *is, const ChapterListLayout *l, const ChapterStrip *strips, int nb)
static const char * window_title
static int get_video_frame(VideoState *is, AVFrame *frame)
static enum AVAlphaMode sdl_supported_alpha_modes[]
static void video_audio_display(VideoState *s)
static int decoder_start(Decoder *d, int(*fn)(void *), const char *thread_name, void *arg)
static void decoder_abort(Decoder *d, FrameQueue *fq)
static int64_t frame_queue_last_pos(FrameQueue *f)
static void update_video_pts(VideoState *is, double pts, int serial)
static int64_t audio_callback_time
static void chapter_list_key(VideoState *is, SDL_Keycode key)
static const char * audio_codec_name
static ChapterSortKey chapter_sort[CHAPTER_SORT_NB]
static float seek_interval
static int packet_queue_init(PacketQueue *q)
static Frame * frame_queue_peek_last(FrameQueue *f)
#define SUBPICTURE_QUEUE_SIZE
static const struct TextureFormatEntry sdl_texture_format_map[]
static void set_default_window_size(int width, int height, AVRational sar)
#define INSERT_FILT(name, arg)
static int frame_queue_init(FrameQueue *f, PacketQueue *pktq, int max_size, int keep_last)
void show_help_default(const char *opt, const char *arg)
Per-fftool specific help handler.
static void frame_queue_unref_item(Frame *vp)
static void init_clock(Clock *c, int *queue_serial)
static void chapter_list_move(VideoState *is, int delta)
static void bprint_chapter_header_strip(VideoState *is, AVBPrint *script, const ChapterListLayout *l)
static int opt_show_mode(void *optctx, const char *opt, const char *arg)
static int compute_mod(int a, int b)
static int opt_sync(void *optctx, const char *opt, const char *arg)
#define CHAPTER_LIST_EVENT
static int do_bsf_flush(AVFormatContext *ic, VideoState *is)
static const char chapter_popup_color[]
static int chapter_list_show(VideoState *is, int chapter)
#define EXTERNAL_CLOCK_SPEED_MIN
static void bprint_chapter_box(AVBPrint *script, const char *style, int x, int y, int w, int h)
static void stream_cycle_channel(VideoState *is, int codec_type)
static SDL_Renderer * renderer
#define CHAPTER_LIST_FADE_TIME
static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block, int *serial)
#define AUDIO_DIFF_AVG_NB
static void bprint_chapter_styles(AVBPrint *script, const ChapterListLayout *l)
static void frame_queue_push(FrameQueue *f)
static int decode_interrupt_cb(void *ctx)
static int decoder_init(Decoder *d, AVCodecContext *avctx, PacketQueue *queue, SDL_cond *empty_queue_cond)
static int audio_thread(void *arg)
static int configure_audio_filters(VideoState *is, const char *afilters, int force_output_format)
static int64_t cursor_last_shown
#define SDL_AUDIO_MIN_BUFFER_SIZE
static int configure_filtergraph(AVFilterGraph *graph, const char *filtergraph, AVFilterContext *source_ctx, AVFilterContext *sink_ctx)
static void stream_close(VideoState *is)
static int video_thread(void *arg)
static int exit_on_mousedown
static void chapter_list_select(VideoState *is, int row)
#define AV_SYNC_THRESHOLD_MIN
static SDL_Window * window
static void decoder_destroy(Decoder *d)
static int chapter_list_render(VideoState *is)
static int do_bsf_graph(AVFormatContext *ic, VideoState *is, Stream *sti, AVPacket *pkt)
static int stream_component_open(VideoState *is, int stream_index)
static void stream_component_close(VideoState *is, int stream_index)
static void uninit_bsf_graph(AVFormatContext *ic, int stream_index)
static void packet_queue_flush(PacketQueue *q)
static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters, AVFrame *frame)
static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
static void chapter_sort_by(int key, int seed_step)
#define CURSOR_HIDE_DELAY
static int opt_width(void *optctx, const char *opt, const char *arg)
static void packet_queue_start(PacketQueue *q)
static void get_sdl_pix_fmt_and_blendmode(int format, Uint32 *sdl_pix_fmt, SDL_BlendMode *sdl_blendmode)
static SDL_RendererInfo renderer_info
static void step_to_next_frame(VideoState *is)
static int chapter_shuffle_seed
static int chapter_list_visible(VideoState *is)
static void toggle_pause(VideoState *is)
static void seek_chapter(VideoState *is, int i)
static void chapter_list_discard(VideoState *is)
static int opt_height(void *optctx, const char *opt, const char *arg)
#define EXTERNAL_CLOCK_MIN_FRAMES
#define AV_NOSYNC_THRESHOLD
static void update_sample_display(VideoState *is, short *samples, int samples_size)
static int cmp_audio_fmts(enum AVSampleFormat fmt1, int64_t channel_count1, enum AVSampleFormat fmt2, int64_t channel_count2)
static int exit_on_keydown
static int realloc_texture(SDL_Texture **texture, Uint32 new_format, int new_width, int new_height, SDL_BlendMode blendmode, int init_texture)
static int opt_add_vfilter(void *optctx, const char *opt, const char *arg)
static int create_hwaccel(AVBufferRef **device_ctx)
static void video_refresh(void *opaque, double *remaining_time)
static void frame_queue_signal(FrameQueue *f)
static double get_clock(Clock *c)
#define SAMPLE_CORRECTION_PERCENT_MAX
static const char * subtitle_codec_name
static int wait_for_events
#define VIDEO_PICTURE_QUEUE_SIZE
static void bprint_chapter_row_strip(VideoState *is, AVBPrint *script, const ChapterListLayout *l, int r)
static void set_clock_speed(Clock *c, double speed)
static void chapter_list_draw(VideoState *is)
static void calculate_display_rect(SDL_Rect *rect, int scr_xleft, int scr_ytop, int scr_width, int scr_height, int pic_width, int pic_height, AVRational pic_sar)
static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, double duration, int64_t pos, int serial)
static void check_external_clock_speed(VideoState *is)
static void sync_clock_to_slave(Clock *c, Clock *slave)
static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
static void chapter_strips_free(ChapterStrip **strips, int *nb)
static void toggle_full_screen(VideoState *is)
#define CHAPTER_LIST_HOLD_TIME
static void chapter_list_pin(VideoState *is, int pinned)
static const char * wanted_stream_spec[AVMEDIA_TYPE_NB]
static int stream_has_enough_packets(AVStream *st, int stream_id, PacketQueue *queue)
#define AV_SYNC_FRAMEDUP_THRESHOLD
static void sigterm_handler(int sig)
static int chapter_list_strips(VideoState *is, const ChapterListLayout *l, ChapterStrip **strips, int *nb)
static int synchronize_audio(VideoState *is, int nb_samples)
static int read_thread(void *arg)
static VkRenderer * vk_renderer
static void set_sdl_yuv_conversion_mode(AVFrame *frame)
static int64_t start_time
static void bprint_chapter_cell(AVBPrint *script, const char *style, int x, int y, int right, int bottom, const char *text)
int vk_renderer_create(VkRenderer *renderer, SDL_Window *window, AVDictionary *opt)
int vk_renderer_display(VkRenderer *renderer, AVFrame *frame, RenderParams *render_params)
VkRenderer * vk_get_renderer(void)
int vk_renderer_get_hw_dev(VkRenderer *renderer, AVBufferRef **dev)
int vk_renderer_resize(VkRenderer *renderer, int width, int height)
void vk_renderer_destroy(VkRenderer *renderer)
#define VIDEO_BACKGROUND_TILE_SIZE
static const AVInputFormat * iformat
static unsigned int nb_streams
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_PIXEL_FMT
Underlying C type is enum AVPixelFormat.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
int av_bsf_sink_get_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Get a packet with filtered data from sink and put it in packet.
AVRational av_bsf_sink_get_time_base(const AVBitStreamFilterContext *ctx)
int av_bsf_source_parameters_set(AVBitStreamFilterContext *ctx, const AVCodecParameters *par)
Initialize the source filter with the provided parameters.
av_warn_unused_result int av_bsf_source_add_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Add a packet to the buffer source.
@ AV_BSF_SOURCE_FLAG_PUSH
Immediately push the packet to the output.
int av_bsf_init_dict(AVBitStreamFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
AVBitStreamFilterGraph * av_bsf_graph_alloc(void)
Allocate a filter graph.
int av_bsf_link(AVBitStreamFilterContext *src, unsigned srcpad, AVBitStreamFilterContext *dst, unsigned dstpad)
Link two filters together.
int av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
void av_bsf_graph_free(AVBitStreamFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
int av_bsf_graph_alloc_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filter, const char *name, AVBitStreamFilterGraph *graph)
Create a new filter instance in a filter graph.
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
Initialize the AVCodecContext to use the given AVCodec.
#define AV_CODEC_FLAG2_FAST
Allow non spec compliant speedup tricks.
const AVClass * avcodec_get_class(void)
Get the AVClass for AVCodecContext.
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
const AVCodec * avcodec_find_decoder(enum AVCodecID id)
Find a registered decoder with a matching codec ID.
const AVCodec * avcodec_find_decoder_by_name(const char *name)
Find a registered decoder with the specified name.
void avsubtitle_free(AVSubtitle *sub)
Free all allocated data in the given subtitle struct.
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Alias for avcodec_receive_frame_flags(avctx, frame, 0).
int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
Supply raw packet data as input to a decoder.
int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, int *got_sub_ptr, const AVPacket *avpkt)
Decode a subtitle message.
@ AVDISCARD_ALL
discard all
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
void avcodec_flush_buffers(AVCodecContext *avctx)
Reset the internal codec state / flush internal buffers.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
FF_VISIBILITY_POP_HIDDEN av_cold void avdevice_register_all(void)
Initialize libavdevice and register all the input and output devices.
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.
int avformat_network_init(void)
Do global initialization of network libraries.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
const AVClass * avformat_get_class(void)
Get the AVClass for AVFormatContext.
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
AVProgram * av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s)
Find the programs which belong to a given stream.
int av_read_pause(AVFormatContext *s)
Pause a network-based stream (e.g.
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
Seek to timestamp ts.
int av_read_frame(AVFormatContext *s, AVPacket *pkt)
Return the next frame of a stream.
int av_read_play(AVFormatContext *s)
Start playing a network-based stream (e.g.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
Read packets of a media file to get stream information.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame)
Guess the frame rate, based on both the container and codec information.
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
void av_dump_format(AVFormatContext *ic, int index, const char *url, int is_output)
Print detailed information about the input or output format, such as duration, bitrate,...
AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame)
Guess the sample aspect ratio of a frame, based on both the stream and the frame aspect ratio.
int av_buffersink_get_sample_rate(const AVFilterContext *ctx)
AVRational av_buffersink_get_frame_rate(const AVFilterContext *ctx)
int av_buffersink_get_ch_layout(const AVFilterContext *ctx, AVChannelLayout *out)
AVRational av_buffersink_get_time_base(const AVFilterContext *ctx)
int attribute_align_arg av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame)
Get a frame with filtered data from sink and put it in frame.
int attribute_align_arg av_buffersink_get_frame_flags(AVFilterContext *ctx, AVFrame *frame, int flags)
Get a frame with filtered data from sink and put it in frame.
int av_buffersrc_parameters_set(AVFilterContext *ctx, AVBufferSrcParameters *param)
Initialize the buffersrc or abuffersrc filter with the provided parameters.
int attribute_align_arg av_buffersrc_add_frame(AVFilterContext *ctx, AVFrame *frame)
Add a frame to the buffer source.
AVBufferSrcParameters * av_buffersrc_parameters_alloc(void)
Allocate a new AVBufferSrcParameters instance.
int avfilter_init_str(AVFilterContext *filter, const char *args)
Initialize a filter with the supplied parameters.
int avfilter_graph_config(AVFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
const AVFilter * avfilter_get_by_name(const char *name)
Get a filter definition matching the given name.
void avfilter_inout_free(AVFilterInOut **inout)
Free the supplied list of AVFilterInOut and set *inout to NULL.
int avfilter_graph_parse_ptr(AVFilterGraph *graph, const char *filters, AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
Add a graph described by a string to a graph.
AVFilterContext * avfilter_graph_alloc_filter(AVFilterGraph *graph, const AVFilter *filter, const char *name)
Create a new filter instance in a filter graph.
void avfilter_graph_free(AVFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
int avfilter_graph_send_command(AVFilterGraph *graph, const char *target, const char *cmd, const char *arg, char *res, int res_len, int flags)
Send a command to one or more filter instances.
int avfilter_link(AVFilterContext *src, unsigned srcpad, AVFilterContext *dst, unsigned dstpad)
Link two filters together.
int avfilter_graph_create_filter(AVFilterContext **filt_ctx, const AVFilter *filt, const char *name, const char *args, void *opaque, AVFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
const AVClass * avfilter_get_class(void)
AVFilterInOut * avfilter_inout_alloc(void)
Allocate a single AVFilterInOut entry.
AVFilterGraph * avfilter_graph_alloc(void)
Allocate a filter graph.
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, AVBPrint *bp)
bprint variant of av_channel_layout_describe().
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
AVBufferRef * av_buffer_allocz(size_t size)
Same as av_buffer_alloc(), except the returned buffer will be initialized to zero.
#define AV_DICT_MULTIKEY
Allow to store several equal keys in the dictionary.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
int av_dict_parse_string(AVDictionary **pm, const char *str, const char *key_val_sep, const char *pairs_sep, int flags)
Parse the key/value pairs list and add the parsed entries to a dictionary.
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
#define AVERROR_FILTER_NOT_FOUND
Filter not found.
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
AVFrameSideData * av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type)
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
@ AV_FRAME_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_QUIET
Print no output.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_log_set_callback(void(*callback)(void *, int, const char *, va_list))
Set the logging callback.
#define AV_LOG_SKIP_REPEATED
Skip repeated messages, this requires the user app to use av_log() instead of (f)printf as the 2 woul...
int av_log_get_level(void)
Get the current log level.
void av_log_set_flags(int arg)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
Rescale a 64-bit integer with specified rounding.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AV_ROUND_NEAR_INF
Round to nearest and halfway cases away from zero.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
char av_get_picture_type_char(enum AVPictureType pict_type)
Return a single letter to describe the given picture type pict_type.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters.
const char * av_get_sample_fmt_name(enum AVSampleFormat sample_fmt)
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
AVSampleFormat
Audio sample formats.
@ AV_SAMPLE_FMT_S16
signed 16 bits
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes,...
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
SwsContext * sws_getCachedContext(SwsContext *context, int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
Check if context can be reused, otherwise reallocate a new one.
int attribute_align_arg sws_scale(SwsContext *sws, const uint8_t *const srcSlice[], const int srcStride[], int srcSliceY, int srcSliceH, uint8_t *const dst[], const int dstStride[])
swscale wrapper, so we don't need to export the SwsContext.
void sws_freeContext(SwsContext *swsContext)
Free the swscaler context swsContext.
int swr_alloc_set_opts2(struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
int swr_set_compensation(struct SwrContext *s, int sample_delta, int compensation_distance)
Activate resampling compensation ("soft" compensation).
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *const *out_arg, int out_count, const uint8_t *const *in_arg, int in_count)
Convert audio.
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
int av_opt_set_array(void *obj, const char *name, int search_flags, unsigned int start_elem, unsigned int nb_elems, enum AVOptionType val_type, const void *val)
Add, replace, or remove elements for an array option.
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr, enum AVHWDeviceType type, AVBufferRef *src_ref, int flags)
Create a new device of the specified type from an existing device.
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
static const int16_t alpha[]
static void scale(int *out, const int *in, const int w, const int h, const int shift)
static int lcevc_merge(FFPacketSync *fs)
static int shift(int a, int b)
Macro definitions for various function/variable attributes.
static enum AVPixelFormat pix_fmts[]
#define FFSWAP(type, a, b)
#define FFDIFFSIGN(x, y)
Comparator.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
static av_always_inline int cmp(MPVEncContext *const s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags)
compares a block (either a full macroblock or a partition thereof) against a proposed motion-compensa...
#define CMDUTILS_COMMON_OPTIONS
int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx)
Put the RGBA values that correspond to color_string in rgba_color.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_0RGB32
@ AVCOL_RANGE_JPEG
Full range content.
#define AV_PIX_FMT_BGR555
AVAlphaMode
Correlation between the alpha channel and color values.
@ AVALPHA_MODE_STRAIGHT
Alpha channel is independent of color values.
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb)
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
#define AV_PIX_FMT_RGB32_1
#define AV_PIX_FMT_BGR32_1
#define AV_PIX_FMT_BGR565
#define AV_PIX_FMT_RGB565
#define AV_PIX_FMT_RGB444
#define AV_PIX_FMT_NE(be, le)
#define AV_PIX_FMT_0BGR32
#define AV_PIX_FMT_RGB555
AVColorSpace
YUV colorspace type.
@ AVCOL_SPC_BT709
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B
@ AVCOL_SPC_BT470BG
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
@ AVCOL_SPC_SMPTE170M
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above
enum AVMediaType codec_type
static volatile sig_atomic_t sig
#define FF_ARRAY_ELEMS(a)
void * priv_data
Opaque filter-specific private data.
A reference to a data buffer.
uint8_t * data
The data buffer.
This structure contains the parameters describing the frames that will be passed to this filter.
AVRational frame_rate
Video only, the frame rate of the input video.
enum AVColorRange color_range
int format
video: the pixel format, value corresponds to enum AVPixelFormat audio: the sample format,...
int width
Video only, the display dimensions of the input frames.
enum AVColorSpace color_space
Video only, the YUV colorspace and range.
enum AVAlphaMode alpha_mode
Video only, the alpha mode.
AVRational time_base
The timebase to be used for the timestamps on the input frames.
AVBufferRef * hw_frames_ctx
Video with a hwaccel pixel format only.
AVRational sample_aspect_ratio
Video only, the sample (pixel) aspect ratio.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
int64_t end
chapter start/end time in time_base units
AVRational time_base
time base in which the start/end timestamps are specified
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
int flags2
AV_CODEC_FLAG2_*.
enum AVSampleFormat sample_fmt
audio sample format
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed.
enum AVMediaType codec_type
int sample_rate
samples per second
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
int lowres
low resolution decoding, 1-> 1/2 size, 2->1/4 size
This struct describes the properties of an encoded stream.
int height
The height of the video frame in pixels.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
AVRational sample_aspect_ratio
The aspect ratio (width/height) which a single pixel should have when displayed.
int sample_rate
The number of audio samples per second.
uint8_t max_lowres
maximum value for lowres supported by the decoder
int offset
Number of elements before the component of the first pixel.
char * scale_sws_opts
sws options to use for the auto-inserted scale filters
AVFilterContext ** filters
int nb_threads
Maximum number of threads used by filters in this graph.
A linked-list of the inputs/outputs of the filter chain.
int event_flags
Flags indicating events happening on the file, a combination of AVFMT_EVENT_FLAG_*.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVStreamGroup ** stream_groups
A list of all stream groups in the file.
AVIOContext * pb
I/O context.
int64_t start_time
Position of the first frame of the component, in AV_TIME_BASE fractional seconds.
AVDictionary * metadata
Metadata that applies to the whole file.
int flags
Flags modifying the (de)muxer behaviour.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
const struct AVInputFormat * iformat
The input container format.
unsigned int nb_chapters
Number of chapters in AVChapter array.
int64_t bit_rate
Total stream bitrate in bit/s, 0 if not available.
unsigned int nb_stream_groups
Number of elements in AVFormatContext.stream_groups.
AVStream ** streams
A list of all streams in the file.
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
Structure to hold side data for an AVFrame.
This structure describes decoded (raw) audio or video data.
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int sample_rate
Sample rate of the audio data.
AVChannelLayout ch_layout
Channel layout of the audio data.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
enum AVPictureType pict_type
Picture type of the frame.
uint8_t ** extended_data
pointers to the data planes/channels.
int eof_reached
true if was unable to read due to error or eof
int error
contains the error code or 0 if no error happened
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
This structure stores compressed data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
int64_t pos
byte position in stream, -1 if unknown
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
New fields can be added to the end with minor version bumps.
Rational number (pair of numerator and denominator).
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
unsigned int nb_entries
Number of elements in AVStreamGroup.entries.
enum AVStreamGroupParamsType type
Group type.
AVStreamGroupEntry ** entries
A list of streams or child groups in the group.
union AVStreamGroup::@313244315204024013007202273061153315146016101155 params
Group type-specific parameters.
struct AVStreamGroupLayeredVideo * layered_video
AVCodecParameters * codecpar
Codec parameters associated with this stream.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int event_flags
Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
int x
top left corner of pict, undefined when pict is not set
int w
width of pict, undefined when pict is not set
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
int y
top left corner of pict, undefined when pict is not set
int h
height of pict, undefined when pict is not set
uint32_t start_display_time
uint32_t end_display_time
int64_t pts
Same as packet pts, in AV_TIME_BASE.
AVChannelLayout ch_layout
int button_y[CHAPTER_SORT_NB]
int button_x[CHAPTER_SORT_NB]
SDL_cond * empty_queue_cond
StreamGroup ** stream_groups
Frame queue[FRAME_QUEUE_SIZE]
AVBitStreamFilterContext * sink
AVBitStreamFilterGraph * graph
AVBitStreamFilterContext * filter
The libswresample context.
Main external API structure.
enum AVPixelFormat format
int chapter_pin_requested
ChapterStrip * chapter_strips
AVFilterContext * out_video_filter
AVFilterContext * chapter_sink
struct AudioParams audio_src
int16_t sample_array[SAMPLE_ARRAY_SIZE]
RenderParams render_params
SDL_Texture * chapter_texture
SDL_Texture * vid_texture
unsigned int audio_buf_size
int64_t chapter_fade_start
enum VideoState::ShowMode show_mode
struct AudioParams audio_tgt
const AVInputFormat * iformat
double audio_diff_threshold
double audio_diff_avg_coef
AVFilterContext * out_audio_filter
double max_frame_duration
double frame_last_returned_time
struct SwrContext * swr_ctx
SDL_Texture * vis_texture
struct AudioParams audio_filter_src
SDL_cond * continue_read_thread
int chapter_render_pending
AVComplexFloat * rdft_data
ChapterListHit chapter_hover
AVFilterGraph * chapter_graph
int64_t chapter_last_input
double chapter_drawn_alpha
double frame_last_filter_delay
unsigned int audio_buf1_size
struct SwsContext * sub_convert_ctx
AVFilterContext * in_video_filter
ChapterRow * chapter_rows
int queue_attachments_req
SDL_Texture * sub_texture
AVFilterContext * in_audio_filter
libswresample public header
#define av_malloc_array(a, b)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
int av_usleep(unsigned usec)
Sleep for a period of time.
int64_t av_gettime_relative(void)
Get the current time in microseconds since some unspecified starting point.
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
@ AV_TX_FLOAT_RDFT
Real to complex and complex to real DFTs.
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)