MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / mpeg_decode_user_data

Function mpeg_decode_user_data

libavcodec/mpeg12dec.c:2108–2175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2106}
2107
2108static void mpeg_decode_user_data(AVCodecContext *avctx,
2109 const uint8_t *p, int buf_size)
2110{
2111 const uint8_t *buf_end = p + buf_size;
2112 Mpeg1Context *s1 = avctx->priv_data;
2113
2114#if 0
2115 int i;
2116 for(i=0; !(!p[i-2] && !p[i-1] && p[i]==1) && i<buf_size; i++){
2117 av_log(avctx, AV_LOG_ERROR, "%c", p[i]);
2118 }
2119 av_log(avctx, AV_LOG_ERROR, "\n");
2120#endif
2121
2122 if (buf_size > 29){
2123 int i;
2124 for(i=0; i<20; i++)
2125 if (!memcmp(p+i, "\0TMPGEXS\0", 9)){
2126 s1->tmpgexs = 1;
2127 }
2128 }
2129 /* we parse the DTG active format information */
2130 if (buf_end - p >= 5 &&
2131 p[0] == 'D' && p[1] == 'T' && p[2] == 'G' && p[3] == '1') {
2132 int flags = p[4];
2133 p += 5;
2134 if (flags & 0x80) {
2135 /* skip event id */
2136 p += 2;
2137 }
2138 if (flags & 0x40) {
2139 if (buf_end - p < 1)
2140 return;
2141 s1->has_afd = 1;
2142 s1->afd = p[0] & 0x0f;
2143 }
2144 } else if (buf_end - p >= 6 &&
2145 p[0] == 'J' && p[1] == 'P' && p[2] == '3' && p[3] == 'D' &&
2146 p[4] == 0x03) { // S3D_video_format_length
2147 // the 0x7F mask ignores the reserved_bit value
2148 const uint8_t S3D_video_format_type = p[5] & 0x7F;
2149
2150 if (S3D_video_format_type == 0x03 ||
2151 S3D_video_format_type == 0x04 ||
2152 S3D_video_format_type == 0x08 ||
2153 S3D_video_format_type == 0x23) {
2154
2155 s1->has_stereo3d = 1;
2156
2157 switch (S3D_video_format_type) {
2158 case 0x03:
2159 s1->stereo3d_type = AV_STEREO3D_SIDEBYSIDE;
2160 break;
2161 case 0x04:
2162 s1->stereo3d_type = AV_STEREO3D_TOPBOTTOM;
2163 break;
2164 case 0x08:
2165 s1->stereo3d_type = AV_STEREO3D_2D;

Callers 1

decode_chunksFunction · 0.85

Calls 2

av_logFunction · 0.85
mpeg_decode_a53_ccFunction · 0.85

Tested by

no test coverage detected