Commit ea85437d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Remove picture qtype support code

All that code boiled down to selecting MPEG2 vs normal mode by the
postproc video filter. Now that libavcodec does not provide the data
anymore, the code had no more effects.
parent 818cd43f
......@@ -93,7 +93,6 @@ struct picture_t
unsigned int i_nb_fields; /**< # of displayed fields */
int8_t *p_q; /**< quantification table */
int i_qstride; /**< quantification stride */
int i_qtype; /**< quantification style */
/**@}*/
/** Private data - the video output plugin might want to put stuff here to
......@@ -250,20 +249,6 @@ VLC_API int picture_Setup( picture_t *, vlc_fourcc_t i_chroma, int i_width, int
VLC_API void picture_BlendSubpicture( picture_t *, filter_t *p_blend, subpicture_t * );
/*****************************************************************************
* Flags used to describe the status of a picture
*****************************************************************************/
/* Quantification type */
enum
{
QTYPE_NONE,
QTYPE_MPEG1,
QTYPE_MPEG2,
QTYPE_H264,
};
/*****************************************************************************
* Shortcuts to access image components
*****************************************************************************/
......
......@@ -336,8 +336,7 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
p_filter->fmt_in.video.i_width,
p_filter->fmt_in.video.i_height,
p_pic->p_q, p_pic->i_qstride,
p_sys->pp_mode, p_sys->pp_context,
p_pic->i_qtype == QTYPE_MPEG2 ? PP_PICT_TYPE_QP2 : 0 );
p_sys->pp_mode, p_sys->pp_context, 0 );
vlc_mutex_unlock( &p_sys->lock );
return CopyInfoAndRelease( p_outpic, p_pic );
......
......@@ -390,8 +390,6 @@ SOURCES_libvlc_common = \
video_output/snapshot.c \
video_output/snapshot.h \
video_output/statistic.h \
video_output/postprocessing.c \
video_output/postprocessing.h \
video_output/video_output.c \
video_output/video_text.c \
video_output/video_epg.c \
......
......@@ -119,7 +119,6 @@ void picture_Reset( picture_t *p_picture )
free( p_picture->p_q );
p_picture->p_q = NULL;
p_picture->i_qstride = 0;
p_picture->i_qtype = 0;
}
/*****************************************************************************
......@@ -148,7 +147,6 @@ int picture_Setup( picture_t *p_picture, vlc_fourcc_t i_chroma,
p_picture->i_nb_fields = 2;
p_picture->i_qtype = QTYPE_NONE;
p_picture->i_qstride = 0;
p_picture->p_q = NULL;
......
/*****************************************************************************
* postprocessing.c
*****************************************************************************
* Copyright (C) 2010 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <vlc_common.h>
#include <vlc_vout.h>
#include "postprocessing.h"
static bool PostProcessIsPresent(const char *filter)
{
const char *pp = "postproc";
const size_t pp_length = strlen(pp);
return filter &&
!strncmp(filter, pp, pp_length) &&
(filter[pp_length] == '\0' || filter[pp_length] == ':');
}
static int PostProcessCallback(vlc_object_t *object, char const *cmd,
vlc_value_t oldval, vlc_value_t newval, void *data)
{
vout_thread_t *vout = (vout_thread_t *)object;
VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(data);
static const char *pp = "postproc";
char *filters = var_GetString(vout, "video-filter");
if (newval.i_int <= 0) {
if (PostProcessIsPresent(filters)) {
strcpy(filters, &filters[strlen(pp)]);
if (*filters == ':')
strcpy(filters, &filters[1]);
}
} else {
if (!PostProcessIsPresent(filters)) {
if (filters) {
char *tmp = filters;
if (asprintf(&filters, "%s:%s", pp, tmp) < 0)
filters = tmp;
else
free(tmp);
} else {
filters = strdup(pp);
}
}
}
if (newval.i_int > 0)
var_SetInteger(vout, "postproc-q", newval.i_int);
if (filters) {
var_SetString(vout, "video-filter", filters);
free(filters);
} else if (newval.i_int > 0) {
var_TriggerCallback(vout, "video-filter");
}
return VLC_SUCCESS;
}
static void PostProcessEnable(vout_thread_t *vout)
{
vlc_value_t text;
msg_Dbg(vout, "Post-processing available");
var_Create(vout, "postprocess", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE);
text.psz_string = _("Post processing");
var_Change(vout, "postprocess", VLC_VAR_SETTEXT, &text, NULL);
for (int i = 0; i <= 6; i++) {
vlc_value_t val;
vlc_value_t text;
char tmp[1+1];
val.i_int = i;
snprintf(tmp, sizeof(tmp), "%d", i);
if (i == 0)
text.psz_string = _("Disable");
else
text.psz_string = tmp;
var_Change(vout, "postprocess", VLC_VAR_ADDCHOICE, &val, &text);
}
var_AddCallback(vout, "postprocess", PostProcessCallback, NULL);
/* */
char *filters = var_GetNonEmptyString(vout, "video-filter");
int postproc_q = 0;
if (PostProcessIsPresent(filters))
postproc_q = var_CreateGetInteger(vout, "postproc-q");
var_SetInteger(vout, "postprocess", postproc_q);
free(filters);
}
static void PostProcessDisable(vout_thread_t *vout)
{
msg_Dbg(vout, "Post-processing no more available");
var_Destroy(vout, "postprocess");
}
void vout_SetPostProcessingState(vout_thread_t *vout, vout_postprocessing_support_t *state, int qtype)
{
const int postproc_change = (qtype != QTYPE_NONE) - (state->qtype != QTYPE_NONE);
if (postproc_change == 1)
PostProcessEnable(vout);
else if (postproc_change == -1)
PostProcessDisable(vout);
if (postproc_change)
state->qtype = qtype;
}
/*****************************************************************************
* postprocessing.h: Post processing related helpers
*****************************************************************************
* Copyright (C) 2010 Laurent Aimar
* $Id$
*
* Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef LIBVLC_VOUT_POSTPROCESSING_H
#define LIBVLC_VOUT_POSTPROCESSING_H
typedef struct {
int qtype;
} vout_postprocessing_support_t;
void vout_SetPostProcessingState(vout_thread_t *, vout_postprocessing_support_t *, int qtype);
#endif
......@@ -49,7 +49,6 @@
#include <libvlc.h>
#include "vout_internal.h"
#include "interlacing.h"
#include "postprocessing.h"
#include "display.h"
/*****************************************************************************
......@@ -855,7 +854,6 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool is_
vout->p->displayed.decoded = picture_Hold(decoded);
vout->p->displayed.timestamp = decoded->date;
vout->p->displayed.is_interlaced = !decoded->b_progressive;
vout->p->displayed.qtype = decoded->i_qtype;
picture = filter_chain_VideoFilter(vout->p->filter.chain_static, decoded);
}
......@@ -1128,8 +1126,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
static void ThreadManage(vout_thread_t *vout,
mtime_t *deadline,
vout_interlacing_support_t *interlacing,
vout_postprocessing_support_t *postprocessing)
vout_interlacing_support_t *interlacing)
{
vlc_mutex_lock(&vout->p->picture_lock);
......@@ -1139,14 +1136,10 @@ static void ThreadManage(vout_thread_t *vout,
break;
}
const int picture_qtype = vout->p->displayed.qtype;
const bool picture_interlaced = vout->p->displayed.is_interlaced;
vlc_mutex_unlock(&vout->p->picture_lock);
/* Post processing */
vout_SetPostProcessingState(vout, postprocessing, picture_qtype);
/* Deinterlacing */
vout_SetInterlacingState(vout, interlacing, picture_interlaced);
......@@ -1364,7 +1357,6 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
vout->p->displayed.decoded = NULL;
vout->p->displayed.date = VLC_TS_INVALID;
vout->p->displayed.timestamp = VLC_TS_INVALID;
vout->p->displayed.qtype = QTYPE_NONE;
vout->p->displayed.is_interlaced = false;
vout->p->step.last = VLC_TS_INVALID;
......@@ -1480,9 +1472,6 @@ static void *Thread(void *object)
.is_interlaced = false,
.date = mdate(),
};
vout_postprocessing_support_t postprocessing = {
.qtype = QTYPE_NONE,
};
mtime_t deadline = VLC_TS_INVALID;
for (;;) {
......@@ -1576,7 +1565,7 @@ static void *Thread(void *object)
vout_control_cmd_Clean(&cmd);
}
ThreadManage(vout, &deadline, &interlacing, &postprocessing);
ThreadManage(vout, &deadline, &interlacing);
}
}
......@@ -91,7 +91,6 @@ struct vout_thread_sys_t
struct {
mtime_t date;
mtime_t timestamp;
int qtype;
bool is_interlaced;
picture_t *decoded;
picture_t *current;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment