[vlc-commits] [Git][videolan/vlc][master] 16 commits: avcodec/subtitle: log the unknown subtitle type
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Oct 31 07:27:15 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
ce7efde1 by Steve Lhomme at 2023-10-31T07:38:41+01:00
avcodec/subtitle: log the unknown subtitle type
If there's a text type we should be able to handle it.
- - - - -
26487814 by Steve Lhomme at 2023-10-31T07:45:19+01:00
arib/substext: simplify text region creation
- - - - -
836a9c50 by Steve Lhomme at 2023-10-31T07:45:29+01:00
dvdbsub: directly pass the region to encode_clut()
- - - - -
143e0125 by Steve Lhomme at 2023-10-31T07:45:29+01:00
bluray: return early if the region creation fails
- - - - -
c7a4b13a by Steve Lhomme at 2023-10-31T07:45:29+01:00
zvbi: simplify usage of the region format
We only need it in one location and we don't need a copy.
- - - - -
b16c3726 by Steve Lhomme at 2023-10-31T07:45:29+01:00
zvbi: simplify usage of the spu->p_region
And no need to initialize the region position to 0.
- - - - -
ff39472c by Steve Lhomme at 2023-10-31T07:45:29+01:00
spudec: simplify usage of the spu->p_region
- - - - -
262a572c by Steve Lhomme at 2023-10-31T07:45:29+01:00
kate: simplify usage of the spu->p_region
- - - - -
4d925edc by Steve Lhomme at 2023-10-31T07:45:29+01:00
substx3g: simplify usage of the spu->p_region
- - - - -
c0f7ca33 by Steve Lhomme at 2023-10-31T07:45:29+01:00
marq: simplify usage of the spu->p_region
- - - - -
e21ecd8c by Steve Lhomme at 2023-10-31T07:45:29+01:00
rss: simplify usage of the spu->p_region
- - - - -
657aee0a by Steve Lhomme at 2023-10-31T07:45:29+01:00
subsusf: directly fill spu->p_region in ParseUSFString()
- - - - -
ed652367 by Steve Lhomme at 2023-10-31T07:45:29+01:00
telx: simplify usage of the spu->p_region
- - - - -
482d2df5 by Steve Lhomme at 2023-10-31T07:45:29+01:00
test/opengl: simplify usage of the subpicture->p_region
- - - - -
64721b92 by Steve Lhomme at 2023-10-31T07:45:29+01:00
test/decoder: simplify usage of the subpic->p_region
- - - - -
49058633 by Steve Lhomme at 2023-10-31T07:45:29+01:00
kate: favor appending region to prepending
That allows more flexibility in the choice of container.
- - - - -
14 changed files:
- modules/access/bluray.c
- modules/codec/arib/substext.h
- modules/codec/avcodec/subtitle.c
- modules/codec/dvbsub.c
- modules/codec/kate.c
- modules/codec/spudec/parse.c
- modules/codec/substx3g.c
- modules/codec/subsusf.c
- modules/codec/telx.c
- modules/codec/zvbi.c
- modules/spu/marq.c
- modules/spu/rss.c
- test/modules/video_output/opengl/sub_renderer.c
- test/src/input/decoder/input_decoder_scenarios.c
Changes:
=====================================
modules/access/bluray.c
=====================================
@@ -2045,7 +2045,8 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
#else
const vlc_fourcc_t rgbchroma = VLC_CODEC_BGRA;
#endif
- if (!ov->p_regions)
+ subpicture_region_t *p_reg = ov->p_regions;
+ if (!p_reg)
{
video_format_t fmt;
video_format_Init(&fmt, 0);
@@ -2053,12 +2054,16 @@ static void blurayDrawArgbOverlay(demux_t *p_demux, const BD_ARGB_OVERLAY* const
rgbchroma,
eventov->stride, ov->height,
ov->width, ov->height, 1, 1);
- ov->p_regions = subpicture_region_New(&fmt);
+ p_reg = subpicture_region_New(&fmt);
+ if (unlikely(p_reg == NULL)) {
+ vlc_mutex_unlock(&ov->lock);
+ return;
+ }
+ ov->p_regions = p_reg;
}
/* Find a region to update */
- subpicture_region_t *p_reg = ov->p_regions;
- if (!p_reg || p_reg->fmt.i_chroma != rgbchroma) {
+ if (p_reg->fmt.i_chroma != rgbchroma) {
vlc_mutex_unlock(&ov->lock);
return;
}
=====================================
modules/codec/arib/substext.h
=====================================
@@ -73,22 +73,21 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
return;
}
- subpicture_region_t *r = NULL;
+ subpicture_region_t *r, **last = &subpic->p_region;
arib_text_region_t *p_region;
for( p_region = sys->p_region; p_region; p_region = p_region->p_next )
{
- if( !r )
+ r = subpicture_region_NewText();
+ if( r == NULL )
{
- subpic->p_region = r = subpicture_region_NewText();
+ return;
}
+ if (*last == NULL)
+ *last = r;
else
{
- r->p_next = subpicture_region_NewText();
- r = r->p_next;
- }
- if( r == NULL )
- {
- return;
+ (*last)->p_next = r;
+ *last = r;
}
r->fmt.i_sar_num = 1;
r->fmt.i_sar_den = 1;
=====================================
modules/codec/avcodec/subtitle.c
=====================================
@@ -354,8 +354,7 @@ static subpicture_t *ConvertSubtitle(decoder_t *dec, AVSubtitle *ffsub, vlc_tick
region = ConvertRegionRGBA(rec);
break;
default:
- msg_Warn(dec, "unsupported subtitle type");
- region = NULL;
+ msg_Warn(dec, "unsupported subtitle type %" PRIu16, ffsub->format);
break;
}
if (region) {
=====================================
modules/codec/dvbsub.c
=====================================
@@ -1684,7 +1684,7 @@ typedef struct
#ifdef ENABLE_SOUT
static void encode_page_composition( encoder_t *, bs_t *, subpicture_t * );
-static void encode_clut( encoder_t *, bs_t *, subpicture_t * );
+static void encode_clut( encoder_t *, bs_t *, subpicture_region_t * );
static void encode_region_composition( encoder_t *, bs_t *, subpicture_t * );
static void encode_object( encoder_t *, bs_t *, subpicture_t * );
@@ -1987,7 +1987,7 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
encode_page_composition( p_enc, s, p_subpic );
encode_region_composition( p_enc, s, p_subpic );
- encode_clut( p_enc, s, p_subpic );
+ encode_clut( p_enc, s, p_region );
encode_object( p_enc, s, p_subpic );
/* End of display */
@@ -2123,10 +2123,9 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
}
}
-static void encode_clut( encoder_t *p_enc, bs_t *s, subpicture_t *p_subpic )
+static void encode_clut( encoder_t *p_enc, bs_t *s, subpicture_region_t *p_region )
{
encoder_sys_t *p_sys = p_enc->p_sys;
- subpicture_region_t *p_region = p_subpic->p_region;
video_palette_t *p_pal, empty_palette = { .i_entries = 4 };
/* Sanity check */
=====================================
modules/codec/kate.c
=====================================
@@ -703,7 +703,7 @@ static void CreateKatePalette( video_palette_t *fmt_palette, const kate_palette
}
}
-static void SetupText( decoder_t *p_dec, subpicture_t *p_spu, const kate_event *ev )
+static void SetupText( decoder_t *p_dec, subpicture_region_t *p_region, const kate_event *ev )
{
decoder_sys_t *p_sys = p_dec->p_sys;
@@ -718,10 +718,10 @@ static void SetupText( decoder_t *p_dec, subpicture_t *p_spu, const kate_event *
case kate_markup_none:
case kate_markup_simple:
if( p_sys->b_formatted )
-// p_spu->p_region->p_text = ParseSubtitles(&p_spu->p_region->i_align, ev->text );
+// p_region->p_text = ParseSubtitles(&p_region->i_align, ev->text );
;//FIXME
else
- p_spu->p_region->p_text = text_segment_New( ev->text ); /* no leak, this actually gets killed by the core */
+ p_region->p_text = text_segment_New( ev->text ); /* no leak, this actually gets killed by the core */
break;
default:
/* we don't know about this one, so remove markup and display as text */
@@ -729,7 +729,7 @@ static void SetupText( decoder_t *p_dec, subpicture_t *p_spu, const kate_event *
char *copy = strdup( ev->text );
size_t len0 = strlen( copy ) + 1;
kate_text_remove_markup( ev->text_encoding, copy, &len0 );
- p_spu->p_region->p_text = text_segment_New( copy );
+ p_region->p_text = text_segment_New( copy );
free( copy );
}
break;
@@ -1143,8 +1143,8 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
}
/* text region */
- p_spu->p_region = subpicture_region_NewText();
- if( !p_spu->p_region )
+ subpicture_region_t *p_region = subpicture_region_NewText();
+ if( unlikely(p_region == NULL) )
{
msg_Err( p_dec, "cannot allocate SPU region" );
if( p_bitmap_region )
@@ -1152,27 +1152,27 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
subpicture_Delete( p_spu );
return NULL;
}
- p_spu->p_region->fmt.i_sar_num = 0;
- p_spu->p_region->fmt.i_sar_den = 1;
+ p_region->fmt.i_sar_num = 0;
+ p_region->fmt.i_sar_den = 1;
- SetupText( p_dec, p_spu, ev );
+ SetupText( p_dec, p_region, ev );
/* default positioning */
- p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;
+ p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;
if (p_bitmap_region)
{
p_bitmap_region->i_align = SUBPICTURE_ALIGN_BOTTOM;
}
- p_spu->p_region->i_x = 0;
- p_spu->p_region->i_y = 10;
+ p_region->i_x = 0;
+ p_region->i_y = 10;
/* override if tracker info present */
if (b_tracker_valid)
{
if (kin.has.region)
{
- p_spu->p_region->i_x = kin.region_x;
- p_spu->p_region->i_y = kin.region_y;
+ p_region->i_x = kin.region_x;
+ p_region->i_y = kin.region_y;
if (p_bitmap_region)
{
p_bitmap_region->i_x = kin.region_x;
@@ -1187,9 +1187,11 @@ static subpicture_t *SetupSimpleKateSPU( decoder_t *p_dec, subpicture_t *p_spu,
/* if we have a bitmap, chain it before the text */
if (p_bitmap_region)
{
- p_bitmap_region->p_next = p_spu->p_region;
p_spu->p_region = p_bitmap_region;
+ p_bitmap_region->p_next = p_region;
}
+ else
+ p_spu->p_region = p_region;
return p_spu;
}
=====================================
modules/codec/spudec/parse.c
=====================================
@@ -105,10 +105,10 @@ static void CLUTIdxToYUV(const struct subs_format_t *subs,
}
static void ParsePXCTLI( decoder_t *p_dec, const subpicture_data_t *p_spu_data,
- subpicture_t *p_spu )
+ subpicture_region_t *p_region )
{
- plane_t *p_plane = &p_spu->p_region->p_picture->p[0];
- video_palette_t *p_palette = p_spu->p_region->fmt.p_palette;
+ plane_t *p_plane = &p_region->p_picture->p[0];
+ video_palette_t *p_palette = p_region->fmt.p_palette;
if( !p_dec->fmt_in->subs.spu.b_palette )
return;
@@ -168,8 +168,8 @@ static void ParsePXCTLI( decoder_t *p_dec, const subpicture_data_t *p_spu_data,
index_map[j] = i_index;
}
- if( p_spu->p_region->i_x >= i_col )
- i_col -= p_spu->p_region->i_x;
+ if( p_region->i_x >= i_col )
+ i_col -= p_region->i_x;
for( int j=0; j<p_plane->i_visible_lines; j++ )
{
@@ -253,7 +253,7 @@ static void OutputPicture( decoder_t *p_dec,
free( p_pixeldata );
if( p_spu_data->p_pxctli && p_spu )
- ParsePXCTLI( p_dec, p_spu_data, p_spu );
+ ParsePXCTLI( p_dec, p_spu_data, p_spu->p_region );
pf_queue( p_dec, p_spu );
}
@@ -859,19 +859,20 @@ static int Render( decoder_t *p_dec, subpicture_t *p_spu,
fmt.p_palette->palette[i_x][3] = p_spu_data->pi_alpha[i_x] * 0x11;
}
- p_spu->p_region = subpicture_region_New( &fmt );
- if( !p_spu->p_region )
+ subpicture_region_t *p_region = subpicture_region_New( &fmt );
+ if( !p_region )
{
fmt.p_palette = NULL;
video_format_Clean( &fmt );
msg_Err( p_dec, "cannot allocate SPU region" );
return VLC_EGENERIC;
}
+ p_spu->p_region = p_region;
- p_spu->p_region->i_x = p_spu_properties->i_x;
- p_spu->p_region->i_y = p_spu_properties->i_y + p_spu_data->i_y_top_offset;
- p_p = p_spu->p_region->p_picture->p->p_pixels;
- i_pitch = p_spu->p_region->p_picture->p->i_pitch;
+ p_region->i_x = p_spu_properties->i_x;
+ p_region->i_y = p_spu_properties->i_y + p_spu_data->i_y_top_offset;
+ p_p = p_region->p_picture->p->p_pixels;
+ i_pitch = p_region->p_picture->p->i_pitch;
/* Draw until we reach the bottom of the subtitle */
for( i_y = 0; i_y < (int)fmt.i_height * i_pitch; i_y += i_pitch )
=====================================
modules/codec/substx3g.c
=====================================
@@ -702,9 +702,8 @@ static block_t *GetStylBlock( const text_segment_t *p_segment, size_t i_styles )
static block_t * Encode( encoder_t *p_enc, subpicture_t *p_spu )
{
VLC_UNUSED(p_enc);
- const text_segment_t *p_segments = (p_spu->p_region)
- ? p_spu->p_region->p_text
- : NULL;
+ const subpicture_region_t *p_region = p_spu->p_region;
+ const text_segment_t *p_segments = p_region ? p_region->p_text : NULL;
size_t i_len = 0;
size_t i_styles = 0;
=====================================
modules/codec/subsusf.c
=====================================
@@ -104,7 +104,7 @@ static int ParseImageAttachments( decoder_t *p_dec );
static subpicture_t *ParseText ( decoder_t *, block_t * );
static void ParseUSFHeader( decoder_t * );
-static subpicture_region_t *ParseUSFString( decoder_t *, char * );
+static void ParseUSFString( decoder_t *, char *, subpicture_region_t ** );
static subpicture_region_t *LoadEmbeddedImage( decoder_t *p_dec, const char *psz_filename, int i_transparent_color );
/*****************************************************************************
@@ -258,7 +258,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
}
/* Decode USF strings */
- p_spu->p_region = ParseUSFString( p_dec, psz_subtitle );
+ ParseUSFString( p_dec, psz_subtitle, &p_spu->p_region );
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
@@ -805,12 +805,13 @@ static void ParseUSFHeaderTags( decoder_t *p_dec, xml_reader_t *p_xml_reader )
-static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
- char *psz_subtitle )
+static void ParseUSFString( decoder_t *p_dec,
+ char *psz_subtitle,
+ subpicture_region_t **regions )
{
decoder_sys_t *p_sys = p_dec->p_sys;
- subpicture_region_t *p_region_first = NULL;
- subpicture_region_t *p_region_upto = p_region_first;
+ *regions = NULL;
+ subpicture_region_t *p_region_upto = NULL;
while( *psz_subtitle )
{
@@ -842,14 +843,14 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
p_sys->i_align );
if( p_text_region )
{
- if( !p_region_first )
+ if( *regions == NULL)
{
- p_region_first = p_region_upto = p_text_region;
+ *regions = p_region_upto = p_text_region;
}
else
{
p_region_upto->p_next = p_text_region;
- p_region_upto = p_region_upto->p_next;
+ p_region_upto = p_text_region;
}
}
else free( psz_flat );
@@ -901,16 +902,15 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
{
SetupPositions( p_image_region, psz_subtitle );
- p_image_region->p_next = NULL;
- }
- if( !p_region_first )
- {
- p_region_first = p_region_upto = p_image_region;
- }
- else if( p_image_region )
- {
- p_region_upto->p_next = p_image_region;
- p_region_upto = p_region_upto->p_next;
+ if( *regions == NULL)
+ {
+ *regions = p_region_upto = p_image_region;
+ }
+ else
+ {
+ p_region_upto->p_next = p_image_region;
+ p_region_upto = p_image_region;
+ }
}
}
else
@@ -928,14 +928,14 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
p_sys->i_align );
if( p_text_region )
{
- if( !p_region_first )
+ if( *regions == NULL)
{
- p_region_first = p_region_upto = p_text_region;
+ *regions = p_region_upto = p_text_region;
}
else
{
p_region_upto->p_next = p_text_region;
- p_region_upto = p_region_upto->p_next;
+ p_region_upto = p_text_region;
}
}
else free( psz_flat );
@@ -949,8 +949,6 @@ static subpicture_region_t *ParseUSFString( decoder_t *p_dec,
psz_subtitle++;
}
-
- return p_region_first;
}
/*****************************************************************************
=====================================
modules/codec/telx.c
=====================================
@@ -729,18 +729,19 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
/* Create a new subpicture region */
- p_spu->p_region = subpicture_region_NewText();
- if( p_spu->p_region == NULL )
+ subpicture_region_t *p_region = subpicture_region_NewText();
+ if( p_region == NULL )
{
msg_Err( p_dec, "cannot allocate SPU region" );
goto error;
}
+ p_spu->p_region = p_region;
/* Normal text subs, easy markup */
- p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
- p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
- p_spu->p_region->i_y = 10;
- p_spu->p_region->p_text = text_segment_New(psz_text);
+ p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
+ p_region->i_x = p_sys->i_align ? 20 : 0;
+ p_region->i_y = 10;
+ p_region->p_text = text_segment_New(psz_text);
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
=====================================
modules/codec/zvbi.c
=====================================
@@ -305,7 +305,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
{
decoder_sys_t *p_sys = p_dec->p_sys;
subpicture_t *p_spu = NULL;
- video_format_t fmt;
bool b_cached = false;
vbi_page p_page;
@@ -391,8 +390,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
if( !p_spu )
goto error;
- fmt = p_spu->p_region->fmt;
-
p_sys->b_update = true;
p_sys->i_last_page = i_wanted_page;
goto exit;
@@ -429,8 +426,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
if( !p_spu )
goto error;
- fmt = p_spu->p_region->fmt;
-
if( !p_sys->b_text && i_num_rows == 0 )
{
p_spu->b_ephemer = false;
@@ -483,13 +478,14 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
else
{
- picture_t *p_pic = p_spu->p_region->p_picture;
+ subpicture_region_t *p_region = p_spu->p_region;
+ picture_t *p_pic = p_region->p_picture;
/* ZVBI is stupid enough to assume pitch == width */
- p_pic->p->i_pitch = 4 * fmt.i_width;
+ p_pic->p->i_pitch = 4 * p_region->fmt.i_width;
/* Maintain subtitle position */
- p_spu->p_region->i_y = i_first_row*10;
+ p_region->i_y = i_first_row*10;
if (p_page.columns > 0 && p_page.rows > 0)
{
p_spu->i_original_picture_width = p_page.columns*12;
@@ -497,7 +493,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
}
vbi_draw_vt_page_region( &p_page, ZVBI_PIXFMT_RGBA32,
- p_spu->p_region->p_picture->p->p_pixels, -1,
+ p_region->p_picture->p->p_pixels, -1,
0, i_first_row, p_page.columns, i_num_rows,
1, 1);
@@ -505,7 +501,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
memcpy( p_sys->nav_link, &p_page.nav_link, sizeof( p_sys->nav_link )) ;
vlc_mutex_unlock( &p_sys->lock );
- OpaquePage( p_pic, &p_page, &fmt, b_opaque, i_first_row * p_page.columns );
+ OpaquePage( p_pic, &p_page, &p_region->fmt, b_opaque, i_first_row * p_page.columns );
}
exit:
@@ -540,6 +536,7 @@ static subpicture_t *Subpicture( decoder_t *p_dec,
return NULL;
}
+ subpicture_region_t *p_region;
if( !b_text )
{
video_format_t fmt;
@@ -547,22 +544,20 @@ static subpicture_t *Subpicture( decoder_t *p_dec,
fmt.i_width = fmt.i_visible_width = i_columns * 12;
fmt.i_height = fmt.i_visible_height = i_rows * 10;
fmt.i_sar_num = fmt.i_sar_den = 0; /* let the vout set the correct AR */
- p_spu->p_region = subpicture_region_New( &fmt );
+ p_region = subpicture_region_New( &fmt );
}
else
{
- p_spu->p_region = subpicture_region_NewText();
+ p_region = subpicture_region_NewText();
}
- if( p_spu->p_region == NULL )
+ if( p_region == NULL )
{
msg_Err( p_dec, "cannot allocate SPU region" );
subpicture_Delete( p_spu );
return NULL;
}
-
- p_spu->p_region->i_x = 0;
- p_spu->p_region->i_y = 0;
+ p_spu->p_region = p_region;
p_spu->i_start = i_pts;
p_spu->i_stop = b_text ? i_pts + VLC_TICK_FROM_SEC(10): 0;
@@ -570,9 +565,9 @@ static subpicture_t *Subpicture( decoder_t *p_dec,
p_spu->b_absolute = b_text ? false : true;
if( !b_text )
- p_spu->p_region->i_align = i_align;
- p_spu->i_original_picture_width = p_spu->p_region->fmt.i_width;
- p_spu->i_original_picture_height = p_spu->p_region->fmt.i_height;
+ p_region->i_align = i_align;
+ p_spu->i_original_picture_width = p_region->fmt.i_width;
+ p_spu->i_original_picture_height = p_region->fmt.i_height;
return p_spu;
}
=====================================
modules/spu/marq.c
=====================================
@@ -284,18 +284,19 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
if( !p_spu )
goto out;
- p_spu->p_region = subpicture_region_NewText();
- if( !p_spu->p_region )
+ subpicture_region_t *p_region = subpicture_region_NewText();
+ if( !p_region )
{
subpicture_Delete( p_spu );
p_spu = NULL;
goto out;
}
- p_spu->p_region->fmt.i_sar_den = p_spu->p_region->fmt.i_sar_num = 1;
+ p_spu->p_region = p_region;
+ p_region->fmt.i_sar_den = p_region->fmt.i_sar_num = 1;
p_sys->last_time = date;
- p_spu->p_region->p_text = text_segment_New( msg );
+ p_region->p_text = text_segment_New( msg );
p_spu->i_start = date;
p_spu->i_stop = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout;
p_spu->b_ephemer = true;
@@ -303,19 +304,19 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
/* where to locate the string: */
if( p_sys->i_pos < 0 )
{ /* set to an absolute xy */
- p_spu->p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
+ p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
p_spu->b_absolute = true;
}
else
{ /* set to one of the 9 relative locations */
- p_spu->p_region->i_align = p_sys->i_pos;
+ p_region->i_align = p_sys->i_pos;
p_spu->b_absolute = false;
}
- p_spu->p_region->i_x = p_sys->i_xoff;
- p_spu->p_region->i_y = p_sys->i_yoff;
+ p_region->i_x = p_sys->i_xoff;
+ p_region->i_y = p_sys->i_yoff;
- p_spu->p_region->p_text->style = text_style_Duplicate( p_sys->p_style );
+ p_region->p_text->style = text_style_Duplicate( p_sys->p_style );
out:
vlc_mutex_unlock( &p_sys->lock );
=====================================
modules/spu/rss.c
=====================================
@@ -402,13 +402,14 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
return NULL;
}
- p_spu->p_region = subpicture_region_NewText();
- if( !p_spu->p_region )
+ subpicture_region_t *region = subpicture_region_NewText();
+ if( !region )
{
subpicture_Delete( p_spu );
vlc_mutex_unlock( &p_sys->lock );
return NULL;
}
+ p_spu->p_region = region;
/* Generate the string that will be displayed. This string is supposed to
be p_sys->i_length characters long. */
@@ -472,9 +473,9 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
free( a2 );
}
- p_spu->p_region->p_text = text_segment_New(p_sys->psz_marquee);
+ region->p_text = text_segment_New(p_sys->psz_marquee);
if( p_sys->p_style->i_font_size > 0 )
- p_spu->p_region->fmt.i_visible_height = p_sys->p_style->i_font_size;
+ region->fmt.i_visible_height = p_sys->p_style->i_font_size;
p_spu->i_start = date;
p_spu->i_stop = 0;
p_spu->b_ephemer = true;
@@ -482,18 +483,18 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
/* where to locate the string: */
if( p_sys->i_pos < 0 )
{ /* set to an absolute xy */
- p_spu->p_region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
+ region->i_align = SUBPICTURE_ALIGN_LEFT | SUBPICTURE_ALIGN_TOP;
p_spu->b_absolute = true;
}
else
{ /* set to one of the 9 relative locations */
- p_spu->p_region->i_align = p_sys->i_pos;
+ region->i_align = p_sys->i_pos;
p_spu->b_absolute = false;
}
- p_spu->p_region->i_x = p_sys->i_xoff;
- p_spu->p_region->i_y = p_sys->i_yoff;
+ region->i_x = p_sys->i_xoff;
+ region->i_y = p_sys->i_yoff;
- p_spu->p_region->p_text->style = text_style_Duplicate( p_sys->p_style );
+ region->p_text->style = text_style_Duplicate( p_sys->p_style );
if( p_feed->p_pic )
{
@@ -516,12 +517,12 @@ static subpicture_t *Filter( filter_t *p_filter, vlc_tick_t date )
}
else
{
- p_region->i_x = p_spu->p_region->i_x;
- p_region->i_y = p_spu->p_region->i_y;
- p_spu->p_region->p_next = p_region;
+ p_region->i_x = region->i_x;
+ p_region->i_y = region->i_y;
+ region->p_next = p_region;
/* Offset text to display right next to the image */
- p_spu->p_region->i_x += fmt_out.i_visible_width;
+ region->i_x += fmt_out.i_visible_width;
}
video_format_Clean(&fmt_out);
}
=====================================
test/modules/video_output/opengl/sub_renderer.c
=====================================
@@ -178,8 +178,9 @@ static void test_opengl_offscreen(
subpicture->i_original_picture_width = 4;
subpicture->i_original_picture_height = 4;
- subpicture->p_region = subpicture_region_ForPicture(&fmt, picture);
- assert(subpicture->p_region != NULL);
+ subpicture_region_t *p_region = subpicture_region_ForPicture(&fmt, picture);
+ assert(p_region != NULL);
+ subpicture->p_region = p_region;
ret = vlc_gl_sub_renderer_Prepare(sr, subpicture);
assert(ret == VLC_SUCCESS);
@@ -293,7 +294,7 @@ int main( int argc, char **argv )
{ 2, 1, black },
{ 2, 2, black },
};
- test_opengl_offscreen(root, ORIENT_NORMAL,
+ test_opengl_offscreen(root, ORIENT_NORMAL,
points_normal, ARRAY_SIZE(points_normal));
struct test_point points_rotated_90[] = {
=====================================
test/src/input/decoder/input_decoder_scenarios.c
=====================================
@@ -482,11 +482,12 @@ static int cc_decoder_decode_common(decoder_t *dec, vlc_frame_t *in,
subpic->i_start = in->i_pts;
subpic->i_stop = subpic->i_start + in->i_length;
- subpic->p_region = subpicture_region_NewText();
- assert(subpic->p_region != NULL);
+ subpicture_region_t *p_region = subpicture_region_NewText();;
+ assert(p_region != NULL);
+ subpic->p_region = p_region;
- subpic->p_region->p_text = text_segment_New(text);
- assert(subpic->p_region->p_text != NULL);
+ p_region->p_text = text_segment_New(text);
+ assert(p_region->p_text != NULL);
decoder_QueueSub(dec, subpic);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/443a2a4e84ce03955362556a52eb72d747e37256...4905863389c97402227428710bf67e795cb271a3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/443a2a4e84ce03955362556a52eb72d747e37256...4905863389c97402227428710bf67e795cb271a3
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list