Go to the documentation of this file.
   33 #define TEXT_MAXSZ    (25 * (56 + 1) * 4 + 2) 
   34 #define VBI_NB_COLORS 40 
   35 #define VBI_TRANSPARENT_BLACK 8 
   36 #define RGBA(r,g,b,a) (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) 
   37 #define VBI_R(rgba)   (((rgba) >> 0) & 0xFF) 
   38 #define VBI_G(rgba)   (((rgba) >> 8) & 0xFF) 
   39 #define VBI_B(rgba)   (((rgba) >> 16) & 0xFF) 
   40 #define VBI_A(rgba)   (((rgba) >> 24) & 0xFF) 
   41 #define MAX_BUFFERED_PAGES 25 
   42 #define BITMAP_CHAR_WIDTH  12 
   43 #define BITMAP_CHAR_HEIGHT 10 
  102         "&Hffffff,&Hffffff,&H0,&H0,"  
  112         "&Hffffff,&Hffffff,&H0,&H0,"  
  134         if (*--t != 
' ' || (
len-1 > 0 && *(t-1) & 0x80))
 
  176     sz = vbi_print_page_region(page, vbi_text, 
TEXT_MAXSZ-1, 
"UTF-8",
 
  179                                    page->columns, page->rows-chop_top);
 
  189     if (
ctx->chop_spaces) {
 
  194             in += strspn(
in, 
" \n");
 
  196             for (nl = 0; 
in[nl]; ++nl)
 
  197                 if (
in[nl] == 
'\n' && (nl==0 || !(
in[nl-1] & 0x80)))
 
  221         if (!sub_rect->
ass) {
 
  235     int r = 
VBI_R(page->color_map[ci]);
 
  236     int g = 
VBI_G(page->color_map[ci]);
 
  237     int b = 
VBI_B(page->color_map[ci]);
 
  241 #define IS_TXT_SPACE(ch) ((ch).unicode < 0x0020 || (ch).unicode >= 0xe000 || (ch).unicode == 0x00a0 ||\ 
  242                           (ch).size > VBI_DOUBLE_SIZE || (ch).opacity == VBI_TRANSPARENT_SPACE) 
  244 static void get_trim_info(vbi_page *page, vbi_char *row, 
int *leading, 
int *trailing, 
int *olen)
 
  251     for (
i = 0; 
i < page->columns; 
i++) {
 
  254         if (
out == 32 && !char_seen)
 
  257             char_seen = 1, 
len = 
i - (*leading) + 1;
 
  261     *trailing = 
len > 0 ? page->columns - *leading - 
len : page->columns;
 
  265                           int start, 
int end, vbi_color *cur_color, vbi_color *cur_back_color)
 
  269     for (
i = start; 
i < 
end; 
i++) {
 
  272         if (*cur_color != row[
i].foreground) {
 
  274             *cur_color = row[
i].foreground;
 
  276         if (*cur_back_color != row[
i].background) {
 
  278             *cur_back_color = row[
i].background;
 
  283         } 
else if (
out == 
'\\' || 
out == 
'{' || 
out == 
'}') {
 
  297     int leading, trailing, 
len;
 
  298     int last_trailing = -1, last_leading = -1;
 
  299     int min_trailing = page->columns, min_leading = page->columns;
 
  301     int vertical_align = -1;
 
  302     int can_align_left = 1, can_align_right = 1, can_align_center = 1;
 
  303     int is_subtitle_page = 
ctx->subtitle_map[page->pgno & 0x7ff];
 
  305     vbi_color cur_color = VBI_WHITE;
 
  306     vbi_color cur_back_color = VBI_BLACK;
 
  311     for (
i = chop_top; 
i < page->rows; 
i++) {
 
  312         vbi_char *row = page->text + 
i * page->columns;
 
  317             if (last_leading != -1 && last_leading != leading || leading > 5)
 
  319             if (last_trailing != -1 && last_trailing != trailing || trailing > 2)
 
  321             if (last_trailing != -1 && (
FFABS((trailing - leading) - (last_trailing - last_leading)) > 1) || trailing - leading > 4)
 
  322                 can_align_center = 0;
 
  323             last_leading = leading;
 
  324             last_trailing = trailing;
 
  325             min_leading = 
FFMIN(leading, min_leading);
 
  326             min_trailing = 
FFMIN(trailing, min_trailing);
 
  330     if (!can_align_right && can_align_left && !can_align_center) {
 
  331         ctx->last_ass_alignment = alignment = 1;
 
  332     } 
else if (!can_align_right && !can_align_left && can_align_center) {
 
  333         ctx->last_ass_alignment = alignment = 2;
 
  334     } 
else if (can_align_right && !can_align_left && !can_align_center) {
 
  335         ctx->last_ass_alignment = alignment = 3;
 
  337         if (
ctx->last_ass_alignment == 1 && can_align_left ||
 
  338             ctx->last_ass_alignment == 2 && can_align_center ||
 
  339             ctx->last_ass_alignment == 3 && can_align_right)
 
  340             alignment = 
ctx->last_ass_alignment;
 
  343     for (
i = chop_top; 
i < page->rows; 
i++) {
 
  345         vbi_char *row = page->text + 
i * page->columns;
 
  346         int is_transparent_line;
 
  348         for (j = 0; j < page->columns; j++)
 
  349             if (row[j].opacity != VBI_TRANSPARENT_SPACE)
 
  351         is_transparent_line = (j == page->columns);
 
  353         len = is_transparent_line ? 0 : page->columns;
 
  354         leading = trailing = is_transparent_line ? page->columns : 0;
 
  356         if (is_subtitle_page) {
 
  357             if (!is_transparent_line)
 
  360             if (vertical_align == -1 && 
len) {
 
  361                 vertical_align = (2 - (av_clip(
i + 1, 0, 23) / 8));
 
  362                 av_bprintf(&buf, 
"{\\an%d}", alignment + vertical_align * 3);
 
  363                 if (vertical_align != 2)
 
  367             if (
len && empty_lines > 1)
 
  368                 for (empty_lines /= 2; empty_lines > 0; empty_lines--)
 
  371             if (alignment == 1 || alignment == 2 && !can_align_center)
 
  372                 leading = min_leading;
 
  373             if (alignment == 3 || alignment == 2 && !can_align_center)
 
  374                 trailing = min_trailing;
 
  377         if (
len || !is_subtitle_page) {
 
  378             decode_string(page, row, &buf, leading, page->columns - trailing, &cur_color, &cur_back_color);
 
  386     if (vertical_align == 0)
 
  387         for (empty_lines = (empty_lines - 1) / 2; empty_lines > 0; empty_lines--)
 
  399         if (!sub_rect->
ass) {
 
  412                              int chop_top, 
int resx, 
int resy)
 
  417     for (iy = 0; iy < resy; iy++) {
 
  420         vbi_char *vcnext = vc + page->columns;
 
  421         for (; vc < vcnext; vc++) {
 
  423             switch (vc->opacity) {
 
  424                 case VBI_TRANSPARENT_SPACE:
 
  428                     if (!
ctx->transparent_bg)
 
  430                 case VBI_SEMI_TRANSPARENT:
 
  431                     if (
ctx->opacity > 0) {
 
  432                         if (
ctx->opacity < 255)
 
  434                                 if (*
pixel == vc->background)
 
  438                 case VBI_TRANSPARENT_FULL:
 
  440                         if (*
pixel == vc->background)
 
  455     vbi_char *vc = page->text + (chop_top * page->columns);
 
  456     vbi_char *vcend = page->text + (page->rows * page->columns);
 
  458     for (; vc < vcend; vc++) {
 
  459         if (vc->opacity != VBI_TRANSPARENT_SPACE)
 
  471     if (!sub_rect->
data[0])
 
  474     vbi_draw_vt_page_region(page, VBI_PIXFMT_PAL8,
 
  476                             0, chop_top, page->columns, page->rows - chop_top,
 
  480     sub_rect->
x = 
ctx->x_offset;
 
  486     if (!sub_rect->
data[1]) {
 
  493         r = 
VBI_R(page->color_map[ci]);
 
  494         g = 
VBI_G(page->color_map[ci]);
 
  495         b = 
VBI_B(page->color_map[ci]);
 
  496         a = 
VBI_A(page->color_map[ci]);
 
  499         ff_dlog(
ctx, 
"palette %0x\n", ((uint32_t *)sub_rect->
data[1])[ci]);
 
  515     int is_subtitle_page = 
ctx->subtitle_map[ev->ev.ttx_page.pgno & 0x7ff];
 
  517     snprintf(pgno_str, 
sizeof pgno_str, 
"%03x", ev->ev.ttx_page.pgno);
 
  519            pgno_str, ev->ev.ttx_page.subno & 0xFF);
 
  521     if (strcmp(
ctx->pgno, 
"*") && (strcmp(
ctx->pgno, 
"subtitle") || !is_subtitle_page) && !strstr(
ctx->pgno, pgno_str))
 
  523     if (
ctx->handler_ret < 0)
 
  526     res = vbi_fetch_vt_page(
ctx->vbi, &page,
 
  527                             ev->ev.ttx_page.pgno,
 
  528                             ev->ev.ttx_page.subno,
 
  529                             VBI_WST_LEVEL_3p5, 25, TRUE);
 
  534     chop_top = 
ctx->chop_top || ((page.rows > 1) && is_subtitle_page);
 
  537            page.columns, page.rows, chop_top);
 
  542             ctx->pages = new_pages;
 
  545             cur_page->
pgno = ev->ev.ttx_page.pgno;
 
  546             cur_page->
subno = ev->ev.ttx_page.subno;
 
  548                 switch (
ctx->format_id) {
 
  564                     ctx->handler_ret = res;
 
  566                     ctx->pages[
ctx->nb_pages++] = *cur_page;
 
  580     vbi_unref_page(&page);
 
  587         int data_unit_id     = buf[0];
 
  588         int data_unit_length = buf[1];
 
  589         if (data_unit_length + 2 > 
size)
 
  592             if (data_unit_length != 0x2c)
 
  595                 int line_offset  = buf[2] & 0x1f;
 
  596                 int field_parity = buf[2] & 0x20;
 
  599                 ctx->sliced[lines].id = VBI_SLICED_TELETEXT_B;
 
  600                 ctx->sliced[lines].line = (line_offset > 0 ? (line_offset + (field_parity ? 0 : 313)) : 0);
 
  601                 for (
i = 0; 
i < 42; 
i++)
 
  602                     p[
i] = vbi_rev8(buf[4 + 
i]);
 
  606                 pmag = vbi_unham16p(p);
 
  607                 if (pmag >= 0 && pmag >> 3 == 0) {   
 
  608                     int page = vbi_unham16p(p + 2);
 
  609                     int flags1 = vbi_unham16p(p + 6);
 
  610                     int flags2 = vbi_unham16p(p + 8);
 
  611                     if (page >= 0 && flags1 >= 0 && flags2 >= 0) {
 
  612                         int pgno = ((pmag & 7) << 8) + page;
 
  614                         ctx->subtitle_map[pgno] = (!(flags1 & 0x40) && flags1 & 0x80 && flags2 & 0x01);
 
  616                         if (
ctx->subtitle_map[pgno] && pgno == 
ctx->last_pgno) {
 
  617                             int last_byte9 = vbi_unham8(
ctx->last_p5);
 
  618                             if (last_byte9 >= 0 && last_byte9 & 0x8) {
 
  619                                 int byte9 = vbi_unham8(p[5]);
 
  621                                     p[5] = vbi_ham8(byte9 | 0x8);
 
  624                         ctx->last_pgno = pgno;
 
  631         size -= data_unit_length + 2;
 
  632         buf += data_unit_length + 2;
 
  647         if (!(
ctx->vbi = vbi_decoder_new()))
 
  649         if (
ctx->default_region != -1) {
 
  651             vbi_teletext_set_default_region(
ctx->vbi, 
ctx->default_region);
 
  653         if (!vbi_event_handler_register(
ctx->vbi, VBI_EVENT_TTX_PAGE, 
handler, 
ctx)) {
 
  654             vbi_decoder_delete(
ctx->vbi);
 
  665         const int full_pes_size = 
pkt->
size + 45; 
 
  668         if (full_pes_size < 184 || full_pes_size > 65504 || full_pes_size % 184 != 0)
 
  676             ff_dlog(avctx, 
"ctx=%p buf_size=%d lines=%u pkt_pts=%7.3f\n",
 
  679                 vbi_decode(
ctx->vbi, 
ctx->sliced, lines, 0.0);
 
  680                 ctx->lines_processed += lines;
 
  697         sub->
pts = 
ctx->pages->pts;
 
  703                 sub->
rects[0] = 
ctx->pages->sub_rect;
 
  706                 for (j = 0; j < 4; j++) {
 
  722         for (
i = 0; 
i < 
ctx->nb_pages - 1; 
i++)
 
  737     unsigned int maj, 
min, rev;
 
  739     vbi_version(&maj, &
min, &rev);
 
  740     if (!(maj > 0 || 
min > 2 || 
min == 2 && rev >= 26)) {
 
  745     if (
ctx->format_id == 0) {
 
  753     ctx->last_ass_alignment = 2;
 
  755     if (
ctx->opacity == -1)
 
  756         ctx->opacity = 
ctx->transparent_bg ? 0 : 255;
 
  760     switch (
ctx->format_id) {
 
  775     ff_dlog(avctx, 
"lines_total=%u\n", 
ctx->lines_processed);
 
  776     while (
ctx->nb_pages)
 
  780     vbi_decoder_delete(
ctx->vbi);
 
  784     ctx->last_ass_alignment = 2;
 
  785     memset(
ctx->subtitle_map, 0, 
sizeof(
ctx->subtitle_map));
 
  796 #define OFFSET(x) offsetof(TeletextContext, x) 
  797 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM 
  799     {
"txt_page",        
"page numbers to decode, subtitle for subtitles, * for all", 
OFFSET(pgno),   
AV_OPT_TYPE_STRING, {.str = 
"*"},      0, 0,        
SD},
 
  800     {
"txt_default_region", 
"default G0 character set used for decoding",     
OFFSET(default_region), 
AV_OPT_TYPE_INT,    {.i64 = -1},      -1, 87,       
SD},
 
  802     {
"txt_format",      
"format of the subtitles (bitmap or text or ass)",   
OFFSET(format_id),      
AV_OPT_TYPE_INT,    {.i64 = 0},        0, 2,        
SD,  
"txt_format"},
 
  808     {
"txt_chop_spaces", 
"chops leading and trailing spaces from text",       
OFFSET(chop_spaces),    
AV_OPT_TYPE_INT,    {.i64 = 1},        0, 1,        
SD},
 
  809     {
"txt_duration",    
"display duration of teletext pages in msecs",       
OFFSET(sub_duration),   
AV_OPT_TYPE_INT,    {.i64 = -1},      -1, 86400000, 
SD},
 
  810     {
"txt_transparent", 
"force transparent background of the teletext",      
OFFSET(transparent_bg), 
AV_OPT_TYPE_INT,    {.i64 = 0},        0, 1,        
SD},
 
  811     {
"txt_opacity",     
"set opacity of the transparent background",         
OFFSET(opacity),        
AV_OPT_TYPE_INT,    {.i64 = -1},      -1, 255,      
SD},
 
  823     .
name      = 
"libzvbi_teletextdec",
 
  834     .wrapper_name = 
"libzvbi",
 
  
#define FF_ENABLE_DEPRECATION_WARNINGS
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define PUT_UTF8(val, tmp, PUT_BYTE)
static av_cold int init(AVCodecContext *avctx)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_ass_subtitle_header_default(AVCodecContext *avctx)
Generate a suitable AVCodecContext.subtitle_header for SUBTITLE_ASS with default style.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
char * av_asprintf(const char *fmt,...)
static av_cold int end(AVCodecContext *avctx)
@ AV_CODEC_ID_DVB_TELETEXT
static int gen_sub_text(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top)
uint8_t * subtitle_header
Header containing style information for text subtitles.
static int gen_sub_ass(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top)
static char * create_ass_text(TeletextContext *ctx, const char *text)
#define AV_LOG_VERBOSE
Detailed information.
static av_always_inline int ff_data_identifier_is_teletext(int data_identifier)
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
attribute_deprecated uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
@ SUBTITLE_ASS
Formatted text, the ass field must be set by the decoder and is authoritative.
int x
top left corner of pict, undefined when pict is not set
static int slice_to_vbi_lines(TeletextContext *ctx, uint8_t *buf, int size)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
static void decode_string(vbi_page *page, vbi_char *row, AVBPrint *buf, int start, int end, vbi_color *cur_color, vbi_color *cur_back_color)
char * ass
0 terminated ASS/SSA compatible event line.
char * ff_ass_get_dialog(int readorder, int layer, const char *style, const char *speaker, const char *text)
Craft an ASS dialog string.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int y
top left corner of pict, undefined when pict is not set
static void get_trim_info(vbi_page *page, vbi_char *row, int *leading, int *trailing, int *olen)
#define MAX_BUFFERED_PAGES
void ff_ass_bprint_text_event(AVBPrint *buf, const char *p, int size, const char *linebreaks, int keep_ass_markup)
Escape a text subtitle using ASS syntax into an AVBPrint buffer.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int64_t pts
Same as packet pts, in AV_TIME_BASE.
static void handler(vbi_event *ev, void *user_data)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int w
width of pict, undefined when pict is not set
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
static void flush(AVCodecContext *avctx)
static int teletext_close_decoder(AVCodecContext *avctx)
uint8_t subtitle_map[2048]
static void bprint_color(const char *type, AVBPrint *buf, vbi_page *page, unsigned ci)
#define BITMAP_CHAR_HEIGHT
const char * av_default_item_name(void *ptr)
Return the context name.
uint8_t * data[4]
data+linesize for the bitmap of this subtitle.
#define BITMAP_CHAR_WIDTH
AVCodec ff_libzvbi_teletext_decoder
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int flags2
AV_CODEC_FLAG2_*.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static int FUNC() user_data(CodedBitstreamContext *ctx, RWContext *rw, MPEG2RawUserData *current)
uint32_t end_display_time
static av_always_inline int ff_data_unit_id_is_teletext(int data_unit_id)
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
#define AVERROR_EXTERNAL
Generic error in an external library.
static int teletext_init_decoder(AVCodecContext *avctx)
@ SUBTITLE_BITMAP
A bitmap, pict will be set.
#define AV_LOG_INFO
Standard information.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int nb_colors
number of colors in pict, undefined when pict is not set
#define VBI_TRANSPARENT_BLACK
static const AVOption options[]
attribute_deprecated AVPicture pict
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const char * name
Name of the codec implementation.
static void teletext_flush(AVCodecContext *avctx)
static int teletext_decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr, AVPacket *pkt)
int h
height of pict, undefined when pict is not set
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static void subtitle_rect_free(AVSubtitleRect **sub_rect)
vbi_sliced sliced[MAX_SLICES]
void av_bprintf(AVBPrint *buf, const char *fmt,...)
main external API structure.
static const AVClass teletext_class
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define FF_DISABLE_DEPRECATION_WARNINGS
AVSubtitleRect * sub_rect
This structure stores compressed data.
static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top)
attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
int width
picture width / height.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_CODEC_FLAG2_RO_FLUSH_NOOP
Do not reset ASS ReadOrder field on flush (subtitles decoding)
static void fix_transparency(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_page *page, int chop_top, int resx, int resy)
static int chop_spaces_utf8(const unsigned char *t, int len)
uint32_t start_display_time
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
Append char c n times to a print buffer.
static int my_ass_subtitle_header(AVCodecContext *avctx)