History

lavc: Add properties field to AVCodecContext.

The new field can hold information about losslessness and closed captions for now.

Carl Eugen Hoyos committed 11 years ago

Commit 8dad2131 parent 7aafac99 files · +36 −1Browse files

Unified · Split

9 files
  1. doc/APIchanges +4 −0
  2. libavcodec/avcodec.h +12 −0
  3. libavcodec/h264.c +1 −0
  4. libavcodec/mjpegdec.c +2 −0
  5. libavcodec/mpeg12dec.c +1 −0
  6. libavcodec/utils.c +12 −0
  7. libavcodec/version.h +1 −1
  8. libavcodec/vp9.c +2 −0
  9. libavcodec/webp.c +1 −0
doc/APIchanges+4−0
@@ -15,6 +15,10 @@ libavutil: 2014-08-09 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182015-07-16 - xxxxxxxx - lavc 56.49.100
19 Add av_codec_get_codec_properties(), FF_CODEC_PROPERTY_LOSSLESS
20 and FF_CODEC_PROPERTY_CLOSED_CAPTIONS
21
182015-xx-xx - xxxxxxx - lavu 56.15.0222015-xx-xx - xxxxxxx - lavu 56.15.0
19 Add av_version_info().23 Add av_version_info().
20 24
libavcodec/avcodec.h+12−0
@@ -3173,6 +3173,16 @@ typedef struct AVCodecContext { · 3172 unmodified lines
3173 * - decoding: set by user through AVOPtions (NO direct access)3173 * - decoding: set by user through AVOPtions (NO direct access)
3174 */3174 */
3175 char *codec_whitelist;3175 char *codec_whitelist;
3176
3177 /*
3178 * Properties of the stream that gets decoded
3179 * To be accessed through av_codec_get_properties() (NO direct access)
3180 * - encoding: unused
3181 * - decoding: set by libavcodec
3182 */
3183 unsigned properties;
3184#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001
3185#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
3176} AVCodecContext;3186} AVCodecContext;
3177 3187
3178AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);3188AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
@@ -3181,6 +3191,8 @@ void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational · 2 unmodified lines
3181const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);3191const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx);
3182void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);3192void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc);
3183 3193
3194unsigned av_codec_get_codec_properties(const AVCodecContext *avctx);
3195
3184int av_codec_get_lowres(const AVCodecContext *avctx);3196int av_codec_get_lowres(const AVCodecContext *avctx);
3185void av_codec_set_lowres(AVCodecContext *avctx, int val);3197void av_codec_set_lowres(AVCodecContext *avctx, int val);
3186 3198
libavcodec/h264.c+1−0
@@ -886,6 +886,7 @@ static void decode_postinit(H264Context *h, int setup_finished) · 885 unmodified lines
886 memcpy(sd->data, h->a53_caption, h->a53_caption_size);886 memcpy(sd->data, h->a53_caption, h->a53_caption_size);
887 av_freep(&h->a53_caption);887 av_freep(&h->a53_caption);
888 h->a53_caption_size = 0;888 h->a53_caption_size = 0;
889 h->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
889 }890 }
890 891
891 cur->mmco_reset = h->mmco_reset;892 cur->mmco_reset = h->mmco_reset;
libavcodec/mjpegdec.c+2−0
@@ -2059,6 +2059,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 2058 unmodified lines
2059 goto fail;2059 goto fail;
2060 break;2060 break;
2061 case SOF3:2061 case SOF3:
2062 s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
2062 s->lossless = 1;2063 s->lossless = 1;
2063 s->ls = 0;2064 s->ls = 0;
2064 s->progressive = 0;2065 s->progressive = 0;
@@ -2066,6 +2067,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 1 unmodified line
2066 goto fail;2067 goto fail;
2067 break;2068 break;
2068 case SOF48:2069 case SOF48:
2070 s->avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
2069 s->lossless = 1;2071 s->lossless = 1;
2070 s->ls = 1;2072 s->ls = 1;
2071 s->progressive = 0;2073 s->progressive = 0;
libavcodec/mpeg12dec.c+1−0
@@ -1685,6 +1685,7 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 1684 unmodified lines
1685 if (sd)1685 if (sd)
1686 memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);1686 memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
1687 av_freep(&s1->a53_caption);1687 av_freep(&s1->a53_caption);
1688 avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
1688 }1689 }
1689 1690
1690 if (s1->has_stereo3d) {1691 if (s1->has_stereo3d) {
libavcodec/utils.c+12−0
@@ -1293,6 +1293,11 @@ MAKE_ACCESSORS(AVCodecContext, codec, int, lowres) · 1292 unmodified lines
1293MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll)1293MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll)
1294MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix)1294MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix)
1295 1295
1296unsigned av_codec_get_codec_properties(const AVCodecContext *codec)
1297{
1298 return codec->properties;
1299}
1300
1296int av_codec_get_max_lowres(const AVCodec *codec)1301int av_codec_get_max_lowres(const AVCodec *codec)
1297{1302{
1298 return codec->max_lowres;1303 return codec->max_lowres;
@@ -3147,6 +3152,13 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) · 1848 unmodified lines
3147 if (encode) {3152 if (encode) {
3148 snprintf(buf + strlen(buf), buf_size - strlen(buf),3153 snprintf(buf + strlen(buf), buf_size - strlen(buf),
3149 ", q=%d-%d", enc->qmin, enc->qmax);3154 ", q=%d-%d", enc->qmin, enc->qmax);
3155 } else {
3156 if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)
3157 snprintf(buf + strlen(buf), buf_size - strlen(buf),
3158 ", Closed Captions");
3159 if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS)
3160 snprintf(buf + strlen(buf), buf_size - strlen(buf),
3161 ", lossless");
3150 }3162 }
3151 break;3163 break;
3152 case AVMEDIA_TYPE_AUDIO:3164 case AVMEDIA_TYPE_AUDIO:
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29#include "libavutil/version.h"29#include "libavutil/version.h"
30 30
31#define LIBAVCODEC_VERSION_MAJOR 5631#define LIBAVCODEC_VERSION_MAJOR 56
32#define LIBAVCODEC_VERSION_MINOR 4832#define LIBAVCODEC_VERSION_MINOR 49
33#define LIBAVCODEC_VERSION_MICRO 10033#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavcodec/vp9.c+2−0
@@ -733,6 +733,8 @@ static int decode_frame_header(AVCodecContext *ctx, · 732 unmodified lines
733 s->uvac_qdelta = get_bits1(&s->gb) ? get_sbits_inv(&s->gb, 4) : 0;733 s->uvac_qdelta = get_bits1(&s->gb) ? get_sbits_inv(&s->gb, 4) : 0;
734 s->lossless = s->yac_qi == 0 && s->ydc_qdelta == 0 &&734 s->lossless = s->yac_qi == 0 && s->ydc_qdelta == 0 &&
735 s->uvdc_qdelta == 0 && s->uvac_qdelta == 0;735 s->uvdc_qdelta == 0 && s->uvac_qdelta == 0;
736 if (s->lossless)
737 ctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
736 738
737 /* segmentation header info */739 /* segmentation header info */
738 s->segmentation.ignore_refmap = 0;740 s->segmentation.ignore_refmap = 0;
libavcodec/webp.c+1−0
@@ -1417,6 +1417,7 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 1416 unmodified lines
1417 chunk_size, 0);1417 chunk_size, 0);
1418 if (ret < 0)1418 if (ret < 0)
1419 return ret;1419 return ret;
1420 avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
1420 }1421 }
1421 bytestream2_skip(&gb, chunk_size);1422 bytestream2_skip(&gb, chunk_size);
1422 break;1423 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t